From 99260acaf119b6b2b57dd10eb357fa1271bfc536 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sun, 6 Nov 2022 02:24:34 -0600 Subject: [PATCH] Use PlayState instead of GlobalContext (#1927) * Use PlayState instead of GlobalContext - GlobalContext -> PlayState - globalCtx -> play - GlobalCtx -> PlayState - globalContext -> playState * Find and replace Gameplay_ with Play_ * Correct some misnamed argument cases --- soh/include/functions.h | 1120 ++-- soh/include/macros.h | 4 +- soh/include/variables.h | 2 +- soh/include/z64.h | 22 +- soh/include/z64actor.h | 14 +- soh/include/z64animation.h | 16 +- soh/include/z64bgcheck.h | 4 +- soh/include/z64camera.h | 6 +- soh/include/z64effect.h | 10 +- soh/include/z64player.h | 6 +- soh/include/z64skin.h | 4 +- soh/soh/CrashHandlerExt.cpp | 10 +- .../crowd-control/CrowdControl.cpp | 18 +- soh/soh/Enhancements/debugconsole.cpp | 144 +- soh/soh/Enhancements/debugger/actorViewer.cpp | 32 +- soh/soh/Enhancements/debugger/colViewer.cpp | 38 +- .../Enhancements/debugger/debugSaveEditor.cpp | 38 +- soh/soh/Enhancements/gameconsole.c | 2 +- soh/soh/Enhancements/gameconsole.h | 2 +- soh/soh/Enhancements/gfx.c | 10 +- .../Enhancements/item-tables/ItemTableTypes.h | 4 +- .../randomizer/adult_trade_shuffle.c | 4 +- .../randomizer/adult_trade_shuffle.h | 2 +- soh/soh/Enhancements/randomizer/draw.cpp | 44 +- soh/soh/Enhancements/randomizer/draw.h | 10 +- .../randomizer/randomizer_item_tracker.cpp | 4 +- soh/soh/Enhancements/savestates.cpp | 4 +- soh/soh/OTRGlobals.cpp | 26 +- soh/soh/OTRGlobals.h | 2 +- soh/soh/z_play_otr.cpp | 64 +- soh/soh/z_scene_otr.cpp | 370 +- soh/src/code/code_80043480.c | 6 +- soh/src/code/code_8006C3A0.c | 16 +- soh/src/code/code_80097A00.c | 8 +- soh/src/code/db_camera.c | 202 +- soh/src/code/flg_set.c | 8 +- soh/src/code/game.c | 18 +- soh/src/code/graph.c | 6 +- soh/src/code/padmgr.c | 2 +- soh/src/code/sys_math3d.c | 4 +- soh/src/code/z_actor.c | 1080 ++-- soh/src/code/z_bgcheck.c | 176 +- soh/src/code/z_camera.c | 266 +- soh/src/code/z_camera_data.inc | 2 +- soh/src/code/z_cheap_proc.c | 20 +- soh/src/code/z_collision_check.c | 730 +-- soh/src/code/z_construct.c | 34 +- soh/src/code/z_debug_display.c | 32 +- soh/src/code/z_demo.c | 1116 ++-- soh/src/code/z_draw.c | 508 +- soh/src/code/z_eff_shield_particle.c | 8 +- soh/src/code/z_eff_spark.c | 4 +- soh/src/code/z_eff_ss_dead.c | 40 +- soh/src/code/z_effect.c | 24 +- soh/src/code/z_effect_soft_sprite.c | 36 +- soh/src/code/z_effect_soft_sprite_old_init.c | 332 +- soh/src/code/z_elf_message.c | 12 +- soh/src/code/z_en_a_keep.c | 72 +- soh/src/code/z_en_item00.c | 334 +- soh/src/code/z_face_reaction.c | 4 +- soh/src/code/z_fcurve_data_skelanime.c | 30 +- soh/src/code/z_game_dlftbls.c | 2 +- soh/src/code/z_game_over.c | 26 +- soh/src/code/z_horse.c | 98 +- soh/src/code/z_kaleido_manager.c | 4 +- soh/src/code/z_kaleido_scope_call.c | 32 +- soh/src/code/z_kaleido_setup.c | 24 +- soh/src/code/z_kankyo.c | 570 +- soh/src/code/z_lifemeter.c | 36 +- soh/src/code/z_lights.c | 36 +- soh/src/code/z_map_exp.c | 150 +- soh/src/code/z_map_mark.c | 34 +- soh/src/code/z_message_PAL.c | 446 +- soh/src/code/z_onepointdemo.c | 540 +- soh/src/code/z_parameter.c | 718 +-- soh/src/code/z_path.c | 4 +- soh/src/code/z_play.c | 1188 ++--- soh/src/code/z_player_call.c | 40 +- soh/src/code/z_player_lib.c | 230 +- soh/src/code/z_quake.c | 6 +- soh/src/code/z_rcp.c | 6 +- soh/src/code/z_room.c | 144 +- soh/src/code/z_sample.c | 2 +- soh/src/code/z_scene.c | 196 +- soh/src/code/z_scene_table.c | 770 +-- soh/src/code/z_skelanime.c | 302 +- soh/src/code/z_skin.c | 24 +- soh/src/code/z_skin_awb.c | 12 +- soh/src/code/z_sound_source.c | 24 +- soh/src/code/z_sram.c | 2 +- soh/src/code/z_vr_box.c | 14 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 64 +- .../actors/ovl_Arms_Hook/z_arms_hook.h | 2 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.c | 50 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.h | 2 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.c | 48 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.h | 2 +- .../actors/ovl_Arrow_Light/z_arrow_light.c | 48 +- .../actors/ovl_Arrow_Light/z_arrow_light.h | 2 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 160 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h | 2 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 148 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h | 2 +- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c | 28 +- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h | 2 +- .../actors/ovl_Bg_Bombwall/z_bg_bombwall.c | 82 +- .../actors/ovl_Bg_Bombwall/z_bg_bombwall.h | 2 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 64 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h | 2 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 78 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.h | 2 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c | 56 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h | 2 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c | 70 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h | 2 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 118 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.h | 2 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 346 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h | 2 +- .../ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c | 76 +- .../ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h | 2 +- .../ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c | 48 +- .../ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h | 2 +- .../ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c | 72 +- .../ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h | 2 +- .../ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c | 100 +- .../ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h | 2 +- .../ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c | 46 +- .../ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h | 2 +- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c | 58 +- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h | 2 +- .../ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c | 22 +- .../ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c | 68 +- .../ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h | 2 +- .../overlays/actors/ovl_Bg_Haka/z_bg_haka.c | 70 +- .../overlays/actors/ovl_Bg_Haka/z_bg_haka.h | 2 +- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 126 +- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h | 2 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 76 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h | 2 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 56 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.h | 2 +- .../ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c | 64 +- .../ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 66 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h | 2 +- .../actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c | 78 +- .../actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h | 2 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 120 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h | 2 +- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c | 80 +- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h | 2 +- .../ovl_Bg_Haka_Water/z_bg_haka_water.c | 60 +- .../ovl_Bg_Haka_Water/z_bg_haka_water.h | 2 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c | 112 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h | 2 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 142 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.h | 2 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 90 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h | 2 +- .../ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c | 60 +- .../ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h | 2 +- .../z_bg_hidan_firewall.c | 72 +- .../z_bg_hidan_firewall.h | 2 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c | 42 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h | 2 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c | 92 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h | 2 +- .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c | 90 +- .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h | 2 +- .../ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c | 52 +- .../ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h | 2 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c | 56 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h | 2 +- .../z_bg_hidan_kowarerukabe.c | 84 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 112 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h | 2 +- .../z_bg_hidan_rsekizou.c | 50 +- .../ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c | 92 +- .../ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h | 2 +- .../ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c | 70 +- .../ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h | 2 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c | 44 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h | 2 +- .../ovl_Bg_Ice_Objects/z_bg_ice_objects.c | 68 +- .../ovl_Bg_Ice_Objects/z_bg_ice_objects.h | 2 +- .../ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c | 120 +- .../ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h | 2 +- .../ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c | 54 +- .../ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h | 2 +- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.c | 72 +- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.h | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 48 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.h | 2 +- .../ovl_Bg_Jya_1flift/z_bg_jya_1flift.c | 70 +- .../ovl_Bg_Jya_1flift/z_bg_jya_1flift.h | 2 +- .../z_bg_jya_amishutter.c | 26 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c | 68 +- .../actors/ovl_Bg_Jya_Block/z_bg_jya_block.c | 32 +- .../z_bg_jya_bombchuiwa.c | 106 +- .../z_bg_jya_bombchuiwa.h | 2 +- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c | 52 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c | 114 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h | 2 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 50 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h | 2 +- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c | 60 +- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h | 2 +- .../ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c | 72 +- .../ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h | 2 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c | 44 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h | 2 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c | 62 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h | 2 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 102 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.h | 2 +- .../z_bg_jya_zurerukabe.c | 48 +- .../z_bg_jya_zurerukabe.h | 2 +- .../ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c | 40 +- .../z_bg_menkuri_kaiten.c | 24 +- .../z_bg_menkuri_nisekabe.c | 22 +- .../ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c | 118 +- .../ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h | 2 +- .../ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c | 88 +- .../ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h | 2 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c | 60 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h | 2 +- .../actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c | 32 +- .../actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h | 2 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.c | 124 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.h | 2 +- .../overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c | 48 +- .../overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h | 2 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c | 148 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h | 2 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 88 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h | 2 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c | 86 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h | 2 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c | 64 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 120 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h | 2 +- .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c | 66 +- .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h | 2 +- .../z_bg_mori_kaitenkabe.c | 58 +- .../z_bg_mori_kaitenkabe.h | 2 +- .../z_bg_mori_rakkatenjo.c | 80 +- .../z_bg_mori_rakkatenjo.h | 2 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.c | 154 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.h | 2 +- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 74 +- .../actors/ovl_Bg_Pushbox/z_bg_pushbox.c | 36 +- .../actors/ovl_Bg_Pushbox/z_bg_pushbox.h | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 70 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.h | 2 +- .../ovl_Bg_Spot00_Break/z_bg_spot00_break.c | 24 +- .../z_bg_spot00_hanebasi.c | 90 +- .../z_bg_spot00_hanebasi.h | 2 +- .../ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c | 30 +- .../ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h | 2 +- .../z_bg_spot01_idohashira.c | 112 +- .../z_bg_spot01_idohashira.h | 4 +- .../z_bg_spot01_idomizu.c | 36 +- .../z_bg_spot01_idomizu.h | 2 +- .../z_bg_spot01_idosoko.c | 34 +- .../z_bg_spot01_idosoko.h | 2 +- .../z_bg_spot01_objects2.c | 42 +- .../z_bg_spot01_objects2.h | 2 +- .../z_bg_spot02_objects.c | 148 +- .../z_bg_spot02_objects.h | 2 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c | 50 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h | 2 +- .../ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c | 44 +- .../ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h | 2 +- .../z_bg_spot06_objects.c | 166 +- .../z_bg_spot06_objects.h | 2 +- .../ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c | 50 +- .../ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h | 2 +- .../z_bg_spot08_bakudankabe.c | 52 +- .../z_bg_spot08_iceblock.c | 58 +- .../z_bg_spot08_iceblock.h | 2 +- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 64 +- .../z_bg_spot11_bakudankabe.c | 52 +- .../ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c | 60 +- .../ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h | 2 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 52 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h | 2 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c | 46 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h | 2 +- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 128 +- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h | 2 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c | 42 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h | 2 +- .../z_bg_spot16_bombstone.c | 136 +- .../z_bg_spot16_bombstone.h | 2 +- .../z_bg_spot16_doughnut.c | 50 +- .../z_bg_spot17_bakudankabe.c | 60 +- .../ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c | 34 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 106 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h | 2 +- .../ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c | 22 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 96 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h | 4 +- .../z_bg_spot18_shutter.c | 52 +- .../z_bg_spot18_shutter.h | 2 +- .../actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c | 38 +- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 80 +- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h | 2 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 86 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h | 2 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 104 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.h | 2 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 22 +- .../actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c | 32 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 80 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h | 2 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 64 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h | 2 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 100 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h | 2 +- soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 48 +- soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h | 4 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 330 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.h | 2 +- .../overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 270 +- .../overlays/actors/ovl_Boss_Fd/z_boss_fd.h | 2 +- .../overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 238 +- .../overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 904 ++-- .../actors/ovl_Boss_Ganon/z_boss_ganon.h | 2 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 844 +-- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.h | 2 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 238 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.h | 2 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 420 +- .../actors/ovl_Boss_Goma/z_boss_goma.h | 2 +- .../overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 428 +- .../overlays/actors/ovl_Boss_Mo/z_boss_mo.h | 2 +- .../overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 590 +-- .../overlays/actors/ovl_Boss_Sst/z_boss_sst.h | 2 +- .../overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 1106 ++-- .../overlays/actors/ovl_Boss_Tw/z_boss_tw.h | 2 +- .../overlays/actors/ovl_Boss_Va/z_boss_va.c | 924 ++-- .../overlays/actors/ovl_Boss_Va/z_boss_va.h | 2 +- .../overlays/actors/ovl_Demo_6K/z_demo_6k.c | 248 +- .../overlays/actors/ovl_Demo_6K/z_demo_6k.h | 2 +- .../overlays/actors/ovl_Demo_Du/z_demo_du.c | 444 +- .../overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 642 +-- .../overlays/actors/ovl_Demo_Ec/z_demo_ec.h | 6 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 638 +-- .../actors/ovl_Demo_Effect/z_demo_effect.h | 2 +- .../overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 52 +- .../overlays/actors/ovl_Demo_Ext/z_demo_ext.h | 4 +- .../actors/ovl_Demo_Geff/z_demo_geff.c | 76 +- .../actors/ovl_Demo_Geff/z_demo_geff.h | 6 +- .../overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 630 +-- .../overlays/actors/ovl_Demo_Go/z_demo_go.c | 150 +- .../overlays/actors/ovl_Demo_Go/z_demo_go.h | 4 +- .../overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 628 +-- .../overlays/actors/ovl_Demo_Gt/z_demo_gt.h | 4 +- .../overlays/actors/ovl_Demo_Ik/z_demo_ik.c | 162 +- .../overlays/actors/ovl_Demo_Ik/z_demo_ik.h | 4 +- .../overlays/actors/ovl_Demo_Im/z_demo_im.c | 570 +- .../overlays/actors/ovl_Demo_Im/z_demo_im.h | 4 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 278 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.h | 2 +- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.c | 112 +- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.h | 2 +- .../overlays/actors/ovl_Demo_Sa/z_demo_sa.c | 342 +- .../overlays/actors/ovl_Demo_Sa/z_demo_sa.h | 4 +- .../overlays/actors/ovl_Demo_Shd/z_demo_shd.c | 50 +- .../overlays/actors/ovl_Demo_Shd/z_demo_shd.h | 2 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c | 54 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h | 2 +- .../overlays/actors/ovl_Door_Ana/z_door_ana.c | 66 +- .../overlays/actors/ovl_Door_Ana/z_door_ana.h | 2 +- .../actors/ovl_Door_Gerudo/z_door_gerudo.c | 68 +- .../actors/ovl_Door_Gerudo/z_door_gerudo.h | 2 +- .../actors/ovl_Door_Killer/z_door_killer.c | 142 +- .../actors/ovl_Door_Killer/z_door_killer.h | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 260 +- .../actors/ovl_Door_Shutter/z_door_shutter.h | 2 +- .../actors/ovl_Door_Toki/z_door_toki.c | 20 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 442 +- .../actors/ovl_Door_Warp1/z_door_warp1.h | 2 +- .../actors/ovl_Efc_Erupc/z_efc_erupc.c | 76 +- .../actors/ovl_Efc_Erupc/z_efc_erupc.h | 2 +- .../overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 56 +- .../overlays/actors/ovl_Eff_Dust/z_eff_dust.h | 4 +- .../overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 60 +- .../overlays/actors/ovl_Elf_Msg/z_elf_msg.h | 2 +- .../overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c | 60 +- .../overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h | 2 +- soh/src/overlays/actors/ovl_En_Am/z_en_am.c | 190 +- soh/src/overlays/actors/ovl_En_Am/z_en_am.h | 2 +- soh/src/overlays/actors/ovl_En_Ani/z_en_ani.c | 142 +- soh/src/overlays/actors/ovl_En_Ani/z_en_ani.h | 2 +- .../actors/ovl_En_Anubice/z_en_anubice.c | 110 +- .../actors/ovl_En_Anubice/z_en_anubice.h | 2 +- .../ovl_En_Anubice_Fire/z_en_anubice_fire.c | 62 +- .../ovl_En_Anubice_Fire/z_en_anubice_fire.h | 2 +- .../ovl_En_Anubice_Tag/z_en_anubice_tag.c | 30 +- .../ovl_En_Anubice_Tag/z_en_anubice_tag.h | 2 +- .../actors/ovl_En_Arow_Trap/z_en_arow_trap.c | 14 +- .../overlays/actors/ovl_En_Arrow/z_en_arrow.c | 110 +- .../overlays/actors/ovl_En_Arrow/z_en_arrow.h | 2 +- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 80 +- .../ovl_En_Attack_Niw/z_en_attack_niw.h | 2 +- soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c | 96 +- soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h | 2 +- soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c | 190 +- soh/src/overlays/actors/ovl_En_Bb/z_en_bb.h | 2 +- .../actors/ovl_En_Bdfire/z_en_bdfire.c | 50 +- .../actors/ovl_En_Bdfire/z_en_bdfire.h | 4 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 210 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.h | 2 +- .../overlays/actors/ovl_En_Bili/z_en_bili.c | 114 +- .../overlays/actors/ovl_En_Bili/z_en_bili.h | 2 +- .../overlays/actors/ovl_En_Bird/z_en_bird.c | 30 +- .../overlays/actors/ovl_En_Bird/z_en_bird.h | 2 +- .../actors/ovl_En_Blkobj/z_en_blkobj.c | 72 +- .../actors/ovl_En_Blkobj/z_en_blkobj.h | 2 +- soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c | 128 +- soh/src/overlays/actors/ovl_En_Bom/z_en_bom.h | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 196 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 2 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 110 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h | 2 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 130 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.h | 2 +- .../overlays/actors/ovl_En_Bombf/z_en_bombf.c | 160 +- .../overlays/actors/ovl_En_Bombf/z_en_bombf.h | 2 +- .../overlays/actors/ovl_En_Boom/z_en_boom.c | 54 +- .../overlays/actors/ovl_En_Boom/z_en_boom.h | 2 +- soh/src/overlays/actors/ovl_En_Box/z_en_box.c | 226 +- soh/src/overlays/actors/ovl_En_Box/z_en_box.h | 2 +- .../overlays/actors/ovl_En_Brob/z_en_brob.c | 108 +- .../overlays/actors/ovl_En_Brob/z_en_brob.h | 2 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 90 +- .../actors/ovl_En_Bubble/z_en_bubble.h | 2 +- .../overlays/actors/ovl_En_Butte/z_en_butte.c | 76 +- .../overlays/actors/ovl_En_Butte/z_en_butte.h | 2 +- soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c | 176 +- soh/src/overlays/actors/ovl_En_Bw/z_en_bw.h | 2 +- soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c | 58 +- .../actors/ovl_En_Changer/z_en_changer.c | 100 +- .../actors/ovl_En_Changer/z_en_changer.h | 2 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 148 +- soh/src/overlays/actors/ovl_En_Cow/z_en_cow.c | 172 +- soh/src/overlays/actors/ovl_En_Cow/z_en_cow.h | 2 +- .../overlays/actors/ovl_En_Crow/z_en_crow.c | 94 +- .../overlays/actors/ovl_En_Crow/z_en_crow.h | 2 +- soh/src/overlays/actors/ovl_En_Cs/z_en_cs.c | 116 +- soh/src/overlays/actors/ovl_En_Cs/z_en_cs.h | 2 +- .../overlays/actors/ovl_En_Daiku/z_en_daiku.c | 166 +- .../overlays/actors/ovl_En_Daiku/z_en_daiku.h | 2 +- .../z_en_daiku_kakariko.c | 92 +- .../z_en_daiku_kakariko.h | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 202 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 2 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 104 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.h | 2 +- soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c | 130 +- soh/src/overlays/actors/ovl_En_Dh/z_en_dh.h | 2 +- soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c | 72 +- soh/src/overlays/actors/ovl_En_Dha/z_en_dha.h | 2 +- .../ovl_En_Diving_Game/z_en_diving_game.c | 238 +- .../ovl_En_Diving_Game/z_en_diving_game.h | 2 +- soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c | 126 +- soh/src/overlays/actors/ovl_En_Dns/z_en_dns.h | 2 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c | 66 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h | 2 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c | 158 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h | 2 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 246 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h | 2 +- .../actors/ovl_En_Dodojr/z_en_dodojr.c | 162 +- .../actors/ovl_En_Dodojr/z_en_dodojr.h | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 164 +- .../actors/ovl_En_Dodongo/z_en_dodongo.h | 2 +- soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c | 90 +- soh/src/overlays/actors/ovl_En_Dog/z_en_dog.h | 2 +- .../overlays/actors/ovl_En_Door/z_en_door.c | 118 +- .../overlays/actors/ovl_En_Door/z_en_door.h | 2 +- soh/src/overlays/actors/ovl_En_Ds/z_en_ds.c | 132 +- soh/src/overlays/actors/ovl_En_Ds/z_en_ds.h | 2 +- soh/src/overlays/actors/ovl_En_Du/z_en_du.c | 180 +- soh/src/overlays/actors/ovl_En_Du/z_en_du.h | 2 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.c | 36 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.h | 2 +- soh/src/overlays/actors/ovl_En_Eg/z_en_eg.c | 28 +- soh/src/overlays/actors/ovl_En_Eg/z_en_eg.h | 2 +- .../overlays/actors/ovl_En_Eiyer/z_en_eiyer.c | 142 +- .../overlays/actors/ovl_En_Eiyer/z_en_eiyer.h | 2 +- soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c | 374 +- soh/src/overlays/actors/ovl_En_Elf/z_en_elf.h | 4 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 60 +- .../actors/ovl_En_Encount1/z_en_encount1.h | 2 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 102 +- .../actors/ovl_En_Encount2/z_en_encount2.h | 2 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 168 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.h | 4 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c | 80 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h | 2 +- soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c | 186 +- soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h | 2 +- .../actors/ovl_En_Fd_Fire/z_en_fd_fire.c | 72 +- .../actors/ovl_En_Fd_Fire/z_en_fd_fire.h | 2 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 148 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h | 2 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.c | 98 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.h | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 146 +- .../actors/ovl_En_Firefly/z_en_firefly.h | 2 +- .../overlays/actors/ovl_En_Fish/z_en_fish.c | 130 +- .../overlays/actors/ovl_En_Fish/z_en_fish.h | 2 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 210 +- .../actors/ovl_En_Floormas/z_en_floormas.h | 2 +- soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c | 266 +- soh/src/overlays/actors/ovl_En_Fr/z_en_fr.h | 2 +- soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c | 158 +- soh/src/overlays/actors/ovl_En_Fu/z_en_fu.h | 2 +- soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c | 90 +- soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h | 2 +- soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c | 166 +- soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h | 2 +- .../actors/ovl_En_G_Switch/z_en_g_switch.c | 150 +- .../actors/ovl_En_G_Switch/z_en_g_switch.h | 2 +- .../ovl_En_Ganon_Mant/z_en_ganon_mant.c | 30 +- .../ovl_En_Ganon_Organ/z_en_ganon_organ.c | 32 +- soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c | 146 +- soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h | 2 +- soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 298 +- soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 2 +- soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 230 +- soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 2 +- soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 124 +- soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 2 +- .../overlays/actors/ovl_En_GeldB/z_en_geldb.c | 370 +- .../overlays/actors/ovl_En_GeldB/z_en_geldb.h | 2 +- .../overlays/actors/ovl_En_GirlA/z_en_girla.c | 366 +- .../overlays/actors/ovl_En_GirlA/z_en_girla.h | 8 +- soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c | 122 +- soh/src/overlays/actors/ovl_En_Gm/z_en_gm.h | 4 +- soh/src/overlays/actors/ovl_En_Go/z_en_go.c | 308 +- soh/src/overlays/actors/ovl_En_Go/z_en_go.h | 6 +- soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c | 570 +- soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h | 2 +- .../overlays/actors/ovl_En_Goma/z_en_goma.c | 208 +- .../overlays/actors/ovl_En_Goma/z_en_goma.h | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 194 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.h | 2 +- soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c | 136 +- soh/src/overlays/actors/ovl_En_Gs/z_en_gs.h | 2 +- .../overlays/actors/ovl_En_Guest/z_en_guest.c | 76 +- .../overlays/actors/ovl_En_Guest/z_en_guest.h | 2 +- .../overlays/actors/ovl_En_Hata/z_en_hata.c | 52 +- .../actors/ovl_En_Heishi1/z_en_heishi1.c | 110 +- .../actors/ovl_En_Heishi1/z_en_heishi1.h | 2 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 322 +- .../actors/ovl_En_Heishi2/z_en_heishi2.h | 2 +- .../actors/ovl_En_Heishi3/z_en_heishi3.c | 84 +- .../actors/ovl_En_Heishi3/z_en_heishi3.h | 2 +- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 116 +- .../actors/ovl_En_Heishi4/z_en_heishi4.h | 2 +- .../actors/ovl_En_Hintnuts/z_en_hintnuts.c | 136 +- .../actors/ovl_En_Hintnuts/z_en_hintnuts.h | 2 +- .../overlays/actors/ovl_En_Holl/z_en_holl.c | 158 +- .../overlays/actors/ovl_En_Holl/z_en_holl.h | 2 +- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 138 +- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 2 +- .../overlays/actors/ovl_En_Horse/z_en_horse.c | 678 +-- .../overlays/actors/ovl_En_Horse/z_en_horse.h | 2 +- .../z_en_horse_game_check.c | 106 +- .../z_en_horse_game_check.h | 2 +- .../ovl_En_Horse_Ganon/z_en_horse_ganon.c | 66 +- .../ovl_En_Horse_Ganon/z_en_horse_ganon.h | 2 +- .../z_en_horse_link_child.c | 92 +- .../z_en_horse_link_child.h | 2 +- .../ovl_En_Horse_Normal/z_en_horse_normal.c | 118 +- .../ovl_En_Horse_Normal/z_en_horse_normal.h | 2 +- .../ovl_En_Horse_Zelda/z_en_horse_zelda.c | 66 +- .../ovl_En_Horse_Zelda/z_en_horse_zelda.h | 2 +- soh/src/overlays/actors/ovl_En_Hs/z_en_hs.c | 112 +- soh/src/overlays/actors/ovl_En_Hs/z_en_hs.h | 2 +- soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c | 58 +- soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h | 2 +- soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c | 240 +- soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h | 2 +- .../actors/ovl_En_Ice_Hono/z_en_ice_hono.c | 98 +- .../actors/ovl_En_Ice_Hono/z_en_ice_hono.h | 2 +- soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c | 416 +- soh/src/overlays/actors/ovl_En_Ik/z_en_ik.h | 2 +- soh/src/overlays/actors/ovl_En_In/z_en_in.c | 330 +- soh/src/overlays/actors/ovl_En_In/z_en_in.h | 2 +- .../actors/ovl_En_Insect/z_en_insect.c | 98 +- .../actors/ovl_En_Insect/z_en_insect.h | 2 +- .../overlays/actors/ovl_En_Ishi/z_en_ishi.c | 160 +- .../overlays/actors/ovl_En_Ishi/z_en_ishi.h | 6 +- soh/src/overlays/actors/ovl_En_It/z_en_it.c | 20 +- soh/src/overlays/actors/ovl_En_Jj/z_en_jj.c | 98 +- soh/src/overlays/actors/ovl_En_Jj/z_en_jj.h | 2 +- soh/src/overlays/actors/ovl_En_Js/z_en_js.c | 86 +- soh/src/overlays/actors/ovl_En_Js/z_en_js.h | 2 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.c | 68 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 128 +- .../actors/ovl_En_Kakasi/z_en_kakasi.h | 2 +- .../actors/ovl_En_Kakasi2/z_en_kakasi2.c | 92 +- .../actors/ovl_En_Kakasi2/z_en_kakasi2.h | 2 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.c | 196 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.h | 2 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 90 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 148 +- .../actors/ovl_En_Karebaba/z_en_karebaba.h | 2 +- soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c | 414 +- soh/src/overlays/actors/ovl_En_Ko/z_en_ko.h | 2 +- .../overlays/actors/ovl_En_Kusa/z_en_kusa.c | 144 +- .../overlays/actors/ovl_En_Kusa/z_en_kusa.h | 2 +- soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c | 192 +- soh/src/overlays/actors/ovl_En_Kz/z_en_kz.h | 2 +- .../overlays/actors/ovl_En_Light/z_en_light.c | 50 +- .../actors/ovl_En_Lightbox/z_en_lightbox.c | 30 +- .../actors/ovl_En_M_Fire1/z_en_m_fire1.c | 22 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 102 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.h | 2 +- soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 188 +- soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h | 2 +- soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 122 +- soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h | 2 +- soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 102 +- soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h | 2 +- soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c | 96 +- soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c | 270 +- soh/src/overlays/actors/ovl_En_Mb/z_en_mb.h | 2 +- soh/src/overlays/actors/ovl_En_Md/z_en_md.c | 186 +- soh/src/overlays/actors/ovl_En_Md/z_en_md.h | 2 +- soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c | 130 +- soh/src/overlays/actors/ovl_En_Mk/z_en_mk.h | 2 +- soh/src/overlays/actors/ovl_En_Mm/z_en_mm.c | 136 +- soh/src/overlays/actors/ovl_En_Mm/z_en_mm.h | 2 +- soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 104 +- soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h | 2 +- soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c | 90 +- soh/src/overlays/actors/ovl_En_Ms/z_en_ms.h | 2 +- soh/src/overlays/actors/ovl_En_Mu/z_en_mu.c | 68 +- soh/src/overlays/actors/ovl_En_Mu/z_en_mu.h | 2 +- soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c | 526 +- soh/src/overlays/actors/ovl_En_Nb/z_en_nb.h | 4 +- soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c | 234 +- soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h | 6 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.c | 74 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.h | 2 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 210 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.h | 2 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 72 +- .../actors/ovl_En_Nutsball/z_en_nutsball.h | 2 +- soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 74 +- soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h | 4 +- soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c | 130 +- soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h | 2 +- soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.c | 20 +- soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.h | 2 +- .../z_en_okarina_effect.c | 78 +- .../z_en_okarina_effect.h | 2 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 152 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.h | 2 +- .../overlays/actors/ovl_En_Okuta/z_en_okuta.c | 190 +- .../overlays/actors/ovl_En_Okuta/z_en_okuta.h | 2 +- .../overlays/actors/ovl_En_Ossan/z_en_ossan.c | 974 ++-- .../overlays/actors/ovl_En_Ossan/z_en_ossan.h | 10 +- soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c | 516 +- soh/src/overlays/actors/ovl_En_Owl/z_en_owl.h | 2 +- .../overlays/actors/ovl_En_Part/z_en_part.c | 84 +- .../overlays/actors/ovl_En_Part/z_en_part.h | 2 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 220 +- .../actors/ovl_En_Peehat/z_en_peehat.h | 2 +- .../actors/ovl_En_Po_Desert/z_en_po_desert.c | 82 +- .../actors/ovl_En_Po_Desert/z_en_po_desert.h | 2 +- .../actors/ovl_En_Po_Field/z_en_po_field.c | 272 +- .../actors/ovl_En_Po_Field/z_en_po_field.h | 2 +- .../actors/ovl_En_Po_Relay/z_en_po_relay.c | 152 +- .../actors/ovl_En_Po_Relay/z_en_po_relay.h | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 300 +- .../ovl_En_Po_Sisters/z_en_po_sisters.h | 2 +- soh/src/overlays/actors/ovl_En_Poh/z_en_poh.c | 324 +- soh/src/overlays/actors/ovl_En_Poh/z_en_poh.h | 2 +- .../actors/ovl_En_Pu_box/z_en_pu_box.c | 24 +- soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c | 190 +- soh/src/overlays/actors/ovl_En_Rd/z_en_rd.h | 2 +- .../overlays/actors/ovl_En_Reeba/z_en_reeba.c | 144 +- .../overlays/actors/ovl_En_Reeba/z_en_reeba.h | 2 +- .../ovl_En_River_Sound/z_en_river_sound.c | 26 +- soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c | 190 +- soh/src/overlays/actors/ovl_En_Rl/z_en_rl.h | 4 +- soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c | 154 +- soh/src/overlays/actors/ovl_En_Rr/z_en_rr.h | 2 +- soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 978 ++-- soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h | 6 +- soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 374 +- soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h | 4 +- soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c | 160 +- soh/src/overlays/actors/ovl_En_Sa/z_en_sa.h | 2 +- soh/src/overlays/actors/ovl_En_Sb/z_en_sb.c | 98 +- soh/src/overlays/actors/ovl_En_Sb/z_en_sb.h | 2 +- .../ovl_En_Scene_Change/z_en_scene_change.c | 30 +- .../ovl_En_Scene_Change/z_en_scene_change.h | 2 +- soh/src/overlays/actors/ovl_En_Sda/z_en_sda.c | 42 +- .../actors/ovl_En_Shopnuts/z_en_shopnuts.c | 80 +- .../actors/ovl_En_Shopnuts/z_en_shopnuts.h | 2 +- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 104 +- soh/src/overlays/actors/ovl_En_Si/z_en_si.h | 2 +- .../actors/ovl_En_Siofuki/z_en_siofuki.c | 110 +- .../actors/ovl_En_Siofuki/z_en_siofuki.h | 2 +- soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c | 138 +- soh/src/overlays/actors/ovl_En_Skb/z_en_skb.h | 2 +- soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c | 500 +- soh/src/overlays/actors/ovl_En_Skj/z_en_skj.h | 2 +- .../actors/ovl_En_Skjneedle/z_en_skjneedle.c | 38 +- soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 188 +- soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h | 2 +- soh/src/overlays/actors/ovl_En_St/z_en_st.c | 204 +- soh/src/overlays/actors/ovl_En_St/z_en_st.h | 2 +- soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c | 152 +- soh/src/overlays/actors/ovl_En_Sth/z_en_sth.h | 2 +- .../actors/ovl_En_Stream/z_en_stream.c | 40 +- .../actors/ovl_En_Stream/z_en_stream.h | 2 +- soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c | 236 +- soh/src/overlays/actors/ovl_En_Sw/z_en_sw.h | 2 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.c | 64 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.h | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 140 +- .../ovl_En_Syateki_Man/z_en_syateki_man.h | 2 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.c | 116 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.h | 2 +- soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c | 404 +- soh/src/overlays/actors/ovl_En_Ta/z_en_ta.h | 2 +- .../ovl_En_Takara_Man/z_en_takara_man.c | 96 +- .../ovl_En_Takara_Man/z_en_takara_man.h | 2 +- .../overlays/actors/ovl_En_Tana/z_en_tana.c | 36 +- .../overlays/actors/ovl_En_Test/z_en_test.c | 392 +- .../overlays/actors/ovl_En_Test/z_en_test.h | 2 +- soh/src/overlays/actors/ovl_En_Tg/z_en_tg.c | 64 +- soh/src/overlays/actors/ovl_En_Tg/z_en_tg.h | 2 +- .../overlays/actors/ovl_En_Tite/z_en_tite.c | 192 +- .../overlays/actors/ovl_En_Tite/z_en_tite.h | 2 +- soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c | 154 +- soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h | 2 +- .../overlays/actors/ovl_En_Torch/z_en_torch.c | 6 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 120 +- .../overlays/actors/ovl_En_Toryo/z_en_toryo.c | 124 +- .../overlays/actors/ovl_En_Toryo/z_en_toryo.h | 2 +- soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c | 104 +- soh/src/overlays/actors/ovl_En_Tp/z_en_tp.h | 2 +- soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c | 184 +- soh/src/overlays/actors/ovl_En_Tr/z_en_tr.h | 2 +- .../overlays/actors/ovl_En_Trap/z_en_trap.c | 48 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 108 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h | 2 +- .../overlays/actors/ovl_En_Vali/z_en_vali.c | 162 +- .../overlays/actors/ovl_En_Vali/z_en_vali.h | 2 +- .../overlays/actors/ovl_En_Vase/z_en_vase.c | 14 +- .../actors/ovl_En_Vb_Ball/z_en_vb_ball.c | 64 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 334 +- .../actors/ovl_En_Viewer/z_en_viewer.h | 6 +- soh/src/overlays/actors/ovl_En_Vm/z_en_vm.c | 116 +- soh/src/overlays/actors/ovl_En_Vm/z_en_vm.h | 2 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 44 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 186 +- .../actors/ovl_En_Wallmas/z_en_wallmas.h | 2 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 214 +- .../ovl_En_Weather_Tag/z_en_weather_tag.h | 2 +- .../actors/ovl_En_Weiyer/z_en_weiyer.c | 124 +- .../actors/ovl_En_Weiyer/z_en_weiyer.h | 2 +- soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c | 306 +- soh/src/overlays/actors/ovl_En_Wf/z_en_wf.h | 2 +- .../ovl_En_Wonder_Item/z_en_wonder_item.c | 102 +- .../ovl_En_Wonder_Item/z_en_wonder_item.h | 2 +- .../ovl_En_Wonder_Talk/z_en_wonder_talk.c | 62 +- .../ovl_En_Wonder_Talk/z_en_wonder_talk.h | 2 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.c | 78 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.h | 2 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 62 +- soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c | 986 ++-- soh/src/overlays/actors/ovl_En_Xc/z_en_xc.h | 4 +- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.c | 32 +- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.h | 2 +- .../actors/ovl_En_Yukabyun/z_en_yukabyun.c | 58 +- .../actors/ovl_En_Yukabyun/z_en_yukabyun.h | 2 +- soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c | 478 +- soh/src/overlays/actors/ovl_En_Zf/z_en_zf.h | 2 +- soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 230 +- soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h | 2 +- soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 664 +-- soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h | 4 +- soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 906 ++-- soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h | 4 +- soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 484 +- soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h | 4 +- soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c | 142 +- soh/src/overlays/actors/ovl_En_Zo/z_en_zo.h | 2 +- soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.c | 152 +- soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.h | 2 +- .../actors/ovl_End_Title/z_end_title.c | 42 +- .../overlays/actors/ovl_Fishing/z_fishing.c | 834 +-- .../actors/ovl_Item_B_Heart/z_item_b_heart.c | 54 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 128 +- .../ovl_Item_Etcetera/z_item_etcetera.h | 2 +- .../actors/ovl_Item_Inbox/z_item_inbox.c | 30 +- .../actors/ovl_Item_Inbox/z_item_inbox.h | 2 +- .../actors/ovl_Item_Ocarina/z_item_ocarina.c | 94 +- .../actors/ovl_Item_Ocarina/z_item_ocarina.h | 2 +- .../actors/ovl_Item_Shield/z_item_shield.c | 62 +- .../actors/ovl_Item_Shield/z_item_shield.h | 2 +- .../actors/ovl_Magic_Dark/z_magic_dark.c | 96 +- .../actors/ovl_Magic_Fire/z_magic_fire.c | 52 +- .../actors/ovl_Magic_Wind/z_magic_wind.c | 84 +- .../actors/ovl_Magic_Wind/z_magic_wind.h | 2 +- .../overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 78 +- .../overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 216 +- .../overlays/actors/ovl_Obj_Bean/z_obj_bean.h | 2 +- .../ovl_Obj_Blockstop/z_obj_blockstop.c | 20 +- .../actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c | 54 +- .../overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 62 +- .../overlays/actors/ovl_Obj_Comb/z_obj_comb.h | 2 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 56 +- .../actors/ovl_Obj_Elevator/z_obj_elevator.c | 36 +- .../actors/ovl_Obj_Elevator/z_obj_elevator.h | 2 +- .../actors/ovl_Obj_Hamishi/z_obj_hamishi.c | 60 +- .../overlays/actors/ovl_Obj_Hana/z_obj_hana.c | 26 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 54 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.h | 2 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 68 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h | 2 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 106 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.h | 2 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.c | 66 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.h | 2 +- .../overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 62 +- .../overlays/actors/ovl_Obj_Lift/z_obj_lift.h | 2 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 138 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.h | 2 +- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 22 +- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.h | 2 +- .../ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c | 24 +- .../overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 80 +- .../overlays/actors/ovl_Obj_Mure/z_obj_mure.h | 2 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.c | 38 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.h | 2 +- .../actors/ovl_Obj_Mure3/z_obj_mure3.c | 58 +- .../actors/ovl_Obj_Mure3/z_obj_mure3.h | 4 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 182 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h | 2 +- .../ovl_Obj_Roomtimer/z_obj_roomtimer.c | 32 +- .../ovl_Obj_Roomtimer/z_obj_roomtimer.h | 2 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 220 +- .../actors/ovl_Obj_Switch/z_obj_switch.h | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 76 +- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 126 +- .../ovl_Obj_Timeblock/z_obj_timeblock.h | 4 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 130 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.h | 2 +- .../ovl_Obj_Warp2block/z_obj_warp2block.c | 108 +- .../ovl_Obj_Warp2block/z_obj_warp2block.h | 4 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 276 +- .../ovl_Object_Kankyo/z_object_kankyo.h | 2 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.c | 64 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.h | 2 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.c | 62 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.h | 2 +- .../actors/ovl_Oceff_Wipe/z_oceff_wipe.c | 42 +- .../actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c | 42 +- .../actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c | 42 +- .../actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c | 40 +- .../overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 70 +- .../overlays/actors/ovl_Shot_Sun/z_shot_sun.h | 2 +- .../actors/ovl_player_actor/z_player.c | 4636 ++++++++--------- .../ovl_Effect_Ss_Blast/z_eff_ss_blast.c | 18 +- .../ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c | 16 +- .../ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c | 26 +- .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c | 18 +- .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c | 24 +- .../ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c | 16 +- .../ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c | 14 +- .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c | 24 +- .../z_eff_ss_dead_sound.c | 8 +- .../z_eff_ss_dt_bubble.c | 14 +- .../ovl_Effect_Ss_Dust/z_eff_ss_dust.c | 20 +- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c | 22 +- .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c | 26 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 32 +- .../ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c | 20 +- .../z_eff_ss_fhg_flash.c | 44 +- .../z_eff_ss_fire_tail.c | 32 +- .../ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c | 14 +- .../ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c | 14 +- .../z_eff_ss_g_magma2.c | 22 +- .../z_eff_ss_g_ripple.c | 26 +- .../ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c | 20 +- .../z_eff_ss_g_splash.c | 20 +- .../ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c | 40 +- .../ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c | 16 +- .../z_eff_ss_ice_piece.c | 22 +- .../z_eff_ss_ice_smoke.c | 40 +- .../ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c | 24 +- .../ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c | 44 +- .../z_eff_ss_kirakira.c | 24 +- .../z_eff_ss_lightning.c | 28 +- .../ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c | 18 +- .../ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c | 14 +- .../z_eff_ss_solder_srch_ball.c | 22 +- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 20 +- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c | 16 +- .../ovl_file_choose/z_file_choose.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 2 +- .../overlays/gamestates/ovl_select/z_select.c | 4 +- .../ovl_kaleido_scope/z_kaleido_collect.c | 10 +- .../misc/ovl_kaleido_scope/z_kaleido_debug.c | 66 +- .../ovl_kaleido_scope/z_kaleido_equipment.c | 68 +- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 46 +- .../ovl_kaleido_scope/z_kaleido_map_PAL.c | 34 +- .../misc/ovl_kaleido_scope/z_kaleido_prompt.c | 6 +- .../misc/ovl_kaleido_scope/z_kaleido_scope.h | 30 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 244 +- .../misc/ovl_kaleido_scope/z_lmap_mark.c | 32 +- 926 files changed, 41210 insertions(+), 41210 deletions(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index cc267a617..4a2017f7b 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -185,9 +185,9 @@ void osViSetYScale(f32 scale); void osViSetXScale(f32 value); void __osSetWatchLo(u32); -EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params); -EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params); -void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params); +EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params); +EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params); +void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params); void EffectBlure_ChangeType(EffectBlure* this, int type); void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); void EffectBlure_AddSpace(EffectBlure* this); @@ -204,204 +204,204 @@ void EffectSpark_Init(void* thisx, void* initParamsx); void EffectSpark_Destroy(void* thisx); s32 EffectSpark_Update(void* thisx); void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx); -void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026608(GlobalContext* globalCtx); -void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026A6C(GlobalContext* globalCtx); -GlobalContext* Effect_GetGlobalCtx(void); +void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026608(PlayState* play); +void func_80026690(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026860(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026A6C(PlayState* play); +PlayState* Effect_GetPlayState(void); void* Effect_GetByIndex(s32 index); -void Effect_InitContext(GlobalContext* globalCtx); -void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); +void Effect_InitContext(PlayState* play); +void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); void Effect_DrawAll(GraphicsContext* gfxCtx); -void Effect_UpdateAll(GlobalContext* globalCtx); -void Effect_Delete(GlobalContext* globalCtx, s32 index); -void Effect_DeleteAll(GlobalContext* globalCtx); -void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize); -void EffectSs_ClearAll(GlobalContext* globalCtx); +void Effect_UpdateAll(PlayState* play); +void Effect_Delete(PlayState* play, s32 index); +void Effect_DeleteAll(PlayState* play); +void EffectSs_InitInfo(PlayState* play, s32 tableSize); +void EffectSs_ClearAll(PlayState* play); void EffectSs_Delete(EffectSs* effectSs); void EffectSs_Reset(EffectSs* effectSs); -void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs); -void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams); -void EffectSs_UpdateAll(GlobalContext* globalCtx); -void EffectSs_DrawAll(GlobalContext* globalCtx); +void EffectSs_Insert(PlayState* play, EffectSs* effectSs); +void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams); +void EffectSs_UpdateAll(PlayState* play); +void EffectSs_DrawAll(PlayState* play); s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2); s16 func_80027E34(s16 arg0, s16 arg1, f32 arg2); u8 func_80027E84(u8 arg0, u8 arg1, f32 arg2); -void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* texture); -void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture); +void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, u8 updateMode); -void func_8002829C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002829C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_80028304(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028304(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_8002836C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002836C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800283D4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800283D4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_8002843C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002843C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800284A4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800284A4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_80028510(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028510(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_8002857C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800285EC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_8002865C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_800286CC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_8002873C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void func_8002857C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_800285EC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_8002865C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_800286CC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_8002873C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void func_800287AC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void func_800287AC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void func_8002881C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002881C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void func_80028858(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028858(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos); -void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos); -void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsKiraKira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void func_80028990(PlayState* play, f32 randScale, Vec3f* srcPos); +void func_80028A54(PlayState* play, f32 randScale, Vec3f* srcPos); +void EffectSsKiraKira_SpawnSmallYellow(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsKiraKira_SpawnSmall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKiraKira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); -void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKiraKira_SpawnFocused(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); -void EffectSsBomb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsBomb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsBomb2_SpawnFade(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life); -void EffectSsBlast_SpawnWhiteCustomScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsBlast_SpawnWhiteCustomScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void EffectSsBlast_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsBlast_SpawnShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 life); -void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsGSpk_SpawnAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnNoAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsGSpk_SpawnRandColor(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s32 life); -void EffectSsDFire_SpawnFixedScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, +void EffectSsDFire_SpawnFixedScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, s16 fadeDelay); -void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, +void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale); -void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 radiusMax, s16 life); -void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life); +void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 scale); -void EffectSsGMagma_Spawn(GlobalContext* globalCtx, Vec3f* pos); -void EffectSsGFire_Spawn(GlobalContext* globalCtx, Vec3f* pos); -void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsGMagma_Spawn(PlayState* play, Vec3f* pos); +void EffectSsGFire_Spawn(PlayState* play, Vec3f* pos); +void EffectSsLightning_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 yaw, s16 life, s16 numBolts); -void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 life, s16 colorProfile, s16 randXZ); -void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ); -void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, +void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, s16 objId, s16 life, Gfx* dList); -void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, +void EffectSsHahen_SpawnBurst(PlayState* play, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList); -void EffectSsStick_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 yaw); -void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, +void EffectSsStick_Spawn(PlayState* play, Vec3f* pos, s16 yaw); +void EffectSsSibuki_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, s16 direction, s16 scale); -void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos); -void EffectSsSibuki2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); -void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos); +void EffectSsSibuki2_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); +void EffectSsGMagma2_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 updateRate, s16 drawMode, s16 scale); -void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 arg2); -void EffectSsHitMark_Spawn(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos); -void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* pos); -void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos); -void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 arg2); +void EffectSsHitMark_Spawn(PlayState* play, s32 type, s16 scale, Vec3f* pos); +void EffectSsHitMark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos); +void EffectSsHitMark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos); +void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, u8 param); -void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, u8 param); -void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type); -void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param); +void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type); +void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected); -void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, +void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList); -void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life); -void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale); -void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, +void EffectSsIcePiece_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life); +void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale); +void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); -void EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, +void EffectSsEnIce_SpawnFlyingVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); -void EffectSsEnIce_Spawn(GlobalContext* arg0, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, +void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); -void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, +void EffectSsFireTail_Spawn(PlayState* play, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life); -void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, +void EffectSsFireTail_SpawnFlame(PlayState* play, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, f32 colorIntensity); -void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity); -void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 unk_12, s16 flags, +void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPart, f32 colorIntensity); +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 unk_12, s16 flags, s16 bodyPart); -void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* vec, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* vec, s16 scale, s16 arg4, s16 flags, s16 bodyPart); -void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); -void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 radius, s16 height); -void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); +void EffectSsFCircle_Spawn(PlayState* play, Actor* actor, Vec3f* pos, s16 radius, s16 height); +void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, s16 unused, s32 arg14, s16 playSound); -void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 alpha, s16 envR, s16 envG, s16 envB, s16 alphaStep, s32 life); -void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, +void EffectSsDeadDd_SpawnRandYellow(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, s32 randIter, s32 life); -void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDs_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s32 life); -void EffectSsDeadDs_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, +void EffectSsDeadDs_SpawnStationary(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life); -void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, +void EffectSsDeadSound_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, s16 lowerPriority, s16 repeatMode, s32 life); -void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16 sfxId, s16 lowerPriority, +void EffectSsDeadSound_SpawnStationary(PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority, s16 repeatMode, s32 life); -void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); -void FlagSet_Update(GlobalContext* globalCtx); +void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); +void FlagSet_Update(PlayState* play); void Overlay_LoadGameState(GameStateOverlay* overlayEntry); void Overlay_FreeGameState(GameStateOverlay* overlayEntry); void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale); -void ActorShadow_DrawCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx); -void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx); -void ActorShadow_DrawHorse(Actor* actor, Lights* lights, GlobalContext* globalCtx); -void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx); +void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play); +void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, PlayState* play); +void ActorShadow_DrawHorse(Actor* actor, Lights* lights, PlayState* play); +void ActorShadow_DrawFeet(Actor* actor, Lights* lights, PlayState* play); void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex, Vec3f* rightFootPos); -void func_8002BE04(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3); -void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx); -s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag); -void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag); -void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetUnknown(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetTreasure(GlobalContext* globalCtx, s32 flag); -void Flags_SetTreasure(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetClear(GlobalContext* globalCtx, s32 flag); -void Flags_SetClear(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetClear(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetTempClear(GlobalContext* globalCtx, s32 flag); -void Flags_SetTempClear(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag); -void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag); -void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, +void func_8002BE04(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3); +void func_8002C124(TargetContext* targetCtx, PlayState* play); +s32 Flags_GetSwitch(PlayState* play, s32 flag); +void Flags_SetSwitch(PlayState* play, s32 flag); +void Flags_UnsetSwitch(PlayState* play, s32 flag); +s32 Flags_GetUnknown(PlayState* play, s32 flag); +void Flags_SetUnknown(PlayState* play, s32 flag); +void Flags_UnsetUnknown(PlayState* play, s32 flag); +s32 Flags_GetTreasure(PlayState* play, s32 flag); +void Flags_SetTreasure(PlayState* play, s32 flag); +s32 Flags_GetClear(PlayState* play, s32 flag); +void Flags_SetClear(PlayState* play, s32 flag); +void Flags_UnsetClear(PlayState* play, s32 flag); +s32 Flags_GetTempClear(PlayState* play, s32 flag); +void Flags_SetTempClear(PlayState* play, s32 flag); +void Flags_UnsetTempClear(PlayState* play, s32 flag); +s32 Flags_GetCollectible(PlayState* play, s32 flag); +void Flags_SetCollectible(PlayState* play, s32 flag); +void TitleCard_InitBossName(PlayState* play, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, u8 height, s16 hastranslation); -void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, +void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, s32 width, s32 height, s32 delay); -s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx); +s32 func_8002D53C(PlayState* play, TitleCardContext* titleCtx); void Actor_Kill(Actor* actor); void Actor_SetFocus(Actor* actor, f32 offset); void Actor_SetScale(Actor* actor, f32 scale); -void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor); +void Actor_SetObjectDependency(PlayState* play, Actor* actor); void func_8002D7EC(Actor* actor); void func_8002D868(Actor* actor); void Actor_MoveForward(Actor* actor); @@ -422,141 +422,141 @@ f32 Player_GetHeight(Player* player); f32 func_8002DCE4(Player* player); s32 func_8002DD6C(Player* player); s32 func_8002DD78(Player* player); -s32 func_8002DDE4(GlobalContext* globalCtx); -s32 func_8002DDF4(GlobalContext* globalCtx); -void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB); -void func_8002DE74(GlobalContext* globalCtx, Player* player); -void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse); +s32 func_8002DDE4(PlayState* play); +s32 func_8002DDF4(PlayState* play); +void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB); +void func_8002DE74(PlayState* play, Player* player); +void Actor_MountHorse(PlayState* play, Player* player, Actor* horse); s32 func_8002DEEC(Player* player); -void func_8002DF18(GlobalContext* globalCtx, Player* player); -s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode); -s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 arg2); +void func_8002DF18(PlayState* play, Player* player); +s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode); +s32 func_8002DF54(PlayState* play, Actor* actor, u8 arg2); void func_8002DF90(DynaPolyActor* dynaActor); void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2); -s32 Player_IsFacingActor(Actor* actor, s16 angle, GlobalContext* globalCtx); +s32 Player_IsFacingActor(Actor* actor, s16 angle, PlayState* play); s32 Actor_ActorBIsFacingActorA(Actor* actorA, Actor* actorB, s16 angle); s32 Actor_IsFacingPlayer(Actor* actor, s16 angle); s32 Actor_ActorAIsFacingActorB(Actor* actorA, Actor* actorB, s16 angle); s32 Actor_IsFacingAndNearPlayer(Actor* actor, f32 range, s16 angle); s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s16 angle); -void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, +void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, s32 flags); Hilite* func_8002EABC(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx); Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx); -void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag); -void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag); +void func_8002EBCC(Actor* actor, PlayState* play, s32 flag); +void func_8002ED80(Actor* actor, PlayState* play, s32 flag); PosRot* Actor_GetFocus(PosRot* arg0, Actor* actor); PosRot* Actor_GetWorld(PosRot* arg0, Actor* actor); PosRot* Actor_GetWorldPosShapeRot(PosRot* arg0, Actor* actor); s32 func_8002F0C8(Actor* actor, Player* player, s32 arg2); -u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx); -s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u32 arg4); -s32 func_8002F298(Actor* actor, GlobalContext* globalCtx, f32 arg2, u32 arg3); -s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2); -s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx); -u32 Actor_TextboxIsClosing(Actor* actor, GlobalContext* globalCtx); -s8 func_8002F368(GlobalContext* globalCtx); -void Actor_GetScreenPos(GlobalContext* globalCtx, Actor* actor, s16* x, s16* y); -u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx); +u32 Actor_ProcessTalkRequest(Actor* actor, PlayState* play); +s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 arg4); +s32 func_8002F298(Actor* actor, PlayState* play, f32 arg2, u32 arg3); +s32 func_8002F2CC(Actor* actor, PlayState* play, f32 arg2); +s32 func_8002F2F4(Actor* actor, PlayState* play); +u32 Actor_TextboxIsClosing(Actor* actor, PlayState* play); +s8 func_8002F368(PlayState* play); +void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y); +u32 Actor_HasParent(Actor* actor, PlayState* play); // TODO: Rename the follwing 3 functions using whatever scheme we use when we rename func_8002F434 and func_8002F554. -s32 GiveItemEntryWithoutActor(GlobalContext* globalCtx, GetItemEntry getItemEntry); -s32 GiveItemEntryFromActor(Actor* actor, GlobalContext* globalCtx, GetItemEntry getItemEntry, f32 xzRange, f32 yRange); -void GiveItemEntryFromActorWithFixedRange(Actor* actor, GlobalContext* globalCtx, GetItemEntry getItemEntry); -s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange); -void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId); -void func_8002F580(Actor* actor, GlobalContext* globalCtx); -u32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx); -void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx); -void func_8002F5F0(Actor* actor, GlobalContext* globalCtx); -s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse); -u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 arg2); -s32 Actor_NotMounted(GlobalContext* globalCtx, Actor* horse); -void func_8002F698(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); -void func_8002F6D4(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F71C(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4); -void func_8002F758(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F7A0(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +s32 GiveItemEntryWithoutActor(PlayState* play, GetItemEntry getItemEntry); +s32 GiveItemEntryFromActor(Actor* actor, PlayState* play, GetItemEntry getItemEntry, f32 xzRange, f32 yRange); +void GiveItemEntryFromActorWithFixedRange(Actor* actor, PlayState* play, GetItemEntry getItemEntry); +s32 func_8002F434(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange); +void func_8002F554(Actor* actor, PlayState* play, s32 getItemId); +void func_8002F580(Actor* actor, PlayState* play); +u32 Actor_HasNoParent(Actor* actor, PlayState* play); +void func_8002F5C4(Actor* actorA, Actor* actorB, PlayState* play); +void func_8002F5F0(Actor* actor, PlayState* play); +s32 Actor_IsMounted(PlayState* play, Actor* horse); +u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 arg2); +s32 Actor_NotMounted(PlayState* play, Actor* horse); +void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); +void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); +void func_8002F71C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +void func_8002F758(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); +void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); void func_8002F7DC(Actor* actor, u16 sfxId); void Audio_PlayActorSound2(Actor* actor, u16 sfxId); -void func_8002F850(GlobalContext* globalCtx, Actor* actor); +void func_8002F850(PlayState* play, Actor* actor); void func_8002F8F0(Actor* actor, u16 sfxId); void func_8002F91C(Actor* actor, u16 sfxId); void func_8002F948(Actor* actor, u16 sfxId); void func_8002F974(Actor* actor, u16 sfxId); void func_8002F994(Actor* actor, s32 arg1); -s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos); -void Actor_DisableLens(GlobalContext* globalCtx); -void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry); -void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx); -s32 func_800314D4(GlobalContext* globalCtx, Actor* actorB, Vec3f* arg2, f32 arg3); -void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx); -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, +s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos); +void Actor_DisableLens(PlayState* play); +void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry); +void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx); +s32 func_800314D4(PlayState* play, Actor* actorB, Vec3f* arg2, f32 arg3); +void func_800315AC(PlayState* play, ActorContext* actorCtx); +void func_80031A28(PlayState* play, ActorContext* actorCtx); +void func_80031B14(PlayState* play, ActorContext* actorCtx); +void func_80031C3C(ActorContext* actorCtx, PlayState* play); +Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params); -Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* globalCtx, s16 actorId, f32 posX, +Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params); -void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx); -Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx); -Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx); -Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player); +void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx); +Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play); +Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play); +Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player); Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory); -void Enemy_StartFinishingBlow(GlobalContext* globalCtx, Actor* actor); +void Enemy_StartFinishingBlow(PlayState* play, Actor* actor); s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3); -void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx); +void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play); void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, s16 objectId); -s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* globalCtx, s16 type); -void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, +s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type); +void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting); -void func_80033480(GlobalContext* globalCtx, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, +void func_80033480(PlayState* play, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, s16 scaleStep, u8 arg6); -Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider); -Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor); -Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 radius); -void Actor_ChangeCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory); -void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 textIdLower); -s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 distance, s16 angle); -s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor); -s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor); +Actor* Actor_GetCollidedExplosive(PlayState* play, Collider* collider); +Actor* func_80033684(PlayState* play, Actor* explosiveActor); +Actor* Actor_GetProjectileActor(PlayState* play, Actor* refActor, f32 radius); +void Actor_ChangeCategory(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 actorCategory); +void Actor_SetTextWithPrefix(PlayState* play, Actor* actor, s16 textIdLower); +s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 angle); +s32 Actor_IsTargeted(PlayState* play, Actor* actor); +s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor); f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5); -void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx); -void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2); -void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3); -void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3); +void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play); +void func_80033DB8(PlayState* play, s16 arg1, s16 arg2); +void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3); +void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3); f32 Rand_ZeroFloat(f32 f); f32 Rand_CenteredFloat(f32 f); -void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 arg1, s32 arg2); -void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1); +void Actor_DrawDoorLock(PlayState* play, s32 arg1, s32 arg2); +void func_8003424C(PlayState* play, Vec3f* arg1); void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 xluFlag, s16 duration); -Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx); -Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx); -s32 func_800343CC(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 interactRange, - u16 (*unkFunc1)(GlobalContext*, Actor*), s16 (*unkFunc2)(GlobalContext*, Actor*)); +Hilite* func_800342EC(Vec3f* object, PlayState* play); +Hilite* func_8003435C(Vec3f* object, PlayState* play); +s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, + u16 (*unkFunc1)(PlayState*, Actor*), s16 (*unkFunc2)(PlayState*, Actor*)); s16 func_800347E8(s16 arg0); void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3); -void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, +void func_80034BA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); -void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, +void func_80034CC4(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); -s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3); +s16 func_80034DD4(Actor* actor, PlayState* play, s16 arg2, f32 arg3); void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index); -void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3); -void Actor_Noop(Actor* actor, GlobalContext* globalCtx); -void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist); -void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist); -Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorCategory, f32 range); -s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5); -void func_8003555C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800355B8(GlobalContext* globalCtx, Vec3f* pos); -u8 func_800355E4(GlobalContext* globalCtx, Collider* collider); +void func_80034F54(PlayState* play, s16* arg1, s16* arg2, s32 arg3); +void Actor_Noop(Actor* actor, PlayState* play); +void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist); +void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist); +Actor* Actor_FindNearby(PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range); +s32 func_800354B4(PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5); +void func_8003555C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_800355B8(PlayState* play, Vec3f* pos); +u8 func_800355E4(PlayState* play, Collider* collider); u8 Actor_ApplyDamage(Actor* actor); void Actor_SetDropFlag(Actor* actor, ColliderInfo* colBody, s32 freezeFlag); void Actor_SetDropFlagJntSph(Actor* actor, ColliderJntSph* colBody, s32 freezeFlag); void func_80035844(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3); Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, - GlobalContext* globalCtx, s16 params, s32 arg8); + PlayState* play, s16 params, s32 arg8); void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2); s32 Flags_GetEventChkInf(s32 flag); void Flags_SetEventChkInf(s32 flag); @@ -564,9 +564,9 @@ s32 Flags_GetInfTable(s32 flag); void Flags_SetInfTable(s32 flag); s32 Flags_GetRandomizerInf(RandomizerInf flag); void Flags_SetRandomizerInf(RandomizerInf flag); -u16 func_80037C30(GlobalContext* globalCtx, s16 arg1); -s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3); -s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4); +u16 func_80037C30(PlayState* play, s16 arg1); +s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3); +s32 func_80038290(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4); void ActorOverlayTable_LogPrint(void); void ActorOverlayTable_Init(void); void ActorOverlayTable_Cleanup(void); @@ -582,15 +582,15 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* headNodeId, CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* outPos, CollisionPoly** outPoly, f32* outDistSq, f32 chkDist, s32 bccFlags); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* arg2); -void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader); +void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader); s32 BgCheck_PosInStaticBoundingBox(CollisionContext* colCtx, Vec3f* pos); f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, +f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); f32 BgCheck_EntityRaycastFloor3(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); f32 BgCheck_EntityRaycastFloor4(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* arg4); -f32 BgCheck_EntityRaycastFloor5(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, +f32 BgCheck_EntityRaycastFloor5(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); f32 BgCheck_EntityRaycastFloor6(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos, f32 chkDist); @@ -639,21 +639,21 @@ s32 BgCheck_AnyLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId); s32 BgCheck_SphVsFirstPoly(CollisionContext* colCtx, Vec3f* center, f32 radius); void SSNodeList_Initialize(SSNodeList*); -void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s32 numPolys); +void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys); u16 SSNodeList_GetNextNodeIdx(SSNodeList* this); s32 DynaPoly_IsBgIdBgActor(s32 bgId); -void DynaPoly_Init(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void DynaPoly_Alloc(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void func_8003EBF8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_8003EC50(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_8003ECA8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -s32 DynaPoly_SetBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); +void DynaPoly_Init(PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_Alloc(PlayState* play, DynaCollisionContext* dyna); +void func_8003EBF8(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_8003EC50(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_8003ECA8(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId); -void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_8003EE6C(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor); -void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void DynaPoly_UpdateBgActorTransforms(GlobalContext* globalCtx, DynaCollisionContext* dyna); +void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_8003EE6C(PlayState* play, DynaCollisionContext* dyna); +void func_8003F8EC(PlayState* play, DynaCollisionContext* dyna, Actor* actor); +void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna); f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast); s32 BgCheck_SphVsDynaWall(CollisionContext* colCtx, u16 xpFlags, f32* outX, f32* outZ, Vec3f* pos, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor); @@ -665,7 +665,7 @@ s32 BgCheck_CheckLineAgainstDyna(CollisionContext* colCtx, u16 xpFlags, Vec3f* p s32 BgCheck_SphVsFirstDynaPoly(CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* center, f32 radius, Actor* actor, u16 bciFlags); void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest); -void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx); +void func_800418D0(CollisionContext* colCtx, PlayState* play); void BgCheck_ResetPolyCheckTbl(SSNodeList* nodeList, s32 numPolys); u32 SurfaceType_GetCamDataIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u16 func_80041A4C(CollisionContext* colCtx, u32 camId, s32 bgId); @@ -697,19 +697,19 @@ s32 SurfaceType_IsConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bg u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, +s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox); -s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); u32 WaterBox_GetCamDataIndex(CollisionContext* colCtx, WaterBox* waterBox); u16 WaterBox_GetCameraSType(CollisionContext* colCtx, WaterBox* waterBox); u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox); s32 func_80042708(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* point, Vec3f* closestPoint); s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); -void BgCheck_DrawDynaCollision(GlobalContext*, CollisionContext*); -void BgCheck_DrawStaticCollision(GlobalContext*, CollisionContext*); +void BgCheck_DrawDynaCollision(PlayState*, CollisionContext*); +void BgCheck_DrawStaticCollision(PlayState*, CollisionContext*); void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId); s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor); void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags); @@ -722,8 +722,8 @@ s32 func_80043548(DynaPolyActor* dynaActor); s32 func_8004356C(DynaPolyActor* dynaActor); s32 func_80043590(DynaPolyActor* dynaActor); s32 func_800435B4(DynaPolyActor* dynaActor); -s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4); -void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalContext* globalCtx); +s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4); +void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play); void Camera_InitPlayerSettings(Camera* camera, Player* player); s16 Camera_ChangeStatus(Camera* camera, s16 status); Vec3s Camera_Update(Camera* camera); @@ -756,89 +756,89 @@ DamageTable* DamageTable_Get(s32 index); void DamageTable_Clear(DamageTable* table); void Collider_DrawRedPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC); void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, u8 r, u8 g, u8 b); -s32 Collider_InitJntSph(GlobalContext* globalCtx, ColliderJntSph* collider); -s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider); -s32 Collider_DestroyJntSph(GlobalContext* globalCtx, ColliderJntSph* collider); -s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, ColliderJntSphInitToActor* src); -s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, +s32 Collider_InitJntSph(PlayState* play, ColliderJntSph* collider); +s32 Collider_FreeJntSph(PlayState* play, ColliderJntSph* collider); +s32 Collider_DestroyJntSph(PlayState* play, ColliderJntSph* collider); +s32 Collider_SetJntSphToActor(PlayState* play, ColliderJntSph* dest, ColliderJntSphInitToActor* src); +s32 Collider_SetJntSphAllocType1(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInitType1* src); -s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src); -s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, +s32 Collider_SetJntSphAlloc(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src); +s32 Collider_SetJntSph(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements); -s32 Collider_ResetJntSphAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetJntSphAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetJntSphOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitCylinder(GlobalContext* globalCtx, ColliderCylinder* collider); -s32 Collider_DestroyCylinder(GlobalContext* globalCtx, ColliderCylinder* collider); -s32 Collider_SetCylinderToActor(GlobalContext* globalCtx, ColliderCylinder* collider, ColliderCylinderInitToActor* src); -s32 Collider_SetCylinderType1(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, +s32 Collider_ResetJntSphAT(PlayState* play, Collider* collider); +s32 Collider_ResetJntSphAC(PlayState* play, Collider* collider); +s32 Collider_ResetJntSphOC(PlayState* play, Collider* collider); +s32 Collider_InitCylinder(PlayState* play, ColliderCylinder* collider); +s32 Collider_DestroyCylinder(PlayState* play, ColliderCylinder* collider); +s32 Collider_SetCylinderToActor(PlayState* play, ColliderCylinder* collider, ColliderCylinderInitToActor* src); +s32 Collider_SetCylinderType1(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInitType1* src); -s32 Collider_SetCylinder(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src); -s32 Collider_ResetCylinderAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetCylinderAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetCylinderOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitTris(GlobalContext* globalCtx, ColliderTris* tris); -s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris); -s32 Collider_DestroyTris(GlobalContext* globalCtx, ColliderTris* tris); -s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src); -s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src); -s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, +s32 Collider_SetCylinder(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src); +s32 Collider_ResetCylinderAT(PlayState* play, Collider* collider); +s32 Collider_ResetCylinderAC(PlayState* play, Collider* collider); +s32 Collider_ResetCylinderOC(PlayState* play, Collider* collider); +s32 Collider_InitTris(PlayState* play, ColliderTris* tris); +s32 Collider_FreeTris(PlayState* play, ColliderTris* tris); +s32 Collider_DestroyTris(PlayState* play, ColliderTris* tris); +s32 Collider_SetTrisAllocType1(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src); +s32 Collider_SetTrisAlloc(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src); +s32 Collider_SetTris(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* elements); -s32 Collider_ResetTrisAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetTrisAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetTrisOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitQuad(GlobalContext* globalCtx, ColliderQuad* collider); -s32 Collider_DestroyQuad(GlobalContext* globalCtx, ColliderQuad* collider); -s32 Collider_SetQuadType1(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInitType1* src); -s32 Collider_SetQuad(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src); -s32 Collider_ResetQuadAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetQuadAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetQuadOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line); -s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line); -s32 Collider_SetLinePoints(GlobalContext* globalCtx, OcLine* ocLine, Vec3f* a, Vec3f* b); -s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* dest, OcLine* src); -s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line); -void CollisionCheck_InitContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_DestroyContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void Collider_Draw(GlobalContext* globalCtx, Collider* collider); -void CollisionCheck_DrawCollision(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider); -s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); -s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider); -s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); -s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider); -s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); -s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, OcLine* collider); -void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); +s32 Collider_ResetTrisAT(PlayState* play, Collider* collider); +s32 Collider_ResetTrisAC(PlayState* play, Collider* collider); +s32 Collider_ResetTrisOC(PlayState* play, Collider* collider); +s32 Collider_InitQuad(PlayState* play, ColliderQuad* collider); +s32 Collider_DestroyQuad(PlayState* play, ColliderQuad* collider); +s32 Collider_SetQuadType1(PlayState* play, ColliderQuad* collider, Actor* actor, ColliderQuadInitType1* src); +s32 Collider_SetQuad(PlayState* play, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src); +s32 Collider_ResetQuadAT(PlayState* play, Collider* collider); +s32 Collider_ResetQuadAC(PlayState* play, Collider* collider); +s32 Collider_ResetQuadOC(PlayState* play, Collider* collider); +s32 Collider_InitLine(PlayState* play, OcLine* line); +s32 Collider_DestroyLine(PlayState* play, OcLine* line); +s32 Collider_SetLinePoints(PlayState* play, OcLine* ocLine, Vec3f* a, Vec3f* b); +s32 Collider_SetLine(PlayState* play, OcLine* dest, OcLine* src); +s32 Collider_ResetLineOC(PlayState* play, OcLine* line); +void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx); +void Collider_Draw(PlayState* play, Collider* collider); +void CollisionCheck_DrawCollision(PlayState* play, CollisionCheckContext* colChkCtx); +s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider); +s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); +s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider); +s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); +s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider); +s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); +s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colChkCtx, OcLine* collider); +void CollisionCheck_BlueBlood(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_OC(PlayState* play, CollisionCheckContext* colChkCtx); void CollisionCheck_InitInfo(CollisionCheckInfo* info); void CollisionCheck_ResetDamage(CollisionCheckInfo* info); void CollisionCheck_SetInfoNoDamageTable(CollisionCheckInfo* info, CollisionCheckInfoInit* init); void CollisionCheck_SetInfo(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit* init); void CollisionCheck_SetInfo2(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit2* init); void CollisionCheck_SetInfoGetDamageTable(CollisionCheckInfo* info, s32 index, CollisionCheckInfoInit2* init); -void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b); -s32 CollisionCheck_LineOCCheck(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, +void CollisionCheck_Damage(PlayState* play, CollisionCheckContext* colChkCtx); +s32 CollisionCheck_LineOCCheckAll(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b); +s32 CollisionCheck_LineOCCheck(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions); void Collider_UpdateCylinder(Actor* actor, ColliderCylinder* collider); void Collider_SetCylinderPosition(ColliderCylinder* collider, Vec3s* pos); void Collider_SetQuadVertices(ColliderQuad* collider, Vec3f* a, Vec3f* b, Vec3f* c, Vec3f* d); void Collider_SetTrisVertices(ColliderTris* collider, s32 index, Vec3f* a, Vec3f* b, Vec3f* c); -void Collider_SetTrisDim(GlobalContext* globalCtx, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* init); +void Collider_SetTrisDim(PlayState* play, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* init); void Collider_UpdateSpheres(s32 limb, ColliderJntSph* collider); -void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticlesMetal(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticlesMetalSound(GlobalContext* globalCtx, Vec3f* v, Vec3f* actorPos); -void CollisionCheck_SpawnShieldParticlesMetal2(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* b, Vec3f* actorPos); +void CollisionCheck_SpawnRedBlood(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnWaterDroplets(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticles(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticlesMetal(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticlesMetalSound(PlayState* play, Vec3f* v, Vec3f* actorPos); +void CollisionCheck_SpawnShieldParticlesMetal2(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* b, Vec3f* actorPos); s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* actorPos, Vec3f* itemPos, Vec3f* itemProjPos, Vec3f* out1, Vec3f* out2); u8 CollisionCheck_GetSwordDamage(s32 dmgFlags); @@ -855,48 +855,48 @@ void DebugDisplay_Init(void); DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, GraphicsContext* gfxCtx); -void DebugDisplay_DrawObjects(GlobalContext* globalCtx); -void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064520(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064534(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx); -void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx); -void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx); -void Cutscene_SetSegment(GlobalContext* globalCtx, void* segment); -void GetItem_Draw(GlobalContext* globalCtx, s16 drawId); -void GetItemEntry_Draw(GlobalContext* globalCtx, GetItemEntry getItemEntry); -void SoundSource_InitAll(GlobalContext* globalCtx); -void SoundSource_UpdateAll(GlobalContext* globalCtx); -void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* pos, s32 duration, u16 sfxId); -u16 ElfMessage_GetSariaText(GlobalContext* globalCtx); -u16 ElfMessage_GetCUpText(GlobalContext* globalCtx); -u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet); -void Flags_UnsetAllEnv(GlobalContext* globalCtx); -void Flags_SetEnv(GlobalContext* globalCtx, s16 flag); -void Flags_UnsetEnv(GlobalContext* globalCtx, s16 flag); -s32 Flags_GetEnv(GlobalContext* globalCtx, s16 flag); +void DebugDisplay_DrawObjects(PlayState* play); +void func_8006450C(PlayState* play, CutsceneContext* csCtx); +void func_80064520(PlayState* play, CutsceneContext* csCtx); +void func_80064534(PlayState* play, CutsceneContext* csCtx); +void func_80064558(PlayState* play, CutsceneContext* csCtx); +void func_800645A0(PlayState* play, CutsceneContext* csCtx); +void Cutscene_HandleEntranceTriggers(PlayState* play); +void Cutscene_HandleConditionalTriggers(PlayState* play); +void Cutscene_SetSegment(PlayState* play, void* segment); +void GetItem_Draw(PlayState* play, s16 drawId); +void GetItemEntry_Draw(PlayState* play, GetItemEntry getItemEntry); +void SoundSource_InitAll(PlayState* play); +void SoundSource_UpdateAll(PlayState* play); +void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* pos, s32 duration, u16 sfxId); +u16 ElfMessage_GetSariaText(PlayState* play); +u16 ElfMessage_GetCUpText(PlayState* play); +u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet); +void Flags_UnsetAllEnv(PlayState* play); +void Flags_SetEnv(PlayState* play, s16 flag); +void Flags_UnsetEnv(PlayState* play, s16 flag); +s32 Flags_GetEnv(PlayState* play, s16 flag); f32 func_8006C5A8(f32 target, TransformData* transData, s32 refIdx); void SkelCurve_Clear(SkelAnimeCurve* skelCurve); -s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, +s32 SkelCurve_Init(PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, TransformUpdateIndex* transUpdIdx); -void SkelCurve_Destroy(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve); +void SkelCurve_Destroy(PlayState* play, SkelAnimeCurve* skelCurve); void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame, f32 animCurFrame, f32 animSpeed); -s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve); -void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, +s32 SkelCurve_Update(PlayState* play, SkelAnimeCurve* skelCurve); +void SkelCurve_Draw(Actor* actor, PlayState* play, SkelAnimeCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data); s32 func_8006CFC0(s32 scene); -void func_8006D074(GlobalContext* globalCtx); -void func_8006D0AC(GlobalContext* globalCtx); -void func_8006D0EC(GlobalContext* globalCtx, Player* player); -void func_8006D684(GlobalContext* globalCtx, Player* player); -void func_8006DC68(GlobalContext* globalCtx, Player* player); +void func_8006D074(PlayState* play); +void func_8006D0AC(PlayState* play); +void func_8006D0EC(PlayState* play, Player* player); +void func_8006D684(PlayState* play, Player* player); +void func_8006DC68(PlayState* play, Player* player); void func_8006DD9C(Actor* actor, Vec3f* arg1, s16 arg2); s32 Jpeg_Decode(void* data, void* zbuffer, void* workBuff, u32 workSize); -void KaleidoSetup_Update(GlobalContext* globalCtx); -void KaleidoSetup_Init(GlobalContext* globalCtx); -void KaleidoSetup_Destroy(GlobalContext* globalCtx); +void KaleidoSetup_Update(PlayState* play); +void KaleidoSetup_Init(PlayState* play); +void KaleidoSetup_Destroy(PlayState* play); void func_8006EE50(Font* font, u16 arg1, u16 arg2); void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); void Font_LoadMessageBoxIcon(Font* font, u16 icon); @@ -904,44 +904,44 @@ void Font_LoadOrderedFont(Font* font); s32 func_8006F0A0(s32 arg0); u16 Environment_GetPixelDepth(s32 x, s32 y); void Environment_GraphCallback(GraphicsContext* gfxCtx, void* param); -void Environment_Init(GlobalContext* globalCtx, EnvironmentContext* envCtx, s32 unused); +void Environment_Init(PlayState* play, EnvironmentContext* envCtx, s32 unused); u8 Environment_SmoothStepToU8(u8* pvalue, u8 target, u8 scale, u8 step, u8 minStep); u8 Environment_SmoothStepToS8(s8* pvalue, s8 target, u8 scale, u8 step, u8 minStep); f32 Environment_LerpWeight(u16 max, u16 min, u16 val); f32 Environment_LerpWeightAccelDecel(u16 endFrame, u16 startFrame, u16 curFrame, u16 accelDuration, u16 decelDuration); -void Environment_UpdateSkybox(GlobalContext* globalCtx, u8 skyboxId, EnvironmentContext* envCtx, SkyboxContext* skyboxCtx); -void Environment_EnableUnderwaterLights(GlobalContext* globalCtx, s32 waterLightsIndex); -void Environment_DisableUnderwaterLights(GlobalContext* globalCtx); -void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, +void Environment_UpdateSkybox(PlayState* play, u8 skyboxId, EnvironmentContext* envCtx, SkyboxContext* skyboxCtx); +void Environment_EnableUnderwaterLights(PlayState* play, s32 waterLightsIndex); +void Environment_DisableUnderwaterLights(PlayState* play); +void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContext* lightCtx, PauseContext* pauseCtx, MessageContext* msgCtx, GameOverContext* gameOverCtx, GraphicsContext* gfxCtx); -void Environment_DrawSunAndMoon(GlobalContext* globalCtx); -void Environment_DrawSunLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, +void Environment_DrawSunAndMoon(PlayState* play); +void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f pos, s32 unused); -void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, +void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f pos, s32 unused, s16 arg6, f32 arg7, s16 arg8, u8 arg9); -void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gfxCtx); -void func_80074CE8(GlobalContext* globalCtx, u32 arg1); -void Environment_DrawSkyboxFilters(GlobalContext* globalCtx); -void Environment_UpdateLightningStrike(GlobalContext* globalCtx); -void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num); -void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused); -void Environment_PlaySceneSequence(GlobalContext* globalCtx); -void Environment_DrawCustomLensFlare(GlobalContext* globalCtx); -void Environment_InitGameOverLights(GlobalContext* globalCtx); -void Environment_FadeInGameOverLights(GlobalContext* globalCtx); -void Environment_FadeOutGameOverLights(GlobalContext* globalCtx); +void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx); +void func_80074CE8(PlayState* play, u32 arg1); +void Environment_DrawSkyboxFilters(PlayState* play); +void Environment_UpdateLightningStrike(PlayState* play); +void Environment_AddLightningBolts(PlayState* play, u8 num); +void Environment_DrawLightning(PlayState* play, s32 unused); +void Environment_PlaySceneSequence(PlayState* play); +void Environment_DrawCustomLensFlare(PlayState* play); +void Environment_InitGameOverLights(PlayState* play); +void Environment_FadeInGameOverLights(PlayState* play); +void Environment_FadeOutGameOverLights(PlayState* play); void Environment_FillScreen(GraphicsContext* gfxCtx, u8 red, u8 green, u8 blue, u8 alpha, u8 drawFlags); -void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState); -void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4); +void Environment_DrawSandstorm(PlayState* play, u8 sandstormState); +void Environment_AdjustLights(PlayState* play, f32 arg1, f32 arg2, f32 arg3, f32 arg4); s32 Environment_GetBgsDayCount(void); void Environment_ClearBgsDayCount(void); s32 Environment_GetTotalDays(void); void Environment_ForcePlaySequence(u16 seqId); s32 Environment_IsForcedSequenceDisabled(void); -void Environment_PlayStormNatureAmbience(GlobalContext* globalCtx); -void Environment_StopStormNatureAmbience(GlobalContext* globalCtx); -void Environment_WarpSongLeave(GlobalContext* globalCtx); +void Environment_PlayStormNatureAmbience(PlayState* play); +void Environment_StopStormNatureAmbience(PlayState* play); +void Environment_WarpSongLeave(PlayState* play); f32 Math_CosS(s16 angle); f32 Math_SinS(s16 angle); s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step); @@ -978,10 +978,10 @@ void func_800788CC(u16 sfxId); void func_80078914(Vec3f* arg0, u16 sfxId); s16 getHealthMeterXOffset(); s16 getHealthMeterYOffset(); -void HealthMeter_Init(GlobalContext* globalCtx); -void HealthMeter_Update(GlobalContext* globalCtx); -void HealthMeter_Draw(GlobalContext* globalCtx); -void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx); +void HealthMeter_Init(PlayState* play); +void HealthMeter_Update(PlayState* play); +void HealthMeter_Draw(PlayState* play); +void HealthMeter_HandleCriticalAlarm(PlayState* play); u32 HealthMeter_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); @@ -991,20 +991,20 @@ void Lights_DirectionalSetInfo(LightInfo* info, s8 x, s8 y, s8 z, u8 r, u8 g, u8 void Lights_Reset(Lights* lights, u8 ambentR, u8 ambentG, u8 ambentB); void Lights_Draw(Lights* lights, GraphicsContext* gfxCtx); void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* vec); -void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx); +void LightContext_Init(PlayState* play, LightContext* lightCtx); void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b); void LightContext_SetFog(LightContext* lightCtx, u8 arg1, u8 arg2, u8 arg3, s16 numLights, s16 arg5); Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx); -void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx); -void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx); -LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* lightCtx, LightInfo* info); -void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* node); +void LightContext_InitList(PlayState* play, LightContext* lightCtx); +void LightContext_DestroyList(PlayState* play, LightContext* lightCtx); +LightNode* LightContext_InsertLight(PlayState* play, LightContext* lightCtx, LightInfo* info); +void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* node); Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambientB, u8 numLights, u8 r, u8 g, u8 b, s8 x, s8 y, s8 z); Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambientB); -void Lights_GlowCheckPrepare(GlobalContext* globalCtx); -void Lights_GlowCheck(GlobalContext* globalCtx); -void Lights_DrawGlow(GlobalContext* globalCtx); +void Lights_GlowCheckPrepare(PlayState* play); +void Lights_GlowCheck(PlayState* play); +void Lights_DrawGlow(PlayState* play); void ZeldaArena_CheckPointer(void* ptr, size_t size, const char* name, const char* action); void* ZeldaArena_Malloc(size_t size); void* ZeldaArena_MallocDebug(size_t size, const char* file, s32 line); @@ -1021,9 +1021,9 @@ void ZeldaArena_Check(); void ZeldaArena_Init(void* start, size_t size); void ZeldaArena_Cleanup(); u8 ZeldaArena_IsInitalized(); -void MapMark_Init(GlobalContext* globalCtx); -void MapMark_ClearPointers(GlobalContext* globalCtx); -void MapMark_Draw(GlobalContext* globalCtx); +void MapMark_Init(PlayState* play); +void MapMark_ClearPointers(PlayState* play); +void MapMark_Draw(PlayState* play); void PreNmiBuff_Init(PreNmiBuff* this); void PreNmiBuff_SetReset(PreNmiBuff* this); u32 PreNmiBuff_IsResetting(PreNmiBuff* this); @@ -1038,67 +1038,67 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec); VecSph* OLib_Vec3fToVecSphGeo(VecSph* arg0, Vec3f* arg1); VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* arg0, Vec3f* a, Vec3f* b); Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b); -s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 camIdx); -s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 camIdx); -s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor); -s32 OnePointCutscene_AttentionSetSfx(GlobalContext* globalCtx, Actor* actor, s32 sfxId); +s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 camIdx); +s16 OnePointCutscene_EndCutscene(PlayState* play, s16 camIdx); +s32 OnePointCutscene_Attention(PlayState* play, Actor* actor); +s32 OnePointCutscene_AttentionSetSfx(PlayState* play, Actor* actor, s32 sfxId); void OnePointCutscene_EnableAttention(void); void OnePointCutscene_DisableAttention(void); -s32 OnePointCutscene_CheckForCategory(GlobalContext* globalCtx, s32 actorCategory); -void OnePointCutscene_Noop(GlobalContext* globalCtx, s32 arg1); -void Map_SavePlayerInitialInfo(GlobalContext* globalCtx); -void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor); -void Map_InitData(GlobalContext* globalCtx, s16 room); -void Map_InitRoomData(GlobalContext* globalCtx, s16 room); -void Map_Destroy(GlobalContext* globalCtx); -void Map_Init(GlobalContext* globalCtx); -void Minimap_Draw(GlobalContext* globalCtx); -void Map_Update(GlobalContext* globalCtx); +s32 OnePointCutscene_CheckForCategory(PlayState* play, s32 actorCategory); +void OnePointCutscene_Noop(PlayState* play, s32 arg1); +void Map_SavePlayerInitialInfo(PlayState* play); +void Map_SetFloorPalettesData(PlayState* play, s16 floor); +void Map_InitData(PlayState* play, s16 room); +void Map_InitRoomData(PlayState* play, s16 room); +void Map_Destroy(PlayState* play); +void Map_Init(PlayState* play); +void Minimap_Draw(PlayState* play); +void Map_Update(PlayState* play); void Interface_ChangeAlpha(u16 alphaType); -void Interface_SetSceneRestrictions(GlobalContext* globalCtx); +void Interface_SetSceneRestrictions(PlayState* play); void Inventory_SwapAgeEquipment(void); -void Interface_InitHorsebackArchery(GlobalContext* globalCtx); -void func_800849EC(GlobalContext* globalCtx); -void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button); -void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button); -void func_80084BF4(GlobalContext* globalCtx, u16 flag); -u8 Item_Give(GlobalContext* globalCtx, u8 item); -u16 Randomizer_Item_Give(GlobalContext* globalCtx, GetItemEntry giEntry); +void Interface_InitHorsebackArchery(PlayState* play); +void func_800849EC(PlayState* play); +void Interface_LoadItemIcon1(PlayState* play, u16 button); +void Interface_LoadItemIcon2(PlayState* play, u16 button); +void func_80084BF4(PlayState* play, u16 flag); +u8 Item_Give(PlayState* play, u8 item); +u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry); u8 Item_CheckObtainability(u8 item); -void PerformAutosave(GlobalContext* globalCtx, u8 item); +void PerformAutosave(PlayState* play, u8 item); void Inventory_DeleteItem(u16 item, u16 invSlot); -s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem); +s32 Inventory_ReplaceItem(PlayState* play, u16 oldItem, u16 newItem); s32 Inventory_HasEmptyBottle(void); bool Inventory_HasEmptyBottleSlot(void); s32 Inventory_HasSpecificBottle(u8 bottleItem); -void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton); -s32 Inventory_ConsumeFairy(GlobalContext* globalCtx); -bool Inventory_HatchPocketCucco(GlobalContext* globalCtx); -void Interface_SetDoAction(GlobalContext* globalCtx, u16 action); -void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState); -void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action); -s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange); +void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 cButton); +s32 Inventory_ConsumeFairy(PlayState* play); +bool Inventory_HatchPocketCucco(PlayState* play); +void Interface_SetDoAction(PlayState* play, u16 action); +void Interface_SetNaviCall(PlayState* play, u16 naviCallState); +void Interface_LoadActionLabelB(PlayState* play, u16 action); +s32 Health_ChangeBy(PlayState* play, s16 healthChange); void Health_GiveHearts(s16 hearts); void Health_RemoveHearts(s16 hearts); void Rupees_ChangeBy(s16 rupeeChange); void Inventory_ChangeAmmo(s16 item, s16 ammoChange); -void Magic_Fill(GlobalContext* globalCtx); -void func_800876C8(GlobalContext* globalCtx); -s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2); +void Magic_Fill(PlayState* play); +void func_800876C8(PlayState* play); +s32 func_80087708(PlayState* play, s16 arg1, s16 arg2); void func_80088AA0(s16 seconds); -void func_80088AF0(GlobalContext* globalCtx); +void func_80088AF0(PlayState* play); void func_80088B34(s16 arg0); -void Interface_Draw(GlobalContext* globalCtx); -void Interface_Update(GlobalContext* globalCtx); -Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max); +void Interface_Draw(PlayState* play); +void Interface_Update(PlayState* play); +Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx); s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input); u8 PlayerGrounded(Player* player); -void Player_SetBootData(GlobalContext* globalCtx, Player* player); -s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* player); -s32 Player_InCsMode(GlobalContext* globalCtx); +void Player_SetBootData(PlayState* play, Player* player); +s32 Player_InBlockingCsMode(PlayState* play, Player* player); +s32 Player_InCsMode(PlayState* play); s32 func_8008E9C4(Player* player); s32 Player_IsChildWithHylianShield(Player* player); s32 Player_ActionToModelGroup(Player* player, s32 actionParam); @@ -1106,19 +1106,19 @@ void Player_SetModelsForHoldingShield(Player* player); void Player_SetModels(Player* player, s32 modelGroup); void Player_SetModelGroup(Player* player, s32 modelGroup); void func_8008EC70(Player* player); -void Player_SetEquipmentData(GlobalContext* globalCtx, Player* player); -void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* player, s32 item, s32 actionParam); -void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6); +void Player_SetEquipmentData(PlayState* play, Player* player); +void Player_UpdateBottleHeld(PlayState* play, Player* player, s32 item, s32 actionParam); +void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6); void func_8008EDF0(Player* player); void func_8008EE08(Player* player); -void func_8008EEAC(GlobalContext* globalCtx, Actor* actor); -s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo); -s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 radius, f32 arg3); +void func_8008EEAC(PlayState* play, Actor* actor); +s32 func_8008EF44(PlayState* play, s32 ammo); +s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 radius, f32 arg3); s32 Player_GetStrength(void); -u8 Player_GetMask(GlobalContext* globalCtx); -Player* Player_UnsetMask(GlobalContext* globalCtx); -s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx); -s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx); +u8 Player_GetMask(PlayState* play); +Player* Player_UnsetMask(PlayState* play); +s32 Player_HasMirrorShieldEquipped(PlayState* play); +s32 Player_HasMirrorShieldSetToDraw(PlayState* play); s32 Player_ActionToMagicSpell(Player* player, s32 actionParam); s32 Player_HoldsHookshot(Player* player); s32 func_8008F128(Player* player); @@ -1131,19 +1131,19 @@ s32 Player_GetBottleHeld(Player* player); s32 Player_ActionToExplosive(Player* player, s32 actionParam); s32 Player_GetExplosiveHeld(Player* player); s32 func_8008F2BC(Player* player, s32 actionParam); -s32 func_8008F2F8(GlobalContext* globalCtx); -void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, +s32 func_8008F2F8(PlayState* play); +void func_8008F470(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* this); -s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 func_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponDim, Vec3f* newTip, +s32 func_8008FCC8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); +s32 func_80090014(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); +s32 func_800902F0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); +s32 func_80090440(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); +u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponDim, Vec3f* newTip, Vec3f* newBase); -void Player_DrawGetItem(GlobalContext* globalCtx, Player* player); -void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* data); -u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime); -void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, +void Player_DrawGetItem(PlayState* play, Player* player); +void func_80090D20(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* data); +u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime); +void func_8009214C(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots); void PreNMI_Init(GameState* thisx); Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2); @@ -1179,7 +1179,7 @@ void func_8009398C(GraphicsContext* gfxCtx); void func_80093AD0(GraphicsContext* gfxCtx); void func_80093BA8(GraphicsContext* gfxCtx); void func_80093C14(GraphicsContext* gfxCtx); -void func_80093C80(GlobalContext* globalCtx); +void func_80093C80(PlayState* play); void func_80093D18(GraphicsContext* gfxCtx); void func_80093D84(GraphicsContext* gfxCtx); Gfx* func_80093F34(Gfx* gfx); @@ -1217,37 +1217,37 @@ Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1 Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a); void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b); void func_80095974(GraphicsContext* gfxCtx); -void func_80095AA0(GlobalContext* globalCtx, Room* room, Input* arg2, UNK_TYPE arg3); +void func_80095AA0(PlayState* play, Room* room, Input* arg2, UNK_TYPE arg3); void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, u16 tlutCount, f32 frameX, f32 frameY); -void func_80096FD4(GlobalContext* globalCtx, Room* room); -u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx); -s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum); -s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx); -void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags); -void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx); +void func_80096FD4(PlayState* play, Room* room); +u32 func_80096FE8(PlayState* play, RoomContext* roomCtx); +s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum); +s32 func_800973FC(PlayState* play, RoomContext* roomCtx); +void Room_Draw(PlayState* play, Room* room, u32 flags); +void func_80097534(PlayState* play, RoomContext* roomCtx); void Sample_Destroy(GameState* thisx); void Sample_Init(GameState* thisx); void Inventory_ChangeEquipment(s16 equipment, u16 value); -u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment); +u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, s16 value); -void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx); +void Object_InitBank(PlayState* play, ObjectContext* objectCtx); void Object_UpdateBank(ObjectContext* objectCtx); s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId); s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex); void func_800981B8(ObjectContext* objectCtx); -s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd); +s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd); void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx); -void func_800994A0(GlobalContext* globalCtx); -void Scene_Draw(GlobalContext* globalCtx); -void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, +void func_800994A0(PlayState* play); +void Scene_Draw(PlayState* play); +void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 dListIndex); -void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 dListIndex); -void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg); -void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg); s16 Animation_GetLength(void* animation); s16 Animation_GetLastFrame(void* animation); @@ -1255,55 +1255,55 @@ s32 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Ve s16 Animation_GetLimbCountLegacy(LegacyAnimationHeader* animation); s16 Animation_GetLengthLegacy(LegacyAnimationHeader* animation); s16 Animation_GetLastFrameLegacy(LegacyAnimationHeader* animation); -Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, +Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx); -Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx); void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s* target, f32 weight); void AnimationContext_Reset(AnimationContext* animationCtx); -void AnimationContext_SetNextQueue(GlobalContext* globalCtx); -void AnimationContext_DisableQueue(GlobalContext* globalCtx); -void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame, s32 limbCount, +void AnimationContext_SetNextQueue(PlayState* play); +void AnimationContext_DisableQueue(PlayState* play); +void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); -void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src); -void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight); -void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); -void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); -void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3); -void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx); -void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +void AnimationContext_SetCopyAll(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src); +void AnimationContext_SetInterp(PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight); +void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); +void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); +void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3); +void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx); +void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, LinkAnimationHeader* animation, s32 initFlags, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime); -s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime); -void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime); -void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames); -void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, +s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime); +void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime); +void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames); +void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); -void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation); -void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); +void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); -void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation); -void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); +void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); -void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime); -void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime); -void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime); +void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime); +void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame); -void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, +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 weight, Vec3s* blendTable); -void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, +void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 weight, Vec3s* blendTable); void LinkAnimation_EndLoop(SkelAnime* skelAnime); s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); -s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -s32 SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation); s32 SkelAnime_Update(SkelAnime* skelAnime); void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, @@ -1322,19 +1322,19 @@ 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 Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos); void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags); void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags); -void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); -void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); -void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); -void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); +void func_800A6330(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); +void func_800A6360(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); +void func_800A6394(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); +void func_800A63CC(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* arg2, Vec3f* dst); -void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader); -void Skin_Free(GlobalContext* globalCtx, Skin* skin); +void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader); +void Skin_Free(PlayState* play, Skin* skin); s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* mf, Actor* actor, s32 setTranslation); void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); @@ -1511,53 +1511,53 @@ s32 Mempak_DeleteFile(s32 controllerNb, char idx); s32 Mempak_GetFileSize(s32 controllerNb, char idx); void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); -void KaleidoManager_Init(GlobalContext* globalCtx); +void KaleidoManager_Init(PlayState* play); void KaleidoManager_Destroy(); void* KaleidoManager_GetRamAddr(void* vram); void KaleidoScopeCall_LoadPlayer(); -void KaleidoScopeCall_Init(GlobalContext* globalCtx); -void KaleidoScopeCall_Destroy(GlobalContext* globalCtx); -void KaleidoScopeCall_Update(GlobalContext* globalCtx); -void KaleidoScopeCall_Draw(GlobalContext* globalCtx); -void func_800BC490(GlobalContext* globalCtx, s16 point); -s32 func_800BC56C(GlobalContext* globalCtx, s16 arg1); -void func_800BC590(GlobalContext* globalCtx); -void func_800BC5E0(GlobalContext* globalCtx, s32 arg1); -Gfx* Gameplay_SetFog(GlobalContext* globalCtx, Gfx* gfx); -void Gameplay_Destroy(GameState* thisx); -void Gameplay_Init(GameState* thisx); -void Gameplay_Main(GameState* thisx); +void KaleidoScopeCall_Init(PlayState* play); +void KaleidoScopeCall_Destroy(PlayState* play); +void KaleidoScopeCall_Update(PlayState* play); +void KaleidoScopeCall_Draw(PlayState* play); +void func_800BC490(PlayState* play, s16 point); +s32 func_800BC56C(PlayState* play, s16 arg1); +void func_800BC590(PlayState* play); +void func_800BC5E0(PlayState* play, s32 arg1); +Gfx* Play_SetFog(PlayState* play, Gfx* gfx); +void Play_Destroy(GameState* thisx); +void Play_Init(GameState* thisx); +void Play_Main(GameState* thisx); u8 CheckStoneCount(); u8 CheckMedallionCount(); u8 CheckDungeonCount(); -s32 Gameplay_InCsMode(GlobalContext* globalCtx); -f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec); -void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file); -void Gameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn); -void func_800C016C(GlobalContext* globalCtx, Vec3f* src, Vec3f* dest); -s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx); -s16 Gameplay_GetActiveCamId(GlobalContext* globalCtx); -s16 Gameplay_ChangeCameraStatus(GlobalContext* globalCtx, s16 camId, s16 status); -void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId); -void Gameplay_ClearAllSubCameras(GlobalContext* globalCtx); -Camera* Gameplay_GetCamera(GlobalContext* globalCtx, s16 camId); -s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye); -s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); -s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov); -s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll); -void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 camId1, s16 camId2); -s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 arg3); -s32 Gameplay_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 arg2); -void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2); -void Gameplay_SaveSceneFlags(GlobalContext* globalCtx); -void Gameplay_SetupRespawnPoint(GlobalContext* globalCtx, s32 respawnMode, s32 playerParams); -void Gameplay_TriggerVoidOut(GlobalContext* globalCtx); -void Gameplay_TriggerRespawn(GlobalContext* globalCtx); -s32 func_800C0CB8(GlobalContext* globalCtx); -s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx); -s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw); -s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos); -void Gameplay_PerformSave(GlobalContext* globalCtx); +s32 Play_InCsMode(PlayState* play); +f32 func_800BFCB8(PlayState* play, MtxF* mf, Vec3f* vec); +void* Play_LoadFile(PlayState* play, RomFile* file); +void Play_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn); +void func_800C016C(PlayState* play, Vec3f* src, Vec3f* dest); +s16 Play_CreateSubCamera(PlayState* play); +s16 Play_GetActiveCamId(PlayState* play); +s16 Play_ChangeCameraStatus(PlayState* play, s16 camId, s16 status); +void Play_ClearCamera(PlayState* play, s16 camId); +void Play_ClearAllSubCameras(PlayState* play); +Camera* Play_GetCamera(PlayState* play, s16 camId); +s32 Play_CameraSetAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); +s32 Play_CameraSetAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); +s32 Play_CameraSetFov(PlayState* play, s16 camId, f32 fov); +s32 Play_SetCameraRoll(PlayState* play, s16 camId, s16 roll); +void Play_CopyCamera(PlayState* play, s16 camId1, s16 camId2); +s32 func_800C0808(PlayState* play, s16 camId, Player* player, s16 arg3); +s32 Play_CameraChangeSetting(PlayState* play, s16 camId, s16 arg2); +void func_800C08AC(PlayState* play, s16 camId, s16 arg2); +void Play_SaveSceneFlags(PlayState* play); +void Play_SetupRespawnPoint(PlayState* play, s32 respawnMode, s32 playerParams); +void Play_TriggerVoidOut(PlayState* play); +void Play_TriggerRespawn(PlayState* play); +s32 func_800C0CB8(PlayState* play); +s32 FrameAdvance_IsEnabled(PlayState* play); +s32 func_800C0D34(PlayState* play, Actor* actor, s16* yaw); +s32 func_800C0DB4(PlayState* play, Vec3f* pos); +void Play_PerformSave(PlayState* play); void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); @@ -1776,8 +1776,8 @@ s32 Math3D_TriVsTriIntersect(TriNorm* ta, TriNorm* tb, Vec3f* intersect); s32 Math3D_XZInSphere(Sphere16* sphere, f32 x, f32 z); s32 Math3D_XYInSphere(Sphere16* sphere, f32 x, f32 y); s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z); -void Math3D_DrawSphere(GlobalContext* globalCtx, Sphere16* sph); -void Math3D_DrawCylinder(GlobalContext* globalCtx, Cylinder16* cyl); +void Math3D_DrawSphere(PlayState* play, Sphere16* sph); +void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl); s16 Math_Atan2S(f32 x, f32 y); f32 Math_Atan2F(f32 x, f32 y); void Matrix_Init(GameState* gameState); @@ -2395,25 +2395,25 @@ u32* osViGetCurrentFramebuffer(void); s32 __osSpSetPc(void* pc); f32 absf(f32); void* func_801068B0(void* dst, void* src, size_t size); -void Message_UpdateOcarinaGame(GlobalContext* globalCtx); -u8 Message_ShouldAdvance(GlobalContext* globalCtx); -u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx); -void Message_CloseTextbox(GlobalContext*); -void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor); -void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId); -void func_8010BD58(GlobalContext* globalCtx, u16 arg1); -void func_8010BD88(GlobalContext* globalCtx, u16 arg1); +void Message_UpdateOcarinaGame(PlayState* play); +u8 Message_ShouldAdvance(PlayState* play); +u8 Message_ShouldAdvanceSilent(PlayState* play); +void Message_CloseTextbox(PlayState*); +void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor); +void Message_ContinueTextbox(PlayState* play, u16 textId); +void func_8010BD58(PlayState* play, u16 arg1); +void func_8010BD88(PlayState* play, u16 arg1); u8 Message_GetState(MessageContext* msgCtx); -void Message_Draw(GlobalContext* globalCtx); -void Message_Update(GlobalContext* globalCtx); +void Message_Draw(PlayState* play); +void Message_Update(PlayState* play); void Message_SetTables(void); -void GameOver_Init(GlobalContext* globalCtx); -void GameOver_FadeInLights(GlobalContext* globalCtx); -void GameOver_Update(GlobalContext* globalCtx); -void func_80110990(GlobalContext* globalCtx); -void func_801109B0(GlobalContext* globalCtx); -void Message_Init(GlobalContext* globalCtx); -void func_80112098(GlobalContext* globalCtx); +void GameOver_Init(PlayState* play); +void GameOver_FadeInLights(PlayState* play); +void GameOver_Update(PlayState* play); +void func_80110990(PlayState* play); +void func_801109B0(PlayState* play); +void Message_Init(PlayState* play); +void func_80112098(PlayState* play); void Title_Init(GameState* thisx); void Title_PrintBuildInfo(Gfx** gfxp); diff --git a/soh/include/macros.h b/soh/include/macros.h index 0d8b5ac01..b672ac0af 100644 --- a/soh/include/macros.h +++ b/soh/include/macros.h @@ -31,9 +31,9 @@ #define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) -#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head) +#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head) -#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera]) +#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamera]) #define LINK_IS_ADULT (gSaveContext.linkAge == 0) #define LINK_IS_CHILD (gSaveContext.linkAge == 1) diff --git a/soh/include/variables.h b/soh/include/variables.h index 9a5fbad77..816a7d631 100644 --- a/soh/include/variables.h +++ b/soh/include/variables.h @@ -101,7 +101,7 @@ extern "C" extern void* gItemIcons[0x82]; extern u8 gItemAgeReqs[]; extern u8 gItemSlots[56]; - extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*); + extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*); extern s16 gLinkObjectIds[2]; extern u32 gObjectTableSize; extern RomFile gObjectTable[OBJECT_ID_MAX]; diff --git a/soh/include/z64.h b/soh/include/z64.h index dada44b48..d466d3f12 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -1228,7 +1228,7 @@ typedef struct { } TransitionActorContext; // Global Context (dbg ram start: 80212020) -typedef struct GlobalContext { +typedef struct PlayState { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneNum; /* 0x000A6 */ u8 sceneConfig; @@ -1266,15 +1266,15 @@ typedef struct GlobalContext { /* 0x117A4 */ ObjectContext objectCtx; /* 0x11CBC */ RoomContext roomCtx; /* 0x11D34 */ TransitionActorContext transiActorCtx; - /* 0x11D3C */ void (*playerInit)(Player* player, struct GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader); - /* 0x11D40 */ void (*playerUpdate)(Player* player, struct GlobalContext* globalCtx, Input* input); - /* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct GlobalContext* globalCtx); - /* 0x11D48 */ s32 (*startPlayerFishing)(struct GlobalContext* globalCtx); - /* 0x11D4C */ s32 (*grabPlayer)(struct GlobalContext* globalCtx, Player* player); - /* 0x11D50 */ s32 (*startPlayerCutscene)(struct GlobalContext* globalCtx, Actor* actor, s32 mode); - /* 0x11D54 */ void (*func_11D54)(Player* player, struct GlobalContext* globalCtx); - /* 0x11D58 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage); - /* 0x11D5C */ void (*talkWithPlayer)(struct GlobalContext* globalCtx, Actor* actor); + /* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader); + /* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input); + /* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct PlayState* play); + /* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play); + /* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player); + /* 0x11D50 */ s32 (*startPlayerCutscene)(struct PlayState* play, Actor* actor, s32 mode); + /* 0x11D54 */ void (*func_11D54)(Player* player, struct PlayState* play); + /* 0x11D58 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage); + /* 0x11D5C */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor); /* 0x11D60 */ MtxF viewProjectionMtxF; /* 0x11DA0 */ MtxF billboardMtxF; /* 0x11DE0 */ Mtx* billboardMtx; @@ -1315,7 +1315,7 @@ typedef struct GlobalContext { /* 0x1242B */ u8 unk_1242B; /* 0x1242C */ SceneTableEntry* loadedScene; /* 0x12430 */ char unk_12430[0xE8]; -} GlobalContext; // size = 0x12518 +} PlayState; // size = 0x12518 typedef struct { /* 0x0000 */ GameState state; diff --git a/soh/include/z64actor.h b/soh/include/z64actor.h index 0271a9b8e..11cf86138 100644 --- a/soh/include/z64actor.h +++ b/soh/include/z64actor.h @@ -14,14 +14,14 @@ #define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects. struct Actor; -struct GlobalContext; +struct PlayState; struct Lights; -typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*); +typedef void (*ActorFunc)(struct Actor*, struct PlayState*); typedef void (*ActorResetFunc)(void); -typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct GlobalContext*); -typedef u16 (*callback1_800343CC)(struct GlobalContext*, struct Actor*); -typedef s16 (*callback2_800343CC)(struct GlobalContext*, struct Actor*); +typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState*); +typedef u16 (*callback1_800343CC)(struct PlayState*, struct Actor*); +typedef s16 (*callback2_800343CC)(struct PlayState*, struct Actor*); typedef struct { Vec3f pos; @@ -278,7 +278,7 @@ typedef enum { struct EnItem00; -typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct GlobalContext*); +typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct PlayState*); typedef struct EnItem00 { /* 0x000 */ Actor actor; @@ -314,7 +314,7 @@ typedef enum { struct EnAObj; -typedef void (*EnAObjActionFunc)(struct EnAObj*, struct GlobalContext*); +typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*); typedef struct EnAObj { /* 0x000 */ DynaPolyActor dyna; diff --git a/soh/include/z64animation.h b/soh/include/z64animation.h index 6bbf79159..b0d8d40ef 100755 --- a/soh/include/z64animation.h +++ b/soh/include/z64animation.h @@ -5,7 +5,7 @@ #include "z64dma.h" #include "z64math.h" -struct GlobalContext; +struct PlayState; struct Actor; struct SkelAnime; @@ -106,15 +106,15 @@ typedef struct { /* 0x08 */ JointKey* jointKey; } LegacyAnimationHeader; // size = 0xC -typedef s32 (*OverrideLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +typedef s32 (*OverrideLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void*); -typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); +typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); -typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +typedef s32 (*OverrideLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void*, Gfx** gfx); -typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx); +typedef void (*PostLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx); typedef enum { ANIMENTRY_LOADFRAME, @@ -187,7 +187,7 @@ typedef struct AnimationContext { AnimationEntry entries[ANIMATION_ENTRY_MAX]; } AnimationContext; // size = 0xC84 -typedef void (*AnimationEntryCallback)(struct GlobalContext* globalCtx, AnimationEntryData* data); +typedef void (*AnimationEntryCallback)(struct PlayState* play, AnimationEntryData* data); // fcurve_skelanime structs typedef struct { @@ -234,8 +234,8 @@ typedef struct { /* 0x001C */ LimbTransform* transforms; } SkelAnimeCurve; // size = 0x20 -typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); -typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); +typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); +typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); typedef s32 (*AnimUpdateFunc)(); diff --git a/soh/include/z64bgcheck.h b/soh/include/z64bgcheck.h index 30e18afed..5314f98cd 100644 --- a/soh/include/z64bgcheck.h +++ b/soh/include/z64bgcheck.h @@ -1,7 +1,7 @@ #ifndef Z_BGCHECK_H #define Z_BGCHECK_H -struct GlobalContext; +struct PlayState; struct Actor; struct DynaPolyActor; @@ -166,7 +166,7 @@ typedef struct CollisionContext { } CollisionContext; // size = 0x1464 typedef struct { - /* 0x00 */ struct GlobalContext* globalCtx; + /* 0x00 */ struct PlayState* play; /* 0x04 */ struct CollisionContext* colCtx; /* 0x08 */ u16 xpFlags; /* 0x0C */ CollisionPoly** resultPoly; diff --git a/soh/include/z64camera.h b/soh/include/z64camera.h index 37b822c23..15ba1b0d9 100644 --- a/soh/include/z64camera.h +++ b/soh/include/z64camera.h @@ -18,8 +18,8 @@ #define SUBCAM_ACTIVE -1 #define ONEPOINT_CS_INFO(camera) ((Unique9OnePointCs*)camera->paramData) -#define PARENT_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->parentCamIdx]) -#define CHILD_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->childCamIdx]) +#define PARENT_CAM(cam) ((cam)->play->cameraPtrs[(cam)->parentCamIdx]) +#define CHILD_CAM(cam) ((cam)->play->cameraPtrs[(cam)->childCamIdx]) typedef enum { /* 0x00 */ CAM_SET_NONE, @@ -1163,7 +1163,7 @@ typedef struct { /* 0x068 */ Vec3f up; /* 0x074 */ Vec3f eyeNext; /* 0x080 */ Vec3f skyboxOffset; - /* 0x08C */ struct GlobalContext* globalCtx; + /* 0x08C */ struct PlayState* play; /* 0x090 */ struct Player* player; /* 0x094 */ PosRot playerPosRot; /* 0x0A8 */ struct Actor* target; diff --git a/soh/include/z64effect.h b/soh/include/z64effect.h index 541586187..d1d6b3329 100644 --- a/soh/include/z64effect.h +++ b/soh/include/z64effect.h @@ -4,7 +4,7 @@ #include struct GraphicsContext; -struct GlobalContext; +struct PlayState; /* Effects */ @@ -163,7 +163,7 @@ typedef struct { } EffectShieldParticle; // size = 0x1C8 typedef struct { - /* 0x0000 */ struct GlobalContext* globalCtx; + /* 0x0000 */ struct PlayState* play; struct { EffectStatus status; EffectSpark effect; @@ -197,9 +197,9 @@ typedef enum { struct EffectSs; -typedef u32 (*EffectSsInitFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs, void* initParams); -typedef void (*EffectSsUpdateFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs); -typedef void (*EffectSsDrawFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs); +typedef u32 (*EffectSsInitFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs, void* initParams); +typedef void (*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs); +typedef void (*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs); typedef struct { /* 0x00 */ u32 type; diff --git a/soh/include/z64player.h b/soh/include/z64player.h index e68ca8d45..dab2e7752 100644 --- a/soh/include/z64player.h +++ b/soh/include/z64player.h @@ -451,9 +451,9 @@ typedef struct { #define PLAYER_STATE3_6 (1 << 6) #define PLAYER_STATE3_7 (1 << 7) -typedef void (*PlayerFunc674)(struct Player*, struct GlobalContext*); -typedef s32(*PlayerFunc82C)(struct Player*, struct GlobalContext*); -typedef void (*PlayerFuncA74)(struct GlobalContext*, struct Player*); +typedef void (*PlayerFunc674)(struct Player*, struct PlayState*); +typedef s32(*PlayerFunc82C)(struct Player*, struct PlayState*); +typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); typedef struct Player { /* 0x0000 */ Actor actor; diff --git a/soh/include/z64skin.h b/soh/include/z64skin.h index 3d75f4835..1d77fad33 100644 --- a/soh/include/z64skin.h +++ b/soh/include/z64skin.h @@ -79,8 +79,8 @@ typedef struct { /* 0x04C */ SkelAnime skelAnime; } Skin; // size = 0x90 -typedef void (*SkinPostDraw)(struct Actor*, struct GlobalContext*, Skin*); -typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct GlobalContext*, s32, Skin*); +typedef void (*SkinPostDraw)(struct Actor*, struct PlayState*, Skin*); +typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct PlayState*, s32, Skin*); #define SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS (1 << 0) #define SKIN_DRAW_FLAG_CUSTOM_MATRIX (1 << 1) diff --git a/soh/soh/CrashHandlerExt.cpp b/soh/soh/CrashHandlerExt.cpp index 8e30b6744..af8d4fbb3 100644 --- a/soh/soh/CrashHandlerExt.cpp +++ b/soh/soh/CrashHandlerExt.cpp @@ -13,7 +13,7 @@ append_str(buff, len, varName); \ append_str(buff, len, varValue); -extern "C" GlobalContext* gGlobalCtx; +extern "C" PlayState* gPlayState; static std::array sCatToStrArray{ "SWITCH", "BG", "PLAYER", "EXPLOSIVE", "NPC", "ENEMY", "PROP", "ITEMACTION", "MISC", "BOSS", "DOOR", "CHEST", @@ -139,7 +139,7 @@ static void CrashHandler_WriteActorData(char* buffer, size_t* pos) { append_line(buffer, pos, "Actor Id Params"); for (unsigned int i = 0; i < ACTORCAT_MAX; i++) { - ActorListEntry* entry = &gGlobalCtx->actorCtx.actorLists[i]; + ActorListEntry* entry = &gPlayState->actorCtx.actorLists[i]; Actor* cur; if(entry->length == 0) { @@ -167,13 +167,13 @@ extern "C" void CrashHandler_PrintSohData(char* buffer, size_t* pos) { WRITE_VAR_LINE(buffer, pos, "Game Version: ", (const char*)gBuildVersion); WRITE_VAR_LINE(buffer, pos, "Build Date: ", (const char*)gBuildDate); - if (gGlobalCtx != nullptr) { + if (gPlayState != nullptr) { append_line(buffer, pos, "Actors:"); CrashHandler_WriteActorData(buffer, pos); - WRITE_VAR_LINE(buffer, pos, "Scene: ", sSceneIdToStrArray[gGlobalCtx->sceneNum]); + WRITE_VAR_LINE(buffer, pos, "Scene: ", sSceneIdToStrArray[gPlayState->sceneNum]); - snprintf(intCharBuffer, sizeof(intCharBuffer), "%i", gGlobalCtx->roomCtx.curRoom.num); + snprintf(intCharBuffer, sizeof(intCharBuffer), "%i", gPlayState->roomCtx.curRoom.num); WRITE_VAR_LINE(buffer, pos, "Room: ", intCharBuffer); } } \ No newline at end of file diff --git a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp index 4ffc61fdf..b61e5972f 100644 --- a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp +++ b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp @@ -12,7 +12,7 @@ extern "C" { #include "variables.h" #include "functions.h" #include "macros.h" -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; } #include "../debugconsole.h" @@ -286,11 +286,11 @@ void CrowdControl::ReceiveFromCrowdControl() CrowdControl::EffectResult CrowdControl::ExecuteEffect(std::string effectId, uint32_t value, bool dryRun) { // Don't execute effect and don't advance timer when the player is not in a proper loaded savefile // and when they're busy dying. - if (gGlobalCtx == NULL || gGlobalCtx->gameOverCtx.state > 0 || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2) { + if (gPlayState == NULL || gPlayState->gameOverCtx.state > 0 || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2) { return EffectResult::Retry; } - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); if (player != NULL) { if (effectId == "add_heart_container") { @@ -338,8 +338,8 @@ CrowdControl::EffectResult CrowdControl::ExecuteEffect(std::string effectId, uin } } - if (player != NULL && !Player_InBlockingCsMode(gGlobalCtx, player) && gGlobalCtx->pauseCtx.state == 0 - && gGlobalCtx->msgCtx.msgMode == 0) { + if (player != NULL && !Player_InBlockingCsMode(gPlayState, player) && gPlayState->pauseCtx.state == 0 + && gPlayState->msgCtx.msgMode == 0) { if (effectId == "high_gravity") { if (dryRun == 0) CMD_EXECUTE("gravity 2"); return EffectResult::Success; @@ -432,7 +432,7 @@ CrowdControl::EffectResult CrowdControl::ExecuteEffect(std::string effectId, uin } bool CrowdControl::SpawnEnemy(std::string effectId) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); int enemyId = 0; int enemyParams = 0; @@ -488,17 +488,17 @@ bool CrowdControl::SpawnEnemy(std::string effectId) { posYOffset = 50; } - return Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, enemyId, player->actor.world.pos.x + posXOffset, + return Actor_Spawn(&gPlayState->actorCtx, gPlayState, enemyId, player->actor.world.pos.x + posXOffset, player->actor.world.pos.y + posYOffset, player->actor.world.pos.z + posZOffset, 0, 0, 0, enemyParams); } void CrowdControl::RemoveEffect(std::string effectId) { - if (gGlobalCtx == NULL) { + if (gPlayState == NULL) { return; } - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); if (player != NULL) { if (effectId == "giant_link" diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 7c462acd9..4466c06f1 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -24,7 +24,7 @@ extern "C" { #include "variables.h" #include "functions.h" #include "macros.h" -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; } #include @@ -52,12 +52,12 @@ static bool ActorSpawnHandler(std::shared_ptr Console, const std: return CMD_FAILED; } - if (gGlobalCtx == nullptr) { - SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr"); + if (gPlayState == nullptr) { + SohImGui::GetConsole()->SendErrorMessage("PlayState == nullptr"); return CMD_FAILED; } - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); PosRot spawnPoint; const s16 actorId = std::stoi(args[1]); const s16 params = std::stoi(args[2]); @@ -87,7 +87,7 @@ static bool ActorSpawnHandler(std::shared_ptr Console, const std: } } - if (Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, actorId, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z, + if (Actor_Spawn(&gPlayState->actorCtx, gPlayState, actorId, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z, spawnPoint.rot.x, spawnPoint.rot.y, spawnPoint.rot.z, params) == NULL) { SohImGui::GetConsole()->SendErrorMessage("Failed to spawn actor. Actor_Spawn returned NULL"); return CMD_FAILED; @@ -97,8 +97,8 @@ static bool ActorSpawnHandler(std::shared_ptr Console, const std: static bool GiveDekuShieldHandler(std::shared_ptr Console, const std::vector&) { // Give Deku Shield to the player, and automatically equip it when they're child and have no shield currently equiped. - Player* player = GET_PLAYER(gGlobalCtx); - Item_Give(gGlobalCtx, ITEM_SHIELD_DEKU); + Player* player = GET_PLAYER(gPlayState); + Item_Give(gPlayState, ITEM_SHIELD_DEKU); if (LINK_IS_CHILD && player->currentShield == PLAYER_SHIELD_NONE) { player->currentShield = PLAYER_SHIELD_DEKU; Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_DEKU); @@ -173,12 +173,12 @@ static bool RupeeHandler(std::shared_ptr Console, const std::vect } static bool SetPosHandler(std::shared_ptr Console, const std::vector args) { - if (gGlobalCtx == nullptr) { - SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr"); + if (gPlayState == nullptr) { + SohImGui::GetConsole()->SendErrorMessage("PlayState == nullptr"); return CMD_FAILED; } - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); if (args.size() == 1) { SohImGui::GetConsole()->SendInfoMessage("Player position is [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x, @@ -200,13 +200,13 @@ static bool SetPosHandler(std::shared_ptr Console, const std::vec } static bool ResetHandler(std::shared_ptr Console, std::vector args) { - if (gGlobalCtx == nullptr) { - SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr"); + if (gPlayState == nullptr) { + SohImGui::GetConsole()->SendErrorMessage("PlayState == nullptr"); return CMD_FAILED; } - SET_NEXT_GAMESTATE(&gGlobalCtx->state, TitleSetup_Init, GameState); - gGlobalCtx->state.running = false; + SET_NEXT_GAMESTATE(&gPlayState->state, TitleSetup_Init, GameState); + gPlayState->state.running = false; return CMD_SUCCESS; } @@ -332,7 +332,7 @@ static bool GiveItemHandler(std::shared_ptr Console, const std::v return CMD_FAILED; } - GiveItemEntryWithoutActor(gGlobalCtx, getItemEntry); + GiveItemEntryWithoutActor(gPlayState, getItemEntry); return CMD_SUCCESS; } @@ -352,53 +352,53 @@ static bool EntranceHandler(std::shared_ptr Console, const std::v return CMD_FAILED; } - gGlobalCtx->nextEntranceIndex = entrance; - gGlobalCtx->sceneLoadFlag = 0x14; - gGlobalCtx->fadeTransition = 11; + gPlayState->nextEntranceIndex = entrance; + gPlayState->sceneLoadFlag = 0x14; + gPlayState->fadeTransition = 11; gSaveContext.nextTransition = 11; } static bool VoidHandler(std::shared_ptr Console, const std::vector& args) { - if (gGlobalCtx != nullptr) { - gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gGlobalCtx->actorCtx.flags.tempSwch; - gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gGlobalCtx->actorCtx.flags.tempCollect; + if (gPlayState != nullptr) { + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gPlayState->actorCtx.flags.tempSwch; + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gPlayState->actorCtx.flags.tempCollect; gSaveContext.respawnFlag = 1; - gGlobalCtx->sceneLoadFlag = 0x14; - gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; - gGlobalCtx->fadeTransition = 2; + gPlayState->sceneLoadFlag = 0x14; + gPlayState->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; + gPlayState->fadeTransition = 2; gSaveContext.nextTransition = 2; } else { - SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr"); + SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr"); return CMD_FAILED; } return CMD_SUCCESS; } static bool ReloadHandler(std::shared_ptr Console, const std::vector& args) { - if (gGlobalCtx != nullptr) { - gGlobalCtx->nextEntranceIndex = gSaveContext.entranceIndex; - gGlobalCtx->sceneLoadFlag = 0x14; - gGlobalCtx->fadeTransition = 11; + if (gPlayState != nullptr) { + gPlayState->nextEntranceIndex = gSaveContext.entranceIndex; + gPlayState->sceneLoadFlag = 0x14; + gPlayState->fadeTransition = 11; gSaveContext.nextTransition = 11; } else { - SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr"); + SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr"); return CMD_FAILED; } return CMD_SUCCESS; } static bool FWHandler(std::shared_ptr Console, const std::vector& args) { - if (gGlobalCtx != nullptr) { + if (gPlayState != nullptr) { if (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0) { - gGlobalCtx->sceneLoadFlag = 0x14; - gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; - gGlobalCtx->fadeTransition = 5; + gPlayState->sceneLoadFlag = 0x14; + gPlayState->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; + gPlayState->fadeTransition = 5; } else { SohImGui::GetConsole()->SendErrorMessage("Farore's wind not set!"); } } else { - SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr"); + SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr"); return CMD_FAILED; } @@ -406,18 +406,18 @@ static bool FWHandler(std::shared_ptr Console, const std::vector< } static bool FileSelectHandler(std::shared_ptr Console, const std::vector& args) { - if (gGlobalCtx != nullptr) { - SET_NEXT_GAMESTATE(&gGlobalCtx->state, FileChoose_Init, FileChooseContext); - gGlobalCtx->state.running = 0; + if (gPlayState != nullptr) { + SET_NEXT_GAMESTATE(&gPlayState->state, FileChoose_Init, FileChooseContext); + gPlayState->state.running = 0; } else { - SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr"); + SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr"); return CMD_FAILED; } return CMD_SUCCESS; } static bool QuitHandler(std::shared_ptr Console, const std::vector& args) { - gGlobalCtx->state.running = 0; + gPlayState->state.running = 0; return CMD_SUCCESS; } @@ -490,7 +490,7 @@ static bool InvisibleHandler(std::shared_ptr Console, const std:: try { chaosEffectInvisibleLink = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; if (!chaosEffectInvisibleLink) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); player->actor.shape.shadowDraw = ActorShadow_DrawFeet; } @@ -624,10 +624,10 @@ static bool DamageHandler(std::shared_ptr Console, const std::vec return CMD_FAILED; } - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); - Health_ChangeBy(gGlobalCtx, -value * 0x10); - func_80837C0C(gGlobalCtx, player, 0, 0, 0, 0, 0); + Health_ChangeBy(gPlayState, -value * 0x10); + func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0); player->invincibilityTimer = 28; return CMD_SUCCESS; @@ -650,7 +650,7 @@ static bool HealHandler(std::shared_ptr Console, const std::vecto return CMD_FAILED; } - Health_ChangeBy(gGlobalCtx, value * 0x10); + Health_ChangeBy(gPlayState, value * 0x10); return CMD_SUCCESS; } catch (std::invalid_argument const& ex) { SohImGui::GetConsole()->SendErrorMessage("[SOH] Heal value must be a number."); @@ -659,7 +659,7 @@ static bool HealHandler(std::shared_ptr Console, const std::vecto } static bool FillMagicHandler(std::shared_ptr Console, const std::vector& args) { - Magic_Fill(gGlobalCtx); + Magic_Fill(gPlayState); return CMD_SUCCESS; } @@ -708,7 +708,7 @@ static bool PacifistHandler(std::shared_ptr Console, const std::v chaosEffectPacifistMode = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; // Force interface to update to make the buttons transparent gSaveContext.unk_13E8 = 50; - Interface_Update(gGlobalCtx); + Interface_Update(gPlayState); return CMD_SUCCESS; } catch (std::invalid_argument const& ex) { SohImGui::GetConsole()->SendErrorMessage("[SOH] Pacifist value must be a number."); @@ -746,30 +746,30 @@ static bool RainstormHandler(std::shared_ptr Console, const std:: try { uint32_t rainstorm = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; if (rainstorm) { - gGlobalCtx->envCtx.unk_F2[0] = 20; // rain intensity target - gGlobalCtx->envCtx.gloomySkyMode = 1; // start gloomy sky - if ((gWeatherMode != 0) || gGlobalCtx->envCtx.unk_17 != 0) { - gGlobalCtx->envCtx.unk_DE = 1; + gPlayState->envCtx.unk_F2[0] = 20; // rain intensity target + gPlayState->envCtx.gloomySkyMode = 1; // start gloomy sky + if ((gWeatherMode != 0) || gPlayState->envCtx.unk_17 != 0) { + gPlayState->envCtx.unk_DE = 1; } - gGlobalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON; - Environment_PlayStormNatureAmbience(gGlobalCtx); + gPlayState->envCtx.lightningMode = LIGHTNING_MODE_ON; + Environment_PlayStormNatureAmbience(gPlayState); } else { - gGlobalCtx->envCtx.unk_F2[0] = 0; - if (gGlobalCtx->csCtx.state == CS_STATE_IDLE) { - Environment_StopStormNatureAmbience(gGlobalCtx); + gPlayState->envCtx.unk_F2[0] = 0; + if (gPlayState->csCtx.state == CS_STATE_IDLE) { + Environment_StopStormNatureAmbience(gPlayState); } else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); } osSyncPrintf("\n\n\nE_wether_flg=[%d]", gWeatherMode); - osSyncPrintf("\nrain_evt_trg=[%d]\n\n", gGlobalCtx->envCtx.gloomySkyMode); - if (gWeatherMode == 0 && (gGlobalCtx->envCtx.gloomySkyMode == 1)) { - gGlobalCtx->envCtx.gloomySkyMode = 2; // end gloomy sky + osSyncPrintf("\nrain_evt_trg=[%d]\n\n", gPlayState->envCtx.gloomySkyMode); + if (gWeatherMode == 0 && (gPlayState->envCtx.gloomySkyMode == 1)) { + gPlayState->envCtx.gloomySkyMode = 2; // end gloomy sky } else { - gGlobalCtx->envCtx.gloomySkyMode = 0; - gGlobalCtx->envCtx.unk_DE = 0; + gPlayState->envCtx.gloomySkyMode = 0; + gPlayState->envCtx.unk_DE = 0; } - gGlobalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; + gPlayState->envCtx.lightningMode = LIGHTNING_MODE_LAST; } @@ -844,10 +844,10 @@ static bool BootsHandler(std::shared_ptr Console, const std::vect return CMD_FAILED; } - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); player->currentBoots = it->second; Inventory_ChangeEquipment(EQUIP_BOOTS, it->second + 1); - Player_SetBootData(gGlobalCtx, player); + Player_SetBootData(gPlayState, player); return CMD_SUCCESS; } @@ -865,8 +865,8 @@ static bool KnockbackHandler(std::shared_ptr Console, const std:: return CMD_FAILED; } - Player* player = GET_PLAYER(gGlobalCtx); - func_8002F71C(gGlobalCtx, &player->actor, value * 5, player->actor.world.rot.y + 0x8000, value * 5); + Player* player = GET_PLAYER(gPlayState); + func_8002F71C(gPlayState, &player->actor, value * 5, player->actor.world.rot.y + 0x8000, value * 5); return CMD_SUCCESS; } catch (std::invalid_argument const& ex) { @@ -876,9 +876,9 @@ static bool KnockbackHandler(std::shared_ptr Console, const std:: } static bool ElectrocuteHandler(std::shared_ptr Console, const std::vector& args) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); if (PlayerGrounded(player)) { - func_80837C0C(gGlobalCtx, player, 4, 0, 0, 0, 0); + func_80837C0C(gPlayState, player, 4, 0, 0, 0, 0); return CMD_SUCCESS; } @@ -886,21 +886,21 @@ static bool ElectrocuteHandler(std::shared_ptr Console, const std } static bool BurnHandler(std::shared_ptr Console, const std::vector& args) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); if (PlayerGrounded(player)) { for (int i = 0; i < 18; i++) { player->flameTimers[i] = Rand_S16Offset(0, 200); } player->isBurning = true; - func_80837C0C(gGlobalCtx, player, 0, 0, 0, 0, 0); + func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0); return CMD_FAILED; } return CMD_SUCCESS; } static bool CuccoStormHandler(std::shared_ptr Console, const std::vector& args) { - Player* player = GET_PLAYER(gGlobalCtx); - EnNiw* cucco = (EnNiw*)Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, ACTOR_EN_NIW, player->actor.world.pos.x, + Player* player = GET_PLAYER(gPlayState); + EnNiw* cucco = (EnNiw*)Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_NIW, player->actor.world.pos.x, player->actor.world.pos.y + 2200, player->actor.world.pos.z, 0, 0, 0, 0); cucco->actionFunc = func_80AB70A0_nocutscene; return CMD_SUCCESS; diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index 8c6a4d543..e1cca6b02 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -15,7 +15,7 @@ extern "C" { #include "variables.h" #include "functions.h" #include "macros.h" -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; #include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_24_static/icon_item_24_static.h" @@ -99,7 +99,7 @@ std::map actorDescriptions = { { ACTOR_EN_TP, "Electric Tailpasaran" }, { ACTOR_EN_ST, "Skulltula" }, { ACTOR_EN_BW, "Torch Slug" }, - { ACTOR_EN_A_OBJ, "Gameplay_keep items" }, + { ACTOR_EN_A_OBJ, "Play_keep items" }, { ACTOR_EN_EIYER, "Stinger (Land)" }, { ACTOR_EN_RIVER_SOUND, "Ambient Sound Effects" }, { ACTOR_EN_HORSE_NORMAL, "Horse" }, @@ -516,8 +516,8 @@ void PopulateActorDropdown(int i, std::vector& data) { if (data.size() != 0) { data.clear(); } - if (gGlobalCtx != nullptr) { - ActorListEntry currList = gGlobalCtx->actorCtx.actorLists[i]; + if (gPlayState != nullptr) { + ActorListEntry currList = gPlayState->actorCtx.actorLists[i]; Actor* currAct = currList.head; if (currAct != nullptr) { while (currAct != nullptr) { @@ -555,8 +555,8 @@ void DrawActorViewer(bool& open) { static std::vector list; static u16 lastSceneId = 0; - if (gGlobalCtx != nullptr) { - needs_reset = lastSceneId != gGlobalCtx->sceneNum; + if (gPlayState != nullptr) { + needs_reset = lastSceneId != gPlayState->sceneNum; if (needs_reset) { display = empty; fetch = nullptr; @@ -566,7 +566,7 @@ void DrawActorViewer(bool& open) { list.clear(); needs_reset = false; } - lastSceneId = gGlobalCtx->sceneNum; + lastSceneId = gPlayState->sceneNum; if (ImGui::BeginCombo("Actor Type", acMapping[category])) { for (int i = 0; i < acMapping.size(); i++) { if (ImGui::Selectable(acMapping[i])) { @@ -579,9 +579,9 @@ void DrawActorViewer(bool& open) { } if (ImGui::BeginCombo("Actor", filler.c_str())) { - if (gGlobalCtx != nullptr && lastSceneId != gGlobalCtx->sceneNum) { + if (gPlayState != nullptr && lastSceneId != gPlayState->sceneNum) { PopulateActorDropdown(category, list); - lastSceneId = gGlobalCtx->sceneNum; + lastSceneId = gPlayState->sceneNum; } for (int i = 0; i < list.size(); i++) { std::string label = std::to_string(i) + ": " + list[i]->overlayEntry->name; @@ -652,13 +652,13 @@ void DrawActorViewer(bool& open) { } if (ImGui::Button("Go to Actor")) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); Math_Vec3f_Copy(&player->actor.world.pos, &display.world.pos); Math_Vec3f_Copy(&player->actor.home.pos, &player->actor.world.pos); } if (ImGui::Button("Fetch from Target")) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); fetch = player->targetActor; if (fetch != NULL) { display = *fetch; @@ -669,7 +669,7 @@ void DrawActorViewer(bool& open) { } UIWidgets::InsertHelpHoverText("Grabs actor with target arrow above it. You might need C-Up for enemies"); if (ImGui::Button("Fetch from Held")) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); fetch = player->heldActor; if (fetch != NULL) { display = *fetch; @@ -680,7 +680,7 @@ void DrawActorViewer(bool& open) { } UIWidgets::InsertHelpHoverText("Grabs actor that Link is holding"); if (ImGui::Button("Fetch from Interaction")) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); fetch = player->interactRangeActor; if (fetch != NULL) { display = *fetch; @@ -722,7 +722,7 @@ void DrawActorViewer(bool& open) { }); if (ImGui::Button("Fetch from Link")) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); Vec3f newPos = player->actor.world.pos; Vec3s newRot = player->actor.world.rot; newActor.pos = newPos; @@ -731,7 +731,7 @@ void DrawActorViewer(bool& open) { if (ImGui::Button("Spawn")) { if (newActor.id >= 0 && newActor.id < ACTOR_ID_MAX && gActorOverlayTable[newActor.id].initInfo != NULL) { - Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, newActor.id, newActor.pos.x, newActor.pos.y, + Actor_Spawn(&gPlayState->actorCtx, gPlayState, newActor.id, newActor.pos.x, newActor.pos.y, newActor.pos.z, newActor.rot.x, newActor.rot.y, newActor.rot.z, newActor.params); } else { func_80078884(NA_SE_SY_ERROR); @@ -743,7 +743,7 @@ void DrawActorViewer(bool& open) { if (parent != NULL) { if (newActor.id >= 0 && newActor.id < ACTOR_ID_MAX && gActorOverlayTable[newActor.id].initInfo != NULL) { - Actor_SpawnAsChild(&gGlobalCtx->actorCtx, parent, gGlobalCtx, newActor.id, newActor.pos.x, + Actor_SpawnAsChild(&gPlayState->actorCtx, parent, gPlayState, newActor.id, newActor.pos.x, newActor.pos.y, newActor.pos.z, newActor.rot.x, newActor.rot.y, newActor.rot.z, newActor.params); } else { diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index 0146e626f..c87b8a991 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -13,7 +13,7 @@ extern "C" { #include "variables.h" #include "functions.h" #include "macros.h" -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; } enum class ColRenderSetting { Disabled, Solid, Transparent }; @@ -358,29 +358,29 @@ void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { for (int i = 0; i < col->numPolygons; i++) { CollisionPoly* poly = &col->polyList[i]; - if (SurfaceType_IsHookshotSurface(&gGlobalCtx->colCtx, poly, bgId)) { + if (SurfaceType_IsHookshotSurface(&gPlayState->colCtx, poly, bgId)) { colorR = CVar_GetS32("gColViewerColorHookshotR", 128); colorG = CVar_GetS32("gColViewerColorHookshotG", 128); colorB = CVar_GetS32("gColViewerColorHookshotB", 255); - } else if (func_80041D94(&gGlobalCtx->colCtx, poly, bgId) > 0x01) { + } else if (func_80041D94(&gPlayState->colCtx, poly, bgId) > 0x01) { colorR = CVar_GetS32("gColViewerColorInteractableR", 192); colorG = CVar_GetS32("gColViewerColorInteractableG", 0); colorB = CVar_GetS32("gColViewerColorInteractableB", 192); - } else if (func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x0C) { + } else if (func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x0C) { colorR = CVar_GetS32("gColViewerColorVoidR", 255); colorG = CVar_GetS32("gColViewerColorVoidG", 0); colorB = CVar_GetS32("gColViewerColorVoidB", 0); - } else if (SurfaceType_GetSceneExitIndex(&gGlobalCtx->colCtx, poly, bgId) || - func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x05) { + } else if (SurfaceType_GetSceneExitIndex(&gPlayState->colCtx, poly, bgId) || + func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x05) { colorR = CVar_GetS32("gColViewerColorEntranceR", 0); colorG = CVar_GetS32("gColViewerColorEntranceG", 255); colorB = CVar_GetS32("gColViewerColorEntranceB", 0); - } else if (func_80041D4C(&gGlobalCtx->colCtx, poly, bgId) != 0 || - SurfaceType_IsWallDamage(&gGlobalCtx->colCtx, poly, bgId)) { + } else if (func_80041D4C(&gPlayState->colCtx, poly, bgId) != 0 || + SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) { colorR = CVar_GetS32("gColViewerColorSpecialSurfaceR", 192); colorG = CVar_GetS32("gColViewerColorSpecialSurfaceG", 255); colorB = CVar_GetS32("gColViewerColorSpecialSurfaceB", 192); - } else if (SurfaceType_GetSlope(&gGlobalCtx->colCtx, poly, bgId) == 0x01) { + } else if (SurfaceType_GetSlope(&gPlayState->colCtx, poly, bgId) == 0x01) { colorR = CVar_GetS32("gColViewerColorSlopeR", 255); colorG = CVar_GetS32("gColViewerColorSlopeG", 255); colorB = CVar_GetS32("gColViewerColorSlopeB", 128); @@ -445,7 +445,7 @@ void DrawSceneCollision() { InitGfx(dl, showSceneColSetting); dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); - DrawDynapoly(dl, gGlobalCtx->colCtx.colHeader, BGCHECK_SCENE); + DrawDynapoly(dl, gPlayState->colCtx.colHeader, BGCHECK_SCENE); } // Draws all Bg Actors @@ -460,8 +460,8 @@ void DrawBgActorCollision() { dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); for (int32_t bgIndex = 0; bgIndex < BG_ACTOR_MAX; bgIndex++) { - if (gGlobalCtx->colCtx.dyna.bgActorFlags[bgIndex] & 1) { - BgActor& bg = gGlobalCtx->colCtx.dyna.bgActors[bgIndex]; + if (gPlayState->colCtx.dyna.bgActorFlags[bgIndex] & 1) { + BgActor& bg = gPlayState->colCtx.dyna.bgActors[bgIndex]; Mtx m; MtxF mf; SkinMatrix_SetTranslateRotateYXZScale(&mf, bg.curTransform.scale.x, bg.curTransform.scale.y, @@ -584,7 +584,7 @@ void DrawColCheckCollision() { InitGfx(dl, showColCheckSetting); dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); - CollisionCheckContext& col = gGlobalCtx->colChkCtx; + CollisionCheckContext& col = gPlayState->colChkCtx; dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorOCR", 255), CVar_GetS32("gColViewerColorOCG", 255), CVar_GetS32("gColViewerColorOCB", 255), 255)); @@ -602,7 +602,7 @@ void DrawColCheckCollision() { void DrawWaterbox(std::vector& dl, WaterBox* water, float water_max_depth = -4000.0f) { // Skip waterboxes that would be disabled in current room int32_t room = ((water->properties >> 13) & 0x3F); - if ((room != gGlobalCtx->roomCtx.curRoom.num) && (room != 0x3F)) { + if ((room != gPlayState->roomCtx.curRoom.num) && (room != 0x3F)) { return; } @@ -641,14 +641,14 @@ void DrawWaterboxList() { CVar_GetS32("gColViewerColorWaterboxG", 0), CVar_GetS32("gColViewerColorWaterboxB", 255), 255)); - CollisionHeader* col = gGlobalCtx->colCtx.colHeader; + CollisionHeader* col = gPlayState->colCtx.colHeader; for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) { WaterBox* water = &col->waterBoxes[waterboxIndex]; DrawWaterbox(dl, water); } // Zora's Domain has a special, hard-coded waterbox with a bottom so you can go under the waterfall - if (gGlobalCtx->sceneNum == SCENE_SPOT07) { + if (gPlayState->sceneNum == SCENE_SPOT07) { DrawWaterbox(dl, &zdWaterBox, zdWaterBoxMinY); } } @@ -663,7 +663,7 @@ template size_t ResetVector(T& vec) { } void DrawColViewer() { - if (gGlobalCtx == nullptr) { + if (gPlayState == nullptr) { return; } @@ -698,7 +698,7 @@ void DrawColViewer() { return; } - OPEN_DISPS(gGlobalCtx->state.gfxCtx); + OPEN_DISPS(gPlayState->state.gfxCtx); opaDl.push_back(gsSPEndDisplayList()); gSPDisplayList(POLY_OPA_DISP++, opaDl.data()); @@ -706,5 +706,5 @@ void DrawColViewer() { xluDl.push_back(gsSPEndDisplayList()); gSPDisplayList(POLY_XLU_DISP++, xluDl.data()); - CLOSE_DISPS(gGlobalCtx->state.gfxCtx); + CLOSE_DISPS(gPlayState->state.gfxCtx); } diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 2d2ce0ccd..d72850048 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -17,7 +17,7 @@ extern "C" { #include "functions.h" #include "macros.h" #include "soh/Enhancements/randomizer/adult_trade_shuffle.h" -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; #include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_24_static/icon_item_24_static.h" @@ -545,7 +545,7 @@ void DrawBGSItemFlag(uint8_t itemID) { } } else { gSaveContext.adultTradeItems &= ~(1 << tradeIndex); - Inventory_ReplaceItem(gGlobalCtx, itemID, Randomizer_GetNextAdultTradeItem()); + Inventory_ReplaceItem(gPlayState, itemID, Randomizer_GetNextAdultTradeItem()); } } } @@ -730,8 +730,8 @@ void DrawFlagArray16(const FlagTable& flagTable, uint16_t row, uint16_t& flags) void DrawFlagsTab() { if (ImGui::TreeNode("Current Scene")) { - if (gGlobalCtx != nullptr) { - ActorContext* act = &gGlobalCtx->actorCtx; + if (gPlayState != nullptr) { + ActorContext* act = &gPlayState->actorCtx; DrawGroupWithBorder([&]() { ImGui::Text("Switch"); @@ -786,18 +786,18 @@ void DrawFlagsTab() { ImGui::BeginGroup(); if (ImGui::Button("Reload Flags")) { - act->flags.swch = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].swch; - act->flags.clear = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].clear; - act->flags.collect = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].collect; - act->flags.chest = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].chest; + act->flags.swch = gSaveContext.sceneFlags[gPlayState->sceneNum].swch; + act->flags.clear = gSaveContext.sceneFlags[gPlayState->sceneNum].clear; + act->flags.collect = gSaveContext.sceneFlags[gPlayState->sceneNum].collect; + act->flags.chest = gSaveContext.sceneFlags[gPlayState->sceneNum].chest; } UIWidgets::SetLastItemHoverText("Load flags from saved scene flags. Normally happens on scene load"); if (ImGui::Button("Save Flags")) { - gSaveContext.sceneFlags[gGlobalCtx->sceneNum].swch = act->flags.swch; - gSaveContext.sceneFlags[gGlobalCtx->sceneNum].clear = act->flags.clear; - gSaveContext.sceneFlags[gGlobalCtx->sceneNum].collect = act->flags.collect; - gSaveContext.sceneFlags[gGlobalCtx->sceneNum].chest = act->flags.chest; + gSaveContext.sceneFlags[gPlayState->sceneNum].swch = act->flags.swch; + gSaveContext.sceneFlags[gPlayState->sceneNum].clear = act->flags.clear; + gSaveContext.sceneFlags[gPlayState->sceneNum].collect = act->flags.collect; + gSaveContext.sceneFlags[gPlayState->sceneNum].chest = act->flags.chest; } UIWidgets::SetLastItemHoverText("Save current scene flags. Normally happens on scene exit"); @@ -833,10 +833,10 @@ void DrawFlagsTab() { } // Don't show current scene button if there is no current scene - if (gGlobalCtx != nullptr) { + if (gPlayState != nullptr) { ImGui::SameLine(); if (ImGui::Button("Current")) { - selectedSceneFlagMap = gGlobalCtx->sceneNum; + selectedSceneFlagMap = gPlayState->sceneNum; } UIWidgets::SetLastItemHoverText("Open flags for current scene"); } @@ -1316,8 +1316,8 @@ void DrawQuestStatusTab() { } void DrawPlayerTab() { - if (gGlobalCtx != nullptr) { - Player* player = GET_PLAYER(gGlobalCtx); + if (gPlayState != nullptr) { + Player* player = GET_PLAYER(gPlayState); const char* curSword; const char* curShield; const char* curTunic; @@ -1434,12 +1434,12 @@ void DrawPlayerTab() { ImGui::InputScalar("Gravity", ImGuiDataType_Float, &player->actor.gravity); UIWidgets::InsertHelpHoverText("Rate at which Link falls. Default -4.0f"); - if (ImGui::BeginCombo("Link Age on Load", gGlobalCtx->linkAgeOnLoad == 0 ? "Adult" : "Child")) { + if (ImGui::BeginCombo("Link Age on Load", gPlayState->linkAgeOnLoad == 0 ? "Adult" : "Child")) { if (ImGui::Selectable("Adult")) { - gGlobalCtx->linkAgeOnLoad = 0; + gPlayState->linkAgeOnLoad = 0; } if (ImGui::Selectable("Child")) { - gGlobalCtx->linkAgeOnLoad = 1; + gPlayState->linkAgeOnLoad = 1; } ImGui::EndCombo(); } diff --git a/soh/soh/Enhancements/gameconsole.c b/soh/soh/Enhancements/gameconsole.c index 58cb5f750..4c2551bbf 100644 --- a/soh/soh/Enhancements/gameconsole.c +++ b/soh/soh/Enhancements/gameconsole.c @@ -15,6 +15,6 @@ #include #include -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; void GameConsole_Init() {} \ No newline at end of file diff --git a/soh/soh/Enhancements/gameconsole.h b/soh/soh/Enhancements/gameconsole.h index 27838ff63..59c609615 100644 --- a/soh/soh/Enhancements/gameconsole.h +++ b/soh/soh/Enhancements/gameconsole.h @@ -29,7 +29,7 @@ typedef struct ConsoleCommand char* description; } ConsoleCommand; -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; void GameConsole_Init(); diff --git a/soh/soh/Enhancements/gfx.c b/soh/soh/Enhancements/gfx.c index d63827a91..25ff1a1ab 100644 --- a/soh/soh/Enhancements/gfx.c +++ b/soh/soh/Enhancements/gfx.c @@ -3,13 +3,13 @@ #include "global.h" #include "z64.h" -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; /** * Simple wrapper to load a texture to be drawn. */ void sprite_load(sprite_t* sprite) { - OPEN_DISPS(gGlobalCtx->state.gfxCtx); + OPEN_DISPS(gPlayState->state.gfxCtx); if (sprite->im_siz == G_IM_SIZ_16b) { gDPLoadTextureBlock( @@ -37,7 +37,7 @@ void sprite_load(sprite_t* sprite) { ); } - CLOSE_DISPS(gGlobalCtx->state.gfxCtx); + CLOSE_DISPS(gPlayState->state.gfxCtx); } /** @@ -48,7 +48,7 @@ void sprite_draw(sprite_t* sprite, int left, int top, int width, int height) { int width_factor = (1 << 10) * sprite->width / width; int height_factor = (1 << 10) * sprite->height / height; - OPEN_DISPS(gGlobalCtx->state.gfxCtx); + OPEN_DISPS(gPlayState->state.gfxCtx); gSPWideTextureRectangle( OVERLAY_DISP++, @@ -59,5 +59,5 @@ void sprite_draw(sprite_t* sprite, int left, int top, int width, int height) { width_factor, height_factor ); - CLOSE_DISPS(gGlobalCtx->state.gfxCtx); + CLOSE_DISPS(gPlayState->state.gfxCtx); } diff --git a/soh/soh/Enhancements/item-tables/ItemTableTypes.h b/soh/soh/Enhancements/item-tables/ItemTableTypes.h index 19b831d65..34c7b556b 100644 --- a/soh/soh/Enhancements/item-tables/ItemTableTypes.h +++ b/soh/soh/Enhancements/item-tables/ItemTableTypes.h @@ -35,10 +35,10 @@ typedef enum GetItemCategory { #define GET_ITEM_NONE \ { ITEM_NONE, 0, 0, 0, 0, 0, 0, 0, false, ITEM_FROM_NPC, ITEM_CATEGORY_JUNK, NULL } -typedef struct GlobalContext GlobalContext; +typedef struct PlayState PlayState; typedef struct GetItemEntry GetItemEntry; -typedef void (*CustomDrawFunc)(GlobalContext* globalCtx, GetItemEntry* getItemEntry); +typedef void (*CustomDrawFunc)(PlayState* play, GetItemEntry* getItemEntry); typedef struct GetItemEntry { /* 0x00 */ uint16_t itemId; diff --git a/soh/soh/Enhancements/randomizer/adult_trade_shuffle.c b/soh/soh/Enhancements/randomizer/adult_trade_shuffle.c index 1bddf0c2f..c1acc100b 100644 --- a/soh/soh/Enhancements/randomizer/adult_trade_shuffle.c +++ b/soh/soh/Enhancements/randomizer/adult_trade_shuffle.c @@ -3,9 +3,9 @@ #include "variables.h" #include "macros.h" -void Randomizer_ConsumeAdultTradeItem(GlobalContext* globalCtx, u8 itemId) { +void Randomizer_ConsumeAdultTradeItem(PlayState* play, u8 itemId) { gSaveContext.adultTradeItems &= ~ADULT_TRADE_FLAG(itemId); - Inventory_ReplaceItem(globalCtx, itemId, Randomizer_GetNextAdultTradeItem()); + Inventory_ReplaceItem(play, itemId, Randomizer_GetNextAdultTradeItem()); } u8 Randomizer_GetNextAdultTradeItem() { diff --git a/soh/soh/Enhancements/randomizer/adult_trade_shuffle.h b/soh/soh/Enhancements/randomizer/adult_trade_shuffle.h index d30ca2839..13d905026 100644 --- a/soh/soh/Enhancements/randomizer/adult_trade_shuffle.h +++ b/soh/soh/Enhancements/randomizer/adult_trade_shuffle.h @@ -6,7 +6,7 @@ #define ADULT_TRADE_FLAG(itemId) (1 << (itemId - ITEM_POCKET_EGG)) #define PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(itemID) (gSaveContext.adultTradeItems & ADULT_TRADE_FLAG(itemID)) -void Randomizer_ConsumeAdultTradeItem(GlobalContext* globalCtx, u8 itemId); +void Randomizer_ConsumeAdultTradeItem(PlayState* play, u8 itemId); u8 Randomizer_GetNextAdultTradeItem(); u8 Randomizer_GetPrevAdultTradeItem(); diff --git a/soh/soh/Enhancements/randomizer/draw.cpp b/soh/soh/Enhancements/randomizer/draw.cpp index 550d71104..da56620c9 100644 --- a/soh/soh/Enhancements/randomizer/draw.cpp +++ b/soh/soh/Enhancements/randomizer/draw.cpp @@ -8,7 +8,7 @@ #include "objects/object_gi_bosskey/object_gi_bosskey.h" #include "objects/object_gi_hearts/object_gi_hearts.h" -extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry) { +extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEntry) { s32 pad; s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY; @@ -24,11 +24,11 @@ extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry* { 80, 80, 80 } // Ganon's Castle }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); gsDPSetGrayscaleColor(POLY_OPA_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 255); @@ -38,10 +38,10 @@ extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry* gsSPGrayscale(POLY_OPA_DISP++, false); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry) { +extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEntry) { s32 pad; s16 color_slot; color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY; @@ -54,11 +54,11 @@ extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* g { 210, 0, 0 } // Ganon's Castle }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); if (color_slot == 5) { // Ganon's Boss Key @@ -72,9 +72,9 @@ extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* g gsSPGrayscale(POLY_OPA_DISP++, false); } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); gsDPSetGrayscaleColor(POLY_XLU_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], @@ -85,10 +85,10 @@ extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* g gsSPGrayscale(POLY_XLU_DISP++, false); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* getItemEntry) { +extern "C" void Randomizer_DrawKeyRing(PlayState* play, GetItemEntry* getItemEntry) { s32 pad; s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_KEY_RING; @@ -104,9 +104,9 @@ extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* g { 80, 80, 80 } // Ganon's Castle }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gsDPSetGrayscaleColor(POLY_OPA_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 255); gsSPGrayscale(POLY_OPA_DISP++, true); @@ -122,7 +122,7 @@ extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* g Matrix_RotateY(-(0.19f * 2), MTXMODE_APPLY); Matrix_RotateZ(-(0.20f * 2), MTXMODE_APPLY); for (int i = 0; i < 5; i++) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); Matrix_Translate(3.12f, -0.34f, 17.53f, MTXMODE_APPLY); Matrix_RotateX(-0.31f, MTXMODE_APPLY); @@ -133,16 +133,16 @@ extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* g gsSPGrayscale(POLY_OPA_DISP++, false); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -extern "C" void Randomizer_DrawDoubleDefense(GlobalContext* globalCtx, GetItemEntry getItemEntry) { +extern "C" void Randomizer_DrawDoubleDefense(PlayState* play, GetItemEntry getItemEntry) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); gsDPSetGrayscaleColor(POLY_XLU_DISP++, 255, 255, 255, 255); gsSPGrayscale(POLY_XLU_DISP++, true); @@ -153,5 +153,5 @@ extern "C" void Randomizer_DrawDoubleDefense(GlobalContext* globalCtx, GetItemEn gSPDisplayList(POLY_XLU_DISP++, (Gfx*)gGiHeartContainerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/soh/Enhancements/randomizer/draw.h b/soh/soh/Enhancements/randomizer/draw.h index 71974342c..1e1515456 100644 --- a/soh/soh/Enhancements/randomizer/draw.h +++ b/soh/soh/Enhancements/randomizer/draw.h @@ -4,11 +4,11 @@ #include "../item-tables/ItemTableTypes.h" -typedef struct GlobalContext GlobalContext; +typedef struct PlayState PlayState; -extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry); -extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* getItemEntry); -extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry); -extern "C" void Randomizer_DrawDoubleDefense(GlobalContext* globalCtx, GetItemEntry getItemEntry); +extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEntry); +extern "C" void Randomizer_DrawKeyRing(PlayState* play, GetItemEntry* getItemEntry); +extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEntry); +extern "C" void Randomizer_DrawDoubleDefense(PlayState* play, GetItemEntry getItemEntry); #endif diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index d46faf286..4a8141d7f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -15,7 +15,7 @@ extern "C" { #include "variables.h" #include "functions.h" #include "macros.h" -extern GlobalContext* gGlobalCtx; +extern PlayState* gPlayState; #include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_24_static/icon_item_24_static.h" @@ -862,7 +862,7 @@ void DrawItemTracker(bool& open) { int comboButton1Mask = buttonMap[CVar_GetS32("gItemTrackerComboButton1", 6)]; int comboButton2Mask = buttonMap[CVar_GetS32("gItemTrackerComboButton2", 8)]; bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask; - bool isPaused = CVar_GetS32("gItemTrackerShowOnlyPaused", 0) == 0 || gGlobalCtx != nullptr && gGlobalCtx->pauseCtx.state > 0; + bool isPaused = CVar_GetS32("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0; if (CVar_GetS32("gItemTrackerWindowType", 0) == 1 || isPaused && (CVar_GetS32("gItemTrackerDisplayType", 0) == 0 ? CVar_GetS32("gItemTrackerEnabled", 0) : comboButtonsHeld)) { if ( diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index 4296ce869..91f7d5ec9 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -22,7 +22,7 @@ #include "../../src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "../../src/overlays/actors/ovl_En_Fr/z_en_fr.h" -extern "C" GlobalContext* gGlobalCtx; +extern "C" PlayState* gPlayState; // FROM z_lights.c // I didn't feel like moving it into a header file. @@ -860,7 +860,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) { } SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { - if (gGlobalCtx == nullptr) { + if (gPlayState == nullptr) { SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\""); SohImGui::GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot); return SaveStateReturn::FAIL_WRONG_GAMESTATE; diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index ff538be42..1e2487348 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -652,7 +652,7 @@ uint32_t IsSceneMasterQuest(s16 sceneNum) { value = 0; if (gSaveContext.n64ddFlag) { if (!OTRGlobals::Instance->gRandomizer->masterQuestDungeons.empty()) { - if (gGlobalCtx != NULL && OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(sceneNum)) { + if (gPlayState != NULL && OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(sceneNum)) { value = 1; } } @@ -663,7 +663,7 @@ uint32_t IsSceneMasterQuest(s16 sceneNum) { } uint32_t IsGameMasterQuest() { - return gGlobalCtx != NULL ? IsSceneMasterQuest(gGlobalCtx->sceneNum) : 0; + return gPlayState != NULL ? IsSceneMasterQuest(gPlayState->sceneNum) : 0; } extern "C" uint32_t ResourceMgr_GameHasMasterQuest() { @@ -1898,8 +1898,8 @@ extern "C" CustomMessageEntry Randomizer_GetCustomGetItemMessage(Player* player) return getItemText; } -extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; uint16_t textId = msgCtx->textId; Font* font = &msgCtx->font; char* buffer = font->msgBuf; @@ -1907,7 +1907,7 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { CustomMessageEntry messageEntry; if (gSaveContext.n64ddFlag) { if (textId == TEXT_RANDOMIZER_CUSTOM_ITEM) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->getItemEntry.getItemId == RG_ICE_TRAP) { u16 iceTrapTextId = Random(0, NUM_ICE_TRAP_MESSAGES); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, iceTrapTextId); @@ -1919,29 +1919,29 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { } else if (textId == TEXT_RANDOMIZER_GOSSIP_STONE_HINTS && Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) != 0 && (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 1 || (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 2 && - Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) || + Player_GetMask(play) == PLAYER_MASK_TRUTH) || (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 3 && CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)))) { s16 actorParams = msgCtx->talkActor->params; // if we're in a generic grotto - if (globalCtx->sceneNum == 62 && actorParams == 14360) { + if (play->sceneNum == 62 && actorParams == 14360) { // look for the chest in the actorlist to determine // which grotto we're in int numOfActorLists = - sizeof(globalCtx->actorCtx.actorLists) / sizeof(globalCtx->actorCtx.actorLists[0]); + sizeof(play->actorCtx.actorLists) / sizeof(play->actorCtx.actorLists[0]); for (int i = 0; i < numOfActorLists; i++) { - if (globalCtx->actorCtx.actorLists[i].length) { - if (globalCtx->actorCtx.actorLists[i].head->id == 10) { + if (play->actorCtx.actorLists[i].length) { + if (play->actorCtx.actorLists[i].head->id == 10) { // set the params for the hint check to be negative chest params - actorParams = 0 - globalCtx->actorCtx.actorLists[i].head->params; + actorParams = 0 - play->actorCtx.actorLists[i].head->params; } } } } RandomizerCheck hintCheck = - Randomizer_GetCheckFromActor(msgCtx->talkActor->id, globalCtx->sceneNum, actorParams); + Randomizer_GetCheckFromActor(msgCtx->talkActor->id, play->sceneNum, actorParams); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, hintCheck); } else if (textId == TEXT_ALTAR_CHILD || textId == TEXT_ALTAR_ADULT) { @@ -1958,7 +1958,7 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { // textId: TEXT_SCRUB_RANDOM + (randomizerInf - RAND_INF_SCRUBS_PURCHASED_DODONGOS_CAVERN_DEKU_SCRUB_NEAR_BOMB_BAG_LEFT) } else if (textId >= TEXT_SCRUB_RANDOM && textId <= TEXT_SCRUB_RANDOM + NUM_SCRUBS) { RandomizerInf randoInf = (RandomizerInf)((textId - TEXT_SCRUB_RANDOM) + RAND_INF_SCRUBS_PURCHASED_DODONGOS_CAVERN_DEKU_SCRUB_NEAR_BOMB_BAG_LEFT); - messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SCRUB_RANDOM, Player_GetMask(globalCtx) != PLAYER_MASK_TRUTH); + messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SCRUB_RANDOM, Player_GetMask(play) != PLAYER_MASK_TRUTH); // Shop items each have two message entries, second one offset by NUM_SHOP_ITEMS // textId: TEXT_SHOP_ITEM_RANDOM + (randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) // textId: TEXT_SHOP_ITEM_RANDOM + ((randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) + NUM_SHOP_ITEMS) diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 0dc49b6e2..2d84097e4 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -126,7 +126,7 @@ GetItemEntry Randomizer_GetItemFromActorWithoutObtainabilityCheck(s16 actorId, s GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId); GetItemEntry Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(RandomizerCheck randomizerCheck, GetItemID ogId); ItemObtainability Randomizer_GetItemObtainabilityFromRandomizerCheck(RandomizerCheck randomizerCheck); -int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx); +int CustomMessage_RetrieveIfExists(PlayState* play); void Overlay_DisplayText(float duration, const char* text); GetItemEntry ItemTable_Retrieve(int16_t getItemID); GetItemEntry ItemTable_RetrieveEntry(s16 modIndex, s16 getItemID); diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 1e7ee687c..7d70a19ee 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -6,25 +6,25 @@ #include "vt.h" #include -extern "C" void Gameplay_InitScene(GlobalContext * globalCtx, s32 spawn); -extern "C" void Gameplay_InitEnvironment(GlobalContext * globalCtx, s16 skyboxId); -void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn); -s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* sceneCmd); +extern "C" void Play_InitScene(PlayState * play, s32 spawn); +extern "C" void Play_InitEnvironment(PlayState * play, s16 skyboxId); +void OTRPlay_InitScene(PlayState* play, s32 spawn); +s32 OTRScene_ExecuteCommands(PlayState* play, Ship::Scene* sceneCmd); -//Ship::OTRResource* OTRGameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) { -Ship::Resource* OTRGameplay_LoadFile(GlobalContext* globalCtx, const char* fileName) +//Ship::OTRResource* OTRPlay_LoadFile(PlayState* play, RomFile* file) { +Ship::Resource* OTRPlay_LoadFile(PlayState* play, const char* fileName) { auto res = OTRGlobals::Instance->context->GetResourceManager()->LoadResource(fileName); return res.get(); } -extern "C" void OTRGameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) { +extern "C" void OTRPlay_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) { SceneTableEntry* scene = &gSceneTable[sceneNum]; scene->unk_13 = 0; - globalCtx->loadedScene = scene; - globalCtx->sceneNum = sceneNum; - globalCtx->sceneConfig = scene->config; + play->loadedScene = scene; + play->sceneNum = sceneNum; + play->sceneConfig = scene->config; //osSyncPrintf("\nSCENE SIZE %fK\n", (scene->sceneFile.vromEnd - scene->sceneFile.vromStart) / 1024.0f); @@ -36,44 +36,44 @@ extern "C" void OTRGameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s } std::string scenePath = StringHelper::Sprintf("scenes/%s/%s/%s", sceneVersion.c_str(), scene->sceneFile.fileName, scene->sceneFile.fileName); - globalCtx->sceneSegment = (Ship::Scene*)OTRGameplay_LoadFile(globalCtx, scenePath.c_str()); + play->sceneSegment = (Ship::Scene*)OTRPlay_LoadFile(play, scenePath.c_str()); // Failed to load scene... default to doodongs cavern - if (globalCtx->sceneSegment == nullptr) + if (play->sceneSegment == nullptr) { lusprintf(__FILE__, __LINE__, 2, "Unable to load scene %s... Defaulting to Doodong's Cavern!\n", scenePath.c_str()); - OTRGameplay_SpawnScene(globalCtx, 0x01, 0); + OTRPlay_SpawnScene(play, 0x01, 0); return; } scene->unk_13 = 0; - //ASSERT(globalCtx->sceneSegment != NULL); - //gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment); + //ASSERT(play->sceneSegment != NULL); + //gSegments[2] = VIRTUAL_TO_PHYSICAL(play->sceneSegment); - OTRGameplay_InitScene(globalCtx, spawn); + OTRPlay_InitScene(play, spawn); - osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(globalCtx, &globalCtx->roomCtx) / 1024.0f); + osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(play, &play->roomCtx) / 1024.0f); } -void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn) { - globalCtx->curSpawn = spawn; - globalCtx->linkActorEntry = nullptr; - globalCtx->unk_11DFC = nullptr; - globalCtx->setupEntranceList = nullptr; - globalCtx->setupExitList = nullptr; - globalCtx->cUpElfMsgs = nullptr; - globalCtx->setupPathList = nullptr; - globalCtx->numSetupActors = 0; - Object_InitBank(globalCtx, &globalCtx->objectCtx); - LightContext_Init(globalCtx, &globalCtx->lightCtx); - TransitionActor_InitContext(&globalCtx->state, &globalCtx->transiActorCtx); - func_80096FD4(globalCtx, &globalCtx->roomCtx.curRoom); +void OTRPlay_InitScene(PlayState* play, s32 spawn) { + play->curSpawn = spawn; + play->linkActorEntry = nullptr; + play->unk_11DFC = nullptr; + play->setupEntranceList = nullptr; + play->setupExitList = nullptr; + play->cUpElfMsgs = nullptr; + play->setupPathList = nullptr; + play->numSetupActors = 0; + Object_InitBank(play, &play->objectCtx); + LightContext_Init(play, &play->lightCtx); + TransitionActor_InitContext(&play->state, &play->transiActorCtx); + func_80096FD4(play, &play->roomCtx.curRoom); YREG(15) = 0; gSaveContext.worldMapArea = 0; - OTRScene_ExecuteCommands(globalCtx, globalCtx->sceneSegment); - Gameplay_InitEnvironment(globalCtx, globalCtx->skyboxId); + OTRScene_ExecuteCommands(play, play->sceneSegment); + Play_InitEnvironment(play, play->skyboxId); /* auto data = static_cast(Ship::Window::GetInstance() ->GetResourceManager() ->LoadResource("object_link_child\\object_link_childVtx_01FE08") diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 556505d27..74a07c3b6 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -11,10 +11,10 @@ #include #include -extern Ship::Resource* OTRGameplay_LoadFile(GlobalContext* globalCtx, const char* fileName); +extern Ship::Resource* OTRPlay_LoadFile(PlayState* play, const char* fileName); extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); extern "C" RomFile sNaviMsgFiles[]; -s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene); +s32 OTRScene_ExecuteCommands(PlayState* play, Ship::Scene* scene); std::shared_ptr ResourceMgr_LoadFile(const char* path) { std::string Path = path; @@ -30,7 +30,7 @@ std::shared_ptr ResourceMgr_LoadFile(const char* path) { // Forward Declaration of function declared in OTRGlobals.cpp std::shared_ptr ResourceMgr_LoadResource(const char* path); -bool Scene_CommandSpawnList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSpawnList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetStartPositionList* cmdStartPos = (Ship::SetStartPositionList*)cmd; @@ -39,7 +39,7 @@ bool Scene_CommandSpawnList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) if (cmdStartPos->cachedGameData != nullptr) { ActorEntry* entries = (ActorEntry*)cmdStartPos->cachedGameData; - linkSpawnEntry = &entries[globalCtx->setupEntranceList[globalCtx->curSpawn].spawn]; + linkSpawnEntry = &entries[play->setupEntranceList[play->curSpawn].spawn]; } else { @@ -57,31 +57,31 @@ bool Scene_CommandSpawnList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) entries[i].rot.z = cmdStartPos->entries[i].rotZ; } - linkSpawnEntry = &entries[globalCtx->setupEntranceList[globalCtx->curSpawn].spawn]; + linkSpawnEntry = &entries[play->setupEntranceList[play->curSpawn].spawn]; cmdStartPos->cachedGameData = entries; } - ActorEntry* linkEntry = globalCtx->linkActorEntry = linkSpawnEntry; + ActorEntry* linkEntry = play->linkActorEntry = linkSpawnEntry; s16 linkObjectId; - globalCtx->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); + play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)]; //gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId; - Object_Spawn(&globalCtx->objectCtx, linkObjectId); + Object_Spawn(&play->objectCtx, linkObjectId); return false; } -bool Scene_CommandActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandActorList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetActorList* cmdActor = (Ship::SetActorList*)cmd; - globalCtx->numSetupActors = cmdActor->entries.size(); + play->numSetupActors = cmdActor->entries.size(); if (cmdActor->cachedGameData != nullptr) - globalCtx->setupActorList = (ActorEntry*)cmdActor->cachedGameData; + play->setupActorList = (ActorEntry*)cmdActor->cachedGameData; else { ActorEntry* entries = (ActorEntry*)malloc(cmdActor->entries.size() * sizeof(ActorEntry)); @@ -99,21 +99,21 @@ bool Scene_CommandActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { } cmdActor->cachedGameData = entries; - globalCtx->setupActorList = entries; + play->setupActorList = entries; } return false; } -bool Scene_CommandUnused2(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandUnused2(PlayState* play, Ship::SceneCommand* cmd) { // Do we need to implement this? - //globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); + //play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); return false; } -bool Scene_CommandCollisionHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandCollisionHeader(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetCollisionHeader* cmdCol = (Ship::SetCollisionHeader*)cmd; @@ -214,100 +214,100 @@ bool Scene_CommandCollisionHeader(GlobalContext* globalCtx, Ship::SceneCommand* colRes->cachedGameAsset = colHeader; } - BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader); + BgCheck_Allocate(&play->colCtx, play, colHeader); return false; } -bool Scene_CommandRoomList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandRoomList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetRoomList* cmdRoomList = (Ship::SetRoomList*)cmd; - globalCtx->numRooms = cmdRoomList->rooms.size(); - globalCtx->roomList = (RomFile*)malloc(globalCtx->numRooms * sizeof(RomFile)); + play->numRooms = cmdRoomList->rooms.size(); + play->roomList = (RomFile*)malloc(play->numRooms * sizeof(RomFile)); for (int i = 0; i < cmdRoomList->rooms.size(); i++) { - globalCtx->roomList[i].fileName = (char*)cmdRoomList->rooms[i].name.c_str(); - globalCtx->roomList[i].vromStart = cmdRoomList->rooms[i].vromStart; - globalCtx->roomList[i].vromEnd = cmdRoomList->rooms[i].vromEnd; + play->roomList[i].fileName = (char*)cmdRoomList->rooms[i].name.c_str(); + play->roomList[i].vromStart = cmdRoomList->rooms[i].vromStart; + play->roomList[i].vromEnd = cmdRoomList->rooms[i].vromEnd; } return false; } -bool Scene_CommandEntranceList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandEntranceList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetEntranceList* otrEntrance = (Ship::SetEntranceList*)cmd; if (otrEntrance->cachedGameData != nullptr) - globalCtx->setupEntranceList = (EntranceEntry*)otrEntrance->cachedGameData; + play->setupEntranceList = (EntranceEntry*)otrEntrance->cachedGameData; else { - globalCtx->setupEntranceList = (EntranceEntry*)malloc(otrEntrance->entrances.size() * sizeof(EntranceEntry)); + play->setupEntranceList = (EntranceEntry*)malloc(otrEntrance->entrances.size() * sizeof(EntranceEntry)); for (int i = 0; i < otrEntrance->entrances.size(); i++) { - globalCtx->setupEntranceList[i].room = otrEntrance->entrances[i].roomToLoad; - globalCtx->setupEntranceList[i].spawn = otrEntrance->entrances[i].startPositionIndex; + play->setupEntranceList[i].room = otrEntrance->entrances[i].roomToLoad; + play->setupEntranceList[i].spawn = otrEntrance->entrances[i].startPositionIndex; } - otrEntrance->cachedGameData = globalCtx->setupEntranceList; + otrEntrance->cachedGameData = play->setupEntranceList; } return false; } -bool Scene_CommandSpecialFiles(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSpecialFiles(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetSpecialObjects* otrSpecial = (Ship::SetSpecialObjects*)cmd; if (otrSpecial->globalObject != 0) - globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, otrSpecial->globalObject); + play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, otrSpecial->globalObject); if (otrSpecial->elfMessage != 0) { - auto res = (Ship::Blob*)OTRGameplay_LoadFile(globalCtx, sNaviMsgFiles[otrSpecial->elfMessage - 1].fileName); - globalCtx->cUpElfMsgs = (ElfMessage*)res->data.data(); + auto res = (Ship::Blob*)OTRPlay_LoadFile(play, sNaviMsgFiles[otrSpecial->elfMessage - 1].fileName); + play->cUpElfMsgs = (ElfMessage*)res->data.data(); } return false; } -bool Scene_CommandRoomBehavior(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandRoomBehavior(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetRoomBehavior* cmdRoom = (Ship::SetRoomBehavior*)cmd; - globalCtx->roomCtx.curRoom.behaviorType1 = cmdRoom->gameplayFlags; - globalCtx->roomCtx.curRoom.behaviorType2 = cmdRoom->gameplayFlags2 & 0xFF; - globalCtx->roomCtx.curRoom.lensMode = (cmdRoom->gameplayFlags2 >> 8) & 1; - globalCtx->msgCtx.disableWarpSongs = (cmdRoom->gameplayFlags2 >> 0xA) & 1; + play->roomCtx.curRoom.behaviorType1 = cmdRoom->gameplayFlags; + play->roomCtx.curRoom.behaviorType2 = cmdRoom->gameplayFlags2 & 0xFF; + play->roomCtx.curRoom.lensMode = (cmdRoom->gameplayFlags2 >> 8) & 1; + play->msgCtx.disableWarpSongs = (cmdRoom->gameplayFlags2 >> 0xA) & 1; return false; } -bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandMeshHeader(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetMesh* otrMesh = (Ship::SetMesh*)cmd; if (otrMesh->cachedGameData != nullptr) - globalCtx->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->cachedGameData; + play->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->cachedGameData; else { - globalCtx->roomCtx.curRoom.meshHeader = (MeshHeader*)malloc(sizeof(MeshHeader)); - globalCtx->roomCtx.curRoom.meshHeader->base.type = otrMesh->meshHeaderType; - globalCtx->roomCtx.curRoom.meshHeader->polygon0.num = otrMesh->meshes.size(); + play->roomCtx.curRoom.meshHeader = (MeshHeader*)malloc(sizeof(MeshHeader)); + play->roomCtx.curRoom.meshHeader->base.type = otrMesh->meshHeaderType; + play->roomCtx.curRoom.meshHeader->polygon0.num = otrMesh->meshes.size(); if (otrMesh->meshHeaderType == 2) - globalCtx->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist2) * globalCtx->roomCtx.curRoom.meshHeader->polygon0.num); + play->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist2) * play->roomCtx.curRoom.meshHeader->polygon0.num); else - globalCtx->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist) * globalCtx->roomCtx.curRoom.meshHeader->polygon0.num); + play->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist) * play->roomCtx.curRoom.meshHeader->polygon0.num); - for (int i = 0; i < globalCtx->roomCtx.curRoom.meshHeader->polygon0.num; i++) + for (int i = 0; i < play->roomCtx.curRoom.meshHeader->polygon0.num; i++) { if (otrMesh->meshHeaderType == 2) { - PolygonDlist2* arr = (PolygonDlist2*)globalCtx->roomCtx.curRoom.meshHeader->polygon0.start; + PolygonDlist2* arr = (PolygonDlist2*)play->roomCtx.curRoom.meshHeader->polygon0.start; PolygonDlist2* dlist = &arr[i]; if (otrMesh->meshes[i].opa != "") @@ -339,7 +339,7 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) dlist->pos.z = otrMesh->meshes[i].z; dlist->unk_06 = otrMesh->meshes[i].unk_06; - //globalCtx->roomCtx.curRoom.meshHeader->base.start = dlist; + //play->roomCtx.curRoom.meshHeader->base.start = dlist; } else if (otrMesh->meshHeaderType == 1) { @@ -355,56 +355,56 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) else pType->xlu = 0; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.dlist = (Gfx*)pType; + play->roomCtx.curRoom.meshHeader->polygon1.dlist = (Gfx*)pType; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.format = otrMesh->meshes[0].imgFmt; + play->roomCtx.curRoom.meshHeader->polygon1.format = otrMesh->meshes[0].imgFmt; if (otrMesh->meshes[0].imgFmt == 1) { - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.source = + play->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; + play->roomCtx.curRoom.meshHeader->polygon1.single.source = (void*)(ResourceMgr_LoadFile(otrMesh->meshes[0].images[0].sourceBackground.c_str())) .get() ->buffer.get(); - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.siz = otrMesh->meshes[0].images[0].siz; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.width = otrMesh->meshes[0].images[0].width; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.height = otrMesh->meshes[0].images[0].height; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.mode0 = otrMesh->meshes[0].images[0].mode0; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.tlutCount = otrMesh->meshes[0].images[0].tlutCount; + play->roomCtx.curRoom.meshHeader->polygon1.single.siz = otrMesh->meshes[0].images[0].siz; + play->roomCtx.curRoom.meshHeader->polygon1.single.width = otrMesh->meshes[0].images[0].width; + play->roomCtx.curRoom.meshHeader->polygon1.single.height = otrMesh->meshes[0].images[0].height; + play->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt; + play->roomCtx.curRoom.meshHeader->polygon1.single.mode0 = otrMesh->meshes[0].images[0].mode0; + play->roomCtx.curRoom.meshHeader->polygon1.single.tlutCount = otrMesh->meshes[0].images[0].tlutCount; } else { - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.count = otrMesh->meshes[0].images.size(); - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list = - (BgImage*)calloc(sizeof(BgImage), globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.count); + play->roomCtx.curRoom.meshHeader->polygon1.multi.count = otrMesh->meshes[0].images.size(); + play->roomCtx.curRoom.meshHeader->polygon1.multi.list = + (BgImage*)calloc(sizeof(BgImage), play->roomCtx.curRoom.meshHeader->polygon1.multi.count); for (size_t i = 0; i < otrMesh->meshes[0].images.size(); i++) { - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].source = + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].source = (void*)(ResourceMgr_LoadFile(otrMesh->meshes[0].images[i].sourceBackground.c_str())) .get() ->buffer.get(); - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].siz = otrMesh->meshes[0].images[i].siz; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].width = otrMesh->meshes[0].images[i].width; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].height = + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].siz = otrMesh->meshes[0].images[i].siz; + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].width = otrMesh->meshes[0].images[i].width; + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].height = otrMesh->meshes[0].images[i].height; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].mode0 = otrMesh->meshes[0].images[i].mode0; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].tlutCount = + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt; + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].mode0 = otrMesh->meshes[0].images[i].mode0; + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].tlutCount = otrMesh->meshes[0].images[i].tlutCount; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_00 = + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_00 = otrMesh->meshes[0].images[i].unk_00; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_0C = + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_0C = otrMesh->meshes[0].images[i].unk_0C; - globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].id = otrMesh->meshes[0].images[i].id; + play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].id = otrMesh->meshes[0].images[i].id; } } } else { - PolygonDlist* arr = (PolygonDlist*)globalCtx->roomCtx.curRoom.meshHeader->polygon0.start; + PolygonDlist* arr = (PolygonDlist*)play->roomCtx.curRoom.meshHeader->polygon0.start; PolygonDlist* dlist = &arr[i]; if (otrMesh->meshes[i].opa != "") @@ -427,11 +427,11 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) else dlist->xlu = 0; - //globalCtx->roomCtx.curRoom.meshHeader->base.start = dlist; + //play->roomCtx.curRoom.meshHeader->base.start = dlist; } } - otrMesh->cachedGameData = globalCtx->roomCtx.curRoom.meshHeader; + otrMesh->cachedGameData = play->roomCtx.curRoom.meshHeader; } return false; @@ -439,7 +439,7 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd) extern "C" void* func_800982FC(ObjectContext * objectCtx, s32 bankIndex, s16 objectId); -bool Scene_CommandObjectList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandObjectList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetObjectList* cmdObj = (Ship::SetObjectList*)cmd; @@ -454,37 +454,37 @@ bool Scene_CommandObjectList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) void* nextPtr; k = 0; - //i = globalCtx->objectCtx.unk_09; + //i = play->objectCtx.unk_09; i = 0; - firstStatus = &globalCtx->objectCtx.status[0]; - status = &globalCtx->objectCtx.status[i]; + firstStatus = &play->objectCtx.status[0]; + status = &play->objectCtx.status[i]; for (int i = 0; i < cmdObj->objects.size(); i++) { bool alreadyIncluded = false; - for (int j = 0; j < globalCtx->objectCtx.num; j++) { - if (globalCtx->objectCtx.status[j].id == cmdObj->objects[i]) { + for (int j = 0; j < play->objectCtx.num; j++) { + if (play->objectCtx.status[j].id == cmdObj->objects[i]) { alreadyIncluded = true; break; } } if (!alreadyIncluded) { - globalCtx->objectCtx.status[globalCtx->objectCtx.num++].id = cmdObj->objects[i]; - func_80031A28(globalCtx, &globalCtx->actorCtx); + play->objectCtx.status[play->objectCtx.num++].id = cmdObj->objects[i]; + func_80031A28(play, &play->actorCtx); } } /* - while (i < globalCtx->objectCtx.num) { + while (i < play->objectCtx.num) { if (status->id != *objectEntry) { - status2 = &globalCtx->objectCtx.status[i]; - for (j = i; j < globalCtx->objectCtx.num; j++) { + status2 = &play->objectCtx.status[i]; + for (j = i; j < play->objectCtx.num; j++) { status2->id = OBJECT_INVALID; status2++; } - globalCtx->objectCtx.num = i; - func_80031A28(globalCtx, &globalCtx->actorCtx); + play->objectCtx.num = i; + func_80031A28(play, &play->actorCtx); continue; } @@ -495,13 +495,13 @@ bool Scene_CommandObjectList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) status++; } - globalCtx->objectCtx.num = i; + play->objectCtx.num = i; */ return false; } -bool Scene_CommandLightList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandLightList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetLightList* cmdLight = (Ship::SetLightList*)cmd; @@ -519,31 +519,31 @@ bool Scene_CommandLightList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) lightInfo[i].params.point.color[1] = cmdLight->lights[i].g; lightInfo[i].params.point.color[2] = cmdLight->lights[i].b; - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &lightInfo[i]); + LightContext_InsertLight(play, &play->lightCtx, &lightInfo[i]); } return false; } -bool Scene_CommandPathList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandPathList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetPathways* cmdPath = (Ship::SetPathways*)cmd; Ship::Path* path = (Ship::Path*)ResourceMgr_LoadResource(cmdPath->paths[0].c_str()).get(); - globalCtx->setupPathList = (Path*)malloc(path->paths.size() * sizeof(Path)); + play->setupPathList = (Path*)malloc(path->paths.size() * sizeof(Path)); //for (int i = 0; i < cmdPath->paths.size(); i++) { for (int j = 0; j < path->paths.size(); j++) { - globalCtx->setupPathList[j].count = path->paths[j].size(); - globalCtx->setupPathList[j].points = (Vec3s*)malloc(sizeof(Vec3s) * path->paths[j].size()); + play->setupPathList[j].count = path->paths[j].size(); + play->setupPathList[j].points = (Vec3s*)malloc(sizeof(Vec3s) * path->paths[j].size()); for (int k = 0; k < path->paths[j].size(); k++) { - globalCtx->setupPathList[j].points[k].x = path->paths[j][k].x; - globalCtx->setupPathList[j].points[k].y = path->paths[j][k].y; - globalCtx->setupPathList[j].points[k].z = path->paths[j][k].z; + play->setupPathList[j].points[k].x = path->paths[j][k].x; + play->setupPathList[j].points[k].y = path->paths[j][k].y; + play->setupPathList[j].points[k].z = path->paths[j][k].z; } } } @@ -551,24 +551,24 @@ bool Scene_CommandPathList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) return false; } -bool Scene_CommandTransitionActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandTransitionActorList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetTransitionActorList* cmdActor = (Ship::SetTransitionActorList*)cmd; - globalCtx->transiActorCtx.numActors = cmdActor->entries.size(); - globalCtx->transiActorCtx.list = (TransitionActorEntry*)malloc(cmdActor->entries.size() * sizeof(TransitionActorEntry)); + play->transiActorCtx.numActors = cmdActor->entries.size(); + play->transiActorCtx.list = (TransitionActorEntry*)malloc(cmdActor->entries.size() * sizeof(TransitionActorEntry)); for (int i = 0; i < cmdActor->entries.size(); i++) { - globalCtx->transiActorCtx.list[i].sides[0].room = cmdActor->entries[i].frontObjectRoom; - globalCtx->transiActorCtx.list[i].sides[0].effects = cmdActor->entries[i].frontTransitionReaction; - globalCtx->transiActorCtx.list[i].sides[1].room = cmdActor->entries[i].backObjectRoom; - globalCtx->transiActorCtx.list[i].sides[1].effects = cmdActor->entries[i].backTransitionReaction; - globalCtx->transiActorCtx.list[i].id = cmdActor->entries[i].actorNum; - globalCtx->transiActorCtx.list[i].pos.x = cmdActor->entries[i].posX; - globalCtx->transiActorCtx.list[i].pos.y = cmdActor->entries[i].posY; - globalCtx->transiActorCtx.list[i].pos.z = cmdActor->entries[i].posZ; - globalCtx->transiActorCtx.list[i].rotY = cmdActor->entries[i].rotY; - globalCtx->transiActorCtx.list[i].params = cmdActor->entries[i].initVar; + play->transiActorCtx.list[i].sides[0].room = cmdActor->entries[i].frontObjectRoom; + play->transiActorCtx.list[i].sides[0].effects = cmdActor->entries[i].frontTransitionReaction; + play->transiActorCtx.list[i].sides[1].room = cmdActor->entries[i].backObjectRoom; + play->transiActorCtx.list[i].sides[1].effects = cmdActor->entries[i].backTransitionReaction; + play->transiActorCtx.list[i].id = cmdActor->entries[i].actorNum; + play->transiActorCtx.list[i].pos.x = cmdActor->entries[i].posX; + play->transiActorCtx.list[i].pos.y = cmdActor->entries[i].posY; + play->transiActorCtx.list[i].pos.z = cmdActor->entries[i].posZ; + play->transiActorCtx.list[i].rotY = cmdActor->entries[i].rotY; + play->transiActorCtx.list[i].params = cmdActor->entries[i].initVar; } return false; @@ -578,69 +578,69 @@ bool Scene_CommandTransitionActorList(GlobalContext* globalCtx, Ship::SceneComma // transiActorCtx->numActors = 0; //} -bool Scene_CommandLightSettingsList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandLightSettingsList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetLightingSettings* otrLight = (Ship::SetLightingSettings*)cmd; - globalCtx->envCtx.numLightSettings = otrLight->settings.size(); - globalCtx->envCtx.lightSettingsList = (EnvLightSettings*)malloc(globalCtx->envCtx.numLightSettings * sizeof(EnvLightSettings)); + play->envCtx.numLightSettings = otrLight->settings.size(); + play->envCtx.lightSettingsList = (EnvLightSettings*)malloc(play->envCtx.numLightSettings * sizeof(EnvLightSettings)); for (int i = 0; i < otrLight->settings.size(); i++) { - globalCtx->envCtx.lightSettingsList[i].ambientColor[0] = otrLight->settings[i].ambientClrR; - globalCtx->envCtx.lightSettingsList[i].ambientColor[1] = otrLight->settings[i].ambientClrG; - globalCtx->envCtx.lightSettingsList[i].ambientColor[2] = otrLight->settings[i].ambientClrB; + play->envCtx.lightSettingsList[i].ambientColor[0] = otrLight->settings[i].ambientClrR; + play->envCtx.lightSettingsList[i].ambientColor[1] = otrLight->settings[i].ambientClrG; + play->envCtx.lightSettingsList[i].ambientColor[2] = otrLight->settings[i].ambientClrB; - globalCtx->envCtx.lightSettingsList[i].light1Color[0] = otrLight->settings[i].diffuseClrA_R; - globalCtx->envCtx.lightSettingsList[i].light1Color[1] = otrLight->settings[i].diffuseClrA_G; - globalCtx->envCtx.lightSettingsList[i].light1Color[2] = otrLight->settings[i].diffuseClrA_B; + play->envCtx.lightSettingsList[i].light1Color[0] = otrLight->settings[i].diffuseClrA_R; + play->envCtx.lightSettingsList[i].light1Color[1] = otrLight->settings[i].diffuseClrA_G; + play->envCtx.lightSettingsList[i].light1Color[2] = otrLight->settings[i].diffuseClrA_B; - globalCtx->envCtx.lightSettingsList[i].light1Dir[0] = otrLight->settings[i].diffuseDirA_X; - globalCtx->envCtx.lightSettingsList[i].light1Dir[1] = otrLight->settings[i].diffuseDirA_Y; - globalCtx->envCtx.lightSettingsList[i].light1Dir[2] = otrLight->settings[i].diffuseDirA_Z; + play->envCtx.lightSettingsList[i].light1Dir[0] = otrLight->settings[i].diffuseDirA_X; + play->envCtx.lightSettingsList[i].light1Dir[1] = otrLight->settings[i].diffuseDirA_Y; + play->envCtx.lightSettingsList[i].light1Dir[2] = otrLight->settings[i].diffuseDirA_Z; - globalCtx->envCtx.lightSettingsList[i].light2Color[0] = otrLight->settings[i].diffuseClrB_R; - globalCtx->envCtx.lightSettingsList[i].light2Color[1] = otrLight->settings[i].diffuseClrB_G; - globalCtx->envCtx.lightSettingsList[i].light2Color[2] = otrLight->settings[i].diffuseClrB_B; + play->envCtx.lightSettingsList[i].light2Color[0] = otrLight->settings[i].diffuseClrB_R; + play->envCtx.lightSettingsList[i].light2Color[1] = otrLight->settings[i].diffuseClrB_G; + play->envCtx.lightSettingsList[i].light2Color[2] = otrLight->settings[i].diffuseClrB_B; - globalCtx->envCtx.lightSettingsList[i].light2Dir[0] = otrLight->settings[i].diffuseDirB_X; - globalCtx->envCtx.lightSettingsList[i].light2Dir[1] = otrLight->settings[i].diffuseDirB_Y; - globalCtx->envCtx.lightSettingsList[i].light2Dir[2] = otrLight->settings[i].diffuseDirB_Z; + play->envCtx.lightSettingsList[i].light2Dir[0] = otrLight->settings[i].diffuseDirB_X; + play->envCtx.lightSettingsList[i].light2Dir[1] = otrLight->settings[i].diffuseDirB_Y; + play->envCtx.lightSettingsList[i].light2Dir[2] = otrLight->settings[i].diffuseDirB_Z; - globalCtx->envCtx.lightSettingsList[i].fogColor[0] = otrLight->settings[i].fogClrR; - globalCtx->envCtx.lightSettingsList[i].fogColor[1] = otrLight->settings[i].fogClrG; - globalCtx->envCtx.lightSettingsList[i].fogColor[2] = otrLight->settings[i].fogClrB; + play->envCtx.lightSettingsList[i].fogColor[0] = otrLight->settings[i].fogClrR; + play->envCtx.lightSettingsList[i].fogColor[1] = otrLight->settings[i].fogClrG; + play->envCtx.lightSettingsList[i].fogColor[2] = otrLight->settings[i].fogClrB; - globalCtx->envCtx.lightSettingsList[i].fogNear = otrLight->settings[i].fogNear; - globalCtx->envCtx.lightSettingsList[i].fogFar = otrLight->settings[i].fogFar; + play->envCtx.lightSettingsList[i].fogNear = otrLight->settings[i].fogNear; + play->envCtx.lightSettingsList[i].fogFar = otrLight->settings[i].fogFar; } return false; } // Scene Command 0x11: Skybox Settings -bool Scene_CommandSkyboxSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSkyboxSettings(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetSkyboxSettings* cmdSky = (Ship::SetSkyboxSettings*)cmd; - globalCtx->skyboxId = cmdSky->skyboxNumber; - globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmdSky->cloudsType; - globalCtx->envCtx.indoors = cmdSky->isIndoors; + play->skyboxId = cmdSky->skyboxNumber; + play->envCtx.unk_17 = play->envCtx.unk_18 = cmdSky->cloudsType; + play->envCtx.indoors = cmdSky->isIndoors; return false; } -bool Scene_CommandSkyboxDisables(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandSkyboxDisables(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetSkyboxModifier* cmdSky = (Ship::SetSkyboxModifier*)cmd; - globalCtx->envCtx.sunMoonDisabled = cmdSky->disableSunMoon; - globalCtx->envCtx.skyboxDisabled = cmdSky->disableSky; + play->envCtx.sunMoonDisabled = cmdSky->disableSunMoon; + play->envCtx.skyboxDisabled = cmdSky->disableSky; return false; } -bool Scene_CommandTimeSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandTimeSettings(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetTimeSettings* cmdTime = (Ship::SetTimeSettings*)cmd; @@ -650,21 +650,21 @@ bool Scene_CommandTimeSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd } if (cmdTime->unk != 0xFF) { - globalCtx->envCtx.timeIncrement = cmdTime->unk; + play->envCtx.timeIncrement = cmdTime->unk; } else { - globalCtx->envCtx.timeIncrement = 0; + play->envCtx.timeIncrement = 0; } if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) { - gTimeIncrement = globalCtx->envCtx.timeIncrement; + gTimeIncrement = play->envCtx.timeIncrement; } - globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f; + play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f; - if (((globalCtx->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) || + if (((play->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) || (gSaveContext.entranceIndex == 0x0604)) { gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime); if ((gSaveContext.skyboxTime >= 0x2AAC) && (gSaveContext.skyboxTime < 0x4555)) { @@ -684,43 +684,43 @@ bool Scene_CommandTimeSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd return false; } -bool Scene_CommandWindSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandWindSettings(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetWind* cmdWind = (Ship::SetWind*)cmd; s8 x = cmdWind->windWest; s8 y = cmdWind->windVertical; s8 z = cmdWind->windSouth; - globalCtx->envCtx.windDirection.x = x; - globalCtx->envCtx.windDirection.y = y; - globalCtx->envCtx.windDirection.z = z; + play->envCtx.windDirection.x = x; + play->envCtx.windDirection.y = y; + play->envCtx.windDirection.z = z; - globalCtx->envCtx.windSpeed = cmdWind->clothFlappingStrength; + play->envCtx.windSpeed = cmdWind->clothFlappingStrength; return false; } -bool Scene_CommandExitList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandExitList(PlayState* play, Ship::SceneCommand* cmd) { Ship::ExitList* cmdExit = (Ship::ExitList*)cmd; - globalCtx->setupExitList = (int16_t*)malloc(cmdExit->exits.size() * sizeof(int16_t)); + play->setupExitList = (int16_t*)malloc(cmdExit->exits.size() * sizeof(int16_t)); for (int i = 0; i < cmdExit->exits.size(); i++) - globalCtx->setupExitList[i] = cmdExit->exits[i]; + play->setupExitList[i] = cmdExit->exits[i]; return false; } -bool Scene_CommandUndefined9(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandUndefined9(PlayState* play, Ship::SceneCommand* cmd) { return false; } -bool Scene_CommandSoundSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) { +bool Scene_CommandSoundSettings(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetSoundSettings* cmdSnd = (Ship::SetSoundSettings*)cmd; - globalCtx->sequenceCtx.seqId = cmdSnd->musicSequence; - globalCtx->sequenceCtx.natureAmbienceId = cmdSnd->nightTimeSFX; + play->sequenceCtx.seqId = cmdSnd->musicSequence; + play->sequenceCtx.natureAmbienceId = cmdSnd->nightTimeSFX; if (gSaveContext.seqId == 0xFF) { Audio_QueueSeqCmd(cmdSnd->reverb | 0xF0000000); @@ -729,16 +729,16 @@ bool Scene_CommandSoundSettings(GlobalContext* globalCtx, Ship::SceneCommand* cm return false; } -bool Scene_CommandEchoSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandEchoSettings(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetEchoSettings* cmdEcho = (Ship::SetEchoSettings*)cmd; - globalCtx->roomCtx.curRoom.echo = cmdEcho->echo; + play->roomCtx.curRoom.echo = cmdEcho->echo; return false; } -bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandAlternateHeaderList(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetAlternateHeaders* cmdHeaders = (Ship::SetAlternateHeaders*)cmd; @@ -759,7 +759,7 @@ bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneComma if (headerData != nullptr) { - OTRScene_ExecuteCommands(globalCtx, headerData); + OTRScene_ExecuteCommands(play, headerData); return true; } else @@ -780,7 +780,7 @@ bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneComma if (headerData != nullptr) { - OTRScene_ExecuteCommands(globalCtx, headerData); + OTRScene_ExecuteCommands(play, headerData); return true; } } @@ -789,33 +789,33 @@ bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneComma return false; } -bool Scene_CommandCutsceneData(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandCutsceneData(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetCutscenes* cmdCS = (Ship::SetCutscenes*)cmd; Ship::Cutscene* csData = (Ship::Cutscene*)ResourceMgr_LoadResource(cmdCS->cutscenePath.c_str()).get(); - globalCtx->csCtx.segment = csData->commands.data(); + play->csCtx.segment = csData->commands.data(); - //osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment); + //osSyncPrintf("\ngame_play->demo_play.data=[%x]", play->csCtx.segment); return false; } // Camera & World Map Area -bool Scene_CommandMiscSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) +bool Scene_CommandMiscSettings(PlayState* play, Ship::SceneCommand* cmd) { Ship::SetCameraSettings* cmdCam = (Ship::SetCameraSettings*)cmd; YREG(15) = cmdCam->cameraMovement; gSaveContext.worldMapArea = cmdCam->mapHighlights; - if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) { + if ((play->sceneNum == SCENE_SHOP1) || (play->sceneNum == SCENE_SYATEKIJYOU)) { if (LINK_AGE_IN_YEARS == YEARS_ADULT) { gSaveContext.worldMapArea = 1; } } - if (((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_GANON_TOU)) || - ((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) { + if (((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_GANON_TOU)) || + ((play->sceneNum >= SCENE_ENTRA) && (play->sceneNum <= SCENE_SHRINE_R))) { if (gSaveContext.cutsceneIndex < 0xFFF0) { gSaveContext.worldMapAreaData |= gBitFlags[gSaveContext.worldMapArea]; osSyncPrintf("000 area_arrival=%x (%d)\n", gSaveContext.worldMapAreaData, @@ -825,7 +825,7 @@ bool Scene_CommandMiscSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd return false; } -bool (*sceneCommands[])(GlobalContext*, Ship::SceneCommand*) = +bool (*sceneCommands[])(PlayState*, Ship::SceneCommand*) = { Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST @@ -855,7 +855,7 @@ bool (*sceneCommands[])(GlobalContext*, Ship::SceneCommand*) = Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS }; -s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene) +s32 OTRScene_ExecuteCommands(PlayState* play, Ship::Scene* scene) { Ship::SceneCommandID cmdCode; @@ -875,7 +875,7 @@ s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene) } if ((int)cmdCode <= 0x19) { - if (sceneCommands[(int)cmdCode](globalCtx, sceneCmd)) + if (sceneCommands[(int)cmdCode](play, sceneCmd)) break; } else { @@ -889,7 +889,7 @@ s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene) return 0; } -extern "C" s32 OTRfunc_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { +extern "C" s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx) { if (roomCtx->status == 1) { //if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { if (1) @@ -898,9 +898,9 @@ extern "C" s32 OTRfunc_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) roomCtx->curRoom.segment = roomCtx->unk_34; gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34); - OTRScene_ExecuteCommands(globalCtx, roomCtx->roomToLoad); - Player_SetBootData(globalCtx, GET_PLAYER(globalCtx)); - Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); + OTRScene_ExecuteCommands(play, roomCtx->roomToLoad); + Player_SetBootData(play, GET_PLAYER(play)); + Actor_SpawnTransitionActors(play, &play->actorCtx); return 1; } @@ -911,7 +911,7 @@ extern "C" s32 OTRfunc_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) return 1; } -extern "C" s32 OTRfunc_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { +extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { u32 size; if (roomCtx->status == 0) { @@ -920,19 +920,19 @@ extern "C" s32 OTRfunc_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - ASSERT(roomNum < globalCtx->numRooms); + ASSERT(roomNum < play->numRooms); - if (roomNum >= globalCtx->numRooms) + if (roomNum >= play->numRooms) return 0; // UH OH - size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart; + size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart; roomCtx->unk_34 = (void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); - //DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0, + //DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0, //&roomCtx->loadQueue, NULL, __FILE__, __LINE__); - auto roomData = ResourceMgr_LoadResource(globalCtx->roomList[roomNum].fileName); + auto roomData = ResourceMgr_LoadResource(play->roomList[roomNum].fileName); roomCtx->status = 1; roomCtx->roomToLoad = (Ship::Scene*)roomData.get(); diff --git a/soh/src/code/code_80043480.c b/soh/src/code/code_80043480.c index eda615d35..3ba733e26 100644 --- a/soh/src/code/code_80043480.c +++ b/soh/src/code/code_80043480.c @@ -76,7 +76,7 @@ s32 func_800435B4(DynaPolyActor* dynaActor) { } } -s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) { +s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) { Vec3f posA; Vec3f posB; Vec3f posResult; @@ -98,7 +98,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, posB.y = posA.y; posB.z = sign * a3 * cos + posA.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, + if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, &dynaActor->actor, 0.0f)) { return false; } @@ -106,7 +106,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, posA.z = (dynaActor->actor.world.pos.z * 2) - posA.z; posB.x = sign * a3 * sin + posA.x; posB.z = sign * a3 * cos + posA.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, + if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, &dynaActor->actor, 0.0f)) { return false; } diff --git a/soh/src/code/code_8006C3A0.c b/soh/src/code/code_8006C3A0.c index 341a44595..d3397086e 100644 --- a/soh/src/code/code_8006C3A0.c +++ b/soh/src/code/code_8006C3A0.c @@ -1,33 +1,33 @@ #include "global.h" -void Flags_UnsetAllEnv(GlobalContext* globalCtx) { +void Flags_UnsetAllEnv(PlayState* play) { u8 i; for (i = 0; i < 20; i++) { - globalCtx->envFlags[i] = 0; + play->envFlags[i] = 0; } } -void Flags_SetEnv(GlobalContext* globalCtx, s16 flag) { +void Flags_SetEnv(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = 1 << bit; - globalCtx->envFlags[index] |= mask; + play->envFlags[index] |= mask; } -void Flags_UnsetEnv(GlobalContext* globalCtx, s16 flag) { +void Flags_UnsetEnv(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = (1 << bit) ^ 0xFFFF; - globalCtx->envFlags[index] &= mask; + play->envFlags[index] &= mask; } -s32 Flags_GetEnv(GlobalContext* globalCtx, s16 flag) { +s32 Flags_GetEnv(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = 1 << bit; - return globalCtx->envFlags[index] & mask; + return play->envFlags[index] & mask; } diff --git a/soh/src/code/code_80097A00.c b/soh/src/code/code_80097A00.c index 727c199ac..00fdb0a4d 100644 --- a/soh/src/code/code_80097A00.c +++ b/soh/src/code/code_80097A00.c @@ -188,8 +188,8 @@ void Inventory_ChangeEquipment(s16 equipment, u16 value) { gSaveContext.equips.equipment |= value << gEquipShifts[equipment]; } -u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { - Player* player = GET_PLAYER(globalCtx); +u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) { + Player* player = GET_PLAYER(play); s32 pad; u16 sp26 = gSaveContext.equips.equipment & gEquipMasks[equipment]; @@ -211,8 +211,8 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { gSaveContext.infTable[29] = 1; } - Player_SetEquipmentData(globalCtx, player); - globalCtx->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT; + Player_SetEquipmentData(play, player); + play->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT; } return sp26; diff --git a/soh/src/code/db_camera.c b/soh/src/code/db_camera.c index d663b4191..0f6d110b8 100644 --- a/soh/src/code/db_camera.c +++ b/soh/src/code/db_camera.c @@ -1,7 +1,7 @@ #include "ultra64.h" #include "global.h" -static GlobalContext* sGlobalCtx; +static PlayState* sPlayState; // TODO: cleanup these arrays and UB access char* D_8012CEE0[] = { GFXP_KATAKANA "キ-フレ-ム" GFXP_HIRAGANA "ガ" }; @@ -349,7 +349,7 @@ s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) { void func_800B44E0(DbCamera* dbCamera, Camera* cam) { s32 i; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT)) { sDbCamAnim.keyframe = 0; sDbCamAnim.unk_0A = 1; sDbCamAnim.curFrame = 0.0f; @@ -523,7 +523,7 @@ void DbCamera_Init(DbCamera* dbCamera, Camera* cameraPtr) { dbCamera->sub.unk_104A.x = dbCamera->sub.unk_104A.z; dbCamera->fov = 0.0f; dbCamera->rollDegrees = 0.0f; - sGlobalCtx = cameraPtr->globalCtx; + sPlayState = cameraPtr->play; dbCamera->sub.mode = 0; dbCamera->sub.nFrames = -1; dbCamera->sub.nPoints = 1; @@ -598,7 +598,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { sp80 = &dbCamera->eye; sp7C = &dbCamera->at; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_Z)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_Z)) { dbCamera->unk_00++; dbCamera->unk_00 %= 3; dbCamera->unk_38 = 1; @@ -688,7 +688,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } dbCamera->unk_3C = D_80161140; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B | BTN_L)) { sp104.r += temp_f2; if (sp104.r > 30000.0f) { @@ -702,7 +702,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } dbCamera->unk_40 = 7; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B)) { spFC = sp104; spFC.r = temp_f2; if (!D_80161144) { @@ -719,7 +719,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 0xB; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A | BTN_L)) { sp104.r -= temp_f2; if (sp104.r < 10.0f) { sp104.r = 10.0f; @@ -730,7 +730,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 8; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A)) { spFC = sp104; spFC.r = -temp_f2; if (!D_80161144) { @@ -752,7 +752,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_40 = -1; } - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DDOWN | BTN_L)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -770,7 +770,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 1; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DUP | BTN_L)) { spFC = sp104; spFC.r = -temp_f2; spFC.pitch = 0; @@ -787,7 +787,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 2; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DUP)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0x3FFF; @@ -803,7 +803,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 3; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DDOWN)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = -0x3FFF; @@ -819,8 +819,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 4; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) || + CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DRIGHT)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -837,8 +837,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 5; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) || + CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DLEFT)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -855,7 +855,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 6; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B | BTN_L)) { sp104.r = sp104.r + temp_f2; if (sp104.r > 30000.0f) { sp104.r = 30000.0f; @@ -866,7 +866,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 7; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B)) { spFC = sp104; spFC.r = temp_f2; if (!D_80161144) { @@ -883,7 +883,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 0xB; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A | BTN_L)) { sp104.r -= temp_f2; if (sp104.r < 10.0f) { @@ -895,7 +895,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 8; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A)) { spFC = sp104; spFC.r = -temp_f2; if (!D_80161144) { @@ -917,7 +917,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_40 = -1; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_R)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_R)) { if (dbCamera->unk_00 == 0) { dbCamera->sub.unk_104A = cam->inputDir; *sp7C = cam->at; @@ -931,12 +931,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { func_800B41DC(dbCamera, dbCamera->sub.unkIdx, cam); } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_R) && + CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.nPoints = dbCamera->sub.unkIdx + 1; func_800B4088(dbCamera, cam); - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_R)) { if (dbCamera->sub.unkIdx == 0x80) { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { @@ -952,8 +952,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } } else { - temp_f0_5 = sGlobalCtx->state.input[2].rel.stick_y; - temp_f2_2 = sGlobalCtx->state.input[2].rel.stick_x; + temp_f0_5 = sPlayState->state.input[2].rel.stick_y; + temp_f2_2 = sPlayState->state.input[2].rel.stick_x; pitch = DEGF_TO_BINANG((SQ(temp_f0_5) / 600.0f) * 0.8f); yaw = DEGF_TO_BINANG((SQ(temp_f2_2) / 600.0f) * 0.8f); if (!D_80161144) { @@ -973,7 +973,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { OLib_Vec3fDiffToVecSphGeo(&spF4, sp80, sp7C); DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw, DEGF_TO_BINANG(dbCamera->rollDegrees)); if (dbCamera->unk_00 == 1) { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_CRIGHT)) { cam->inputDir = dbCamera->sub.unk_104A; new_var2 = OLib_Vec3fDist(&cam->at, &cam->eye); cam->at = *sp7C; @@ -987,12 +987,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { if (dbCamera->unk_00 == 1) { OREG(0) = 8; func_8006376C(0xC, 5, 0, D_8012CEF4); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT) && - !CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_CRIGHT) && + !CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { func_800B44E0(dbCamera, cam); } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT) && + CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** start here *** */\n@@@\n"); DbCamera_PrintPoints("Lookat", dbCamera->sub.nPoints, dbCamera->sub.lookAt); @@ -1001,13 +1001,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { osSyncPrintf("@@@static short nFrames = %d;\n@@@\n", dbCamera->sub.nFrames); osSyncPrintf("@@@static short Mode = %d;\n@@@\n", dbCamera->sub.mode); osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** finish! *** */\n@@@\n"); - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.unk_08 = (dbCamera->sub.unk_08 + 1) % 3; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CUP) && + CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (dbCamera->sub.unkIdx > 0) { dbCamera->sub.unkIdx--; @@ -1015,7 +1015,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unkIdx = dbCamera->sub.nPoints - 1; } } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CUP)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (dbCamera->sub.unkIdx > 0) { @@ -1036,8 +1036,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L) && + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CDOWN)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) { dbCamera->sub.unkIdx++; @@ -1045,7 +1045,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unkIdx = 0; } } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CDOWN)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) { @@ -1115,7 +1115,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { break; case 1: dbCamera->unk_3C = true; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (dbCamera->sub.unk_0A == 0) { @@ -1124,7 +1124,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0A--; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (dbCamera->sub.unk_0A == 5) { @@ -1133,12 +1133,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0A++; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); switch (dbCamera->sub.unk_0A) { case 1: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame -= 5; } else { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame--; @@ -1170,7 +1170,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0C = false; break; case 2: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll -= 5; dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll; } else { @@ -1182,7 +1182,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DLEFT)) { if ((D_8012D10C++ % 5) == 0) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -1190,7 +1190,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { switch (dbCamera->sub.unk_0A) { case 0: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle -= 1.0f; dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle; } else { @@ -1199,7 +1199,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } break; case 5: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.nFrames -= 10; } else { dbCamera->sub.nFrames--; @@ -1221,13 +1221,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); switch (dbCamera->sub.unk_0A) { case 1: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame += 5; } else { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame++; @@ -1258,7 +1258,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0C = true; break; case 2: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll += 5; dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll; } else { @@ -1269,7 +1269,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { break; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DRIGHT)) { if ((D_8012D10C++ % 5) == 0) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -1277,7 +1277,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { switch (dbCamera->sub.unk_0A) { case 0: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle += 1.0f; dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle; } else { @@ -1286,7 +1286,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } break; case 5: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { dbCamera->sub.nFrames += 10; } else { dbCamera->sub.nFrames++; @@ -1388,11 +1388,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, - 0xFF, 0xFF, 0x7F, 0x40, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0xFF, 0x7F, 0x40, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, - 0x7F, 0xFF, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx); + 0x7F, 0xFF, 0xFF, 0x40, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f, - 0xFF, 0x7F, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0x7F, 0xFF, 0x40, 0, cam->play->view.gfxCtx); if (dbCamera->sub.unk_08 == 2) { for (i = 0; i < (dbCamera->sub.nPoints - 1); i++) { if (dbCamera->sub.mode != 1) { @@ -1406,14 +1406,14 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { spAA = dbCamera->sub.lookAt[i].cameraRoll * 0xB6; if (i == dbCamera->sub.unkIdx) { DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f, - 0x7F, 0xFF, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx); + 0x7F, 0xFF, 0x7F, 0x80, 5, cam->play->view.gfxCtx); DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f, - 1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx); + 1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->play->view.gfxCtx); } else { DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f, - 0xFF, 0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx); + 0xFF, 0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx); DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f, - 1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx); + 1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx); } } } @@ -1423,7 +1423,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->roll = 0; dbCamera->fov = 60.0f; dbCamera->rollDegrees = dbCamera->roll * 1.40625f; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->unk_78 = (dbCamera->unk_78 + 1) % 3; dbCamera->unk_38 = -1; @@ -1471,18 +1471,18 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eye, &cam->at); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, 0xFF, - 0xFF, 0x7F, 0x2D, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0x7F, 0x2D, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, 0x7F, - 0xFF, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0xFF, 0x2D, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f, 0xFF, - 0x7F, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx); + 0x7F, 0xFF, 0x2D, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(cam->eye.x, cam->eye.y, cam->eye.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f, .5f, 0xFF, - 0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx); + 0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx); DebugDisplay_AddObject(cam->at.x, cam->at.y, cam->at.z, spA0.pitch * -1, spA0.yaw, 0, 1.5f, 2.0f, 1.0f, 0xFF, - 0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx); + 0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx); OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eyeNext, &cam->at); DebugDisplay_AddObject(cam->eyeNext.x, cam->eyeNext.y, cam->eyeNext.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f, - .5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->globalCtx->view.gfxCtx); + .5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->play->view.gfxCtx); } } @@ -1850,8 +1850,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { case DEMO_CTRL_MENU(ACTION_LOAD, MENU_INFO): case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_INFO): { if ((1 << sCurFileIdx) & sMempakFiles) { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT) || + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlToggleSwitch ^= 1; @@ -1864,7 +1864,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0x11, 8, dbCamera->sub.demoCtrlToggleSwitch ? 4 : 7, D_8012CF94); func_8006376C(0x15, 8, dbCamera->sub.demoCtrlToggleSwitch ? 7 : 4, D_8012CF98); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A)) { if (dbCamera->sub.demoCtrlToggleSwitch == 0) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -1886,7 +1886,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0xD, 9, dbCamera->sub.demoCtrlToggleSwitch ? 1 : 6, "PRESS B BUTTON"); } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlMenu = 0; return 1; @@ -1921,8 +1921,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0x17, 7, 5, D_8012CFA4); func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON"); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A) || + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (dbCamera->sub.demoCtrlMenu == DEMO_CTRL_MENU(ACTION_LOAD, MENU_SUCCESS)) { dbCamera->sub.demoCtrlActionIdx = ACTION_E; @@ -1943,8 +1943,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0x17, 7, 5, D_8012CFA4); func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON"); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A) || + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlMenu -= 9; } @@ -1978,7 +1978,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sp74[i * 2 + 0] = '-'; sp74[i * 2 + 1] = '\0'; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (sCurFileIdx >= 4) { @@ -1995,7 +1995,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.demoCtrlActionIdx = ACTION_SAVE; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (sCurFileIdx <= 0) { @@ -2038,24 +2038,24 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0xD, 0x1A, 5, D_8012CF60[0]); func_8006376C(0x14, 0x1A, 5, D_8012CF70); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx + 1) % 4u; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A)) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlToggleSwitch = 0; dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(dbCamera->sub.demoCtrlActionIdx, MENU_INFO); } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlActionIdx = ACTION_E; @@ -2065,9 +2065,9 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } else { func_8006376C(0xC, 0x1A, 4, D_8012CF60[0]); func_8006376C(0x13, 0x1A, 4, D_8012CF80); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B) || + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP) || + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -2081,13 +2081,13 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { break; default: { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u; sCurFileIdx = 0; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx + 1) % 4u; @@ -2100,7 +2100,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(4, 7, 5, D_8012CF4C); func_8006376C(D_8016110C * 2 + 6, 7, 7, ">"); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CUP)) { if (D_8016110C > 0) { D_8016110C--; } @@ -2108,7 +2108,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CDOWN)) { if (D_8016110C < 14) { D_8016110C++; } @@ -2116,7 +2116,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) { sDbCamAnim.unk_0A = 0; Interface_ChangeAlpha(2); ShrinkWindow_SetVal(0); @@ -2135,7 +2135,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { return 2; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[1].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[1].press.button, BTN_CRIGHT)) { D_8015FCC8 = 0; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; @@ -2148,7 +2148,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_L)) { if (sp74[sCurFileIdx] == '?') { sLastFileIdx = -1; D_801612EA = '*'; @@ -2156,7 +2156,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sLastFileIdx = sCurFileIdx; D_801612EA = sDbCameraCuts[idx1].letter; } - } else if (!CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + } else if (!CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) { if (sLastFileIdx != -1) { switch (sp74[sCurFileIdx]) { case '?': @@ -2198,7 +2198,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sLastFileIdx = -1; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A)) { if (sp74[sCurFileIdx] == '?') { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); sp74[sCurFileIdx] = DbCamera_InitCut(idx1, &dbCamera->sub); @@ -2208,7 +2208,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) { if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); sp74[sCurFileIdx] = '?'; @@ -2216,7 +2216,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_R)) { if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -2239,7 +2239,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (sCurFileIdx == 0x1E) { sCurFileIdx = 0; @@ -2247,21 +2247,21 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sCurFileIdx++; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); sCurFileIdx = (sCurFileIdx == 0) ? 0x1E : sCurFileIdx - 1; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L) && + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT)) { for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) { osSyncPrintf("###%2d:(%c) (%d %d) %d %d %d\n", i, sDbCameraCuts[i].letter, sDbCameraCuts[i].position, sDbCameraCuts[i].lookAt, sDbCameraCuts[i].nFrames, sDbCameraCuts[i].nPoints, sDbCameraCuts[i].mode); } DbCamera_PrintAllCuts(cam); - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L) && + CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) { if (sDbCameraCuts[i].nPoints != 0) { @@ -2269,7 +2269,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { DbCamera_PrintCutBytes(&sDbCameraCuts[i]); } } - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) { + } else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT)) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0.0f; diff --git a/soh/src/code/flg_set.c b/soh/src/code/flg_set.c index 54bbd21e8..c6e809c63 100644 --- a/soh/src/code/flg_set.c +++ b/soh/src/code/flg_set.c @@ -1,6 +1,6 @@ #include "global.h" -void FlagSet_Update(GlobalContext* globalCtx) { +void FlagSet_Update(PlayState* play) { static s32 entryIdx = 0; static u32 curBit = 0; static s32 timer = 0; @@ -35,8 +35,8 @@ void FlagSet_Update(GlobalContext* globalCtx) { { &gSaveContext.eventInf[2], "event_inf[2]" }, { &gSaveContext.eventInf[3], "event_inf[3]" }, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Input* input = &globalCtx->state.input[0]; + GraphicsContext* gfxCtx = play->state.gfxCtx; + Input* input = &play->state.input[0]; Gfx* gfx; Gfx* polyOpa; @@ -145,7 +145,7 @@ void FlagSet_Update(GlobalContext* globalCtx) { } if (CHECK_BTN_ALL(input->press.button, BTN_L)) { - globalCtx->pauseCtx.debugState = 0; + play->pauseCtx.debugState = 0; } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/code/game.c b/soh/src/code/game.c index 712bc6f2a..8482c7678 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -389,10 +389,10 @@ void GameState_Update(GameState* gameState) { // Moon Jump On L if (CVar_GetS32("gMoonJumpOnL", 0) != 0) { - if (gGlobalCtx) { - Player* player = GET_PLAYER(gGlobalCtx); + if (gPlayState) { + Player* player = GET_PLAYER(gPlayState); - if (CHECK_BTN_ANY(gGlobalCtx->state.input[0].cur.button, BTN_L)) { + if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) { player->actor.velocity.y = 6.34375f; } } @@ -400,18 +400,18 @@ void GameState_Update(GameState* gameState) { // Permanent infinite sword glitch (ISG) if (CVar_GetS32("gEzISG", 0) != 0) { - if (gGlobalCtx) { - Player* player = GET_PLAYER(gGlobalCtx); + if (gPlayState) { + Player* player = GET_PLAYER(gPlayState); player->swordState = 1; } } // Unrestricted Items if (CVar_GetS32("gNoRestrictItems", 0) != 0) { - if (gGlobalCtx) { - u8 sunsBackup = gGlobalCtx->interfaceCtx.restrictions.sunsSong; - memset(&gGlobalCtx->interfaceCtx.restrictions, 0, sizeof(gGlobalCtx->interfaceCtx.restrictions)); - gGlobalCtx->interfaceCtx.restrictions.sunsSong = sunsBackup; + if (gPlayState) { + u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong; + memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions)); + gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup; } } diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index 2a0e5c733..c6354ae93 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -124,7 +124,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) { if (gameStateInitFunc == Title_Init) { return &gGameStateOverlayTable[2]; } - if (gameStateInitFunc == Gameplay_Init) { + if (gameStateInitFunc == Play_Init) { return &gGameStateOverlayTable[3]; } if (gameStateInitFunc == Opening_Init) { @@ -469,8 +469,8 @@ static void RunFrame() // Setup the normal skybox once before entering any game states to avoid the 0xabababab crash. // The crash is due to certain skyboxes not loading all the data they need from Skybox_Setup. if (!hasSetupSkybox) { - GlobalContext* globalCtx = (GlobalContext*)runFrameContext.gameState; - Skybox_Setup(globalCtx, &globalCtx->skyboxCtx, SKYBOX_NORMAL_SKY); + PlayState* play = (PlayState*)runFrameContext.gameState; + Skybox_Setup(play, &play->skyboxCtx, SKYBOX_NORMAL_SKY); hasSetupSkybox = true; } diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c index e7f8bcf14..ed18dcbac 100644 --- a/soh/src/code/padmgr.c +++ b/soh/src/code/padmgr.c @@ -294,7 +294,7 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) { if (HealthMeter_IsCritical()) { controllerCallback.ledColor = 0; - } else if (gGlobalCtx) { + } else if (gPlayState) { switch (CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1) { case PLAYER_TUNIC_KOKIRI: controllerCallback.ledColor = 1; diff --git a/soh/src/code/sys_math3d.c b/soh/src/code/sys_math3d.c index 39ffea881..66ec88316 100644 --- a/soh/src/code/sys_math3d.c +++ b/soh/src/code/sys_math3d.c @@ -2147,8 +2147,8 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) { return false; } -void Math3D_DrawSphere(GlobalContext* globalCtx, Sphere16* sph) { +void Math3D_DrawSphere(PlayState* play, Sphere16* sph) { } -void Math3D_DrawCylinder(GlobalContext* globalCtx, Cylinder16* cyl) { +void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl) { } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index d3dbf9216..3d8ef6753 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -84,7 +84,7 @@ void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, shape->shadowAlpha = 255; } -void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { +void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist, Color_RGBA8* color) { f32 temp1; f32 temp2; MtxF sp60; @@ -93,7 +93,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf temp1 = actor->world.pos.y - actor->floorHeight; if (temp1 >= -50.0f && temp1 < 500.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); @@ -120,35 +120,35 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.shadowScale; Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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) { - ActorShadow_Draw(actor, lights, globalCtx, gCircleShadowDL, NULL); +void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) { + ActorShadow_Draw(actor, lights, play, gCircleShadowDL, NULL); } -void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, PlayState* play) { static Color_RGBA8 white = { 255, 255, 255, 255 }; - ActorShadow_Draw(actor, lights, globalCtx, gCircleShadowDL, &white); + ActorShadow_Draw(actor, lights, play, gCircleShadowDL, &white); } -void ActorShadow_DrawHorse(Actor* actor, Lights* lights, GlobalContext* globalCtx) { - ActorShadow_Draw(actor, lights, globalCtx, gHorseShadowDL, NULL); +void ActorShadow_DrawHorse(Actor* actor, Lights* lights, PlayState* play) { + ActorShadow_Draw(actor, lights, play, gHorseShadowDL, NULL); } -void ActorShadow_DrawFoot(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { +void ActorShadow_DrawFoot(PlayState* play, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { s32 pad1; f32 sp58; s32 pad2[2]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u32)(((arg3 * 0.00005f) > 1.0f ? 1.0f : (arg3 * 0.00005f)) * arg4) & 0xFF); @@ -160,14 +160,14 @@ void ActorShadow_DrawFoot(GlobalContext* globalCtx, Light* light, MtxF* arg2, s3 Matrix_RotateY(sp58, MTXMODE_APPLY); Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawFeet(Actor* actor, Lights* lights, PlayState* play) { f32 distToFloor = actor->world.pos.y - actor->floorHeight; if (distToFloor > 20.0f) { @@ -178,7 +178,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx actor->shape.shadowScale *= 0.3f; alphaRatio = (distToFloor - 20.0f) * 0.02f; actor->shape.shadowAlpha = (f32)actor->shape.shadowAlpha * CLAMP_MAX(alphaRatio, 1.0f); - ActorShadow_DrawCircle(actor, lights, globalCtx); + ActorShadow_DrawCircle(actor, lights, play); actor->shape.shadowScale = shadowScale; actor->shape.shadowAlpha = shadowAlpha; } @@ -200,7 +200,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx Vec3f* feetPosPtr = actor->shape.feetPos; f32* floorHeightPtr = floorHeight; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); @@ -208,7 +208,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx for (i = 0; i < 2; i++) { feetPosPtr->y += 50.0f; - *floorHeightPtr = func_800BFCB8(globalCtx, &floorMtx, feetPosPtr); + *floorHeightPtr = func_800BFCB8(play, &floorMtx, feetPosPtr); feetPosPtr->y -= 50.0f; actor->shape.feetFloorFlags <<= 1; distToFloor = feetPosPtr->y - *floorHeightPtr; @@ -231,7 +231,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx (lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) * ABS(lightPtr->l.dir[1]); if (lightNum > 0) { lightNumMax += lightNum; - ActorShadow_DrawFoot(globalCtx, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, + ActorShadow_DrawFoot(play, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, shadowScaleZ); } } @@ -244,7 +244,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx ((lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) * ABS(lightPtr->l.dir[1])) - (lightNumMax * 8); if (lightNum > 0) { - ActorShadow_DrawFoot(globalCtx, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, + ActorShadow_DrawFoot(play, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, shadowScaleZ); } } @@ -267,7 +267,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -280,8 +280,8 @@ void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* lef } } -void func_8002BE04(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg1, arg2, arg3); +void func_8002BE04(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, arg2, arg3); *arg3 = (*arg3 < 1.0f) ? 1.0f : (1.0f / *arg3); } @@ -312,12 +312,12 @@ void func_8002BE64(TargetContext* targetCtx, s32 index, f32 arg2, f32 arg3, f32 targetCtx->arr_50[index].unk_0C = targetCtx->unk_44; } -void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, GlobalContext* globalCtx) { +void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, PlayState* play) { TargetContextEntry* entry; NaviColor* naviColor; s32 i; - Math_Vec3f_Copy(&targetCtx->targetCenterPos, &globalCtx->view.eye); + Math_Vec3f_Copy(&targetCtx->targetCenterPos, &play->view.eye); targetCtx->unk_44 = 500.0f; targetCtx->unk_48 = 0x100; @@ -333,7 +333,7 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, GlobalContext* g } } -void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, GlobalContext* globalCtx) { +void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { NaviColor* naviColor = &sNaviColorList[actorCategory]; Color_RGB8 customInnerNaviColor; Color_RGB8 customOuterNaviColor; @@ -393,7 +393,7 @@ void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, Gl targetCtx->naviOuter.a = naviColor->outer.a; } -void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* globalCtx) { +void func_8002C0C0(TargetContext* targetCtx, Actor* actor, PlayState* play) { targetCtx->arrowPointedActor = NULL; targetCtx->targetedActor = NULL; targetCtx->unk_40 = 0.0f; @@ -401,14 +401,14 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global targetCtx->bgmEnemy = NULL; targetCtx->unk_4B = 0; targetCtx->unk_4C = 0; - func_8002BF60(targetCtx, actor, actor->category, globalCtx); - func_8002BE98(targetCtx, actor->category, globalCtx); + func_8002BF60(targetCtx, actor, actor->category, play); + func_8002BE98(targetCtx, actor->category, play); } -void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { +void func_8002C124(TargetContext* targetCtx, PlayState* play) { Actor* actor = targetCtx->targetedActor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (targetCtx->unk_48 != 0) { TargetContextEntry* entry; @@ -425,7 +425,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { s32 i; FrameInterpolation_RecordOpenChild(actor, 0); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); spCE = 0xFF; var1 = 1.0f; @@ -447,7 +447,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { spCE = targetCtx->unk_48; } - func_8002BE04(globalCtx, &targetCtx->targetCenterPos, &spBC, &spB4); + func_8002BE04(play, &targetCtx->targetCenterPos, &spBC, &spB4); spBC.x = (160 * (spBC.x * spB4)) * var1; spBC.x = CLAMP(spBC.x, -320.0f, 320.0f); @@ -488,7 +488,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(entry->unk_0C, entry->unk_0C, 0.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL); Matrix_Pop(); @@ -513,20 +513,20 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_Translate(actor->focus.pos.x, actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f, actor->focus.pos.z, MTXMODE_NEW); - Matrix_RotateY((f32)((u16)(globalCtx->gameplayFrames * 3000)) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((f32)((u16)(play->gameplayFrames * 3000)) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 255); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL); FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, GlobalContext* globalCtx) { +void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, PlayState* play) { s32 pad; Actor* unkActor; s32 actorCategory; @@ -545,7 +545,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) { targetCtx->unk_94 = NULL; } else { - func_80032AF0(globalCtx, &globalCtx->actorCtx, &unkActor, player); + func_80032AF0(play, &play->actorCtx, &unkActor, player); targetCtx->unk_94 = unkActor; } @@ -581,11 +581,11 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl targetCtx->naviRefPos.y += temp3 * temp1; targetCtx->naviRefPos.z += temp4 * temp1; } else { - func_8002BF60(targetCtx, unkActor, actorCategory, globalCtx); + func_8002BF60(targetCtx, unkActor, actorCategory, play); } if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) { - func_8002BE04(globalCtx, &actorArg->focus.pos, &sp50, &sp4C); + func_8002BE04(play, &actorArg->focus.pos, &sp50, &sp4C); if (((sp50.z <= 0.0f) || (1.0f <= fabsf(sp50.x * sp4C))) || (1.0f <= fabsf(sp50.y * sp4C))) { actorArg = NULL; } @@ -593,7 +593,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl if (actorArg != NULL) { if (actorArg != targetCtx->targetedActor) { - func_8002BE98(targetCtx, actorArg->category, globalCtx); + func_8002BE98(targetCtx, actorArg->category, play); targetCtx->targetedActor = actorArg; if (actorArg->id == ACTOR_EN_BOOM) { @@ -628,156 +628,156 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl /** * Tests if current scene switch flag is set. */ -s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetSwitch(PlayState* play, s32 flag) { if (flag < 0x20) { - return globalCtx->actorCtx.flags.swch & (1 << flag); + return play->actorCtx.flags.swch & (1 << flag); } else { - return globalCtx->actorCtx.flags.tempSwch & (1 << (flag - 0x20)); + return play->actorCtx.flags.tempSwch & (1 << (flag - 0x20)); } } /** * Sets current scene switch flag. */ -void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag) { +void Flags_SetSwitch(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.swch |= (1 << flag); + play->actorCtx.flags.swch |= (1 << flag); } else { - globalCtx->actorCtx.flags.tempSwch |= (1 << (flag - 0x20)); + play->actorCtx.flags.tempSwch |= (1 << (flag - 0x20)); } } /** * Unsets current scene switch flag. */ -void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag) { +void Flags_UnsetSwitch(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.swch &= ~(1 << flag); + play->actorCtx.flags.swch &= ~(1 << flag); } else { - globalCtx->actorCtx.flags.tempSwch &= ~(1 << (flag - 0x20)); + play->actorCtx.flags.tempSwch &= ~(1 << (flag - 0x20)); } } /** * Tests if unknown flag is set. */ -s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetUnknown(PlayState* play, s32 flag) { if (flag < 0x20) { - return globalCtx->actorCtx.flags.unk0 & (1 << flag); + return play->actorCtx.flags.unk0 & (1 << flag); } else { - return globalCtx->actorCtx.flags.unk1 & (1 << (flag - 0x20)); + return play->actorCtx.flags.unk1 & (1 << (flag - 0x20)); } } /** * Sets unknown flag. */ -void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag) { +void Flags_SetUnknown(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.unk0 |= (1 << flag); + play->actorCtx.flags.unk0 |= (1 << flag); } else { - globalCtx->actorCtx.flags.unk1 |= (1 << (flag - 0x20)); + play->actorCtx.flags.unk1 |= (1 << (flag - 0x20)); } } /** * Unsets unknown flag. */ -void Flags_UnsetUnknown(GlobalContext* globalCtx, s32 flag) { +void Flags_UnsetUnknown(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.unk0 &= ~(1 << flag); + play->actorCtx.flags.unk0 &= ~(1 << flag); } else { - globalCtx->actorCtx.flags.unk1 &= ~(1 << (flag - 0x20)); + play->actorCtx.flags.unk1 &= ~(1 << (flag - 0x20)); } } /** * Tests if current scene chest flag is set. */ -s32 Flags_GetTreasure(GlobalContext* globalCtx, s32 flag) { - return globalCtx->actorCtx.flags.chest & (1 << flag); +s32 Flags_GetTreasure(PlayState* play, s32 flag) { + return play->actorCtx.flags.chest & (1 << flag); } /** * Sets current scene chest flag. */ -void Flags_SetTreasure(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.chest |= (1 << flag); +void Flags_SetTreasure(PlayState* play, s32 flag) { + play->actorCtx.flags.chest |= (1 << flag); } /** * Tests if current scene clear flag is set. */ -s32 Flags_GetClear(GlobalContext* globalCtx, s32 flag) { - return globalCtx->actorCtx.flags.clear & (1 << flag); +s32 Flags_GetClear(PlayState* play, s32 flag) { + return play->actorCtx.flags.clear & (1 << flag); } /** * Sets current scene clear flag. */ -void Flags_SetClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.clear |= (1 << flag); +void Flags_SetClear(PlayState* play, s32 flag) { + play->actorCtx.flags.clear |= (1 << flag); } /** * Unsets current scene clear flag. */ -void Flags_UnsetClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.clear &= ~(1 << flag); +void Flags_UnsetClear(PlayState* play, s32 flag) { + play->actorCtx.flags.clear &= ~(1 << flag); } /** * Tests if current scene temp clear flag is set. */ -s32 Flags_GetTempClear(GlobalContext* globalCtx, s32 flag) { - return globalCtx->actorCtx.flags.tempClear & (1 << flag); +s32 Flags_GetTempClear(PlayState* play, s32 flag) { + return play->actorCtx.flags.tempClear & (1 << flag); } /** * Sets current scene temp clear flag. */ -void Flags_SetTempClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.tempClear |= (1 << flag); +void Flags_SetTempClear(PlayState* play, s32 flag) { + play->actorCtx.flags.tempClear |= (1 << flag); } /** * Unsets current scene temp clear flag. */ -void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.tempClear &= ~(1 << flag); +void Flags_UnsetTempClear(PlayState* play, s32 flag) { + play->actorCtx.flags.tempClear &= ~(1 << flag); } /** * Tests if current scene collectible flag is set. */ -s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetCollectible(PlayState* play, s32 flag) { if (flag < 0x20) { - return globalCtx->actorCtx.flags.collect & (1 << flag); + return play->actorCtx.flags.collect & (1 << flag); } else { - return globalCtx->actorCtx.flags.tempCollect & (1 << (flag - 0x20)); + return play->actorCtx.flags.tempCollect & (1 << (flag - 0x20)); } } /** * Sets current scene collectible flag. */ -void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag) { +void Flags_SetCollectible(PlayState* play, s32 flag) { if (flag != 0) { if (flag < 0x20) { - globalCtx->actorCtx.flags.collect |= (1 << flag); + play->actorCtx.flags.collect |= (1 << flag); } else { - globalCtx->actorCtx.flags.tempCollect |= (1 << (flag - 0x20)); + play->actorCtx.flags.tempCollect |= (1 << (flag - 0x20)); } } } -void func_8002CDE4(GlobalContext* globalCtx, TitleCardContext* titleCtx) { +void func_8002CDE4(PlayState* play, TitleCardContext* titleCtx) { titleCtx->durationTimer = titleCtx->delayTimer = titleCtx->intensityR = titleCtx->alpha = 0; titleCtx->durationTimer = titleCtx->delayTimer = titleCtx->intensityG = titleCtx->alpha = 0; titleCtx->durationTimer = titleCtx->delayTimer = titleCtx->intensityB = titleCtx->alpha = 0; } -void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, +void TitleCard_InitBossName(PlayState* play, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, u8 height, s16 hasTranslation) { if (ResourceMgr_OTRSigCheck(texture)) @@ -794,11 +794,11 @@ void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx titleCtx->delayTimer = 0; } -void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, +void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, s32 width, s32 height, s32 delay) { - SceneTableEntry* loadedScene = globalCtx->loadedScene; + SceneTableEntry* loadedScene = play->loadedScene; // size_t size = loadedScene->titleFile.vromEnd - loadedScene->titleFile.vromStart; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: texture = gDekuTreeTitleCardENGTex; break; @@ -1016,7 +1016,7 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt titleCtx->delayTimer = delay; } -void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { +void TitleCard_Update(PlayState* play, TitleCardContext* titleCtx) { const Color_RGB8 TitleCard_Colors_ori = {255,255,255}; Color_RGB8 TitleCard_Colors = {255,255,255}; if (titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) {//Bosses cards. @@ -1042,7 +1042,7 @@ void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { } } -void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { +void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) { s32 width; s32 height; s32 unused; @@ -1083,7 +1083,7 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { titleY = (TitleCard_PosY * 4) - (height * 2); doubleWidth = width * 2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); height = (width * height > 0x1000) ? 0x1000 / width : height; titleSecondY = titleY + (height * 4); @@ -1131,12 +1131,12 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { titleSecondY + (height * 4), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) { - if ((globalCtx->actorCtx.titleCtx.delayTimer != 0) || (globalCtx->actorCtx.titleCtx.alpha != 0)) { +s32 func_8002D53C(PlayState* play, TitleCardContext* titleCtx) { + if ((play->actorCtx.titleCtx.delayTimer != 0) || (play->actorCtx.titleCtx.alpha != 0)) { titleCtx->durationTimer = 0; titleCtx->delayTimer = 0; return false; @@ -1179,11 +1179,11 @@ void Actor_SetScale(Actor* actor, f32 scale) { actor->scale.x = scale; } -void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[actor->objBankIndex].segment); +void Actor_SetObjectDependency(PlayState* play, Actor* actor) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment); } -void Actor_Init(Actor* actor, GlobalContext* globalCtx) { +void Actor_Init(Actor* actor, PlayState* play) { Actor_SetWorldToHome(actor); Actor_SetShapeRotToWorld(actor); Actor_SetFocus(actor, 0.0f); @@ -1199,7 +1199,7 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { if (CVar_GetS32("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room && actor->id != ACTOR_EN_HORSE // Check for Epona, else if we call her she will spawn at the other side of the map + we can hear her during the title screen sequence && actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning - && (globalCtx->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room + && (play->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room actor->uncullZoneForward = 32767.0f; actor->uncullZoneScale = 32767.0f; actor->uncullZoneDownward = 32767.0f; @@ -1207,20 +1207,20 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { CollisionCheck_InitInfo(&actor->colChkInfo); actor->floorBgId = BGCHECK_SCENE; ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); - //if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) + //if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { - //Actor_SetObjectDependency(globalCtx, actor); - actor->init(actor, globalCtx); + //Actor_SetObjectDependency(play, actor); + actor->init(actor, play); actor->init = NULL; } } -void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) { +void Actor_Destroy(Actor* actor, PlayState* play) { ActorOverlay* overlayEntry; char* name; if (actor->destroy != NULL) { - actor->destroy(actor, globalCtx); + actor->destroy(actor, play); actor->destroy = NULL; } else { overlayEntry = actor->overlayEntry; @@ -1369,26 +1369,26 @@ s32 func_8002DD78(Player* player) { return func_8002DD6C(player) && player->unk_834; } -s32 func_8002DDA8(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DDA8(PlayState* play) { + Player* player = GET_PLAYER(play); return (player->stateFlags1 & 0x800) || func_8002DD78(player); } -s32 func_8002DDE4(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DDE4(PlayState* play) { + Player* player = GET_PLAYER(play); return player->stateFlags2 & 0x8; } -s32 func_8002DDF4(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DDF4(PlayState* play) { + Player* player = GET_PLAYER(play); return player->stateFlags2 & 0x1000; } -void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { - ArmsHook* hookshot = (ArmsHook*)Actor_Find(&globalCtx->actorCtx, ACTOR_ARMS_HOOK, ACTORCAT_ITEMACTION); +void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB) { + ArmsHook* hookshot = (ArmsHook*)Actor_Find(&play->actorCtx, ACTOR_ARMS_HOOK, ACTORCAT_ITEMACTION); hookshot->grabbed = actorB; hookshot->grabbedDistDiff.x = 0.0f; @@ -1398,13 +1398,13 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { actorA->flags &= ~ACTOR_FLAG_13; } -void func_8002DE74(GlobalContext* globalCtx, Player* player) { - if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && func_800C0CB8(globalCtx)) { - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, MAIN_CAM), CAM_SET_HORSE); +void func_8002DE74(PlayState* play, Player* player) { + if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && func_800C0CB8(play)) { + Camera_ChangeSetting(Play_GetCamera(play, MAIN_CAM), CAM_SET_HORSE); } } -void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse) { +void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) { player->rideActor = horse; player->stateFlags1 |= 0x800000; horse->child = &player->actor; @@ -1414,12 +1414,12 @@ s32 func_8002DEEC(Player* player) { return (player->stateFlags1 & 0x20000080) || (player->csMode != 0); } -void func_8002DF18(GlobalContext* globalCtx, Player* player) { - func_8006DC68(globalCtx, player); +void func_8002DF18(PlayState* play, Player* player) { + func_8006DC68(play, player); } -s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode) { + Player* player = GET_PLAYER(play); player->csMode = csMode; player->unk_448 = actor; @@ -1428,10 +1428,10 @@ s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode) { return true; } -s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DF54(PlayState* play, Actor* actor, u8 csMode) { + Player* player = GET_PLAYER(play); - func_8002DF38(globalCtx, actor, csMode); + func_8002DF38(play, actor, csMode); player->unk_46A = 1; return true; @@ -1451,8 +1451,8 @@ void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2) { * Chcek if the player is facing the specified actor. * The maximum angle difference that qualifies as "facing" is specified by `maxAngle`. */ -s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y; if (ABS(yawDiff) < maxAngle) { @@ -1559,14 +1559,14 @@ s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) { return true; } -s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) { +s32 func_8002E2AC(PlayState* play, Actor* actor, Vec3f* arg2, s32 arg3) { f32 floorHeightDiff; s32 floorBgId; arg2->y += 50.0f; actor->floorHeight = - BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &floorBgId, actor, arg2); + BgCheck_EntityRaycastFloor5(play, &play->colCtx, &actor->floorPoly, &floorBgId, actor, arg2); actor->bgCheckFlags &= ~0x0086; if (actor->floorHeight <= BGCHECK_Y_MIN) { @@ -1602,11 +1602,11 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) } actor->bgCheckFlags |= 0x1; - func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); + func_80043334(&play->colCtx, actor, actor->floorBgId); } } else { // actor is above ground if ((actor->bgCheckFlags & 0x1) && (floorHeightDiff >= -11.0f)) { - func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); + func_80043334(&play->colCtx, actor, actor->floorBgId); } return func_8002E234(actor, floorHeightDiff, arg3); @@ -1615,7 +1615,7 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) return true; } -void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, +void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, s32 flags) { f32 sp74; s32 pad; @@ -1630,15 +1630,15 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe sp74 = actor->world.pos.y - actor->prevPos.y; if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & 1)) { - func_800433A4(&globalCtx->colCtx, actor->floorBgId, actor); + func_800433A4(&play->colCtx, actor->floorBgId, actor); } if (flags & 1) { if ((!(flags & 0x80) && - BgCheck_EntitySphVsWall3(&globalCtx->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, + BgCheck_EntitySphVsWall3(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight)) || ((flags & 0x80) && - BgCheck_EntitySphVsWall4(&globalCtx->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, + BgCheck_EntitySphVsWall4(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight))) { wallPoly = actor->wallPoly; Math_Vec3f_Copy(&actor->world.pos, &sp64); @@ -1655,7 +1655,7 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe if (flags & 2) { sp64.y = actor->prevPos.y + 10.0f; - if (BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &sp58, &sp64, (ceilingCheckHeight + sp74) - 10.0f, + if (BgCheck_EntityCheckCeiling(&play->colCtx, &sp58, &sp64, (ceilingCheckHeight + sp74) - 10.0f, &sCurCeilingPoly, &sCurCeilingBgId, actor)) { actor->bgCheckFlags |= 0x10; actor->world.pos.y = (sp58 + sp74) - 10.0f; @@ -1666,9 +1666,9 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe if (flags & 4) { sp64.y = actor->prevPos.y; - func_8002E2AC(globalCtx, actor, &sp64, flags); + func_8002E2AC(play, actor, &sp64, flags); waterBoxYSurface = actor->world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, actor->world.pos.x, actor->world.pos.z, + if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &waterBoxYSurface, &waterBox)) { actor->yDistToWater = waterBoxYSurface - actor->world.pos.y; if (actor->yDistToWater < 0.0f) { @@ -1680,9 +1680,9 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe ripplePos.x = actor->world.pos.x; ripplePos.y = waterBoxYSurface; ripplePos.z = actor->world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 8); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 4); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 8); } } actor->bgCheckFlags |= 0x20; @@ -1746,60 +1746,60 @@ Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContex return hilite; } -void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) { +void func_8002EBCC(Actor* actor, PlayState* play, s32 flag) { Hilite* hilite; Vec3f lightDir; Gfx* displayListHead; Gfx* displayList; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; if (HREG(80) == 6) { - osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", globalCtx->view.eye.x, - globalCtx->view.eye.y, globalCtx->view.eye.z); + osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", play->view.eye.x, + play->view.eye.y, play->view.eye.z); } - hilite = func_8002EABC(&actor->world.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + hilite = func_8002EABC(&actor->world.pos, &play->view.eye, &lightDir, play->state.gfxCtx); if (flag != 0) { - displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); + displayList = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - OPEN_DISPS(globalCtx->state.gfxCtx); + 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_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) { +void func_8002ED80(Actor* actor, PlayState* play, s32 flag) { Hilite* hilite; Vec3f lightDir; Gfx* displayListHead; Gfx* displayList; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; - hilite = func_8002EB44(&actor->world.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + hilite = func_8002EB44(&actor->world.pos, &play->view.eye, &lightDir, play->state.gfxCtx); if (flag != 0) { - displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); + displayList = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - OPEN_DISPS(globalCtx->state.gfxCtx); + 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); } } @@ -1887,7 +1887,7 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { return false; } -u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx) { +u32 Actor_ProcessTalkRequest(Actor* actor, PlayState* play) { if (actor->flags & ACTOR_FLAG_8) { actor->flags &= ~ACTOR_FLAG_8; return true; @@ -1896,11 +1896,11 @@ u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx) { return false; } -s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u32 exchangeItemId) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchangeItemId) { + Player* player = GET_PLAYER(play); // This is convoluted but it seems like it must be a single if statement to match - if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) || + if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) || (!actor->isTargeted && ((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) || (arg2 < actor->xzDistToPlayer)))) { @@ -1914,44 +1914,44 @@ s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u3 return true; } -s32 func_8002F298(Actor* actor, GlobalContext* globalCtx, f32 arg2, u32 exchangeItemId) { - return func_8002F1C4(actor, globalCtx, arg2, arg2, exchangeItemId); +s32 func_8002F298(Actor* actor, PlayState* play, f32 arg2, u32 exchangeItemId) { + return func_8002F1C4(actor, play, arg2, arg2, exchangeItemId); } -s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2) { - return func_8002F298(actor, globalCtx, arg2, EXCH_ITEM_NONE); +s32 func_8002F2CC(Actor* actor, PlayState* play, f32 arg2) { + return func_8002F298(actor, play, arg2, EXCH_ITEM_NONE); } -s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx) { +s32 func_8002F2F4(Actor* actor, PlayState* play) { f32 var1 = 50.0f + actor->colChkInfo.cylRadius; - return func_8002F2CC(actor, globalCtx, var1); + return func_8002F2CC(actor, play, var1); } -u32 Actor_TextboxIsClosing(Actor* actor, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +u32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return true; } else { return false; } } -s8 func_8002F368(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s8 func_8002F368(PlayState* play) { + Player* player = GET_PLAYER(play); return player->exchangeItemId; } -void Actor_GetScreenPos(GlobalContext* globalCtx, Actor* actor, s16* x, s16* y) { +void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y) { Vec3f projectedPos; f32 w; - func_8002BE04(globalCtx, &actor->focus.pos, &projectedPos, &w); + func_8002BE04(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); } -u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { +u32 Actor_HasParent(Actor* actor, PlayState* play) { if (actor->parent != NULL) { return true; } else { @@ -1964,12 +1964,12 @@ u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { * where Link holds an item over his head. This function does not require an actor for giving * the player an item, instead setting the player as their own interactRangeActor and getItemDirection. * - * \param globalCtx the Global Context + * \param play the Global Context * \param getItemEntry the GetItemEntry for the item you want the player to receive. * \return true if the player can receive an item, false if not. */ -s32 GiveItemEntryWithoutActor(GlobalContext* globalCtx, GetItemEntry getItemEntry) { - Player* player = GET_PLAYER(globalCtx); +s32 GiveItemEntryWithoutActor(PlayState* play, GetItemEntry getItemEntry) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if (((player->heldActor != NULL) && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX)) || @@ -1996,7 +1996,7 @@ s32 GiveItemEntryWithoutActor(GlobalContext* globalCtx, GetItemEntry getItemEntr * * \param actor the actor link is receiving an item from. Will usually be a chest but can also * be an npc. - * \param globalCtx the Global Context + * \param play the Global Context * \param getItemEntry the GetItemEntry for the item you want the player to receive. * \param xzRange the distance on the x and z axes that the player can be from the target * actor to receive the item. @@ -2004,8 +2004,8 @@ s32 GiveItemEntryWithoutActor(GlobalContext* globalCtx, GetItemEntry getItemEntr * to receive the item. * \return true if the player can receive an item, false if not. */ -s32 GiveItemEntryFromActor(Actor* actor, GlobalContext* globalCtx, GetItemEntry getItemEntry, f32 xzRange, f32 yRange) { - Player* player = GET_PLAYER(globalCtx); +s32 GiveItemEntryFromActor(Actor* actor, PlayState* play, GetItemEntry getItemEntry, f32 xzRange, f32 yRange) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && @@ -2036,17 +2036,17 @@ s32 GiveItemEntryFromActor(Actor* actor, GlobalContext* globalCtx, GetItemEntry * that supplies a fixed xzRange of 50.0f and a fixed yRange of 10.0f. * * \param actor the target actor that link is receiving an item from. - * \param globalCtx the Global Context + * \param play the Global Context * \param getItemEntry the GetItemEntry for the item you want the player to receive. */ -void GiveItemEntryFromActorWithFixedRange(Actor* actor, GlobalContext* globalCtx, GetItemEntry getItemEntry) { - GiveItemEntryFromActor(actor, globalCtx, getItemEntry, 50.0f, 10.0f); +void GiveItemEntryFromActorWithFixedRange(Actor* actor, PlayState* play, GetItemEntry getItemEntry) { + GiveItemEntryFromActor(actor, play, getItemEntry, 50.0f, 10.0f); } // TODO: Rename to GiveItemIdFromActor or similar // If you're doing something for randomizer, you're probably looking for GiveItemEntryFromActor -s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002F434(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && @@ -2071,15 +2071,15 @@ s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzR // TODO: Rename to GiveItemIdFromActorWithFixedRange or similar // If you're doing something for randomizer, you're probably looking for GiveItemEntryFromActorWithFixedRange -void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId) { - func_8002F434(actor, globalCtx, getItemId, 50.0f, 10.0f); +void func_8002F554(Actor* actor, PlayState* play, s32 getItemId) { + func_8002F434(actor, play, getItemId, 50.0f, 10.0f); } -void func_8002F580(Actor* actor, GlobalContext* globalCtx) { - func_8002F554(actor, globalCtx, GI_NONE); +void func_8002F580(Actor* actor, PlayState* play) { + func_8002F554(actor, play, GI_NONE); } -u32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx) { +u32 Actor_HasNoParent(Actor* actor, PlayState* play) { if (actor->parent == NULL) { return true; } else { @@ -2087,7 +2087,7 @@ u32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx) { } } -void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { +void func_8002F5C4(Actor* actorA, Actor* actorB, PlayState* play) { Actor* parent = actorA->parent; if (parent->id == ACTOR_PLAYER) { @@ -2102,15 +2102,15 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { actorA->parent = NULL; } -void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8002F5F0(Actor* actor, PlayState* play) { + Player* player = GET_PLAYER(play); if (actor->xyzDistToPlayerSq < player->unk_6A4) { player->unk_6A4 = actor->xyzDistToPlayerSq; } } -s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse) { +s32 Actor_IsMounted(PlayState* play, Actor* horse) { if (horse->child != NULL) { return true; } else { @@ -2118,8 +2118,8 @@ s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse) { } } -u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { - Player* player = GET_PLAYER(globalCtx); +u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x003C7880)) { player->rideActor = horse; @@ -2130,7 +2130,7 @@ u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { return false; } -s32 Actor_NotMounted(GlobalContext* globalCtx, Actor* horse) { +s32 Actor_NotMounted(PlayState* play, Actor* horse) { if (horse->child == NULL) { return true; } else { @@ -2138,8 +2138,8 @@ s32 Actor_NotMounted(GlobalContext* globalCtx, Actor* horse) { } } -void func_8002F698(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { - Player* player = GET_PLAYER(globalCtx); +void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { + Player* player = GET_PLAYER(play); player->unk_8A0 = arg6; player->unk_8A1 = arg5; @@ -2148,20 +2148,20 @@ void func_8002F698(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f player->unk_8A8 = arg4; } -void func_8002F6D4(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { - func_8002F698(globalCtx, actor, arg2, arg3, arg4, 2, arg5); +void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { + func_8002F698(play, actor, arg2, arg3, arg4, 2, arg5); } -void func_8002F71C(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_8002F6D4(globalCtx, actor, arg2, arg3, arg4, 0); +void func_8002F71C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { + func_8002F6D4(play, actor, arg2, arg3, arg4, 0); } -void func_8002F758(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { - func_8002F698(globalCtx, actor, arg2, arg3, arg4, 1, arg5); +void func_8002F758(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { + func_8002F698(play, actor, arg2, arg3, arg4, 1, arg5); } -void func_8002F7A0(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_8002F758(globalCtx, actor, arg2, arg3, arg4, 0); +void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { + func_8002F758(play, actor, arg2, arg3, arg4, 0); } void func_8002F7DC(Actor* actor, u16 sfxId) { @@ -2172,7 +2172,7 @@ void Audio_PlayActorSound2(Actor* actor, u16 sfxId) { func_80078914(&actor->projectedPos, sfxId); } -void func_8002F850(GlobalContext* globalCtx, Actor* actor) { +void func_8002F850(PlayState* play, Actor* actor) { s32 sfxId; if (actor->bgCheckFlags & 0x20) { @@ -2182,7 +2182,7 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) { sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; } } else { - sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, actor->floorPoly, actor->floorBgId); + sfxId = SurfaceType_GetSfx(&play->colCtx, actor->floorPoly, actor->floorBgId); } func_80078914(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); @@ -2225,10 +2225,10 @@ void func_8002F994(Actor* actor, s32 arg1) { } // Tests if something hit Jabu Jabu surface, displaying hit splash and playing sfx if true -s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) { - if (func_80041D4C(&globalCtx->colCtx, poly, bgId) == 8) { - globalCtx->roomCtx.unk_74[0] = 1; - CollisionCheck_BlueBlood(globalCtx, NULL, pos); +s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) { + if (func_80041D4C(&play->colCtx, poly, bgId) == 8) { + play->roomCtx.unk_74[0] = 1; + CollisionCheck_BlueBlood(play, NULL, pos); Audio_PlayActorSound2(actor, NA_SE_IT_WALL_HIT_BUYO); return true; } @@ -2242,7 +2242,7 @@ LightNode* D_8015BC10; s32 D_8015BC14; f32 D_8015BC18; -void func_8002FA60(GlobalContext* globalCtx) { +void func_8002FA60(PlayState* play) { Vec3f lightPos; if (gSaveContext.fw.set) { @@ -2269,16 +2269,16 @@ void func_8002FA60(GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, -1); - D_8015BC10 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &D_8015BC00); + D_8015BC10 = LightContext_InsertLight(play, &play->lightCtx, &D_8015BC00); D_8015BC14 = 0; D_8015BC18 = 0.0f; } -void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { +void Actor_DrawFaroresWindPointer(PlayState* play) { s32 lightRadius = -1; s32 params; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); params = gSaveContext.respawn[RESPAWN_MODE_TOP].data; @@ -2333,7 +2333,7 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { effectPos.y = curPos->y + 80.0f + (6.0f * Rand_ZeroOne()); effectPos.z = curPos->z + Rand_CenteredFloat(6.0f); - EffectSsKiraKira_SpawnDispersed(globalCtx, &effectPos, &effectVel, &effectAccel, &effectPrimCol, + EffectSsKiraKira_SpawnDispersed(play, &effectPos, &effectVel, &effectAccel, &effectPrimCol, &effectEnvCol, 1000, 16); if (D_8015BC18 == 0.0f) { @@ -2352,9 +2352,9 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { f32 diff; if (nextRatio > 0.0f) { - eye.x = globalCtx->view.eye.x; - eye.y = globalCtx->view.eye.y - yOffset; - eye.z = globalCtx->view.eye.z; + eye.x = play->view.eye.x; + eye.y = play->view.eye.y - yOffset; + eye.z = play->view.eye.z; diff = Math_Vec3f_DistXYZAndStoreDiff(&eye, curPos, &dist); diff = (diff * (nextRatio / curRatio)) / diff; curPos->x = eye.x + (dist.x * diff); @@ -2378,10 +2378,10 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { lightRadius = 500.0f * ratio; - if ((globalCtx->csCtx.state == CS_STATE_IDLE) && + if ((play->csCtx.state == CS_STATE_IDLE) && (((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex) == ((void)0, gSaveContext.entranceIndex)) && - (((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex) == globalCtx->roomCtx.curRoom.num)) { + (((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex) == play->roomCtx.curRoom.num)) { f32 scale = 0.025f * ratio; POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x19); @@ -2390,22 +2390,22 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y) + yOffset, ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z), MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, alpha); gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255); - Matrix_RotateZ(((globalCtx->gameplayFrames * 1500) & 0xFFFF) * M_PI / 32768.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_RotateZ(((play->gameplayFrames * 1500) & 0xFFFF) * M_PI / 32768.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); - Matrix_RotateZ(~((globalCtx->gameplayFrames * 1200) & 0xFFFF) * M_PI / 32768.0f, MTXMODE_APPLY); + Matrix_RotateZ(~((play->gameplayFrames * 1200) & 0xFFFF) * M_PI / 32768.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); } @@ -2415,33 +2415,33 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z), 255, 255, 255, lightRadius); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80030488(GlobalContext* globalCtx) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, D_8015BC10); +void func_80030488(PlayState* play) { + LightContext_RemoveLight(play, &play->lightCtx, D_8015BC10); } -void Actor_DisableLens(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.lensActive) { - globalCtx->actorCtx.lensActive = false; - func_800876C8(globalCtx); +void Actor_DisableLens(PlayState* play) { + if (play->actorCtx.lensActive) { + play->actorCtx.lensActive = false; + func_800876C8(play); } } // Actor_InitContext -void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry) { +void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry) { ActorOverlay* overlayEntry; SavedSceneFlags* savedSceneFlags; s32 i; - savedSceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum]; + savedSceneFlags = &gSaveContext.sceneFlags[play->sceneNum]; memset(actorCtx, 0, sizeof(*actorCtx)); ActorOverlayTable_Init(); - Matrix_MtxFCopy(&globalCtx->billboardMtxF, &gMtxFClear); - Matrix_MtxFCopy(&globalCtx->viewProjectionMtxF, &gMtxFClear); + Matrix_MtxFCopy(&play->billboardMtxF, &gMtxFClear); + Matrix_MtxFCopy(&play->viewProjectionMtxF, &gMtxFClear); overlayEntry = &gActorOverlayTable[0]; for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) { @@ -2455,13 +2455,13 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorCtx->flags.clear = savedSceneFlags->clear; actorCtx->flags.collect = savedSceneFlags->collect; - func_8002CDE4(globalCtx, &actorCtx->titleCtx); + func_8002CDE4(play, &actorCtx->titleCtx); actorCtx->absoluteSpace = NULL; - Actor_SpawnEntry(actorCtx, actorEntry, globalCtx); - func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, globalCtx); - func_8002FA60(globalCtx); + Actor_SpawnEntry(actorCtx, actorEntry, play); + func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, play); + func_8002FA60(play); } u32 D_80116068[ACTORCAT_MAX] = { @@ -2469,7 +2469,7 @@ u32 D_80116068[ACTORCAT_MAX] = { 0x10000080, 0x00000000, 0x300000C0, 0x100004C0, 0x00000000, 0x100000C0, }; -void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { +void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { Actor* refActor; Actor* actor; Player* player; @@ -2480,7 +2480,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { ActorEntry* actorEntry; s32 i; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (0) { // This ASSERT is optimized out but it exists due to its presence in rodata @@ -2490,12 +2490,12 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { sp74 = NULL; unkFlag = 0; - if (globalCtx->numSetupActors != 0) { - actorEntry = &globalCtx->setupActorList[0]; - for (i = 0; i < globalCtx->numSetupActors; i++) { - Actor_SpawnEntry(&globalCtx->actorCtx, actorEntry++, globalCtx); + if (play->numSetupActors != 0) { + actorEntry = &play->setupActorList[0]; + for (i = 0; i < play->numSetupActors; i++) { + Actor_SpawnEntry(&play->actorCtx, actorEntry++, play); } - globalCtx->numSetupActors = 0; + play->numSetupActors = 0; } if (actorCtx->unk_02 != 0) { @@ -2503,9 +2503,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } if (KREG(0) == -100) { - refActor = &GET_PLAYER(globalCtx)->actor; + refActor = &GET_PLAYER(play)->actor; KREG(0) = 0; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, refActor->world.pos.y + 100.0f, refActor->world.pos.z, 0, 0, 0, 1); } @@ -2531,14 +2531,14 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor->sfx = 0; if (actor->init != NULL) { - if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) + if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { - Actor_SetObjectDependency(globalCtx, actor); - actor->init(actor, globalCtx); + Actor_SetObjectDependency(play, actor); + actor->init(actor, play); actor->init = NULL; } actor = actor->next; - } else if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { + } else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); actor = actor->next; } else if ((unkFlag && !(actor->flags & unkFlag)) || @@ -2548,9 +2548,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor = actor->next; } else if (actor->update == NULL) { if (!actor->isDrawn) { - actor = Actor_Delete(&globalCtx->actorCtx, actor, globalCtx); + actor = Actor_Delete(&play->actorCtx, actor, play); } else { - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); actor = actor->next; } } else { @@ -2573,12 +2573,12 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor->targetPriority = 0; } - Actor_SetObjectDependency(globalCtx, actor); + Actor_SetObjectDependency(play, actor); if (actor->colorFilterTimer != 0) { actor->colorFilterTimer--; } - actor->update(actor, globalCtx); - func_8003F8EC(globalCtx, &globalCtx->colCtx.dyna, actor); + actor->update(actor, play); + func_8003F8EC(play, &play->colCtx.dyna, actor); } CollisionCheck_ResetDamage(&actor->colChkInfo); @@ -2588,7 +2588,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } if (i == ACTORCAT_BG) { - DynaPoly_Setup(globalCtx, &globalCtx->colCtx.dyna); + DynaPoly_Setup(play, &play->colCtx.dyna); } } @@ -2607,9 +2607,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - func_8002C7BC(&actorCtx->targetCtx, player, actor, globalCtx); - TitleCard_Update(globalCtx, &actorCtx->titleCtx); - DynaPoly_UpdateBgActorTransforms(globalCtx, &globalCtx->colCtx.dyna); + func_8002C7BC(&actorCtx->targetCtx, player, actor, play); + TitleCard_Update(play, &actorCtx->titleCtx); + DynaPoly_UpdateBgActorTransforms(play, &play->colCtx.dyna); } void Actor_FaultPrint(Actor* actor, char* command) { @@ -2634,36 +2634,36 @@ void Actor_FaultPrint(Actor* actor, char* command) { FaultDrawer_Printf("ACTOR NAME %08x:%s", actor, name); } -void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { +void Actor_Draw(PlayState* play, Actor* actor) { FaultClient faultClient; Lights* lights; Fault_AddClient(&faultClient, Actor_FaultPrint, actor, "Actor_draw"); FrameInterpolation_RecordOpenChild(actor, 0); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); + lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); - Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos); - Lights_Draw(lights, globalCtx->state.gfxCtx); + Lights_BindAll(lights, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos); + Lights_Draw(lights, play->state.gfxCtx); FrameInterpolation_RecordActorPosRotMatrix(); if (actor->flags & ACTOR_FLAG_12) { Matrix_SetTranslateRotateYXZ( - actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x, - actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), - actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot); + actor->world.pos.x + play->mainCamera.skyboxOffset.x, + actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y), + actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot); } else { Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y), actor->world.pos.z, &actor->shape.rot); } Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY); - Actor_SetObjectDependency(globalCtx, actor); + Actor_SetObjectDependency(play, actor); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment); if (actor->colorFilterTimer != 0) { Color_RGBA8 color = { 0, 0, 0, 255 }; @@ -2677,27 +2677,27 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { } if (actor->colorFilterParams & 0x2000) { - func_80026860(globalCtx, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + func_80026860(play, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } else { - func_80026400(globalCtx, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + func_80026400(play, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } } - actor->draw(actor, globalCtx); + actor->draw(actor, play); if (actor->colorFilterTimer != 0) { if (actor->colorFilterParams & 0x2000) { - func_80026A6C(globalCtx); + func_80026A6C(play); } else { - func_80026608(globalCtx); + func_80026608(play); } } if (actor->shape.shadowDraw != NULL) { - actor->shape.shadowDraw(actor, lights, globalCtx); + actor->shape.shadowDraw(actor, lights, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); FrameInterpolation_RecordCloseChild(); Fault_RemoveClient(&faultClient); @@ -2745,12 +2745,12 @@ void Actor_DrawLensOverlay(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx); } -void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) { +void Actor_DrawLensActors(PlayState* play, s32 numInvisibleActors, Actor** invisibleActors) { Actor** invisibleActor; GraphicsContext* gfxCtx; s32 i; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -2758,7 +2758,7 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto gDPPipeSync(POLY_XLU_DISP++); - if (globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) { + if (play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) { // Update both the color frame buffer and the z-buffer gDPSetOtherMode(POLY_XLU_DISP++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | @@ -2801,13 +2801,13 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto for (i = 0; i < numInvisibleActors; i++) { // "Magic lens invisible Actor display" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示", i); - Actor_Draw(globalCtx, *(invisibleActor++)); + Actor_Draw(play, *(invisibleActor++)); } // "Magic lens invisible Actor display END" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", numInvisibleActors); - if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { + if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { // Draw the lens overlay to the color frame buffer gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 0); // "Blue spectacles (exterior)" @@ -2831,17 +2831,17 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto CLOSE_DISPS(gfxCtx); } -s32 func_800314B0(GlobalContext* globalCtx, Actor* actor) { - return func_800314D4(globalCtx, actor, &actor->projectedPos, actor->projectedW); +s32 func_800314B0(PlayState* play, Actor* actor) { + return func_800314D4(play, actor, &actor->projectedPos, actor->projectedW); } -s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3) { +s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3) { f32 var; if (CVar_GetS32("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room && actor->id != ACTOR_EN_HORSE // Check for Epona, else if we call her she will spawn at the other side of the map + we can hear her during the title screen sequence && actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning - && (globalCtx->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room + && (play->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room return true; } @@ -2858,7 +2858,7 @@ s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3) return false; } -void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_800315AC(PlayState* play, ActorContext* actorCtx) { s32 invisibleActorCounter; Actor* invisibleActors[INVISIBLE_ACTOR_MAX]; ActorListEntry* actorListEntry; @@ -2867,7 +2867,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { invisibleActorCounter = 0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); actorListEntry = &actorCtx->actorLists[0]; @@ -2884,7 +2884,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { HREG(66) = i; if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, &actor->projectedW); } @@ -2895,7 +2895,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { - if (func_800314B0(globalCtx, actor)) { + if (func_800314B0(play, actor)) { actor->flags |= ACTOR_FLAG_6; } else { actor->flags &= ~ACTOR_FLAG_6; @@ -2907,14 +2907,14 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { if ((actor->flags & ACTOR_FLAG_7) && - ((globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || - globalCtx->actorCtx.lensActive || (actor->room != globalCtx->roomCtx.curRoom.num))) { + ((play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || + play->actorCtx.lensActive || (actor->room != play->roomCtx.curRoom.num))) { ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX); invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; } else { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) { - Actor_Draw(globalCtx, actor); + Actor_Draw(play, actor); actor->isDrawn = true; } } @@ -2926,47 +2926,47 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || (HREG(73) != 0)) { - Effect_DrawAll(globalCtx->state.gfxCtx); + Effect_DrawAll(play->state.gfxCtx); } if ((HREG(64) != 1) || (HREG(74) != 0)) { - EffectSs_DrawAll(globalCtx); + EffectSs_DrawAll(play); } if ((HREG(64) != 1) || (HREG(72) != 0)) { - if (globalCtx->actorCtx.lensActive) { - Actor_DrawLensActors(globalCtx, invisibleActorCounter, invisibleActors); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(globalCtx)) { - Actor_DisableLens(globalCtx); + if (play->actorCtx.lensActive) { + Actor_DrawLensActors(play, invisibleActorCounter, invisibleActors); + if ((play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play)) { + Actor_DisableLens(play); } } } - Actor_DrawFaroresWindPointer(globalCtx); + Actor_DrawFaroresWindPointer(play); if (IREG(32) == 0) { - Lights_DrawGlow(globalCtx); + Lights_DrawGlow(play); } if ((HREG(64) != 1) || (HREG(75) != 0)) { - TitleCard_Draw(globalCtx, &actorCtx->titleCtx); + TitleCard_Draw(play, &actorCtx->titleCtx); } if ((HREG(64) != 1) || (HREG(76) != 0)) { - CollisionCheck_DrawCollision(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_DrawCollision(play, &play->colChkCtx); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_80031A28(PlayState* play, ActorContext* actorCtx) { Actor* actor; s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { actor = actorCtx->actorLists[i].head; while (actor != NULL) { - if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); } actor = actor->next; @@ -2976,7 +2976,7 @@ void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { u8 sEnemyActorCategories[] = { ACTORCAT_ENEMY, ACTORCAT_BOSS }; -void Actor_FreezeAllEnemies(GlobalContext* globalCtx, ActorContext* actorCtx, s32 duration) { +void Actor_FreezeAllEnemies(PlayState* play, ActorContext* actorCtx, s32 duration) { Actor* actor; s32 i; @@ -2989,20 +2989,20 @@ void Actor_FreezeAllEnemies(GlobalContext* globalCtx, ActorContext* actorCtx, s3 } } -void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_80031B14(PlayState* play, ActorContext* actorCtx) { Actor* actor; s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { actor = actorCtx->actorLists[i].head; while (actor != NULL) { - if ((actor->room >= 0) && (actor->room != globalCtx->roomCtx.curRoom.num) && - (actor->room != globalCtx->roomCtx.prevRoom.num)) { + if ((actor->room >= 0) && (actor->room != play->roomCtx.curRoom.num) && + (actor->room != play->roomCtx.prevRoom.num)) { if (!actor->isDrawn) { - actor = Actor_Delete(actorCtx, actor, globalCtx); + actor = Actor_Delete(actorCtx, actor, play); } else { Actor_Kill(actor); - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); actor = actor->next; } } else { @@ -3011,21 +3011,21 @@ void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - CollisionCheck_ClearContext(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_ClearContext(play, &play->colChkCtx); actorCtx->flags.tempClear = 0; actorCtx->flags.tempSwch &= 0xFFFFFF; - globalCtx->msgCtx.unk_E3F4 = 0; + play->msgCtx.unk_E3F4 = 0; } // Actor_CleanupContext -void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) { +void func_80031C3C(ActorContext* actorCtx, PlayState* play) { Actor* actor; s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { actor = actorCtx->actorLists[i].head; while (actor != NULL) { - Actor_Delete(actorCtx, actor, globalCtx); + Actor_Delete(actorCtx, actor, play); actor = actorCtx->actorLists[i].head; } } @@ -3039,8 +3039,8 @@ void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) { actorCtx->absoluteSpace = NULL; } - Gameplay_SaveSceneFlags(globalCtx); - func_80030488(globalCtx); + Play_SaveSceneFlags(play); + func_80030488(play); ActorOverlayTable_Cleanup(); } @@ -3069,7 +3069,7 @@ void Actor_AddToCategory(ActorContext* actorCtx, Actor* actorToAdd, u8 actorCate * Removes a given actor instance from its actor list. * Also sets the temp clear flag of the current room if the actor removed was the last enemy loaded. */ -Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actorToRemove) { +Actor* Actor_RemoveFromCategory(PlayState* play, ActorContext* actorCtx, Actor* actorToRemove) { Actor* newHead; actorCtx->total--; @@ -3090,9 +3090,9 @@ Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx actorToRemove->next = NULL; actorToRemove->prev = NULL; - if ((actorToRemove->room == globalCtx->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && + if ((actorToRemove->room == play->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && (actorCtx->actorLists[ACTORCAT_ENEMY].length == 0)) { - Flags_SetTempClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetTempClear(play, play->roomCtx.curRoom.num); } return newHead; @@ -3140,7 +3140,7 @@ void Actor_FreeOverlay(ActorOverlay* actorOverlay) { int gMapLoading = 0; -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, +Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) { s32 pad; Actor* actor; @@ -3224,13 +3224,13 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId : NULL); } - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, actorInit->objectId); + objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId); if (objBankIndex < 0 && !gMapLoading) objBankIndex = 0; if ((objBankIndex < 0) || - ((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num))) { + ((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) { // "No data bank!! (profilep->bank=%d)" osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, objBankIndex, actorInit->objectId); @@ -3273,7 +3273,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId actor->destroy = actorInit->destroy; actor->update = actorInit->update; actor->draw = actorInit->draw; - actor->room = globalCtx->roomCtx.curRoom.num; + actor->room = play->roomCtx.curRoom.num; actor->home.pos.x = posX; actor->home.pos.y = posY; actor->home.pos.z = posZ; @@ -3285,15 +3285,15 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId Actor_AddToCategory(actorCtx, actor, actorInit->category); temp = gSegments[6]; - Actor_Init(actor, globalCtx); + Actor_Init(actor, play); gSegments[6] = temp; return actor; } -Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* globalCtx, s16 actorId, f32 posX, +Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) { - Actor* spawnedActor = Actor_Spawn(actorCtx, globalCtx, actorId, posX, posY, posZ, rotX, rotY, rotZ, params); + Actor* spawnedActor = Actor_Spawn(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params); if (spawnedActor == NULL) { return NULL; @@ -3309,50 +3309,50 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* return spawnedActor; } -void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx) { +void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { TransitionActorEntry* transitionActor; u8 numActors; s32 i; - transitionActor = globalCtx->transiActorCtx.list; - numActors = globalCtx->transiActorCtx.numActors; + transitionActor = play->transiActorCtx.list; + numActors = play->transiActorCtx.numActors; for (i = 0; i < numActors; i++) { if (transitionActor->id >= 0) { if (((transitionActor->sides[0].room >= 0) && - ((transitionActor->sides[0].room == globalCtx->roomCtx.curRoom.num) || - (transitionActor->sides[0].room == globalCtx->roomCtx.prevRoom.num))) || + ((transitionActor->sides[0].room == play->roomCtx.curRoom.num) || + (transitionActor->sides[0].room == play->roomCtx.prevRoom.num))) || ((transitionActor->sides[1].room >= 0) && - ((transitionActor->sides[1].room == globalCtx->roomCtx.curRoom.num) || - (transitionActor->sides[1].room == globalCtx->roomCtx.prevRoom.num)))) { - Actor_Spawn(actorCtx, globalCtx, (s16)(transitionActor->id & 0x1FFF), transitionActor->pos.x, + ((transitionActor->sides[1].room == play->roomCtx.curRoom.num) || + (transitionActor->sides[1].room == play->roomCtx.prevRoom.num)))) { + Actor_Spawn(actorCtx, play, (s16)(transitionActor->id & 0x1FFF), transitionActor->pos.x, transitionActor->pos.y, transitionActor->pos.z, 0, transitionActor->rotY, 0, (i << 0xA) + transitionActor->params); transitionActor->id = -transitionActor->id; - numActors = globalCtx->transiActorCtx.numActors; + numActors = play->transiActorCtx.numActors; } } transitionActor++; } } -Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx) { +Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play) { gMapLoading = 1; - Actor* ret = Actor_Spawn(actorCtx, globalCtx, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y, actorEntry->pos.z, + Actor* ret = Actor_Spawn(actorCtx, play, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y, actorEntry->pos.z, actorEntry->rot.x, actorEntry->rot.y, actorEntry->rot.z, actorEntry->params); gMapLoading = 0; return ret; } -Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx) { +Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { char* name; Player* player; Actor* newHead; ActorOverlay* overlayEntry; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -3363,7 +3363,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC if ((player != NULL) && (actor == player->unk_664)) { func_8008EDF0(player); - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, Gameplay_GetActiveCamId(globalCtx)), 0); + Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0); } if (actor == actorCtx->targetCtx.arrowPointedActor) { @@ -3379,9 +3379,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); ZELDA_ARENA_FREE_DEBUG(actor); @@ -3399,11 +3399,11 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC return newHead; } -s32 func_80032880(GlobalContext* globalCtx, Actor* actor) { +s32 func_80032880(PlayState* play, Actor* actor) { s16 sp1E; s16 sp1C; - Actor_GetScreenPos(globalCtx, actor, &sp1E, &sp1C); + Actor_GetScreenPos(play, actor, &sp1E, &sp1C); return (sp1E > -20) && (sp1E < 340) && (sp1C > -160) && (sp1C < 400); } @@ -3415,7 +3415,7 @@ f32 sbgmEnemyDistSq; s32 D_8015BBF8; s16 D_8015BBFC; -void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* player, u32 actorCategory) { +void func_800328D4(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) { f32 var; Actor* actor; Actor* sp84; @@ -3439,10 +3439,10 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla if (actor != sp84) { var = func_8002EFC0(actor, player, D_8015BBFC); - if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(globalCtx, actor) && - (!BgCheck_CameraLineTest1(&globalCtx->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, + if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(play, actor) && + (!BgCheck_CameraLineTest1(&play->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, &sp80, 1, 1, 1, 1, &sp7C) || - SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, sp80, sp7C))) { + SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp80, sp7C))) { if (actor->targetPriority != 0) { if (actor->targetPriority < D_8015BBF8) { D_8015BBEC = actor; @@ -3465,7 +3465,7 @@ u8 D_801160A0[] = { ACTORCAT_CHEST, ACTORCAT_SWITCH, ACTORCAT_PROP, ACTORCAT_MISC, ACTORCAT_DOOR, ACTORCAT_SWITCH, }; -Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player) { +Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player) { s32 i; u8* entry; @@ -3473,20 +3473,20 @@ Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** a D_8015BBF0 = sbgmEnemyDistSq = FLT_MAX; D_8015BBF8 = 0x7FFFFFFF; - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { entry = &D_801160A0[0]; actorCtx->targetCtx.bgmEnemy = NULL; D_8015BBFC = player->actor.shape.rot.y; for (i = 0; i < 3; i++) { - func_800328D4(globalCtx, actorCtx, player, *entry); + func_800328D4(play, actorCtx, player, *entry); entry++; } if (D_8015BBE8 == NULL) { for (; i < ARRAY_COUNT(D_801160A0); i++) { - func_800328D4(globalCtx, actorCtx, player, *entry); + func_800328D4(play, actorCtx, player, *entry); entry++; } } @@ -3521,9 +3521,9 @@ Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory) { * Play the death sound effect and flash the screen white for 4 frames. * While the screen flashes, the game freezes. */ -void Enemy_StartFinishingBlow(GlobalContext* globalCtx, Actor* actor) { - globalCtx->actorCtx.freezeFlashTimer = 5; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); +void Enemy_StartFinishingBlow(PlayState* play, Actor* actor) { + play->actorCtx.freezeFlashTimer = 5; + SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); } s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { @@ -3555,7 +3555,7 @@ s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { return arg0[0]; } -void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx) { +void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) { u32 matricesSize; u32 dListsSize; u32 objectIdsSize; @@ -3596,9 +3596,9 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx) void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, s16 objectId) { - GlobalContext* globalCtx = Effect_GetGlobalCtx(); + PlayState* play = Effect_GetPlayState(); - if ((globalCtx->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) { + if ((play->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) { if ((limbIndex >= minLimbIndex) && (limbIndex <= maxLimbIndex) && (*dList != NULL)) { bodyBreak->dLists[bodyBreak->val] = *dList; Matrix_Get(&bodyBreak->matrices[bodyBreak->val]); @@ -3619,7 +3619,7 @@ void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s3 bodyBreak->prevLimbIndex = limbIndex; } -s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* globalCtx, s16 type) { +s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type) { EnPart* spawnedEnPart; MtxF* mtx; s16 objBankIndex; @@ -3643,7 +3643,7 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob mtx = &bodyBreak->matrices[bodyBreak->count]; - spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, mtx->xw, + spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, mtx->xw, mtx->yw, mtx->zw, 0, 0, objBankIndex, type); if (spawnedEnPart != NULL) { @@ -3664,7 +3664,7 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob return true; } -void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, +void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting) { Vec3f pos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -3683,12 +3683,12 @@ void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* pos accel.z = (Rand_ZeroOne() - 0.5f) * randAccelWeight; if (scale == 0) { - func_8002857C(globalCtx, &pos, &velocity, &accel); + func_8002857C(play, &pos, &velocity, &accel); } else { if (useLighting) { - func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_800286CC(play, &pos, &velocity, &accel, scale, scaleStep); } else { - func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_8002865C(play, &pos, &velocity, &accel, scale, scaleStep); } } @@ -3696,7 +3696,7 @@ void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* pos } } -void func_80033480(GlobalContext* globalCtx, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, +void func_80033480(PlayState* play, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, s16 scaleStep, u8 arg6) { Vec3f pos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -3714,14 +3714,14 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* posBase, f32 randRangeDiamet var2 = arg6; if (var2 != 0) { - func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_800286CC(play, &pos, &velocity, &accel, scale, scaleStep); } else { - func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_8002865C(play, &pos, &velocity, &accel, scale, scaleStep); } } } -Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider) { +Actor* Actor_GetCollidedExplosive(PlayState* play, Collider* collider) { if ((collider->acFlags & AC_HIT) && (collider->ac->category == ACTORCAT_EXPLOSIVE)) { collider->acFlags &= ~AC_HIT; return collider->ac; @@ -3730,8 +3730,8 @@ Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider) return NULL; } -Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +Actor* func_80033684(PlayState* play, Actor* explosiveActor) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (actor != NULL) { if ((actor == explosiveActor) || (actor->params != 1)) { @@ -3752,8 +3752,8 @@ Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) { * Dynamically changes the category of a given actor instance. * This is done by moving it to the corresponding category list and setting its category variable accordingly. */ -void Actor_ChangeCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory) { - Actor_RemoveFromCategory(globalCtx, actorCtx, actor); +void Actor_ChangeCategory(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 actorCategory) { + Actor_RemoveFromCategory(play, actorCtx, actor); Actor_AddToCategory(actorCtx, actor, actorCategory); } @@ -3764,7 +3764,7 @@ void Actor_ChangeCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Acto * * Returns the actor if there will be collision, NULL otherwise. */ -Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 radius) { +Actor* Actor_GetProjectileActor(PlayState* play, Actor* refActor, f32 radius) { Actor* actor; Vec3f spA8; f32 deltaX; @@ -3773,7 +3773,7 @@ Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 r Vec3f sp90; Vec3f sp84; - actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (actor != NULL) { if (((actor->id != ACTOR_ARMS_HOOK) && (actor->id != ACTOR_EN_ARROW)) || (actor == refActor)) { actor = actor->next; @@ -3811,10 +3811,10 @@ Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 r /** * Sets the actor's text id with a dynamic prefix based on the current scene. */ -void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTextId) { +void Actor_SetTextWithPrefix(PlayState* play, Actor* actor, s16 baseTextId) { s16 prefix; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_YDAN_BOSS: case SCENE_MORIBOSSROOM: @@ -3894,7 +3894,7 @@ void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTex * * Returns true if the actor will be standing on ground. */ -s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 distance, s16 angle) { +s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 angle) { s16 ret; s16 prevBgCheckFlags; f32 dx; @@ -3909,7 +3909,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, &prevActorPos); @@ -3922,8 +3922,8 @@ s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 dista /** * Returns true if the player is targeting the provided actor */ -s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_IsTargeted(PlayState* play, Actor* actor) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 & 0x10) && actor->isTargeted) { return true; @@ -3935,8 +3935,8 @@ s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { /** * Returns true if the player is targeting an actor other than the provided actor */ -s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 & 0x10) && !actor->isTargeted) { return true; @@ -3961,13 +3961,13 @@ f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 ar return ret; } -void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) { +void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { MtxF sp60; f32 var; Vec3f sp50; CollisionPoly* sp4C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); @@ -3977,7 +3977,7 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) sp50.y = arg0->y + 1.0f; sp50.z = arg0->z; - var = BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &sp4C, &sp50); + var = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &sp4C, &sp50); if (sp4C != NULL) { func_80038A28(sp4C, arg0->x, var, arg0->z, &sp60); @@ -3988,37 +3988,37 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2) { - s16 var = Quake_Add(&globalCtx->mainCamera, 3); +void func_80033DB8(PlayState* play, s16 arg1, s16 arg2) { + s16 var = Quake_Add(&play->mainCamera, 3); Quake_SetSpeed(var, 20000); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); } -void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { - s16 var = Quake_Add(&globalCtx->mainCamera, 3); +void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3) { + s16 var = Quake_Add(&play->mainCamera, 3); Quake_SetSpeed(var, arg3); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); } -void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3) { +void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3) { if (arg2 >= 5) { func_800AA000(actor->xyzDistToPlayerSq, 0xFF, 0x14, 0x96); } else { func_800AA000(actor->xyzDistToPlayerSq, 0xB4, 0x14, 0x64); } - func_80033DB8(globalCtx, arg2, arg3); + func_80033DB8(play, arg2, arg3); } f32 Rand_ZeroFloat(f32 f) { @@ -4049,7 +4049,7 @@ static DoorLockInfo sDoorLocksInfo[] = { * Draws chains and lock of a locked door, of the specified `type` (see `DoorLockType`). * `frame` can be 0 to 10, where 0 is "open" and 10 is "closed", the chains slide accordingly. */ -void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { +void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type) { DoorLockInfo* entry; s32 i; MtxF baseMtxF; @@ -4061,7 +4061,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { entry = &sDoorLocksInfo[type]; chainRotZ = entry->chainsRotZInit; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, entry->yShift, 500.0f, MTXMODE_APPLY); Matrix_Get(&baseMtxF); @@ -4079,7 +4079,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), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, entry->chainDL); @@ -4096,15 +4096,15 @@ 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), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, entry->lockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, arg1); +void func_8003424C(PlayState* play, Vec3f* arg1) { + CollisionCheck_SpawnShieldParticlesMetal(play, arg1); } void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 xluFlag, s16 duration) { @@ -4116,52 +4116,52 @@ void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s1 actor->colorFilterTimer = duration; } -Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) { +Hilite* func_800342EC(Vec3f* object, PlayState* play) { Vec3f lightDir; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; - return func_8002EABC(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + return func_8002EABC(object, &play->view.eye, &lightDir, play->state.gfxCtx); } -Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx) { +Hilite* func_8003435C(Vec3f* object, PlayState* play) { Vec3f lightDir; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; - return func_8002EB44(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + return func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx); } -s32 func_800343CC(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 interactRange, callback1_800343CC unkFunc1, +s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, callback1_800343CC unkFunc1, callback2_800343CC unkFunc2) { s16 x; s16 y; - if (Actor_ProcessTalkRequest(actor, globalCtx)) { + if (Actor_ProcessTalkRequest(actor, play)) { *arg2 = 1; return true; } if (*arg2 != 0) { - *arg2 = unkFunc2(globalCtx, actor); + *arg2 = unkFunc2(play, actor); return false; } - Actor_GetScreenPos(globalCtx, actor, &x, &y); + Actor_GetScreenPos(play, actor, &x, &y); if ((x < 0) || (x > SCREEN_WIDTH) || (y < 0) || (y > SCREEN_HEIGHT)) { return false; } - if (!func_8002F2CC(actor, globalCtx, interactRange)) { + if (!func_8002F2CC(actor, play, interactRange)) { return false; } - actor->textId = unkFunc1(globalCtx, actor); + actor->textId = unkFunc1(play, actor); return false; } @@ -4340,45 +4340,45 @@ Gfx* func_80034B54(GraphicsContext* gfxCtx) { return displayList; } -void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, +void func_80034BA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, alpha); gDPPipeSync(POLY_OPA_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80034B28(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, func_80034B28(play->state.gfxCtx)); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, actor, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, +void func_80034CC4(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, alpha); - gSPSegment(POLY_XLU_DISP++, 0x0C, func_80034B54(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x0C, func_80034B54(play->state.gfxCtx)); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { - Player* player = GET_PLAYER(globalCtx); +s16 func_80034DD4(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { + Player* player = GET_PLAYER(play); f32 var; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) { - var = Math_Vec3f_DistXYZ(&actor->world.pos, &globalCtx->view.eye) * 0.25f; + if ((play->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) { + var = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; } else { var = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); } @@ -4409,8 +4409,8 @@ void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, frameCount, animationInfo->mode, animationInfo->morphFrames); } -void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) { - u32 frames = globalCtx->gameplayFrames; +void func_80034F54(PlayState* play, s16* arg1, s16* arg2, s32 arg3) { + u32 frames = play->gameplayFrames; s32 i; for (i = 0; i < arg3; i++) { @@ -4419,15 +4419,15 @@ void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) { } } -void Actor_Noop(Actor* actor, GlobalContext* globalCtx) { +void Actor_Noop(Actor* actor, PlayState* play) { } -s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { +s32 func_80035124(Actor* actor, PlayState* play) { s32 ret = 0; switch (actor->params) { case 0: - if (Actor_HasParent(actor, globalCtx)) { + if (Actor_HasParent(actor, play)) { actor->params = 1; } else if (!(actor->bgCheckFlags & 1)) { Actor_MoveForward(actor); @@ -4436,24 +4436,24 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { ret = 1; } else { actor->shape.rot.x = actor->shape.rot.z = 0; - func_8002F580(actor, globalCtx); + func_8002F580(actor, play); } break; case 1: - if (Actor_HasNoParent(actor, globalCtx)) { + if (Actor_HasNoParent(actor, play)) { actor->params = 0; } break; } - Actor_UpdateBgCheckInfo(globalCtx, actor, actor->colChkInfo.cylHeight, actor->colChkInfo.cylRadius, + Actor_UpdateBgCheckInfo(play, actor, actor->colChkInfo.cylHeight, actor->colChkInfo.cylRadius, actor->colChkInfo.cylRadius, 0x1D); return ret; } -u8 func_800353E8(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u8 func_800353E8(PlayState* play) { + Player* player = GET_PLAYER(play); return player->unk_845; } @@ -4463,8 +4463,8 @@ u8 func_800353E8(GlobalContext* globalCtx) { * an actor if there is one. If the ID provided is -1, this will look for any actor of the * specified category rather than a specific ID. */ -Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorCategory, f32 range) { - Actor* actor = globalCtx->actorCtx.actorLists[actorCategory].head; +Actor* Actor_FindNearby(PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range) { + Actor* actor = play->actorCtx.actorLists[actorCategory].head; while (actor != NULL) { if (actor == refActor || ((actorId != -1) && (actorId != actor->id))) { @@ -4481,8 +4481,8 @@ Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, return NULL; } -s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) { - Player* player = GET_PLAYER(globalCtx); +s32 func_800354B4(PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) { + Player* player = GET_PLAYER(play); s16 var1; s16 var2; @@ -4496,7 +4496,7 @@ s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s } } -void func_8003555C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void func_8003555C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { Color_RGBA8 color1; Color_RGBA8 color2; @@ -4509,7 +4509,7 @@ void func_8003555C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* color2.b = 50; //! @bug color1 and color2 alpha components not set before being passed on - EffectSsKiraKira_SpawnSmall(globalCtx, pos, velocity, accel, &color1, &color2); + EffectSsKiraKira_SpawnSmall(play, pos, velocity, accel, &color1, &color2); } Vec3f D_80116268 = { 0.0f, -1.5f, 0.0f }; @@ -4522,12 +4522,12 @@ Gfx D_80116280[] = { gsSPEndDisplayList(), }; -void func_800355B8(GlobalContext* globalCtx, Vec3f* pos) { - func_8003555C(globalCtx, pos, &D_80116268, &D_80116274); +void func_800355B8(PlayState* play, Vec3f* pos) { + func_8003555C(play, pos, &D_80116268, &D_80116274); } -u8 func_800355E4(GlobalContext* globalCtx, Collider* collider) { - Player* player = GET_PLAYER(globalCtx); +u8 func_800355E4(PlayState* play, Collider* collider) { + Player* player = GET_PLAYER(play); if ((collider->acFlags & AC_TYPE_PLAYER) && (player->swordState != 0) && (player->swordAnimation == 0x16)) { return true; @@ -4625,11 +4625,11 @@ void func_80035844(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3) { * Spawns En_Part (Dissipating Flames) actor as a child of the given actor. */ Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, - GlobalContext* globalCtx, s16 params, s32 arg8) { + PlayState* play, s16 params, s32 arg8) { EnPart* spawnedEnPart; spawnedEnPart = - (EnPart*)Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, spawnPos->x, spawnPos->y, + (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, spawnPos->x, spawnPos->y, spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params); if (spawnedEnPart != NULL) { spawnedEnPart->actor.scale = actor->scale; @@ -4676,8 +4676,8 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) { } } -void func_80035B18(GlobalContext* globalCtx, Actor* actor, u16 textId) { - Message_ContinueTextbox(globalCtx, textId); +void func_80035B18(PlayState* play, Actor* actor, u16 textId) { + Message_ContinueTextbox(play, textId); actor->textId = textId; } @@ -4723,7 +4723,7 @@ void Flags_SetRandomizerInf(RandomizerInf flag) { gSaveContext.randomizerInf[flag >> 4] |= (1 << (flag & 0xF)); } -u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { +u32 func_80035BFC(PlayState* play, s16 arg1) { u16 retTextId = 0; switch (arg1) { @@ -5013,7 +5013,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { } break; case 16: - if (globalCtx->sceneNum == SCENE_SPOT15) { + if (play->sceneNum == SCENE_SPOT15) { retTextId = 0x7002; } else if (Flags_GetInfTable(0x6A)) { retTextId = 0x7004; @@ -5710,24 +5710,24 @@ void func_80036E50(u16 textId, s16 arg1) { } } -s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 func_800374E0(PlayState* play, Actor* actor, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; s32 ret = 1; switch (textId) { case 0x1035: if (msgCtx->choiceIndex == 0) { if (Flags_GetInfTable(0x2A)) { - func_80035B18(globalCtx, actor, 0x1036); + func_80035B18(play, actor, 0x1036); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } if (msgCtx->choiceIndex == 1) { if (Flags_GetInfTable(0x2B)) { - func_80035B18(globalCtx, actor, 0x1037); + func_80035B18(play, actor, 0x1037); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } ret = 0; @@ -5735,58 +5735,58 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x1038: if (msgCtx->choiceIndex == 0) { if (Flags_GetInfTable(0x2E)) { - func_80035B18(globalCtx, actor, 0x1039); + func_80035B18(play, actor, 0x1039); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } if (msgCtx->choiceIndex == 1) { if (Flags_GetInfTable(0x2F)) { - func_80035B18(globalCtx, actor, 0x103A); + func_80035B18(play, actor, 0x103A); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } if (msgCtx->choiceIndex == 2) { if (Flags_GetInfTable(0x30)) { - func_80035B18(globalCtx, actor, 0x103B); + func_80035B18(play, actor, 0x103B); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } ret = 0; break; case 0x103E: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x103F); + func_80035B18(play, actor, 0x103F); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x1040); + func_80035B18(play, actor, 0x1040); } ret = 0; break; case 0x1041: if (msgCtx->choiceTextId == 0x1035) { if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x1036); + func_80035B18(play, actor, 0x1036); Flags_SetInfTable(0x2A); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x1037); + func_80035B18(play, actor, 0x1037); Flags_SetInfTable(0x2B); } } if (msgCtx->choiceTextId == 0x1038) { if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x1039); + func_80035B18(play, actor, 0x1039); Flags_SetInfTable(0x2E); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x103A); + func_80035B18(play, actor, 0x103A); Flags_SetInfTable(0x2F); } if (msgCtx->choiceIndex == 2) { - func_80035B18(globalCtx, actor, 0x103B); + func_80035B18(play, actor, 0x103B); Flags_SetInfTable(0x30); } } @@ -5794,10 +5794,10 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { break; case 0x1062: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x1063); + func_80035B18(play, actor, 0x1063); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x1064); + func_80035B18(play, actor, 0x1064); } ret = 0; break; @@ -5805,14 +5805,14 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x2031: if (msgCtx->choiceIndex == 0) { if (gSaveContext.rupees >= 10) { - func_80035B18(globalCtx, actor, 0x2034); + func_80035B18(play, actor, 0x2034); Rupees_ChangeBy(-10); } else { - func_80035B18(globalCtx, actor, 0x2032); + func_80035B18(play, actor, 0x2032); } } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x2032); + func_80035B18(play, actor, 0x2032); } Flags_SetInfTable(0x9A); ret = 0; @@ -5820,10 +5820,10 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x2036: case 0x2037: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x201F); + func_80035B18(play, actor, 0x201F); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x205A); + func_80035B18(play, actor, 0x205A); } ret = 0; break; @@ -5832,7 +5832,7 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { break; } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x205A); + func_80035B18(play, actor, 0x205A); } ret = 0; break; @@ -5840,14 +5840,14 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { if (msgCtx->choiceIndex != 0) { break; } - func_80035B18(globalCtx, actor, 0x2035); + func_80035B18(play, actor, 0x2035); ret = 0; break; case 0x2043: if (Flags_GetEventChkInf(0x12)) { break; } - func_80035B18(globalCtx, actor, 0x2044); + func_80035B18(play, actor, 0x2044); ret = 0; break; case 0x205A: @@ -5855,52 +5855,52 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x300A: if (msgCtx->choiceIndex == 0) { if (Flags_GetEventChkInf(0x22)) { - func_80035B18(globalCtx, actor, 0x300B); + func_80035B18(play, actor, 0x300B); } else { - func_80035B18(globalCtx, actor, 0x300C); + func_80035B18(play, actor, 0x300C); } } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x300D); + func_80035B18(play, actor, 0x300D); } ret = 0; break; case 0x301B: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x301D); + func_80035B18(play, actor, 0x301D); } if (msgCtx->choiceIndex == 1) { if (Flags_GetInfTable(0x113)) { - func_80035B18(globalCtx, actor, 0x301F); + func_80035B18(play, actor, 0x301F); } else { - func_80035B18(globalCtx, actor, 0x301E); + func_80035B18(play, actor, 0x301E); } } ret = 0; break; case 0x301E: - func_80035B18(globalCtx, actor, 0x3020); + func_80035B18(play, actor, 0x3020); ret = 0; break; case 0x400C: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x400D); + func_80035B18(play, actor, 0x400D); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x400E); + func_80035B18(play, actor, 0x400E); } ret = 0; break; case 0x7007: - func_80035B18(globalCtx, actor, 0x703E); + func_80035B18(play, actor, 0x703E); ret = 0; break; case 0x703E: - func_80035B18(globalCtx, actor, 0x703F); + func_80035B18(play, actor, 0x703F); ret = 0; break; case 0x703F: - func_80035B18(globalCtx, actor, 0x7042); + func_80035B18(play, actor, 0x7042); ret = 0; break; } @@ -5908,31 +5908,31 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { return ret; } -u16 func_80037C30(GlobalContext* globalCtx, s16 arg1) { - return func_80035BFC(globalCtx, arg1); +u16 func_80037C30(PlayState* play, s16 arg1) { + return func_80035BFC(play, arg1); } -s32 func_80037C5C(GlobalContext* globalCtx, s16 arg1, u16 textId) { +s32 func_80037C5C(PlayState* play, s16 arg1, u16 textId) { func_80036E50(textId, arg1); return false; } -s32 func_80037C94(GlobalContext* globalCtx, Actor* actor, s32 arg2) { - return func_800374E0(globalCtx, actor, actor->textId); +s32 func_80037C94(PlayState* play, Actor* actor, s32 arg2) { + return func_800374E0(play, actor, actor->textId); } -s32 func_80037CB8(GlobalContext* globalCtx, Actor* actor, s16 arg2) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 func_80037CB8(PlayState* play, Actor* actor, s16 arg2) { + MessageContext* msgCtx = &play->msgCtx; s32 ret = false; switch (Message_GetState(msgCtx)) { case TEXT_STATE_CLOSING: - func_80037C5C(globalCtx, arg2, actor->textId); + func_80037C5C(play, arg2, actor->textId); ret = true; break; case TEXT_STATE_CHOICE: case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx) && func_80037C94(globalCtx, actor, arg2)) { + if (Message_ShouldAdvance(play) && func_80037C94(play, actor, arg2)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); msgCtx->msgMode = MSGMODE_TEXT_CLOSING; ret = true; @@ -5943,25 +5943,25 @@ s32 func_80037CB8(GlobalContext* globalCtx, Actor* actor, s16 arg2) { return ret; } -s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { +s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3) { s16 var; s16 sp2C; s16 sp2A; s16 abs_var; - if (Actor_ProcessTalkRequest(actor, globalCtx)) { + if (Actor_ProcessTalkRequest(actor, play)) { *arg3 = 1; return true; } if (*arg3 == 1) { - if (func_80037CB8(globalCtx, actor, arg2)) { + if (func_80037CB8(play, actor, arg2)) { *arg3 = 0; } return false; } - Actor_GetScreenPos(globalCtx, actor, &sp2C, &sp2A); + Actor_GetScreenPos(play, actor, &sp2C, &sp2A); if ((sp2C < 0) || (sp2C > SCREEN_WIDTH) || (sp2A < 0) || (sp2A > SCREEN_HEIGHT)) { return false; @@ -5979,12 +5979,12 @@ s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { } if (actor->xyzDistToPlayerSq <= SQ(80.0f)) { - if (func_8002F2CC(actor, globalCtx, 80.0f)) { - actor->textId = func_80037C30(globalCtx, arg2); + if (func_8002F2CC(actor, play, 80.0f)) { + actor->textId = func_80037C30(play, arg2); } } else { - if (func_8002F2F4(actor, globalCtx)) { - actor->textId = func_80037C30(globalCtx, arg2); + if (func_8002F2F4(actor, play)) { + actor->textId = func_80037C30(play, arg2); } } @@ -6023,8 +6023,8 @@ s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) { return true; } -s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, f32 arg4) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80038154(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, f32 arg4) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp2C; s16 var; @@ -6033,7 +6033,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->focus.pos = actor->world.pos; actor->focus.pos.y += arg4; - if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE))) { + if (!(((play->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE))) { var = actor->yawTowardsPlayer - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { @@ -6042,8 +6042,8 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar } } - if (((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE)) { - sp2C = globalCtx->view.eye; + if (((play->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE)) { + sp2C = play->view.eye; } else { sp2C = player->actor.focus.pos; } @@ -6053,8 +6053,8 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar return true; } -s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80038290(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp24; s16 var; @@ -6062,7 +6062,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->focus.pos = arg4; - if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE))) { + if (!(((play->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE))) { var = actor->yawTowardsPlayer - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { @@ -6071,8 +6071,8 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar } } - if (((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE)) { - sp24 = globalCtx->view.eye; + if (((play->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) && (gSaveContext.entranceIndex == 0x00EE)) { + sp24 = play->view.eye; } else { sp24 = player->actor.focus.pos; } @@ -6082,7 +6082,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar return true; } -GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, GlobalContext* globalCtx) { +GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, PlayState* play) { if (Randomizer_GetSettingValue(RSK_SHUFFLE_CHEST_MINIGAME)) { // RANDOTODO update this logic when we implement keysanity // because 3drando replaces the keys not the rupees @@ -6092,27 +6092,27 @@ GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, GlobalContext* glob { switch(room) { case 1: - if(!Flags_GetCollectible(globalCtx, 0x1B)) { + if(!Flags_GetCollectible(play, 0x1B)) { return Randomizer_GetItemFromKnownCheck(RC_MARKET_TREASURE_CHEST_GAME_ITEM_1, GI_RUPEE_GREEN); } break; case 2: - if(!Flags_GetCollectible(globalCtx, 0x1C)) { + if(!Flags_GetCollectible(play, 0x1C)) { return Randomizer_GetItemFromKnownCheck(RC_MARKET_TREASURE_CHEST_GAME_ITEM_2, GI_RUPEE_GREEN); } break; case 3: - if(!Flags_GetCollectible(globalCtx, 0x1D)) { + if(!Flags_GetCollectible(play, 0x1D)) { return Randomizer_GetItemFromKnownCheck(RC_MARKET_TREASURE_CHEST_GAME_ITEM_3, GI_RUPEE_BLUE); } break; case 4: - if(!Flags_GetCollectible(globalCtx, 0x1E)) { + if(!Flags_GetCollectible(play, 0x1E)) { return Randomizer_GetItemFromKnownCheck(RC_MARKET_TREASURE_CHEST_GAME_ITEM_4, GI_RUPEE_BLUE); } break; case 5: - if(!Flags_GetCollectible(globalCtx, 0x1F)) { + if(!Flags_GetCollectible(play, 0x1F)) { return Randomizer_GetItemFromKnownCheck(RC_MARKET_TREASURE_CHEST_GAME_ITEM_5, GI_RUPEE_RED); } break; @@ -6127,8 +6127,8 @@ GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, GlobalContext* glob return (GetItemEntry)GET_ITEM_NONE; } -s16 GetChestGameRandoGiDrawId(s8 room, s16 ogDrawId, GlobalContext* globalCtx) { - GetItemEntry randoGetItem = GetChestGameRandoGetItem(room, ogDrawId, globalCtx); +s16 GetChestGameRandoGiDrawId(s8 room, s16 ogDrawId, PlayState* play) { + GetItemEntry randoGetItem = GetChestGameRandoGetItem(room, ogDrawId, play); if (randoGetItem.itemId != ITEM_NONE) { return randoGetItem.gid; diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c index e8721fdfb..0b0025927 100644 --- a/soh/src/code/z_bgcheck.c +++ b/soh/src/code/z_bgcheck.c @@ -95,7 +95,7 @@ void DynaSSNodeList_SetSSListHead(DynaSSNodeList* nodeList, SSList* ssList, s16* /** * Initialize DynaSSNodeList */ -void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeList) { +void DynaSSNodeList_Initialize(PlayState* play, DynaSSNodeList* nodeList) { nodeList->tbl = NULL; nodeList->count = 0; } @@ -103,8 +103,8 @@ void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeLis /** * Initialize DynaSSNodeList tbl */ -void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* nodeList, s32 max) { - nodeList->tbl = THA_AllocEndAlign(&globalCtx->state.tha, max * sizeof(SSNode), -2); +void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* nodeList, s32 max) { + nodeList->tbl = THA_AllocEndAlign(&play->state.tha, max * sizeof(SSNode), -2); ASSERT(nodeList->tbl != NULL); @@ -1355,7 +1355,7 @@ s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* pol * Initialize StaticLookup Table * returns size of table, in bytes */ -u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, StaticLookup* lookupTbl) { +u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl) { Vec3s* vtxList; CollisionPoly* polyList; s32 polyMax; @@ -1438,7 +1438,7 @@ u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* glob /** * Is current scene a SPOT scene */ -s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) { +s32 BgCheck_IsSpotScene(PlayState* play) { static s16 spotScenes[] = { SCENE_SPOT00, SCENE_SPOT01, SCENE_SPOT02, SCENE_SPOT03, SCENE_SPOT04, SCENE_SPOT05, SCENE_SPOT06, SCENE_SPOT07, SCENE_SPOT08, SCENE_SPOT09, SCENE_SPOT10, SCENE_SPOT11, SCENE_SPOT12, SCENE_SPOT13, @@ -1447,7 +1447,7 @@ s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) { s16* i; for (i = spotScenes; i < spotScenes + ARRAY_COUNT(spotScenes); i++) { - if (globalCtx->sceneNum == *i) { + if (play->sceneNum == *i) { return true; } } @@ -1501,7 +1501,7 @@ typedef struct { /** * Allocate CollisionContext */ -void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader) { +void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader) { static BgCheckSceneSubdivisionEntry sceneSubdivisionList[] = { { SCENE_HAKADAN, { 23, 7, 14 }, -1 }, { SCENE_BMORI1, { 38, 1, 38 }, -1 }, @@ -1522,7 +1522,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis osSyncPrintf("/*---------------- BGCheck バッファーメモリサイズ -------------*/\n"); if (YREG(15) == 0x10 || YREG(15) == 0x20 || YREG(15) == 0x30 || YREG(15) == 0x40) { - if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + if (play->sceneNum == SCENE_MALON_STABLE) { // "/* BGCheck LonLon Size %dbyte */\n" osSyncPrintf("/* BGCheck LonLonサイズ %dbyte */\n", 0x3520); colCtx->memSize = 0x3520; @@ -1537,7 +1537,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis colCtx->subdivAmount.x = 2; colCtx->subdivAmount.y = 2; colCtx->subdivAmount.z = 2; - } else if (BgCheck_IsSpotScene(globalCtx) == true) { + } else if (BgCheck_IsSpotScene(play) == true) { colCtx->memSize = 0xF000; // "/* BGCheck Spot Size %dbyte */\n" osSyncPrintf("/* BGCheck Spot用サイズ %dbyte */\n", 0xF000); @@ -1548,7 +1548,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis colCtx->subdivAmount.y = 4; colCtx->subdivAmount.z = 16; } else { - if (BgCheck_TryGetCustomMemsize(globalCtx->sceneNum, &customMemSize)) { + if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) { colCtx->memSize = customMemSize; } else { colCtx->memSize = 0x1CC00; @@ -1561,7 +1561,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis useCustomSubdivisions = false; for (i = 0; i < ARRAY_COUNT(sceneSubdivisionList); i++) { - if (globalCtx->sceneNum == sceneSubdivisionList[i].sceneId) { + if (play->sceneNum == sceneSubdivisionList[i].sceneId) { colCtx->subdivAmount.x = sceneSubdivisionList[i].subdivAmount.x; colCtx->subdivAmount.y = sceneSubdivisionList[i].subdivAmount.y; colCtx->subdivAmount.z = sceneSubdivisionList[i].subdivAmount.z; @@ -1576,7 +1576,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis } } colCtx->lookupTbl = THA_AllocEndAlign( - &globalCtx->state.tha, + &play->state.tha, colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1); if (colCtx->lookupTbl == NULL) { LOG_HUNGUP_THREAD(); @@ -1624,15 +1624,15 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis } SSNodeList_Initialize(&colCtx->polyNodes); - SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons); + SSNodeList_Alloc(play, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons); - lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, globalCtx, colCtx->lookupTbl); + lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, play, colCtx->lookupTbl); osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("/*---結局 BG使用サイズ %dbyte---*/\n", memSize + lookupTblMemSize); osSyncPrintf(VT_RST); - DynaPoly_Init(globalCtx, &colCtx->dyna); - DynaPoly_Alloc(globalCtx, &colCtx->dyna); + DynaPoly_Init(play, &colCtx->dyna); + DynaPoly_Alloc(play, &colCtx->dyna); } /** @@ -1675,7 +1675,7 @@ s32 BgCheck_PosInStaticBoundingBox(CollisionContext* colCtx, Vec3f* pos) { * returns the yIntersect of the nearest poly found directly below `pos`, or BGCHECK_Y_MIN if no floor detected * returns the poly found in `outPoly`, and the bgId of the entity in `outBgId` */ -f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, +f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 chkDist) { f32 yIntersectDyna; @@ -1720,7 +1720,7 @@ f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, dynaRaycast.actor = actor; dynaRaycast.unk_20 = arg7; dynaRaycast.chkDist = chkDist; - dynaRaycast.globalCtx = globalCtx; + dynaRaycast.play = play; dynaRaycast.resultPoly = outPoly; dynaRaycast.bgId = outBgId; @@ -1760,11 +1760,11 @@ 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, +f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos) { s32 bgId; - return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f); + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f); } /** @@ -1788,9 +1788,9 @@ f32 BgCheck_EntityRaycastFloor4(CollisionContext* colCtx, CollisionPoly** outPol * Public raycast toward floor * returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected */ -f32 BgCheck_EntityRaycastFloor5(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, +f32 BgCheck_EntityRaycastFloor5(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos) { - return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f); + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f); } /** @@ -2441,14 +2441,14 @@ void SSNodeList_Initialize(SSNodeList* this) { * tblMax is the number of SSNode records to allocate * numPolys is the number of polygons defined within the CollisionHeader */ -void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s32 numPolys) { +void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) { this->max = tblMax; this->count = 0; - this->tbl = THA_AllocEndAlign(&globalCtx->state.tha, tblMax * sizeof(SSNode), -2); + this->tbl = THA_AllocEndAlign(&play->state.tha, tblMax * sizeof(SSNode), -2); ASSERT(this->tbl != NULL); - this->polyCheckTbl = GAMESTATE_ALLOC_MC(&globalCtx->state, numPolys); + this->polyCheckTbl = GAMESTATE_ALLOC_MC(&play->state, numPolys); ASSERT(this->polyCheckTbl != NULL); } @@ -2534,7 +2534,7 @@ void DynaLookup_ResetVtxStartIndex(u16* vtxStartIndex) { /** * Initialize BgActor */ -void BgActor_Initialize(GlobalContext* globalCtx, BgActor* bgActor) { +void BgActor_Initialize(PlayState* play, BgActor* bgActor) { bgActor->actor = NULL; bgActor->colHeader = NULL; ScaleRotPos_Initialize(&bgActor->prevTransform); @@ -2577,8 +2577,8 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) { /** * Allocate dyna.polyList */ -void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys) { - *polyList = THA_AllocEndAlign(&globalCtx->state.tha, numPolys * sizeof(CollisionPoly), -2); +void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) { + *polyList = THA_AllocEndAlign(&play->state.tha, numPolys * sizeof(CollisionPoly), -2); ASSERT(*polyList != NULL); } @@ -2592,15 +2592,15 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) { /** * Allocate dyna.vtxList */ -void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx) { - *vtxList = THA_AllocEndAlign(&globalCtx->state.tha, numVtx * sizeof(Vec3s), -2); +void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) { + *vtxList = THA_AllocEndAlign(&play->state.tha, numVtx * sizeof(Vec3s), -2); ASSERT(*vtxList != NULL); } /** * Update BgActor's prevTransform */ -void DynaPoly_SetBgActorPrevTransform(GlobalContext* globalCtx, BgActor* bgActor) { +void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor) { bgActor->prevTransform = bgActor->curTransform; } @@ -2617,38 +2617,38 @@ s32 DynaPoly_IsBgIdBgActor(s32 bgId) { /** * Init DynaCollisionContext */ -void DynaPoly_Init(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_Init(PlayState* play, DynaCollisionContext* dyna) { dyna->bitFlag = DYNAPOLY_INVALIDATE_LOOKUP; DynaPoly_NullPolyList(&dyna->polyList); DynaPoly_NullVtxList(&dyna->vtxList); - DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes); + DynaSSNodeList_Initialize(play, &dyna->polyNodes); } /** * Set DynaCollisionContext */ -void DynaPoly_Alloc(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_Alloc(PlayState* play, DynaCollisionContext* dyna) { s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { - BgActor_Initialize(globalCtx, &dyna->bgActors[i]); + BgActor_Initialize(play, &dyna->bgActors[i]); dyna->bgActorFlags[i] = 0; } DynaPoly_NullPolyList(&dyna->polyList); - DynaPoly_AllocPolyList(globalCtx, &dyna->polyList, dyna->polyListMax); + DynaPoly_AllocPolyList(play, &dyna->polyList, dyna->polyListMax); DynaPoly_NullVtxList(&dyna->vtxList); - DynaPoly_AllocVtxList(globalCtx, &dyna->vtxList, dyna->vtxListMax); + DynaPoly_AllocVtxList(play, &dyna->vtxList, dyna->vtxListMax); - DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes); - DynaSSNodeList_Alloc(globalCtx, &dyna->polyNodes, dyna->polyNodesMax); + DynaSSNodeList_Initialize(play, &dyna->polyNodes); + DynaSSNodeList_Alloc(play, &dyna->polyNodes, dyna->polyNodesMax); } /** * Set BgActor * original name: DynaPolyInfo_setActor */ -s32 DynaPoly_SetBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor, +s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader) { s32 bgId; s32 foundSlot = false; @@ -2690,28 +2690,28 @@ DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId) { return (DynaPolyActor*)colCtx->dyna.bgActors[bgId].actor; } -void func_8003EBF8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003EBF8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] |= 4; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_8003EC50(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003EC50(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] &= ~4; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_8003ECA8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003ECA8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] |= 8; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_8003ED00(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003ED00(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] &= ~8; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; @@ -2721,7 +2721,7 @@ void func_8003ED00(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgI /** * original name: DynaPolyInfo_delReserve */ -void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { DynaPolyActor* actor; osSyncPrintf(VT_FGCOL(GREEN)); @@ -2746,7 +2746,7 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna return; } } - actor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + actor = DynaPoly_GetActor(&play->colCtx, bgId); if (actor != NULL) { actor->bgId = BGACTOR_NEG_ONE; @@ -2755,14 +2755,14 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna } } -void func_8003EE6C(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void func_8003EE6C(PlayState* play, DynaCollisionContext* dyna) { dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } /** * original name: DynaPolyInfo_expandSRT */ -void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, +void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex) { MtxF mtx; Actor* actor; @@ -2941,13 +2941,13 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 } } -void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor) { +void func_8003F8EC(PlayState* play, DynaCollisionContext* dyna, Actor* actor) { DynaPolyActor* dynaActor; s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { if ((dyna->bgActorFlags[i] & 1)) { - dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, i); + dynaActor = DynaPoly_GetActor(&play->colCtx, i); if (dynaActor != NULL && &dynaActor->actor == actor) { func_800434A0((DynaPolyActor*)actor); return; @@ -2959,7 +2959,7 @@ void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* /** * DynaPolyInfo_setup */ -void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) { DynaPolyActor* actor; s32 vtxStartIndex; s32 polyStartIndex; @@ -2979,7 +2979,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { osSyncPrintf(VT_RST); dyna->bgActorFlags[i] = 0; - BgActor_Initialize(globalCtx, &dyna->bgActors[i]); + BgActor_Initialize(play, &dyna->bgActors[i]); dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } if (dyna->bgActors[i].actor != NULL && dyna->bgActors[i].actor->update == NULL) { @@ -2987,14 +2987,14 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("DynaPolyInfo_setup():削除 index=%d\n", i); osSyncPrintf(VT_RST); - actor = DynaPoly_GetActor(&globalCtx->colCtx, i); + actor = DynaPoly_GetActor(&play->colCtx, i); if (actor == NULL) { return; } actor->bgId = BGACTOR_NEG_ONE; dyna->bgActorFlags[i] = 0; - BgActor_Initialize(globalCtx, &dyna->bgActors[i]); + BgActor_Initialize(play, &dyna->bgActors[i]); dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } @@ -3002,7 +3002,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { polyStartIndex = 0; for (i = 0; i < BG_ACTOR_MAX; i++) { if (dyna->bgActorFlags[i] & 1) { - DynaPoly_ExpandSRT(globalCtx, dyna, i, &vtxStartIndex, &polyStartIndex); + DynaPoly_ExpandSRT(play, dyna, i, &vtxStartIndex, &polyStartIndex); } } dyna->bitFlag &= ~DYNAPOLY_INVALIDATE_LOOKUP; @@ -3011,12 +3011,12 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { /** * Update all BgActor's previous ScaleRotPos */ -void DynaPoly_UpdateBgActorTransforms(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna) { s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { if (dyna->bgActorFlags[i] & 1) { - DynaPoly_SetBgActorPrevTransform(globalCtx, &dyna->bgActors[i]); + DynaPoly_SetBgActorPrevTransform(play, &dyna->bgActors[i]); } } } @@ -3155,10 +3155,10 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) { } dynaActor = DynaPoly_GetActor(dynaRaycast->colCtx, *dynaRaycast->bgId); - if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->globalCtx != NULL)) { - pauseState = dynaRaycast->globalCtx->pauseCtx.state != 0; + if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->play != NULL)) { + pauseState = dynaRaycast->play->pauseCtx.state != 0; if (pauseState == 0) { - pauseState = dynaRaycast->globalCtx->pauseCtx.debugState != 0; + pauseState = dynaRaycast->play->pauseCtx.debugState != 0; } if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & 2)) { curTransform = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].curTransform; @@ -3820,7 +3820,7 @@ void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest) /** * SEGMENT_TO_VIRTUAL all active BgActor CollisionHeaders */ -void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) { +void func_800418D0(CollisionContext* colCtx, PlayState* play) { DynaCollisionContext* dyna = &colCtx->dyna; s32 i; u16 flag; @@ -3828,7 +3828,7 @@ void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) { for (i = 0; i < BG_ACTOR_MAX; i++) { flag = dyna->bgActorFlags[i]; if ((flag & 1) && !(flag & 2)) { - Actor_SetObjectDependency(globalCtx, dyna->bgActors[i].actor); + Actor_SetObjectDependency(play, dyna->bgActors[i].actor); CollisionHeader_SegmentedToVirtual(dyna->bgActors[i].colHeader); } } @@ -4205,9 +4205,9 @@ f32 zdWaterBoxMaxZ = -967.0f; * returns true if point is within the xz boundaries of an active water box, else false * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ -s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { - if (globalCtx->sceneNum == SCENE_SPOT07) { + if (play->sceneNum == SCENE_SPOT07) { if (zdWaterBoxMinX < x && x < zdWaterBoxMaxX && zdWaterBoxMinY < *ySurface && *ySurface < zdWaterBoxMaxY && zdWaterBoxMinZ < z && z < zdWaterBoxMaxZ) { *outWaterBox = &zdWaterBox; @@ -4215,7 +4215,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 return true; } } - return WaterBox_GetSurfaceImpl(globalCtx, colCtx, x, z, ySurface, outWaterBox); + return WaterBox_GetSurfaceImpl(play, colCtx, x, z, ySurface, outWaterBox); } /** @@ -4223,7 +4223,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 * returns true if point is within the xz boundaries of an active water box, else false * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ -s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; u32 room; @@ -4236,7 +4236,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = (curWaterBox->properties >> 13) & 0x3F; - if (room == (u32)globalCtx->roomCtx.curRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) { if ((curWaterBox->properties & 0x80000) == 0) { if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) { if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) { @@ -4257,7 +4257,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, * returns the index of the waterbox found, or -1 if no waterbox is found * `outWaterBox` returns the pointer to the waterbox found, or NULL if none is found */ -s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, +s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; s32 room; @@ -4274,7 +4274,7 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec waterBox = &colHeader->waterBoxes[i]; room = WATERBOX_ROOM(waterBox->properties); - if (!(room == globalCtx->roomCtx.curRoom.num || room == 0x3F)) { + if (!(room == play->roomCtx.curRoom.num || room == 0x3F)) { continue; } if ((waterBox->properties & 0x80000)) { @@ -4334,7 +4334,7 @@ u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox) * returns true if point is within the xz boundaries of an active water box, else false * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ -s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; u32 room; @@ -4347,7 +4347,7 @@ s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = (curWaterBox->properties >> 0xD) & 0x3F; - if ((room == (u32)globalCtx->roomCtx.curRoom.num) || (room == 0x3F)) { + if ((room == (u32)play->roomCtx.curRoom.num) || (room == 0x3F)) { if ((curWaterBox->properties & 0x80000) != 0) { if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) { if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) { @@ -4403,7 +4403,7 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec /** * Draw a list of dyna polys, specified by `ssList` */ -void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, DynaCollisionContext* dyna, +void BgCheck_DrawDynaPolyList(PlayState* play, CollisionContext* colCtx, DynaCollisionContext* dyna, SSList* ssList, u8 r, u8 g, u8 b) { s16 curPolyId; CollisionPoly* poly; @@ -4437,7 +4437,7 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx vC.y += AREG(26) * ny; vC.z += AREG(26) * nz; } - Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b); + Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b); if (curNode->next == SS_NULL) { break; } @@ -4450,17 +4450,17 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx * Draw a BgActor's dyna polys * `bgId` is the BgActor index that should be drawn */ -void BgCheck_DrawBgActor(GlobalContext* globalCtx, CollisionContext* colCtx, s32 bgId) { +void BgCheck_DrawBgActor(PlayState* play, CollisionContext* colCtx, s32 bgId) { if (AREG(21)) { - BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255, + BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255, 0, 0); } if (AREG(22)) { - BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255, + BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255, 0); } if (AREG(23)) { - BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0, + BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0, 255); } } @@ -4468,7 +4468,7 @@ void BgCheck_DrawBgActor(GlobalContext* globalCtx, CollisionContext* colCtx, s32 /** * Draw all dyna polys */ -void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCtx) { +void BgCheck_DrawDynaCollision(PlayState* play, CollisionContext* colCtx) { s32 bgId; for (bgId = 0; bgId < BG_ACTOR_MAX; bgId++) { @@ -4476,14 +4476,14 @@ void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCt if (!(colCtx->dyna.bgActorFlags[bgId] & 1)) { continue; } - BgCheck_DrawBgActor(globalCtx, colCtx, bgId); + BgCheck_DrawBgActor(play, colCtx, bgId); } } /** * Draw a static poly */ -void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) { +void BgCheck_DrawStaticPoly(PlayState* play, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) { Vec3f vA; Vec3f vB; Vec3f vC; @@ -4508,13 +4508,13 @@ void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx, vC.y += AREG(26) * ny; vC.z += AREG(26) * nz; } - Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b); + Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b); } /** * Draw a list of static polys, specified by `ssList` */ -void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) { +void BgCheck_DrawStaticPolyList(PlayState* play, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) { SSNode* curNode; CollisionPoly* polyList = colCtx->colHeader->polyList; s16 curPolyId; @@ -4523,7 +4523,7 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC curNode = &colCtx->polyNodes.tbl[ssList->head]; while (true) { curPolyId = curNode->polyId; - BgCheck_DrawStaticPoly(globalCtx, colCtx, &polyList[curPolyId], r, g, b); + BgCheck_DrawStaticPoly(play, colCtx, &polyList[curPolyId], r, g, b); if (curNode->next == SS_NULL) { break; } @@ -4535,17 +4535,17 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC /** * Draw scene collision */ -void BgCheck_DrawStaticCollision(GlobalContext* globalCtx, CollisionContext* colCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgCheck_DrawStaticCollision(PlayState* play, CollisionContext* colCtx) { + Player* player = GET_PLAYER(play); StaticLookup* lookup = BgCheck_GetNearestStaticLookup(colCtx, colCtx->lookupTbl, &player->actor.world.pos); if (AREG(23) != 0) { - BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->floor, 0, 0, 255); + BgCheck_DrawStaticPolyList(play, colCtx, &lookup->floor, 0, 0, 255); } if (AREG(22) != 0) { - BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->wall, 0, 255, 0); + BgCheck_DrawStaticPolyList(play, colCtx, &lookup->wall, 0, 255, 0); } if (AREG(21) != 0) { - BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->ceiling, 255, 0, 0); + BgCheck_DrawStaticPolyList(play, colCtx, &lookup->ceiling, 255, 0, 0); } } diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index c1003c6dd..a2147d97a 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -211,7 +211,7 @@ Vec3f* Camera_Vec3fTranslateByUnitVector(Vec3f* dest, Vec3f* src, Vec3f* unitVec * Detects the collision poly between `from` and `to`, places collision info in `to` */ s32 Camera_BGCheckInfo(Camera* camera, Vec3f* from, CamColChk* to) { - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; Vec3f toNewPos; Vec3f toPoint; Vec3f fromToNorm; @@ -274,7 +274,7 @@ s32 Camera_BGCheck(Camera* camera, Vec3f* from, Vec3f* to) { } s32 func_80043F94(Camera* camera, Vec3f* from, CamColChk* to) { - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; Vec3f toNewPos; Vec3f toPos; Vec3f fromToNorm; @@ -359,7 +359,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) { s32 pad2; s32 bgId; CollisionPoly* poly; - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; poly = NULL; if (BgCheck_CameraLineTest1(colCtx, from, to, &intersect, &poly, 1, 1, 1, 0, &bgId) && @@ -378,7 +378,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) { f32 Camera_GetFloorYNorm(Camera* camera, Vec3f* floorNorm, Vec3f* chkPos, s32* bgId) { s32 pad; CollisionPoly* floorPoly; - f32 floorY = BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, bgId, chkPos); + f32 floorY = BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, bgId, chkPos); if (floorY == BGCHECK_Y_MIN) { // no floor @@ -414,7 +414,7 @@ f32 Camera_GetFloorY(Camera* camera, Vec3f* pos) { */ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) { CollisionPoly* floorPoly; - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; f32 floorY; s32 i; @@ -449,14 +449,14 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) { * Returns the CameraSettingType of the camera at index `camDataIdx` */ s16 Camera_GetCamDataSetting(Camera* camera, s32 camDataIdx) { - return func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, BGCHECK_SCENE); + return func_80041A4C(&camera->play->colCtx, camDataIdx, BGCHECK_SCENE); } /** * Returns the scene camera info for the current camera data index */ Vec3s* Camera_GetCamBGData(Camera* camera) { - return func_80041C10(&camera->globalCtx->colCtx, camera->camDataIdx, BGCHECK_SCENE); + return func_80041C10(&camera->play->colCtx, camera->camDataIdx, BGCHECK_SCENE); } /** @@ -469,9 +469,9 @@ s32 Camera_GetDataIdxForPoly(Camera* camera, s32* bgId, CollisionPoly* poly) { s32 ret; Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); // unused. - camDataIdx = SurfaceType_GetCamDataIndex(&camera->globalCtx->colCtx, poly, *bgId); + camDataIdx = SurfaceType_GetCamDataIndex(&camera->play->colCtx, poly, *bgId); - if (func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) { + if (func_80041A4C(&camera->play->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) { ret = -1; } else { ret = camDataIdx; @@ -492,13 +492,13 @@ Vec3s* Camera_GetCamBgDataUnderPlayer(Camera* camera, u16* dataCnt) { Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor); playerPosShape.pos.y += Player_GetHeight(camera->player); - if (BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == + if (BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == BGCHECK_Y_MIN) { // no floor return NULL; } - *dataCnt = SurfaceType_GetNumCameras(&camera->globalCtx->colCtx, floorPoly, bgId); - return SurfaceType_GetCamPosData(&camera->globalCtx->colCtx, floorPoly, bgId); + *dataCnt = SurfaceType_GetNumCameras(&camera->play->colCtx, floorPoly, bgId); + return SurfaceType_GetCamPosData(&camera->play->colCtx, floorPoly, bgId); } /** @@ -515,7 +515,7 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) { Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor); *waterY = playerPosShape.pos.y; - if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, playerPosShape.pos.x, playerPosShape.pos.z, + if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, playerPosShape.pos.x, playerPosShape.pos.z, waterY, &waterBox)) { // player's position is not in a water box. *waterY = BGCHECK_Y_MIN; @@ -528,8 +528,8 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) { return -1; } - ret = WaterBox_GetCamDataIndex(&camera->globalCtx->colCtx, waterBox); - if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->globalCtx->colCtx, waterBox) <= 0)) { + ret = WaterBox_GetCamDataIndex(&camera->play->colCtx, waterBox); + if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->play->colCtx, waterBox) <= 0)) { // no camera data idx, or no CameraSettingType return -2; } @@ -550,7 +550,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) { Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); waterY = playerPosRot.pos.y; - if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, chkPos->x, chkPos->z, &waterY, + if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, chkPos->x, chkPos->z, &waterY, &waterBox)) { // chkPos is not within the x/z boundaries of a water box. return BGCHECK_Y_MIN; @@ -562,7 +562,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) { return BGCHECK_Y_MIN; } - *envProp = WaterBox_GetLightSettingIndex(&camera->globalCtx->colCtx, waterBox); + *envProp = WaterBox_GetLightSettingIndex(&camera->play->colCtx, waterBox); return waterY; } @@ -604,7 +604,7 @@ s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) { rotatedPos.x = playerPos.x + (sp30 * sinYaw); rotatedPos.y = playerPos.y; rotatedPos.z = playerPos.z + (sp30 * cosYaw); - if (arg2 || (camera->globalCtx->state.frames % 2) == 0) { + if (arg2 || (camera->play->state.frames % 2) == 0) { D_8015CE58.pos.x = playerPos.x + (sp2C * sinYaw); D_8015CE58.pos.y = playerPos.y; D_8015CE58.pos.z = playerPos.z + (sp2C * cosYaw); @@ -1419,17 +1419,17 @@ s32 SetCameraManual(Camera* camera) { f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f; f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f; - if ((fabsf(newCamX) >= 15.0f || fabsf(newCamY) >= 15.0f) && camera->globalCtx->manualCamera == false) { - camera->globalCtx->manualCamera = true; + if ((fabsf(newCamX) >= 15.0f || fabsf(newCamY) >= 15.0f) && camera->play->manualCamera == false) { + camera->play->manualCamera = true; VecSph eyeAdjustment; OLib_Vec3fDiffToVecSphGeo(&eyeAdjustment, &camera->at, &camera->eye); - camera->globalCtx->camX = eyeAdjustment.yaw; - camera->globalCtx->camY = eyeAdjustment.pitch; + camera->play->camX = eyeAdjustment.yaw; + camera->play->camY = eyeAdjustment.pitch; } - if (camera->globalCtx->manualCamera) { + if (camera->play->manualCamera) { return 1; } @@ -1458,8 +1458,8 @@ s32 Camera_Free(Camera* camera) { if (RELOAD_PARAMS) { OLib_Vec3fDiffToVecSphGeo(&spA8, &camera->at, &camera->eye); - camera->globalCtx->camX = spA8.yaw; - camera->globalCtx->camY = spA8.pitch; + camera->play->camX = spA8.yaw; + camera->play->camY = spA8.pitch; CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight)); @@ -1488,22 +1488,22 @@ s32 Camera_Free(Camera* camera) { f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVar_GetFloat("gCameraSensitivity", 1.0f)); f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVar_GetFloat("gCameraSensitivity", 1.0f)); - camera->globalCtx->camX += newCamX * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1); - camera->globalCtx->camY += newCamY * (CVar_GetS32("gInvertYAxis", 1) ? 1 : -1); + camera->play->camX += newCamX * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1); + camera->play->camY += newCamY * (CVar_GetS32("gInvertYAxis", 1) ? 1 : -1); - if (camera->globalCtx->camY > 0x32A4) { - camera->globalCtx->camY = 0x32A4; + if (camera->play->camY > 0x32A4) { + camera->play->camY = 0x32A4; } - if (camera->globalCtx->camY < -0x228C) { - camera->globalCtx->camY = -0x228C; + if (camera->play->camY < -0x228C) { + camera->play->camY = -0x228C; } camera->dist = Camera_LERPCeilF(para1->distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, 0.0f); OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext); spA8.r = camera->dist; - spA8.yaw = camera->globalCtx->camX; - spA8.pitch = camera->globalCtx->camY; + spA8.yaw = camera->play->camX; + spA8.pitch = camera->play->camY; Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8); if (camera->status == CAM_STAT_ACTIVE) { @@ -1733,7 +1733,7 @@ s32 Camera_Normal1(Camera* camera) { // crit wiggle if(!CVar_GetS32("gDisableCritWiggle",0)) { - if (gSaveContext.health <= 16 && ((camera->globalCtx->state.frames % 256) == 0)) { + if (gSaveContext.health <= 16 && ((camera->play->state.frames % 256) == 0)) { wiggleAdj = Rand_ZeroOne() * 10000.0f; camera->inputDir.y = wiggleAdj + camera->inputDir.y; } @@ -1903,7 +1903,7 @@ s32 Camera_Normal2(Camera* camera) { if (camera->status == CAM_STAT_ACTIVE) { bgChk.pos = *eyeNext; - if (!camera->globalCtx->envCtx.skyboxDisabled || norm2->interfaceFlags & 0x10) { + if (!camera->play->envCtx.skyboxDisabled || norm2->interfaceFlags & 0x10) { Camera_BGCheckInfo(camera, at, &bgChk); *eye = bgChk.pos; } else { @@ -2123,7 +2123,7 @@ s32 Camera_Parallel1(Camera* camera) { OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye); OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext); - camera->globalCtx->manualCamera = false; + camera->play->manualCamera = false; switch (camera->animState) { case 0: @@ -2241,7 +2241,7 @@ s32 Camera_Parallel1(Camera* camera) { Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8); if (camera->status == CAM_STAT_ACTIVE) { sp6C.pos = *eyeNext; - if (!camera->globalCtx->envCtx.skyboxDisabled || para1->interfaceFlags & 0x10) { + if (!camera->play->envCtx.skyboxDisabled || para1->interfaceFlags & 0x10) { Camera_BGCheckInfo(camera, at, &sp6C); *eye = sp6C.pos; } else { @@ -3051,7 +3051,7 @@ s32 Camera_Battle1(Camera* camera) { Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spB4); spBC.pos = *eyeNext; if (camera->status == CAM_STAT_ACTIVE) { - if (!camera->globalCtx->envCtx.skyboxDisabled || batt1->flags & 1) { + if (!camera->play->envCtx.skyboxDisabled || batt1->flags & 1) { Camera_BGCheckInfo(camera, at, &spBC); } else if (batt1->flags & 2) { func_80043F94(camera, at, &spBC); @@ -3382,7 +3382,7 @@ s32 Camera_KeepOn1(Camera* camera) { Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spD8); sp8C.pos = *eyeNext; if (camera->status == CAM_STAT_ACTIVE) { - if (!camera->globalCtx->envCtx.skyboxDisabled || keep1->interfaceFlags & 1) { + if (!camera->play->envCtx.skyboxDisabled || keep1->interfaceFlags & 1) { Camera_BGCheckInfo(camera, at, &sp8C); } else if (keep1->interfaceFlags & 2) { func_80043F94(camera, at, &sp8C); @@ -3448,9 +3448,9 @@ s32 Camera_KeepOn3(Camera* camera) { return 1; } if (camera->animState == 0 || camera->animState == 0xA || camera->animState == 0x14) { - if (camera->globalCtx->view.unk_124 == 0) { + if (camera->play->view.unk_124 == 0) { camera->unk_14C |= 0x20; - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + camera->play->view.unk_124 = camera->thisIdx | 0x50; return 1; } camera->unk_14C &= ~0x20; @@ -3538,7 +3538,7 @@ s32 Camera_KeepOn3(Camera* camera) { Camera_Vec3fVecSphGeoAdd(&lineChkPointB, &anim->atTarget, &atToEyeAdj); if (!(keep3->flags & 0x80)) { while (i < angleCnt) { - if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &anim->atTarget, + if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &anim->atTarget, &lineChkPointB, colChkActors, 2) && !Camera_BGCheck(camera, &anim->atTarget, &lineChkPointB)) { break; @@ -3622,15 +3622,15 @@ s32 Camera_KeepOn4(Camera* camera) { KeepOn4_Unk20* unk20 = &keep4->unk_20; s32 pad; f32 playerHeight; - Player* player = GET_PLAYER(camera->globalCtx); + Player* player = GET_PLAYER(camera->play); s16 angleCnt; s32 i; if (camera->animState == 0 || camera->animState == 0xA || camera->animState == 0x14) { - if (camera->globalCtx->view.unk_124 == 0) { + if (camera->play->view.unk_124 == 0) { camera->unk_14C |= 0x20; camera->unk_14C &= ~(0x4 | 0x2); - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + camera->play->view.unk_124 = camera->thisIdx | 0x50; return 1; } unk20->unk_14 = *temp_s0; @@ -3643,7 +3643,7 @@ s32 Camera_KeepOn4(Camera* camera) { camera->animState = 0x14; camera->unk_14C |= 0x20; camera->unk_14C &= ~(0x4 | 0x2); - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + camera->play->view.unk_124 = camera->thisIdx | 0x50; return 1; } @@ -3761,7 +3761,7 @@ s32 Camera_KeepOn4(Camera* camera) { OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext); D_8015BD50 = playerPosRot->pos; D_8015BD50.y += playerHeight; - temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->globalCtx->colCtx, &spC0, &i, &D_8015BD50); + temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->play->colCtx, &spC0, &i, &D_8015BD50); if (temp_f0_2 > (keep4->unk_00 + D_8015BD50.y)) { D_8015BD50.y = temp_f0_2 + 10.0f; } else { @@ -3821,7 +3821,7 @@ s32 Camera_KeepOn4(Camera* camera) { if (!(keep4->unk_1C & 1)) { angleCnt = ARRAY_COUNT(D_8011D3B0); for (i = 0; i < angleCnt; i++) { - if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &D_8015BD50, + if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &D_8015BD50, &D_8015BD70, spCC, sp9C) && !Camera_BGCheck(camera, &D_8015BD50, &D_8015BD70)) { break; @@ -4303,8 +4303,8 @@ s32 Camera_Subj3(Camera* camera) { Actor_GetFocus(&sp60, &camera->player->actor); playerHeight = Player_GetHeight(camera->player); - if (camera->globalCtx->view.unk_124 == 0) { - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + if (camera->play->view.unk_124 == 0) { + camera->play->view.unk_124 = camera->thisIdx | 0x50; return true; } @@ -4364,7 +4364,7 @@ s32 Camera_Subj3(Camera* camera) { *eye = *eyeNext; anim->animTimer--; - if (!camera->globalCtx->envCtx.skyboxDisabled) { + if (!camera->play->envCtx.skyboxDisabled) { Camera_BGCheck(camera, at, eye); } else { func_80044340(camera, at, eye); @@ -4430,8 +4430,8 @@ s32 Camera_Subj4(Camera* camera) { Camera_CopyPREGToModeValues(camera); } - if (camera->globalCtx->view.unk_124 == 0) { - camera->globalCtx->view.unk_124 = (camera->thisIdx | 0x50); + if (camera->play->view.unk_124 == 0) { + camera->play->view.unk_124 = (camera->thisIdx | 0x50); anim->unk_24 = camera->xzSpeed; return true; } @@ -5223,11 +5223,11 @@ s32 Camera_Unique9(Camera* camera) { } else if ((anim->curKeyFrame->unk_01 & 0xF0) == 0xC0) { Camera_UpdateInterface(0xF000 | ((anim->curKeyFrame->unk_01 & 0xF) << 8)); } else if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) { - func_8002DF38(camera->globalCtx, camera->target, 8); + func_8002DF38(camera->play, camera->target, 8); osSyncPrintf("camera: demo: player demo set WAIT\n"); } else { osSyncPrintf("camera: demo: player demo set %d\n", anim->curKeyFrame->unk_01); - func_8002DF38(camera->globalCtx, camera->target, anim->curKeyFrame->unk_01); + func_8002DF38(camera->play, camera->target, anim->curKeyFrame->unk_01); } } } else { @@ -5246,9 +5246,9 @@ s32 Camera_Unique9(Camera* camera) { anim->atTarget = anim->curKeyFrame->atTargetInit; } else if (atInitFlags == 2) { if (anim->isNewKeyFrame) { - anim->atTarget.x = camera->globalCtx->view.lookAt.x + anim->curKeyFrame->atTargetInit.x; - anim->atTarget.y = camera->globalCtx->view.lookAt.y + anim->curKeyFrame->atTargetInit.y; - anim->atTarget.z = camera->globalCtx->view.lookAt.z + anim->curKeyFrame->atTargetInit.z; + anim->atTarget.x = camera->play->view.lookAt.x + anim->curKeyFrame->atTargetInit.x; + anim->atTarget.y = camera->play->view.lookAt.y + anim->curKeyFrame->atTargetInit.y; + anim->atTarget.z = camera->play->view.lookAt.z + anim->curKeyFrame->atTargetInit.z; } } else if (atInitFlags == 3) { if (anim->isNewKeyFrame) { @@ -5328,9 +5328,9 @@ s32 Camera_Unique9(Camera* camera) { anim->eyeTarget = anim->curKeyFrame->eyeTargetInit; } else if (eyeInitFlags == 0x200) { if (anim->isNewKeyFrame) { - anim->eyeTarget.x = camera->globalCtx->view.eye.x + anim->curKeyFrame->eyeTargetInit.x; - anim->eyeTarget.y = camera->globalCtx->view.eye.y + anim->curKeyFrame->eyeTargetInit.y; - anim->eyeTarget.z = camera->globalCtx->view.eye.z + anim->curKeyFrame->eyeTargetInit.z; + anim->eyeTarget.x = camera->play->view.eye.x + anim->curKeyFrame->eyeTargetInit.x; + anim->eyeTarget.y = camera->play->view.eye.y + anim->curKeyFrame->eyeTargetInit.y; + anim->eyeTarget.z = camera->play->view.eye.z + anim->curKeyFrame->eyeTargetInit.z; } } else if (eyeInitFlags == 0x300) { if (anim->isNewKeyFrame) { @@ -5417,7 +5417,7 @@ s32 Camera_Unique9(Camera* camera) { } if (anim->curKeyFrame->initFlags == 2) { - anim->fovTarget = camera->globalCtx->view.fovy; + anim->fovTarget = camera->play->view.fovy; anim->rollTarget = 0; } else if (anim->curKeyFrame->initFlags == 0) { anim->fovTarget = camera->fov; @@ -5571,12 +5571,12 @@ s32 Camera_Unique9(Camera* camera) { // Change the parent camera (or default)'s mode to normal s32 camIdx = camera->parentCamIdx <= SUBCAM_NONE ? MAIN_CAM : camera->parentCamIdx; - Camera_ChangeModeFlags(camera->globalCtx->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1); + Camera_ChangeModeFlags(camera->play->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1); } case 18: { // copy the current camera to the parent (or default)'s camera. s32 camIdx = camera->parentCamIdx <= SUBCAM_NONE ? MAIN_CAM : camera->parentCamIdx; - Camera* cam = camera->globalCtx->cameraPtrs[camIdx]; + Camera* cam = camera->play->cameraPtrs[camIdx]; *eye = *eyeNext; Camera_Copy(cam, camera); @@ -5698,7 +5698,7 @@ s32 Camera_Demo1(Camera* camera) { camera->animState++; // "absolute" : "relative" osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n", - camera->globalCtx->state.frames, *relativeToPlayer == 0 ? "絶対" : "相対"); + camera->play->state.frames, *relativeToPlayer == 0 ? "絶対" : "相対"); if (PREG(93)) { Camera_DebugPrintSplineArray("CENTER", 5, csAtPoints); @@ -5794,7 +5794,7 @@ s32 Camera_Demo3(Camera* camera) { sp68.x = anim->initialAt.x + (Math_SinS(angle) * 40.0f); sp68.y = anim->initialAt.y + 40.0f; sp68.z = anim->initialAt.z + (Math_CosS(angle) * 40.0f); - if (camera->globalCtx->state.frames & 1) { + if (camera->play->state.frames & 1) { angle -= 0x3FFF; anim->yawDir = 1; } else { @@ -5991,7 +5991,7 @@ s32 Camera_Demo5(Camera* camera) { Actor_GetFocus(&camera->targetPosRot, camera->target); OLib_Vec3fDiffToVecSphGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos); D_8011D3AC = camera->target->category; - Actor_GetScreenPos(camera->globalCtx, camera->target, &sp78.yaw, &sp78.pitch); + Actor_GetScreenPos(camera->play, camera->target, &sp78.yaw, &sp78.pitch); eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye); OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext); sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw; @@ -6087,7 +6087,7 @@ s32 Camera_Demo5(Camera* camera) { // the target is a door. D_8011D954[0].timerInit = camera->timer - 5; sp4A = 0; - if (!func_800C0D34(camera->globalCtx, camera->target, &sp4A)) { + if (!func_800C0D34(camera->play, camera->target, &sp4A)) { osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: attention demo: this door is dummy door!\n" VT_RST); if (ABS(playerTargetGeo.yaw - camera->target->shape.rot.y) >= 0x4000) { sp4A = camera->target->shape.rot.y; @@ -6140,7 +6140,7 @@ s32 Camera_Demo5(Camera* camera) { ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D9F4; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D9F4); if (camera->parentCamIdx != MAIN_CAM) { - if (camera->globalCtx->state.frames & 1) { + if (camera->play->state.frames & 1) { D_8011D9F4[0].rollTargetInit = -D_8011D9F4[0].rollTargetInit; D_8011D9F4[1].rollTargetInit = -D_8011D9F4[1].rollTargetInit; } @@ -6151,12 +6151,12 @@ s32 Camera_Demo5(Camera* camera) { } } - pad = sDemo5PrevSfxFrame - camera->globalCtx->state.frames; + pad = sDemo5PrevSfxFrame - camera->play->state.frames; if ((pad >= 0x33) || (pad < -0x32)) { func_80078884(camera->data1); } - sDemo5PrevSfxFrame = camera->globalCtx->state.frames; + sDemo5PrevSfxFrame = camera->play->state.frames; if (camera->player->stateFlags1 & 0x8000000 && (player->currentBoots != PLAYER_BOOTS_IRON)) { // swimming, and not iron boots @@ -6166,21 +6166,21 @@ s32 Camera_Demo5(Camera* camera) { } else { sp4A = playerhead.rot.y - playerTargetGeo.yaw; if (camera->target->category == ACTORCAT_PLAYER) { - pad = camera->globalCtx->state.frames - sDemo5PrevAction12Frame; + pad = camera->play->state.frames - sDemo5PrevAction12Frame; if (player->stateFlags1 & 0x800) { // holding object over head. - func_8002DF54(camera->globalCtx, camera->target, 8); + func_8002DF54(camera->play, camera->target, 8); } else if (ABS(pad) > 3000) { - func_8002DF54(camera->globalCtx, camera->target, 12); + func_8002DF54(camera->play, camera->target, 12); } else { - func_8002DF54(camera->globalCtx, camera->target, 69); + func_8002DF54(camera->play, camera->target, 69); } } else { - func_8002DF54(camera->globalCtx, camera->target, 1); + func_8002DF54(camera->play, camera->target, 1); } } - sDemo5PrevAction12Frame = camera->globalCtx->state.frames; + sDemo5PrevAction12Frame = camera->play->state.frames; Camera_ChangeSettingFlags(camera, CAM_SET_CS_C, (4 | 1)); Camera_Unique9(camera); return true; @@ -6201,7 +6201,7 @@ s32 Camera_Demo6(Camera* camera) { s16 stateTimers[4]; Vec3f* at = &camera->at; - mainCam = Gameplay_GetCamera(camera->globalCtx, MAIN_CAM); + mainCam = Play_GetCamera(camera->play, MAIN_CAM); camFocus = camera->target; stateTimers[1] = 0x37; stateTimers[2] = 0x46; @@ -6235,7 +6235,7 @@ s32 Camera_Demo6(Camera* camera) { camera->animState++; case 1: if (stateTimers[camera->animState] < anim->animTimer) { - func_8002DF54(camera->globalCtx, &camera->player->actor, 8); + func_8002DF54(camera->play, &camera->player->actor, 8); Actor_GetWorld(&focusPosRot, camFocus); anim->atTarget.x = focusPosRot.pos.x; anim->atTarget.y = focusPosRot.pos.y - 20.0f; @@ -6306,7 +6306,7 @@ s32 Camera_Demo9(Camera* camera) { f32* camFOV = &camera->fov; Demo9Anim* anim = &demo9->anim; - mainCam = Gameplay_GetCamera(camera->globalCtx, MAIN_CAM); + mainCam = Play_GetCamera(camera->play, MAIN_CAM); mainCamPlayerPosRot = &mainCam->playerPosRot; if (RELOAD_PARAMS) { values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; @@ -6397,7 +6397,7 @@ s32 Camera_Demo9(Camera* camera) { // finish action = 0x2000, run OnePointCs 0x3FC (Dramatic Return to Link) onePointTimer = demo9OnePoint->onePointCs.initTimer < 50 ? 5 : demo9OnePoint->onePointCs.initTimer / 5; - OnePointCutscene_Init(camera->globalCtx, 1020, onePointTimer, NULL, camera->parentCamIdx); + OnePointCutscene_Init(camera->play, 1020, onePointTimer, NULL, camera->parentCamIdx); } } else { // finish action = 0x1000, copy the current camera's values to the @@ -6616,7 +6616,7 @@ s32 Camera_Special7(Camera* camera) { yOffset = Player_GetHeight(camera->player); if (camera->animState == 0) { - if (camera->globalCtx->sceneNum == SCENE_JYASINZOU) { + if (camera->play->sceneNum == SCENE_JYASINZOU) { // Spirit Temple spec7->idx = 3; } else if (playerPosRot->pos.x < 1500.0f) { @@ -6838,7 +6838,7 @@ s32 Camera_Special9(Camera* camera) { // 0xE38 ~ 20 degrees eyeAdjustment.pitch = 0xE38; // 0xAAA ~ 15 degrees. - yaw = 0xAAA * ((camera->globalCtx->state.frames & 1) ? 1 : -1); + yaw = 0xAAA * ((camera->play->state.frames & 1) ? 1 : -1); eyeAdjustment.yaw = anim->targetYaw + yaw; eyeAdjustment.r = 200.0f * yNormal; Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment); @@ -6909,12 +6909,12 @@ s32 Camera_Special9(Camera* camera) { return true; } -Camera* Camera_Create(View* view, CollisionContext* colCtx, GlobalContext* globalCtx) { +Camera* Camera_Create(View* view, CollisionContext* colCtx, PlayState* play) { Camera* newCamera = ZELDA_ARENA_MALLOC_DEBUG(sizeof(*newCamera)); if (newCamera != NULL) { osSyncPrintf(VT_FGCOL(BLUE) "camera: create --- allocate %d byte" VT_RST "\n", sizeof(*newCamera) * 4); - Camera_Init(newCamera, view, colCtx, globalCtx); + Camera_Init(newCamera, view, colCtx, play); } else { osSyncPrintf(VT_COL(RED, WHITE) "camera: create: not enough memory\n" VT_RST); } @@ -6930,7 +6930,7 @@ void Camera_Destroy(Camera* camera) { } } -void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalContext* globalCtx) { +void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play) { Camera* camP; s32 i; s16 curUID; @@ -6950,7 +6950,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon sInitRegs = false; PREG(88) = -1; } - camera->globalCtx = D_8015BD7C = globalCtx; + camera->play = D_8015BD7C = play; DbCamera_Init(&D_8015BD80, camera); curUID = sNextUID; sNextUID++; @@ -6960,7 +6960,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon } for (j = 0; j < NUM_CAMS; j++) { - camP = camera->globalCtx->cameraPtrs[j]; + camP = camera->play->cameraPtrs[j]; if (camP != NULL && curUID == camP->uid) { break; } @@ -7009,11 +7009,11 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon } void func_80057FC4(Camera* camera) { - if (camera != &camera->globalCtx->mainCamera) { + if (camera != &camera->play->mainCamera) { camera->prevSetting = camera->setting = CAM_SET_FREE0; camera->unk_14C &= ~0x4; - } else if (camera->globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) { - switch (camera->globalCtx->roomCtx.curRoom.behaviorType1) { + } else if (camera->play->roomCtx.curRoom.meshHeader->base.type != 1) { + switch (camera->play->roomCtx.curRoom.behaviorType1) { case ROOM_BEHAVIOR_TYPE1_1: Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10); camera->prevSetting = camera->setting = CAM_SET_DUNGEON0; @@ -7025,7 +7025,7 @@ void func_80057FC4(Camera* camera) { break; default: osSyncPrintf("camera: room type: default set etc (%d)\n", - camera->globalCtx->roomCtx.curRoom.behaviorType1); + camera->play->roomCtx.curRoom.behaviorType1); Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10); camera->prevSetting = camera->setting = CAM_SET_NORMAL0; camera->unk_14C |= 4; @@ -7088,7 +7088,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) { camera->waterPrevCamSetting = -1; camera->unk_14C |= 4; - if (camera == &camera->globalCtx->mainCamera) { + if (camera == &camera->play->mainCamera) { sCameraInterfaceFlags = 0xB200; } else { sCameraInterfaceFlags = 0; @@ -7142,13 +7142,13 @@ void Camera_PrintSettings(Camera* camera) { char sp48[8]; s32 i; - if ((OREG(0) & 1) && (camera->globalCtx->activeCamera == camera->thisIdx) && !gDbgCamEnabled) { + if ((OREG(0) & 1) && (camera->play->activeCamera == camera->thisIdx) && !gDbgCamEnabled) { for (i = 0; i < NUM_CAMS; i++) { - if (camera->globalCtx->cameraPtrs[i] == NULL) { + if (camera->play->cameraPtrs[i] == NULL) { sp58[i] = '-'; sp48[i] = ' '; } else { - switch (camera->globalCtx->cameraPtrs[i]->status) { + switch (camera->play->cameraPtrs[i]->status) { case 0: sp58[i] = 'c'; break; @@ -7174,7 +7174,7 @@ void Camera_PrintSettings(Camera* camera) { sp58[i] = '\0'; sp48[i] = '\0'; - sp48[camera->globalCtx->activeCamera] = 'a'; + sp48[camera->play->activeCamera] = 'a'; func_8006376C(3, 0x16, 5, sp58); func_8006376C(3, 0x16, 1, sp48); func_8006376C(3, 0x17, 5, "S:"); @@ -7288,7 +7288,7 @@ s32 Camera_UpdateWater(Camera* camera) { if (!(camera->unk_14C & 0x100)) { camera->unk_14C |= 0x100; osSyncPrintf("kankyo changed water, sound on\n"); - Environment_EnableUnderwaterLights(camera->globalCtx, waterLightsIndex); + Environment_EnableUnderwaterLights(camera->play, waterLightsIndex); camera->waterDistortionTimer = 80; } @@ -7311,7 +7311,7 @@ s32 Camera_UpdateWater(Camera* camera) { if (camera->waterDistortionTimer > 0) { camera->waterDistortionTimer--; camera->distortionFlags |= DISTORTION_UNDERWATER_STRONG; - } else if (camera->globalCtx->sceneNum == SCENE_TURIBORI) { + } else if (camera->play->sceneNum == SCENE_TURIBORI) { camera->distortionFlags |= DISTORTION_UNDERWATER_FISHING; } else { camera->distortionFlags |= DISTORTION_UNDERWATER_WEAK; @@ -7320,7 +7320,7 @@ s32 Camera_UpdateWater(Camera* camera) { if (camera->unk_14C & 0x100) { camera->unk_14C &= ~0x100; osSyncPrintf("kankyo changed water off, sound off\n"); - Environment_DisableUnderwaterLights(camera->globalCtx); + Environment_DisableUnderwaterLights(camera->play); if (*quakeId != 0) { Quake_RemoveFromIdx(*quakeId); } @@ -7334,7 +7334,7 @@ s32 Camera_UpdateWater(Camera* camera) { s32 Camera_UpdateHotRoom(Camera* camera) { camera->distortionFlags &= ~DISTORTION_HOT_ROOM; - if (camera->globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { + if (camera->play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { camera->distortionFlags |= DISTORTION_HOT_ROOM; } @@ -7344,7 +7344,7 @@ s32 Camera_UpdateHotRoom(Camera* camera) { s32 Camera_DbgChangeMode(Camera* camera) { s32 changeDir = 0; - if (!gDbgCamEnabled && camera->globalCtx->activeCamera == MAIN_CAM) { + if (!gDbgCamEnabled && camera->play->activeCamera == MAIN_CAM) { if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CUP)) { osSyncPrintf("attention sound URGENCY\n"); func_80078884(NA_SE_SY_ATTENTION_URGENCY); @@ -7440,17 +7440,17 @@ void Camera_UpdateDistortion(Camera* camera) { depthPhase += DEGF_TO_BINANG(depthPhaseStep); screenPlanePhase += DEGF_TO_BINANG(screenPlanePhaseStep); - View_SetDistortionOrientation(&camera->globalCtx->view, Math_CosS(depthPhase) * 0.0f, Math_SinS(depthPhase) * 0.0f, + View_SetDistortionOrientation(&camera->play->view, Math_CosS(depthPhase) * 0.0f, Math_SinS(depthPhase) * 0.0f, Math_SinS(screenPlanePhase) * 0.0f); - View_SetDistortionScale(&camera->globalCtx->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f, + View_SetDistortionScale(&camera->play->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f, Math_CosS(screenPlanePhase) * (yScale * scaleFactor) + 1.0f, Math_CosS(depthPhase) * (zScale * scaleFactor) + 1.0f); - View_SetDistortionSpeed(&camera->globalCtx->view, speed * speedFactor); + View_SetDistortionSpeed(&camera->play->view, speed * speedFactor); camera->unk_14C |= 0x40; } else if (camera->unk_14C & 0x40) { - View_ClearDistortion(&camera->globalCtx->view); + View_ClearDistortion(&camera->play->view); camera->unk_14C &= ~0x40; } } @@ -7471,7 +7471,7 @@ Vec3s Camera_Update(Camera* camera) { QuakeCamCalc quake; Player* player; - player = camera->globalCtx->cameraPtrs[MAIN_CAM]->player; + player = camera->play->cameraPtrs[MAIN_CAM]->player; if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: in %x\n", camera); @@ -7497,7 +7497,7 @@ Vec3s Camera_Update(Camera* camera) { spAC = curPlayerPosRot.pos; spAC.y += Player_GetHeight(camera->player); - playerGroundY = BgCheck_EntityRaycastFloor5(camera->globalCtx, &camera->globalCtx->colCtx, &playerFloorPoly, + playerGroundY = BgCheck_EntityRaycastFloor5(camera->play, &camera->play->colCtx, &playerFloorPoly, &bgId, &camera->player->actor, &spAC); if (playerGroundY != BGCHECK_Y_MIN) { // player is above ground. @@ -7581,10 +7581,10 @@ Vec3s Camera_Update(Camera* camera) { D_8011D3F0--; sCameraInterfaceFlags = 0x3200; Camera_UpdateInterface(sCameraInterfaceFlags); - } else if (camera->globalCtx->transitionMode != 0) { + } else if (camera->play->transitionMode != 0) { sCameraInterfaceFlags = 0xF200; Camera_UpdateInterface(sCameraInterfaceFlags); - } else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) { + } else if (camera->play->csCtx.state != CS_STATE_IDLE) { sCameraInterfaceFlags = 0x3200; Camera_UpdateInterface(sCameraInterfaceFlags); } else { @@ -7593,7 +7593,7 @@ Vec3s Camera_Update(Camera* camera) { } if (R_DBG_CAM_UPDATE) { - osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->globalCtx->transitionMode); + osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->play->transitionMode); } if (R_DBG_CAM_UPDATE) { @@ -7608,16 +7608,16 @@ Vec3s Camera_Update(Camera* camera) { gDbgCamEnabled ^= 1; if (gDbgCamEnabled) { DbgCamera_Enable(&D_8015BD80, camera); - } else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) { - func_80064534(camera->globalCtx, &camera->globalCtx->csCtx); + } else if (camera->play->csCtx.state != CS_STATE_IDLE) { + func_80064534(camera->play, &camera->play->csCtx); } } // Debug cam update if (gDbgCamEnabled) { - camera->globalCtx->view.fovy = D_8015BD80.fov; + camera->play->view.fovy = D_8015BD80.fov; DbCamera_Update(&D_8015BD80, camera); - func_800AA358(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); + func_800AA358(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: debug out\n"); } @@ -7662,13 +7662,13 @@ Vec3s Camera_Update(Camera* camera) { Camera_UpdateDistortion(camera); - if ((camera->globalCtx->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) { - View_SetScale(&camera->globalCtx->view, 0.79f); + if ((camera->play->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) { + View_SetScale(&camera->play->view, 0.79f); } else { - View_SetScale(&camera->globalCtx->view, 1.0f); + View_SetScale(&camera->play->view, 1.0f); } - camera->globalCtx->view.fovy = viewFov; - func_800AA358(&camera->globalCtx->view, &viewEye, &viewAt, &viewUp); + camera->play->view.fovy = viewFov; + func_800AA358(&camera->play->view, &viewEye, &viewAt, &viewUp); camera->camDir.x = eyeAtAngle.pitch; camera->camDir.y = eyeAtAngle.yaw; camera->camDir.z = 0; @@ -7708,18 +7708,18 @@ Vec3s Camera_Update(Camera* camera) { * When the camera's timer is 0, change the camera to its parent */ void Camera_Finish(Camera* camera) { - Camera* mainCam = camera->globalCtx->cameraPtrs[MAIN_CAM]; - Player* player = GET_PLAYER(camera->globalCtx); + Camera* mainCam = camera->play->cameraPtrs[MAIN_CAM]; + Player* player = GET_PLAYER(camera->play); if (camera->timer == 0) { - Gameplay_ChangeCameraStatus(camera->globalCtx, camera->parentCamIdx, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(camera->play, camera->parentCamIdx, CAM_STAT_ACTIVE); if ((camera->parentCamIdx == MAIN_CAM) && (camera->csId != 0)) { player->actor.freezeTimer = 0; player->stateFlags1 &= ~0x20000000; if (player->csMode != 0) { - func_8002DF54(camera->globalCtx, &player->actor, 7); + func_8002DF54(camera->play, &player->actor, 7); osSyncPrintf("camera: player demo end!!\n"); } @@ -7740,9 +7740,9 @@ void Camera_Finish(Camera* camera) { camera->childCamIdx = camera->parentCamIdx = SUBCAM_FREE; camera->timer = -1; - camera->globalCtx->envCtx.fillScreen = false; + camera->play->envCtx.fillScreen = false; - Gameplay_ClearCamera(camera->globalCtx, camera->thisIdx); + Play_ClearCamera(camera->play, camera->thisIdx); } } @@ -7756,7 +7756,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) { static s32 modeChangeFlags = 0; if (QREG(89)) { - osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->globalCtx->state.frames, sCameraModeNames[mode]); + osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->play->state.frames, sCameraModeNames[mode]); } if (camera->unk_14C & 0x20 && flags == 0) { @@ -7858,7 +7858,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) { func_80078884(0); break; case 2: - if (camera->globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) { + if (camera->play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) { func_80078884(NA_SE_SY_ATTENTION_URGENCY); } else { func_80078884(NA_SE_SY_ATTENTION_ON); @@ -7905,7 +7905,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) { } } if (((setting == CAM_SET_MEADOW_BIRDS_EYE) || (setting == CAM_SET_MEADOW_UNUSED)) && LINK_IS_ADULT && - (camera->globalCtx->sceneNum == SCENE_SPOT05)) { + (camera->play->sceneNum == SCENE_SPOT05)) { camera->unk_14A |= 0x10; return -5; } @@ -7951,7 +7951,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) { Camera_CopyDataToRegs(camera, camera->mode); } - osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->globalCtx->state.frames, + osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->play->state.frames, camera->thisIdx, sCameraSettingNames[camera->setting]); return setting; @@ -8280,9 +8280,9 @@ s32 func_8005B198() { s16 func_8005B1A4(Camera* camera) { camera->unk_14C |= 0x8; - if ((camera->thisIdx == MAIN_CAM) && (camera->globalCtx->activeCamera != MAIN_CAM)) { - GET_ACTIVE_CAM(camera->globalCtx)->unk_14C |= 0x8; - return camera->globalCtx->activeCamera; + if ((camera->thisIdx == MAIN_CAM) && (camera->play->activeCamera != MAIN_CAM)) { + GET_ACTIVE_CAM(camera->play)->unk_14C |= 0x8; + return camera->play->activeCamera; } return camera->thisIdx; diff --git a/soh/src/code/z_camera_data.inc b/soh/src/code/z_camera_data.inc index 1f457888e..f7bd99549 100644 --- a/soh/src/code/z_camera_data.inc +++ b/soh/src/code/z_camera_data.inc @@ -2398,6 +2398,6 @@ s16 D_8011DAFC[] = { CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2, }; -GlobalContext* D_8015BD7C; +PlayState* D_8015BD7C; DbCamera D_8015BD80; CollisionPoly* playerFloorPoly; diff --git a/soh/src/code/z_cheap_proc.c b/soh/src/code/z_cheap_proc.c index 75b6b8f5d..73afef668 100644 --- a/soh/src/code/z_cheap_proc.c +++ b/soh/src/code/z_cheap_proc.c @@ -1,23 +1,23 @@ #include "global.h" -void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + 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 Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/code/z_collision_check.c b/soh/src/code/z_collision_check.c index 91deaa26a..c27f35d6d 100644 --- a/soh/src/code/z_collision_check.c +++ b/soh/src/code/z_collision_check.c @@ -2,11 +2,11 @@ #include "vt.h" #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" -typedef s32 (*ColChkResetFunc)(GlobalContext*, Collider*); -typedef void (*ColChkBloodFunc)(GlobalContext*, Collider*, Vec3f*); -typedef void (*ColChkApplyFunc)(GlobalContext*, CollisionCheckContext*, Collider*); -typedef void (*ColChkVsFunc)(GlobalContext*, CollisionCheckContext*, Collider*, Collider*); -typedef s32 (*ColChkLineFunc)(GlobalContext*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); +typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); +typedef void (*ColChkBloodFunc)(PlayState*, Collider*, Vec3f*); +typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); +typedef void (*ColChkVsFunc)(PlayState*, CollisionCheckContext*, Collider*, Collider*); +typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); typedef struct { /* 0 */ u8 blood; @@ -100,7 +100,7 @@ void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, CLOSE_DISPS(gfxCtx); } -s32 Collider_InitBase(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_InitBase(PlayState* play, Collider* collider) { static Collider init = { NULL, NULL, NULL, NULL, AT_NONE, AC_NONE, OC1_NONE, OC2_NONE, COLTYPE_HIT3, COLSHAPE_INVALID, }; @@ -109,14 +109,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; @@ -129,7 +129,7 @@ s32 Collider_SetBaseToActor(GlobalContext* globalCtx, Collider* collider, Collid /** * Uses default OC2_TYPE_1 */ -s32 Collider_SetBaseType1(GlobalContext* globalCtx, Collider* collider, Actor* actor, ColliderInitType1* src) { +s32 Collider_SetBaseType1(PlayState* play, Collider* collider, Actor* actor, ColliderInitType1* src) { collider->actor = actor; collider->colType = src->colType; collider->atFlags = src->atFlags; @@ -140,7 +140,7 @@ s32 Collider_SetBaseType1(GlobalContext* globalCtx, Collider* collider, Actor* a return 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; @@ -151,62 +151,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 init = { 0x00000000, 0, 0 }; *touch = init; return 1; } -s32 Collider_DestroyTouch(GlobalContext* globalCtx, ColliderTouch* touch) { +s32 Collider_DestroyTouch(PlayState* play, ColliderTouch* touch) { return 1; } -s32 Collider_SetTouch(GlobalContext* globalCtx, ColliderTouch* dest, ColliderTouch* src) { +s32 Collider_SetTouch(PlayState* play, ColliderTouch* dest, ColliderTouch* src) { dest->dmgFlags = src->dmgFlags; dest->effect = src->effect; dest->damage = src->damage; return 1; } -void Collider_ResetATInfo_Unk(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetATInfo_Unk(PlayState* play, ColliderInfo* info) { } -s32 Collider_InitBump(GlobalContext* globalCtx, ColliderBump* bump) { +s32 Collider_InitBump(PlayState* play, ColliderBump* bump) { static ColliderBump init = { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }; *bump = init; return 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* init) { +s32 Collider_SetBump(PlayState* play, ColliderBump* bump, ColliderBumpInit* init) { bump->dmgFlags = init->dmgFlags; bump->effect = init->effect; bump->defense = init->defense; return 1; } -s32 Collider_InitInfo(GlobalContext* globalCtx, ColliderInfo* info) { +s32 Collider_InitInfo(PlayState* play, ColliderInfo* info) { static ColliderInfo init = { { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }, ELEMTYPE_UNK0, TOUCH_NONE, @@ -216,36 +216,36 @@ s32 Collider_InitInfo(GlobalContext* globalCtx, ColliderInfo* info) { }; *info = init; - Collider_InitTouch(globalCtx, &info->toucher); - Collider_InitBump(globalCtx, &info->bumper); + Collider_InitTouch(play, &info->toucher); + Collider_InitBump(play, &info->bumper); return 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* infoInit) { +s32 Collider_SetInfo(PlayState* play, ColliderInfo* info, ColliderInfoInit* infoInit) { info->elemType = infoInit->elemType; - Collider_SetTouch(globalCtx, &info->toucher, &infoInit->toucher); - Collider_SetBump(globalCtx, &info->bumper, &infoInit->bumper); + Collider_SetTouch(play, &info->toucher, &infoInit->toucher); + Collider_SetBump(play, &info->bumper, &infoInit->bumper); info->toucherFlags = infoInit->toucherFlags; info->bumperFlags = infoInit->bumperFlags; info->ocElemFlags = infoInit->ocElemFlags; return 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_ResetATInfo_Unk(globalCtx, info); + Collider_ResetATInfo_Unk(play, info); } -void Collider_ResetACInfo(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetACInfo(PlayState* play, ColliderInfo* info) { info->bumper.hitPos.x = info->bumper.hitPos.y = info->bumper.hitPos.z = 0; info->bumperFlags &= ~BUMP_HIT; info->bumperFlags &= ~BUMP_DRAW_HITMARK; @@ -253,11 +253,11 @@ void Collider_ResetACInfo(GlobalContext* globalCtx, ColliderInfo* info) { info->acHitInfo = NULL; } -void Collider_ResetOCInfo(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetOCInfo(PlayState* play, ColliderInfo* info) { info->ocElemFlags &= ~OCELEM_HIT; } -s32 Collider_InitJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dim) { +s32 Collider_InitJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dim) { static ColliderJntSphElementDim init = { { { 0, 0, 0 }, 0 }, { { 0, 0, 0 }, 0 }, @@ -268,11 +268,11 @@ s32 Collider_InitJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElemen return 1; } -s32 Collider_DestroyJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* element) { +s32 Collider_DestroyJntSphElementDim(PlayState* play, ColliderJntSphElementDim* element) { return 1; } -s32 Collider_SetJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dest, +s32 Collider_SetJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dest, ColliderJntSphElementDimInit* src) { dest->limb = src->limb; dest->modelSphere = src->modelSphere; @@ -280,44 +280,44 @@ s32 Collider_SetJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElement 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; @@ -326,12 +326,12 @@ s32 Collider_InitJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { /** * Destroys a dynamically allocated ColliderJntSph */ -s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { +s32 Collider_FreeJntSph(PlayState* play, ColliderJntSph* collider) { ColliderJntSphElement* element; - Collider_DestroyBase(globalCtx, &collider->base); + Collider_DestroyBase(play, &collider->base); for (element = collider->elements; element < collider->elements + collider->count; element++) { - Collider_DestroyJntSphElement(globalCtx, element); + Collider_DestroyJntSphElement(play, element); } collider->count = 0; @@ -345,12 +345,12 @@ s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { /** * Destroys a preallocated ColliderJntSph */ -s32 Collider_DestroyJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { +s32 Collider_DestroyJntSph(PlayState* play, ColliderJntSph* collider) { ColliderJntSphElement* element; - Collider_DestroyBase(globalCtx, &collider->base); + Collider_DestroyBase(play, &collider->base); for (element = collider->elements; element < collider->elements + collider->count; element++) { - Collider_DestroyJntSphElement(globalCtx, element); + Collider_DestroyJntSphElement(play, element); } collider->count = 0; collider->elements = NULL; @@ -361,11 +361,11 @@ s32 Collider_DestroyJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { * Sets up the ColliderJntSph using the values in src, sets it to the actor specified in src, and dynamically allocates * the element array. Uses default OC2_TYPE_1 and COLTYPE_HIT0. Unused. */ -s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, ColliderJntSphInitToActor* src) { +s32 Collider_SetJntSphToActor(PlayState* play, ColliderJntSph* dest, ColliderJntSphInitToActor* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBaseToActor(globalCtx, &dest->base, &src->base); + Collider_SetBaseToActor(play, &dest->base, &src->base); dest->count = src->count; dest->elements = ZELDA_ARENA_MALLOC_DEBUG(src->count * sizeof(ColliderJntSphElement)); @@ -379,8 +379,8 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, Co for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return 1; } @@ -389,12 +389,12 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, Co * Sets up the ColliderJntSph using the values in src and dynamically allocates the element array. Uses default * OC2_TYPE_1. Only used by En_Nwc, an unused and unfinished actor. */ -s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, +s32 Collider_SetJntSphAllocType1(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInitType1* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBaseType1(globalCtx, &dest->base, actor, &src->base); + Collider_SetBaseType1(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZELDA_ARENA_MALLOC_DEBUG(src->count * sizeof(ColliderJntSphElement)); @@ -408,8 +408,8 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return 1; } @@ -418,11 +418,11 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, * Sets up the ColliderJntSph using the values in src and dynamically allocates the element array. * Unused. */ -s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src) { +s32 Collider_SetJntSphAlloc(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZELDA_ARENA_MALLOC_DEBUG(src->count * sizeof(ColliderJntSphElement)); @@ -435,8 +435,8 @@ s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Acto } for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return 1; } @@ -444,20 +444,20 @@ s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Acto /** * Sets up the ColliderJntSph using the values in src, placing the element array in elements. */ -s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, +s32 Collider_SetJntSph(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; ASSERT(dest->elements != NULL); for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return 1; } @@ -465,14 +465,14 @@ s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* ac /** * Resets the collider's AT collision flags. */ -s32 Collider_ResetJntSphAT(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetJntSphAT(PlayState* play, Collider* collider) { ColliderJntSphElement* element; ColliderJntSph* jntSph = (ColliderJntSph*)collider; - Collider_ResetATBase(globalCtx, &jntSph->base); + Collider_ResetATBase(play, &jntSph->base); for (element = jntSph->elements; element < jntSph->elements + jntSph->count; element++) { - Collider_ResetJntSphElementAT(globalCtx, element); + Collider_ResetJntSphElementAT(play, element); } return 1; } @@ -480,14 +480,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; } @@ -495,30 +495,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) { Cylinder16 init = { 0, 0, 0, { 0, 0, 0 } }; *dim = init; return 1; } -s32 Collider_DestroyCylinderDim(GlobalContext* globalCtx, Cylinder16* dim) { +s32 Collider_DestroyCylinderDim(PlayState* play, Cylinder16* dim) { return 1; } -s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dest, Cylinder16* src) { +s32 Collider_SetCylinderDim(PlayState* play, Cylinder16* dest, Cylinder16* src) { *dest = *src; return 1; } @@ -526,20 +526,20 @@ s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dest, Cylinder /** * Initializes a ColliderCylinder to default values */ -s32 Collider_InitCylinder(GlobalContext* globalCtx, ColliderCylinder* collider) { - Collider_InitBase(globalCtx, &collider->base); - Collider_InitInfo(globalCtx, &collider->info); - Collider_InitCylinderDim(globalCtx, &collider->dim); +s32 Collider_InitCylinder(PlayState* play, ColliderCylinder* collider) { + Collider_InitBase(play, &collider->base); + Collider_InitInfo(play, &collider->info); + Collider_InitCylinderDim(play, &collider->dim); return 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; } @@ -547,70 +547,70 @@ s32 Collider_DestroyCylinder(GlobalContext* globalCtx, ColliderCylinder* collide * Sets up the ColliderCylinder using the values in src and sets it to the actor specified in src. Uses default * OC2_TYPE_1 and COLTYPE_0. Used only by DekuJr, who sets it to himself anyways. */ -s32 Collider_SetCylinderToActor(GlobalContext* globalCtx, ColliderCylinder* collider, +s32 Collider_SetCylinderToActor(PlayState* play, 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); + 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, +s32 Collider_SetCylinder(PlayState* play, 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); + Collider_SetBase(play, &collider->base, actor, &src->base); + Collider_SetInfo(play, &collider->info, &src->info); + Collider_SetCylinderDim(play, &collider->dim, &src->dim); 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 init = { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { { 0.0f, 0.0f, 0.0f }, 0.0f }, @@ -620,11 +620,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* dest, ColliderTrisElementDimInit* src) { +s32 Collider_SetTrisElementDim(PlayState* play, TriNorm* dest, ColliderTrisElementDimInit* src) { Vec3f* destVtx; Vec3f* srcVtx; f32 nx; @@ -645,44 +645,44 @@ s32 Collider_SetTrisElementDim(GlobalContext* globalCtx, TriNorm* dest, Collider return 1; } -s32 Collider_InitTrisElement(GlobalContext* globalCtx, ColliderTrisElement* collider) { - Collider_InitInfo(globalCtx, &collider->info); - Collider_InitTrisElementDim(globalCtx, &collider->dim); +s32 Collider_InitTrisElement(PlayState* play, ColliderTrisElement* collider) { + Collider_InitInfo(play, &collider->info); + Collider_InitTrisElementDim(play, &collider->dim); return 1; } -s32 Collider_DestroyTrisElement(GlobalContext* globalCtx, ColliderTrisElement* collider) { - Collider_DestroyInfo(globalCtx, &collider->info); - Collider_DestroyTrisElementDim(globalCtx, &collider->dim); +s32 Collider_DestroyTrisElement(PlayState* play, ColliderTrisElement* collider) { + Collider_DestroyInfo(play, &collider->info); + Collider_DestroyTrisElementDim(play, &collider->dim); return 1; } -s32 Collider_SetTrisElement(GlobalContext* globalCtx, ColliderTrisElement* dest, ColliderTrisElementInit* src) { - Collider_SetInfo(globalCtx, &dest->info, &src->info); - Collider_SetTrisElementDim(globalCtx, &dest->dim, &src->dim); +s32 Collider_SetTrisElement(PlayState* play, ColliderTrisElement* dest, ColliderTrisElementInit* src) { + Collider_SetInfo(play, &dest->info, &src->info); + Collider_SetTrisElementDim(play, &dest->dim, &src->dim); return 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 = 0; return 1; @@ -692,12 +692,12 @@ s32 Collider_InitTris(GlobalContext* globalCtx, ColliderTris* tris) { * Destroys a dynamically allocated ColliderTris * Unused */ -s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) { +s32 Collider_FreeTris(PlayState* play, ColliderTris* tris) { ColliderTrisElement* element; - Collider_DestroyBase(globalCtx, &tris->base); + Collider_DestroyBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_DestroyTrisElement(globalCtx, element); + Collider_DestroyTrisElement(play, element); } tris->count = 0; @@ -711,12 +711,12 @@ s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) { /** * Destroys a preallocated ColliderTris */ -s32 Collider_DestroyTris(GlobalContext* globalCtx, ColliderTris* tris) { +s32 Collider_DestroyTris(PlayState* play, ColliderTris* tris) { ColliderTrisElement* element; - Collider_DestroyBase(globalCtx, &tris->base); + Collider_DestroyBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_DestroyTrisElement(globalCtx, element); + Collider_DestroyTrisElement(play, element); } tris->count = 0; @@ -728,11 +728,11 @@ s32 Collider_DestroyTris(GlobalContext* globalCtx, ColliderTris* tris) { * Sets up the ColliderTris using the values in src and dynamically allocates the element array. Uses default OC2_TYPE_1 * Unused. */ -s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src) { +s32 Collider_SetTrisAllocType1(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src) { ColliderTrisElement* destElem; ColliderTrisElementInit* srcElem; - Collider_SetBaseType1(globalCtx, &dest->base, actor, &src->base); + Collider_SetBaseType1(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZELDA_ARENA_MALLOC_DEBUG(dest->count * sizeof(ColliderTrisElement)); if (dest->elements == NULL) { @@ -744,8 +744,8 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Act } for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitTrisElement(globalCtx, destElem); - Collider_SetTrisElement(globalCtx, destElem, srcElem); + Collider_InitTrisElement(play, destElem); + Collider_SetTrisElement(play, destElem, srcElem); } return 1; } @@ -754,11 +754,11 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Act * Sets up the ColliderTris using the values in src and dynamically allocates the element array. * Unused */ -s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src) { +s32 Collider_SetTrisAlloc(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src) { ColliderTrisElement* destElem; ColliderTrisElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZELDA_ARENA_MALLOC_DEBUG(dest->count * sizeof(ColliderTrisElement)); @@ -772,8 +772,8 @@ s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* a for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitTrisElement(globalCtx, destElem); - Collider_SetTrisElement(globalCtx, destElem, srcElem); + Collider_InitTrisElement(play, destElem); + Collider_SetTrisElement(play, destElem, srcElem); } return 1; } @@ -781,20 +781,20 @@ s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* a /** * Sets up the ColliderTris using the values in src, placing the element array in elements. */ -s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, +s32 Collider_SetTris(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* elements) { ColliderTrisElement* destElem; ColliderTrisElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; ASSERT(dest->elements != NULL); for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitTrisElement(globalCtx, destElem); - Collider_SetTrisElement(globalCtx, destElem, srcElem); + Collider_InitTrisElement(play, destElem); + Collider_SetTrisElement(play, destElem, srcElem); } return 1; } @@ -802,13 +802,13 @@ s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, /** * Resets the collider's AT collision flags. */ -s32 Collider_ResetTrisAT(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetTrisAT(PlayState* play, Collider* collider) { ColliderTrisElement* element; ColliderTris* tris = (ColliderTris*)collider; - Collider_ResetATBase(globalCtx, &tris->base); + Collider_ResetATBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_ResetTrisElementAT(globalCtx, element); + Collider_ResetTrisElementAT(play, element); } return 1; } @@ -816,13 +816,13 @@ s32 Collider_ResetTrisAT(GlobalContext* globalCtx, Collider* collider) { /** * Resets the collider's AC collision flags. */ -s32 Collider_ResetTrisAC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetTrisAC(PlayState* play, Collider* collider) { ColliderTrisElement* element; ColliderTris* tris = (ColliderTris*)collider; - Collider_ResetACBase(globalCtx, &tris->base); + Collider_ResetACBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_ResetTrisElementAC(globalCtx, element); + Collider_ResetTrisElementAC(play, element); } return 1; } @@ -830,18 +830,18 @@ s32 Collider_ResetTrisAC(GlobalContext* globalCtx, Collider* collider) { /** * Resets the collider's OC collision flags. */ -s32 Collider_ResetTrisOC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetTrisOC(PlayState* play, Collider* collider) { ColliderTrisElement* element; ColliderTris* tris = (ColliderTris*)collider; - Collider_ResetOCBase(globalCtx, &tris->base); + Collider_ResetOCBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_ResetTrisElementOC(globalCtx, element); + Collider_ResetTrisElementOC(play, element); } return 1; } -s32 Collider_InitQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { +s32 Collider_InitQuadDim(PlayState* play, ColliderQuadDim* dim) { static ColliderQuadDim init = { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0, 0, 0 }, @@ -853,11 +853,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; } @@ -871,7 +871,7 @@ void Collider_SetQuadMidpoints(ColliderQuadDim* dim) { dim->baMid.z = (dim->quad[1].z + dim->quad[0].z) * 0.5f; } -s32 Collider_SetQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dest, ColliderQuadDimInit* src) { +s32 Collider_SetQuadDim(PlayState* play, ColliderQuadDim* dest, ColliderQuadDimInit* src) { dest->quad[0] = src->quad[0]; dest->quad[1] = src->quad[1]; dest->quad[2] = src->quad[2]; @@ -883,74 +883,74 @@ s32 Collider_SetQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dest, Collide /** * Initializes a ColliderQuad to default values. */ -s32 Collider_InitQuad(GlobalContext* globalCtx, ColliderQuad* collider) { - Collider_InitBase(globalCtx, &collider->base); - Collider_InitInfo(globalCtx, &collider->info); - Collider_InitQuadDim(globalCtx, &collider->dim); +s32 Collider_InitQuad(PlayState* play, ColliderQuad* collider) { + Collider_InitBase(play, &collider->base); + Collider_InitInfo(play, &collider->info); + Collider_InitQuadDim(play, &collider->dim); return 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; } /** * 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; } @@ -958,7 +958,7 @@ s32 Collider_ResetQuadOC(GlobalContext* globalCtx, Collider* collider) { * For quad colliders with AT_NEAREST, resets the previous AC collider it hit if the current element is closer, * otherwise returns false. Used on player AT colliders to prevent multiple collisions from registering. */ -s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3f* hitPos) { +s32 Collider_QuadSetNearestAC(PlayState* play, ColliderQuad* quad, Vec3f* hitPos) { f32 acDist; Vec3f dcMid; @@ -970,10 +970,10 @@ s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3 if (acDist < quad->dim.acDist) { 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 true; } @@ -984,7 +984,7 @@ s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3 * Initializes an OcLine to default values * OcLines are entirely unused. */ -s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_InitLine(PlayState* play, OcLine* line) { Vec3f init = { 0.0f, 0.0f, 0.0f }; Math_Vec3f_Copy(&line->line.a, &init); @@ -996,7 +996,7 @@ s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line) { * Destroys an OcLine * OcLines are entirely unused. */ -s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_DestroyLine(PlayState* play, OcLine* line) { return 1; } @@ -1004,7 +1004,7 @@ s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line) { * Sets up an OcLine with endpoints a and b. * OcLines are entirely unused. */ -s32 Collider_SetLinePoints(GlobalContext* GlobalContext, OcLine* ocLine, Vec3f* a, Vec3f* b) { +s32 Collider_SetLinePoints(PlayState* PlayState, OcLine* ocLine, Vec3f* a, Vec3f* b) { Math_Vec3f_Copy(&ocLine->line.a, a); Math_Vec3f_Copy(&ocLine->line.b, b); return 1; @@ -1014,9 +1014,9 @@ s32 Collider_SetLinePoints(GlobalContext* GlobalContext, OcLine* ocLine, Vec3f* * Sets up an OcLine using the values in src. * OcLines are entirely unused. */ -s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* dest, OcLine* src) { +s32 Collider_SetLine(PlayState* play, OcLine* dest, OcLine* src) { dest->ocFlags = src->ocFlags; - Collider_SetLinePoints(globalCtx, dest, &src->line.a, &src->line.b); + Collider_SetLinePoints(play, dest, &src->line.a, &src->line.b); return 1; } @@ -1024,7 +1024,7 @@ s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* dest, OcLine* src) { * Resets the OcLine's collision flags. * OcLines are entirely unused. */ -s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_ResetLineOC(PlayState* play, OcLine* line) { line->ocFlags &= ~OCLINE_HIT; return 1; } @@ -1032,21 +1032,21 @@ s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line) { /** * Initializes CollisionCheckContext. Clears all collider arrays, disables SAC, and sets flags for drawing colliders. */ -void CollisionCheck_InitContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCtx) { colChkCtx->sacFlags = 0; - CollisionCheck_ClearContext(globalCtx, colChkCtx); + CollisionCheck_ClearContext(play, colChkCtx); AREG(21) = true; AREG(22) = true; AREG(23) = true; } -void CollisionCheck_DestroyContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colChkCtx) { } /** * Clears all collider lists in CollisionCheckContext when not in SAC mode. */ -void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** col; OcLine** line; @@ -1076,14 +1076,14 @@ void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext /** * Enables SAC, an alternate collision check mode that allows direct management of collider lists. Unused. */ -void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colChkCtx) { colChkCtx->sacFlags |= 1; } /** * Disables SAC, an alternate collision check mode that allows direct management of collider lists. Unused. */ -void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx) { colChkCtx->sacFlags &= ~1; } @@ -1091,7 +1091,7 @@ void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* * Draws a collider of any shape. * Math3D_DrawSphere and Math3D_DrawCylinder are noops, so JntSph and Cylinder are not drawn. */ -void Collider_Draw(GlobalContext* globalCtx, Collider* collider) { +void Collider_Draw(PlayState* play, Collider* collider) { ColliderJntSph* jntSph; ColliderCylinder* cylinder; ColliderTris* tris; @@ -1105,24 +1105,24 @@ void Collider_Draw(GlobalContext* globalCtx, Collider* collider) { case COLSHAPE_JNTSPH: jntSph = (ColliderJntSph*)collider; for (i = 0; i < jntSph->count; i++) { - Math3D_DrawSphere(globalCtx, &jntSph->elements[i].dim.worldSphere); + Math3D_DrawSphere(play, &jntSph->elements[i].dim.worldSphere); } break; case COLSHAPE_CYLINDER: cylinder = (ColliderCylinder*)collider; - Math3D_DrawCylinder(globalCtx, &cylinder->dim); + Math3D_DrawCylinder(play, &cylinder->dim); break; case COLSHAPE_TRIS: tris = (ColliderTris*)collider; for (i = 0; i < tris->count; i++) { - Collider_DrawRedPoly(globalCtx->state.gfxCtx, &tris->elements[i].dim.vtx[0], + Collider_DrawRedPoly(play->state.gfxCtx, &tris->elements[i].dim.vtx[0], &tris->elements[i].dim.vtx[1], &tris->elements[i].dim.vtx[2]); } break; case COLSHAPE_QUAD: quad = (ColliderQuad*)collider; - Collider_DrawRedPoly(globalCtx->state.gfxCtx, &quad->dim.quad[2], &quad->dim.quad[3], &quad->dim.quad[1]); - Collider_DrawRedPoly(globalCtx->state.gfxCtx, &quad->dim.quad[1], &quad->dim.quad[0], &quad->dim.quad[2]); + Collider_DrawRedPoly(play->state.gfxCtx, &quad->dim.quad[2], &quad->dim.quad[3], &quad->dim.quad[1]); + Collider_DrawRedPoly(play->state.gfxCtx, &quad->dim.quad[1], &quad->dim.quad[0], &quad->dim.quad[2]); break; } } @@ -1131,34 +1131,34 @@ void Collider_Draw(GlobalContext* globalCtx, Collider* collider) { * Draws collision if AREG(15) and other AREGs are set. AREG(21) draws AT colliders, AREG(22) draws AC colliders, * AREG(23) draws OC colliders, AREG(24) draws dynapolys, and AREG(25) draws bg polys */ -void CollisionCheck_DrawCollision(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_DrawCollision(PlayState* play, CollisionCheckContext* colChkCtx) { Collider* collider; s32 i; if (AREG(15)) { if (AREG(21)) { for (i = 0; i < colChkCtx->colATCount; i++) { - Collider_Draw(globalCtx, colChkCtx->colAT[i]); + Collider_Draw(play, colChkCtx->colAT[i]); } } if (AREG(22)) { for (i = 0; i < colChkCtx->colACCount; i++) { - Collider_Draw(globalCtx, colChkCtx->colAC[i]); + Collider_Draw(play, colChkCtx->colAC[i]); } } if (AREG(23)) { for (i = 0; i < colChkCtx->colOCCount; i++) { collider = colChkCtx->colOC[i]; if (collider->ocFlags1 & OC1_ON) { - Collider_Draw(globalCtx, collider); + Collider_Draw(play, collider); } } } if (AREG(24)) { - BgCheck_DrawDynaCollision(globalCtx, &globalCtx->colCtx); + BgCheck_DrawDynaCollision(play, &play->colCtx); } if (AREG(25)) { - BgCheck_DrawStaticCollision(globalCtx, &globalCtx->colCtx); + BgCheck_DrawStaticCollision(play, &play->colCtx); } } } @@ -1174,14 +1174,14 @@ static ColChkResetFunc sATResetFuncs[] = { * Sets collider as an AT (attack) for the current frame, which will be checked against ACs (attack colliders) * The last argument takes a Collider, so pass collider.base rather than the raw collider. */ -s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape <= COLSHAPE_QUAD); - sATResetFuncs[collider->shape](globalCtx, collider); + sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1203,13 +1203,13 @@ s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChk * If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it * will be inserted into the next slot */ -s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, +s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { ASSERT(collider->shape <= COLSHAPE_QUAD); - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } - sATResetFuncs[collider->shape](globalCtx, collider); + sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1243,14 +1243,14 @@ static ColChkResetFunc sACResetFuncs[] = { * Sets collider as an AC (attack collider) for the current frame, allowing it to detect ATs (attacks) * The last argument takes a Collider, so pass collider.base rather than the raw collider. */ -s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape <= COLSHAPE_QUAD); - sACResetFuncs[collider->shape](globalCtx, collider); + sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1272,13 +1272,13 @@ s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChk * If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it * will be inserted into the next slot */ -s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, +s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { ASSERT(collider->shape <= COLSHAPE_QUAD); - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } - sACResetFuncs[collider->shape](globalCtx, collider); + sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1312,16 +1312,16 @@ static ColChkResetFunc sOCResetFuncs[] = { * Sets collider as an OC (object collider) for the current frame, allowing it to detect other OCs * The last argument takes a Collider, so pass collider.base rather than the raw collider. */ -s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape <= COLSHAPE_QUAD); - sOCResetFuncs[collider->shape](globalCtx, collider); + sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1343,13 +1343,13 @@ s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChk * If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it * will be inserted into the next slot */ -s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, +s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape <= COLSHAPE_QUAD); - sOCResetFuncs[collider->shape](globalCtx, collider); + sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1377,13 +1377,13 @@ s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* co * Sets a line as an OC collider for this frame. * OC lines are entirely unused, and do not even have collision check functions. */ -s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, OcLine* collider) { +s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colChkCtx, OcLine* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } - Collider_ResetLineOC(globalCtx, collider); + Collider_ResetLineOC(play, collider); if (!(colChkCtx->colLineCount < COLLISION_CHECK_OC_LINE_MAX)) { // "Index exceeded and cannot add more" osSyncPrintf("CollisionCheck_setOCLine():インデックスがオーバして追加不能\n"); @@ -1428,14 +1428,14 @@ s32 CollisionCheck_NoSharedFlags(ColliderInfo* atInfo, ColliderInfo* acInfo) { * Spawns no blood drops. * Used by collider types HIT1, HIT3, HIT5, METAL, NONE, WOOD, HARD, and TREE */ -void CollisionCheck_NoBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_NoBlood(PlayState* play, Collider* collider, Vec3f* v) { } /** * Spawns blue blood drops. * Used by collider types HIT0 and HIT8. */ -void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_BlueBlood(PlayState* play, Collider* collider, Vec3f* v) { static EffectSparkInit D_8015D8A0; s32 effectIndex; @@ -1481,14 +1481,14 @@ void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3 D_8015D8A0.speed = 8.0f; D_8015D8A0.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015D8A0); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015D8A0); } /** * Spawns green blood drops. * Used by collider types HIT2 and HIT6. No actor has type HIT2. */ -void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_GreenBlood(PlayState* play, Collider* collider, Vec3f* v) { static EffectSparkInit D_8015DD68; s32 effectIndex; @@ -1534,42 +1534,42 @@ void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec D_8015DD68.speed = 8.0f; D_8015DD68.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015DD68); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015DD68); } /** * Spawns a burst of water. * Used by collider type HIT4, which no actor has. */ -void CollisionCheck_WaterBurst(GlobalContext* globalCtx, Collider* collider, Vec3f* pos) { - EffectSsSibuki_SpawnBurst(globalCtx, pos); - CollisionCheck_SpawnWaterDroplets(globalCtx, pos); +void CollisionCheck_WaterBurst(PlayState* play, Collider* collider, Vec3f* pos) { + EffectSsSibuki_SpawnBurst(play, pos); + CollisionCheck_SpawnWaterDroplets(play, pos); } /** * Spawns red blood drops. * Used by collider type HIT7, which no actor has. */ -void CollisionCheck_RedBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { - CollisionCheck_SpawnRedBlood(globalCtx, v); +void CollisionCheck_RedBlood(PlayState* play, Collider* collider, Vec3f* v) { + CollisionCheck_SpawnRedBlood(play, v); } /** * Spawns red blood drops. * Unused. */ -void CollisionCheck_RedBloodUnused(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { - CollisionCheck_SpawnRedBlood(globalCtx, v); +void CollisionCheck_RedBloodUnused(PlayState* play, Collider* collider, Vec3f* v) { + CollisionCheck_SpawnRedBlood(play, v); } /** * Plays sound effects and displays hitmarks for solid-type AC colliders (METAL, WOOD, HARD, and TREE) */ -void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Collider* collider, Vec3f* hitPos) { +void CollisionCheck_HitSolid(PlayState* play, ColliderInfo* info, Collider* collider, Vec3f* hitPos) { s32 flags = info->toucherFlags & TOUCH_SFX_NONE; if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_WHITE, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (collider->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { @@ -1577,14 +1577,14 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli &D_801333E8); } } else if (flags == TOUCH_SFX_NORMAL) { // collider->colType == COLTYPE_METAL - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_METAL, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_METAL, hitPos); if (collider->actor == NULL) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, hitPos); + CollisionCheck_SpawnShieldParticlesMetal(play, hitPos); } else { - CollisionCheck_SpawnShieldParticlesMetalSound(globalCtx, hitPos, &collider->actor->projectedPos); + CollisionCheck_SpawnShieldParticlesMetalSound(play, hitPos, &collider->actor->projectedPos); } } else if (flags == TOUCH_SFX_HARD) { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_WHITE, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (collider->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { @@ -1592,7 +1592,7 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli &D_801333E8); } } else if (flags == TOUCH_SFX_WOOD) { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_DUST, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_DUST, hitPos); if (collider->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { @@ -1638,7 +1638,7 @@ static HitInfo sHitInfo[] = { /** * Handles hitmarks, blood, and sound effects for each AC collision, determined by the AC collider's colType */ -void CollisionCheck_HitEffects(GlobalContext* globalCtx, Collider* at, ColliderInfo* atInfo, Collider* ac, +void CollisionCheck_HitEffects(PlayState* play, Collider* at, ColliderInfo* atInfo, Collider* ac, ColliderInfo* acInfo, Vec3f* hitPos) { if (acInfo->bumperFlags & BUMP_NO_HITMARK) { return; @@ -1647,26 +1647,26 @@ void CollisionCheck_HitEffects(GlobalContext* globalCtx, Collider* at, ColliderI return; } if (ac->actor != NULL) { - sBloodFuncs[sHitInfo[ac->colType].blood](globalCtx, ac, hitPos); + sBloodFuncs[sHitInfo[ac->colType].blood](play, ac, hitPos); } if (ac->actor != NULL) { if (sHitInfo[ac->colType].effect == HIT_SOLID) { - CollisionCheck_HitSolid(globalCtx, atInfo, ac, hitPos); + CollisionCheck_HitSolid(play, atInfo, ac, hitPos); } else if (sHitInfo[ac->colType].effect == HIT_WOOD) { if (at->actor == NULL) { - CollisionCheck_SpawnShieldParticles(globalCtx, hitPos); + CollisionCheck_SpawnShieldParticles(play, hitPos); Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { - CollisionCheck_SpawnShieldParticlesWood(globalCtx, hitPos, &at->actor->projectedPos); + CollisionCheck_SpawnShieldParticlesWood(play, hitPos, &at->actor->projectedPos); } } else if (sHitInfo[ac->colType].effect != HIT_NONE) { - EffectSsHitMark_SpawnFixedScale(globalCtx, sHitInfo[ac->colType].effect, hitPos); + EffectSsHitMark_SpawnFixedScale(play, sHitInfo[ac->colType].effect, hitPos); if (!(acInfo->bumperFlags & BUMP_NO_SWORD_SFX)) { CollisionCheck_SwordHitAudio(at, acInfo); } } } else { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_WHITE, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (ac->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { @@ -1687,7 +1687,7 @@ void CollisionCheck_SetBounce(Collider* at, Collider* ac) { /** * Performs the AC collision between the AT element and AC element that collided. */ -s32 CollisionCheck_SetATvsAC(GlobalContext* globalCtx, Collider* at, ColliderInfo* atInfo, Vec3f* atPos, Collider* ac, +s32 CollisionCheck_SetATvsAC(PlayState* play, Collider* at, ColliderInfo* atInfo, Vec3f* atPos, Collider* ac, ColliderInfo* acInfo, Vec3f* acPos, Vec3f* hitPos) { if (ac->acFlags & AC_HARD && at->actor != NULL && ac->actor != NULL) { CollisionCheck_SetBounce(at, ac); @@ -1717,7 +1717,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; @@ -1726,7 +1726,7 @@ s32 CollisionCheck_SetATvsAC(GlobalContext* globalCtx, Collider* at, ColliderInf /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atItem; @@ -1768,7 +1768,7 @@ void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, &acPos, &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; @@ -1782,7 +1782,7 @@ void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atItem; @@ -1825,7 +1825,7 @@ void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } @@ -1836,7 +1836,7 @@ void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_CylVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderJntSph* ac = (ColliderJntSph*)colAC; @@ -1879,7 +1879,7 @@ void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckConte } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { break; @@ -1892,7 +1892,7 @@ void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckConte /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atSph; @@ -1922,7 +1922,7 @@ void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckCont acPos.x = (acTri->dim.vtx[0].x + acTri->dim.vtx[1].x + acTri->dim.vtx[2].x) * (1.0f / 3); acPos.y = (acTri->dim.vtx[0].y + acTri->dim.vtx[1].y + acTri->dim.vtx[2].y) * (1.0f / 3); acPos.z = (acTri->dim.vtx[0].z + acTri->dim.vtx[1].z + acTri->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atSph->info, &atPos, &ac->base, &acTri->info, + CollisionCheck_SetATvsAC(play, &at->base, &atSph->info, &atPos, &ac->base, &acTri->info, &acPos, &hitPos); return; } @@ -1934,7 +1934,7 @@ void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_TrisVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderTris* at = (ColliderTris*)colAT; ColliderTrisElement* atItem; @@ -1962,7 +1962,7 @@ void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckCont atPos.x = (atItem->dim.vtx[0].x + atItem->dim.vtx[1].x + atItem->dim.vtx[2].x) * (1.0f / 3); atPos.y = (atItem->dim.vtx[0].y + atItem->dim.vtx[1].y + atItem->dim.vtx[2].y) * (1.0f / 3); atPos.z = (atItem->dim.vtx[0].z + atItem->dim.vtx[1].z + atItem->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, &acPos, &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; @@ -1976,7 +1976,7 @@ void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm D_8015E230; static TriNorm D_8015E268; @@ -2009,7 +2009,7 @@ void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckCont acPos.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } @@ -2020,7 +2020,7 @@ void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_QuadVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm D_8015E2A0; static TriNorm D_8015E2D8; @@ -2044,7 +2044,7 @@ void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckCont } if (Math3D_TriVsSphIntersect(&acElem->dim.worldSphere, &D_8015E2A0, &hitPos) == 1 || Math3D_TriVsSphIntersect(&acElem->dim.worldSphere, &D_8015E2D8, &hitPos) == 1) { - if (Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (Collider_QuadSetNearestAC(play, at, &hitPos)) { Vec3f atPos; Vec3f acPos; @@ -2058,7 +2058,7 @@ void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckCont (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; @@ -2072,7 +2072,7 @@ void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_CylVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderCylinder* ac = (ColliderCylinder*)colAC; @@ -2105,7 +2105,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); } } } @@ -2113,7 +2113,7 @@ void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_CylVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderTris* ac = (ColliderTris*)colAC; @@ -2140,7 +2140,7 @@ void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext acPos.x = (acElem->dim.vtx[0].x + acElem->dim.vtx[1].x + acElem->dim.vtx[2].x) * (1.0f / 3); acPos.y = (acElem->dim.vtx[0].y + acElem->dim.vtx[1].y + acElem->dim.vtx[2].y) * (1.0f / 3); acPos.z = (acElem->dim.vtx[0].z + acElem->dim.vtx[1].z + acElem->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atpos, &ac->base, &acElem->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atpos, &ac->base, &acElem->info, &acPos, &hitPos); return; } @@ -2151,7 +2151,7 @@ void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_TrisVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f D_8015E310; ColliderTris* at = (ColliderTris*)colAT; @@ -2177,7 +2177,7 @@ void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext atPos.y = (atItem->dim.vtx[0].y + atItem->dim.vtx[1].y + atItem->dim.vtx[2].y) * (1.0f / 3); atPos.z = (atItem->dim.vtx[0].z + atItem->dim.vtx[1].z + atItem->dim.vtx[2].z) * (1.0f / 3); Math_Vec3s_ToVec3f(&acPos, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &D_8015E310); return; } @@ -2188,7 +2188,7 @@ void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_CylVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm D_8015E320; static TriNorm D_8015E358; @@ -2213,7 +2213,7 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext acPos1.x = (ac->dim.quad[0].x + (ac->dim.quad[1].x + (ac->dim.quad[3].x + ac->dim.quad[2].x))) / 4.0f; acPos1.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos1.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, &D_8015E390); } else if (Math3D_CylTriVsIntersect(&at->dim, &D_8015E358, &D_8015E390) == 1) { Vec3f atPos2; @@ -2223,7 +2223,7 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext acPos2.x = (ac->dim.quad[0].x + (ac->dim.quad[1].x + (ac->dim.quad[3].x + ac->dim.quad[2].x))) / 4.0f; acPos2.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos2.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, &D_8015E390); } } @@ -2235,7 +2235,7 @@ static s8 sBssDummy1; /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_QuadVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm D_8015E3A0; static TriNorm D_8015E3D8; @@ -2253,7 +2253,7 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext Math3D_TriNorm(&D_8015E3A0, &at->dim.quad[2], &at->dim.quad[3], &at->dim.quad[1]); Math3D_TriNorm(&D_8015E3D8, &at->dim.quad[2], &at->dim.quad[1], &at->dim.quad[0]); if (Math3D_CylTriVsIntersect(&ac->dim, &D_8015E3A0, &D_8015E410) == 1) { - if (Collider_QuadSetNearestAC(globalCtx, at, &D_8015E410)) { + if (Collider_QuadSetNearestAC(play, at, &D_8015E410)) { Vec3f atPos1; Vec3f acPos1; @@ -2261,13 +2261,13 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext atPos1.y = (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos1.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; Math_Vec3s_ToVec3f(&acPos1, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, &D_8015E410); return; } } if (Math3D_CylTriVsIntersect(&ac->dim, &D_8015E3D8, &D_8015E410) == 1) { - if (Collider_QuadSetNearestAC(globalCtx, at, &D_8015E410)) { + if (Collider_QuadSetNearestAC(play, at, &D_8015E410)) { Vec3f atPos2; Vec3f acPos2; @@ -2275,7 +2275,7 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext atPos2.y = (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos2.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; Math_Vec3s_ToVec3f(&acPos2, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, &D_8015E410); } } @@ -2290,7 +2290,7 @@ static s8 sBssDummy6; /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_TrisVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f D_8015E420; ColliderTris* at = (ColliderTris*)colAT; @@ -2320,7 +2320,7 @@ void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContex acPos.x = (acElem->dim.vtx[0].x + acElem->dim.vtx[1].x + acElem->dim.vtx[2].x) * (1.0f / 3); acPos.y = (acElem->dim.vtx[0].y + acElem->dim.vtx[1].y + acElem->dim.vtx[2].y) * (1.0f / 3); acPos.z = (acElem->dim.vtx[0].z + acElem->dim.vtx[1].z + acElem->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, &acPos, &D_8015E420); return; } @@ -2337,7 +2337,7 @@ static s8 sBssDummy10; /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_TrisVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f D_8015E430; static TriNorm D_8015E440; @@ -2370,7 +2370,7 @@ void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContex acPos.x = (ac->dim.quad[0].x + (ac->dim.quad[1].x + (ac->dim.quad[3].x + ac->dim.quad[2].x))) / 4.0f; acPos.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &D_8015E430); return; } @@ -2381,7 +2381,7 @@ void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContex /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_QuadVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f D_8015E4B0; static TriNorm D_8015E4C0; @@ -2405,7 +2405,7 @@ void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContex } if (Math3D_TriVsTriIntersect(&D_8015E4C0, &acElem->dim, &D_8015E4B0) == 1 || Math3D_TriVsTriIntersect(&D_8015E4F8, &acElem->dim, &D_8015E4B0) == 1) { - if (Collider_QuadSetNearestAC(globalCtx, at, &D_8015E4B0)) { + if (Collider_QuadSetNearestAC(play, at, &D_8015E4B0)) { Vec3f atPos; Vec3f acPos; @@ -2418,7 +2418,7 @@ void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContex (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, &D_8015E4B0); return; } @@ -2430,7 +2430,7 @@ void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContex /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_QuadVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm D_8015E530[2]; static Vec3f D_8015E598; @@ -2458,7 +2458,7 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { if (Math3D_TriVsTriIntersect(&D_8015E5A8[j], &D_8015E530[i], &D_8015E598) == 1) { - if (Collider_QuadSetNearestAC(globalCtx, at, &D_8015E598)) { + if (Collider_QuadSetNearestAC(play, at, &D_8015E598)) { Vec3f atPos; Vec3f acPos; @@ -2474,7 +2474,7 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &D_8015E598); return; } @@ -2486,7 +2486,7 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex /** * Sets a ColliderJntSph's hit effects */ -void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderJntSph* jntSph = (ColliderJntSph*)collider; ColliderJntSphElement* element; Vec3f hitPos; @@ -2495,7 +2495,7 @@ void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckConte if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && (element->info.acHitInfo != NULL) && !(element->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &element->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, element->info.acHit, element->info.acHitInfo, &jntSph->base, + CollisionCheck_HitEffects(play, element->info.acHit, element->info.acHitInfo, &jntSph->base, &element->info, &hitPos); element->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; return; @@ -2506,14 +2506,14 @@ void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckConte /** * Sets a ColliderCylinder's hit effects */ -void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; Vec3f hitPos; if ((cylinder->info.bumperFlags & BUMP_DRAW_HITMARK) && (cylinder->info.acHitInfo != NULL) && !(cylinder->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &cylinder->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, cylinder->info.acHit, cylinder->info.acHitInfo, &cylinder->base, + CollisionCheck_HitEffects(play, cylinder->info.acHit, cylinder->info.acHitInfo, &cylinder->base, &cylinder->info, &hitPos); cylinder->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; } @@ -2522,7 +2522,7 @@ void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* /** * Sets a ColliderTris's hit effects */ -void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderTris* tris = (ColliderTris*)collider; ColliderTrisElement* element; Vec3f hitPos; @@ -2531,7 +2531,7 @@ void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && (element->info.acHitInfo != NULL) && !(element->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &element->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, element->info.acHit, element->info.acHitInfo, &tris->base, + CollisionCheck_HitEffects(play, element->info.acHit, element->info.acHitInfo, &tris->base, &element->info, &hitPos); element->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; return; @@ -2542,14 +2542,14 @@ void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext /** * Sets a ColliderQuad's hit effects */ -void CollisionCheck_SetQuadHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetQuadHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; Vec3f hitPos; if ((quad->info.bumperFlags & BUMP_DRAW_HITMARK) && (quad->info.acHitInfo != NULL) && !(quad->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &quad->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, quad->info.acHit, quad->info.acHitInfo, &quad->base, &quad->info, &hitPos); + CollisionCheck_HitEffects(play, quad->info.acHit, quad->info.acHitInfo, &quad->base, &quad->info, &hitPos); quad->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; } } @@ -2564,7 +2564,7 @@ static ColChkApplyFunc sColChkApplyFuncs[] = { /** * Handles hit effects for each AC collider that had an AC collision. Spawns hitmarks and plays sound effects. */ -void CollisionCheck_SetHitEffects(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_SetHitEffects(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** col; for (col = colChkCtx->colAC; col < colChkCtx->colAC + colChkCtx->colACCount; col++) { @@ -2574,7 +2574,7 @@ void CollisionCheck_SetHitEffects(GlobalContext* globalCtx, CollisionCheckContex if (colAC->actor != NULL && colAC->actor->update == NULL) { continue; } - sColChkApplyFuncs[colAC->shape](globalCtx, colChkCtx, colAC); + sColChkApplyFuncs[colAC->shape](play, colChkCtx, colAC); } } } @@ -2593,7 +2593,7 @@ static ColChkVsFunc sACVsFuncs[4][4] = { /** * Iterates through all AC colliders, performing AC collisions with the AT collider. */ -void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT) { +void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT) { Collider** col; for (col = colChkCtx->colAC; col < colChkCtx->colAC + colChkCtx->colACCount; col++) { @@ -2607,7 +2607,7 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCt if (!(colAT->atFlags & AT_SELF) && colAT->actor != NULL && colAC->actor == colAT->actor) { continue; } - sACVsFuncs[colAT->shape][colAC->shape](globalCtx, colChkCtx, colAT, colAC); + sACVsFuncs[colAT->shape][colAC->shape](play, colChkCtx, colAT, colAC); } } } @@ -2619,7 +2619,7 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCt * successful collision. To collide, an AT collider must share a type (AC_TYPE_PLAYER, AC_TYPE_ENEMY, or AC_TYPE_OTHER) * with the AC collider and the toucher and bumper elements that overlapped must share a dmgFlag. */ -void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** col; if (colChkCtx->colATCount == 0 || colChkCtx->colACCount == 0) { @@ -2632,10 +2632,10 @@ void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colChkCt if (colAT->actor != NULL && colAT->actor->update == NULL) { continue; } - CollisionCheck_AC(globalCtx, colChkCtx, colAT); + CollisionCheck_AC(play, colChkCtx, colAT); } } - CollisionCheck_SetHitEffects(globalCtx, colChkCtx); + CollisionCheck_SetHitEffects(play, colChkCtx); } /** @@ -2749,7 +2749,7 @@ void CollisionCheck_SetOCvsOC(Collider* left, ColliderInfo* leftInfo, Vec3f* lef /** * OC overlap check for two JntSphs */ -void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, +void CollisionCheck_OC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { ColliderJntSph* left = (ColliderJntSph*)l; ColliderJntSphElement* leftElem; @@ -2783,7 +2783,7 @@ void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * OC overlap check for a JntSph and Cylinder */ -void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, +void CollisionCheck_OC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { ColliderJntSph* left = (ColliderJntSph*)l; ColliderJntSphElement* leftElem; @@ -2813,15 +2813,15 @@ void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte /** * OC overlap check for a Cylinder and JntSph */ -void CollisionCheck_OC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, +void CollisionCheck_OC_CylVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { - CollisionCheck_OC_JntSphVsCyl(globalCtx, colChkCtx, r, l); + CollisionCheck_OC_JntSphVsCyl(play, colChkCtx, r, l); } /** * OC overlap check for two Cylinders */ -void CollisionCheck_OC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { +void CollisionCheck_OC_CylVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { ColliderCylinder* left = (ColliderCylinder*)l; ColliderCylinder* right = (ColliderCylinder*)r; f32 deadSpace; @@ -2883,7 +2883,7 @@ static ColChkVsFunc sOCVsFuncs[4][4] = { * can collide, and each collider must have the OC flag corresponding to the other's OC type. Additionally, OC2_UNK1 * cannot collide with OC2_UNK2, nor can two colliders that share an actor. */ -void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_OC(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** left; Collider** right; ColChkVsFunc vsFunc; @@ -2903,7 +2903,7 @@ void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colChkCt osSyncPrintf("CollisionCheck_OC():未対応 %d, %d\n", (*left)->shape, (*right)->shape); continue; } - vsFunc(globalCtx, colChkCtx, *left, *right); + vsFunc(play, colChkCtx, *left, *right); } } } @@ -2975,7 +2975,7 @@ void CollisionCheck_SetInfoGetDamageTable(CollisionCheckInfo* info, s32 index, C /** * Apply AC damage effect */ -void CollisionCheck_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, +void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, ColliderInfo* info) { DamageTable* tbl; f32 damage; @@ -3015,13 +3015,13 @@ void CollisionCheck_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* /** * Apply ColliderJntSph AC damage effect */ -void CollisionCheck_ApplyDamageJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderJntSph* jntSph = (ColliderJntSph*)collider; s32 i; if (jntSph->count > 0 && jntSph->elements != NULL) { for (i = 0; i < jntSph->count; i++) { - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, &jntSph->base, &jntSph->elements[i].info); + CollisionCheck_ApplyDamage(play, colChkCtx, &jntSph->base, &jntSph->elements[i].info); } } } @@ -3029,29 +3029,29 @@ void CollisionCheck_ApplyDamageJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * Apply ColliderCylinder AC damage effect */ -void CollisionCheck_ApplyDamageCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, &cylinder->base, &cylinder->info); + CollisionCheck_ApplyDamage(play, colChkCtx, &cylinder->base, &cylinder->info); } /** * Apply ColliderTris AC damage effect */ -void CollisionCheck_ApplyDamageTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderTris* tris = (ColliderTris*)collider; s32 i; for (i = 0; i < tris->count; i++) { - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, collider, &tris->elements[i].info); + CollisionCheck_ApplyDamage(play, colChkCtx, collider, &tris->elements[i].info); } } /** * Apply ColliderQuad AC damage effect */ -void CollisionCheck_ApplyDamageQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, &quad->base, &quad->info); + CollisionCheck_ApplyDamage(play, colChkCtx, &quad->base, &quad->info); } static ColChkApplyFunc sApplyDamageFuncs[4] = { @@ -3065,7 +3065,7 @@ static ColChkApplyFunc sApplyDamageFuncs[4] = { * For all AC colliders, sets any damage effects from collisions with AT colliders to their corresponding actor's * CollisionCheckInfo. */ -void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_Damage(PlayState* play, CollisionCheckContext* colChkCtx) { s32 i; for (i = 0; i < colChkCtx->colACCount; i++) { @@ -3077,14 +3077,14 @@ void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colC if (collider->acFlags & AC_NO_DAMAGE) { continue; } - sApplyDamageFuncs[collider->shape](globalCtx, colChkCtx, collider); + sApplyDamageFuncs[collider->shape](play, colChkCtx, collider); } } /** * Checks if the line ab intersects any of the ColliderJntSph's elements */ -s32 CollisionCheck_LineOC_JntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, +s32 CollisionCheck_LineOC_JntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b) { static Linef D_8015E610; ColliderJntSph* jntSph = (ColliderJntSph*)collider; @@ -3108,7 +3108,7 @@ s32 CollisionCheck_LineOC_JntSph(GlobalContext* globalCtx, CollisionCheckContext /** * Checks if the line segment ab intersects the ColliderCylinder */ -s32 CollisionCheck_LineOC_Cyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, +s32 CollisionCheck_LineOC_Cyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b) { static Vec3f D_8015E628; static Vec3f D_8015E638; @@ -3134,7 +3134,7 @@ static ColChkLineFunc sOCLineCheckFuncs[4] = { * 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, +s32 CollisionCheck_LineOC(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions) { ColChkLineFunc lineCheck; Collider** col; @@ -3161,7 +3161,7 @@ s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colCh // "type %d not supported" osSyncPrintf("CollisionCheck_generalLineOcCheck():未対応 %dタイプ\n", (*col)->shape); } else { - result = lineCheck(globalCtx, colChkCtx, (*col), a, b); + result = lineCheck(play, colChkCtx, (*col), a, b); if (result) { break; } @@ -3174,17 +3174,17 @@ s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colCh * Checks if the line segment ab intersects any OC colliders. Returns true if there are any intersections and false * otherwise. Unused. */ -s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b) { - return CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, NULL, 0); +s32 CollisionCheck_LineOCCheckAll(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b) { + return CollisionCheck_LineOC(play, colChkCtx, a, b, NULL, 0); } /** * Checks if the line segment ab intersects any OC colliders, excluding those attached to actors on the exclusion list. * Returns true if there are any intersections and false otherwise. */ -s32 CollisionCheck_LineOCCheck(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, +s32 CollisionCheck_LineOCCheck(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions) { - return CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, exclusions, numExclusions); + return CollisionCheck_LineOC(play, colChkCtx, a, b, exclusions, numExclusions); } /** @@ -3239,10 +3239,10 @@ void Collider_SetTrisVertices(ColliderTris* collider, s32 index, Vec3f* a, Vec3f /** * Sets the specified ColliderTrisElement's dim using the values in src */ -void Collider_SetTrisDim(GlobalContext* globalCtx, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* src) { +void Collider_SetTrisDim(PlayState* play, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* src) { ColliderTrisElement* element = &collider->elements[index]; - Collider_SetTrisElementDim(globalCtx, &element->dim, src); + Collider_SetTrisElementDim(play, &element->dim, src); } // Due to an unknown reason, bss ordering changed between the 2 static Vec3f variables in the function below. @@ -3281,7 +3281,7 @@ void Collider_UpdateSpheres(s32 limb, ColliderJntSph* collider) { * Spawns red blood droplets. * No actor has a collision type that spawns red blood. */ -void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnRedBlood(PlayState* play, Vec3f* v) { static EffectSparkInit D_8015CF10; s32 effectIndex; @@ -3327,14 +3327,14 @@ void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { D_8015CF10.speed = 8.0f; D_8015CF10.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015CF10); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015CF10); } /** * Spawns water droplets. * No actor has a collision type that spawns water droplets. */ -void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnWaterDroplets(PlayState* play, Vec3f* v) { static EffectSparkInit D_8015D3D8; s32 effectIndex; @@ -3380,13 +3380,13 @@ void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { D_8015D3D8.speed = 8.0f; D_8015D3D8.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015D3D8); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_8015D3D8); } /** * 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 initMetal = { 16, { 0, 0, 0 }, @@ -3412,36 +3412,36 @@ void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v) { initMetal.lightPoint.y = initMetal.position.y; initMetal.lightPoint.z = initMetal.position.z; - Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &initMetal); + Effect_Add(play, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &initMetal); } /** * Spawns streaks of light and makes a metallic sound */ -void CollisionCheck_SpawnShieldParticlesMetal(GlobalContext* globalCtx, Vec3f* v) { - CollisionCheck_SpawnShieldParticles(globalCtx, v); +void CollisionCheck_SpawnShieldParticlesMetal(PlayState* play, Vec3f* v) { + CollisionCheck_SpawnShieldParticles(play, v); Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_SW, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } /** * Spawns streaks of light and makes a metallic sound at the specified position */ -void CollisionCheck_SpawnShieldParticlesMetalSound(GlobalContext* globalCtx, Vec3f* v, Vec3f* pos) { - CollisionCheck_SpawnShieldParticles(globalCtx, v); +void CollisionCheck_SpawnShieldParticlesMetalSound(PlayState* play, Vec3f* v, Vec3f* pos) { + CollisionCheck_SpawnShieldParticles(play, v); Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_SW, pos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } /** * Spawns streaks of light and makes a metallic sound */ -void CollisionCheck_SpawnShieldParticlesMetal2(GlobalContext* globalCtx, Vec3f* v) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, v); +void CollisionCheck_SpawnShieldParticlesMetal2(PlayState* play, Vec3f* v) { + CollisionCheck_SpawnShieldParticlesMetal(play, v); } /** * Spawns streaks of light and makes a wooden sound */ -void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, Vec3f* actorPos) { +void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* actorPos) { static EffectShieldParticleInit initWood = { 16, { 0, 0, 0 }, @@ -3467,7 +3467,7 @@ void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, initWood.lightPoint.y = initWood.position.y; initWood.lightPoint.z = initWood.position.z; - Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &initWood); + Effect_Add(play, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &initWood); Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, actorPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } diff --git a/soh/src/code/z_construct.c b/soh/src/code/z_construct.c index 08497fe1c..6c5f6e21d 100644 --- a/soh/src/code/z_construct.c +++ b/soh/src/code/z_construct.c @@ -1,19 +1,19 @@ #include "global.h" #include -void func_80110990(GlobalContext* globalCtx) { - Map_Destroy(globalCtx); +void func_80110990(PlayState* play) { + Map_Destroy(play); } -void func_801109B0(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_801109B0(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; u32 parameterSize; u8 temp; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0; - View_Init(&interfaceCtx->view, globalCtx->state.gfxCtx); + View_Init(&interfaceCtx->view, play->state.gfxCtx); interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0; interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0; @@ -33,7 +33,7 @@ void func_801109B0(GlobalContext* globalCtx) { // "Permanent PARAMETER Segment = %x" osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize); - interfaceCtx->parameterSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, parameterSize); + interfaceCtx->parameterSegment = GAMESTATE_ALLOC_MC(&play->state, parameterSize); osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment); @@ -41,7 +41,7 @@ void func_801109B0(GlobalContext* globalCtx) { DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (uintptr_t)_parameter_staticSegmentRomStart, parameterSize, __FILE__, 162); - interfaceCtx->doActionSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, 0x480); + interfaceCtx->doActionSegment = GAMESTATE_ALLOC_MC(&play->state, 0x480); osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480); // "DO Action Texture Initialization" osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->doActionSegment); @@ -55,7 +55,7 @@ void func_801109B0(GlobalContext* globalCtx) { memcpy(interfaceCtx->doActionSegment + attackDoActionTexSize, ResourceMgr_LoadTexByName(gReturnDoActionENGTex), ResourceMgr_LoadTexSizeByName(gReturnDoActionENGTex)); interfaceCtx->iconItemSegment = GAMESTATE_ALLOC_MC( - &globalCtx->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems)); + &play->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems)); // "Icon Item Texture Initialization = %x" osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000); @@ -118,8 +118,8 @@ void func_801109B0(GlobalContext* globalCtx) { osSyncPrintf("PARAMETER領域=%x\n", parameterSize + 0x5300); // "Parameter Area = %x" - HealthMeter_Init(globalCtx); - Map_Init(globalCtx); + HealthMeter_Init(play); + Map_Init(play); interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0; @@ -136,29 +136,29 @@ void func_801109B0(GlobalContext* globalCtx) { R_A_BTN_COLOR(2) = 50; } -void Message_Init(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_Init(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; s32 pad; Message_SetTables(); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; msgCtx->msgMode = MSGMODE_NONE; msgCtx->msgLength = 0; msgCtx->textId = msgCtx->textboxEndType = msgCtx->choiceIndex = msgCtx->ocarinaAction = msgCtx->textUnskippable = 0; msgCtx->textColorAlpha = 255; - View_Init(&msgCtx->view, globalCtx->state.gfxCtx); + View_Init(&msgCtx->view, play->state.gfxCtx); - msgCtx->textboxSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, 0x2200); + msgCtx->textboxSegment = GAMESTATE_ALLOC_MC(&play->state, 0x2200); osSyncPrintf("message->fukidashiSegment=%x\n", msgCtx->textboxSegment); osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200); // "Textbox game_alloc=%x" ASSERT(msgCtx->textboxSegment != NULL); - Font_LoadOrderedFont(&globalCtx->msgCtx.font); + Font_LoadOrderedFont(&play->msgCtx.font); YREG(31) = 0; } @@ -572,6 +572,6 @@ void func_80111070(void) { VREG(92) = -63; } -void func_80112098(GlobalContext* globalCtx) { +void func_80112098(PlayState* play) { func_80111070(); } diff --git a/soh/src/code/z_debug_display.c b/soh/src/code/z_debug_display.c index 14a75aa41..48cca9149 100644 --- a/soh/src/code/z_debug_display.c +++ b/soh/src/code/z_debug_display.c @@ -6,10 +6,10 @@ typedef struct { /* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw function when called } DebugDispObjectInfo; // size = 0x8 -typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, GlobalContext*); +typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, PlayState*); -void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx); -void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx); +void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play); +void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play); static DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] = { DebugDisplay_DrawSpriteI8, @@ -55,43 +55,43 @@ DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, return sDebugObjectListHead; } -void DebugDisplay_DrawObjects(GlobalContext* globalCtx) { +void DebugDisplay_DrawObjects(PlayState* play) { DebugDispObject* dispObj = sDebugObjectListHead; DebugDispObjectInfo* objInfo; while (dispObj != NULL) { objInfo = &sDebugObjectInfoTable[dispObj->type]; - sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, globalCtx); + sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, play); dispObj = dispObj->next; } } -void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80094678(globalCtx->state.gfxCtx); + func_80094678(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZYX(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY); gDPLoadTextureBlock(POLY_XLU_DISP++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gDebugSpriteDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8009435C(globalCtx->state.gfxCtx); + func_8009435C(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); @@ -100,9 +100,9 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalConte Matrix_SetTranslateRotateYXZ(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/code/z_demo.c b/soh/src/code/z_demo.c index a447f549c..8f5a5fd31 100644 --- a/soh/src/code/z_demo.c +++ b/soh/src/code/z_demo.c @@ -34,14 +34,14 @@ u16 D_8011E1C0 = 0; u16 D_8011E1C4 = 0; -typedef void (*CutsceneStateHandler)(GlobalContext*, CutsceneContext*); +typedef void (*CutsceneStateHandler)(PlayState*, CutsceneContext*); -void func_80064720(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx); +void func_80064720(PlayState* play, CutsceneContext* csCtx); +void func_80064760(PlayState* play, CutsceneContext* csCtx); +void func_800647C0(PlayState* play, CutsceneContext* csCtx); +void func_80068C3C(PlayState* play, CutsceneContext* csCtx); +void func_80068D84(PlayState* play, CutsceneContext* csCtx); +void func_80068DC0(PlayState* play, CutsceneContext* csCtx); CutsceneStateHandler sCsStateHandlers1[] = { func_80064720, func_80064760, func_80064720, func_80068D84, func_80064720, @@ -105,9 +105,9 @@ u16 D_8015FCCC; // only written to, never read char D_8015FCD0[20]; // unreferenced u8 D_8015FCE4; // only written to, never read -void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx); +void func_80068ECC(PlayState* play, CutsceneContext* csCtx); -void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneContext* csCtx) { +void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx) { GfxPrint printer; s32 pad[2]; @@ -127,30 +127,30 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte GfxPrint_Destroy(&printer); } -void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_8006450C(PlayState* play, CutsceneContext* csCtx) { csCtx->state = CS_STATE_IDLE; csCtx->unk_0C = 0.0f; } -void func_80064520(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064520(PlayState* play, CutsceneContext* csCtx) { csCtx->state = CS_STATE_SKIPPABLE_INIT; csCtx->linkAction = NULL; } -void func_80064534(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064534(PlayState* play, CutsceneContext* csCtx) { if (csCtx->state != CS_STATE_UNSKIPPABLE_EXEC) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; } } -void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064558(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.cutsceneIndex < 0xFFF0) { - sCsStateHandlers1[csCtx->state](globalCtx, csCtx); + sCsStateHandlers1[csCtx->state](play, csCtx); } } -void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) { - Input* input = &globalCtx->state.input[0]; +void func_800645A0(PlayState* play, CutsceneContext* csCtx) { + Input* input = &play->state.input[0]; if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4)) { @@ -166,7 +166,7 @@ void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) { gSaveContext.cutsceneTrigger = 1; } - if ((gSaveContext.cutsceneTrigger != 0) && (globalCtx->sceneLoadFlag == 0x14)) { + if ((gSaveContext.cutsceneTrigger != 0) && (play->sceneLoadFlag == 0x14)) { gSaveContext.cutsceneTrigger = 0; } @@ -177,42 +177,42 @@ void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) { } if (gSaveContext.cutsceneIndex >= 0xFFF0) { - func_80068ECC(globalCtx, csCtx); - sCsStateHandlers2[csCtx->state](globalCtx, csCtx); + func_80068ECC(play, csCtx); + sCsStateHandlers2[csCtx->state](play, csCtx); } } -void func_80064720(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064720(PlayState* play, CutsceneContext* csCtx) { } -u32 func_8006472C(GlobalContext* globalCtx, CutsceneContext* csCtx, f32 target) { +u32 func_8006472C(PlayState* play, CutsceneContext* csCtx, f32 target) { return Math_StepToF(&csCtx->unk_0C, target, 0.1f); } -void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064760(PlayState* play, CutsceneContext* csCtx) { Interface_ChangeAlpha(1); ShrinkWindow_SetVal(0x20); - if (func_8006472C(globalCtx, csCtx, 1.0f)) { + if (func_8006472C(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(1); csCtx->state++; } } -void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) { - func_80068C3C(globalCtx, csCtx); +void func_800647C0(PlayState* play, CutsceneContext* csCtx) { + func_80068C3C(play, csCtx); Interface_ChangeAlpha(1); ShrinkWindow_SetVal(0x20); - if (func_8006472C(globalCtx, csCtx, 1.0f)) { + if (func_8006472C(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(1); csCtx->state++; } } // Command 3: Misc. Actions -void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { - Player* player = GET_PLAYER(globalCtx); +void func_80064824(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { + Player* player = GET_PLAYER(play); f32 temp; u8 sp3F = 0; @@ -231,60 +231,60 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* if (sp3F != 0) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, 0x3F); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1); - globalCtx->envCtx.unk_EE[0] = 20; + play->envCtx.unk_EE[0] = 20; } break; case 2: if (sp3F != 0) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); - Environment_AddLightningBolts(globalCtx, 3); + Environment_AddLightningBolts(play, 3); gLightningStrike.state = LIGHTNING_STRIKE_START; } break; case 3: if (sp3F != 0) { - Flags_SetEnv(globalCtx, 0); + Flags_SetEnv(play, 0); if (gSaveContext.entranceIndex == 0x0053 || (gSaveContext.n64ddFlag && gSaveContext.entranceIndex == 0x05F4)) { - Flags_SetEnv(globalCtx, 2); + Flags_SetEnv(play, 2); } } break; case 6: - if (globalCtx->envCtx.adjFogFar < 12800) { - globalCtx->envCtx.adjFogFar += 35; + if (play->envCtx.adjFogFar < 12800) { + play->envCtx.adjFogFar += 35; } break; case 7: if (sp3F != 0) { - globalCtx->envCtx.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_22 = globalCtx->envCtx.unk_24 = 0x3C; + 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_22 = play->envCtx.unk_24 = 0x3C; } break; case 8: - if (globalCtx->roomCtx.unk_74[0] < 0x80) { - globalCtx->roomCtx.unk_74[0] += 4; + if (play->roomCtx.unk_74[0] < 0x80) { + play->roomCtx.unk_74[0] += 4; } break; case 9: - globalCtx->envCtx.unk_EE[3] = 16; + play->envCtx.unk_EE[3] = 16; break; case 10: - Flags_SetEnv(globalCtx, 1); + Flags_SetEnv(play, 1); break; case 11: - if (globalCtx->roomCtx.unk_74[0] < 0x672) { - globalCtx->roomCtx.unk_74[0] += 0x14; + if (play->roomCtx.unk_74[0] < 0x672) { + play->roomCtx.unk_74[0] += 0x14; } if (csCtx->frames == 0x30F) { func_80078884(NA_SE_EV_DEKU_DEATH); } else if (csCtx->frames == 0x2CD) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; } break; case 12: @@ -295,27 +295,27 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } break; case 13: - if (globalCtx->roomCtx.unk_74[1] == 0) { + if (play->roomCtx.unk_74[1] == 0) { func_80078884(NA_SE_EV_TRIFORCE_FLASH); } - if (globalCtx->roomCtx.unk_74[1] < 0xFF) { - globalCtx->roomCtx.unk_74[1] += 5; + if (play->roomCtx.unk_74[1] < 0xFF) { + play->roomCtx.unk_74[1] += 5; } break; case 14: if (sp3F != 0) { - func_800BC490(globalCtx, 1); + func_800BC490(play, 1); } break; case 15: if (sp3F != 0) { - TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, player->giObjectSegment, 160, 120, + TitleCard_InitPlaceName(play, &play->actorCtx.titleCtx, player->giObjectSegment, 160, 120, 144, 24, 20); } break; case 16: if (sp3F != 0) { - sQuakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); + sQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(sQuakeIndex, 0x7FFF); Quake_SetQuakeValues(sQuakeIndex, 4, 0, 1000, 0); Quake_SetCountdown(sQuakeIndex, 800); @@ -327,12 +327,12 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } break; case 18: - globalCtx->envCtx.unk_EE[0] = 0; - globalCtx->envCtx.gloomySkyMode = 2; + play->envCtx.unk_EE[0] = 0; + play->envCtx.gloomySkyMode = 2; if (gSaveContext.dayTime < 0x4AAB) { gSaveContext.dayTime += 30; } - if (globalCtx->envCtx.unk_EE[1] == 0) { + if (play->envCtx.unk_EE[1] == 0) { gWeatherMode = 0; Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); } @@ -359,7 +359,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* D_801614B0.a = 255.0f * temp; break; case 24: - globalCtx->roomCtx.curRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; break; case 25: gSaveContext.dayTime += 30; @@ -370,44 +370,44 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* case 26: if ((gSaveContext.dayTime < 0x3000) || (gSaveContext.dayTime >= 0x4555)) { if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime < 0xAAAB)) { - globalCtx->envCtx.unk_BF = 1; + play->envCtx.unk_BF = 1; } else if ((gSaveContext.dayTime >= 0xAAAB) && (gSaveContext.dayTime < 0xC556)) { - globalCtx->envCtx.unk_BF = 2; + play->envCtx.unk_BF = 2; } else { - globalCtx->envCtx.unk_BF = 3; + play->envCtx.unk_BF = 3; } } break; case 27: - if (globalCtx->state.frames & 8) { - if (globalCtx->envCtx.adjAmbientColor[0] < 40) { - globalCtx->envCtx.adjAmbientColor[0] += 2; - globalCtx->envCtx.adjLight1Color[1] -= 3; - globalCtx->envCtx.adjLight1Color[2] -= 3; + if (play->state.frames & 8) { + if (play->envCtx.adjAmbientColor[0] < 40) { + play->envCtx.adjAmbientColor[0] += 2; + play->envCtx.adjLight1Color[1] -= 3; + play->envCtx.adjLight1Color[2] -= 3; } } else { - if (globalCtx->envCtx.adjAmbientColor[0] > 2) { - globalCtx->envCtx.adjAmbientColor[0] -= 2; - globalCtx->envCtx.adjLight1Color[1] += 3; - globalCtx->envCtx.adjLight1Color[2] += 3; + if (play->envCtx.adjAmbientColor[0] > 2) { + play->envCtx.adjAmbientColor[0] -= 2; + play->envCtx.adjLight1Color[1] += 3; + play->envCtx.adjLight1Color[2] += 3; } } break; case 28: - globalCtx->unk_11DE9 = 1; + play->unk_11DE9 = 1; break; case 29: - globalCtx->unk_11DE9 = 0; + play->unk_11DE9 = 0; break; case 30: - Flags_SetEnv(globalCtx, 3); + Flags_SetEnv(play, 3); break; case 31: - Flags_SetEnv(globalCtx, 4); + Flags_SetEnv(play, 4); break; case 32: if (sp3F != 0) { - globalCtx->envCtx.sandstormState = 1; + play->envCtx.sandstormState = 1; } func_800788CC(NA_SE_EV_SAND_STORM - SFX_FLAG); break; @@ -429,29 +429,29 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } // Command 4: Set Environment Lighting -void Cutscene_Command_SetLighting(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdEnvLighting* cmd) { +void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmdEnvLighting* cmd) { if (csCtx->frames == cmd->startFrame) { - globalCtx->envCtx.unk_BF = cmd->setting - 1; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BF = cmd->setting - 1; + play->envCtx.unk_D8 = 1.0f; } } // Command 0x56: Play Background Music -void Cutscene_Command_PlayBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { +void Cutscene_Command_PlayBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { if (csCtx->frames == cmd->startFrame) { func_800F595C(cmd->sequence - 1); } } // Command 0x57: Stop Background Music -void Cutscene_Command_StopBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { +void Cutscene_Command_StopBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { if (csCtx->frames == cmd->startFrame) { func_800F59E8(cmd->sequence - 1); } } // Command 0x7C: Fade Background Music over duration -void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicFade* cmd) { +void Cutscene_Command_FadeBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusicFade* cmd) { u8 var1; if ((csCtx->frames == cmd->startFrame) && (csCtx->frames < cmd->endFrame)) { @@ -466,14 +466,14 @@ void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, } // Command 9: ? -void Cutscene_Command_09(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdUnknown9* cmd) { +void Cutscene_Command_09(PlayState* play, CutsceneContext* csCtx, CsCmdUnknown9* cmd) { if (csCtx->frames == cmd->startFrame) { func_800AA000(0.0f, cmd->unk_06, cmd->unk_07, cmd->unk_08); } } // Command 0x8C: Set Time of Day & Environment Time -void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTime* cmd) { +void func_80065134(PlayState* play, CutsceneContext* csCtx, CsCmdDayTime* cmd) { s16 temp1; s16 temp2; @@ -487,8 +487,8 @@ void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTim } // Command 0x3E8: Code Execution (& Terminates Cutscene?) -void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { - Player* player = GET_PLAYER(globalCtx); +void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { + Player* player = GET_PLAYER(play); s32 temp = 0; // Automatically skip certain cutscenes when in rando @@ -496,15 +496,15 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt // cmd->base == 24: Dropping a fish for Jabu Jabu // cmd->base == 33: Zelda escaping with impa cutscene bool randoCsSkip = (gSaveContext.n64ddFlag && (cmd->base == 8 || cmd->base == 24 || cmd->base == 33)); - bool debugCsSkip = (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) && + bool debugCsSkip = (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && (gSaveContext.fileNum != 0xFEDC) && CVar_GetS32("gDebugEnabled", 0)); - if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3) && (globalCtx->sceneNum != SCENE_SPOT00) && + if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3) && (play->sceneNum != SCENE_SPOT00) && (csCtx->frames > 20) && - (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START)) && - (gSaveContext.fileNum != 0xFEDC) && (globalCtx->sceneLoadFlag == 0)) { + (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START)) && + (gSaveContext.fileNum != 0xFEDC) && (play->sceneLoadFlag == 0)) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); temp = 1; } @@ -525,477 +525,477 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt switch (cmd->base) { case 1: - globalCtx->nextEntranceIndex = 0x00A0; + play->nextEntranceIndex = 0x00A0; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 2: - globalCtx->nextEntranceIndex = 0x00A0; + play->nextEntranceIndex = 0x00A0; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 10; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 10; break; case 3: - globalCtx->nextEntranceIndex = 0x0117; + play->nextEntranceIndex = 0x0117; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 10; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 10; break; case 4: - globalCtx->nextEntranceIndex = 0x013D; + play->nextEntranceIndex = 0x013D; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 10; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 10; break; case 5: - globalCtx->nextEntranceIndex = 0x00EE; + play->nextEntranceIndex = 0x00EE; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 10; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 10; break; case 6: - globalCtx->nextEntranceIndex = 0x00A0; + play->nextEntranceIndex = 0x00A0; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 10; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 10; break; case 7: - globalCtx->nextEntranceIndex = 0x00EE; + play->nextEntranceIndex = 0x00EE; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 11; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 11; break; case 8: gSaveContext.fw.set = 0; gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; if (!(gSaveContext.eventChkInf[4] & 0x20)) { gSaveContext.eventChkInf[4] |= 0x20; - globalCtx->nextEntranceIndex = 0x00A0; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00A0; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->fadeTransition = 11; + play->fadeTransition = 11; } else { if (gSaveContext.sceneSetupIndex < 4) { if (!LINK_IS_ADULT) { - globalCtx->linkAgeOnLoad = 0; + play->linkAgeOnLoad = 0; } else { - globalCtx->linkAgeOnLoad = 1; + play->linkAgeOnLoad = 1; } } - globalCtx->nextEntranceIndex = 0x02CA; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x02CA; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; } break; case 9: - globalCtx->nextEntranceIndex = 0x0117; + play->nextEntranceIndex = 0x0117; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 12; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 12; break; case 10: - globalCtx->nextEntranceIndex = 0x00BB; + play->nextEntranceIndex = 0x00BB; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 11: - globalCtx->nextEntranceIndex = 0x00EE; + play->nextEntranceIndex = 0x00EE; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; break; case 12: - globalCtx->nextEntranceIndex = 0x047A; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x047A; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 13: - globalCtx->nextEntranceIndex = 0x010E; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x010E; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; gSaveContext.nextTransition = 2; break; case 14: - globalCtx->nextEntranceIndex = 0x0457; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0457; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 15: - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 16: - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 17: - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 18: gSaveContext.eventChkInf[4] |= 0x8000; - globalCtx->nextEntranceIndex = 0x0324; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0324; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; gSaveContext.nextTransition = 2; break; case 19: - globalCtx->nextEntranceIndex = 0x013D; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 4; + play->nextEntranceIndex = 0x013D; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 4; gSaveContext.cutsceneIndex = 0x8000; break; case 21: - globalCtx->nextEntranceIndex = 0x0102; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0102; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 22: - Item_Give(globalCtx, ITEM_SONG_REQUIEM); - globalCtx->nextEntranceIndex = 0x0123; - globalCtx->sceneLoadFlag = 0x14; + Item_Give(play, ITEM_SONG_REQUIEM); + play->nextEntranceIndex = 0x0123; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 23: - globalCtx->nextEntranceIndex = 0x00A0; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00A0; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF8; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 24: - globalCtx->nextEntranceIndex = 0x0028; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0028; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 25: - globalCtx->linkAgeOnLoad = 0; - globalCtx->nextEntranceIndex = 0x006B; - globalCtx->sceneLoadFlag = 0x14; + play->linkAgeOnLoad = 0; + play->nextEntranceIndex = 0x006B; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 26: - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 27: - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 28: - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 29: - globalCtx->nextEntranceIndex = 0x006B; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x006B; + play->sceneLoadFlag = 0x14; gSaveContext.chamberCutsceneNum = 0; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 30: - globalCtx->nextEntranceIndex = 0x006B; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); + play->nextEntranceIndex = 0x006B; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; + Item_Give(play, ITEM_MEDALLION_FIRE); gSaveContext.chamberCutsceneNum = 1; break; case 31: - globalCtx->nextEntranceIndex = 0x006B; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x006B; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.chamberCutsceneNum = 2; break; case 32: - globalCtx->linkAgeOnLoad = 1; - globalCtx->nextEntranceIndex = 0x00CD; - globalCtx->sceneLoadFlag = 0x14; + play->linkAgeOnLoad = 1; + play->nextEntranceIndex = 0x00CD; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->fadeTransition = 11; + play->fadeTransition = 11; break; case 33: - globalCtx->nextEntranceIndex = 0x00CD; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x00CD; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; break; case 34: - globalCtx->nextEntranceIndex = 0x00A0; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00A0; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; case 35: - globalCtx->nextEntranceIndex = 0x00CD; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00CD; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; break; case 38: - globalCtx->nextEntranceIndex = 0x00A0; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00A0; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; break; case 39: - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF9; - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; break; case 40: - globalCtx->linkAgeOnLoad = 0; - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->linkAgeOnLoad = 0; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFFA; - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; break; case 41: - globalCtx->nextEntranceIndex = 0x04E6; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x04E6; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 42: - globalCtx->nextEntranceIndex = 0x00DB; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00DB; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; break; case 43: - globalCtx->nextEntranceIndex = 0x0503; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 4; + play->nextEntranceIndex = 0x0503; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 4; break; case 44: - globalCtx->nextEntranceIndex = 0x0320; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 17; + play->nextEntranceIndex = 0x0320; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 17; break; case 46: gSaveContext.eventChkInf[4] |= 0x8000; - globalCtx->nextEntranceIndex = 0x0324; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 4; + play->nextEntranceIndex = 0x0324; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 4; break; case 47: - Item_Give(globalCtx, ITEM_SONG_NOCTURNE); + Item_Give(play, ITEM_SONG_NOCTURNE); gSaveContext.eventChkInf[5] |= 0x10; - globalCtx->nextEntranceIndex = 0x00DB; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00DB; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; break; case 48: - globalCtx->nextEntranceIndex = 0x01ED; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 15; + play->nextEntranceIndex = 0x01ED; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 15; gSaveContext.nextTransition = 15; break; case 49: - globalCtx->nextEntranceIndex = 0x058C; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 4; + play->nextEntranceIndex = 0x058C; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 4; break; case 50: - globalCtx->nextEntranceIndex = 0x0513; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 17; + play->nextEntranceIndex = 0x0513; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 17; break; case 51: - globalCtx->nextEntranceIndex = 0x00CD; + play->nextEntranceIndex = 0x00CD; gSaveContext.cutsceneIndex = 0xFFF8; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 41; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 41; break; case 52: - globalCtx->nextEntranceIndex = 0x0053; + play->nextEntranceIndex = 0x0053; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 11; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 11; break; case 53: - globalCtx->nextEntranceIndex = 0x050F; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x050F; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; break; case 54: gSaveContext.gameMode = 3; Audio_SetSoundBanksMute(0x6F); - globalCtx->linkAgeOnLoad = 1; - globalCtx->nextEntranceIndex = 0x0117; + play->linkAgeOnLoad = 1; + play->nextEntranceIndex = 0x0117; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 55: - globalCtx->nextEntranceIndex = 0x0129; + play->nextEntranceIndex = 0x0129; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 56: - globalCtx->nextEntranceIndex = 0x00DB; + play->nextEntranceIndex = 0x00DB; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 57: - globalCtx->nextEntranceIndex = 0x013D; + play->nextEntranceIndex = 0x013D; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 58: - globalCtx->nextEntranceIndex = 0x014D; + play->nextEntranceIndex = 0x014D; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 59: - globalCtx->nextEntranceIndex = 0x0102; + play->nextEntranceIndex = 0x0102; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 60: - globalCtx->nextEntranceIndex = 0x010E; + play->nextEntranceIndex = 0x010E; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 61: - globalCtx->nextEntranceIndex = 0x0108; + play->nextEntranceIndex = 0x0108; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 62: - globalCtx->linkAgeOnLoad = 0; - globalCtx->nextEntranceIndex = 0x00EE; + play->linkAgeOnLoad = 0; + play->nextEntranceIndex = 0x00EE; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 63: - globalCtx->nextEntranceIndex = 0x00EE; + play->nextEntranceIndex = 0x00EE; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 64: - globalCtx->nextEntranceIndex = 0x00CD; + play->nextEntranceIndex = 0x00CD; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 65: - globalCtx->linkAgeOnLoad = 1; - globalCtx->nextEntranceIndex = 0x0157; + play->linkAgeOnLoad = 1; + play->nextEntranceIndex = 0x0157; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 66: - globalCtx->nextEntranceIndex = 0x0554; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0554; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 67: - globalCtx->nextEntranceIndex = 0x027E; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x027E; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 68: - globalCtx->nextEntranceIndex = 0x00A0; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00A0; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 69: - globalCtx->nextEntranceIndex = 0x05E8; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x05E8; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 70: - globalCtx->nextEntranceIndex = 0x013D; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x013D; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; gSaveContext.nextTransition = 2; break; case 71: gSaveContext.equips.equipment |= 0x0100; - Player_SetEquipmentData(globalCtx, player); + Player_SetEquipmentData(play, player); gSaveContext.equips.equipment |= 0x1000; - Player_SetEquipmentData(globalCtx, player); - globalCtx->linkAgeOnLoad = 1; - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + Player_SetEquipmentData(play, player); + play->linkAgeOnLoad = 1; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 72: - globalCtx->nextEntranceIndex = 0x0400; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0400; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; gSaveContext.nextTransition = 2; break; case 73: - globalCtx->linkAgeOnLoad = 1; - globalCtx->nextEntranceIndex = 0x0157; - globalCtx->sceneLoadFlag = 0x14; + play->linkAgeOnLoad = 1; + play->nextEntranceIndex = 0x0157; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 74: - globalCtx->nextEntranceIndex = 0x0157; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0157; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; break; case 75: - globalCtx->linkAgeOnLoad = 1; - globalCtx->nextEntranceIndex = 0x0157; - globalCtx->sceneLoadFlag = 0x14; + play->linkAgeOnLoad = 1; + play->nextEntranceIndex = 0x0157; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 76: - globalCtx->linkAgeOnLoad = 0; - globalCtx->nextEntranceIndex = 0x0157; - globalCtx->sceneLoadFlag = 0x14; + play->linkAgeOnLoad = 0; + play->nextEntranceIndex = 0x0157; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 77: - globalCtx->linkAgeOnLoad = 1; - globalCtx->nextEntranceIndex = 0x0157; - globalCtx->sceneLoadFlag = 0x14; + play->linkAgeOnLoad = 1; + play->nextEntranceIndex = 0x0157; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 78: - globalCtx->nextEntranceIndex = 0x0157; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0157; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 79: case 80: @@ -1012,176 +1012,176 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt case 91: case 92: case 93: - globalCtx->nextEntranceIndex = 0x0157; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0157; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 94: - globalCtx->nextEntranceIndex = 0x02AE; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x02AE; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; break; case 95: if ((gSaveContext.eventChkInf[4] & 0x100) && (gSaveContext.eventChkInf[4] & 0x200) && (gSaveContext.eventChkInf[4] & 0x400)) { - globalCtx->nextEntranceIndex = 0x0053; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0053; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; } else { switch (gSaveContext.sceneSetupIndex) { case 8: - globalCtx->nextEntranceIndex = 0x00FC; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x00FC; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 9: - globalCtx->nextEntranceIndex = 0x0147; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0147; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 10: - globalCtx->nextEntranceIndex = 0x0102; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0102; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; break; } } break; case 96: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { - globalCtx->nextEntranceIndex = 0x006B; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x006B; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 5; + play->fadeTransition = 5; } else { gSaveContext.eventChkInf[12] |= 0x100; - globalCtx->nextEntranceIndex = 0x0610; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x0610; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; } break; case 97: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { - globalCtx->nextEntranceIndex = 0x006B; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x006B; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 5; + play->fadeTransition = 5; } else { - globalCtx->nextEntranceIndex = 0x0580; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x0580; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; } break; case 98: - globalCtx->nextEntranceIndex = 0x0564; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x0564; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; break; case 99: - globalCtx->nextEntranceIndex = 0x0608; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0608; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; gSaveContext.nextTransition = 2; break; case 100: - globalCtx->nextEntranceIndex = 0x00EE; + play->nextEntranceIndex = 0x00EE; gSaveContext.cutsceneIndex = 0xFFF8; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; break; case 101: - globalCtx->nextEntranceIndex = 0x01F5; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 15; + play->nextEntranceIndex = 0x01F5; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 15; break; case 102: - globalCtx->nextEntranceIndex = 0x0590; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0590; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 103: - globalCtx->nextEntranceIndex = 0x00CD; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00CD; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 104: switch (sTitleCsState) { case 0: - globalCtx->nextEntranceIndex = 0x008D; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x008D; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; sTitleCsState++; break; case 1: - globalCtx->nextEntranceIndex = 0x0147; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0147; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; sTitleCsState++; break; case 2: - globalCtx->nextEntranceIndex = 0x00A0; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00A0; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; sTitleCsState = 0; break; } break; case 105: - globalCtx->nextEntranceIndex = 0x00E4; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x00E4; + play->sceneLoadFlag = 0x14; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; break; case 106: - globalCtx->nextEntranceIndex = 0x0574; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0574; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 107: - globalCtx->nextEntranceIndex = 0x0538; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0538; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 108: - globalCtx->nextEntranceIndex = 0x053C; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x053C; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 109: - globalCtx->nextEntranceIndex = 0x0540; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0540; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 110: - globalCtx->nextEntranceIndex = 0x0544; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0544; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 111: - globalCtx->nextEntranceIndex = 0x0548; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0548; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 112: - globalCtx->nextEntranceIndex = 0x054C; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x054C; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 113: if (Flags_GetEventChkInf(0xBB) && Flags_GetEventChkInf(0xBC) && Flags_GetEventChkInf(0xBD) && Flags_GetEventChkInf(0xBE) && Flags_GetEventChkInf(0xBF) && Flags_GetEventChkInf(0xAD)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); - globalCtx->csCtx.frames = 0; + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); + play->csCtx.frames = 0; gSaveContext.cutsceneTrigger = 1; gSaveContext.cutsceneIndex = 0xFFFF; csCtx->state = CS_STATE_UNSKIPPABLE_INIT; @@ -1191,70 +1191,70 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt } break; case 114: - globalCtx->nextEntranceIndex = 0x0185; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0185; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; case 115: - globalCtx->nextEntranceIndex = 0x0594; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0594; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; gSaveContext.nextTransition = 2; break; case 116: if (gSaveContext.eventChkInf[12] & 0x100) { - globalCtx->nextEntranceIndex = 0x0580; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x0580; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; } else { - globalCtx->nextEntranceIndex = 0x0610; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x0610; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; } gSaveContext.nextTransition = 3; break; case 117: gSaveContext.gameMode = 3; Audio_SetSoundBanksMute(0x6F); - globalCtx->linkAgeOnLoad = 0; - globalCtx->nextEntranceIndex = 0x00CD; + play->linkAgeOnLoad = 0; + play->nextEntranceIndex = 0x00CD; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; break; case 118: gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = 0x0517; - Gameplay_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); gSaveContext.respawnFlag = -2; gSaveContext.nextTransition = 2; break; case 119: gSaveContext.dayTime = 0x8000; gSaveContext.skyboxTime = 0x8000; - globalCtx->nextEntranceIndex = 0x05F0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = 0x05F0; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; break; } } } // Command 0x2D: Transition Effects -void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_TransitionFX(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { f32 temp; if ((csCtx->frames >= cmd->startFrame) && (csCtx->frames <= cmd->endFrame)) { - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; temp = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames); switch (cmd->base) { case 1: case 5: - globalCtx->envCtx.screenFillColor[0] = 160; - globalCtx->envCtx.screenFillColor[1] = 160; - globalCtx->envCtx.screenFillColor[2] = 160; + play->envCtx.screenFillColor[0] = 160; + play->envCtx.screenFillColor[1] = 160; + play->envCtx.screenFillColor[2] = 160; if (cmd->base == 1) { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; if ((temp == 0.0f) && (gSaveContext.entranceIndex == 0x006B)) { Audio_PlaySoundGeneral(NA_SE_SY_WHITE_OUT_S, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -1263,44 +1263,44 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs (gSaveContext.entranceIndex == 0x0371))) { Audio_PlaySoundGeneral(NA_SE_EV_WHITE_OUT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } else if ((temp == 0.0f) && (globalCtx->sceneNum == SCENE_GANONTIKA)) { + } else if ((temp == 0.0f) && (play->sceneNum == SCENE_GANONTIKA)) { func_800788CC(NA_SE_EV_WHITE_OUT); } } else { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } break; case 2: case 6: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 255; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 255; if (cmd->base == 2) { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } else { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } break; case 3: case 7: - globalCtx->envCtx.screenFillColor[0] = 255; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[0] = 255; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; if (cmd->base == 3) { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } break; case 4: case 8: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 255; - globalCtx->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 255; + play->envCtx.screenFillColor[2] = 0; if (cmd->base == 4) { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } break; case 9: @@ -1308,30 +1308,30 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs break; case 10: case 11: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; if (cmd->base == 10) { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } break; case 12: gSaveContext.unk_1410 = 255.0f - (155.0f * temp); break; case 13: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[3] = 255.0f - ((1.0f - temp) * 155.0f); + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[3] = 255.0f - ((1.0f - temp) * 155.0f); break; } } } // Command 0x1 & 0x5: Camera Positions -size_t Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { +size_t Cutscene_Command_CameraPositions(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = true; CsCmdBase* cmdBase = (CsCmdBase*)cmd; size_t size; @@ -1346,12 +1346,12 @@ size_t Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContex if (csCtx->unk_1A != 0) { csCtx->unk_18 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_CS_0); - Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); - Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14)); - Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus, - csCtx->cameraPosition, GET_PLAYER(globalCtx), relativeToLink); + Play_CameraChangeSetting(play, csCtx->unk_14, CAM_SET_CS_0); + Play_ChangeCameraStatus(play, D_8015FCC6, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->unk_14, CAM_STAT_ACTIVE); + Camera_ResetAnim(Play_GetCamera(play, csCtx->unk_14)); + Camera_SetCSParams(Play_GetCamera(play, csCtx->unk_14), csCtx->cameraFocus, + csCtx->cameraPosition, GET_PLAYER(play), relativeToLink); } } } @@ -1368,7 +1368,7 @@ size_t Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContex } // Command 0x2 & 0x6: Camera Focus Points -size_t Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { +size_t Cutscene_Command_CameraFocus(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = true; CsCmdBase* cmdBase = (CsCmdBase*)cmd; size_t size; @@ -1383,12 +1383,12 @@ size_t Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* c if (csCtx->unk_1B != 0) { D_8015FCC0 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_CS_0); - Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); - Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14)); - Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus, - csCtx->cameraPosition, GET_PLAYER(globalCtx), relativeToLink); + Play_CameraChangeSetting(play, csCtx->unk_14, CAM_SET_CS_0); + Play_ChangeCameraStatus(play, D_8015FCC6, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->unk_14, CAM_STAT_ACTIVE); + Camera_ResetAnim(Play_GetCamera(play, csCtx->unk_14)); + Camera_SetCSParams(Play_GetCamera(play, csCtx->unk_14), csCtx->cameraFocus, + csCtx->cameraPosition, GET_PLAYER(play), relativeToLink); } } } @@ -1405,7 +1405,7 @@ size_t Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* c } // Command 0x7: ? (Related to camera positons) -size_t Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) { +size_t Cutscene_Command_07(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unused) { CsCmdBase* cmdBase = (CsCmdBase*)cmd; size_t size; Vec3f sp3C; @@ -1423,11 +1423,11 @@ size_t Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* if (csCtx->unk_1A != 0) { D_8015FCC2 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14); + sp2C = Play_GetCamera(play, csCtx->unk_14); sp2C->player = NULL; - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->unk_14, CAM_STAT_ACTIVE); + Play_CameraChangeSetting(play, csCtx->unk_14, CAM_SET_FREE0); sp28 = csCtx->cameraFocus->cameraRoll * 1.40625f; Camera_SetParam(sp2C, 64, &sp28); sp3C.x = csCtx->cameraFocus->pos.x; @@ -1436,8 +1436,8 @@ size_t Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* sp30.x = csCtx->cameraPosition->pos.x; sp30.y = csCtx->cameraPosition->pos.y; sp30.z = csCtx->cameraPosition->pos.z; - Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30); - Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle); + Play_CameraSetAtEye(play, csCtx->unk_14, &sp3C, &sp30); + Play_CameraSetFov(play, csCtx->unk_14, csCtx->cameraPosition->viewAngle); } } } @@ -1448,7 +1448,7 @@ size_t Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* } // Command 0x8: ? (Related to camera focus points) -size_t Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) { +size_t Cutscene_Command_08(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unused) { CsCmdBase* cmdBase = (CsCmdBase*)cmd; size_t size; Vec3f sp3C; @@ -1466,19 +1466,19 @@ size_t Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* if (csCtx->unk_1B != 0) { D_8015FCC4 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14); + sp2C = Play_GetCamera(play, csCtx->unk_14); sp2C->player = NULL; - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->unk_14, CAM_STAT_ACTIVE); + Play_CameraChangeSetting(play, csCtx->unk_14, CAM_SET_FREE0); sp3C.x = csCtx->cameraFocus->pos.x; sp3C.y = csCtx->cameraFocus->pos.y; sp3C.z = csCtx->cameraFocus->pos.z; sp30.x = csCtx->cameraPosition->pos.x; sp30.y = csCtx->cameraPosition->pos.y; sp30.z = csCtx->cameraPosition->pos.z; - Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30); - Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle); + Play_CameraSetAtEye(play, csCtx->unk_14, &sp3C, &sp30); + Play_CameraSetFov(play, csCtx->unk_14, csCtx->cameraPosition->viewAngle); } } } @@ -1489,7 +1489,7 @@ size_t Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* } // Command 0x13: Textbox -void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdTextbox* cmd) { +void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdTextbox* cmd) { u8 dialogState; s16 originalCsFrames; @@ -1498,40 +1498,40 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, if (D_8011E1C0 != cmd->base) { D_8011E1C0 = cmd->base; if ((cmd->type == 3) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) { - Message_StartTextbox(globalCtx, cmd->textId1, NULL); + Message_StartTextbox(play, cmd->textId1, NULL); } else if ((cmd->type == 4) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { - Message_StartTextbox(globalCtx, cmd->textId1, NULL); + Message_StartTextbox(play, cmd->textId1, NULL); } else { - Message_StartTextbox(globalCtx, cmd->base, NULL); + Message_StartTextbox(play, cmd->base, NULL); } return; } } else { if (D_8011E1C4 != cmd->base) { D_8011E1C4 = cmd->base; - func_8010BD58(globalCtx, cmd->base); + func_8010BD58(play, cmd->base); return; } } if (csCtx->frames >= cmd->endFrame) { originalCsFrames = csCtx->frames; - dialogState = Message_GetState(&globalCtx->msgCtx); + dialogState = Message_GetState(&play->msgCtx); if ((dialogState != TEXT_STATE_CLOSING) && (dialogState != TEXT_STATE_NONE) && (dialogState != TEXT_STATE_SONG_DEMO_DONE) && (dialogState != TEXT_STATE_8)) { csCtx->frames--; - if ((dialogState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if ((dialogState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { if (cmd->textId1 != 0xFFFF) { - Message_ContinueTextbox(globalCtx, cmd->textId1); + Message_ContinueTextbox(play, cmd->textId1); } else { csCtx->frames++; } } else { if (cmd->textId2 != 0xFFFF) { - Message_ContinueTextbox(globalCtx, cmd->textId2); + Message_ContinueTextbox(play, cmd->textId2); } else { csCtx->frames++; } @@ -1540,15 +1540,15 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, if (dialogState == TEXT_STATE_9) { if (cmd->textId1 != 0xFFFF) { - Message_ContinueTextbox(globalCtx, cmd->textId1); + Message_ContinueTextbox(play, cmd->textId1); } else { csCtx->frames++; } } if (dialogState == TEXT_STATE_EVENT) { - if (Message_ShouldAdvance(globalCtx)) { - func_8010BD58(globalCtx, cmd->base); + if (Message_ShouldAdvance(play)) { + func_8010BD58(play, cmd->base); } } } @@ -1562,7 +1562,7 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } } -void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cutscenePtr) { +void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr) { s16 i; s32 totalEntries; s32 cmdType; @@ -1584,7 +1584,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, return; } - if (CVar_GetS32("gDebugEnabled", 0) && CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_DRIGHT)) { + if (CVar_GetS32("gDebugEnabled", 0) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; return; } @@ -1604,7 +1604,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, memcpy(&cmdEntries, cutscenePtr, sizeof(CutsceneData)); cutscenePtr += sizeof(CutsceneData); for (j = 0; j < cmdEntries; j++) { - func_80064824(globalCtx, csCtx, (void*)cutscenePtr); + func_80064824(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 12; } break; @@ -1612,7 +1612,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, memcpy(&cmdEntries, cutscenePtr, sizeof(CutsceneData)); cutscenePtr += sizeof(CutsceneData); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_SetLighting(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_SetLighting(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 12; } break; @@ -1620,7 +1620,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, memcpy(&cmdEntries, cutscenePtr, sizeof(CutsceneData)); cutscenePtr += sizeof(CutsceneData); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_PlayBGM(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_PlayBGM(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 12; } break; @@ -1628,7 +1628,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, memcpy(&cmdEntries, cutscenePtr, sizeof(CutsceneData)); cutscenePtr += sizeof(CutsceneData); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_StopBGM(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_StopBGM(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 12; } break; @@ -1636,7 +1636,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, memcpy(&cmdEntries, cutscenePtr, sizeof(CutsceneData)); cutscenePtr += sizeof(CutsceneData); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeBGM(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_FadeBGM(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 12; } break; @@ -1644,7 +1644,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, memcpy(&cmdEntries, cutscenePtr, sizeof(CutsceneData)); cutscenePtr += sizeof(CutsceneData); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_09(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_09(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 3; } break; @@ -1652,7 +1652,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, memcpy(&cmdEntries, cutscenePtr, sizeof(CutsceneData)); cutscenePtr += sizeof(CutsceneData); for (j = 0; j < cmdEntries; j++) { - func_80065134(globalCtx, csCtx, (void*)cutscenePtr); + func_80065134(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 3; } break; @@ -1864,26 +1864,26 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, } break; case CS_CMD_CAM_EYE: - cutscenePtr += Cutscene_Command_CameraPositions(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_CameraPositions(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_CAM_EYE_REL_TO_PLAYER: - cutscenePtr += Cutscene_Command_CameraPositions(globalCtx, csCtx, (void*)cutscenePtr, 1); + cutscenePtr += Cutscene_Command_CameraPositions(play, csCtx, (void*)cutscenePtr, 1); break; case CS_CMD_CAM_AT: - cutscenePtr += Cutscene_Command_CameraFocus(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_CameraFocus(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_CAM_AT_REL_TO_PLAYER: - cutscenePtr += Cutscene_Command_CameraFocus(globalCtx, csCtx, (void*)cutscenePtr, 1); + cutscenePtr += Cutscene_Command_CameraFocus(play, csCtx, (void*)cutscenePtr, 1); break; case CS_CMD_07: - cutscenePtr += Cutscene_Command_07(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_07(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_08: - cutscenePtr += Cutscene_Command_08(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_08(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_TERMINATOR: cutscenePtr += 4; - Cutscene_Command_Terminator(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_Terminator(play, csCtx, (void*)cutscenePtr); cutscenePtr += 8; break; case CS_CMD_TEXTBOX: @@ -1892,14 +1892,14 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; if (cmd->base != 0xFFFF) { - Cutscene_Command_Textbox(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_Textbox(play, csCtx, (void*)cutscenePtr); } cutscenePtr += sizeof(CutsceneData) * 3; } break; case CS_CMD_SCENE_TRANS_FX: cutscenePtr += sizeof(CutsceneData); - Cutscene_Command_TransitionFX(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_TransitionFX(play, csCtx, (void*)cutscenePtr); cutscenePtr += sizeof(CutsceneData) * 2; break; default: @@ -1913,46 +1913,46 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, } } -void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80068C3C(PlayState* play, CutsceneContext* csCtx) { Gfx* displayList; Gfx* prevDisplayList; if (gSaveContext.cutsceneIndex >= 0xFFF0) { if (BREG(0) != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); prevDisplayList = POLY_OPA_DISP; displayList = Graph_GfxPlusOne(POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, displayList); - Cutscene_DrawDebugInfo(globalCtx, &displayList, csCtx); + Cutscene_DrawDebugInfo(play, &displayList, csCtx); gSPEndDisplayList(displayList++); Graph_BranchDlist(prevDisplayList, displayList); POLY_OPA_DISP = displayList; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } csCtx->frames++; if (dREG(95) != 0) { - Cutscene_ProcessCommands(globalCtx, csCtx, D_8012D1F0); + Cutscene_ProcessCommands(play, csCtx, D_8012D1F0); } else { - Cutscene_ProcessCommands(globalCtx, csCtx, globalCtx->csCtx.segment); + Cutscene_ProcessCommands(play, csCtx, play->csCtx.segment); } } } -void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if (func_8006472C(globalCtx, csCtx, 0.0f)) { +void func_80068D84(PlayState* play, CutsceneContext* csCtx) { + if (func_8006472C(play, csCtx, 0.0f)) { Audio_SetCutsceneFlag(0); csCtx->state = CS_STATE_IDLE; } } -void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80068DC0(PlayState* play, CutsceneContext* csCtx) { s16 i; - if (func_8006472C(globalCtx, csCtx, 0.0f)) { + if (func_8006472C(play, csCtx, 0.0f)) { csCtx->linkAction = NULL; for (i = 0; i < 10; i++) { @@ -1969,12 +1969,12 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { case 0x028E: case 0x0292: case 0x0476: - Gameplay_CopyCamera(globalCtx, D_8015FCC6, csCtx->unk_14); + Play_CopyCamera(play, D_8015FCC6, csCtx->unk_14); } - Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, csCtx->unk_14); - func_8005B1A4(globalCtx->cameraPtrs[D_8015FCC6]); + Play_ChangeCameraStatus(play, D_8015FCC6, CAM_STAT_ACTIVE); + Play_ClearCamera(play, csCtx->unk_14); + func_8005B1A4(play->cameraPtrs[D_8015FCC6]); } Audio_SetCutsceneFlag(0); @@ -1982,15 +1982,15 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { } } -void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80068ECC(PlayState* play, CutsceneContext* csCtx) { u8 i; - if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(globalCtx)) { + if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { gSaveContext.cutsceneIndex = 0xFFFD; } if ((gSaveContext.cutsceneIndex >= 0xFFF0) && (csCtx->state == CS_STATE_IDLE)) { - Flags_UnsetEnv(globalCtx, 0); + Flags_UnsetEnv(play, 0); D_8011E1C0 = 0; D_8011E1C4 = 0; @@ -2013,10 +2013,10 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { D_8015FCC4 = 0xFFFF; csCtx->unk_1A = 0; csCtx->unk_1B = 0; - D_8015FCC6 = globalCtx->activeCamera; + D_8015FCC6 = play->activeCamera; if (D_8015FCC8 != 0) { - csCtx->unk_14 = Gameplay_CreateSubCamera(globalCtx); + csCtx->unk_14 = Play_CreateSubCamera(play); } if (gSaveContext.cutsceneTrigger == 0) { @@ -2026,14 +2026,14 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { csCtx->state++; } - func_80068C3C(globalCtx, csCtx); + func_80068C3C(play, csCtx); } gSaveContext.cutsceneTrigger = 0; } } -void func_80069048(GlobalContext* globalCtx) { +void func_80069048(PlayState* play) { s16 i; D_8015FCCC = 0; @@ -2043,13 +2043,13 @@ void func_80069048(GlobalContext* globalCtx) { D_8015FCE4 = 0; } -void func_8006907C(GlobalContext* globalCtx) { +void func_8006907C(PlayState* play) { if (D_8015FCCC != 0) { D_8015FCCC = 0; } } -void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) { +void Cutscene_HandleEntranceTriggers(PlayState* play) { EntranceCutscene* entranceCutscene; u8 requiredAge; s16 i; @@ -2079,7 +2079,7 @@ void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) { (gSaveContext.cutsceneIndex < 0xFFF0) && ((u8)gSaveContext.linkAge == requiredAge) && (gSaveContext.respawnFlag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); - Cutscene_SetSegment(globalCtx, entranceCutscene->segAddr); + Cutscene_SetSegment(play, entranceCutscene->segAddr); gSaveContext.cutsceneTrigger = 2; gSaveContext.showTitleCard = false; break; @@ -2087,7 +2087,7 @@ void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) { } } -void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) { +void Cutscene_HandleConditionalTriggers(PlayState* play) { osSyncPrintf("\ngame_info.mode=[%d] restart_flag", ((void)0, gSaveContext.respawnFlag)); if ((gSaveContext.gameMode == 0) && (gSaveContext.respawnFlag <= 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) { @@ -2109,7 +2109,7 @@ void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) { } else if ((gSaveContext.entranceIndex == 0x05E0) && !Flags_GetEventChkInf(0xC1)) { if (!gSaveContext.n64ddFlag) { Flags_SetEventChkInf(0xC1); - Item_Give(globalCtx, ITEM_OCARINA_FAIRY); + Item_Give(play, ITEM_OCARINA_FAIRY); gSaveContext.entranceIndex = 0x011E; gSaveContext.cutsceneIndex = 0xFFF0; } @@ -2137,11 +2137,11 @@ void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) { } } -void Cutscene_SetSegment(GlobalContext* globalCtx, void* segment) { +void Cutscene_SetSegment(PlayState* play, void* segment) { if (SEGMENT_NUMBER(segment) != 0) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(segment); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(segment); } else { - globalCtx->csCtx.segment = segment; + play->csCtx.segment = segment; } } diff --git a/soh/src/code/z_draw.c b/soh/src/code/z_draw.c index 7d98c8e2c..041c5a0eb 100644 --- a/soh/src/code/z_draw.c +++ b/soh/src/code/z_draw.c @@ -79,40 +79,40 @@ #include "objects/object_st/object_st.h" // "Get Item" Model Draw Functions -void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawJewel(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawGenericMusicNote(GlobalContext* globalCtx, s16 drawId); +void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId); +void GetItem_DrawSoldOut(PlayState* play, s16 drawId); +void GetItem_DrawBlueFire(PlayState* play, s16 drawId); +void GetItem_DrawPoes(PlayState* play, s16 drawId); +void GetItem_DrawFairy(PlayState* play, s16 drawId); +void GetItem_DrawMirrorShield(PlayState* play, s16 drawId); +void GetItem_DrawSkullToken(PlayState* play, s16 drawId); +void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId); +void GetItem_DrawCompass(PlayState* play, s16 drawId); +void GetItem_DrawPotion(PlayState* play, s16 drawId); +void GetItem_DrawGoronSword(PlayState* play, s16 drawId); +void GetItem_DrawDekuNuts(PlayState* play, s16 drawId); +void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId); +void GetItem_DrawFish(PlayState* play, s16 drawId); +void GetItem_DrawOpa0(PlayState* play, s16 drawId); +void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId); +void GetItem_DrawXlu01(PlayState* play, s16 drawId); +void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId); +void GetItem_DrawMagicArrow(PlayState* play, s16 drawId); +void GetItem_DrawMagicSpell(PlayState* play, s16 drawId); +void GetItem_DrawOpa1023(PlayState* play, s16 drawId); +void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId); +void GetItem_DrawSmallRupee(PlayState* play, s16 drawId); +void GetItem_DrawScale(PlayState* play, s16 drawId); +void GetItem_DrawBulletBag(PlayState* play, s16 drawId); +void GetItem_DrawWallet(PlayState* play, s16 drawId); +void GetItem_DrawJewel(PlayState* play, s16 drawId); +void GetItem_DrawJewelKokiri(PlayState* play, s16 drawId); +void GetItem_DrawJewelGoron(PlayState* play, s16 drawId); +void GetItem_DrawJewelZora(PlayState* play, s16 drawId); +void GetItem_DrawGenericMusicNote(PlayState* play, s16 drawId); typedef struct { - /* 0x00 */ void (*drawFunc)(GlobalContext*, s16); + /* 0x00 */ void (*drawFunc)(PlayState*, s16); /* 0x04 */ Gfx* dlists[8]; } DrawItemTableEntry; // size = 0x24 @@ -391,21 +391,21 @@ DrawItemTableEntry sDrawItemTable[] = { * Draw "Get Item" Model * Calls the corresponding draw function for the given draw ID */ -void GetItem_Draw(GlobalContext* globalCtx, s16 drawId) { - sDrawItemTable[drawId].drawFunc(globalCtx, drawId); +void GetItem_Draw(PlayState* play, s16 drawId) { + sDrawItemTable[drawId].drawFunc(play, drawId); } /** * Draw "Get Item" Model from a `GetItemEntry` * Uses the Custom Draw Function if it exists, or just calls `GetItem_Draw` */ -void GetItemEntry_Draw(GlobalContext* globalCtx, GetItemEntry getItemEntry) { +void GetItemEntry_Draw(PlayState* play, GetItemEntry getItemEntry) { // RANDOTODO: Make this more flexible for easier toggling of individual item recolors in the future. if (getItemEntry.drawFunc != NULL && (CVar_GetS32("gRandoMatchKeyColors", 0) || getItemEntry.getItemId == RG_DOUBLE_DEFENSE)) { - getItemEntry.drawFunc(globalCtx, &getItemEntry); + getItemEntry.drawFunc(play, &getItemEntry); } else { - GetItem_Draw(globalCtx, getItemEntry.gid); + GetItem_Draw(play, getItemEntry.gid); } } @@ -416,7 +416,7 @@ void GetItemEntry_Draw(GlobalContext* globalCtx, GetItemEntry getItemEntry) { /* 0x017E */ u8 primOpaColor[3]; /* 0x0181 */ u8 envOpaColor[3]; -void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawJewelKokiri(PlayState* play, s16 drawId) { primXluColor[2] = 160; primXluColor[0] = 255; primXluColor[1] = 255; @@ -430,10 +430,10 @@ void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId) { envOpaColor[0] = 150; envOpaColor[2] = 0; - GetItem_DrawJewel(globalCtx, drawId); + GetItem_DrawJewel(play, drawId); } -void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawJewelGoron(PlayState* play, s16 drawId) { primXluColor[1] = 170; primXluColor[0] = 255; primXluColor[2] = 255; @@ -447,10 +447,10 @@ void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId) { envOpaColor[0] = 150; envOpaColor[2] = 0; - GetItem_DrawJewel(globalCtx, drawId); + GetItem_DrawJewel(play, drawId); } -void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawJewelZora(PlayState* play, s16 drawId) { primXluColor[0] = 50; primXluColor[1] = 255; primXluColor[2] = 255; @@ -464,355 +464,355 @@ void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId) { envOpaColor[0] = 150; envOpaColor[2] = 0; - GetItem_DrawJewel(globalCtx, drawId); + GetItem_DrawJewel(play, drawId); } -void GetItem_DrawJewel(GlobalContext* globalCtx, s16 drawId) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void GetItem_DrawJewel(PlayState* play, s16 drawId) { + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 % 256, (256 - (0 % 256)) - 1, 64, 64, 1, 0 % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 % 256, (256 - (0 % 256)) - 1, 64, 64, 1, 0 % 256, (256 - (0 % 256)) - 1, 16, 16)); - gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(globalCtx->state.gfxCtx, (u8)0, (u8)0, 16, 16)); + gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, (u8)0, (u8)0, 16, 16)); Matrix_Push(); Matrix_RotateZYX(0, -0x4000, 0x4000, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2597), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2597), G_MTX_NOPUSH | G_MTX_LOAD); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2599), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2599), G_MTX_NOPUSH | G_MTX_LOAD); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - // func_8002ED80(&this->actor, globalCtx, 0); + // func_8002ED80(&this->actor, play, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primXluColor[0], primXluColor[1], primXluColor[2], 255); gDPSetEnvColor(POLY_XLU_DISP++, envXluColor[0], envXluColor[1], envXluColor[2], 255); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D18(globalCtx->state.gfxCtx); - // func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + // func_8002EBCC(&this->actor, play, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, primOpaColor[0], primOpaColor[1], primOpaColor[2], 255); gDPSetEnvColor(POLY_OPA_DISP++, envOpaColor[0], envOpaColor[1], envOpaColor[2], 255); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093BA8(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawSoldOut(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawBlueFire(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 8), 16, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), + 0 * (play->state.frames * 0), 16, 32, 1, 1 * (play->state.frames * 1), + 1 * -(play->state.frames * 8), 16, 32)); Matrix_Push(); Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawPoes(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 6), 16, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), + 0 * (play->state.frames * 0), 16, 32, 1, 1 * (play->state.frames * 1), + 1 * -(play->state.frames * 6), 16, 32)); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawFairy(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 6), 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), + 0 * (play->state.frames * 0), 32, 32, 1, 1 * (play->state.frames * 1), + 1 * -(play->state.frames * 6), 32, 32)); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMirrorShield(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0) % 256, - 1 * (globalCtx->state.frames * 2) % 256, 64, 64, 1, - 0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0) % 256, + 1 * (play->state.frames * 2) % 256, 64, 64, 1, + 0 * (play->state.frames * 0) % 128, 1 * (play->state.frames * 1) % 128, 32, 32)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawSkullToken(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 1 * -(globalCtx->state.frames * 5), 32, 32, 1, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 32, 64)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), + 1 * -(play->state.frames * 5), 32, 32, 1, 0 * (play->state.frames * 0), + 0 * (play->state.frames * 0), 32, 64)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093BA8(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawCompass(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawPotion(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -1 * (globalCtx->state.frames * 1), - 1 * (globalCtx->state.frames * 1), 32, 32, 1, -1 * (globalCtx->state.frames * 1), - 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -1 * (play->state.frames * 1), + 1 * (play->state.frames * 1), 32, 32, 1, -1 * (play->state.frames * 1), + 1 * (play->state.frames * 1), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[5]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawGoronSword(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 1), - 0 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 1), - 0 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 1), + 0 * (play->state.frames * 1), 32, 32, 1, 0 * (play->state.frames * 1), + 0 * (play->state.frames * 1), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawDekuNuts(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6), + 1 * (play->state.frames * 6), 32, 32, 1, 1 * (play->state.frames * 6), + 1 * (play->state.frames * 6), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 3), 32, 32, 1, 0 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 1), + 1 * -(play->state.frames * 3), 32, 32, 1, 0 * (play->state.frames * 1), + 1 * -(play->state.frames * 2), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawFish(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 1 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 0), - 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), + 1 * (play->state.frames * 1), 32, 32, 1, 0 * (play->state.frames * 0), + 1 * (play->state.frames * 1), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa0(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawGenericMusicNote(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawGenericMusicNote(PlayState* play, s16 drawId) { s32 pad; s16 color_slot = drawId-120; //0 = generic s16* colors[7][3] = { @@ -825,195 +825,195 @@ void GetItem_DrawGenericMusicNote(GlobalContext* globalCtx, s16 drawId) { {146,146,146} //Storms }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, __FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, __FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); gsDPSetGrayscaleColor(POLY_XLU_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 255); gsSPGrayscale(POLY_XLU_DISP++, true); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); gsSPGrayscale(POLY_XLU_DISP++, false); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawXlu01(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMagicArrow(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMagicSpell(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), - 1 * -(globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 1), - -1 * (globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), + 1 * -(play->state.frames * 6), 32, 32, 1, 1 * (play->state.frames * 1), + -1 * (play->state.frames * 2), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa1023(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawSmallRupee(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawScale(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), - -1 * (globalCtx->state.frames * 2), 64, 64, 1, 1 * (globalCtx->state.frames * 4), - 1 * -(globalCtx->state.frames * 4), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), + -1 * (play->state.frames * 2), 64, 64, 1, 1 * (play->state.frames * 4), + 1 * -(play->state.frames * 4), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawBulletBag(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawWallet(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); @@ -1024,5 +1024,5 @@ void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) { gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[6]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[7]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/code/z_eff_shield_particle.c b/soh/src/code/z_eff_shield_particle.c index 27032a632..43934f4e0 100644 --- a/soh/src/code/z_eff_shield_particle.c +++ b/soh/src/code/z_eff_shield_particle.c @@ -55,7 +55,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; } @@ -66,10 +66,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/soh/src/code/z_eff_spark.c b/soh/src/code/z_eff_spark.c index 5ce627508..c96bffa55 100644 --- a/soh/src/code/z_eff_spark.c +++ b/soh/src/code/z_eff_spark.c @@ -134,7 +134,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; @@ -216,7 +216,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/soh/src/code/z_eff_ss_dead.c b/soh/src/code/z_eff_ss_dead.c index f03fcd343..65015b44f 100644 --- a/soh/src/code/z_eff_ss_dead.c +++ b/soh/src/code/z_eff_ss_dead.c @@ -1,11 +1,11 @@ #include "global.h" -void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; f32 absCos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); displayListHead = POLY_OPA_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); @@ -23,15 +23,15 @@ void func_80026230(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_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { Gfx* displayListHead; f32 cos; if (arg3 != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); cos = Math_CosS((0x4000 / arg3) * arg2); displayListHead = POLY_OPA_DISP; @@ -42,27 +42,27 @@ void func_80026400(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_80026608(GlobalContext* globalCtx) { +void func_80026608(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026690(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; f32 absCos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); displayListHead = POLY_XLU_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); @@ -80,14 +80,14 @@ void func_80026690(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_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026860(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); displayListHead = POLY_XLU_DISP; cos = Math_CosS((0x4000 / arg3) * arg2); @@ -98,16 +98,16 @@ void func_80026860(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_80026A6C(GlobalContext* globalCtx) { +void func_80026A6C(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - POLY_XLU_DISP = Gameplay_SetFog(globalCtx, POLY_XLU_DISP); + POLY_XLU_DISP = Play_SetFog(play, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/code/z_effect.c b/soh/src/code/z_effect.c index 5c2a12215..9accf8ec1 100644 --- a/soh/src/code/z_effect.c +++ b/soh/src/code/z_effect.c @@ -33,8 +33,8 @@ EffectInfo sEffectInfoTable[] = { }, }; -GlobalContext* Effect_GetGlobalCtx(void) { - return sEffectContext.globalCtx; +PlayState* Effect_GetPlayState(void) { + return sEffectContext.play; } void* Effect_GetByIndex(s32 index) { @@ -77,7 +77,7 @@ void Effect_InitStatus(EffectStatus* status) { status->unk_02 = 0; } -void Effect_InitContext(GlobalContext* globalCtx) { +void Effect_InitContext(PlayState* play) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { @@ -93,10 +93,10 @@ void Effect_InitContext(GlobalContext* globalCtx) { Effect_InitStatus(&sEffectContext.blures[i].status); } - sEffectContext.globalCtx = globalCtx; + sEffectContext.play = play; } -void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) { +void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) { s32 i; u32 slotFound; void* effect = NULL; @@ -104,7 +104,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg *pIndex = TOTAL_EFFECT_COUNT; - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(play) != true) { slotFound = false; switch (type) { case EFFECT_SPARK: @@ -178,13 +178,13 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) { } } -void Effect_UpdateAll(GlobalContext* globalCtx) { +void Effect_UpdateAll(PlayState* play) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { if (sEffectContext.sparks[i].status.active) { if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) { - Effect_Delete(globalCtx, i); + Effect_Delete(play, i); } } } @@ -192,7 +192,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { for (i = 0; i < BLURE_COUNT; i++) { if (sEffectContext.blures[i].status.active) { if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) { - Effect_Delete(globalCtx, i + SPARK_COUNT); + Effect_Delete(play, i + SPARK_COUNT); } } } @@ -200,13 +200,13 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { if (sEffectContext.shieldParticles[i].status.active) { if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) { - Effect_Delete(globalCtx, i + SPARK_COUNT + BLURE_COUNT); + Effect_Delete(play, i + SPARK_COUNT + BLURE_COUNT); } } } } -void Effect_Delete(GlobalContext* globalCtx, s32 index) { +void Effect_Delete(PlayState* play, s32 index) { if (index == TOTAL_EFFECT_COUNT) { return; } @@ -232,7 +232,7 @@ void Effect_Delete(GlobalContext* globalCtx, s32 index) { } } -void Effect_DeleteAll(GlobalContext* globalCtx) { +void Effect_DeleteAll(PlayState* play) { s32 i; osSyncPrintf("エフェクト総て解放\n"); // "All effect release" diff --git a/soh/src/code/z_effect_soft_sprite.c b/soh/src/code/z_effect_soft_sprite.c index e093edf38..96c4c7b7f 100644 --- a/soh/src/code/z_effect_soft_sprite.c +++ b/soh/src/code/z_effect_soft_sprite.c @@ -5,7 +5,7 @@ EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info" -void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) { +void EffectSs_InitInfo(PlayState* play, s32 tableSize) { u32 i; EffectSs* effectSs; EffectSsOverlay* overlay; @@ -17,7 +17,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) { } sEffectSsInfo.table = - GAMESTATE_ALLOC_MC(&globalCtx->state, tableSize * sizeof(EffectSs)); + GAMESTATE_ALLOC_MC(&play->state, tableSize * sizeof(EffectSs)); ASSERT(sEffectSsInfo.table != NULL); sEffectSsInfo.searchStartIndex = 0; @@ -34,7 +34,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) { } } -void EffectSs_ClearAll(GlobalContext* globalCtx) { +void EffectSs_ClearAll(PlayState* play) { u32 i; EffectSs* effectSs; EffectSsOverlay* overlay; @@ -155,10 +155,10 @@ s32 EffectSs_FindSlot(s32 priority, s32* pIndex) { return 0; } -void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) { +void EffectSs_Insert(PlayState* play, EffectSs* effectSs) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(play) != true) { if (EffectSs_FindSlot(effectSs->priority, &index) == 0) { sEffectSsInfo.searchStartIndex = index + 1; sEffectSsInfo.table[index] = *effectSs; @@ -167,7 +167,7 @@ void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) { } // original name: "EffectSoftSprite2_makeEffect" -void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams) { +void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) { s32 index; u32 overlaySize; EffectSsOverlay* overlayEntry; @@ -237,7 +237,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init sEffectSsInfo.table[index].priority = priority; sEffectSsInfo.table[index].epoch++; - if (initInfo->init(globalCtx, index, &sEffectSsInfo.table[index], initParams) == 0) { + if (initInfo->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) { osSyncPrintf(VT_FGCOL(GREEN)); // "Construction failed for some reason. The constructor returned an error. // Ceasing effect addition." @@ -249,7 +249,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init } } -void EffectSs_Update(GlobalContext* globalCtx, s32 index) { +void EffectSs_Update(PlayState* play, s32 index) { EffectSs* effectSs = &sEffectSsInfo.table[index]; if (effectSs->update != NULL) { @@ -261,11 +261,11 @@ void EffectSs_Update(GlobalContext* globalCtx, s32 index) { effectSs->pos.y += effectSs->velocity.y; effectSs->pos.z += effectSs->velocity.z; - effectSs->update(globalCtx, index, effectSs); + effectSs->update(play, index, effectSs); } } -void EffectSs_UpdateAll(GlobalContext* globalCtx) { +void EffectSs_UpdateAll(PlayState* play) { s32 i; for (i = 0; i < sEffectSsInfo.tableSize; i++) { @@ -278,28 +278,28 @@ void EffectSs_UpdateAll(GlobalContext* globalCtx) { } if (sEffectSsInfo.table[i].life > -1) { - EffectSs_Update(globalCtx, i); + EffectSs_Update(play, i); } } } -void EffectSs_Draw(GlobalContext* globalCtx, s32 index) { +void EffectSs_Draw(PlayState* play, s32 index) { EffectSs* effectSs = &sEffectSsInfo.table[index]; if (effectSs->draw != NULL) { FrameInterpolation_RecordOpenChild(effectSs, effectSs->epoch); - effectSs->draw(globalCtx, index, effectSs); + effectSs->draw(play, index, effectSs); FrameInterpolation_RecordCloseChild(); } } // original name: "EffectSoftSprite2_disp" -void EffectSs_DrawAll(GlobalContext* globalCtx) { - Lights* lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); +void EffectSs_DrawAll(PlayState* play) { + Lights* lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); s32 i; - Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL); - Lights_Draw(lights, globalCtx->state.gfxCtx); + Lights_BindAll(lights, play->lightCtx.listHead, NULL); + Lights_Draw(lights, play->state.gfxCtx); for (i = 0; i < sEffectSsInfo.tableSize; i++) { if (sEffectSsInfo.table[i].life > -1) { @@ -322,7 +322,7 @@ void EffectSs_DrawAll(GlobalContext* globalCtx) { EffectSs_Delete(&sEffectSsInfo.table[i]); } else { - EffectSs_Draw(globalCtx, i); + EffectSs_Draw(play, i); } } } diff --git a/soh/src/code/z_effect_soft_sprite_old_init.c b/soh/src/code/z_effect_soft_sprite_old_init.c index e3efdffaa..965e3a1f9 100644 --- a/soh/src/code/z_effect_soft_sprite_old_init.c +++ b/soh/src/code/z_effect_soft_sprite_old_init.c @@ -40,8 +40,8 @@ static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; // effects that use this draw function are responsible for making sure their regs line up with the usage here -void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* texture) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale; MtxF mfTrans; MtxF mfScale; @@ -49,14 +49,14 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur MtxF mfTrans11DA0; s32 pad1; Mtx* mtx; - void* object = globalCtx->objectCtx.status[this->rgObjBankIdx].segment; + void* object = play->objectCtx.status[this->rgObjBankIdx].segment; OPEN_DISPS(gfxCtx); scale = this->rgScale * 0.0025f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, scale); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); @@ -78,7 +78,7 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur // EffectSsDust Spawn Functions -void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, u8 updateMode) { EffectSsDustInitParams initParams; @@ -94,86 +94,86 @@ void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec initParams.life = life; initParams.updateMode = updateMode; - EffectSs_Spawn(globalCtx, EFFECT_SS_DUST, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DUST, 128, &initParams); } -void func_8002829C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002829C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); } -void func_80028304(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028304(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); } -void func_8002836C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002836C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); } -void func_800283D4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800283D4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); } -void func_8002843C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002843C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); } // unused -void func_800284A4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800284A4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); + EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); } // unused -void func_80028510(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028510(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); + EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); } static Color_RGBA8 sDustBrownPrim = { 170, 130, 90, 255 }; static Color_RGBA8 sDustBrownEnv = { 100, 60, 20, 255 }; -void func_8002857C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); +void func_8002857C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } // unused -void func_800285EC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); +void func_800285EC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } -void func_8002865C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); +void func_8002865C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); } -void func_800286CC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); +void func_800286CC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); } -void func_8002873C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void func_8002873C(PlayState* play, 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); + EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); } -void func_800287AC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void func_800287AC(PlayState* play, 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); + EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); } // unused -void func_8002881C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002881C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - func_8002829C(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); + func_8002829C(play, pos, velocity, accel, primColor, envColor, 100, 5); } // unused -void func_80028858(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028858(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - func_80028304(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); + func_80028304(play, pos, velocity, accel, primColor, envColor, 100, 5); } void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel) { @@ -196,7 +196,7 @@ void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, accel->z = 0.0f; } -void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { +void func_80028990(PlayState* play, f32 randScale, Vec3f* srcPos) { s32 i; Vec3f pos; Vec3f velocity; @@ -204,11 +204,11 @@ void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { for (i = 0; i < 20; i++) { func_80028894(srcPos, randScale, &pos, &velocity, &accel); - func_8002873C(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + func_8002873C(play, &pos, &velocity, &accel, 100, 30, 7); } } -void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { +void func_80028A54(PlayState* play, f32 randScale, Vec3f* srcPos) { s32 i; Vec3f pos; Vec3f velocity; @@ -216,25 +216,25 @@ void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { for (i = 0; i < 20; i++) { func_80028894(srcPos, randScale, &pos, &velocity, &accel); - func_800287AC(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + func_800287AC(play, &pos, &velocity, &accel, 100, 30, 7); } } // EffectSsKiraKira Spawn Functions -void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsKiraKira_SpawnSmallYellow(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { Color_RGBA8 primColor = { 255, 255, 200, 255 }; Color_RGBA8 envColor = { 255, 200, 0, 0 }; - EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, &primColor, &envColor, 1000, 16); + EffectSsKiraKira_SpawnDispersed(play, pos, velocity, accel, &primColor, &envColor, 1000, 16); } -void EffectSsKiraKira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKiraKira_SpawnSmall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, primColor, envColor, 1000, 16); + EffectSsKiraKira_SpawnDispersed(play, pos, velocity, accel, primColor, envColor, 1000, 16); } -void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKiraKira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { EffectSsKiraKiraInitParams initParams; @@ -252,10 +252,10 @@ 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, +void EffectSsKiraKira_SpawnFocused(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { EffectSsKiraKiraInitParams initParams; @@ -271,26 +271,26 @@ void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* Color_RGBA8_Copy(&initParams.envColor, envColor); initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life)); - EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_KIRAKIRA, 128, &initParams); } // EffectSsBomb Spawn Functions // unused -void EffectSsBomb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsBomb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { EffectSsBombInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); Math_Vec3f_Copy(&initParams.velocity, velocity); Math_Vec3f_Copy(&initParams.accel, accel); - EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BOMB, 128, &initParams); } // EffectSsBomb2 Spawn Functions // unused -void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsBomb2_SpawnFade(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { EffectSsBomb2InitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -300,10 +300,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, +void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { EffectSsBomb2InitParams initParams; @@ -314,12 +314,12 @@ void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* vel initParams.scaleStep = scaleStep; initParams.drawMode = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB2, 10, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BOMB2, 10, &initParams); } // EffectSsBlast Spawn Functions -void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life) { EffectSsBlastParams initParams; @@ -333,32 +333,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, +void EffectSsBlast_SpawnShockwave(PlayState* play, 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); + EffectSsBlast_Spawn(play, pos, velocity, accel, primColor, envColor, 100, 375, 35, life); } -void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 200, 200, 200, 0 }; - EffectSsBlast_SpawnShockwave(globalCtx, pos, velocity, accel, &primColor, &envColor, 10); + EffectSsBlast_SpawnShockwave(play, pos, velocity, accel, &primColor, &envColor, 10); } // EffectSsGSpk Spawn Functions -void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { EffectSsGSpkInitParams initParams; @@ -372,11 +372,11 @@ void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, initParams.scaleStep = scaleStep; initParams.updateMode = 0; - EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_SPK, 128, &initParams); } // unused -void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnNoAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { EffectSsGSpkInitParams initParams; @@ -390,18 +390,18 @@ 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, +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 }; @@ -416,17 +416,17 @@ void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* envColor.b += randOffset; envColor.a += randOffset; - EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, &primColor, &envColor, scale, scaleStep); + EffectSsGSpk_SpawnAccel(play, actor, pos, velocity, accel, &primColor, &envColor, scale, scaleStep); } -void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, primColor, envColor, 100, 5); + EffectSsGSpk_SpawnAccel(play, actor, pos, velocity, accel, primColor, envColor, 100, 5); } // EffectSsDFire Spawn Functions -void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s32 life) { EffectSsDFireInitParams initParams; @@ -439,17 +439,17 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.fadeDelay = fadeDelay; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams); } -void EffectSsDFire_SpawnFixedScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, +void EffectSsDFire_SpawnFixedScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, s16 fadeDelay) { - EffectSsDFire_Spawn(globalCtx, pos, velocity, accel, 100, 35, alpha, fadeDelay, 8); + EffectSsDFire_Spawn(play, pos, velocity, accel, 100, 35, alpha, fadeDelay, 8); } // EffectSsBubble Spawn Functions -void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, +void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale) { EffectSsBubbleInitParams initParams; @@ -459,12 +459,12 @@ void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, initParams.xzPosRandScale = xzPosRandScale; initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_BUBBLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BUBBLE, 128, &initParams); } // EffectSsGRipple Spawn Functions -void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 radiusMax, s16 life) { +void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life) { EffectSsGRippleInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -472,12 +472,12 @@ 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, +void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 scale) { EffectSsGSplashInitParams initParams; @@ -493,32 +493,32 @@ void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr initParams.customColor = false; } - EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPLASH, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_SPLASH, 128, &initParams); } // EffectSsGMagma Spawn Functions -void EffectSsGMagma_Spawn(GlobalContext* globalCtx, Vec3f* pos) { +void EffectSsGMagma_Spawn(PlayState* play, Vec3f* pos) { EffectSsGMagmaInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); - EffectSs_Spawn(globalCtx, EFFECT_SS_G_MAGMA, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_MAGMA, 128, &initParams); } // EffectSsGFire Spawn Functions -void EffectSsGFire_Spawn(GlobalContext* globalCtx, Vec3f* pos) { +void EffectSsGFire_Spawn(PlayState* play, Vec3f* pos) { EffectSsGFireInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); - EffectSs_Spawn(globalCtx, EFFECT_SS_G_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_FIRE, 128, &initParams); } // EffectSsLightning Spawn Functions -void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsLightning_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 yaw, s16 life, s16 numBolts) { EffectSsLightningInitParams initParams; @@ -530,12 +530,12 @@ 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, +void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 life, s16 colorProfile, s16 randXZ) { EffectSsDtBubbleInitParams initParams; @@ -548,10 +548,10 @@ void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Ve initParams.life = life; initParams.randXZ = randXZ; - EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams); } -void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ) { EffectSsDtBubbleInitParams initParams; @@ -565,7 +565,7 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec initParams.randXZ = randXZ; initParams.customColor = true; - EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams); } // EffectSsHahen Spawn Functions @@ -579,7 +579,7 @@ 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, +void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, s16 objId, s16 life, Gfx* dList) { EffectSsHahenInitParams initParams; @@ -592,7 +592,7 @@ void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.objId = objId; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_HAHEN, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_HAHEN, 128, &initParams); } /** @@ -604,7 +604,7 @@ 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, +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; @@ -618,7 +618,7 @@ 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, + EffectSsHahen_Spawn(play, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId, life, dList); } } @@ -629,18 +629,18 @@ void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstSca * As child, spawn a broken stick fragment * As adult, spawn a broken sword fragment */ -void EffectSsStick_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 yaw) { +void EffectSsStick_Spawn(PlayState* play, Vec3f* pos, s16 yaw) { EffectSsStickInitParams initParams; initParams.pos = *pos; initParams.yaw = yaw; - EffectSs_Spawn(globalCtx, EFFECT_SS_STICK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_STICK, 128, &initParams); } // EffectSsSibuki Spawn Functions -void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, +void EffectSsSibuki_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, s16 direction, s16 scale) { EffectSsSibukiInitParams initParams; @@ -651,10 +651,10 @@ void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.direction = direction; initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_SIBUKI, 128, &initParams); } -void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) { +void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos) { s16 i; Vec3f unusedZeroVec1 = { 0.0f, 0.0f, 0.0f }; Vec3f unusedZeroVec2 = { 0.0f, 0.0f, 0.0f }; @@ -662,26 +662,26 @@ void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) { s16 randDirection = Rand_ZeroOne() * 1.99f; for (i = 0; i < KREG(19) + 30; i++) { - EffectSsSibuki_Spawn(globalCtx, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40); + EffectSsSibuki_Spawn(play, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40); } } // EffectSsSibuki2 Spawn Functions // unused -void EffectSsSibuki2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { +void EffectSsSibuki2_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { EffectSsSibuki2InitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); Math_Vec3f_Copy(&initParams.velocity, velocity); Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI2, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_SIBUKI2, 128, &initParams); } // EffectSsGMagma2 Spawn Functions -void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsGMagma2_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 updateRate, s16 drawMode, s16 scale) { EffectSsGMagma2InitParams initParams; @@ -692,38 +692,38 @@ void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr initParams.drawMode = drawMode; initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_G_MAGMA2, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_MAGMA2, 128, &initParams); } // EffectSsStone1 Spawn Functions -void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 arg2) { +void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 arg2) { EffectSsStone1InitParams initParams; initParams.pos = *pos; initParams.unk_C = arg2; - EffectSs_Spawn(globalCtx, EFFECT_SS_STONE1, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_STONE1, 128, &initParams); } // EffectSsHitMark Spawn Functions -void EffectSsHitMark_Spawn(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) { +void EffectSsHitMark_Spawn(PlayState* play, s32 type, s16 scale, Vec3f* pos) { EffectSsHitMarkInitParams initParams; initParams.type = type; initParams.scale = scale; Math_Vec3f_Copy(&initParams.pos, pos); - EffectSs_Spawn(globalCtx, EFFECT_SS_HITMARK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_HITMARK, 128, &initParams); } -void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* pos) { - EffectSsHitMark_Spawn(globalCtx, type, 300, pos); +void EffectSsHitMark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos) { + EffectSsHitMark_Spawn(play, type, 300, pos); } -void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) { - EffectSsHitMark_Spawn(globalCtx, type, scale, pos); +void EffectSsHitMark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos) { + EffectSsHitMark_Spawn(play, type, scale, pos); } // EffectSsFhgFlash Spawn Functions @@ -734,7 +734,7 @@ void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 sc * param changes the color of the ball. Refer to FhgFlashLightBallParam for the options. * Note: this type requires OBJECT_FHG to be loaded */ -void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, u8 param) { EffectSsFhgFlashInitParams initParams; @@ -745,7 +745,7 @@ void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f initParams.param = param; initParams.type = FHGFLASH_LIGHTBALL; - EffectSs_Spawn(globalCtx, EFFECT_SS_FHG_FLASH, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams); } /** @@ -756,7 +756,7 @@ void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f * 1: spawn at one of Player's body parts, chosen at random * 2: spawn at one of Phantom Ganon's body parts, chosen at random */ -void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, u8 param) { +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param) { EffectSsFhgFlashInitParams initParams; initParams.actor = actor; @@ -765,12 +765,12 @@ void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* initParams.param = param; initParams.type = FHGFLASH_SHOCK; - EffectSs_Spawn(globalCtx, EFFECT_SS_FHG_FLASH, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams); } // EffectSsKFire Spawn Functions -void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type) { +void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type) { EffectSsKFireInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -779,12 +779,12 @@ void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.scaleMax = scaleMax; initParams.type = type; - EffectSs_Spawn(globalCtx, EFFECT_SS_K_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_K_FIRE, 128, &initParams); } // EffectSsSolderSrchBall Spawn Functions -void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, +void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected) { EffectSsSolderSrchBallInitParams initParams; @@ -794,12 +794,12 @@ void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* v initParams.unused = unused; initParams.linkDetected = linkDetected; - EffectSs_Spawn(globalCtx, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams); } // EffectSsKakera Spawn Functions -void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, +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; @@ -820,12 +820,12 @@ void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.objId = objId; initParams.dList = dList; - EffectSs_Spawn(globalCtx, EFFECT_SS_KAKERA, 101, &initParams); + EffectSs_Spawn(play, EFFECT_SS_KAKERA, 101, &initParams); } // EffectSsIcePiece Spawn Functions -void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life) { +void EffectSsIcePiece_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life) { EffectSsIcePieceInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -833,10 +833,10 @@ void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_PIECE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_ICE_PIECE, 128, &initParams); } -void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale) { +void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Vec3f vecScales[] = { { 0.0f, 70.0f, 0.0f }, @@ -867,14 +867,14 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc pos.y += vecScales[i].y; pos.z += vecScales[i].z; - EffectSsIcePiece_Spawn(globalCtx, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity, + EffectSsIcePiece_Spawn(play, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity, &accel, 25); } } // EffectSsEnIce Spawn Functions -void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, +void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale) { EffectSsEnIceInitParams initParams; @@ -895,10 +895,10 @@ void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3 Audio_PlayActorSound2(actor, NA_SE_PL_FREEZE_S); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 80, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams); } -void EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, +void EffectSsEnIce_SpawnFlyingVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale) { EffectSsEnIceInitParams initParams; @@ -921,10 +921,10 @@ void EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3 Audio_PlayActorSound2(actor, NA_SE_PL_FREEZE_S); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 80, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams); } -void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, +void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life) { EffectSsEnIceInitParams initParams; @@ -937,12 +937,12 @@ void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* initParams.life = life; initParams.type = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 128, &initParams); } // EffectSsFireTail Spawn Functions -void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, +void EffectSsFireTail_Spawn(PlayState* play, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life) { EffectSsFireTailInitParams initParams; @@ -957,10 +957,10 @@ void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, initParams.bodyPart = bodyPart; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_FIRE_TAIL, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FIRE_TAIL, 128, &initParams); } -void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, +void EffectSsFireTail_SpawnFlame(PlayState* play, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, f32 colorIntensity) { static Color_RGBA8 primColor = { 255, 255, 0, 255 }; static Color_RGBA8 envColor = { 255, 0, 0, 255 }; @@ -972,21 +972,21 @@ 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, + EffectSsFireTail_SpawnFlame(play, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart, colorIntensity); } // EffectSsEnFire Spawn Functions // note: if bodyPart is greater than -1 the actor MUST have a table of Vec3f positions at offset 0x14C in the instance -void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; @@ -1001,11 +1001,11 @@ void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* po Audio_PlayActorSound2(actor, NA_SE_EV_FLAME_IGNITION); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); } // note: if bodyPart is greater than -1 the actor MUST have a table of Vec3s positions at offset 0x14C in the instance -void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; @@ -1022,12 +1022,12 @@ void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* po Audio_PlayActorSound2(actor, NA_SE_EV_FLAME_IGNITION); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); } // EffectSsExtra Spawn Functions -void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx) { +void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx) { EffectSsExtraInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1036,12 +1036,12 @@ void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.scale = scale; initParams.scoreIdx = scoreIdx; - EffectSs_Spawn(globalCtx, EFFECT_SS_EXTRA, 100, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EXTRA, 100, &initParams); } // EffectSsFCircle Spawn Functions -void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 radius, s16 height) { +void EffectSsFCircle_Spawn(PlayState* play, Actor* actor, Vec3f* pos, s16 radius, s16 height) { EffectSsFcircleInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1049,12 +1049,12 @@ void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s initParams.radius = radius; initParams.height = height; - EffectSs_Spawn(globalCtx, EFFECT_SS_FCIRCLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FCIRCLE, 128, &initParams); } // EffectSsDeadDb Spawn Functions -void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, s16 unused, s32 arg14, s16 playSound) { EffectSsDeadDbInitParams initParams; @@ -1075,12 +1075,12 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.unk_34 = arg14; initParams.playSound = playSound; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DB, 120, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DB, 120, &initParams); } // EffectSsDeadDd Spawn Functions -void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 alpha, s16 envR, s16 envG, s16 envB, s16 alphaStep, s32 life) { EffectSsDeadDdInitParams initParams; @@ -1101,11 +1101,11 @@ void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.alphaStep = alphaStep; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DD, 120, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DD, 120, &initParams); } // unused -void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, +void EffectSsDeadDd_SpawnRandYellow(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, s32 randIter, s32 life) { EffectSsDeadDdInitParams initParams; @@ -1117,12 +1117,12 @@ void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 sc initParams.life = life; initParams.type = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DD, 120, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DD, 120, &initParams); } // EffectSsDeadDs Spawn Functions -void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDs_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s32 life) { EffectSsDeadDsInitParams initParams; @@ -1133,17 +1133,17 @@ void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.scaleStep = scaleStep; initParams.alpha = alpha; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DS, 100, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DS, 100, &initParams); } -void EffectSsDeadDs_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, +void EffectSsDeadDs_SpawnStationary(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life) { - EffectSsDeadDs_Spawn(globalCtx, pos, &sZeroVec, &sZeroVec, scale, scaleStep, alpha, life); + EffectSsDeadDs_Spawn(play, pos, &sZeroVec, &sZeroVec, scale, scaleStep, alpha, life); } // EffectSsDeadSound Spawn Functions -void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, +void EffectSsDeadSound_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, s16 lowerPriority, s16 repeatMode, s32 life) { EffectSsDeadSoundInitParams initParams; @@ -1156,15 +1156,15 @@ void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* veloci initParams.life = life; if (!lowerPriority) { - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_SOUND, 100, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_SOUND, 100, &initParams); } else { - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_SOUND, 127, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_SOUND, 127, &initParams); } } -void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16 sfxId, s16 lowerPriority, +void EffectSsDeadSound_SpawnStationary(PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority, s16 repeatMode, s32 life) { - EffectSsDeadSound_Spawn(globalCtx, pos, &sZeroVec, &sZeroVec, sfxId, lowerPriority, repeatMode, life); + EffectSsDeadSound_Spawn(play, pos, &sZeroVec, &sZeroVec, sfxId, lowerPriority, repeatMode, life); } // EffectSsIceSmoke Spawn Functions @@ -1174,7 +1174,7 @@ void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16 * * Note: this effect requires OBJECT_FZ to be loaded */ -void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { +void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { EffectSsIceSmokeInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1182,5 +1182,5 @@ void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocit Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_SMOKE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_ICE_SMOKE, 128, &initParams); } diff --git a/soh/src/code/z_elf_message.c b/soh/src/code/z_elf_message.c index 2e847f738..5bf7e9723 100644 --- a/soh/src/code/z_elf_message.c +++ b/soh/src/code/z_elf_message.c @@ -148,12 +148,12 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) { } } -u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u16 ElfMessage_GetSariaText(PlayState* play) { + Player* player = GET_PLAYER(play); ElfMessage* msgs; if (!LINK_IS_ADULT) { - if (Actor_FindNearby(globalCtx, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) { + if (Actor_FindNearby(play, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) { msgs = sChildSariaMsgs; } else { return 0x0160; // Special text about Saria preferring to talk to you face-to-face @@ -165,10 +165,10 @@ u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) { return ElfMessage_GetTextFromMsgs(msgs); } -u16 ElfMessage_GetCUpText(GlobalContext* globalCtx) { - if (globalCtx->cUpElfMsgs == NULL) { +u16 ElfMessage_GetCUpText(PlayState* play) { + if (play->cUpElfMsgs == NULL) { return 0; } else { - return ElfMessage_GetTextFromMsgs(globalCtx->cUpElfMsgs); + return ElfMessage_GetTextFromMsgs(play->cUpElfMsgs); } } diff --git a/soh/src/code/z_en_a_keep.c b/soh/src/code/z_en_a_keep.c index df9f76a1a..d340422ca 100644 --- a/soh/src/code/z_en_a_keep.c +++ b/soh/src/code/z_en_a_keep.c @@ -5,16 +5,16 @@ #define FLAGS ACTOR_FLAG_4 -void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAObj_Init(Actor* thisx, PlayState* play); +void EnAObj_Destroy(Actor* thisx, PlayState* play); +void EnAObj_Update(Actor* thisx, PlayState* play); +void EnAObj_Draw(Actor* thisx, PlayState* play); -void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx); +void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play); +void EnAObj_WaitTalk(EnAObj* this, PlayState* play); +void EnAObj_BlockRot(EnAObj* this, PlayState* play); +void EnAObj_BoulderFragment(EnAObj* this, PlayState* play); +void EnAObj_Block(EnAObj* this, PlayState* play); void EnAObj_SetupWaitTalk(EnAObj* this, s16 type); void EnAObj_SetupBlockRot(EnAObj* this, s16 type); @@ -84,7 +84,7 @@ void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; s32 pad; EnAObj* this = (EnAObj*)thisx; @@ -131,13 +131,13 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { case A_OBJ_BLOCK_LARGE: case A_OBJ_BLOCK_HUGE: this->dyna.bgId = 1; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG); EnAObj_SetupBlock(this, thisx->params); break; case A_OBJ_BLOCK_SMALL_ROT: case A_OBJ_BLOCK_LARGE_ROT: this->dyna.bgId = 3; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG); EnAObj_SetupBlockRot(this, thisx->params); break; case A_OBJ_UNKNOWN_6: @@ -160,8 +160,8 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { // clang-format on this->focusYoffset = 45.0f; EnAObj_SetupWaitTalk(this, thisx->params); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; thisx->targetMode = 0; break; @@ -181,25 +181,25 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->dyna.bgId != BGACTOR_NEG_ONE) { CollisionHeader_GetVirtual(sColHeaders[this->dyna.bgId], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } } -void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Destroy(Actor* thisx, PlayState* play) { EnAObj* this = (EnAObj*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); switch (this->dyna.actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); break; } } -void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) { +void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->dyna.actor, play)) { EnAObj_SetupWaitTalk(this, this->dyna.actor.params); } } @@ -208,17 +208,17 @@ void EnAObj_SetupWaitTalk(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_WaitTalk); } -void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_WaitTalk(EnAObj* this, PlayState* play) { s16 relYawTowardsPlayer; if (this->dyna.actor.textId != 0) { relYawTowardsPlayer = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; if (ABS(relYawTowardsPlayer) < 0x2800 || (this->dyna.actor.params == A_OBJ_SIGNPOST_ARROW && ABS(relYawTowardsPlayer) > 0x5800)) { - if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { EnAObj_SetupAction(this, EnAObj_WaitFinishedTalking); } else { - func_8002F2F4(&this->dyna.actor, globalCtx); + func_8002F2F4(&this->dyna.actor, play); } } } @@ -232,7 +232,7 @@ void EnAObj_SetupBlockRot(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_BlockRot); } -void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_BlockRot(EnAObj* this, PlayState* play) { if (this->rotateState == 0) { if (this->dyna.unk_160 != 0) { this->rotateState++; @@ -275,7 +275,7 @@ void EnAObj_SetupBoulderFragment(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_BoulderFragment); } -void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_BoulderFragment(EnAObj* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f); this->dyna.actor.shape.rot.x += this->dyna.actor.world.rot.x >> 1; this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z >> 1; @@ -303,7 +303,7 @@ void EnAObj_SetupBlock(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_Block); } -void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_Block(EnAObj* this, PlayState* play) { this->dyna.actor.speedXZ += this->dyna.unk_150; this->dyna.actor.world.rot.y = this->dyna.unk_158; this->dyna.actor.speedXZ = CLAMP(this->dyna.actor.speedXZ, -2.5f, 2.5f); @@ -318,17 +318,17 @@ void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; } -void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Update(Actor* thisx, PlayState* play) { EnAObj* this = (EnAObj*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->dyna.actor); if (this->dyna.actor.gravity != 0.0f) { if (this->dyna.actor.params != A_OBJ_BOULDER_FRAGMENT) { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 40.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 40.0f, 0.0f, 0x1D); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 20.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 20.0f, 0.0f, 0x1D); } } @@ -339,17 +339,17 @@ void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); break; } } -void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Draw(Actor* thisx, PlayState* play) { s32 type = thisx->params; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (type >= A_OBJ_MAX) { type = A_OBJ_BOULDER_FRAGMENT; @@ -359,9 +359,9 @@ void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 1, 60, 60, 60, 50); } - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDLists[type]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index c6afc2535..8bdf4e3a6 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -5,20 +5,20 @@ #define FLAGS 0 -void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx); -void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx); -void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnItem00_Init(Actor* thisx, PlayState* play); +void EnItem00_Destroy(Actor* thisx, PlayState* play); +void EnItem00_Update(Actor* thisx, PlayState* play); +void EnItem00_Draw(Actor* thisx, PlayState* play); -void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx); -void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx); -void func_8001E304(EnItem00* this, GlobalContext* globalCtx); -void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx); +void func_8001DFC8(EnItem00* this, PlayState* play); +void func_8001E1C8(EnItem00* this, PlayState* play); +void func_8001E304(EnItem00* this, PlayState* play); +void func_8001E5C8(EnItem00* this, PlayState* play); -void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx); -void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx); -void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx); -void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx); +void EnItem00_DrawRupee(EnItem00* this, PlayState* play); +void EnItem00_DrawCollectible(EnItem00* this, PlayState* play); +void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play); +void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play); const ActorInit En_Item00_InitVars = { ACTOR_EN_ITEM00, @@ -330,7 +330,7 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Init(Actor* thisx, PlayState* play) { EnItem00* this = (EnItem00*)thisx; s32 pad; f32 yOffset = 980.0f; @@ -346,14 +346,14 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.params &= 0xFF; - if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) { + if (Flags_GetCollectible(play, this->collectibleFlag)) { Actor_Kill(&this->actor); return; } Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_158 = 1; @@ -397,8 +397,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = 0.01f; break; case ITEM00_SHIELD_DEKU: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_1); - Actor_SetObjectDependency(globalCtx, &this->actor); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; yOffset = 0.0f; @@ -406,8 +406,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.rot.x = 0x4000; break; case ITEM00_SHIELD_HYLIAN: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2); - Actor_SetObjectDependency(globalCtx, &this->actor); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; yOffset = 0.0f; @@ -416,8 +416,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ITEM00_TUNIC_ZORA: case ITEM00_TUNIC_GORON: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_CLOTHES); - Actor_SetObjectDependency(globalCtx, &this->actor); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_CLOTHES); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; yOffset = 0.0f; @@ -432,7 +432,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->getItemId = GI_NONE; RandomizerCheck randoCheck = - Randomizer_GetCheckFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams); + Randomizer_GetCheckFromActor(this->actor.id, play->sceneNum, this->ogParams); if (gSaveContext.n64ddFlag && randoCheck != RC_UNKNOWN_CHECK) { this->randoGiEntry = @@ -455,41 +455,41 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case ITEM00_RUPEE_GREEN: - Item_Give(globalCtx, ITEM_RUPEE_GREEN); + Item_Give(play, ITEM_RUPEE_GREEN); break; case ITEM00_RUPEE_BLUE: - Item_Give(globalCtx, ITEM_RUPEE_BLUE); + Item_Give(play, ITEM_RUPEE_BLUE); break; case ITEM00_RUPEE_RED: - Item_Give(globalCtx, ITEM_RUPEE_RED); + Item_Give(play, ITEM_RUPEE_RED); break; case ITEM00_RUPEE_PURPLE: - Item_Give(globalCtx, ITEM_RUPEE_PURPLE); + Item_Give(play, ITEM_RUPEE_PURPLE); break; case ITEM00_RUPEE_ORANGE: - Item_Give(globalCtx, ITEM_RUPEE_GOLD); + Item_Give(play, ITEM_RUPEE_GOLD); break; case ITEM00_HEART: - Item_Give(globalCtx, ITEM_HEART); + Item_Give(play, ITEM_HEART); break; case ITEM00_FLEXIBLE: - Health_ChangeBy(globalCtx, 0x70); + Health_ChangeBy(play, 0x70); break; case ITEM00_BOMBS_A: case ITEM00_BOMBS_B: - Item_Give(globalCtx, ITEM_BOMBS_5); + Item_Give(play, ITEM_BOMBS_5); break; case ITEM00_ARROWS_SINGLE: - Item_Give(globalCtx, ITEM_BOW); + Item_Give(play, ITEM_BOW); break; case ITEM00_ARROWS_SMALL: - Item_Give(globalCtx, ITEM_ARROWS_SMALL); + Item_Give(play, ITEM_ARROWS_SMALL); break; case ITEM00_ARROWS_MEDIUM: - Item_Give(globalCtx, ITEM_ARROWS_MEDIUM); + Item_Give(play, ITEM_ARROWS_MEDIUM); break; case ITEM00_ARROWS_LARGE: - Item_Give(globalCtx, ITEM_ARROWS_LARGE); + Item_Give(play, ITEM_ARROWS_LARGE); break; case ITEM00_MAGIC_LARGE: getItemId = GI_MAGIC_SMALL; @@ -498,7 +498,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { getItemId = GI_MAGIC_LARGE; break; case ITEM00_SMALL_KEY: - Item_Give(globalCtx, ITEM_KEY_SMALL); + Item_Give(play, ITEM_KEY_SMALL); break; case ITEM00_SEEDS: getItemId = GI_SEEDS_5; @@ -518,31 +518,31 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_BOMBS_SPECIAL: break; case ITEM00_BOMBCHU: - Item_Give(globalCtx, ITEM_BOMBCHUS_5); + Item_Give(play, ITEM_BOMBCHUS_5); break; } - if (!Actor_HasParent(&this->actor, globalCtx)) { + if (!Actor_HasParent(&this->actor, play)) { if (getItemId != GI_NONE) { if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) { - func_8002F554(&this->actor, globalCtx, getItemId); + func_8002F554(&this->actor, play, getItemId); } else { - GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, this->randoGiEntry); + GiveItemEntryFromActorWithFixedRange(&this->actor, play, this->randoGiEntry); } } } EnItem00_SetupAction(this, func_8001E5C8); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Destroy(Actor* thisx, PlayState* play) { EnItem00* this = (EnItem00*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { +void func_8001DFC8(EnItem00* this, PlayState* play) { if (!CVar_GetS32("gNewDrops", 0)){ if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) || @@ -601,7 +601,7 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { } } -void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { +void func_8001E1C8(EnItem00* this, PlayState* play) { f32 originalVelocity; Vec3f effectPos; @@ -609,11 +609,11 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += 960; } - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { effectPos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); effectPos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f); effectPos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f); - EffectSsKiraKira_SpawnSmall(globalCtx, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, + EffectSsKiraKira_SpawnSmall(play, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); } @@ -629,7 +629,7 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { } } -void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { +void func_8001E304(EnItem00* this, PlayState* play) { s32 pad; Vec3f pos; s32 rotOffset; @@ -669,11 +669,11 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { } } - if (!(globalCtx->gameplayFrames & 1)) { + if (!(play->gameplayFrames & 1)) { pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f; pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f; pos.z = this->actor.world.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f; - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, + EffectSsKiraKira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); } @@ -685,14 +685,14 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { } } -void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8001E5C8(EnItem00* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->getItemId != GI_NONE) { - if (!Actor_HasParent(&this->actor, globalCtx)) { + if (!Actor_HasParent(&this->actor, play)) { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 50.0f, 80.0f); + func_8002F434(&this->actor, play, this->getItemId, 50.0f, 80.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->randoGiEntry, 50.0f, 80.0f); + GiveItemEntryFromActor(&this->actor, play, this->randoGiEntry, 50.0f, 80.0f); } this->unk_15A++; } else { @@ -721,7 +721,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { } // The BSS in the function acted weird in the past. It is matching now but might cause issues in the future -void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Update(Actor* thisx, PlayState* play) { static u32 D_80157D90; static s16 D_80157D94[1]; s16* params; @@ -762,7 +762,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_156 = this->unk_15A; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Math_SmoothStepToF(&this->actor.scale.x, this->scale, 0.1f, this->scale * 0.1f, 0.0f); temp = &D_80157D90; @@ -771,12 +771,12 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.gravity) { if (this->actor.bgCheckFlags & 0x0003) { - if (*temp != globalCtx->gameplayFrames) { - D_80157D90 = globalCtx->gameplayFrames; + if (*temp != play->gameplayFrames) { + D_80157D90 = play->gameplayFrames; D_80157D94[0] = 0; for (i = 0; i < 50; i++) { - if (globalCtx->colCtx.dyna.bgActorFlags[i] & 1) { - dynaActor = globalCtx->colCtx.dyna.bgActors[i].actor; + if (play->colCtx.dyna.bgActorFlags[i] & 1) { + dynaActor = play->colCtx.dyna.bgActors[i].actor; if ((dynaActor != NULL) && (dynaActor->update != NULL)) { if ((dynaActor->world.pos.x != dynaActor->prevPos.x) || (dynaActor->world.pos.y != dynaActor->prevPos.y) || @@ -795,7 +795,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } if (sp3A || D_80157D94[0]) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D); if (this->actor.floorHeight <= -10000.0f) { Actor_Kill(&this->actor); @@ -805,7 +805,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) || (this->actor.params == ITEM00_TUNIC_ZORA) || (this->actor.params == ITEM00_TUNIC_GORON)) { @@ -819,30 +819,30 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if (!((this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) && (this->actor.yDistToPlayer <= 50.0f))) { - if (!Actor_HasParent(&this->actor, globalCtx)) { + if (!Actor_HasParent(&this->actor, play)) { return; } } - if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) { + if (play->gameOverCtx.state != GAMEOVER_INACTIVE) { return; } switch (this->actor.params) { case ITEM00_RUPEE_GREEN: - Item_Give(globalCtx, ITEM_RUPEE_GREEN); + Item_Give(play, ITEM_RUPEE_GREEN); break; case ITEM00_RUPEE_BLUE: - Item_Give(globalCtx, ITEM_RUPEE_BLUE); + Item_Give(play, ITEM_RUPEE_BLUE); break; case ITEM00_RUPEE_RED: - Item_Give(globalCtx, ITEM_RUPEE_RED); + Item_Give(play, ITEM_RUPEE_RED); break; case ITEM00_RUPEE_PURPLE: - Item_Give(globalCtx, ITEM_RUPEE_PURPLE); + Item_Give(play, ITEM_RUPEE_PURPLE); break; case ITEM00_RUPEE_ORANGE: - Item_Give(globalCtx, ITEM_RUPEE_GOLD); + Item_Give(play, ITEM_RUPEE_GOLD); break; case ITEM00_STICK: getItemId = GI_STICKS_1; @@ -851,26 +851,26 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { getItemId = GI_NUTS_5; break; case ITEM00_HEART: - Item_Give(globalCtx, ITEM_HEART); + Item_Give(play, ITEM_HEART); break; case ITEM00_FLEXIBLE: - Health_ChangeBy(globalCtx, 0x70); + Health_ChangeBy(play, 0x70); break; case ITEM00_BOMBS_A: case ITEM00_BOMBS_B: - Item_Give(globalCtx, ITEM_BOMBS_5); + Item_Give(play, ITEM_BOMBS_5); break; case ITEM00_ARROWS_SINGLE: - Item_Give(globalCtx, ITEM_BOW); + Item_Give(play, ITEM_BOW); break; case ITEM00_ARROWS_SMALL: - Item_Give(globalCtx, ITEM_ARROWS_SMALL); + Item_Give(play, ITEM_ARROWS_SMALL); break; case ITEM00_ARROWS_MEDIUM: - Item_Give(globalCtx, ITEM_ARROWS_MEDIUM); + Item_Give(play, ITEM_ARROWS_MEDIUM); break; case ITEM00_ARROWS_LARGE: - Item_Give(globalCtx, ITEM_ARROWS_LARGE); + Item_Give(play, ITEM_ARROWS_LARGE); break; case ITEM00_SEEDS: getItemId = GI_SEEDS_5; @@ -905,18 +905,18 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_BOMBS_SPECIAL: break; case ITEM00_BOMBCHU: - Item_Give(globalCtx, ITEM_BOMBCHUS_5); + Item_Give(play, ITEM_BOMBCHUS_5); break; } params = &this->actor.params; - if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) { + if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) { if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) { - func_8002F554(&this->actor, globalCtx, getItemId); + func_8002F554(&this->actor, play, getItemId); } else { getItemId = this->randoGiEntry.getItemId; - GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, this->randoGiEntry); + GiveItemEntryFromActorWithFixedRange(&this->actor, play, this->randoGiEntry); } } @@ -928,8 +928,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_SHIELD_HYLIAN: case ITEM00_TUNIC_ZORA: case ITEM00_TUNIC_GORON: - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, this->collectibleFlag); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, this->collectibleFlag); Actor_Kill(&this->actor); } return; @@ -938,8 +938,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if ((*params <= ITEM00_RUPEE_RED) || (*params == ITEM00_RUPEE_ORANGE)) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else if (getItemId != GI_NONE) { - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, this->collectibleFlag); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, this->collectibleFlag); Actor_Kill(&this->actor); } return; @@ -947,7 +947,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_GET_ITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - Flags_SetCollectible(globalCtx, this->collectibleFlag); + Flags_SetCollectible(play, this->collectibleFlag); this->unk_15A = 15; this->unk_154 = 35; @@ -962,7 +962,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { EnItem00_SetupAction(this, func_8001E5C8); } -void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Draw(Actor* thisx, PlayState* play) { EnItem00* this = (EnItem00*)thisx; f32 mtxScale; @@ -975,7 +975,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.shape.shadowScale = 0.3f; this->actor.world.rot.x = 0x4000; - GetItem_Draw(globalCtx, GID_RUPEE_GREEN); + GetItem_Draw(play, GID_RUPEE_GREEN); break; } case ITEM00_RUPEE_BLUE: @@ -985,7 +985,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.shape.shadowScale = 0.3f; this->actor.world.rot.x = 0x4000; - GetItem_Draw(globalCtx, GID_RUPEE_BLUE); + GetItem_Draw(play, GID_RUPEE_BLUE); break; } case ITEM00_RUPEE_RED: @@ -995,14 +995,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.shape.shadowScale = 0.3f; this->actor.world.rot.x = 0x4000; - GetItem_Draw(globalCtx, GID_RUPEE_RED); + GetItem_Draw(play, GID_RUPEE_RED); break; } else { this->actor.shape.shadowScale = 6.0f; Actor_SetScale(&this->actor, 0.015f); this->scale = 0.015f; this->actor.shape.yOffset = 750.0f; - EnItem00_DrawRupee(this, globalCtx); + EnItem00_DrawRupee(this, play); break; } case ITEM00_RUPEE_ORANGE: @@ -1012,14 +1012,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.shape.shadowScale = 0.3f; this->actor.world.rot.x = 0x4000; - GetItem_Draw(globalCtx, GID_RUPEE_GOLD); + GetItem_Draw(play, GID_RUPEE_GOLD); break; } else { Actor_SetScale(&this->actor, 0.045 - 1e-10); this->actor.shape.shadowScale = 6.0f; this->scale = 0.045 - 1e-10; this->actor.shape.yOffset = 750.0f; - EnItem00_DrawRupee(this, globalCtx); + EnItem00_DrawRupee(this, play); break; } case ITEM00_RUPEE_PURPLE: @@ -1029,14 +1029,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.shape.shadowScale = 0.3f; this->actor.world.rot.x = 0x4000; - GetItem_Draw(globalCtx, GID_RUPEE_PURPLE); + GetItem_Draw(play, GID_RUPEE_PURPLE); break; } else { Actor_SetScale(&this->actor, 0.03f); this->actor.shape.shadowScale = 6.0f; this->scale = 0.03f; this->actor.shape.yOffset = 750.0f; - EnItem00_DrawRupee(this, globalCtx); + EnItem00_DrawRupee(this, play); break; } case ITEM00_HEART_PIECE: @@ -1046,17 +1046,17 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_HEART_PIECE); + GetItem_Draw(play, GID_HEART_PIECE); } else { this->actor.shape.yOffset = 650.0f; this->actor.shape.shadowScale = 0.03f; Actor_SetScale(&this->actor, 0.02f); this->scale = 0.02f; - 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 (CVar_GetS32("gNewDrops", 0)) { @@ -1065,23 +1065,23 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.shadowScale = 0.3f; Actor_SetScale(&this->actor, 0.3f); this->scale = 0.3f; - GetItem_Draw(globalCtx, GID_HEART); + GetItem_Draw(play, GID_HEART); mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); break; } else { if (this->unk_15A < 0) { if (this->unk_15A == -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->unk_15A = -2; } } else { mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - GetItem_Draw(globalCtx, GID_HEART); + GetItem_Draw(play, GID_HEART); } break; } @@ -1091,7 +1091,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.shadowScale = 6.0f; Actor_SetScale(&this->actor, 0.02f); this->scale = 0.02f; - EnItem00_DrawCollectible(this, globalCtx); + EnItem00_DrawCollectible(this, play); break; } @@ -1102,7 +1102,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_BOMB); + GetItem_Draw(play, GID_BOMB); break; } case ITEM00_BOMBS_B: @@ -1112,7 +1112,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_BOMB); + GetItem_Draw(play, GID_BOMB); break; } case ITEM00_BOMBS_SPECIAL: @@ -1123,7 +1123,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_ARROWS_SMALL); + GetItem_Draw(play, GID_ARROWS_SMALL); break; } case ITEM00_ARROWS_SMALL: @@ -1133,7 +1133,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_ARROWS_SMALL); + GetItem_Draw(play, GID_ARROWS_SMALL); break; } case ITEM00_ARROWS_MEDIUM: @@ -1143,7 +1143,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_ARROWS_MEDIUM); + GetItem_Draw(play, GID_ARROWS_MEDIUM); break; } case ITEM00_ARROWS_LARGE: @@ -1153,7 +1153,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_ARROWS_LARGE); + GetItem_Draw(play, GID_ARROWS_LARGE); break; } case ITEM00_NUTS: @@ -1163,7 +1163,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_NUTS); + GetItem_Draw(play, GID_NUTS); break; } case ITEM00_STICK: @@ -1173,7 +1173,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_STICK); + GetItem_Draw(play, GID_STICK); break; } case ITEM00_MAGIC_LARGE: @@ -1183,7 +1183,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_MAGIC_LARGE); + GetItem_Draw(play, GID_MAGIC_LARGE); break; } case ITEM00_MAGIC_SMALL: @@ -1193,7 +1193,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.shape.shadowScale = 0.3f; this->actor.world.rot.x = 0x4000; - GetItem_Draw(globalCtx, GID_MAGIC_SMALL); + GetItem_Draw(play, GID_MAGIC_SMALL); break; } case ITEM00_SEEDS: @@ -1203,7 +1203,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.shape.shadowScale = 0.3f; this->actor.world.rot.x = 0x4000; - GetItem_Draw(globalCtx, GID_SEEDS); + GetItem_Draw(play, GID_SEEDS); break; } case ITEM00_SMALL_KEY: @@ -1213,7 +1213,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.5f; - GetItem_Draw(globalCtx, GID_KEY_SMALL); + GetItem_Draw(play, GID_KEY_SMALL); break; } else { Actor_SetScale(&this->actor, 0.03f); @@ -1224,7 +1224,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.rot.x = 0; this->actor.shape.rot.y = 0; } - EnItem00_DrawCollectible(this, globalCtx); + EnItem00_DrawCollectible(this, play); break; } case ITEM00_BOMBCHU: @@ -1234,19 +1234,19 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 50.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.shadowScale = 0.3f; - GetItem_Draw(globalCtx, GID_BOMBCHU); + GetItem_Draw(play, GID_BOMBCHU); break; case ITEM00_SHIELD_DEKU: - GetItem_Draw(globalCtx, GID_SHIELD_DEKU); + GetItem_Draw(play, GID_SHIELD_DEKU); break; case ITEM00_SHIELD_HYLIAN: - GetItem_Draw(globalCtx, GID_SHIELD_HYLIAN); + GetItem_Draw(play, GID_SHIELD_HYLIAN); break; case ITEM00_TUNIC_ZORA: - GetItem_Draw(globalCtx, GID_TUNIC_ZORA); + GetItem_Draw(play, GID_TUNIC_ZORA); break; case ITEM00_TUNIC_GORON: - GetItem_Draw(globalCtx, GID_TUNIC_GORON); + GetItem_Draw(play, GID_TUNIC_GORON); break; case ITEM00_FLEXIBLE: break; @@ -1254,7 +1254,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { } } -void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetItemEntry giEntry) { +void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry giEntry) { s16 color_slot; switch (giEntry.modIndex) { case MOD_NONE: @@ -1351,20 +1351,20 @@ void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetI pos.z = Rand_CenteredFloat(32.0f) + Parent->world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, 50); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 1000, 50); } /** * Draw Function used for Rupee types of En_Item00. */ -void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawRupee(EnItem00* this, PlayState* play) { s32 pad; s32 texIndex; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); if (this->actor.params <= ITEM00_RUPEE_RED) { texIndex = this->actor.params; @@ -1372,31 +1372,31 @@ void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) { texIndex = this->actor.params - 0x10; } - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTex[texIndex])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...). */ -void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawCollectible(EnItem00* this, PlayState* play) { if (gSaveContext.n64ddFlag && (this->getItemId != GI_NONE || this->actor.params == ITEM00_SMALL_KEY)) { f32 mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, this->randoGiEntry); - GetItemEntry_Draw(globalCtx, this->randoGiEntry); + EnItem00_CustomItemsParticles(&this->actor, play, this->randoGiEntry); + GetItemEntry_Draw(play, this->randoGiEntry); } else { s32 texIndex = this->actor.params - 3; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); if (this->actor.params == ITEM00_BOMBS_SPECIAL) { texIndex = 1; @@ -1411,58 +1411,58 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sItemDropTex[texIndex])); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } /** * Draw Function used for the Heart Container type of En_Item00. */ -void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gHeartPieceExteriorDL); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gHeartContainerInteriorDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw Function used for the Piece of Heart type of En_Item00. */ -void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) { if (gSaveContext.n64ddFlag) { f32 mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, this->randoGiEntry); - GetItemEntry_Draw(globalCtx, this->randoGiEntry); + EnItem00_CustomItemsParticles(&this->actor, play, this->randoGiEntry); + GetItemEntry_Draw(play, this->randoGiEntry); } else { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -1538,7 +1538,7 @@ s16 func_8001F404(s16 dropId) { // External functions used by other actors to drop collectibles, which usually results in spawning an En_Item00 actor. -EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { +EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params) { s32 pad[2]; EnItem00* spawnedActor = NULL; s16 param4000 = params & 0x4000; @@ -1551,9 +1551,9 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED); - EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, + EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF, 40); } else { if (!param8000) { @@ -1561,7 +1561,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa } if (params != -1) { - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00); if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f; @@ -1583,7 +1583,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa return spawnedActor; } -EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { +EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params) { EnItem00* spawnedActor = NULL; s32 pad; s16 param4000 = params & 0x4000; @@ -1596,14 +1596,14 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED); - EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, + EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF, 40); } else { params = func_8001F404(params & 0x00FF); if (params != -1) { - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00); if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = 0.0f; @@ -1618,7 +1618,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p return spawnedActor; } -void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) { +void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params) { s32 pad; EnItem00* spawnedActor; s16 dropQuantity; @@ -1667,9 +1667,9 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (dropId == ITEM00_FLEXIBLE) { if (gSaveContext.health <= 0x10) { // 1 heart or less - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED); - EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, + EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF, 40); return; } else if (gSaveContext.health <= 0x30 && !CVar_GetS32("gNoHeartDrops", 0)) { // 3 hearts or less @@ -1715,7 +1715,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (!param8000) { dropId = func_8001F404(dropId); if (dropId != 0xFF) { - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId); if ((spawnedActor != NULL) && (dropId != 0xFF)) { spawnedActor->actor.velocity.y = 8.0f; @@ -1734,7 +1734,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 } } } else { - Item_DropCollectible(globalCtx, spawnPos, params | 0x8000); + Item_DropCollectible(play, spawnPos, params | 0x8000); } dropQuantity--; } diff --git a/soh/src/code/z_face_reaction.c b/soh/src/code/z_face_reaction.c index d463da4f7..2dbd56df2 100644 --- a/soh/src/code/z_face_reaction.c +++ b/soh/src/code/z_face_reaction.c @@ -63,8 +63,8 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 }, }; -u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) { - u8 currentMask = Player_GetMask(globalCtx); +u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) { + u8 currentMask = Player_GetMask(play); return sReactionTextIds[reactionSet][currentMask]; } diff --git a/soh/src/code/z_fcurve_data_skelanime.c b/soh/src/code/z_fcurve_data_skelanime.c index 98e79387c..2ae49c3dd 100644 --- a/soh/src/code/z_fcurve_data_skelanime.c +++ b/soh/src/code/z_fcurve_data_skelanime.c @@ -11,7 +11,7 @@ void SkelCurve_Clear(SkelAnimeCurve* skelCurve) { skelCurve->unk_0C = 0.0f; } -s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, +s32 SkelCurve_Init(PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, TransformUpdateIndex* transUpdIdx) { if (ResourceMgr_OTRSigCheck(limbListSeg)) @@ -29,7 +29,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurv return 1; } -void SkelCurve_Destroy(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) { +void SkelCurve_Destroy(PlayState* play, SkelAnimeCurve* skelCurve) { if (skelCurve->transforms != NULL) { ZELDA_ARENA_FREE_DEBUG(skelCurve->transforms); } @@ -44,7 +44,7 @@ void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpd skelCurve->transUpdIdx = transUpdIdx; } -s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) { +s32 SkelCurve_Update(PlayState* play, SkelAnimeCurve* skelCurve) { s16* transforms; u8* transformRefIdx; TransformUpdateIndex* transformIndex; @@ -99,16 +99,16 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) { return ret; } -void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* skelCurve, +void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelAnimeCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { SkelCurveLimb* limb = SEGMENTED_TO_VIRTUAL(skelCurve->limbList[limbIndex]); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); if (overrideLimbDraw == NULL || - (overrideLimbDraw != NULL && overrideLimbDraw(globalCtx, skelCurve, limbIndex, data))) { + (overrideLimbDraw != NULL && overrideLimbDraw(play, skelCurve, limbIndex, data))) { Vec3f scale; Vec3s rot; Vec3f pos; @@ -135,7 +135,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* 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); } @@ -144,13 +144,13 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* 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); } @@ -161,25 +161,25 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, skelCurve, limbIndex, data); + postLimbDraw(play, skelCurve, limbIndex, data); } if (limb->firstChildIdx != LIMB_DONE) { - SkelCurve_DrawLimb(globalCtx, limb->firstChildIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + SkelCurve_DrawLimb(play, limb->firstChildIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } Matrix_Pop(); if (limb->nextLimbIdx != LIMB_DONE) { - SkelCurve_DrawLimb(globalCtx, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + SkelCurve_DrawLimb(play, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, +void SkelCurve_Draw(Actor* actor, PlayState* play, SkelAnimeCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { if (skelCurve->transforms != NULL) { - SkelCurve_DrawLimb(globalCtx, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + SkelCurve_DrawLimb(play, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } } diff --git a/soh/src/code/z_game_dlftbls.c b/soh/src/code/z_game_dlftbls.c index 0f5b845d8..d3c3adb79 100644 --- a/soh/src/code/z_game_dlftbls.c +++ b/soh/src/code/z_game_dlftbls.c @@ -15,7 +15,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(Gameplay_Init, Gameplay_Destroy, sizeof(GlobalContext)), + GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)), GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)), GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)), }; diff --git a/soh/src/code/z_game_over.c b/soh/src/code/z_game_over.c index bb4be8711..315199000 100644 --- a/soh/src/code/z_game_over.c +++ b/soh/src/code/z_game_over.c @@ -1,23 +1,23 @@ #include "global.h" -void GameOver_Init(GlobalContext* globalCtx) { - globalCtx->gameOverCtx.state = GAMEOVER_INACTIVE; +void GameOver_Init(PlayState* play) { + play->gameOverCtx.state = GAMEOVER_INACTIVE; } -void GameOver_FadeInLights(GlobalContext* globalCtx) { - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; +void GameOver_FadeInLights(PlayState* play) { + GameOverContext* gameOverCtx = &play->gameOverCtx; if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) || (gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) { - Environment_FadeInGameOverLights(globalCtx); + Environment_FadeInGameOverLights(play); } } // This variable cannot be moved into this file as all of z_message_PAL rodata is in the way extern s16 gGameOverTimer; -void GameOver_Update(GlobalContext* globalCtx) { - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; +void GameOver_Update(PlayState* play) { + GameOverContext* gameOverCtx = &play->gameOverCtx; s16 i; s16 j; s32 v90; @@ -26,7 +26,7 @@ void GameOver_Update(GlobalContext* globalCtx) { switch (gameOverCtx->state) { case GAMEOVER_DEATH_START: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gSaveContext.timer1State = 0; gSaveContext.timer2State = 0; @@ -42,7 +42,7 @@ void GameOver_Update(GlobalContext* globalCtx) { for (j = 1; j < ARRAY_COUNT(gSaveContext.equips.buttonItems); j++) { if (gSaveContext.equips.buttonItems[j] == gSpoilingItems[i]) { gSaveContext.equips.buttonItems[j] = gSpoilingItemReverts[i]; - Interface_LoadItemIcon1(globalCtx, j); + Interface_LoadItemIcon1(play, j); } } } @@ -75,7 +75,7 @@ void GameOver_Update(GlobalContext* globalCtx) { } gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0; - Environment_InitGameOverLights(globalCtx); + Environment_InitGameOverLights(play); gGameOverTimer = 20; v90 = VREG(90); v91 = VREG(91); @@ -94,7 +94,7 @@ void GameOver_Update(GlobalContext* globalCtx) { gGameOverTimer--; if (gGameOverTimer == 0) { - globalCtx->pauseCtx.state = 8; + play->pauseCtx.state = 8; gameOverCtx->state++; func_800AA15C(); } @@ -103,7 +103,7 @@ void GameOver_Update(GlobalContext* globalCtx) { case GAMEOVER_REVIVE_START: gameOverCtx->state++; gGameOverTimer = 0; - Environment_InitGameOverLights(globalCtx); + Environment_InitGameOverLights(play); ShrinkWindow_SetVal(0x20); return; @@ -138,7 +138,7 @@ void GameOver_Update(GlobalContext* globalCtx) { break; case GAMEOVER_REVIVE_FADE_OUT: - Environment_FadeOutGameOverLights(globalCtx); + Environment_FadeOutGameOverLights(play); gGameOverTimer--; if (gGameOverTimer == 0) { diff --git a/soh/src/code/z_horse.c b/soh/src/code/z_horse.c index 9537a8146..5d829d3e5 100644 --- a/soh/src/code/z_horse.c +++ b/soh/src/code/z_horse.c @@ -14,7 +14,7 @@ s32 func_8006CFC0(s32 scene) { return 0; } -void func_8006D074(GlobalContext* globalCtx) { +void func_8006D074(PlayState* play) { gSaveContext.horseData.scene = SCENE_SPOT00; gSaveContext.horseData.pos.x = -1840; gSaveContext.horseData.pos.y = 72; @@ -22,7 +22,7 @@ void func_8006D074(GlobalContext* globalCtx) { gSaveContext.horseData.angle = -27353; } -void func_8006D0AC(GlobalContext* globalCtx) { +void func_8006D0AC(PlayState* play) { if (gSaveContext.horseData.scene == SCENE_SPOT06) { gSaveContext.horseData.scene = SCENE_SPOT06; gSaveContext.horseData.pos.x = -2065; @@ -39,7 +39,7 @@ typedef struct { /* 0x0A */ s16 type; } HorseSpawn; -void func_8006D0EC(GlobalContext* globalCtx, Player* player) { +void func_8006D0EC(PlayState* play, Player* player) { s32 i; HorseSpawn horseSpawns[] = { { SCENE_SPOT00, -460, 100, 6640, 0, 2 }, { SCENE_SPOT06, -1929, -1025, 768, 0, 2 }, @@ -48,30 +48,30 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { }; if ((AREG(6) != 0) && (Flags_GetEventChkInf(0x18) || (DREG(1) != 0))) { - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.world.pos.x, + player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x, player->actor.shape.rot.y, player->actor.shape.rot.z, 9); ASSERT(player->rideActor != NULL); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); - gSaveContext.horseData.scene = globalCtx->sceneNum; + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); + gSaveContext.horseData.scene = play->sceneNum; - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { player->rideActor->room = -1; } - } else if ((globalCtx->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) { + } else if ((play->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) { Actor* horseActor; gSaveContext.minigameState = 0; horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1); horseActor->room = -1; } else if ((gSaveContext.entranceIndex == 1230) && (gSaveContext.eventChkInf[1] & 0x100)) { Actor* horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1); ASSERT(horseActor != NULL); - } else if ((globalCtx->sceneNum == gSaveContext.horseData.scene) && + } else if ((play->sceneNum == gSaveContext.horseData.scene) && (((Flags_GetEventChkInf(0x18) != 0) && (!gSaveContext.n64ddFlag || (gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && (INV_CONTENT(ITEM_OCARINA_FAIRY) != ITEM_NONE)))) || DREG(1) != 0)) { @@ -80,11 +80,11 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { DREG(1)); if (func_8006CFC0(gSaveContext.horseData.scene)) { - Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, + Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x, gSaveContext.horseData.pos.y, gSaveContext.horseData.pos.z, 0, gSaveContext.horseData.angle, 0, 1); ASSERT(horseActor != NULL); - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } } else { @@ -92,21 +92,21 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { // "Horse_SetNormal():%d set spot is no good." osSyncPrintf("Horse_SetNormal():%d セットスポットまずいです。\n", gSaveContext.horseData.scene); osSyncPrintf(VT_RST); - func_8006D074(globalCtx); + func_8006D074(play); } - } else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) { + } else if ((play->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) { Actor* horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1); ASSERT(horseActor != NULL); } else if (Flags_GetEventChkInf(0x18) || (DREG(1) != 0)) { for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) { HorseSpawn* horseSpawn = &horseSpawns[i]; - if (horseSpawn->scene == globalCtx->sceneNum) { + if (horseSpawn->scene == play->sceneNum) { Actor* horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y, horseSpawn->pos.z, 0, horseSpawn->angle, 0, horseSpawn->type); ASSERT(horseActor != NULL); - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } @@ -114,8 +114,8 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { } } } else if (!Flags_GetEventChkInf(0x18)) { - if ((DREG(1) == 0) && (globalCtx->sceneNum == SCENE_SOUKO) && !IS_DAY) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1); + if ((DREG(1) == 0) && (play->sceneNum == SCENE_SOUKO) && !IS_DAY) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1); } } } @@ -128,7 +128,7 @@ typedef struct { /* 0x10 */ s16 type; } struct_8011F9B8; -void func_8006D684(GlobalContext* globalCtx, Player* player) { +void func_8006D684(PlayState* play, Player* player) { s32 pad; s32 i; Vec3s spawnPos; @@ -153,24 +153,24 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { spawnPos = spawnPositions[3]; } - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, + player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, spawnPos.z, 0, player->actor.world.rot.y, 0, 7); ASSERT(player->rideActor != NULL); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); - gSaveContext.horseData.scene = globalCtx->sceneNum; - } else if ((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) && + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); + gSaveContext.horseData.scene = play->sceneNum; + } else if ((play->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) && (Flags_GetEventChkInf(0x18) == 0) && (DREG(1) == 0)) { player->rideActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5); ASSERT(player->rideActor != NULL); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); - gSaveContext.horseData.scene = globalCtx->sceneNum; + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); + gSaveContext.horseData.scene = play->sceneNum; - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { player->rideActor->room = -1; } } else { @@ -182,22 +182,22 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { }; for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) { - if ((globalCtx->sceneNum == D_8011F9B8[i].scene) && + if ((play->sceneNum == D_8011F9B8[i].scene) && (((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) { if (D_8011F9B8[i].type == 7) { - if ((globalCtx->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) { + if ((play->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) { D_8011F9B8[i].pos.x = player->actor.world.pos.x; D_8011F9B8[i].pos.y = player->actor.world.pos.y; D_8011F9B8[i].pos.z = player->actor.world.pos.z; } - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, + player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, player->actor.world.rot.y, 0, D_8011F9B8[i].type); ASSERT(player->rideActor != NULL); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); } else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) { Vec3f sp54; s32 temp = 0; @@ -206,7 +206,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { temp = 0x8000; } - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, + player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp); ASSERT(player->rideActor != NULL); @@ -217,16 +217,16 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { player->actor.shape.rot.x = player->actor.shape.rot.z = 0; player->actor.shape.rot.y = D_8011F9B8[i].angle; - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); sp54.x = player->actor.world.pos.x - 200.0f; sp54.y = player->actor.world.pos.y + 100.0f; sp54.z = player->actor.world.pos.z; - Gameplay_CameraSetAtEye(globalCtx, globalCtx->activeCamera, &player->actor.world.pos, &sp54); + Play_CameraSetAtEye(play, play->activeCamera, &player->actor.world.pos, &sp54); } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type); } @@ -236,26 +236,26 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { } } -void func_8006DC68(GlobalContext* globalCtx, Player* player) { +void func_8006DC68(PlayState* play, Player* player) { if (LINK_IS_ADULT) { if (!func_8006CFC0(gSaveContext.horseData.scene)) { osSyncPrintf(VT_COL(RED, WHITE)); // "Horse_Set_Check():%d set spot is no good." osSyncPrintf("Horse_Set_Check():%d セットスポットまずいです。\n", gSaveContext.horseData.scene); osSyncPrintf(VT_RST); - func_8006D074(globalCtx); + func_8006D074(play); } - if (func_8006CFC0(globalCtx->sceneNum)) { + if (func_8006CFC0(play->sceneNum)) { if ((gSaveContext.sceneSetupIndex > 3) || ((gSaveContext.entranceIndex == 0x028A || gSaveContext.entranceIndex == 0x028E || gSaveContext.entranceIndex == 0x0292 || gSaveContext.entranceIndex == 0x0476) && (gSaveContext.respawnFlag == 0)) || - ((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) && + ((play->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0))) { - func_8006D684(globalCtx, player); + func_8006D684(play, player); } else { - func_8006D0EC(globalCtx, player); + func_8006D0EC(play, player); } } } diff --git a/soh/src/code/z_kaleido_manager.c b/soh/src/code/z_kaleido_manager.c index d215d5fa0..92540b3c4 100644 --- a/soh/src/code/z_kaleido_manager.c +++ b/soh/src/code/z_kaleido_manager.c @@ -46,7 +46,7 @@ void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl) { } } -void KaleidoManager_Init(GlobalContext* globalCtx) { +void KaleidoManager_Init(PlayState* play) { ptrdiff_t largestSize = 0; ptrdiff_t size; u32 i; @@ -62,7 +62,7 @@ void KaleidoManager_Init(GlobalContext* globalCtx) { osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestSize); osSyncPrintf(VT_RST); - sKaleidoAreaPtr = GAMESTATE_ALLOC_MC(&globalCtx->state, largestSize); + sKaleidoAreaPtr = GAMESTATE_ALLOC_MC(&play->state, largestSize); LOG_CHECK_NULL_POINTER("KaleidoArea_allocp", sKaleidoAreaPtr); osSyncPrintf(VT_FGCOL(GREEN)); diff --git a/soh/src/code/z_kaleido_scope_call.c b/soh/src/code/z_kaleido_scope_call.c index 6e7e81651..81e442d8a 100644 --- a/soh/src/code/z_kaleido_scope_call.c +++ b/soh/src/code/z_kaleido_scope_call.c @@ -1,14 +1,14 @@ #include "global.h" #include "vt.h" -void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx); -void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx); +void (*sKaleidoScopeUpdateFunc)(PlayState* play); +void (*sKaleidoScopeDrawFunc)(PlayState* play); f32 gBossMarkScale; u32 D_8016139C; PauseMapMarksData* gLoadedPauseMarkDataTable; -extern void KaleidoScope_Update(GlobalContext* globalCtx); -extern void KaleidoScope_Draw(GlobalContext* globalCtx); +extern void KaleidoScope_Update(PlayState* play); +extern void KaleidoScope_Draw(PlayState* play); void KaleidoScopeCall_LoadPlayer() { KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]; @@ -30,7 +30,7 @@ void KaleidoScopeCall_LoadPlayer() { } } -void KaleidoScopeCall_Init(GlobalContext* globalCtx) { +void KaleidoScopeCall_Init(PlayState* play) { // "Kaleidoscope replacement construction" osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n"); @@ -42,19 +42,19 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) { LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw); LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc); - KaleidoSetup_Init(globalCtx); + KaleidoSetup_Init(play); } -void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) { +void KaleidoScopeCall_Destroy(PlayState* play) { // "Kaleidoscope replacement destruction" osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n"); - KaleidoSetup_Destroy(globalCtx); + KaleidoSetup_Destroy(play); } -void KaleidoScopeCall_Update(GlobalContext* globalCtx) { +void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) { if (pauseCtx->state == 1) { @@ -101,9 +101,9 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { - sKaleidoScopeUpdateFunc(globalCtx); + sKaleidoScopeUpdateFunc(play); - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { osSyncPrintf(VT_FGCOL(GREEN)); // "Kaleido area Kaleidoscope Emission" osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); @@ -117,15 +117,15 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) { } } -void KaleidoScopeCall_Draw(GlobalContext* globalCtx) { +void KaleidoScopeCall_Draw(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; if (R_PAUSE_MENU_MODE >= 3) { - if (((globalCtx->pauseCtx.state >= 4) && (globalCtx->pauseCtx.state <= 7)) || - ((globalCtx->pauseCtx.state >= 11) && (globalCtx->pauseCtx.state <= 18))) { + if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) || + ((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 18))) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { - sKaleidoScopeDrawFunc(globalCtx); + sKaleidoScopeDrawFunc(play); } } } diff --git a/soh/src/code/z_kaleido_setup.c b/soh/src/code/z_kaleido_setup.c index 644cbb010..83622820c 100644 --- a/soh/src/code/z_kaleido_setup.c +++ b/soh/src/code/z_kaleido_setup.c @@ -8,15 +8,15 @@ s16 sKaleidoSetupKscpPos1[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM f32 sKaleidoSetupEyeX1[] = { -64.0f, 0.0f, 64.0f, 0.0f }; f32 sKaleidoSetupEyeZ1[] = { 0.0f, -64.0f, 0.0f, 64.0f }; -void KaleidoSetup_Update(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; +void KaleidoSetup_Update(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; - if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE && - globalCtx->sceneLoadFlag == 0 && globalCtx->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 && - gSaveContext.nextCutsceneIndex < 0xFFF0 && !Gameplay_InCsMode(globalCtx) && - globalCtx->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 && - (globalCtx->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(globalCtx, 0x38))) { + if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && play->gameOverCtx.state == GAMEOVER_INACTIVE && + play->sceneLoadFlag == 0 && play->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 && + gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) && + play->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 && + (play->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(play, 0x38))) { if (CVar_GetS32("gCheatEasyPauseBufferFrameAdvance", 0) == 2 && !CHECK_BTN_ALL(input->press.button, BTN_START)) { CVar_SetS32("gCheatEasyPauseBufferFrameAdvance", 0); @@ -71,8 +71,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) { } } -void KaleidoSetup_Init(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoSetup_Init(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; u64 temp = 0; // Necessary to match pauseCtx->state = 0; @@ -124,8 +124,8 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) { pauseCtx->ocarinaSongIdx = -1; pauseCtx->cursorSpecialPos = 0; - View_Init(&pauseCtx->view, globalCtx->state.gfxCtx); + View_Init(&pauseCtx->view, play->state.gfxCtx); } -void KaleidoSetup_Destroy(GlobalContext* globalCtx) { +void KaleidoSetup_Destroy(PlayState* play) { } diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index b1144d966..1718a487d 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -225,18 +225,18 @@ u16 Environment_GetPixelDepth(s32 x, s32 y) { } void Environment_GraphCallback(GraphicsContext* gfxCtx, void* param) { - GlobalContext* globalCtx = (GlobalContext*)param; + PlayState* play = (PlayState*)param; OTRGetPixelDepthPrepare(D_8015FD7E, D_8015FD80); - Lights_GlowCheckPrepare(globalCtx); + Lights_GlowCheckPrepare(play); D_8011FB44 = Environment_GetPixelDepth(D_8015FD7E, D_8015FD80); - Lights_GlowCheck(globalCtx); + Lights_GlowCheck(play); } -void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 unused) { +void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) { u8 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; @@ -246,14 +246,14 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 ((void)0, gSaveContext.nightFlag = 0); } - globalCtx->state.gfxCtx->callback = Environment_GraphCallback; - globalCtx->state.gfxCtx->callbackParam = globalCtx; + play->state.gfxCtx->callback = Environment_GraphCallback; + play->state.gfxCtx->callbackParam = play; Lights_DirectionalSetInfo(&envCtx->dirLight1, 80, 80, 80, 80, 80, 80); - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &envCtx->dirLight1); + LightContext_InsertLight(play, &play->lightCtx, &envCtx->dirLight1); Lights_DirectionalSetInfo(&envCtx->dirLight2, 80, 80, 80, 80, 80, 80); - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &envCtx->dirLight2); + LightContext_InsertLight(play, &play->lightCtx, &envCtx->dirLight2); envCtx->skybox1Index = 99; envCtx->skybox2Index = 99; @@ -319,12 +319,12 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 gSaveContext.chamberCutsceneNum = CREG(3) - 1; } - globalCtx->envCtx.unk_EE[0] = 0; - globalCtx->envCtx.unk_EE[1] = 0; - globalCtx->envCtx.unk_EE[2] = 0; - globalCtx->envCtx.unk_EE[3] = 0; + play->envCtx.unk_EE[0] = 0; + play->envCtx.unk_EE[1] = 0; + play->envCtx.unk_EE[2] = 0; + play->envCtx.unk_EE[3] = 0; - globalCtx->envCtx.unk_F2[0] = 0; + play->envCtx.unk_F2[0] = 0; if (gSaveContext.unk_13C3 != 0) { if (((void)0, gSaveContext.sceneSetupIndex) < 4) { @@ -334,8 +334,8 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 envCtx->unk_18 = 1; envCtx->unk_1F = 3; envCtx->unk_20 = 3; - globalCtx->envCtx.unk_EE[3] = 0; - globalCtx->envCtx.unk_EE[2] = 0; + play->envCtx.unk_EE[3] = 0; + play->envCtx.unk_EE[2] = 0; break; case 2: case 3: @@ -344,30 +344,30 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 envCtx->unk_18 = 1; envCtx->unk_1F = 2; envCtx->unk_20 = 2; - globalCtx->envCtx.unk_EE[3] = 0; - globalCtx->envCtx.unk_EE[2] = 0; + play->envCtx.unk_EE[3] = 0; + play->envCtx.unk_EE[2] = 0; break; case 5: envCtx->unk_17 = 1; envCtx->unk_18 = 1; envCtx->unk_1F = 4; envCtx->unk_20 = 4; - globalCtx->envCtx.unk_EE[3] = 0; - globalCtx->envCtx.unk_EE[2] = 0; + play->envCtx.unk_EE[3] = 0; + play->envCtx.unk_EE[2] = 0; break; default: break; } - if (globalCtx->skyboxId == SKYBOX_NORMAL_SKY) { + if (play->skyboxId == SKYBOX_NORMAL_SKY) { if (gWeatherMode == 3) { - globalCtx->envCtx.unk_EE[2] = globalCtx->envCtx.unk_EE[3] = 0x40; + play->envCtx.unk_EE[2] = play->envCtx.unk_EE[3] = 0x40; } else if (gWeatherMode == 4) { - globalCtx->envCtx.unk_EE[0] = 0x14; - globalCtx->envCtx.unk_EE[1] = 0x14; + play->envCtx.unk_EE[0] = 0x14; + play->envCtx.unk_EE[1] = 0x14; } else if (gWeatherMode == 5) { - globalCtx->envCtx.unk_EE[0] = 0x1E; - globalCtx->envCtx.unk_EE[1] = 0x1E; + play->envCtx.unk_EE[0] = 0x1E; + play->envCtx.unk_EE[1] = 0x1E; } } } @@ -397,15 +397,15 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 sLightningBolts[i].state = LIGHTNING_BOLT_INACTIVE; } - globalCtx->roomCtx.unk_74[0] = 0; - globalCtx->roomCtx.unk_74[1] = 0; + play->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[1] = 0; - for (i = 0; i < ARRAY_COUNT(globalCtx->csCtx.npcActions); i++) { - globalCtx->csCtx.npcActions[i] = 0; + for (i = 0; i < ARRAY_COUNT(play->csCtx.npcActions); i++) { + play->csCtx.npcActions[i] = 0; } - if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !globalCtx->envCtx.sunMoonDisabled) { - globalCtx->envCtx.sunMoonDisabled = true; + if (Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) { + play->envCtx.sunMoonDisabled = true; // "Sun setting other than field keep! So forced release!" osSyncPrintf(VT_COL(YELLOW, BLACK) "\n\nフィールド常駐以外、太陽設定!よって強制解除!\n" VT_RST); } @@ -600,7 +600,7 @@ void func_8006FB94(EnvironmentContext* envCtx, u8 unused) { extern SkyboxTableEntry sSkyboxTable[]; -void Environment_UpdateSkybox(GlobalContext* globalCtx, u8 skyboxId, EnvironmentContext* envCtx, SkyboxContext* skyboxCtx) { +void Environment_UpdateSkybox(PlayState* play, u8 skyboxId, EnvironmentContext* envCtx, SkyboxContext* skyboxCtx) { size_t size; u8 i; u8 newSkybox1Index = 0xFF; @@ -785,38 +785,38 @@ void Environment_UpdateSkybox(GlobalContext* globalCtx, u8 skyboxId, Environment } } -void Environment_EnableUnderwaterLights(GlobalContext* globalCtx, s32 waterLightsIndex) { +void Environment_EnableUnderwaterLights(PlayState* play, s32 waterLightsIndex) { if (waterLightsIndex == 0x1F) { waterLightsIndex = 0; // "Underwater color is not set in the water poly data!" osSyncPrintf(VT_COL(YELLOW, BLACK) "\n水ポリゴンデータに水中カラーが設定されておりません!" VT_RST); } - if (!globalCtx->envCtx.indoors) { - D_8011FB34 = globalCtx->envCtx.unk_20; + if (!play->envCtx.indoors) { + D_8011FB34 = play->envCtx.unk_20; - if (globalCtx->envCtx.unk_1F != waterLightsIndex) { - globalCtx->envCtx.unk_1F = waterLightsIndex; - globalCtx->envCtx.unk_20 = waterLightsIndex; + if (play->envCtx.unk_1F != waterLightsIndex) { + play->envCtx.unk_1F = waterLightsIndex; + play->envCtx.unk_20 = waterLightsIndex; } } else { - globalCtx->envCtx.blendIndoorLights = false; // instantly switch to water lights - globalCtx->envCtx.unk_BF = waterLightsIndex; + play->envCtx.blendIndoorLights = false; // instantly switch to water lights + play->envCtx.unk_BF = waterLightsIndex; } } -void Environment_DisableUnderwaterLights(GlobalContext* globalCtx) { - if (!globalCtx->envCtx.indoors) { - globalCtx->envCtx.unk_1F = D_8011FB34; - globalCtx->envCtx.unk_20 = D_8011FB34; +void Environment_DisableUnderwaterLights(PlayState* play) { + if (!play->envCtx.indoors) { + play->envCtx.unk_1F = D_8011FB34; + play->envCtx.unk_20 = D_8011FB34; } else { - globalCtx->envCtx.blendIndoorLights = false; // instantly switch to previous lights - globalCtx->envCtx.unk_BF = 0xFF; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.blendIndoorLights = false; // instantly switch to previous lights + play->envCtx.unk_BF = 0xFF; + play->envCtx.unk_D8 = 1.0f; } } -void Environment_PrintDebugInfo(GlobalContext* globalCtx, Gfx** gfx) { +void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) { GfxPrint printer; s32 pad[2]; @@ -874,10 +874,10 @@ void Environment_PrintDebugInfo(GlobalContext* globalCtx, Gfx** gfx) { #define TIME_ENTRY_1F (D_8011FB48[envCtx->unk_1F][i]) #define TIME_ENTRY_20 (D_8011FB48[envCtx->unk_20][i]) -void func_80075B44(GlobalContext* globalCtx); -void func_800766C4(GlobalContext* globalCtx); +void func_80075B44(PlayState* play); +void func_800766C4(PlayState* play); -void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, +void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContext* lightCtx, PauseContext* pauseCtx, MessageContext* msgCtx, GameOverContext* gameOverCtx, GraphicsContext* gfxCtx) { f32 sp8C; @@ -885,24 +885,24 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li u16 i; u16 j; u16 time; - EnvLightSettings* lightSettingsList = globalCtx->envCtx.lightSettingsList; + EnvLightSettings* lightSettingsList = play->envCtx.lightSettingsList; s32 adjustment; if ((((void)0, gSaveContext.gameMode) != 0) && (((void)0, gSaveContext.gameMode) != 3)) { - func_800AA16C(globalCtx); + func_800AA16C(play); } if (pauseCtx->state == 0) { - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { - if (globalCtx->skyboxId == SKYBOX_NORMAL_SKY) { - globalCtx->skyboxCtx.rot.y -= 0.001f; - } else if (globalCtx->skyboxId == SKYBOX_CUTSCENE_MAP) { - globalCtx->skyboxCtx.rot.y -= 0.005f; + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if (play->skyboxId == SKYBOX_NORMAL_SKY) { + play->skyboxCtx.rot.y -= 0.001f; + } else if (play->skyboxId == SKYBOX_CUTSCENE_MAP) { + play->skyboxCtx.rot.y -= 0.005f; } } - func_800766C4(globalCtx); // increments or decrements unk_EE[1] depending on some condition - func_80075B44(globalCtx); // updates bgm/sfx and other things as the day progresses + func_800766C4(play); // increments or decrements unk_EE[1] depending on some condition + func_80075B44(play); // updates bgm/sfx and other things as the day progresses if (((void)0, gSaveContext.nextDayTime) >= 0xFF00 && ((void)0, gSaveContext.nextDayTime) != 0xFFFF) { gSaveContext.nextDayTime -= 0x10; @@ -919,8 +919,8 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li if ((pauseCtx->state == 0) && (gameOverCtx->state == GAMEOVER_INACTIVE)) { if (((msgCtx->msgLength == 0) && (msgCtx->msgMode == 0)) || (((void)0, gSaveContext.gameMode) == 3)) { - if ((envCtx->unk_1A == 0) && !FrameAdvance_IsEnabled(globalCtx) && - (globalCtx->transitionMode == 0 || ((void)0, gSaveContext.gameMode) != 0)) { + if ((envCtx->unk_1A == 0) && !FrameAdvance_IsEnabled(play) && + (play->transitionMode == 0 || ((void)0, gSaveContext.gameMode) != 0)) { if (IS_DAY || gTimeIncrement >= 0x190) { gSaveContext.dayTime += gTimeIncrement; @@ -950,15 +950,15 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li Gfx* displayList; Gfx* prevDisplayList; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); prevDisplayList = POLY_OPA_DISP; displayList = Graph_GfxPlusOne(POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, displayList); - Environment_PrintDebugInfo(globalCtx, &displayList); + Environment_PrintDebugInfo(play, &displayList); gSPEndDisplayList(displayList++); Graph_BranchDlist(prevDisplayList, displayList); POLY_OPA_DISP = displayList; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if ((envCtx->unk_BF != 0xFF) && (envCtx->unk_DC != 2) && (envCtx->unk_BD != envCtx->unk_BF) && @@ -1294,35 +1294,35 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li } } -void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { +void Environment_DrawSunAndMoon(PlayState* play) { f32 alpha; f32 color; f32 y; f32 scale; f32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (globalCtx->csCtx.state != 0) { - Math_SmoothStepToF(&globalCtx->envCtx.sunPos.x, + if (play->csCtx.state != 0) { + Math_SmoothStepToF(&play->envCtx.sunPos.x, -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f, 1.0f, 0.8f, 0.8f); - Math_SmoothStepToF(&globalCtx->envCtx.sunPos.y, + Math_SmoothStepToF(&play->envCtx.sunPos.y, (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f, 1.0f, 0.8f, 0.8f); //! @bug This should be z. - Math_SmoothStepToF(&globalCtx->envCtx.sunPos.y, + Math_SmoothStepToF(&play->envCtx.sunPos.y, (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f, 1.0f, 0.8f, 0.8f); } else { - globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.y = +(Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f; + play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.sunPos.y = +(Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f; } if (gSaveContext.entranceIndex != 0xCD || ((void)0, gSaveContext.sceneSetupIndex) != 5) { - Matrix_Translate(globalCtx->view.eye.x + globalCtx->envCtx.sunPos.x, - globalCtx->view.eye.y + globalCtx->envCtx.sunPos.y, - globalCtx->view.eye.z + globalCtx->envCtx.sunPos.z, MTXMODE_NEW); + Matrix_Translate(play->view.eye.x + play->envCtx.sunPos.x, + play->view.eye.y + play->envCtx.sunPos.y, + play->view.eye.z + play->envCtx.sunPos.z, MTXMODE_NEW); - y = globalCtx->envCtx.sunPos.y / 25.0f; + y = play->envCtx.sunPos.y / 25.0f; temp = y / 80.0f; alpha = temp * 255.0f; @@ -1349,8 +1349,8 @@ void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { scale = (color * 2.0f) + 10.0f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); - func_80093AD0(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); + func_80093AD0(play->state.gfxCtx); static Vtx vertices[] = { VTX(-31, -31, 0, 0, 0, 255, 255, 255, 255), @@ -1371,9 +1371,9 @@ void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { gSPVertex(POLY_OPA_DISP++, vertices, 4, 0); gSP2Triangles(POLY_OPA_DISP++, 0, 1, 2, 0, 2, 1, 3, 0); - Matrix_Translate(globalCtx->view.eye.x - globalCtx->envCtx.sunPos.x, - globalCtx->view.eye.y - globalCtx->envCtx.sunPos.y, - globalCtx->view.eye.z - globalCtx->envCtx.sunPos.z, MTXMODE_NEW); + Matrix_Translate(play->view.eye.x - play->envCtx.sunPos.x, + play->view.eye.y - play->envCtx.sunPos.y, + play->view.eye.z - play->envCtx.sunPos.z, MTXMODE_NEW); color = -y / 120.0f; color = CLAMP_MIN(color, 0.0f); @@ -1387,8 +1387,8 @@ void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { alpha = temp * 255.0f; if (alpha > 0.0f) { - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); - func_8009398C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); + func_8009398C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 240, 255, 180, alpha); gDPSetEnvColor(POLY_OPA_DISP++, 80, 70, 20, alpha); @@ -1396,20 +1396,20 @@ void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Environment_DrawSunLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, +void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f pos, s32 unused) { - if ((globalCtx->envCtx.unk_EE[1] == 0) && (globalCtx->envCtx.unk_17 == 0)) { - Environment_DrawLensFlare(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, pos, 2000, + if ((play->envCtx.unk_EE[1] == 0) && (play->envCtx.unk_17 == 0)) { + Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, 2000, 370, Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f, 400, 1); } } f32 sLensFlareScales[] = { 23.0f, 12.0f, 7.0f, 5.0f, 3.0f, 10.0f, 6.0f, 2.0f, 3.0f, 1.0f }; -void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, +void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f pos, s32 unused, s16 scale, f32 colorIntensity, s16 screenFillAlpha, u8 arg9) { s16 i; @@ -1505,7 +1505,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env if (!(cosAngle < 0.0f)) { if (arg9) { u32 shrink = ShrinkWindow_GetCurrentVal(); - func_800C016C(globalCtx, &pos, &screenPos); + func_800C016C(play, &pos, &screenPos); D_8015FD7E = (s16)screenPos.x; D_8015FD80 = (s16)screenPos.y - 5.0f; if (D_8011FB44 != 0xFFFC || screenPos.x < 0.0f || screenPos.y < shrink || screenPos.x > SCREEN_WIDTH || @@ -1520,7 +1520,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); if (arg9) { - temp = Environment_LerpWeight(60, 15, globalCtx->view.fovy); + temp = Environment_LerpWeight(60, 15, play->view.fovy); } Matrix_Translate(-posDirX * i * dist, -posDirY * i * dist, -posDirZ * i * dist, MTXMODE_APPLY); @@ -1540,7 +1540,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env alpha = alpha * lensFlareAlphas[i]; alpha = CLAMP_MIN(alpha, 0.0f); - fogInfluence = (996 - globalCtx->lightCtx.fogNear) / 50.0f; + fogInfluence = (996 - play->lightCtx.fogNear) / 50.0f; fogInfluence = CLAMP_MAX(fogInfluence, 1.0f); @@ -1588,7 +1588,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env alpha = alpha * screenFillAlpha; alpha = CLAMP_MIN(alpha, 0.0f); - fogInfluence = (996 - globalCtx->lightCtx.fogNear) / 50.0f; + fogInfluence = (996 - play->lightCtx.fogNear) / 50.0f; fogInfluence = CLAMP_MAX(fogInfluence, 1.0f); @@ -1622,7 +1622,7 @@ f32 func_800746DC(void) { return Rand_ZeroOne() - 0.5f; } -void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gfxCtx) { +void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx) { s16 i; s32 pad; Vec3f vec; @@ -1639,9 +1639,9 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* f32 z280; Vec3f unused = { 0.0f, 0.0f, 0.0f }; Vec3f windDirection = { 0.0f, 0.0f, 0.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100) && (globalCtx->envCtx.unk_EE[2] == 0)) { + if (!(play->cameraPtrs[0]->unk_14C & 0x100) && (play->envCtx.unk_EE[2] == 0)) { OPEN_DISPS(gfxCtx); vec.x = view->lookAt.x - view->eye.x; @@ -1661,14 +1661,14 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* x280 = view->eye.x + temp1 * 280.0f; z280 = view->eye.z + temp3 * 280.0f; - if (globalCtx->envCtx.unk_EE[1]) { + if (play->envCtx.unk_EE[1]) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 255, 255, 30); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); } // draw rain drops - for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) { + for (i = 0; i < play->envCtx.unk_EE[1]; i++) { FrameInterpolation_RecordOpenChild("Rain Drop", i); temp2 = Rand_ZeroOne(); @@ -1678,9 +1678,9 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* Matrix_Translate((temp2 - 0.7f) * 100.0f + x50, (temp1 - 0.7f) * 100.0f + y50, (temp3 - 0.7f) * 100.0f + z50, MTXMODE_NEW); - windDirection.x = globalCtx->envCtx.windDirection.x; - windDirection.y = globalCtx->envCtx.windDirection.y; - windDirection.z = globalCtx->envCtx.windDirection.z; + windDirection.x = play->envCtx.windDirection.x; + windDirection.y = play->envCtx.windDirection.y; + windDirection.z = play->envCtx.windDirection.z; vec.x = windDirection.x; vec.y = windDirection.y + 500.0f + Rand_ZeroOne() * 200.0f; @@ -1704,7 +1704,7 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* if (player->actor.world.pos.y < view->eye.y) { u8 firstDone = false; - for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) { + for (i = 0; i < play->envCtx.unk_EE[1]; i++) { FrameInterpolation_RecordOpenChild("Droplet Ring", i); if (!firstDone) { @@ -1736,16 +1736,16 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* } } -void func_80074CE8(GlobalContext* globalCtx, u32 arg1) { - if ((globalCtx->envCtx.unk_BD != arg1) && (globalCtx->envCtx.unk_D8 >= 1.0f) && - (globalCtx->envCtx.unk_BF == 0xFF)) { +void func_80074CE8(PlayState* play, u32 arg1) { + if ((play->envCtx.unk_BD != arg1) && (play->envCtx.unk_D8 >= 1.0f) && + (play->envCtx.unk_BF == 0xFF)) { if (arg1 > 30) { arg1 = 0; } - globalCtx->envCtx.unk_D8 = 0.0f; - globalCtx->envCtx.unk_BE = globalCtx->envCtx.unk_BD; - globalCtx->envCtx.unk_BD = arg1; + play->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_BE = play->envCtx.unk_BD; + play->envCtx.unk_BD = arg1; } } @@ -1761,18 +1761,18 @@ void func_80074CE8(GlobalContext* globalCtx, u32 arg1) { * * An example usage of a filter is to dim the skybox in cloudy conditions. */ -void Environment_DrawSkyboxFilters(GlobalContext* globalCtx) { - if (((globalCtx->skyboxId != SKYBOX_NONE) && (globalCtx->lightCtx.fogNear < 980)) || - (globalCtx->skyboxId == SKYBOX_UNSET_1D)) { +void Environment_DrawSkyboxFilters(PlayState* play) { + if (((play->skyboxId != SKYBOX_NONE) && (play->lightCtx.fogNear < 980)) || + (play->skyboxId == SKYBOX_UNSET_1D)) { f32 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800938B4(globalCtx->state.gfxCtx); + func_800938B4(play->state.gfxCtx); - alpha = (1000 - globalCtx->lightCtx.fogNear) * 0.02f; + alpha = (1000 - play->lightCtx.fogNear) * 0.02f; - if (globalCtx->skyboxId == SKYBOX_UNSET_1D) { + if (play->skyboxId == SKYBOX_UNSET_1D) { alpha = 1.0f; } @@ -1780,38 +1780,38 @@ void Environment_DrawSkyboxFilters(GlobalContext* globalCtx) { alpha = 1.0f; } - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, globalCtx->lightCtx.fogColor[0], globalCtx->lightCtx.fogColor[1], - globalCtx->lightCtx.fogColor[2], 255.0f * alpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, play->lightCtx.fogColor[0], play->lightCtx.fogColor[1], + play->lightCtx.fogColor[2], 255.0f * alpha); gDPFillRectangle(POLY_OPA_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } - if (globalCtx->envCtx.customSkyboxFilter) { - OPEN_DISPS(globalCtx->state.gfxCtx); + if (play->envCtx.customSkyboxFilter) { + OPEN_DISPS(play->state.gfxCtx); - func_800938B4(globalCtx->state.gfxCtx); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, globalCtx->envCtx.skyboxFilterColor[0], - globalCtx->envCtx.skyboxFilterColor[1], globalCtx->envCtx.skyboxFilterColor[2], - globalCtx->envCtx.skyboxFilterColor[3]); + func_800938B4(play->state.gfxCtx); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, play->envCtx.skyboxFilterColor[0], + play->envCtx.skyboxFilterColor[1], play->envCtx.skyboxFilterColor[2], + play->envCtx.skyboxFilterColor[3]); gDPFillRectangle(POLY_OPA_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void Environment_DrawLightningFlash(GlobalContext* globalCtx, u8 red, u8 green, u8 blue, u8 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void Environment_DrawLightningFlash(PlayState* play, u8 red, u8 green, u8 blue, u8 alpha) { + OPEN_DISPS(play->state.gfxCtx); - func_800938B4(globalCtx->state.gfxCtx); + func_800938B4(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, red, green, blue, alpha); gDPFillRectangle(POLY_OPA_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { - if (globalCtx->envCtx.lightningMode != LIGHTNING_MODE_OFF) { +void Environment_UpdateLightningStrike(PlayState* play) { + if (play->envCtx.lightningMode != LIGHTNING_MODE_OFF) { switch (gLightningStrike.state) { case LIGHTNING_STRIKE_WAIT: // every frame theres a 10% chance of the timer advancing 50 units @@ -1828,7 +1828,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { gLightningStrike.flashAlphaTarget = 200; gLightningStrike.delayTimer = 0.0f; - Environment_AddLightningBolts(globalCtx, + Environment_AddLightningBolts(play, (u8)(Rand_ZeroOne() * (ARRAY_COUNT(sLightningBolts) - 0.1f)) + 1); sLightningFlashAlpha = 0; gLightningStrike.state++; @@ -1839,9 +1839,9 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { gLightningStrike.flashGreen = 200; gLightningStrike.flashBlue = 255; - globalCtx->envCtx.adjAmbientColor[0] += 80; - globalCtx->envCtx.adjAmbientColor[1] += 80; - globalCtx->envCtx.adjAmbientColor[2] += 100; + play->envCtx.adjAmbientColor[0] += 80; + play->envCtx.adjAmbientColor[1] += 80; + play->envCtx.adjAmbientColor[2] += 100; sLightningFlashAlpha += 100; @@ -1852,26 +1852,26 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { } break; case LIGHTNING_STRIKE_END: - if (globalCtx->envCtx.adjAmbientColor[0] > 0) { - globalCtx->envCtx.adjAmbientColor[0] -= 10; - globalCtx->envCtx.adjAmbientColor[1] -= 10; + if (play->envCtx.adjAmbientColor[0] > 0) { + play->envCtx.adjAmbientColor[0] -= 10; + play->envCtx.adjAmbientColor[1] -= 10; } - if (globalCtx->envCtx.adjAmbientColor[2] > 0) { - globalCtx->envCtx.adjAmbientColor[2] -= 10; + if (play->envCtx.adjAmbientColor[2] > 0) { + play->envCtx.adjAmbientColor[2] -= 10; } sLightningFlashAlpha -= 10; if (sLightningFlashAlpha <= gLightningStrike.flashAlphaTarget) { - globalCtx->envCtx.adjAmbientColor[0] = 0; - globalCtx->envCtx.adjAmbientColor[1] = 0; - globalCtx->envCtx.adjAmbientColor[2] = 0; + play->envCtx.adjAmbientColor[0] = 0; + play->envCtx.adjAmbientColor[1] = 0; + play->envCtx.adjAmbientColor[2] = 0; gLightningStrike.state = LIGHTNING_STRIKE_WAIT; - if (globalCtx->envCtx.lightningMode == LIGHTNING_MODE_LAST) { - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_OFF; + if (play->envCtx.lightningMode == LIGHTNING_MODE_LAST) { + play->envCtx.lightningMode = LIGHTNING_MODE_OFF; } } break; @@ -1879,7 +1879,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { } if (gLightningStrike.state != LIGHTNING_STRIKE_WAIT) { - Environment_DrawLightningFlash(globalCtx, gLightningStrike.flashRed, gLightningStrike.flashGreen, + Environment_DrawLightningFlash(play, gLightningStrike.flashRed, gLightningStrike.flashGreen, gLightningStrike.flashBlue, sLightningFlashAlpha); } } @@ -1888,7 +1888,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { * Request the number of lightning bolts specified by `num` * Note: only 3 lightning bolts can be active at the same time. */ -void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num) { +void Environment_AddLightningBolts(PlayState* play, u8 num) { s16 boltsAdded = 0; s16 i; @@ -1907,7 +1907,7 @@ void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num) { /** * Draw any active lightning bolt entries contained in `sLightningBolts` */ -void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { +void Environment_DrawLightning(PlayState* play, s32 unused) { static void* lightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, gEffLightning5Tex, gEffLightning6Tex, @@ -1922,22 +1922,22 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { Vec3f unused1 = { 0.0f, 0.0f, 0.0f }; Vec3f unused2 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) { FrameInterpolation_RecordOpenChild("Lightning Bolt", i); switch (sLightningBolts[i].state) { case LIGHTNING_BOLT_START: - dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + dx = play->view.lookAt.x - play->view.eye.x; + dz = play->view.lookAt.z - play->view.eye.z; x = dx / sqrtf(SQ(dx) + SQ(dz)); z = dz / sqrtf(SQ(dx) + SQ(dz)); - sLightningBolts[i].pos.x = globalCtx->view.eye.x + x * 9500.0f; + sLightningBolts[i].pos.x = play->view.eye.x + x * 9500.0f; sLightningBolts[i].pos.y = Rand_ZeroOne() * 1000.0f + 4000.0f; - sLightningBolts[i].pos.z = globalCtx->view.eye.z + z * 9500.0f; + sLightningBolts[i].pos.z = play->view.eye.z + z * 9500.0f; sLightningBolts[i].offset.x = (Rand_ZeroOne() - 0.5f) * 5000.0f; sLightningBolts[i].offset.y = 0.0f; @@ -1974,10 +1974,10 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { Matrix_Scale(22.0f, 100.0f, 22.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 128); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 128); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(lightningTextures[sLightningBolts[i].textureIndex])); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL); } @@ -1985,11 +1985,11 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Environment_PlaySceneSequence(GlobalContext* globalCtx) { - globalCtx->envCtx.unk_E0 = 0xFF; +void Environment_PlaySceneSequence(PlayState* play) { + play->envCtx.unk_E0 = 0xFF; // both lost woods exits on the bridge from kokiri to hyrule field if (((void)0, gSaveContext.entranceIndex) == 0x4DE || ((void)0, gSaveContext.entranceIndex) == 0x5E0) { @@ -1999,94 +1999,94 @@ void Environment_PlaySceneSequence(GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.forcedSeqId)); } gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; - } else if (globalCtx->sequenceCtx.seqId == NA_BGM_NO_MUSIC) { - if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { + } else if (play->sequenceCtx.seqId == NA_BGM_NO_MUSIC) { + if (play->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { return; } - if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + if (((void)0, gSaveContext.natureAmbienceId) != play->sequenceCtx.natureAmbienceId) { + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); } - } else if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { + } else if (play->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { // "BGM Configuration" - osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", globalCtx->sequenceCtx.seqId, + osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", play->sequenceCtx.seqId, ((void)0, gSaveContext.seqId)); - if (((void)0, gSaveContext.seqId) != globalCtx->sequenceCtx.seqId) { - func_800F5550(globalCtx->sequenceCtx.seqId); + if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) { + func_800F5550(play->sequenceCtx.seqId); } } else if (((void)0, gSaveContext.dayTime) > 0x4AAA && ((void)0, gSaveContext.dayTime) < 0xB71D) { - if (((void)0, gSaveContext.seqId) != globalCtx->sequenceCtx.seqId) { - func_800F5550(globalCtx->sequenceCtx.seqId); + if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) { + func_800F5550(play->sequenceCtx.seqId); } - globalCtx->envCtx.unk_E0 = 1; + play->envCtx.unk_E0 = 1; } else { - if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + if (((void)0, gSaveContext.natureAmbienceId) != play->sequenceCtx.natureAmbienceId) { + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); } if (((void)0, gSaveContext.dayTime) > 0xB71C && ((void)0, gSaveContext.dayTime) < 0xCAAC) { - globalCtx->envCtx.unk_E0 = 3; + play->envCtx.unk_E0 = 3; } else if (((void)0, gSaveContext.dayTime) > 0xCAAC || ((void)0, gSaveContext.dayTime) < 0x4555) { - globalCtx->envCtx.unk_E0 = 5; + play->envCtx.unk_E0 = 5; } else { - globalCtx->envCtx.unk_E0 = 7; + play->envCtx.unk_E0 = 7; } } osSyncPrintf("\n-----------------\n", ((void)0, gSaveContext.forcedSeqId)); osSyncPrintf("\n 強制BGM=[%d]", ((void)0, gSaveContext.forcedSeqId)); // "Forced BGM" - osSyncPrintf("\n BGM=[%d]", globalCtx->sequenceCtx.seqId); - osSyncPrintf("\n エンブ=[%d]", globalCtx->sequenceCtx.natureAmbienceId); - osSyncPrintf("\n status=[%d]", globalCtx->envCtx.unk_E0); + osSyncPrintf("\n BGM=[%d]", play->sequenceCtx.seqId); + osSyncPrintf("\n エンブ=[%d]", play->sequenceCtx.natureAmbienceId); + osSyncPrintf("\n status=[%d]", play->envCtx.unk_E0); - Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo); + Audio_SetEnvReverb(play->roomCtx.curRoom.echo); } // updates bgm/sfx and other things as the day progresses -void func_80075B44(GlobalContext* globalCtx) { - switch (globalCtx->envCtx.unk_E0) { +void func_80075B44(PlayState* play) { + switch (play->envCtx.unk_E0) { case 0: Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_1, 0); - if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { + if (play->envCtx.unk_EE[0] == 0 && play->envCtx.unk_F2[0] == 0) { osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n"); - func_800F5510(globalCtx->sequenceCtx.seqId); + func_800F5510(play->sequenceCtx.seqId); } - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; break; case 1: if (gSaveContext.dayTime > 0xB71C) { - if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { + if (play->envCtx.unk_EE[0] == 0 && play->envCtx.unk_F2[0] == 0) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xF000FF); } - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; } break; case 2: if (gSaveContext.dayTime > 0xC000) { func_800788CC(NA_SE_EV_DOG_CRY_EVENING); - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; } break; case 3: - if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + if (play->envCtx.unk_EE[0] == 0 && play->envCtx.unk_F2[0] == 0) { + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 1); } - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; break; case 4: if (gSaveContext.dayTime > 0xCAAB) { - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; } break; case 5: Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 0); - if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { + if (play->envCtx.unk_EE[0] == 0 && play->envCtx.unk_F2[0] == 0) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_1, 1); } - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; break; case 6: if ((gSaveContext.dayTime < 0xCAAC) && (gSaveContext.dayTime > 0x4555)) { @@ -2094,35 +2094,35 @@ void func_80075B44(GlobalContext* globalCtx) { gSaveContext.bgsDayCount++; gSaveContext.dogIsLost = true; func_80078884(NA_SE_EV_CHICKEN_CRY_M); - if ((Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) || - Inventory_HatchPocketCucco(globalCtx)) && - globalCtx->csCtx.state == 0 && !Player_InCsMode(globalCtx)) { - Message_StartTextbox(globalCtx, 0x3066, NULL); + if ((Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) || + Inventory_HatchPocketCucco(play)) && + play->csCtx.state == 0 && !Player_InCsMode(play)) { + Message_StartTextbox(play, 0x3066, NULL); } - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; } break; case 7: Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_1, 0); - if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) + if (play->envCtx.unk_EE[0] == 0 && play->envCtx.unk_F2[0] == 0) { // OTRTODO: This is where corrupt audio happens. Commenting this out seems to not introduce any side effects? // Further investigation is needed... //Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, //CHANNEL_IO_PORT_1, 1); } - globalCtx->envCtx.unk_E0++; + play->envCtx.unk_E0++; break; case 8: if (gSaveContext.dayTime > 0x4AAB) { - globalCtx->envCtx.unk_E0 = 0; + play->envCtx.unk_E0 = 0; } break; } } -void Environment_DrawCustomLensFlare(GlobalContext* globalCtx) { +void Environment_DrawCustomLensFlare(PlayState* play) { Vec3f pos; if (gCustomLensFlareOn) { @@ -2130,31 +2130,31 @@ void Environment_DrawCustomLensFlare(GlobalContext* globalCtx) { pos.y = gCustomLensFlarePos.y; pos.z = gCustomLensFlarePos.z; - Environment_DrawLensFlare(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, pos, + Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, gLensFlareUnused, gLensFlareScale, gLensFlareColorIntensity, gLensFlareScreenFillAlpha, 0); } } -void Environment_InitGameOverLights(GlobalContext* globalCtx) { +void Environment_InitGameOverLights(PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sGameOverLightsIntensity = 0; Lights_PointNoGlowSetInfo(&sNGameOverLightInfo, (s16)player->actor.world.pos.x - 10.0f, (s16)player->actor.world.pos.y + 10.0f, (s16)player->actor.world.pos.z - 10.0f, 0, 0, 0, 255); - sNGameOverLightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &sNGameOverLightInfo); + sNGameOverLightNode = LightContext_InsertLight(play, &play->lightCtx, &sNGameOverLightInfo); Lights_PointNoGlowSetInfo(&sSGameOverLightInfo, (s16)player->actor.world.pos.x + 10.0f, (s16)player->actor.world.pos.y + 10.0f, (s16)player->actor.world.pos.z + 10.0f, 0, 0, 0, 255); - sSGameOverLightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &sSGameOverLightInfo); + sSGameOverLightNode = LightContext_InsertLight(play, &play->lightCtx, &sSGameOverLightInfo); } -void Environment_FadeInGameOverLights(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Environment_FadeInGameOverLights(PlayState* play) { + Player* player = GET_PLAYER(play); s16 i; Lights_PointNoGlowSetInfo(&sNGameOverLightInfo, (s16)player->actor.world.pos.x - 10.0f, @@ -2168,33 +2168,33 @@ void Environment_FadeInGameOverLights(GlobalContext* globalCtx) { sGameOverLightsIntensity += 2; } - if (func_800C0CB8(globalCtx)) { + if (func_800C0CB8(play)) { for (i = 0; i < 3; i++) { - if (globalCtx->envCtx.adjAmbientColor[i] > -255) { - globalCtx->envCtx.adjAmbientColor[i] -= 12; - globalCtx->envCtx.adjLight1Color[i] -= 12; + if (play->envCtx.adjAmbientColor[i] > -255) { + play->envCtx.adjAmbientColor[i] -= 12; + play->envCtx.adjLight1Color[i] -= 12; } - globalCtx->envCtx.adjFogColor[i] = -255; + play->envCtx.adjFogColor[i] = -255; } - if (globalCtx->envCtx.lightSettings.fogFar + globalCtx->envCtx.adjFogFar > 900) { - globalCtx->envCtx.adjFogFar -= 100; + if (play->envCtx.lightSettings.fogFar + play->envCtx.adjFogFar > 900) { + play->envCtx.adjFogFar -= 100; } - if (globalCtx->envCtx.lightSettings.fogNear + globalCtx->envCtx.adjFogNear > 950) { - globalCtx->envCtx.adjFogNear -= 10; + if (play->envCtx.lightSettings.fogNear + play->envCtx.adjFogNear > 950) { + play->envCtx.adjFogNear -= 10; } } else { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[3] = sGameOverLightsIntensity; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[3] = sGameOverLightsIntensity; } } -void Environment_FadeOutGameOverLights(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Environment_FadeOutGameOverLights(PlayState* play) { + Player* player = GET_PLAYER(play); s16 i; if (sGameOverLightsIntensity >= 3) { @@ -2204,8 +2204,8 @@ void Environment_FadeOutGameOverLights(GlobalContext* globalCtx) { } if (sGameOverLightsIntensity == 1) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, sNGameOverLightNode); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, sSGameOverLightNode); + LightContext_RemoveLight(play, &play->lightCtx, sNGameOverLightNode); + LightContext_RemoveLight(play, &play->lightCtx, sSGameOverLightNode); } else if (sGameOverLightsIntensity >= 2) { Lights_PointNoGlowSetInfo(&sNGameOverLightInfo, (s16)player->actor.world.pos.x - 10.0f, (s16)player->actor.world.pos.y + 10.0f, (s16)player->actor.world.pos.z - 10.0f, @@ -2215,34 +2215,34 @@ void Environment_FadeOutGameOverLights(GlobalContext* globalCtx) { sGameOverLightsIntensity, sGameOverLightsIntensity, sGameOverLightsIntensity, 255); } - if (func_800C0CB8(globalCtx)) { + if (func_800C0CB8(play)) { for (i = 0; i < 3; i++) { - Math_SmoothStepToS(&globalCtx->envCtx.adjAmbientColor[i], 0, 5, 12, 1); - Math_SmoothStepToS(&globalCtx->envCtx.adjLight1Color[i], 0, 5, 12, 1); - globalCtx->envCtx.adjFogColor[i] = 0; + Math_SmoothStepToS(&play->envCtx.adjAmbientColor[i], 0, 5, 12, 1); + Math_SmoothStepToS(&play->envCtx.adjLight1Color[i], 0, 5, 12, 1); + play->envCtx.adjFogColor[i] = 0; } - globalCtx->envCtx.adjFogFar = 0; - globalCtx->envCtx.adjFogNear = 0; + play->envCtx.adjFogFar = 0; + play->envCtx.adjFogNear = 0; } else { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[3] = sGameOverLightsIntensity; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[3] = sGameOverLightsIntensity; if (sGameOverLightsIntensity == 0) { - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; } } } -void func_800766C4(GlobalContext* globalCtx) { - u8 max = MAX(globalCtx->envCtx.unk_EE[0], globalCtx->envCtx.unk_F2[0]); +void func_800766C4(PlayState* play) { + u8 max = MAX(play->envCtx.unk_EE[0], play->envCtx.unk_F2[0]); - if (globalCtx->envCtx.unk_EE[1] != max && ((globalCtx->state.frames % 8) == 0)) { - if (globalCtx->envCtx.unk_EE[1] < max) { - globalCtx->envCtx.unk_EE[1] += 2; + if (play->envCtx.unk_EE[1] != max && ((play->state.frames % 8) == 0)) { + if (play->envCtx.unk_EE[1] < max) { + play->envCtx.unk_EE[1] += 2; } else { - globalCtx->envCtx.unk_EE[1] -= 2; + play->envCtx.unk_EE[1] -= 2; } } } @@ -2292,7 +2292,7 @@ Color_RGB8 sSandstormEnvColors[] = { u16 previousPatchedSandstormScreenSize = 0; -void Environment_PatchSandstorm(GlobalContext* globalCtx) { +void Environment_PatchSandstorm(PlayState* play) { if (previousPatchedSandstormScreenSize == ABS(OTRGetRectDimensionFromLeftEdge(0)) + ABS(OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH))) { return; } @@ -2308,11 +2308,11 @@ void Environment_PatchSandstorm(GlobalContext* globalCtx) { previousPatchedSandstormScreenSize = ABS(OTRGetRectDimensionFromLeftEdge(0)) + ABS(OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH)); } -void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { +void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) { s32 primA1; s32 envA1; - s32 primA = globalCtx->envCtx.sandstormPrimA; - s32 envA = globalCtx->envCtx.sandstormEnvA; + s32 primA = play->envCtx.sandstormPrimA; + s32 envA = play->envCtx.sandstormEnvA; Color_RGBA8 primColor; Color_RGBA8 envColor; s32 pad; @@ -2321,15 +2321,15 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { u16 sp94; u16 sp92; - Environment_PatchSandstorm(globalCtx); + Environment_PatchSandstorm(play); switch (sandstormState) { case 3: - if ((globalCtx->sceneNum == SCENE_SPOT13) && (globalCtx->roomCtx.curRoom.num == 0)) { + if ((play->sceneNum == SCENE_SPOT13) && (play->roomCtx.curRoom.num == 0)) { envA1 = 0; - primA1 = (globalCtx->envCtx.sandstormEnvA > 128) ? 255 : globalCtx->envCtx.sandstormEnvA >> 1; + primA1 = (play->envCtx.sandstormEnvA > 128) ? 255 : play->envCtx.sandstormEnvA >> 1; } else { - primA1 = globalCtx->state.frames % 128; + primA1 = play->state.frames % 128; if (primA1 > 64) { primA1 = 128 - primA1; } @@ -2339,29 +2339,29 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { break; case 1: primA1 = 255; - envA1 = (globalCtx->envCtx.sandstormPrimA >= 255) ? 255 : 128; + envA1 = (play->envCtx.sandstormPrimA >= 255) ? 255 : 128; break; case 2: envA1 = 128; - if (globalCtx->envCtx.sandstormEnvA > 128) { + if (play->envCtx.sandstormEnvA > 128) { primA1 = 0xFF; } else { - primA1 = globalCtx->state.frames % 128; + primA1 = play->state.frames % 128; if (primA1 > 64) { primA1 = 128 - primA1; } primA1 += 73; } if ((primA1 >= primA) && (primA1 != 255)) { - globalCtx->envCtx.sandstormState = 3; + play->envCtx.sandstormState = 3; } break; case 4: envA1 = 0; - primA1 = (globalCtx->envCtx.sandstormEnvA > 128) ? 255 : globalCtx->envCtx.sandstormEnvA >> 1; + primA1 = (play->envCtx.sandstormEnvA > 128) ? 255 : play->envCtx.sandstormEnvA >> 1; if (primA == 0) { - globalCtx->envCtx.sandstormState = 0; + play->envCtx.sandstormState = 0; } break; } @@ -2380,14 +2380,14 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { } else { envA = envA + 9; } - globalCtx->envCtx.sandstormPrimA = primA; - globalCtx->envCtx.sandstormEnvA = envA; + play->envCtx.sandstormPrimA = primA; + play->envCtx.sandstormEnvA = envA; sp98 = (512.0f - (primA + envA)) * (3.0f / 128.0f); if (sp98 > 6.0f) { sp98 = 6.0f; } - if (globalCtx->envCtx.indoors || (globalCtx->envCtx.unk_BF != 0xFF)) { + if (play->envCtx.indoors || (play->envCtx.unk_BF != 0xFF)) { primColor.r = sSandstormPrimColors[1].r; primColor.g = sSandstormPrimColors[1].g; primColor.b = sSandstormPrimColors[1].b; @@ -2418,29 +2418,29 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { sp94 = (s32)(D_8015FDB0 * (9.0f / 6.0f)); sp92 = (s32)(D_8015FDB0 * (6.0f / 6.0f)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = func_80093F34(POLY_XLU_DISP); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, globalCtx->envCtx.sandstormPrimA); - gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, globalCtx->envCtx.sandstormEnvA); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, play->envCtx.sandstormPrimA); + gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (u32)sp96 % 0x1000, 0, 0x200, 0x20, 1, (u32)sp94 % 0x1000, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (u32)sp96 % 0x1000, 0, 0x200, 0x20, 1, (u32)sp94 % 0x1000, 0xFFF - ((u32)sp92 % 0x1000), 0x100, 0x40)); gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); D_8015FDB0 += (s32)sp98; } -void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +void Environment_AdjustLights(PlayState* play, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { f32 temp; s32 i; - if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5 && func_800C0CB8(globalCtx)) { + if (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5 && func_800C0CB8(play)) { arg1 = CLAMP_MIN(arg1, 0.0f); arg1 = CLAMP_MAX(arg1, 1.0f); @@ -2449,18 +2449,18 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 temp = 0.0f; } - globalCtx->envCtx.adjFogNear = (arg2 - globalCtx->envCtx.lightSettings.fogNear) * temp; + play->envCtx.adjFogNear = (arg2 - play->envCtx.lightSettings.fogNear) * temp; if (arg1 == 0.0f) { for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjFogColor[i] = 0; + play->envCtx.adjFogColor[i] = 0; } } else { temp = arg1 * 5.0f; temp = CLAMP_MAX(temp, 1.0f); for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjFogColor[i] = -(s16)(globalCtx->envCtx.lightSettings.fogColor[i] * temp); + play->envCtx.adjFogColor[i] = -(s16)(play->envCtx.lightSettings.fogColor[i] * temp); } } @@ -2471,8 +2471,8 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg1 *= arg4; for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = -(s16)(globalCtx->envCtx.lightSettings.ambientColor[i] * arg1); - globalCtx->envCtx.adjLight1Color[i] = -(s16)(globalCtx->envCtx.lightSettings.light1Color[i] * arg1); + play->envCtx.adjAmbientColor[i] = -(s16)(play->envCtx.lightSettings.ambientColor[i] * arg1); + play->envCtx.adjLight1Color[i] = -(s16)(play->envCtx.lightSettings.light1Color[i] * arg1); } } } @@ -2503,37 +2503,37 @@ s32 Environment_IsForcedSequenceDisabled(void) { return isDisabled; } -void Environment_PlayStormNatureAmbience(GlobalContext* globalCtx) { - if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { +void Environment_PlayStormNatureAmbience(PlayState* play) { + if (play->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { Audio_PlayNatureAmbienceSequence(NATURE_ID_MARKET_NIGHT); } else { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); } Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 1); } -void Environment_StopStormNatureAmbience(GlobalContext* globalCtx) { +void Environment_StopStormNatureAmbience(PlayState* play) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0); if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { gSaveContext.seqId = NA_BGM_NATURE_SFX_RAIN; - Environment_PlaySceneSequence(globalCtx); + Environment_PlaySceneSequence(play); } } -void Environment_WarpSongLeave(GlobalContext* globalCtx) { +void Environment_WarpSongLeave(PlayState* play) { gWeatherMode = 0; gSaveContext.cutsceneIndex = 0; gSaveContext.respawnFlag = -3; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; - switch (globalCtx->nextEntranceIndex) { + switch (play->nextEntranceIndex) { case 0x147: Flags_SetEventChkInf(0xB9); break; diff --git a/soh/src/code/z_lifemeter.c b/soh/src/code/z_lifemeter.c index 6e3bbb52b..be093af73 100644 --- a/soh/src/code/z_lifemeter.c +++ b/soh/src/code/z_lifemeter.c @@ -123,8 +123,8 @@ s16 sBeatingHeartsDDEnv[3]; s16 sHeartsDDPrim[2][3]; s16 sHeartsDDEnv[2][3]; -void HealthMeter_Init(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void HealthMeter_Init(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (CVar_GetS32("gHudColors", 1) == 2) { HeartInner = CVar_GetRGB("gCCHeartsPrim", HeartInner_ori); HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori); @@ -169,8 +169,8 @@ void HealthMeter_Init(GlobalContext* globalCtx) { sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HeartDDInner.b; } -void HealthMeter_Update(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void HealthMeter_Update(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; f32 factor = interfaceCtx->unk_1FE * 0.1f; f32 ddFactor; s32 type = 0; @@ -328,13 +328,13 @@ void HealthMeter_Update(GlobalContext* globalCtx) { } -s32 func_80078E18(GlobalContext* globalCtx) { - gSaveContext.health = globalCtx->interfaceCtx.unk_226; +s32 func_80078E18(PlayState* play) { + gSaveContext.health = play->interfaceCtx.unk_226; return 1; } -s32 func_80078E34(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +s32 func_80078E34(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; interfaceCtx->unk_228 = 0x140; interfaceCtx->unk_226 += 0x10; @@ -347,8 +347,8 @@ s32 func_80078E34(GlobalContext* globalCtx) { return 0; } -s32 func_80078E84(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +s32 func_80078E84(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (interfaceCtx->unk_228 != 0) { interfaceCtx->unk_228--; @@ -357,7 +357,7 @@ s32 func_80078E84(GlobalContext* globalCtx) { interfaceCtx->unk_226 -= 0x10; if (interfaceCtx->unk_226 <= 0) { interfaceCtx->unk_226 = 0; - globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 1)); + play->damagePlayer(play, -(gSaveContext.health + 1)); return 1; } } @@ -419,7 +419,7 @@ s16 getHealthMeterYOffset() { } } -void HealthMeter_Draw(GlobalContext* globalCtx) { +void HealthMeter_Draw(PlayState* play) { s32 pad[5]; void* heartBgImg; u32 curColorSet; @@ -431,8 +431,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { f32 temp2; f32 temp3; f32 temp4; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vtx* sp154 = interfaceCtx->beatingHeartVtx; s32 curHeartFraction = gSaveContext.health % 0x10; s16 totalHeartCount = gSaveContext.healthCapacity / 0x10; @@ -673,16 +673,16 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void HealthMeter_HandleCriticalAlarm(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (interfaceCtx->unk_22C != 0) { interfaceCtx->unk_22A--; if (interfaceCtx->unk_22A <= 0) { interfaceCtx->unk_22A = 0; interfaceCtx->unk_22C = 0; - if (CVar_GetS32("gLowHpAlarm", 0) == 0 && !Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.debugState == 0) && HealthMeter_IsCritical() && !Gameplay_InCsMode(globalCtx)) { + if (CVar_GetS32("gLowHpAlarm", 0) == 0 && !Player_InCsMode(play) && (play->pauseCtx.state == 0) && + (play->pauseCtx.debugState == 0) && HealthMeter_IsCritical() && !Play_InCsMode(play)) { func_80078884(NA_SE_SY_HITPOINT_ALARM); } } diff --git a/soh/src/code/z_lights.c b/soh/src/code/z_lights.c index 57986baf8..740a0d9c8 100644 --- a/soh/src/code/z_lights.c +++ b/soh/src/code/z_lights.c @@ -205,8 +205,8 @@ s32 Lights_FreeNode(LightNode* light) { } } -void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx) { - LightContext_InitList(globalCtx, lightCtx); +void LightContext_Init(PlayState* play, LightContext* lightCtx) { + LightContext_InitList(play, lightCtx); LightContext_SetAmbientColor(lightCtx, 80, 80, 80); LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800); memset(&sLightsBuffer, 0, sizeof(sLightsBuffer)); @@ -233,13 +233,13 @@ Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]); } -void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx) { +void LightContext_InitList(PlayState* play, LightContext* lightCtx) { lightCtx->listHead = NULL; } -void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx) { +void LightContext_DestroyList(PlayState* play, LightContext* lightCtx) { while (lightCtx->listHead != NULL) { - LightContext_RemoveLight(globalCtx, lightCtx, lightCtx->listHead); + LightContext_RemoveLight(play, lightCtx, lightCtx->listHead); lightCtx->listHead = lightCtx->listHead->next; } } @@ -250,7 +250,7 @@ void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx) * Note: Due to the limited number of slots in a Lights group, inserting too many lights in the * list may result in older entries not being bound to a Light when calling Lights_BindAll */ -LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* lightCtx, LightInfo* info) { +LightNode* LightContext_InsertLight(PlayState* play, LightContext* lightCtx, LightInfo* info) { LightNode* node; node = Lights_FindBufSlot(); @@ -270,7 +270,7 @@ LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* ligh return node; } -void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* node) { +void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* node) { if (node != NULL) { if (node->prev != NULL) { node->prev->next = node->next; @@ -326,7 +326,7 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient return lights; } -void Lights_GlowCheckPrepare(GlobalContext* globalCtx) { +void Lights_GlowCheckPrepare(PlayState* play) { LightNode* node; LightPoint* params; Vec3f pos; @@ -335,7 +335,7 @@ void Lights_GlowCheckPrepare(GlobalContext* globalCtx) { f32 wX; f32 wY; - node = globalCtx->lightCtx.listHead; + node = play->lightCtx.listHead; while (node != NULL) { params = &node->info->params.point; @@ -348,7 +348,7 @@ void Lights_GlowCheckPrepare(GlobalContext* globalCtx) { pos.x = params->x; pos.y = params->y; pos.z = params->z; - func_8002BE04(globalCtx, &pos, &multDest, &wDest); + func_8002BE04(play, &pos, &multDest, &wDest); wX = multDest.x * wDest; wY = multDest.y * wDest; @@ -364,7 +364,7 @@ void Lights_GlowCheckPrepare(GlobalContext* globalCtx) { } } -void Lights_GlowCheck(GlobalContext* globalCtx) { +void Lights_GlowCheck(PlayState* play) { LightNode* node; LightPoint* params; Vec3f pos; @@ -375,7 +375,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { s32 wZ; s32 zBuf; - node = globalCtx->lightCtx.listHead; + node = play->lightCtx.listHead; while (node != NULL) { params = &node->info->params.point; @@ -388,7 +388,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { pos.x = params->x; pos.y = params->y; pos.z = params->z; - func_8002BE04(globalCtx, &pos, &multDest, &wDest); + func_8002BE04(play, &pos, &multDest, &wDest); params->drawGlow = false; wX = multDest.x * wDest; wY = multDest.y * wDest; @@ -410,13 +410,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { } } -void Lights_DrawGlow(GlobalContext* globalCtx) { +void Lights_DrawGlow(PlayState* play) { s32 pad; LightNode* node; - node = globalCtx->lightCtx.listHead; + node = play->lightCtx.listHead; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = func_800947AC(POLY_XLU_DISP++); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); @@ -439,7 +439,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, params->color[0], params->color[1], params->color[2], 50); Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGlowCircleDL); FrameInterpolation_RecordCloseChild(); @@ -448,5 +448,5 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { node = node->next; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index 0866b5332..33075e3fd 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -17,17 +17,17 @@ s16 Left_MM_Margin = 0; s16 Right_MM_Margin = 0; s16 Bottom_MM_Margin = 0; -void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Map_SavePlayerInitialInfo(PlayState* play) { + Player* player = GET_PLAYER(play); sPlayerInitialPosX = player->actor.world.pos.x; sPlayerInitialPosZ = player->actor.world.pos.z; sPlayerInitialDirection = (s16)((0x7FFF - player->actor.shape.rot.y) / 0x400); } -void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) { +void Map_SetPaletteData(PlayState* play, s16 room) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 paletteIndex = gMapData->roomPalette[mapIndex][room]; if (interfaceCtx->mapRoomNum == room) { @@ -44,9 +44,9 @@ void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) { interfaceCtx->mapPalette[paletteIndex * 2 + 1] = 0xBF; } -void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) { +void Map_SetFloorPalettesData(PlayState* play, s16 floor) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 room; s16 i; @@ -60,7 +60,7 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) { interfaceCtx->mapPalette[31] = 1; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -82,7 +82,7 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) { for (i = 0; i < gMapData->maxPaletteCount[mapIndex]; i++) { room = gMapData->paletteRoom[mapIndex][floor][i]; if ((room != 0xFF) && (gSaveContext.sceneFlags[mapIndex].rooms & gBitFlags[room])) { - Map_SetPaletteData(globalCtx, room); + Map_SetPaletteData(play, room); } } break; @@ -360,12 +360,12 @@ const char* minimapTableDangeon[] = gIceCavernRoom11MinimapTex, }; -void Map_InitData(GlobalContext* globalCtx, s16 room) { +void Map_InitData(PlayState* play, s16 room) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 extendedMapIndex; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -387,19 +387,19 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) { case SCENE_SPOT20: case SCENE_GANON_TOU: extendedMapIndex = mapIndex; - if (globalCtx->sceneNum == SCENE_SPOT02) { + if (play->sceneNum == SCENE_SPOT02) { if (CHECK_QUEST_ITEM(QUEST_SONG_NOCTURNE)) { extendedMapIndex = 0x14; } - } else if (globalCtx->sceneNum == SCENE_SPOT06) { + } else if (play->sceneNum == SCENE_SPOT06) { if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) { extendedMapIndex = 0x15; } - } else if (globalCtx->sceneNum == SCENE_SPOT09) { + } else if (play->sceneNum == SCENE_SPOT09) { if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !((gSaveContext.eventChkInf[9] & 0xF) == 0xF)) { extendedMapIndex = 0x16; } - } else if (globalCtx->sceneNum == SCENE_SPOT12) { + } else if (play->sceneNum == SCENE_SPOT12) { if ((gSaveContext.eventChkInf[9] & 0xF) == 0xF) { extendedMapIndex = 0x17; } @@ -414,7 +414,7 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) { if (sEntranceIconMapIndex < 24) { const char* textureName = minimapTableOW[sEntranceIconMapIndex]; - memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName)); + memcpy(play->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName)); } interfaceCtx->unk_258 = mapIndex; @@ -442,31 +442,31 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) { osSyncPrintf("デクの樹ダンジョンMAP テクスチャDMA(%x) scene_id_offset=%d VREG(30)=%d\n", room, mapIndex, VREG(30)); osSyncPrintf(VT_RST); - //DmaMgr_SendRequest1(globalCtx->interfaceCtx.mapSegment, + //DmaMgr_SendRequest1(play->interfaceCtx.mapSegment, //(uintptr_t)_map_i_staticSegmentRomStart + //((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * 0xFF0), //0xFF0, __FILE__, __LINE__); const char* textureName = minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room]; - memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName)); + memcpy(play->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName)); R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room]; R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room]; - Map_SetFloorPalettesData(globalCtx, VREG(30)); + Map_SetFloorPalettesData(play, VREG(30)); osSyncPrintf("MAP 各階ONチェック\n"); // "MAP Individual Floor ON Check" break; } } -void Map_InitRoomData(GlobalContext* globalCtx, s16 room) { +void Map_InitRoomData(PlayState* play, s16 room) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; osSyncPrintf("*******\n*******\nroom_no=%d (%d)(%d)\n*******\n*******\n", room, - mapIndex, globalCtx->sceneNum); + mapIndex, play->sceneNum); if (room >= 0) { - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -489,11 +489,11 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) { osSyncPrintf("ROOM_INF=%d\n", gSaveContext.sceneFlags[mapIndex].rooms); interfaceCtx->mapRoomNum = room; interfaceCtx->unk_25A = mapIndex; - Map_SetPaletteData(globalCtx, room); + Map_SetPaletteData(play, room); osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("部屋部屋=%d\n", room); // "Room Room = %d" osSyncPrintf(VT_RST); - Map_InitData(globalCtx, room); + Map_InitData(play, room); break; } } else { @@ -505,27 +505,27 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) { } } -void Map_Destroy(GlobalContext* globalCtx) { - MapMark_ClearPointers(globalCtx); +void Map_Destroy(PlayState* play) { + MapMark_ClearPointers(play); gMapData = NULL; } -void Map_Init(GlobalContext* globalCtx) { +void Map_Init(PlayState* play) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; gMapData = &gMapDataTable; interfaceCtx->unk_258 = -1; interfaceCtx->unk_25A = -1; - interfaceCtx->mapSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, 0x1000); + interfaceCtx->mapSegment = GAMESTATE_ALLOC_MC(&play->state, 0x1000); // "MAP texture initialization scene_data_ID=%d mapSegment=%x" - osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", globalCtx->sceneNum, - interfaceCtx->mapSegment, globalCtx); + osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", play->sceneNum, + interfaceCtx->mapSegment, play); ASSERT(interfaceCtx->mapSegment != NULL); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -546,13 +546,13 @@ void Map_Init(GlobalContext* globalCtx) { case SCENE_SPOT18: case SCENE_SPOT20: case SCENE_GANON_TOU: - mapIndex = globalCtx->sceneNum - SCENE_SPOT00; + mapIndex = play->sceneNum - SCENE_SPOT00; R_MAP_INDEX = gSaveContext.mapIndex = mapIndex; R_COMPASS_SCALE_X = gMapData->owCompassInfo[mapIndex][0]; R_COMPASS_SCALE_Y = gMapData->owCompassInfo[mapIndex][1]; R_COMPASS_OFFSET_X = gMapData->owCompassInfo[mapIndex][2]; R_COMPASS_OFFSET_Y = gMapData->owCompassInfo[mapIndex][3]; - Map_InitData(globalCtx, mapIndex); + Map_InitData(play, mapIndex); R_OW_MINIMAP_X = gMapData->owMinimapPosX[mapIndex]; R_OW_MINIMAP_Y = gMapData->owMinimapPosY[mapIndex]; break; @@ -582,24 +582,24 @@ void Map_Init(GlobalContext* globalCtx) { case SCENE_JYASINBOSS: case SCENE_HAKADAN_BS: mapIndex = - (globalCtx->sceneNum >= SCENE_YDAN_BOSS) ? globalCtx->sceneNum - SCENE_YDAN_BOSS : globalCtx->sceneNum; + (play->sceneNum >= SCENE_YDAN_BOSS) ? play->sceneNum - SCENE_YDAN_BOSS : play->sceneNum; R_MAP_INDEX = gSaveContext.mapIndex = mapIndex; - if ((globalCtx->sceneNum <= SCENE_ICE_DOUKUTO) || (globalCtx->sceneNum >= SCENE_YDAN_BOSS)) { + if ((play->sceneNum <= SCENE_ICE_DOUKUTO) || (play->sceneNum >= SCENE_YDAN_BOSS)) { R_COMPASS_SCALE_X = gMapData->dgnCompassInfo[mapIndex][0]; R_COMPASS_SCALE_Y = gMapData->dgnCompassInfo[mapIndex][1]; R_COMPASS_OFFSET_X = gMapData->dgnCompassInfo[mapIndex][2]; R_COMPASS_OFFSET_Y = gMapData->dgnCompassInfo[mapIndex][3]; R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE = gMapData->dgnMinimapTexIndexBase[mapIndex]; - Map_InitRoomData(globalCtx, globalCtx->roomCtx.curRoom.num); - MapMark_Init(globalCtx); + Map_InitRoomData(play, play->roomCtx.curRoom.num); + MapMark_Init(play); } break; } } -void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { +void Minimap_DrawCompassIcons(PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 tempX, tempZ; const Color_RGB8 LastEntrance_arrow = { 200, 0, 0 }; const Color_RGB8 CurrentPosition_arrow = { 200, 255, 0 }; @@ -613,10 +613,10 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { Y_Margins_Minimap = 0; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (globalCtx->interfaceCtx.minimapAlpha >= 0xAA) { - func_80094A14(globalCtx->state.gfxCtx); + if (play->interfaceCtx.minimapAlpha >= 0xAA) { + func_80094A14(play->state.gfxCtx); //Player current position (yellow arrow) gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -656,7 +656,7 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { Matrix_RotateX(-1.6f, MTXMODE_APPLY); tempX = (0x7FFF - player->actor.shape.rot.y) / 0x400; Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (CVar_GetS32("gHudColors", 1) == 2) { @@ -697,7 +697,7 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { Matrix_Scale(VREG(9) / 100.0f, VREG(9) / 100.0f, VREG(9) / 100.0f, MTXMODE_APPLY); Matrix_RotateX(VREG(52) / 10.0f, MTXMODE_APPLY); Matrix_RotateY(sPlayerInitialDirection / 10.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (CVar_GetS32("gHudColors", 1) == 2) { @@ -708,24 +708,24 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Minimap_Draw(GlobalContext* globalCtx) { +void Minimap_Draw(PlayState* play) { s32 pad[2]; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s32 mapIndex = gSaveContext.mapIndex; const Color_RGB8 Dungeon_minimap = {100, 255, 255}; const Color_RGB8 Overworld_minimap = {R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2)}; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // If any of these CVars are enabled, disable toggling the minimap with L, unless gEnableMapToggle is set bool enableMapToggle = !(CVar_GetS32("gDebugEnabled", 0) || CVar_GetS32("gMoonJumpOnL", 0) || CVar_GetS32("gTurboOnL", 0)) || CVar_GetS32("gEnableMapToggle", 0); - if (globalCtx->pauseCtx.state < 4) { + if (play->pauseCtx.state < 4) { //Minimap margins s16 X_Margins_Minimap; s16 Y_Margins_Minimap; @@ -737,7 +737,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { Y_Margins_Minimap = 0; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -749,7 +749,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { case SCENE_HAKADANCH: case SCENE_ICE_DOUKUTO: if (!R_MINIMAP_DISABLED) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetCombineLERP(OVERLAY_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); @@ -787,14 +787,14 @@ void Minimap_Draw(GlobalContext* globalCtx) { } if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, mapIndex)) { - Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position - func_80094520(globalCtx->state.gfxCtx); - MapMark_Draw(globalCtx); + Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position + func_80094520(play->state.gfxCtx); + MapMark_Draw(play); } } - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx) && enableMapToggle) { - osSyncPrintf("Game_play_demo_mode_check=%d\n", Gameplay_InCsMode(globalCtx)); + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play) && enableMapToggle) { + osSyncPrintf("Game_play_demo_mode_check=%d\n", Play_InCsMode(play)); // clang-format off if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -826,7 +826,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { case SCENE_SPOT20: case SCENE_GANON_TOU: if (!R_MINIMAP_DISABLED) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CVar_GetS32("gHudColors", 1) == 2) {//Overworld minimap @@ -865,8 +865,8 @@ void Minimap_Draw(GlobalContext* globalCtx) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Overworld_minimap.r, Overworld_minimap.g, Overworld_minimap.b, interfaceCtx->minimapAlpha); } - if (((globalCtx->sceneNum != SCENE_SPOT01) && (globalCtx->sceneNum != SCENE_SPOT04) && - (globalCtx->sceneNum != SCENE_SPOT08)) || + if (((play->sceneNum != SCENE_SPOT01) && (play->sceneNum != SCENE_SPOT04) && + (play->sceneNum != SCENE_SPOT08)) || (LINK_AGE_IN_YEARS != YEARS_ADULT)) { bool Map0 = gMapData->owEntranceIconPosY[sEntranceIconMapIndex] << 2 == 0; s16 IconSize = 8; @@ -941,13 +941,13 @@ void Minimap_Draw(GlobalContext* globalCtx) { } } - if ((globalCtx->sceneNum == SCENE_SPOT08) && (gSaveContext.infTable[26] & gBitFlags[9])) { + if ((play->sceneNum == SCENE_SPOT08) && (gSaveContext.infTable[26] & gBitFlags[9])) { gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPWideTextureRectangle(OVERLAY_DISP++, entranceX << 2, entranceY << 2, (entranceX + 32) << 2, (entranceY + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - } else if ((globalCtx->sceneNum == SCENE_SPOT08) && CVar_GetS32("gAlwaysShowDungeonMinimapIcon", 0) != 0){ + } else if ((play->sceneNum == SCENE_SPOT08) && CVar_GetS32("gAlwaysShowDungeonMinimapIcon", 0) != 0){ gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, @@ -957,10 +957,10 @@ void Minimap_Draw(GlobalContext* globalCtx) { G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } - Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position + Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position } - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx) && enableMapToggle) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play) && enableMapToggle) { // clang-format off if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -974,18 +974,18 @@ void Minimap_Draw(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) { return gMapData->floorTexIndexOffset[mapIndex][floor]; } -void Map_Update(GlobalContext* globalCtx) { +void Map_Update(PlayState* play) { static s16 sLastRoomNum = 99; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 floor; s16 i; @@ -994,8 +994,8 @@ void Map_Update(GlobalContext* globalCtx) { Right_MM_Margin = CVar_GetS32("gHUDMargin_R", 0); Bottom_MM_Margin = CVar_GetS32("gHUDMargin_B", 0); - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { - switch (globalCtx->sceneNum) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -1040,9 +1040,9 @@ void Map_Update(GlobalContext* globalCtx) { // "Layer switching = %x" osSyncPrintf("階層切替=%x\n", interfaceCtx->mapRoomNum); osSyncPrintf(VT_RST); - Map_InitData(globalCtx, interfaceCtx->mapRoomNum); + Map_InitData(play, interfaceCtx->mapRoomNum); gSaveContext.sunsSongState = SUNSSONG_INACTIVE; - Map_SavePlayerInitialInfo(globalCtx); + Map_SavePlayerInitialInfo(play); } } @@ -1056,9 +1056,9 @@ void Map_Update(GlobalContext* globalCtx) { case SCENE_MIZUSIN_BS: case SCENE_JYASINBOSS: case SCENE_HAKADAN_BS: - VREG(30) = gMapData->bossFloor[globalCtx->sceneNum - SCENE_YDAN_BOSS]; + VREG(30) = gMapData->bossFloor[play->sceneNum - SCENE_YDAN_BOSS]; R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE + - gMapData->floorTexIndexOffset[globalCtx->sceneNum - SCENE_YDAN_BOSS][VREG(30)]; + gMapData->floorTexIndexOffset[play->sceneNum - SCENE_YDAN_BOSS][VREG(30)]; break; } } diff --git a/soh/src/code/z_map_mark.c b/soh/src/code/z_map_mark.c index 79540ee20..05e66e1aa 100644 --- a/soh/src/code/z_map_mark.c +++ b/soh/src/code/z_map_mark.c @@ -54,11 +54,11 @@ static MapMarkInfo sMapMarkInfoTable[] = { MapMarkData** sLoadedMarkDataTable; -void MapMark_Init(GlobalContext* globalCtx) { +void MapMark_Init(PlayState* play) { //MapMarkDataOverlay* overlay = &sMapMarkDataOvl; //u32 overlaySize = (uintptr_t)overlay->vramEnd - (uintptr_t)overlay->vramStart; - //overlay->loadedRamAddr = GAMESTATE_ALLOC_MC(&globalCtx->state, overlaySize); + //overlay->loadedRamAddr = GAMESTATE_ALLOC_MC(&play->state, overlaySize); //LOG_CHECK_NULL_POINTER("dlftbl->allocp", overlay->loadedRamAddr); //Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr); @@ -75,12 +75,12 @@ void MapMark_Init(GlobalContext* globalCtx) { //: NULL); } -void MapMark_ClearPointers(GlobalContext* globalCtx) { +void MapMark_ClearPointers(PlayState* play) { //sMapMarkDataOvl.loadedRamAddr = NULL; sLoadedMarkDataTable = NULL; } -void MapMark_DrawForDungeon(GlobalContext* globalCtx) { +void MapMark_DrawForDungeon(PlayState* play) { InterfaceContext* interfaceCtx; MapMarkIconData* mapMarkIconData; MapMarkPoint* markPoint; @@ -90,18 +90,18 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) { s32 rectLeft; s32 rectTop; - interfaceCtx = &globalCtx->interfaceCtx; + interfaceCtx = &play->interfaceCtx; - if ((gMapData != NULL) && (globalCtx->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) { + if ((gMapData != NULL) && (play->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) { // "Room number exceeded, yikes %d/%d MapMarkDraw processing interrupted" osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n", - VT_RST, globalCtx->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]); + VT_RST, play->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]); return; } mapMarkIconData = &sLoadedMarkDataTable[dungeon][interfaceCtx->mapRoomNum][0]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); while (true) { if (mapMarkIconData->markType == MAP_MARK_NONE) { @@ -131,7 +131,7 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) { markPoint = &mapMarkIconData->points[0]; //Place each chest / boss room icon for (i = 0; i < mapMarkIconData->count; i++) { - if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) { + if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(play, markPoint->chestFlag)) { //Minimap chest / boss icon const s32 PosX_Minimap_ori = GREG(94) + OTRGetRectDimensionFromRightEdge(markPoint->x+X_Margins_Minimap_ic) + 204; const s32 PosY_Minimap_ori = GREG(95) + markPoint->y + Y_Margins_Minimap_ic + 140; @@ -139,10 +139,10 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) { rectTop = (markPoint->y + Y_Margins_Minimap_ic + 140 + CVar_GetS32("gMinimapPosY", 0)); if (CVar_GetS32("gMinimapPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap_ic = Left_MC_Margin;}; - if (globalCtx->sceneNum == SCENE_YDAN || globalCtx->sceneNum == SCENE_DDAN || globalCtx->sceneNum == SCENE_BDAN || - globalCtx->sceneNum == SCENE_BMORI1 || globalCtx->sceneNum == SCENE_HIDAN || globalCtx->sceneNum == SCENE_MIZUSIN || - globalCtx->sceneNum == SCENE_JYASINZOU || globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH || - globalCtx->sceneNum == SCENE_ICE_DOUKUTO) { + if (play->sceneNum == SCENE_YDAN || play->sceneNum == SCENE_DDAN || play->sceneNum == SCENE_BDAN || + play->sceneNum == SCENE_BMORI1 || play->sceneNum == SCENE_HIDAN || play->sceneNum == SCENE_MIZUSIN || + play->sceneNum == SCENE_JYASINZOU || play->sceneNum == SCENE_HAKADAN || play->sceneNum == SCENE_HAKADANCH || + play->sceneNum == SCENE_ICE_DOUKUTO) { rectLeft = OTRGetRectDimensionFromLeftEdge(markPoint->x+CVar_GetS32("gMinimapPosX", 0)+204+X_Margins_Minimap_ic); } else { rectLeft = OTRGetRectDimensionFromLeftEdge(markPoint->x+CVar_GetS32("gMinimapPosX", 0)+204+X_Margins_Minimap_ic); @@ -183,11 +183,11 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) { mapMarkIconData++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void MapMark_Draw(GlobalContext* globalCtx) { - switch (globalCtx->sceneNum) { +void MapMark_Draw(PlayState* play) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -203,7 +203,7 @@ void MapMark_Draw(GlobalContext* globalCtx) { case SCENE_BDAN_BOSS: case SCENE_MORIBOSSROOM: case SCENE_FIRE_BS: - MapMark_DrawForDungeon(globalCtx); + MapMark_DrawForDungeon(play); break; } } diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 341bd9372..54854c387 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -200,12 +200,12 @@ void Message_ResetOcarinaNoteState(void) { } } -void Message_UpdateOcarinaGame(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_UpdateOcarinaGame(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; - globalCtx->msgCtx.msgMode++; + play->msgCtx.msgMode++; - if (globalCtx->msgCtx.msgMode == MSGMODE_MEMORY_GAME_PLAYER_PLAYING) { + if (play->msgCtx.msgMode == MSGMODE_MEMORY_GAME_PLAYER_PLAYING) { Audio_OcaSetInstrument(1); msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0; @@ -221,8 +221,8 @@ void Message_UpdateOcarinaGame(GlobalContext* globalCtx) { Message_ResetOcarinaNoteState(); } -u8 Message_ShouldAdvance(GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[0]; +u8 Message_ShouldAdvance(PlayState* play) { + Input* input = &play->state.input[0]; bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); @@ -233,8 +233,8 @@ u8 Message_ShouldAdvance(GlobalContext* globalCtx) { return CHECK_BTN_ALL(input->press.button, BTN_A) || isB_Held || CHECK_BTN_ALL(input->press.button, BTN_CUP); } -u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[0]; +u8 Message_ShouldAdvanceSilent(PlayState* play) { + Input* input = &play->state.input[0]; bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); @@ -246,8 +246,8 @@ u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { * Closes any currently displayed textbox immediately, without waiting for * input from the player. */ -void Message_CloseTextbox(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_CloseTextbox(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; if (msgCtx->msgLength != 0) { msgCtx->stateTimer = 2; @@ -257,10 +257,10 @@ void Message_CloseTextbox(GlobalContext* globalCtx) { } } -void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) { +void Message_HandleChoiceSelection(PlayState* play, u8 numChoices) { static s16 sAnalogStickHeld = false; - MessageContext* msgCtx = &globalCtx->msgCtx; - Input* input = &globalCtx->state.input[0]; + MessageContext* msgCtx = &play->msgCtx; + Input* input = &play->state.input[0]; bool dpad = CVar_GetS32("gDpadText", 0); if ((input->rel.stick_y >= 30 && !sAnalogStickHeld) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) { @@ -287,8 +287,8 @@ void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) { (numChoices == 1) ? R_TEXT_CHOICE_YPOS(msgCtx->choiceIndex + 1) : R_TEXT_CHOICE_YPOS(msgCtx->choiceIndex); } -void Message_DrawTextChar(GlobalContext* globalCtx, void* textureImage, Gfx** p) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_DrawTextChar(PlayState* play, void* textureImage, Gfx** p) { + MessageContext* msgCtx = &play->msgCtx; Gfx* gfx = *p; s16 x = msgCtx->textPosX; s16 y = msgCtx->textPosY; @@ -356,7 +356,7 @@ void Message_GrowTextbox(MessageContext* msgCtx) { R_TEXTBOX_X = (R_TEXTBOX_X_TARGET + R_TEXTBOX_WIDTH_TARGET) - (R_TEXTBOX_WIDTH / 2); } -void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { +void Message_FindMessage(PlayState* play, u16 textId) { const char* foundSeg; const char* nextSeg; MessageTableEntry* messageTableEntry = sNesMessageEntryTablePtr; @@ -383,7 +383,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &globalCtx->msgCtx.font; + font = &play->msgCtx.font; if (messageTableEntry->textId == bufferId) { foundSeg = messageTableEntry->segment; @@ -404,7 +404,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { // "Message not found!!!" osSyncPrintf(" メッセージが,見つからなかった!!! = %x\n", bufferId); - font = &globalCtx->msgCtx.font; + font = &play->msgCtx.font; messageTableEntry = sNesMessageEntryTablePtr; foundSeg = messageTableEntry->segment; @@ -415,7 +415,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { font->msgLength = nextSeg - foundSeg; } -void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) { +void Message_FindCreditsMessage(PlayState* play, u16 textId) { const char* foundSeg; const char* nextSeg; const char* seg; @@ -424,7 +424,7 @@ void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) { seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &globalCtx->msgCtx.font; + font = &play->msgCtx.font; if (messageTableEntry->textId == textId) { foundSeg = messageTableEntry->segment; @@ -527,7 +527,7 @@ void Message_SetTextColor(MessageContext* msgCtx, u16 colorParameter) { } } -void Message_DrawTextboxIcon(GlobalContext* globalCtx, Gfx** p, s16 x, s16 y) { +void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { static s16 sIconPrimColors[][3] = { { 0, 200, 80 }, { 50, 255, 130 }, @@ -585,7 +585,7 @@ void Message_DrawTextboxIcon(GlobalContext* globalCtx, Gfx** p, s16 x, s16 y) { sIconEnvColors[1][1] = 10; sIconEnvColors[1][2] = 10; } - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; Gfx* gfx = *p; s16 primR; @@ -829,10 +829,10 @@ f32 sFontWidths[144] = { 14.0f, // ? }; -u16 Message_DrawItemIcon(GlobalContext* globalCtx, u16 itemId, Gfx** p, u16 i) { +u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) { s32 pad; Gfx* gfx = *p; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; // clang-format off if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySoundGeneral(0, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -868,11 +868,11 @@ u16 Message_DrawItemIcon(GlobalContext* globalCtx, u16 itemId, Gfx** p, u16 i) { return i; } -void Message_HandleOcarina(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_HandleOcarina(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; - if (globalCtx->msgCtx.msgMode == MSGMODE_TEXT_DISPLAYING) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + if (play->msgCtx.msgMode == MSGMODE_TEXT_DISPLAYING) { + play->msgCtx.ocarinaMode = OCARINA_MODE_01; if (msgCtx->ocarinaAction == OCARINA_ACTION_SCARECROW_LONG_RECORDING) { msgCtx->msgMode = MSGMODE_SCARECROW_LONG_RECORDING_START; @@ -938,18 +938,18 @@ void Message_HandleOcarina(GlobalContext* globalCtx) { * Draws the text contents of a textbox, up to the current point that has * been scrolled to so far. */ -void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_DrawText(PlayState* play, Gfx** gfxP) { + MessageContext* msgCtx = &play->msgCtx; u16 lookAheadCharacter; u8 character; u16 j; u16 i; u16 sfxHi; u16 charTexIdx; - Font* font = &globalCtx->msgCtx.font; + Font* font = &play->msgCtx.font; Gfx* gfx = *gfxP; - globalCtx->msgCtx.textPosX = R_TEXT_INIT_XPOS; + play->msgCtx.textPosX = R_TEXT_INIT_XPOS; if (sTextIsCredits == false) { msgCtx->textPosY = R_TEXT_INIT_YPOS; @@ -1081,7 +1081,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { i += 2; break; case MESSAGE_ITEM_ICON: - i = Message_DrawItemIcon(globalCtx, msgCtx->msgBufDecoded[i + 1], &gfx, i); + i = Message_DrawItemIcon(play, msgCtx->msgBufDecoded[i + 1], &gfx, i); break; case MESSAGE_BACKGROUND: // clang-format off @@ -1170,8 +1170,8 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_END, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); - if (globalCtx->csCtx.state == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_RETURN); + if (play->csCtx.state == 0) { + Interface_SetDoAction(play, DO_ACTION_RETURN); } } } @@ -1180,7 +1180,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { case MESSAGE_OCARINA: msgCtx->textDrawPos = i + 1; if (i + 1 == msgCtx->textDrawPos) { - Message_HandleOcarina(globalCtx); + Message_HandleOcarina(play); *gfxP = gfx; return; } @@ -1191,8 +1191,8 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; msgCtx->stateTimer = msgCtx->msgBufDecoded[++i]; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); - if (globalCtx->csCtx.state == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_RETURN); + if (play->csCtx.state == 0) { + Interface_SetDoAction(play, DO_ACTION_RETURN); } } *gfxP = gfx; @@ -1219,7 +1219,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { msgCtx->textDelayTimer == msgCtx->textDelay) { Audio_PlaySoundGeneral(0, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - Message_DrawTextChar(globalCtx, &font->charTexBuf[charTexIdx], &gfx); + Message_DrawTextChar(play, &font->charTexBuf[charTexIdx], &gfx); charTexIdx += FONT_CHAR_TEX_SIZE; msgCtx->textPosX += (s32)(sFontWidths[character - ' '] * (R_TEXT_CHAR_SCALE / 100.0f)); @@ -1235,11 +1235,11 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { *gfxP = gfx; } -void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) { +void Message_LoadItemIcon(PlayState* play, u16 itemId, s16 y) { static s16 sIconItem32XOffsets[] = { 74, 74, 74 }; static s16 sIconItem24XOffsets[] = { 72, 72, 72 }; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (itemId == ITEM_DUNGEON_MAP) { interfaceCtx->mapPalette[30] = 0xFF; @@ -1266,7 +1266,7 @@ void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) { msgCtx->choiceNum = 1; } -void Message_Decode(GlobalContext* globalCtx) { +void Message_Decode(PlayState* play) { u8 temp_s2; u8 phi_s1; u16 phi_s0_3; @@ -1278,22 +1278,22 @@ void Message_Decode(GlobalContext* globalCtx) { s16 i; s16 digits[4]; f32 timeInSeconds; - MessageContext* msgCtx = &globalCtx->msgCtx; - Font* font = &globalCtx->msgCtx.font; + MessageContext* msgCtx = &play->msgCtx; + Font* font = &play->msgCtx.font; if ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode <= MSGMODE_OCARINA_AWAIT_INPUT) || msgCtx->textBoxType == TEXTBOX_TYPE_OCARINA) { // TODO: Figure out what specific textures to invalidate to prevent the ocarina textboxes from flashing - gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL); + gSPInvalidateTexCache(play->state.gfxCtx->polyOpa.p++, NULL); } else { for (u32 i = 0; i < FONT_CHAR_TEX_SIZE * 120; i += FONT_CHAR_TEX_SIZE) { if (&font->charTexBuf[i] != NULL) { - gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); + gSPInvalidateTexCache(play->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); } } } - globalCtx->msgCtx.textDelayTimer = 0; - globalCtx->msgCtx.textUnskippable = globalCtx->msgCtx.textDelay = globalCtx->msgCtx.textDelayTimer = 0; + play->msgCtx.textDelayTimer = 0; + play->msgCtx.textUnskippable = play->msgCtx.textDelay = play->msgCtx.textDelayTimer = 0; sTextFade = false; while (true) { @@ -1619,7 +1619,7 @@ void Message_Decode(GlobalContext* globalCtx) { msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[msgCtx->msgBufPos + 1]; osSyncPrintf("ITEM_NO=(%d) (%d)\n", msgCtx->msgBufDecoded[decodedBufPos], font->msgBuf[msgCtx->msgBufPos + 1]); - Message_LoadItemIcon(globalCtx, font->msgBuf[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); + Message_LoadItemIcon(play, font->msgBuf[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (temp_s2 == MESSAGE_BACKGROUND) { msgCtx->textboxBackgroundIdx = font->msgBuf[msgCtx->msgBufPos + 1] * 2; msgCtx->textboxBackgroundForeColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF0) >> 4; @@ -1673,9 +1673,9 @@ void Message_Decode(GlobalContext* globalCtx) { extern const char* msgStaticTbl[]; -void Message_OpenText(GlobalContext* globalCtx, u16 textId) { +void Message_OpenText(PlayState* play, u16 textId) { static s16 messageStaticIndices[] = { 0, 1, 3, 2 }; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; s16 textBoxType; @@ -1690,11 +1690,11 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { if ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode <= MSGMODE_OCARINA_AWAIT_INPUT) || msgCtx->textBoxType == TEXTBOX_TYPE_OCARINA) { // TODO: Figure out what specific textures to invalidate to prevent the ocarina textboxes from flashing - gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL); + gSPInvalidateTexCache(play->state.gfxCtx->polyOpa.p++, NULL); } else { for (u32 i = 0; i < FONT_CHAR_TEX_SIZE * 120; i += FONT_CHAR_TEX_SIZE) { if (&font->charTexBuf[i] != NULL) { - gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); + gSPInvalidateTexCache(play->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); } } } @@ -1737,10 +1737,10 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { } // RANDOTODO: Use this for ice trap messages - if (CustomMessage_RetrieveIfExists(globalCtx)) { + if (CustomMessage_RetrieveIfExists(play)) { osSyncPrintf("Found custom message"); } else if (sTextIsCredits) { - Message_FindCreditsMessage(globalCtx, textId); + Message_FindCreditsMessage(play, textId); msgCtx->msgLength = font->msgLength; char* src = (uintptr_t)font->msgOffset; memcpy(font->msgBuf, src, font->msgLength); @@ -1759,10 +1759,10 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { (textId == 0x4C || textId == 0xA4)) || // 4D == Hylian Shield textId == 0x4D)) { - Message_FindMessage(globalCtx, textId); + Message_FindMessage(play, textId); msgCtx->msgLength = font->msgLength = GetEquipNowMessage(font->msgBuf, font->msgOffset, sizeof(font->msgBuf)); } else { - Message_FindMessage(globalCtx, textId); + Message_FindMessage(play, textId); msgCtx->msgLength = font->msgLength; char* src = (uintptr_t)font->msgOffset; memcpy(font->msgBuf, src, font->msgLength); @@ -1807,8 +1807,8 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = 0; } -void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor) { + MessageContext* msgCtx = &play->msgCtx; osSyncPrintf(VT_FGCOL(BLUE)); // "Message" @@ -1820,19 +1820,19 @@ void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor) { // so we need to switch the order of these lines if (gSaveContext.n64ddFlag && textId == 0x2053) { msgCtx->talkActor = actor; - Message_OpenText(globalCtx, textId); + Message_OpenText(play, textId); } else { - Message_OpenText(globalCtx, textId); + Message_OpenText(play, textId); msgCtx->talkActor = actor; } msgCtx->msgMode = MSGMODE_TEXT_START; msgCtx->stateTimer = 0; msgCtx->textDelayTimer = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; } -void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_ContinueTextbox(PlayState* play, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; osSyncPrintf(VT_FGCOL(GREEN)); // "Message" @@ -1840,7 +1840,7 @@ void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId) { osSyncPrintf(VT_RST); msgCtx->msgLength = 0; - Message_OpenText(globalCtx, textId); + Message_OpenText(play, textId); msgCtx->msgMode = MSGMODE_NONE; msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; msgCtx->msgMode = MSGMODE_TEXT_CONTINUING; @@ -1848,13 +1848,13 @@ void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId) { msgCtx->textboxEndType = msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = msgCtx->textDelayTimer = 0; msgCtx->textColorAlpha = 255; - if (YREG(31) == 0 && globalCtx->interfaceCtx.unk_1FA == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_NEXT); + if (YREG(31) == 0 && play->interfaceCtx.unk_1FA == 0) { + Interface_SetDoAction(play, DO_ACTION_NEXT); } msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; } -void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { +void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) { static u16 sOcarinaSongFlagsMap[] = { (1 << OCARINA_SONG_MINUET), (1 << OCARINA_SONG_BOLERO), (1 << OCARINA_SONG_SERENADE), (1 << OCARINA_SONG_REQUIEM), (1 << OCARINA_SONG_NOCTURNE), (1 << OCARINA_SONG_PRELUDE), @@ -1862,7 +1862,7 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { (1 << OCARINA_SONG_SUNS), (1 << OCARINA_SONG_TIME), (1 << OCARINA_SONG_STORMS), (1 << OCARINA_SONG_SCARECROW), }; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; s32 textId; s16 j; s16 i; @@ -1894,11 +1894,11 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ オカリナ番号=%d(%d) ☆☆☆☆☆\n" VT_RST, ocarinaActionId, 2); noStop = false; if (ocarinaActionId >= 0x893) { - Message_OpenText(globalCtx, ocarinaActionId); // You played the [song name] + Message_OpenText(play, ocarinaActionId); // You played the [song name] textId = ocarinaActionId + 0x86E; } else if (ocarinaActionId == OCARINA_ACTION_MEMORY_GAME) { msgCtx->ocarinaAction = ocarinaActionId; - Message_OpenText(globalCtx, 0x86D); // Play using [A] and [C]. + Message_OpenText(play, 0x86D); // Play using [A] and [C]. textId = ocarinaActionId + 0x86E; } else if (ocarinaActionId == OCARINA_ACTION_FREE_PLAY || ocarinaActionId >= OCARINA_ACTION_CHECK_SARIA) { osSyncPrintf("ocarina_set 000000000000000000 = %d\n", ocarinaActionId); @@ -1907,10 +1907,10 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } if (ocarinaActionId == OCARINA_ACTION_SCARECROW_PLAYBACK) { - Message_OpenText(globalCtx, 0x86F); // Ocarina + Message_OpenText(play, 0x86F); // Ocarina textId = ocarinaActionId + 0x86E; } else { - Message_OpenText(globalCtx, 0x86E); // Play using [A] and [C]; [B] to Stop. + Message_OpenText(play, 0x86E); // Play using [A] and [C]; [B] to Stop. textId = ocarinaActionId + 0x86E; } } else { @@ -1918,19 +1918,19 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { noStop = true; if (ocarinaActionId >= OCARINA_ACTION_PLAYBACK_MINUET) { osSyncPrintf("222222222\n"); - Message_OpenText(globalCtx, 0x86D); // Play using [A] and [C]. + Message_OpenText(play, 0x86D); // Play using [A] and [C]. textId = ocarinaActionId + 0x86E; } else { osSyncPrintf("333333333\n"); textId = ocarinaActionId + 0x86E; - Message_OpenText(globalCtx, textId); // Play using [A] and [C]; [B] to Stop. + Message_OpenText(play, textId); // Play using [A] and [C]; [B] to Stop. } } msgCtx->talkActor = NULL; // "Ocarina Mode" osSyncPrintf("オカリナモード = %d (%x)\n", msgCtx->ocarinaAction, textId); msgCtx->textDelayTimer = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; R_TEXTBOX_X = 34; R_TEXTBOX_Y = 142; R_TEXTBOX_TEXWIDTH = 512; @@ -1946,7 +1946,7 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { } msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; if (noStop == false) { - Interface_LoadActionLabelB(globalCtx, DO_ACTION_STOP); + Interface_LoadActionLabelB(play, DO_ACTION_STOP); noStop = gSaveContext.unk_13EA; Interface_ChangeAlpha(0xA); gSaveContext.unk_13EA = noStop; @@ -1961,7 +1961,7 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { msgCtx->textBoxType = TEXTBOX_TYPE_BLUE; } else if (ocarinaActionId == OCARINA_ACTION_MEMORY_GAME) { Interface_ChangeAlpha(1); - Message_Decode(globalCtx); + Message_Decode(play); msgCtx->msgMode = MSGMODE_MEMORY_GAME_START; } else if (ocarinaActionId == OCARINA_ACTION_SCARECROW_LONG_PLAYBACK) { // "?????Recording Playback / Recording Playback / Recording Playback / Recording Playback -> " @@ -1979,18 +1979,18 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { Interface_ChangeAlpha(1); } for (k = 0, j = 0; j < 48; j++, k += 0x80) { - func_8006EE50(&globalCtx->msgCtx.font, 0x8140, k); + func_8006EE50(&play->msgCtx.font, 0x8140, k); } } -void func_8010BD58(GlobalContext* globalCtx, u16 ocarinaActionId) { - globalCtx->msgCtx.unk_E40E = 0; - Message_StartOcarina(globalCtx, ocarinaActionId); +void func_8010BD58(PlayState* play, u16 ocarinaActionId) { + play->msgCtx.unk_E40E = 0; + Message_StartOcarina(play, ocarinaActionId); } -void func_8010BD88(GlobalContext* globalCtx, u16 ocarinaActionId) { - globalCtx->msgCtx.unk_E40E = 1; - Message_StartOcarina(globalCtx, ocarinaActionId); +void func_8010BD88(PlayState* play, u16 ocarinaActionId) { + play->msgCtx.unk_E40E = 1; + Message_StartOcarina(play, ocarinaActionId); } u8 Message_GetState(MessageContext* msgCtx) { @@ -2028,8 +2028,8 @@ u8 Message_GetState(MessageContext* msgCtx) { return state; } -void Message_DrawTextBox(GlobalContext* globalCtx, Gfx** p) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_DrawTextBox(PlayState* play, Gfx** p) { + MessageContext* msgCtx = &play->msgCtx; Gfx* gfx = *p; gSPInvalidateTexCache(gfx++, msgCtx->textboxSegment); @@ -2078,7 +2078,7 @@ void Message_SetView(View* view) { /** * Draws the textbox in full and updates ocarina state */ -void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { +void Message_DrawMain(PlayState* play, Gfx** p) { static s16 sOcarinaEffectActorIds[] = { ACTOR_OCEFF_WIPE3, ACTOR_OCEFF_WIPE2, ACTOR_OCEFF_WIPE, ACTOR_OCEFF_SPOT, ACTOR_OCEFF_WIPE, ACTOR_OCEFF_STORM, ACTOR_OCEFF_WIPE4, @@ -2176,10 +2176,10 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { NA_BGM_OCA_NOCTURNE, NA_BGM_OCA_LIGHT, NA_BGM_OCA_SARIA, NA_BGM_OCA_EPONA, NA_BGM_OCA_ZELDA, NA_BGM_OCA_SUNS, NA_BGM_OCA_TIME, NA_BGM_OCA_STORM, }; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - MessageContext* msgCtx = &globalCtx->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; u16 noteBufPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; Gfx* gfx = *p; s16 r; @@ -2202,7 +2202,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { u16 pad1; u16 j; - gSPSegment(gfx++, 0x02, globalCtx->interfaceCtx.parameterSegment); + gSPSegment(gfx++, 0x02, play->interfaceCtx.parameterSegment); gSPSegment(gfx++, 0x07, msgCtx->textboxSegment); if (msgCtx->msgLength != 0) { @@ -2211,7 +2211,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->textBoxType < TEXTBOX_TYPE_NONE_BOTTOM) { Message_SetView(&msgCtx->view); func_8009457C(&gfx); - Message_DrawTextBox(globalCtx, &gfx); + Message_DrawTextBox(play, &gfx); } func_8009457C(&gfx); @@ -2220,8 +2220,8 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(globalCtx->state.input[0].cur.button, BTN_B) - : CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B); + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(play->state.input[0].cur.button, BTN_B) + : CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B); switch (msgCtx->msgMode) { case MSGMODE_TEXT_START: @@ -2232,19 +2232,19 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { case MSGMODE_TEXT_CONTINUING: if (msgCtx->stateTimer == 1) { for (j = 0, i = 0; i < 48; i++, j += 0x80) { - func_8006EE50(&globalCtx->msgCtx.font, 0x8140, j); + func_8006EE50(&play->msgCtx.font, 0x8140, j); } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); } break; case MSGMODE_TEXT_DISPLAYING: case MSGMODE_TEXT_DELAYED_BREAK: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_TEXT_AWAIT_INPUT: case MSGMODE_TEXT_AWAIT_NEXT: - Message_DrawText(globalCtx, &gfx); - Message_DrawTextboxIcon(globalCtx, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); + Message_DrawText(play, &gfx); + Message_DrawTextboxIcon(play, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); break; case MSGMODE_OCARINA_STARTING: case MSGMODE_SONG_DEMONSTRATION_STARTING: @@ -2252,7 +2252,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_OcaSetInstrument(1); msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; Message_ResetOcarinaNoteState(); sOcarinaNoteFlashTimer = 3; sOcarinaNoteFlashColorIdx = 1; @@ -2286,7 +2286,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } if (msgCtx->ocarinaAction != OCARINA_ACTION_FREE_PLAY && msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP) { - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); } break; case MSGMODE_OCARINA_PLAYING: @@ -2320,7 +2320,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } else { // "Ocarina_Flog Correct Example Performance" osSyncPrintf("Ocarina_Flog 正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 10; @@ -2338,7 +2338,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } else { // "Ocarina_Flog Correct Example Performance" osSyncPrintf("Ocarina_Flog 正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 10; @@ -2349,7 +2349,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } else if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY) { // "Ocarina_Free Correct Example Performance" osSyncPrintf("Ocarina_Free 正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 10; @@ -2374,12 +2374,12 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->msgMode = MSGMODE_OCARINA_FAIL; } else if (isB_Held) { Audio_OcaSetInstrument(0); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); } if (msgCtx->ocarinaAction != OCARINA_ACTION_FREE_PLAY && msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP) { - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); } break; case MSGMODE_OCARINA_CORRECT_PLAYBACK: @@ -2602,30 +2602,30 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { if (msgCtx->msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) { // "Correct Example Performance" osSyncPrintf("正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 1; } else if (msgCtx->msgMode == MSGMODE_SONG_PLAYBACK_SUCCESS) { if (msgCtx->lastPlayedSong >= OCARINA_SONG_SARIAS) { - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 1; } else { - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } } else { - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_OCARINA_FAIL: case MSGMODE_SONG_PLAYBACK_FAIL: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); case MSGMODE_OCARINA_FAIL_NO_TEXT: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { @@ -2633,8 +2633,8 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { if (msgCtx->msgMode == MSGMODE_SONG_PLAYBACK_FAIL) { // "kokokokokoko" osSyncPrintf("ここここここ\n"); - Message_ContinueTextbox(globalCtx, 0x88B); // red X background - Message_Decode(globalCtx); + Message_ContinueTextbox(play, 0x88B); // red X background + Message_Decode(play); msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_NOTES_DROP; } else { msgCtx->msgMode = MSGMODE_OCARINA_NOTES_DROP; @@ -2670,14 +2670,14 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf("Na_StopOcarinaMode();\n"); osSyncPrintf("Na_StopOcarinaMode();\n"); osSyncPrintf(VT_RST); - Message_Decode(globalCtx); + Message_Decode(play); msgCtx->msgMode = MSGMODE_SETUP_DISPLAY_SONG_PLAYED; msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0; Message_ResetOcarinaNoteState(); if (msgCtx->lastPlayedSong >= OCARINA_SONG_SARIAS && msgCtx->lastPlayedSong < OCARINA_SONG_MEMORY_GAME) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, + Actor_Spawn(&play->actorCtx, play, sOcarinaEffectActorIds[msgCtx->lastPlayedSong - OCARINA_SONG_SARIAS], player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, sOcarinaEffectActorParams[msgCtx->lastPlayedSong - OCARINA_SONG_SARIAS]); @@ -2686,10 +2686,10 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { break; case MSGMODE_SETUP_DISPLAY_SONG_PLAYED: if (CVar_GetS32("gFastOcarinaPlayback", 0) == 0 || - globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME || - globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS || - globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) { - Message_DrawText(globalCtx, &gfx); + play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME || + play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS || + play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) { + Message_DrawText(play, &gfx); Audio_OcaSetInstrument(1); Audio_OcaSetInstrument(1); Audio_OcaSetSongPlayback(msgCtx->lastPlayedSong + 1, 1); @@ -2701,7 +2701,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_PlayFanfare(sOcarinaSongFanfares[msgCtx->lastPlayedSong]); Audio_SetSoundBanksMute(0x20); } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY) { msgCtx->ocarinaAction = OCARINA_ACTION_FREE_PLAY_DONE; } @@ -2733,36 +2733,36 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { sOcarinaNoteBufPos = 0; msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_DISPLAY_SONG_PLAYED_TEXT_BEGIN: - Message_ContinueTextbox(globalCtx, msgCtx->lastPlayedSong + 0x893); // You played [song name] - Message_Decode(globalCtx); + Message_ContinueTextbox(play, msgCtx->lastPlayedSong + 0x893); // You played [song name] + Message_Decode(play); msgCtx->msgMode = MSGMODE_DISPLAY_SONG_PLAYED_TEXT; - if (CVar_GetS32("gFastOcarinaPlayback", 0) == 0 || globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME - || globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS || - globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) { + if (CVar_GetS32("gFastOcarinaPlayback", 0) == 0 || play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME + || play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS || + play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) { msgCtx->stateTimer = 20; } else { msgCtx->stateTimer = 1; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_DISPLAY_SONG_PLAYED_TEXT: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { msgCtx->msgMode = MSGMODE_SONG_PLAYED_ACT_BEGIN; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SONG_PLAYED_ACT_BEGIN: Audio_OcaSetInstrument(0); Message_ResetOcarinaNoteState(); msgCtx->msgMode = MSGMODE_SONG_PLAYED_ACT; msgCtx->stateTimer = 2; - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SONG_PLAYED_ACT: msgCtx->stateTimer--; @@ -2771,17 +2771,17 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { (msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET || msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) { if (msgCtx->disableWarpSongs || (interfaceCtx->restrictions.warpSongs == 3 && !gSaveContext.n64ddFlag)) { - Message_StartTextbox(globalCtx, 0x88C, NULL); // "You can't warp here!" - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_StartTextbox(play, 0x88C, NULL); // "You can't warp here!" + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else if ((gSaveContext.eventInf[0] & 0xF) != 1) { - Message_StartTextbox(globalCtx, msgCtx->lastPlayedSong + 0x88D, + Message_StartTextbox(play, msgCtx->lastPlayedSong + 0x88D, NULL); // "Warp to [place name]?" - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (msgCtx->lastPlayedSong == OCARINA_SONG_EPONAS) { DREG(53) = 1; } @@ -2789,31 +2789,31 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf("☆☆☆ocarina=%d message->ocarina_no=%d ", msgCtx->lastPlayedSong, msgCtx->ocarinaAction); if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; if (msgCtx->lastPlayedSong == OCARINA_SONG_SCARECROW) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_0B; + play->msgCtx.ocarinaMode = OCARINA_MODE_0B; } } else if (msgCtx->ocarinaAction >= OCARINA_ACTION_CHECK_MINUET) { osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("Ocarina_PC_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_CHECK_MINUET, msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET); if (msgCtx->lastPlayedSong + OCARINA_ACTION_CHECK_MINUET == msgCtx->ocarinaAction) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else { - globalCtx->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1; + play->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1; } } else { osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("Ocarina_C_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_PLAYBACK_MINUET, msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET); if (msgCtx->lastPlayedSong + OCARINA_ACTION_PLAYBACK_MINUET == msgCtx->ocarinaAction) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } } osSyncPrintf(VT_RST); - osSyncPrintf("→ OCARINA_MODE=%d\n", globalCtx->msgCtx.ocarinaMode); + osSyncPrintf("→ OCARINA_MODE=%d\n", play->msgCtx.ocarinaMode); } } break; @@ -2840,7 +2840,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } } case MSGMODE_SONG_DEMONSTRATION_DONE: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SONG_PLAYBACK: msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff(); @@ -2856,7 +2856,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_SUCCESS; if (!gSaveContext.n64ddFlag) { - Item_Give(globalCtx, ITEM_SONG_MINUET + gOcarinaSongItemMap[msgCtx->ocarinaStaff->state]); + Item_Give(play, ITEM_SONG_MINUET + gOcarinaSongItemMap[msgCtx->ocarinaStaff->state]); } osSyncPrintf(VT_FGCOL(YELLOW)); @@ -2872,12 +2872,12 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->stateTimer = 10; msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_FAIL; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_OCARINA_AWAIT_INPUT: - Message_DrawText(globalCtx, &gfx); - if (Message_ShouldAdvance(globalCtx)) { - func_8010BD58(globalCtx, msgCtx->ocarinaAction); + Message_DrawText(play, &gfx); + if (Message_ShouldAdvance(play)) { + func_8010BD58(play, msgCtx->ocarinaAction); } break; case MSGMODE_SCARECROW_LONG_RECORDING_START: @@ -2890,7 +2890,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { sOcarinaNoteBufLen = 0; Message_ResetOcarinaNoteState(); msgCtx->msgMode = MSGMODE_SCARECROW_LONG_RECORDING_ONGOING; - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_LONG_RECORDING_ONGOING: msgCtx->ocarinaStaff = Audio_OcaGetRecordingStaff(); @@ -2924,8 +2924,8 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf("aaaaaaaaaaaaaa\n"); Audio_OcaSetRecordingState(0); msgCtx->stateTimer = 10; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); // "Recording complete!!!!!!!!!Recording Complete" osSyncPrintf("録音終了!!!!!!!!!録音終了\n"); osSyncPrintf(VT_FGCOL(YELLOW)); @@ -2938,7 +2938,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf(VT_RST); osSyncPrintf("\n====================================================================\n"); } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_LONG_PLAYBACK: case MSGMODE_SCARECROW_PLAYBACK: @@ -2963,8 +2963,8 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { if (msgCtx->ocarinaStaff->state == 0) { osSyncPrintf("bbbbbbbbbbb\n"); Audio_OcaSetInstrument(0); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_0F; - Message_CloseTextbox(globalCtx); + play->msgCtx.ocarinaMode = OCARINA_MODE_0F; + Message_CloseTextbox(play); } } else { msgCtx->stateTimer--; @@ -2974,7 +2974,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_OcaSetRecordingState(2); Audio_OcaSetInstrument(1); msgCtx->msgMode = MSGMODE_SCARECROW_RECORDING_ONGOING; - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_RECORDING_ONGOING: msgCtx->ocarinaStaff = Audio_OcaGetRecordingStaff(); @@ -3006,16 +3006,16 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_OcaSetRecordingState(0); Audio_PlaySoundGeneral(NA_SE_SY_OCARINA_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); msgCtx->msgMode = MSGMODE_SCARECROW_RECORDING_FAILED; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_RECORDING_FAILED: osSyncPrintf("cccccccccccc\n"); Audio_OcaSetInstrument(0); - Message_StartTextbox(globalCtx, 0x40AD, NULL); // Bonooru doesn't remember your song - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_StartTextbox(play, 0x40AD, NULL); // Bonooru doesn't remember your song + play->msgCtx.ocarinaMode = OCARINA_MODE_04; break; case MSGMODE_MEMORY_GAME_START: Audio_OcaSetInstrument(1); @@ -3078,7 +3078,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_PlaySoundGeneral(NA_SE_SY_OCARINA_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); msgCtx->stateTimer = 10; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else if (msgCtx->ocarinaStaff->state == 0xD) { // "Musical round succeeded!!!!!!!!!" osSyncPrintf("輪唱成功!!!!!!!!!\n"); @@ -3086,7 +3086,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->msgMode = MSGMODE_MEMORY_GAME_ROUND_SUCCESS; msgCtx->stateTimer = 30; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_MEMORY_GAME_ROUND_SUCCESS: msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff(); @@ -3105,10 +3105,10 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Message_ResetOcarinaNoteState(); msgCtx->msgMode = MSGMODE_MEMORY_GAME_START_NEXT_ROUND; } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_0F; + play->msgCtx.ocarinaMode = OCARINA_MODE_0F; } } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_MEMORY_GAME_START_NEXT_ROUND: if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) { @@ -3122,7 +3122,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_OcaSetInstrument(1); msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; Message_ResetOcarinaNoteState(); func_800ECC04(sOcarinaSongBitFlags + 0xC000); msgCtx->msgMode = MSGMODE_FROGS_PLAYING; @@ -3138,16 +3138,16 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { case MSGMODE_FROGS_WAITING: break; case MSGMODE_TEXT_DONE: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); switch (msgCtx->textboxEndType) { case TEXTBOX_ENDTYPE_2_CHOICE: - Message_HandleChoiceSelection(globalCtx, 1); - Message_DrawTextboxIcon(globalCtx, &gfx, msgCtx->textPosX, msgCtx->textPosY); + Message_HandleChoiceSelection(play, 1); + Message_DrawTextboxIcon(play, &gfx, msgCtx->textPosX, msgCtx->textPosY); break; case TEXTBOX_ENDTYPE_3_CHOICE: - Message_HandleChoiceSelection(globalCtx, 2); - Message_DrawTextboxIcon(globalCtx, &gfx, msgCtx->textPosX, msgCtx->textPosY); + Message_HandleChoiceSelection(play, 2); + Message_DrawTextboxIcon(play, &gfx, msgCtx->textPosX, msgCtx->textPosY); break; case TEXTBOX_ENDTYPE_PERSISTENT: if (msgCtx->textId >= 0x6D && msgCtx->textId < 0x73) { @@ -3160,7 +3160,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { break; case TEXTBOX_ENDTYPE_EVENT: default: - Message_DrawTextboxIcon(globalCtx, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); + Message_DrawTextboxIcon(play, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); case TEXTBOX_ENDTYPE_FADING: break; } @@ -3285,7 +3285,7 @@ void Message_DrawDebugVariableChanged(s16* var, GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx); } -void Message_DrawDebugText(GlobalContext* globalCtx, Gfx** p) { +void Message_DrawDebugText(PlayState* play, Gfx** p) { s32 pad; GfxPrint printer; s32 pad1; @@ -3298,38 +3298,38 @@ void Message_DrawDebugText(GlobalContext* globalCtx, Gfx** p) { GfxPrint_SetPos(&printer, 14, 26); GfxPrint_Printf(&printer, "%s", "="); GfxPrint_SetPos(&printer, 16, 26); - GfxPrint_Printf(&printer, "%x", globalCtx->msgCtx.textId); + GfxPrint_Printf(&printer, "%x", play->msgCtx.textId); *p = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); } -void Message_Draw(GlobalContext* globalCtx) { +void Message_Draw(PlayState* play) { Gfx* plusOne; Gfx* polyOpaP; s16 watchVar; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); watchVar = gSaveContext.scarecrowCustomSongSet; - Message_DrawDebugVariableChanged(&watchVar, globalCtx->state.gfxCtx); - if (BREG(0) != 0 && globalCtx->msgCtx.textId != 0) { + Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx); + if (BREG(0) != 0 && play->msgCtx.textId != 0) { plusOne = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, plusOne); - Message_DrawDebugText(globalCtx, &plusOne); + Message_DrawDebugText(play, &plusOne); gSPEndDisplayList(plusOne++); Graph_BranchDlist(polyOpaP, plusOne); POLY_OPA_DISP = plusOne; } plusOne = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, plusOne); - Message_DrawMain(globalCtx, &plusOne); + Message_DrawMain(play, &plusOne); gSPEndDisplayList(plusOne++); Graph_BranchDlist(polyOpaP, plusOne); POLY_OPA_DISP = plusOne; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Message_Update(GlobalContext* globalCtx) { +void Message_Update(PlayState* play) { static s16 sTextboxXPositions[] = { 34, 34, 34, 34, 34, 34, }; @@ -3352,10 +3352,10 @@ void Message_Update(GlobalContext* globalCtx) { }; static u8 D_80153D74 = 0; static u16 D_80153D78 = 0; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; s16 var; s16 focusScreenPosX; s16 averageY = 0; @@ -3365,7 +3365,7 @@ void Message_Update(GlobalContext* globalCtx) { if (BREG(0) != 0) { if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN) && CHECK_BTN_ALL(input->cur.button, BTN_L)) { osSyncPrintf("msgno=%d\n", D_80153D78); - Message_StartTextbox(globalCtx, R_MESSAGE_DEBUGGER_TEXTID, NULL); + Message_StartTextbox(play, R_MESSAGE_DEBUGGER_TEXTID, NULL); D_80153D78 = (D_80153D78 + 1) % 10; } if (R_MESSAGE_DEBUGGER_SELECT != 0) { @@ -3376,7 +3376,7 @@ void Message_Update(GlobalContext* globalCtx) { if (entry->textId == R_MESSAGE_DEBUGGER_TEXTID) { // "The message was found! !! !!" osSyncPrintf(" メッセージが,見つかった!!! = %x\n", R_MESSAGE_DEBUGGER_TEXTID); - Message_StartTextbox(globalCtx, R_MESSAGE_DEBUGGER_TEXTID, NULL); + Message_StartTextbox(play, R_MESSAGE_DEBUGGER_TEXTID, NULL); R_MESSAGE_DEBUGGER_TEXTID++; R_MESSAGE_DEBUGGER_SELECT = 0; return; @@ -3404,7 +3404,7 @@ void Message_Update(GlobalContext* globalCtx) { if (D_8014B2F4 >= 4) { var = true; } - } else if (YREG(15) != 0 || globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { + } else if (YREG(15) != 0 || play->sceneNum == SCENE_HAIRAL_NIWA) { var = true; } else if (D_8014B2F4 >= 4 || msgCtx->talkActor == NULL) { var = true; @@ -3412,9 +3412,9 @@ void Message_Update(GlobalContext* globalCtx) { if (var) { if (msgCtx->talkActor != NULL) { - Actor_GetScreenPos(globalCtx, &GET_PLAYER(globalCtx)->actor, &focusScreenPosX, + Actor_GetScreenPos(play, &GET_PLAYER(play)->actor, &focusScreenPosX, &playerFocusScreenPosY); - Actor_GetScreenPos(globalCtx, msgCtx->talkActor, &focusScreenPosX, &actorFocusScreenPosY); + Actor_GetScreenPos(play, msgCtx->talkActor, &focusScreenPosX, &actorFocusScreenPosY); if (playerFocusScreenPosY >= actorFocusScreenPosY) { averageY = ((playerFocusScreenPosY - actorFocusScreenPosY) / 2) + actorFocusScreenPosY; @@ -3431,14 +3431,14 @@ void Message_Update(GlobalContext* globalCtx) { var = msgCtx->textBoxType; if (!msgCtx->textBoxPos) { // variable position - if (YREG(15) != 0 || globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { + if (YREG(15) != 0 || play->sceneNum == SCENE_HAIRAL_NIWA) { if (averageY < XREG(92)) { R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; } else { R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; } - } else if (globalCtx->sceneNum == SCENE_MARKET_DAY || globalCtx->sceneNum == SCENE_MARKET_NIGHT || - globalCtx->sceneNum == SCENE_MARKET_RUINS) { + } else if (play->sceneNum == SCENE_MARKET_DAY || play->sceneNum == SCENE_MARKET_NIGHT || + play->sceneNum == SCENE_MARKET_RUINS) { if (averageY < XREG(93)) { R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; } else { @@ -3490,11 +3490,11 @@ void Message_Update(GlobalContext* globalCtx) { case MSGMODE_TEXT_STARTING: msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; if (YREG(31) == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_NEXT); + Interface_SetDoAction(play, DO_ACTION_NEXT); } break; case MSGMODE_TEXT_NEXT_MSG: - Message_Decode(globalCtx); + Message_Decode(play); if (sTextFade) { Interface_ChangeAlpha(1); } @@ -3506,7 +3506,7 @@ void Message_Update(GlobalContext* globalCtx) { case MSGMODE_TEXT_CONTINUING: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { - Message_Decode(globalCtx); + Message_Decode(play); } break; case MSGMODE_TEXT_DISPLAYING: @@ -3517,7 +3517,7 @@ void Message_Update(GlobalContext* globalCtx) { } break; case MSGMODE_TEXT_AWAIT_INPUT: - if (YREG(31) == 0 && Message_ShouldAdvance(globalCtx)) { + if (YREG(31) == 0 && Message_ShouldAdvance(play)) { msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING; msgCtx->textDrawPos++; } @@ -3529,7 +3529,7 @@ void Message_Update(GlobalContext* globalCtx) { } break; case MSGMODE_TEXT_AWAIT_NEXT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; msgCtx->textUnskippable = false; msgCtx->msgBufPos++; @@ -3539,29 +3539,29 @@ void Message_Update(GlobalContext* globalCtx) { if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADING) { msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } else if (msgCtx->textboxEndType != TEXTBOX_ENDTYPE_PERSISTENT && msgCtx->textboxEndType != TEXTBOX_ENDTYPE_EVENT && YREG(31) == 0) { if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_2_CHOICE && - globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - if (Message_ShouldAdvance(globalCtx)) { - osSyncPrintf("OCARINA_MODE=%d -> ", globalCtx->msgCtx.ocarinaMode); - globalCtx->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04; + play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + if (Message_ShouldAdvance(play)) { + osSyncPrintf("OCARINA_MODE=%d -> ", play->msgCtx.ocarinaMode); + play->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04; osSyncPrintf("InRaceSeq=%d(%d) OCARINA_MODE=%d --> ", gSaveContext.eventInf[0] & 0xF, 1, - globalCtx->msgCtx.ocarinaMode); - Message_CloseTextbox(globalCtx); - osSyncPrintf("OCARINA_MODE=%d\n", globalCtx->msgCtx.ocarinaMode); + play->msgCtx.ocarinaMode); + Message_CloseTextbox(play); + osSyncPrintf("OCARINA_MODE=%d\n", play->msgCtx.ocarinaMode); } - } else if (Message_ShouldAdvanceSilent(globalCtx)) { + } else if (Message_ShouldAdvanceSilent(play)) { osSyncPrintf("select=%d\n", msgCtx->textboxEndType); if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_HAS_NEXT) { Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_PASS, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Message_ContinueTextbox(globalCtx, sNextTextId); + Message_ContinueTextbox(play, sNextTextId); } else { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } } @@ -3580,15 +3580,15 @@ void Message_Update(GlobalContext* globalCtx) { msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) { gSaveContext.unk_13EE = 0x32; } - if (globalCtx->csCtx.state == 0) { + if (play->csCtx.state == 0) { osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("day_time=%x active_camera=%d ", gSaveContext.cutsceneIndex, globalCtx->activeCamera); + osSyncPrintf("day_time=%x active_camera=%d ", gSaveContext.cutsceneIndex, play->activeCamera); if (msgCtx->textId != 0x2061 && msgCtx->textId != 0x2025 && msgCtx->textId != 0x208C && ((msgCtx->textId < 0x88D || msgCtx->textId >= 0x893) || msgCtx->choiceIndex != 0) && (msgCtx->textId != 0x3055 && gSaveContext.cutsceneIndex < 0xFFF0)) { osSyncPrintf("=== day_time=%x ", ((void)0, gSaveContext.cutsceneIndex)); - if (globalCtx->activeCamera == MAIN_CAM) { + if (play->activeCamera == MAIN_CAM) { if (gSaveContext.unk_13EE == 0 || gSaveContext.unk_13EE == 1 || gSaveContext.unk_13EE == 2) { gSaveContext.unk_13EE = 0x32; } @@ -3605,7 +3605,7 @@ void Message_Update(GlobalContext* globalCtx) { if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PERSISTENT) { msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_02; + play->msgCtx.ocarinaMode = OCARINA_MODE_02; } else { msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; } @@ -3624,16 +3624,16 @@ void Message_Update(GlobalContext* globalCtx) { player->naviActor->flags |= 0x10000; } if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE && - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01 || - globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0B)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + (play->msgCtx.ocarinaMode == OCARINA_MODE_01 || + play->msgCtx.ocarinaMode == OCARINA_MODE_0B)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; if (msgCtx->unk_E3F2 == OCARINA_SONG_SUNS) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; } } } sLastPlayedSong = 0xFF; - osSyncPrintf("OCARINA_MODE=%d chk_ocarina_no=%d\n", globalCtx->msgCtx.ocarinaMode, msgCtx->unk_E3F2); + osSyncPrintf("OCARINA_MODE=%d chk_ocarina_no=%d\n", play->msgCtx.ocarinaMode, msgCtx->unk_E3F2); break; case MSGMODE_PAUSED: break; diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 5dcdeb2e4..704c28585 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -56,10 +56,10 @@ void OnePointCutscene_SetCsCamPoints(Camera* camera, s16 actionParameters, s16 i onePointCamData->initTimer = initTimer; } -s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Actor* actor, s16 timer) { - Camera* csCam = globalCtx->cameraPtrs[camIdx]; - Camera* childCam = globalCtx->cameraPtrs[csCam->childCamIdx]; - Camera* mainCam = globalCtx->cameraPtrs[MAIN_CAM]; +s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor, s16 timer) { + Camera* csCam = play->cameraPtrs[camIdx]; + Camera* childCam = play->cameraPtrs[csCam->childCamIdx]; + Camera* mainCam = play->cameraPtrs[MAIN_CAM]; Player* player = mainCam->player; VecSph spD0; s32 i; @@ -75,9 +75,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act if (timer < 20) { timer = 20; } - D_801208EC[0].atTargetInit = globalCtx->view.lookAt; - D_801208EC[0].eyeTargetInit = globalCtx->view.eye; - D_801208EC[0].fovTargetInit = globalCtx->view.fovy; + D_801208EC[0].atTargetInit = play->view.lookAt; + D_801208EC[0].eyeTargetInit = play->view.eye; + D_801208EC[0].fovTargetInit = play->view.fovy; D_801208EC[1].atTargetInit = mainCam->at; D_801208EC[1].eyeTargetInit = mainCam->eye; D_801208EC[1].fovTargetInit = mainCam->fov; @@ -88,12 +88,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801208EC; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 1030: - D_80120964[0].atTargetInit = globalCtx->view.lookAt; - D_80120964[0].eyeTargetInit = globalCtx->view.eye; - D_80120964[0].fovTargetInit = globalCtx->view.fovy; + D_80120964[0].atTargetInit = play->view.lookAt; + D_80120964[0].eyeTargetInit = play->view.eye; + D_80120964[0].fovTargetInit = play->view.fovy; OLib_Vec3fDiffToVecSphGeo(&spD0, &mainCam->at, &mainCam->eye); D_80120964[1].eyeTargetInit.y = BINANG_TO_DEGF(spD0.yaw); D_80120964[1].timerInit = timer - 1; @@ -101,12 +101,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80120964; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 5000: - D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = globalCtx->view.lookAt; - D_801209B4[0].eyeTargetInit = globalCtx->view.eye; - D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = globalCtx->view.fovy; + D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = play->view.lookAt; + D_801209B4[0].eyeTargetInit = play->view.eye; + D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = play->view.fovy; OLib_Vec3fDiffToVecSphGeo(&spD0, &actor->focus.pos, &mainCam->at); spD0.r = mainCam->dist; OnePointCutscene_AddVecSphToVec3f(&D_801209B4[1].eyeTargetInit, &D_801209B4[1].atTargetInit, &spD0); @@ -115,29 +115,29 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801209B4; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 5010: - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_ATTENTION); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &mainCam->at, &mainCam->eye); + func_800C0808(play, camIdx, player, CAM_SET_CS_ATTENTION); + Play_CameraSetAtEye(play, camIdx, &mainCam->at, &mainCam->eye); csCam->roll = 0; break; case 9500: csInfo->keyFrames = D_80120A54; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 2260: D_80120ACC[0].atTargetInit.x = D_80120ACC[2].atTargetInit.x = - ((mainCam->globalCtx->state.frames & 1) ? -10.0f : 10.0f) + (Rand_ZeroOne() * 8.0f); + ((mainCam->play->state.frames & 1) ? -10.0f : 10.0f) + (Rand_ZeroOne() * 8.0f); D_80120ACC[0].eyeTargetInit.x = D_80120ACC[2].eyeTargetInit.x = - ((mainCam->globalCtx->state.frames & 1) ? 20.0f : -20.0f) + (Rand_ZeroOne() * 5.0f); + ((mainCam->play->state.frames & 1) ? 20.0f : -20.0f) + (Rand_ZeroOne() * 5.0f); csInfo->keyFrames = D_80120ACC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 2270: csInfo->keyFrames = D_80120B94; @@ -153,8 +153,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act } D_80120B94[camIdx - 1].eyeTargetInit.y = - ((mainCam->globalCtx->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + ((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 5); Quake_SetSpeed(i, 400); @@ -174,8 +174,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act } } D_80120D4C[camIdx - 1].eyeTargetInit.y = - ((mainCam->globalCtx->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + ((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 5); Quake_SetSpeed(i, 400); @@ -186,7 +186,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80120E64; csInfo->keyFrameCnt = 8; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 5); Quake_SetSpeed(i, 400); @@ -202,13 +202,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80120FA4; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 2340: csInfo->keyFrames = D_80121094; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 5); Quake_SetSpeed(i, 400); @@ -219,7 +219,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012110C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 2200: { s16 sp82; @@ -227,15 +227,15 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act s16 sp7E; s16 sp7C; - Actor_GetScreenPos(globalCtx, &player->actor, &sp82, &sp7E); - Actor_GetScreenPos(globalCtx, actor, &sp80, &sp7C); + Actor_GetScreenPos(play, &player->actor, &sp82, &sp7E); + Actor_GetScreenPos(play, actor, &sp80, &sp7C); if ((sp82 > 0) && (sp82 < 320) && (sp7E > 0) && (sp7E < 240) && (sp80 > 0) && (sp80 < 320) && (sp7C > 0) && (sp7C < 240) && - !OnePointCutscene_BgCheckLineTest(&globalCtx->colCtx, &actor->focus.pos, &player->actor.focus.pos)) { - D_80121184[0].atTargetInit.x = (globalCtx->view.lookAt.x + actor->focus.pos.x) * 0.5f; - D_80121184[0].atTargetInit.y = (globalCtx->view.lookAt.y + actor->focus.pos.y) * 0.5f; - D_80121184[0].atTargetInit.z = (globalCtx->view.lookAt.z + actor->focus.pos.z) * 0.5f; - D_80121184[0].eyeTargetInit = globalCtx->view.eye; + !OnePointCutscene_BgCheckLineTest(&play->colCtx, &actor->focus.pos, &player->actor.focus.pos)) { + D_80121184[0].atTargetInit.x = (play->view.lookAt.x + actor->focus.pos.x) * 0.5f; + D_80121184[0].atTargetInit.y = (play->view.lookAt.y + actor->focus.pos.y) * 0.5f; + D_80121184[0].atTargetInit.z = (play->view.lookAt.z + actor->focus.pos.z) * 0.5f; + D_80121184[0].eyeTargetInit = play->view.eye; D_80121184[0].eyeTargetInit.y = player->actor.focus.pos.y + 20.0f; D_80121184[0].fovTargetInit = mainCam->fov * 0.75f; @@ -255,13 +255,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801211D4; csInfo->keyFrameCnt = 2; } - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_UNK3); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_UNK3); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); } break; case 2290: { Actor* rideActor = player->rideActor; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); if (rideActor != NULL) { rideActor->freezeTimer = 180; } @@ -269,42 +269,42 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121224; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); } break; case 5120: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_80121314; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4510: D_8012133C[0].eyeTargetInit = actor->world.pos; D_8012133C[0].eyeTargetInit.y = player->actor.world.pos.y + 40.0f; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_8012133C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4500: Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - spC0.y = OnePointCutscene_RaycastFloor(&globalCtx->colCtx, &spC0) + 40.0f; + spC0.y = OnePointCutscene_RaycastFloor(&play->colCtx, &spC0) + 40.0f; spD0.r = 150.0f; spD0.yaw = spA0.rot.y; spD0.pitch = 0x3E8; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - func_8002DF54(globalCtx, NULL, 8); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); + func_8002DF54(play, NULL, 8); csCam->roll = 0; csCam->fov = 50.0f; if (csCam->childCamIdx != SUBCAM_FREE) { - OnePointCutscene_EndCutscene(globalCtx, csCam->childCamIdx); + OnePointCutscene_EndCutscene(play, csCam->childCamIdx); } break; case 2210: @@ -314,34 +314,34 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act if (Rand_ZeroOne() < 0.0f) { D_801213B4[3].eyeTargetInit.x = -D_801213B4[3].eyeTargetInit.x; } - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_801213B4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 1010: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &childCam->at, &childCam->eye); - Gameplay_CameraSetFov(globalCtx, camIdx, childCam->fov); - Gameplay_SetCameraRoll(globalCtx, camIdx, childCam->roll); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &childCam->at, &childCam->eye); + Play_CameraSetFov(play, camIdx, childCam->fov); + Play_SetCameraRoll(play, camIdx, childCam->roll); break; case 9601: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); - Gameplay_CameraChangeSetting(globalCtx, MAIN_CAM, mainCam->prevSetting); + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); break; case 9602: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); - Gameplay_CameraChangeSetting(globalCtx, MAIN_CAM, mainCam->prevSetting); + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120434); break; case 4175: csInfo->keyFrames = D_8012147C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4180: spC0.x = -1881.0f; @@ -350,24 +350,24 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spB4.x = -1979.0f; spB4.y = 703.0f; spB4.z = -269.0f; - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 6; csCam->fov = 75.0f; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); break; case 3040: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_8012151C[0].timerInit = timer - 1; csInfo->keyFrames = D_8012151C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3020: D_8012156C[1].timerInit = timer - 1; - if (mainCam->globalCtx->state.frames & 1) { + if (mainCam->play->state.frames & 1) { D_8012156C[0].atTargetInit.x = -D_8012156C[0].atTargetInit.x; D_8012156C[0].eyeTargetInit.x = -D_8012156C[0].eyeTargetInit.x; D_8012156C[1].atTargetInit.x = -D_8012156C[1].atTargetInit.x; @@ -380,8 +380,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012156C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); - func_8002DF54(globalCtx, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); break; case 3010: D_801215BC[0].timerInit = timer; @@ -389,13 +389,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801215BC; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3070: csInfo->keyFrames = D_801215E4; csInfo->keyFrameCnt = 10; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 3); Quake_SetSpeed(i, 22000); @@ -406,34 +406,34 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121774; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3090: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_80121814; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3100: VEC_SET(spB4, 0.0f, -280.0f, -1400.0f); Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(globalCtx, camIdx, player, CAM_SET_PIVOT_VERTICAL); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + func_800C0808(play, camIdx, player, CAM_SET_PIVOT_VERTICAL); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0; csCam->fov = 70.0f; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); break; case 3380: case 3065: csInfo->keyFrames = D_801218B4; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 1); Quake_SetSpeed(i, 24000); @@ -444,12 +444,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121904; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3050: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); - func_8002DF54(globalCtx, &player->actor, 5); + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + func_8002DF54(play, &player->actor, 5); OnePointCutscene_SetCsCamPoints(csCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); func_80078884(NA_SE_SY_CORRECT_CHIME); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_8012013C[D_801202FC - 2].pos); @@ -478,26 +478,26 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csCam->unk_14C |= 2; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3130: csInfo->keyFrames = D_80121A44; csInfo->keyFrameCnt = 12; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); csCam->unk_14C |= 2; break; case 3140: - D_80121C24[0].atTargetInit = globalCtx->view.lookAt; - D_80121C24[0].eyeTargetInit = globalCtx->view.eye; - D_80121C24[0].fovTargetInit = globalCtx->view.fovy; + D_80121C24[0].atTargetInit = play->view.lookAt; + D_80121C24[0].eyeTargetInit = play->view.eye; + D_80121C24[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_80121C24; csInfo->keyFrameCnt = 7; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3150: spC0.x = 1890.0f; @@ -506,11 +506,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spB4.x = 1729.0f; spB4.y = 995.0f; spB4.z = -1405.0f; - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0x50; csCam->fov = 55.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); break; case 3170: Actor_GetWorld(&spA0, actor); @@ -521,12 +521,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act Actor_GetWorld(&spA0, &player->actor); spD0.yaw = OnePointCutscene_Vec3fYaw(&spC0, &spA0.pos) - 0x7D0; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - Gameplay_CopyCamera(globalCtx, MAIN_CAM, camIdx); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); + Play_CopyCamera(play, MAIN_CAM, camIdx); csCam->roll = -1; csCam->fov = 55.0f; - func_8002DF38(globalCtx, actor, 1); + func_8002DF38(play, actor, 1); break; case 3160: Actor_GetWorld(&spA0, actor); @@ -535,11 +535,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.yaw = spA0.rot.y; spD0.r = 150.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0; csCam->fov = 55.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); break; case 3180: Actor_GetWorldPosShapeRot(&spA0, actor); @@ -549,16 +549,16 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.yaw = spA0.rot.y; spD0.pitch = -0xAF0; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0; csCam->fov = 60.0f; - func_8002DF38(globalCtx, actor, 1); + func_8002DF38(play, actor, 1); break; case 3190: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FOREST_DEFEAT_POE); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FOREST_DEFEAT_POE); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_8002DF38(globalCtx, actor, 0xC); + func_8002DF38(play, actor, 0xC); break; case 3230: spC0.x = 120.0f; @@ -567,11 +567,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spB4.x = 80.0f; spB4.y = 445.0f; spB4.z = -1425.0f; - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0x1E; csCam->fov = 75.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); Actor_GetWorldPosShapeRot(&spA0, actor); Actor_GetFocus(&sp8C, &player->actor); spC0.x = sp8C.pos.x; @@ -581,7 +581,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.pitch = 0x5DC; spD0.r = 120.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraSetAtEye(globalCtx, MAIN_CAM, &spC0, &spB4); + Play_CameraSetAtEye(play, MAIN_CAM, &spC0, &spB4); i = Quake_Add(csCam, 3); Quake_SetSpeed(i, 22000); @@ -596,27 +596,27 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.yaw = spA0.rot.y + 0x7FFF; spD0.r = 300.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0; csCam->fov = 45.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); break; case 3220: Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(globalCtx, camIdx, player, CAM_SET_PIVOT_VERTICAL); + func_800C0808(play, camIdx, player, CAM_SET_PIVOT_VERTICAL); Actor_GetWorld(&spA0, &player->actor); OLib_Vec3fDiffToVecSphGeo(&spD0, &spC0, &spA0.pos); spD0.yaw += 0x3E8; spD0.r = 400.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); spB4.y = spA0.pos.y + 60.0f; - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0; csCam->fov = 75.0f; player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spD0.yaw + 0x7FFF; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); break; case 3240: D_80121D3C[2].timerInit = timer - 5; @@ -624,12 +624,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121D3C; csInfo->keyFrameCnt = 3; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 6001: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); - func_8002DF54(globalCtx, NULL, 8); + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + func_8002DF54(play, NULL, 8); Actor_GetWorld(&spA0, actor); if (spA0.pos.z > -750.0f) { OnePointCutscene_SetCsCamPoints(csCam, D_801208E8, D_801208E4, D_801206A0, D_80120820); @@ -643,8 +643,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act Quake_SetCountdown(i, D_801208E4 - 10); break; case 3400: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); - func_8002DF38(globalCtx, &player->actor, 8); + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + func_8002DF38(play, &player->actor, 8); OnePointCutscene_SetCsCamPoints(csCam, D_8012069C | 0x2000, D_80120698, D_801204D4, D_801205B4); OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_801204D4[D_80120694 - 2].pos); @@ -660,13 +660,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121DB4; csInfo->keyFrameCnt = 9; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3310: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FIRE_STAIRCASE); - func_8002DF54(globalCtx, NULL, 8); - Gameplay_CopyCamera(globalCtx, camIdx, MAIN_CAM); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FIRE_STAIRCASE); + func_8002DF54(play, NULL, 8); + Play_CopyCamera(play, camIdx, MAIN_CAM); i = Quake_Add(csCam, 1); Quake_SetSpeed(i, 32000); @@ -674,16 +674,16 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act Quake_SetCountdown(i, timer); break; case 3290: - D_80121F1C[0].atTargetInit = globalCtx->view.lookAt; - D_80121F1C[0].eyeTargetInit = globalCtx->view.eye; - D_80121F1C[0].fovTargetInit = globalCtx->view.fovy; + D_80121F1C[0].atTargetInit = play->view.lookAt; + D_80121F1C[0].eyeTargetInit = play->view.eye; + D_80121F1C[0].fovTargetInit = play->view.fovy; Actor_GetFocus(&spA0, actor); player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spA0.rot.y; csInfo->keyFrames = D_80121F1C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 3); Quake_SetSpeed(i, 12000); @@ -691,15 +691,15 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act Quake_SetCountdown(i, 5); break; case 3340: - D_80121FBC[0].atTargetInit = globalCtx->view.lookAt; - D_80121FBC[0].eyeTargetInit = globalCtx->view.eye; - D_80121FBC[0].fovTargetInit = globalCtx->view.fovy; + D_80121FBC[0].atTargetInit = play->view.lookAt; + D_80121FBC[0].eyeTargetInit = play->view.eye; + D_80121FBC[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_80121FBC; csInfo->keyFrameCnt = 4; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 3); Quake_SetSpeed(i, 12000); @@ -710,13 +710,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012205C; csInfo->keyFrameCnt = 3; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3350: - D_801220D4[0].atTargetInit = globalCtx->view.lookAt; - D_801220D4[0].eyeTargetInit = globalCtx->view.eye; - D_801220D4[0].fovTargetInit = globalCtx->view.fovy; + D_801220D4[0].atTargetInit = play->view.lookAt; + D_801220D4[0].eyeTargetInit = play->view.eye; + D_801220D4[0].fovTargetInit = play->view.fovy; if (actor->world.pos.x > 0.0f) { D_801220D4[1].rollTargetInit = -D_801220D4[1].rollTargetInit; D_801220D4[2].rollTargetInit = -D_801220D4[2].rollTargetInit; @@ -725,26 +725,26 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act D_801220D4[1].eyeTargetInit.y = 80.0f; D_801220D4[1].eyeTargetInit.x = -D_801220D4[1].eyeTargetInit.x; } - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_801220D4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3330: csInfo->keyFrames = D_8012219C; csInfo->keyFrameCnt = 7; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3410: csInfo->keyFrames = D_801222B4; csInfo->keyFrameCnt = 5; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 1); Quake_SetSpeed(i, 32000); @@ -755,8 +755,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012237C; csInfo->keyFrameCnt = 2; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 1); Quake_SetSpeed(i, 32000); @@ -767,8 +767,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801223CC; csInfo->keyFrameCnt = 6; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); player->stateFlags1 |= 0x20000000; player->actor.freezeTimer = 90; @@ -781,8 +781,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801224BC; csInfo->keyFrameCnt = 7; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 1); Quake_SetSpeed(i, 32000); @@ -799,70 +799,70 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act } player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = 0x3FFC; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); - func_8002DF54(globalCtx, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); break; case 4110: csInfo->keyFrames = D_8012269C; csInfo->keyFrameCnt = 3; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4120: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_80122714[1].timerInit = 80; csInfo->keyFrames = D_80122714; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4140: csInfo->keyFrames = D_801227B4; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); break; case 4150: csInfo->keyFrames = D_801228A4; csInfo->keyFrameCnt = 5; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4160: csInfo->keyFrames = D_8012296C; csInfo->keyFrameCnt = 4; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4170: csInfo->keyFrames = D_80122A0C; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4190: csInfo->keyFrames = D_80122A5C; csInfo->keyFrameCnt = 8; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4200: csInfo->keyFrames = D_80122B9C; csInfo->keyFrameCnt = 3; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4210: player->actor.freezeTimer = timer; @@ -870,7 +870,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122C14; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); i = Quake_Add(csCam, 3); Quake_SetSpeed(i, 12000); @@ -881,8 +881,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); - func_8002DF38(globalCtx, &player->actor, 1); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 1); i = Quake_Add(csCam, 3); Quake_SetSpeed(i, 12000); @@ -893,38 +893,38 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122C8C; csInfo->keyFrameCnt = 1; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3260: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_80122CB4[1].timerInit = timer - 5; csInfo->keyFrames = D_80122CB4; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 3261: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_80122D04[1].timerInit = timer - 10; csInfo->keyFrames = D_80122D04; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 8010: csInfo->keyFrames = D_80122D54; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 8002: csInfo->keyFrames = D_80122DCC; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 8700: Actor_GetFocus(&spA0, actor); @@ -935,16 +935,16 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122E44[timer & 1]; csInfo->keyFrameCnt = 7; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 1100: { - s32 tempDiff = globalCtx->state.frames - sPrevFrameCs1100; + s32 tempDiff = play->state.frames - sPrevFrameCs1100; if ((tempDiff > 3600) || (tempDiff < -3600)) { csInfo->keyFrames = D_80123074; csInfo->keyFrameCnt = 5; } else { - if (globalCtx->state.frames & 1) { + if (play->state.frames & 1) { D_8012313C[0].rollTargetInit = -D_8012313C[0].rollTargetInit; D_8012313C[0].atTargetInit.y = -D_8012313C[0].atTargetInit.y; D_8012313C[0].eyeTargetInit.y = -D_8012313C[0].eyeTargetInit.y; @@ -953,22 +953,22 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012313C; csInfo->keyFrameCnt = 3; } - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); - sPrevFrameCs1100 = globalCtx->state.frames; + func_800C0808(play, camIdx, player, CAM_SET_CS_C); + sPrevFrameCs1100 = play->state.frames; } break; case 9806: csCam->timer = -99; - if (func_800C0CB8(globalCtx)) { - func_800C0808(globalCtx, camIdx, player, CAM_SET_TURN_AROUND); + if (func_800C0CB8(play)) { + func_800C0808(play, camIdx, player, CAM_SET_TURN_AROUND); csCam->data2 = 0xC; } else { - Gameplay_CopyCamera(globalCtx, camIdx, MAIN_CAM); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); + Play_CopyCamera(play, camIdx, MAIN_CAM); + Play_CameraChangeSetting(play, camIdx, CAM_SET_FREE2); } break; case 9908: - if (func_800C0CB8(globalCtx)) { + if (func_800C0CB8(play)) { D_801231B4[0].eyeTargetInit.z = D_801231B4[1].eyeTargetInit.z = !LINK_IS_ADULT ? 100.0f : 120.0f; if (player->stateFlags1 & 0x08000000) { @@ -987,7 +987,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801231B4; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); } else { D_80123254[1].timerInit = timer - 1; D_80123254[0].fovTargetInit = mainCam->fov; @@ -997,60 +997,60 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80123254; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); } break; case 1000: - D_801232A4[0].atTargetInit = globalCtx->view.lookAt; - D_801232A4[0].eyeTargetInit = globalCtx->view.eye; - D_801232A4[0].fovTargetInit = globalCtx->view.fovy; + D_801232A4[0].atTargetInit = play->view.lookAt; + D_801232A4[0].eyeTargetInit = play->view.eye; + D_801232A4[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_801232A4; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 8603: csInfo->keyFrames = D_801232CC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 8604: csInfo->keyFrames = D_80123394; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4000: csInfo->keyFrames = D_8012345C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4010: csInfo->keyFrames = D_801234FC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4011: csInfo->keyFrames = D_801235C4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4020: csInfo->keyFrames = D_8012368C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4021: csInfo->keyFrames = D_8012372C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 4022: csCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + @@ -1059,12 +1059,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801237CC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 9703: - D_80123894[0].atTargetInit = globalCtx->view.lookAt; - D_80123894[0].eyeTargetInit = globalCtx->view.eye; - D_80123894[0].fovTargetInit = globalCtx->view.fovy; + D_80123894[0].atTargetInit = play->view.lookAt; + D_80123894[0].eyeTargetInit = play->view.eye; + D_80123894[0].fovTargetInit = play->view.fovy; if (LINK_IS_ADULT) { D_80123894[1].atTargetInit.y = 60.0f; D_80123894[1].eyeTargetInit.y = 52.0f; @@ -1073,27 +1073,27 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80123894; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 9704: - D_8012390C[0].atTargetInit = globalCtx->view.lookAt; - D_8012390C[0].eyeTargetInit = globalCtx->view.eye; - D_8012390C[0].fovTargetInit = globalCtx->view.fovy; + D_8012390C[0].atTargetInit = play->view.lookAt; + D_8012390C[0].eyeTargetInit = play->view.eye; + D_8012390C[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_8012390C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 9705: - D_8012395C[0].atTargetInit = globalCtx->view.lookAt; - D_8012395C[0].eyeTargetInit = globalCtx->view.eye; - D_8012395C[0].fovTargetInit = globalCtx->view.fovy; + D_8012395C[0].atTargetInit = play->view.lookAt; + D_8012395C[0].eyeTargetInit = play->view.eye; + D_8012395C[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_8012395C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(play, camIdx, player, CAM_SET_CS_C); break; case 5110: D_801239D4[1].timerInit = 10; @@ -1101,7 +1101,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801239D4; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, (Player*)actor, CAM_SET_CS_C); + func_800C0808(play, camIdx, (Player*)actor, CAM_SET_CS_C); break; default: osSyncPrintf(VT_COL(RED, WHITE) "onepointdemo camera: demo number not found !! (%d)\n" VT_RST, csId); @@ -1110,11 +1110,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act return 0; } -s16 OnePointCutscene_SetAsChild(GlobalContext* globalCtx, s16 newCamIdx, s16 parentCamIdx) { - s16 prevCamIdx = globalCtx->cameraPtrs[parentCamIdx]->childCamIdx; +s16 OnePointCutscene_SetAsChild(PlayState* play, s16 newCamIdx, s16 parentCamIdx) { + s16 prevCamIdx = play->cameraPtrs[parentCamIdx]->childCamIdx; - globalCtx->cameraPtrs[newCamIdx]->parentCamIdx = parentCamIdx; - globalCtx->cameraPtrs[parentCamIdx]->childCamIdx = newCamIdx; + play->cameraPtrs[newCamIdx]->parentCamIdx = parentCamIdx; + play->cameraPtrs[parentCamIdx]->childCamIdx = newCamIdx; return prevCamIdx; } @@ -1123,8 +1123,8 @@ s16 OnePointCutscene_SetAsChild(GlobalContext* globalCtx, s16 newCamIdx, s16 par * Removes a cutscene camera from the list. Returns the parent cam if the removed camera is active, otherwise returns * SUBCAM_NONE */ -s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 camIdx) { - Camera* camera = globalCtx->cameraPtrs[camIdx]; +s32 OnePointCutscene_RemoveCamera(PlayState* play, s16 camIdx) { + Camera* camera = play->cameraPtrs[camIdx]; s32 nextCamIdx; if (camera->thisIdx == CHILD_CAM(camera)->parentCamIdx) { @@ -1133,11 +1133,11 @@ s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 camIdx) { if (camera->thisIdx == PARENT_CAM(camera)->childCamIdx) { PARENT_CAM(camera)->childCamIdx = camera->childCamIdx; } - nextCamIdx = (globalCtx->activeCamera == camIdx) ? camera->parentCamIdx : SUBCAM_NONE; + nextCamIdx = (play->activeCamera == camIdx) ? camera->parentCamIdx : SUBCAM_NONE; camera->parentCamIdx = MAIN_CAM; camera->childCamIdx = camera->parentCamIdx; camera->timer = -1; - Gameplay_ClearCamera(camera->globalCtx, camera->thisIdx); + Play_ClearCamera(camera->play, camera->thisIdx); return nextCamIdx; } @@ -1151,16 +1151,16 @@ s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 camIdx) { * cutscene queue in front of the specified camera, then all lower priority demos in front of it are removed from the * queue. */ -s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 parentCamIdx) { +s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamIdx) { s16 temp1; s16 temp2; s16 csCamIdx; Camera* csCam; if (parentCamIdx == SUBCAM_ACTIVE) { - parentCamIdx = globalCtx->activeCamera; + parentCamIdx = play->activeCamera; } - csCamIdx = Gameplay_CreateSubCamera(globalCtx); + csCamIdx = Play_CreateSubCamera(play); if (csCamIdx == SUBCAM_NONE) { osSyncPrintf(VT_COL(RED, WHITE) "onepoint demo: error: too many cameras ... give up! type=%d\n" VT_RST, csId); return SUBCAM_NONE; @@ -1168,58 +1168,58 @@ s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* // Inserts the cutscene camera into the cutscene queue in front of parentCam - vChildCamIdx = globalCtx->cameraPtrs[parentCamIdx]->childCamIdx; + vChildCamIdx = play->cameraPtrs[parentCamIdx]->childCamIdx; vCsStatus = CAM_STAT_ACTIVE; if (vChildCamIdx >= SUBCAM_FIRST) { - OnePointCutscene_SetAsChild(globalCtx, vChildCamIdx, csCamIdx); + OnePointCutscene_SetAsChild(play, vChildCamIdx, csCamIdx); vCsStatus = CAM_STAT_WAIT; } else { Interface_ChangeAlpha(2); } - OnePointCutscene_SetAsChild(globalCtx, csCamIdx, parentCamIdx); + OnePointCutscene_SetAsChild(play, csCamIdx, parentCamIdx); - csCam = globalCtx->cameraPtrs[csCamIdx]; + csCam = play->cameraPtrs[csCamIdx]; csCam->timer = timer; csCam->target = actor; - csCam->at = globalCtx->view.lookAt; - csCam->eye = globalCtx->view.eye; - csCam->fov = globalCtx->view.fovy; + csCam->at = play->view.lookAt; + csCam->eye = play->view.eye; + csCam->fov = play->view.fovy; csCam->csId = csId; if (parentCamIdx == MAIN_CAM) { - Gameplay_ChangeCameraStatus(globalCtx, parentCamIdx, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, parentCamIdx, CAM_STAT_UNK3); } else { - Gameplay_ChangeCameraStatus(globalCtx, parentCamIdx, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, parentCamIdx, CAM_STAT_WAIT); } - OnePointCutscene_SetInfo(globalCtx, csCamIdx, csId, actor, timer); - Gameplay_ChangeCameraStatus(globalCtx, csCamIdx, vCsStatus); + OnePointCutscene_SetInfo(play, csCamIdx, csId, actor, timer); + Play_ChangeCameraStatus(play, csCamIdx, vCsStatus); // Removes all lower priority cutscenes in front of this cutscene from the queue. vCurCamIdx = csCamIdx; - vNextCamIdx = globalCtx->cameraPtrs[csCamIdx]->childCamIdx; + vNextCamIdx = play->cameraPtrs[csCamIdx]->childCamIdx; while (vNextCamIdx >= SUBCAM_FIRST) { - s16 nextCsId = globalCtx->cameraPtrs[vNextCamIdx]->csId; - s16 thisCsId = globalCtx->cameraPtrs[csCamIdx]->csId; + s16 nextCsId = play->cameraPtrs[vNextCamIdx]->csId; + s16 thisCsId = play->cameraPtrs[csCamIdx]->csId; if ((nextCsId / 100) < (thisCsId / 100)) { osSyncPrintf(VT_COL(YELLOW, BLACK) "onepointdemo camera[%d]: killed 'coz low priority (%d < %d)\n" VT_RST, vNextCamIdx, nextCsId, thisCsId); - if (globalCtx->cameraPtrs[vNextCamIdx]->csId != 5010) { - if ((vNextCamIdx = OnePointCutscene_RemoveCamera(globalCtx, vNextCamIdx)) != SUBCAM_NONE) { - Gameplay_ChangeCameraStatus(globalCtx, vNextCamIdx, CAM_STAT_ACTIVE); + if (play->cameraPtrs[vNextCamIdx]->csId != 5010) { + if ((vNextCamIdx = OnePointCutscene_RemoveCamera(play, vNextCamIdx)) != SUBCAM_NONE) { + Play_ChangeCameraStatus(play, vNextCamIdx, CAM_STAT_ACTIVE); } } else { vCurCamIdx = vNextCamIdx; - OnePointCutscene_EndCutscene(globalCtx, vNextCamIdx); + OnePointCutscene_EndCutscene(play, vNextCamIdx); } } else { vCurCamIdx = vNextCamIdx; } - vNextCamIdx = globalCtx->cameraPtrs[vCurCamIdx]->childCamIdx; + vNextCamIdx = play->cameraPtrs[vCurCamIdx]->childCamIdx; } return csCamIdx; } @@ -1227,17 +1227,17 @@ s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* /** * Ends the cutscene in camIdx by setting its timer to 0. For attention cutscenes, it is set to 5 instead. */ -s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 camIdx) { +s16 OnePointCutscene_EndCutscene(PlayState* play, s16 camIdx) { if (camIdx == SUBCAM_ACTIVE) { - camIdx = globalCtx->activeCamera; + camIdx = play->activeCamera; } - if (globalCtx->cameraPtrs[camIdx] != NULL) { - osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", camIdx, globalCtx->cameraPtrs[camIdx]->timer, - globalCtx->cameraPtrs[camIdx]->parentCamIdx); - if (globalCtx->cameraPtrs[camIdx]->csId == 5010) { - globalCtx->cameraPtrs[camIdx]->timer = 5; + if (play->cameraPtrs[camIdx] != NULL) { + osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", camIdx, play->cameraPtrs[camIdx]->timer, + play->cameraPtrs[camIdx]->parentCamIdx); + if (play->cameraPtrs[camIdx]->csId == 5010) { + play->cameraPtrs[camIdx]->timer = 5; } else { - globalCtx->cameraPtrs[camIdx]->timer = 0; + play->cameraPtrs[camIdx]->timer = 0; } } return camIdx; @@ -1251,7 +1251,7 @@ s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 camIdx) { /** * Adds an attention cutscene to the cutscene queue. */ -s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { +s32 OnePointCutscene_Attention(PlayState* play, Actor* actor) { Camera* parentCam; s32 temp1; s32 temp2; @@ -1263,7 +1263,7 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { } sUnused = -1; - parentCam = globalCtx->cameraPtrs[MAIN_CAM]; + parentCam = play->cameraPtrs[MAIN_CAM]; if (parentCam->mode == CAM_MODE_FOLLOWBOOMERANG) { osSyncPrintf(VT_COL(YELLOW, BLACK) "actor attention demo camera: change mode BOOKEEPON -> NORMAL\n" VT_RST); Camera_ChangeMode(parentCam, CAM_MODE_NORMAL); @@ -1274,7 +1274,7 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { vLastHigherCat = -1; while (parentCam->childCamIdx != SUBCAM_FREE) { - parentCam = globalCtx->cameraPtrs[parentCam->childCamIdx]; + parentCam = play->cameraPtrs[parentCam->childCamIdx]; if (parentCam == NULL) { break; } else if (parentCam->setting != CAM_SET_CS_ATTENTION) { @@ -1314,11 +1314,11 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { case ACTORCAT_BOSS: default: osSyncPrintf(VT_COL(YELLOW, BLACK) "actor attention demo camera: %d: unkown part of actor %d\n" VT_RST, - globalCtx->state.frames, actor->category); + play->state.frames, actor->category); timer = 30; break; } - osSyncPrintf(VT_FGCOL(CYAN) "%06u:" VT_RST " actor attention demo camera: request %d ", globalCtx->state.frames, + osSyncPrintf(VT_FGCOL(CYAN) "%06u:" VT_RST " actor attention demo camera: request %d ", play->state.frames, actor->category); // If the previous attention cutscene has an actor in the same category, skip this actor. @@ -1327,12 +1327,12 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { return SUBCAM_NONE; } osSyncPrintf("→ " VT_FGCOL(BLUE) "○" VT_RST " (%d)\n", actor->id); - vCsCamIdx = OnePointCutscene_Init(globalCtx, 5010, timer, actor, vParentCamIdx); + vCsCamIdx = OnePointCutscene_Init(play, 5010, timer, actor, vParentCamIdx); if (vCsCamIdx == SUBCAM_NONE) { osSyncPrintf(VT_COL(RED, WHITE) "actor attention demo: give up! \n" VT_RST, actor->id); return SUBCAM_NONE; } else { - s32* data = (s32*)&globalCtx->cameraPtrs[vCsCamIdx]->data1; + s32* data = (s32*)&play->cameraPtrs[vCsCamIdx]->data1; *data = NA_SE_SY_CORRECT_CHIME; return vCsCamIdx; @@ -1342,11 +1342,11 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { /** * Adds an attention cutscene to the cutscene queue with the specified sound effect */ -s32 OnePointCutscene_AttentionSetSfx(GlobalContext* globalCtx, Actor* actor, s32 sfxId) { - s32 csCamIdx = OnePointCutscene_Attention(globalCtx, actor); +s32 OnePointCutscene_AttentionSetSfx(PlayState* play, Actor* actor, s32 sfxId) { + s32 csCamIdx = OnePointCutscene_Attention(play, actor); if (csCamIdx != SUBCAM_NONE) { - s32* data = (s32*)&globalCtx->cameraPtrs[csCamIdx]->data1; + s32* data = (s32*)&play->cameraPtrs[csCamIdx]->data1; *data = sfxId; } @@ -1363,11 +1363,11 @@ void OnePointCutscene_DisableAttention() { sDisableAttention = true; } -s32 OnePointCutscene_CheckForCategory(GlobalContext* globalCtx, s32 category) { - Camera* parentCam = globalCtx->cameraPtrs[MAIN_CAM]; +s32 OnePointCutscene_CheckForCategory(PlayState* play, s32 category) { + Camera* parentCam = play->cameraPtrs[MAIN_CAM]; while (parentCam->childCamIdx != SUBCAM_FREE) { - parentCam = globalCtx->cameraPtrs[parentCam->childCamIdx]; + parentCam = play->cameraPtrs[parentCam->childCamIdx]; if ((parentCam == NULL) || (parentCam->setting != CAM_SET_CS_ATTENTION)) { break; } else if (category == parentCam->target->category) { @@ -1378,5 +1378,5 @@ s32 OnePointCutscene_CheckForCategory(GlobalContext* globalCtx, s32 category) { } // unused, also empty. -void OnePointCutscene_Noop(GlobalContext* globalCtx, s32 arg1) { +void OnePointCutscene_Noop(PlayState* play, s32 arg1) { } diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index ba59b8d47..0a8d11a4b 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -232,8 +232,8 @@ void Interface_ChangeAlpha(u16 alphaType) { } } -void func_80082644(GlobalContext* globalCtx, s16 alpha) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_80082644(PlayState* play, s16 alpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { if (interfaceCtx->bAlpha != 70) { @@ -326,11 +326,11 @@ void func_80082644(GlobalContext* globalCtx, s16 alpha) { } } -void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_8008277C(PlayState* play, s16 maxAlpha, s16 alpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (gSaveContext.unk_13E7 != 0) { - func_80082644(globalCtx, alpha); + func_80082644(play, alpha); return; } @@ -371,8 +371,8 @@ void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) { } } -void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_80082850(PlayState* play, s16 maxAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 alpha = 255 - maxAlpha; switch (gSaveContext.unk_13E8) { @@ -443,7 +443,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { interfaceCtx->aAlpha = maxAlpha; } - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; @@ -513,7 +513,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; case 5: - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; @@ -533,7 +533,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; case 6: - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if (interfaceCtx->aAlpha != 255) { interfaceCtx->aAlpha = alpha; @@ -547,7 +547,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { interfaceCtx->magicAlpha = alpha; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -586,7 +586,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { interfaceCtx->minimapAlpha = maxAlpha; } - func_80082644(globalCtx, alpha); + func_80082644(play, alpha); if (interfaceCtx->healthAlpha != 255) { interfaceCtx->healthAlpha = alpha; @@ -798,7 +798,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; case 13: - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; @@ -819,24 +819,24 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; } - if ((globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) { interfaceCtx->minimapAlpha = 255; } } -void func_80083108(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_80083108(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; s16 sp28 = 0; if ((gSaveContext.cutsceneIndex < 0xFFF0) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) { + ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) { gSaveContext.unk_13E7 = 0; - if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) || - ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { + if ((player->stateFlags1 & 0x00800000) || (play->shootingGalleryStatus > 1) || + ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) { if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { gSaveContext.unk_13E7 = 1; @@ -853,22 +853,22 @@ void func_80083108(GlobalContext* globalCtx) { (gSaveContext.equips.buttonItems[0] != ITEM_NONE)) { gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0]; - if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { + if ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) { gSaveContext.equips.buttonItems[0] = ITEM_BOMBCHU; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } else { gSaveContext.equips.buttonItems[0] = ITEM_BOW; - if (globalCtx->shootingGalleryStatus > 1) { + if (play->shootingGalleryStatus > 1) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { gSaveContext.equips.buttonItems[0] = ITEM_SLINGSHOT; } - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } else { if (gSaveContext.inventory.items[SLOT_BOW] == ITEM_NONE) { gSaveContext.equips.buttonItems[0] = ITEM_NONE; } else { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } } @@ -880,13 +880,13 @@ void func_80083108(GlobalContext* globalCtx) { Interface_ChangeAlpha(6); } - if (globalCtx->transitionMode != 0) { + if (play->transitionMode != 0) { Interface_ChangeAlpha(1); } else if (gSaveContext.minigameState == 1) { Interface_ChangeAlpha(8); - } else if (globalCtx->shootingGalleryStatus > 1) { + } else if (play->shootingGalleryStatus > 1) { Interface_ChangeAlpha(8); - } else if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { + } else if ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) { Interface_ChangeAlpha(8); } else if (player->stateFlags1 & 0x00800000) { Interface_ChangeAlpha(12); @@ -896,16 +896,16 @@ void func_80083108(GlobalContext* globalCtx) { Interface_ChangeAlpha(12); } } - } else if (globalCtx->sceneNum == SCENE_KENJYANOMA) { + } else if (play->sceneNum == SCENE_KENJYANOMA) { Interface_ChangeAlpha(1); - } else if (globalCtx->sceneNum == SCENE_TURIBORI) { + } else if (play->sceneNum == SCENE_TURIBORI) { gSaveContext.unk_13E7 = 2; - if (globalCtx->interfaceCtx.unk_260 != 0) { + if (play->interfaceCtx.unk_260 != 0) { if (gSaveContext.equips.buttonItems[0] != ITEM_FISHING_POLE) { gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0]; gSaveContext.equips.buttonItems[0] = ITEM_FISHING_POLE; gSaveContext.unk_13EA = 0; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); Interface_ChangeAlpha(12); } @@ -917,7 +917,7 @@ void func_80083108(GlobalContext* globalCtx) { gSaveContext.unk_13EA = 0; if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = @@ -941,7 +941,7 @@ void func_80083108(GlobalContext* globalCtx) { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] = gSaveContext.buttonStatus[8] = BTN_DISABLED; - } else if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) { + } else if ((func_8008F2F8(play) >= 2) && (func_8008F2F8(play) < 5)) { if (gSaveContext.buttonStatus[0] != BTN_DISABLED) { sp28 = 1; } @@ -957,7 +957,7 @@ void func_80083108(GlobalContext* globalCtx) { } gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED; - } else if (func_8008F2F8(globalCtx) == 2) { + } else if (func_8008F2F8(play) == 2) { if ((gSaveContext.equips.buttonItems[i] != ITEM_HOOKSHOT) && (gSaveContext.equips.buttonItems[i] != ITEM_LONGSHOT)) { if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) { @@ -1028,7 +1028,7 @@ void func_80083108(GlobalContext* globalCtx) { } if (sp28) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); sp28 = 0; } @@ -1065,7 +1065,7 @@ void func_80083108(GlobalContext* globalCtx) { sp28 = 1; if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } } else if ((gSaveContext.buttonStatus[0] & 0xFF) == BTN_DISABLED) { @@ -1088,7 +1088,7 @@ void func_80083108(GlobalContext* globalCtx) { sp28 = 1; if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } } else { @@ -1269,7 +1269,7 @@ void func_80083108(GlobalContext* globalCtx) { (gSaveContext.equips.buttonItems[i] <= ITEM_BOOTS_HOVER)) && // (tunics/boots) on C-buttons !((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) && (gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) { - if ((globalCtx->sceneNum != SCENE_TAKARAYA) || + if ((play->sceneNum != SCENE_TAKARAYA) || (gSaveContext.equips.buttonItems[i] != ITEM_LENS)) { if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) { sp28 = 1; @@ -1312,7 +1312,7 @@ void func_80083108(GlobalContext* globalCtx) { if (sp28) { gSaveContext.unk_13EA = 0; - if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0)) { + if ((play->sceneLoadFlag == 0) && (play->transitionMode == 0)) { Interface_ChangeAlpha(50); osSyncPrintf("???????? alpha_change( 50 ); ?????\n"); } else { @@ -1321,8 +1321,8 @@ void func_80083108(GlobalContext* globalCtx) { } } -void Interface_SetSceneRestrictions(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_SetSceneRestrictions(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; u8 currentScene; @@ -1338,10 +1338,10 @@ void Interface_SetSceneRestrictions(GlobalContext* globalCtx) { i = 0; // "Data settings related to button display scene_data_ID=%d\n" - osSyncPrintf("ボタン表示関係データ設定 scene_data_ID=%d\n", globalCtx->sceneNum); + osSyncPrintf("ボタン表示関係データ設定 scene_data_ID=%d\n", play->sceneNum); do { - currentScene = (u8)globalCtx->sceneNum; + currentScene = (u8)play->sceneNum; if (sRestrictionFlags[i].scene == currentScene) { interfaceCtx->restrictions.hGauge = (sRestrictionFlags[i].flags1 & 0xC0) >> 6; interfaceCtx->restrictions.bButton = (sRestrictionFlags[i].flags1 & 0x30) >> 4; @@ -1537,8 +1537,8 @@ void Inventory_SwapAgeEquipment(void) { } } -void Interface_InitHorsebackArchery(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_InitHorsebackArchery(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; gSaveContext.minigameState = 1; interfaceCtx->unk_23C = interfaceCtx->unk_240 = interfaceCtx->unk_242 = 0; @@ -1546,7 +1546,7 @@ void Interface_InitHorsebackArchery(GlobalContext* globalCtx) { interfaceCtx->hbaAmmo = 20; } -void func_800849EC(GlobalContext* globalCtx) { +void func_800849EC(PlayState* play) { gSaveContext.inventory.equipment |= gBitFlags[2] << gEquipShifts[EQUIP_SWORD]; gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; @@ -1556,11 +1556,11 @@ void func_800849EC(GlobalContext* globalCtx) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; } - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } -void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_LoadItemIcon1(PlayState* play, u16 button) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->iconItemSegment + button * 0x1000, @@ -1569,8 +1569,8 @@ void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) { osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } -void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_LoadItemIcon2(PlayState* play, u16 button) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, interfaceCtx->iconItemSegment + button * 0x1000, @@ -1579,7 +1579,7 @@ void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) { osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } -void func_80084BF4(GlobalContext* globalCtx, u16 flag) { +void func_80084BF4(PlayState* play, u16 flag) { if (flag) { if ((gSaveContext.equips.buttonItems[0] == ITEM_SLINGSHOT) || (gSaveContext.equips.buttonItems[0] == ITEM_BOW) || (gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU) || @@ -1590,12 +1590,12 @@ void func_80084BF4(GlobalContext* globalCtx, u16 flag) { (gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU) || (gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE)) { gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0]; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } else if (gSaveContext.equips.buttonItems[0] == ITEM_NONE) { if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) || (gSaveContext.infTable[29] == 0)) { gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0]; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } @@ -1609,22 +1609,22 @@ void func_80084BF4(GlobalContext* globalCtx, u16 flag) { gSaveContext.buttonStatus[3] = BTN_ENABLED; gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] = gSaveContext.buttonStatus[8] = BTN_ENABLED; - func_80083108(globalCtx); + func_80083108(play); } } /** * @brief Adds the given item to Link's inventory. * - * NOTE: This function has been edited to be safe to use with a NULL globalCtx. - * If you need to add to this function, be sure you check if the globalCtx is not + * NOTE: This function has been edited to be safe to use with a NULL play. + * If you need to add to this function, be sure you check if the play is not * NULL before doing any operations requiring it. * - * @param globalCtx + * @param play * @param item * @return u8 */ -u8 Item_Give(GlobalContext* globalCtx, u8 item) { +u8 Item_Give(PlayState* play, u8 item) { static s16 sAmmoRefillCounts[] = { 5, 10, 20, 30, 5, 10, 30, 0, 5, 20, 1, 5, 20, 50, 200, 10 }; s16 i; s16 slot; @@ -1647,10 +1647,10 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf(VT_RST); if (item == ITEM_MEDALLION_WATER) { - func_8006D0AC(globalCtx); + func_8006D0AC(play); } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item >= ITEM_SONG_MINUET) && (item <= ITEM_SONG_STORMS)) { gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET]; @@ -1662,7 +1662,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET], gBitFlags[item - ITEM_SONG_MINUET]); osSyncPrintf(VT_RST); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_ZORA_SAPPHIRE)) { gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_KOKIRI_EMERALD + QUEST_KOKIRI_EMERALD]; @@ -1671,7 +1671,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf("精霊石 = %x\n", gSaveContext.inventory.questItems); // "Spiritual Stones = %x" osSyncPrintf(VT_RST); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item == ITEM_STONE_OF_AGONY) || (item == ITEM_GERUDO_CARD)) { gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_STONE_OF_AGONY + QUEST_STONE_OF_AGONY]; @@ -1680,7 +1680,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf("アイテム = %x\n", gSaveContext.inventory.questItems); // "Items = %x" osSyncPrintf(VT_RST); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_SKULL_TOKEN) { gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN]; @@ -1691,7 +1691,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf("Nコイン = %x(%d)\n", gSaveContext.inventory.questItems, gSaveContext.inventory.gsTokens); osSyncPrintf(VT_RST); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) { gSaveContext.inventory.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]; @@ -1708,8 +1708,8 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, 0); + if (play != NULL) { + Interface_LoadItemIcon1(play, 0); } } } @@ -1718,33 +1718,33 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.equips.equipment &= 0xFFF0; gSaveContext.equips.equipment |= 0x0002; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, 0); + if (play != NULL) { + Interface_LoadItemIcon1(play, 0); } } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) { gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) { gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) { gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) { // Boss Key, Compass, and Dungeon Map exceptions for rando. // Rando should never be able to get here for Link's Pocket unless something goes wrong, - // but we check for a globalCtx here so the game won't crash if we do somehow get here. - if (gSaveContext.n64ddFlag && globalCtx != NULL) { - if (globalCtx->sceneNum == 13) { // ganon's castle -> ganon's tower + // but we check for a play here so the game won't crash if we do somehow get here. + if (gSaveContext.n64ddFlag && play != NULL) { + if (play->sceneNum == 13) { // ganon's castle -> ganon's tower gSaveContext.inventory.dungeonItems[10] |= 1; - } else if (globalCtx->sceneNum == 92) { // Desert Colossus -> Spirit Temple. + } else if (play->sceneNum == 92) { // Desert Colossus -> Spirit Temple. gSaveContext.inventory.dungeonItems[6] |= gBitFlags[item - ITEM_KEY_BOSS]; } else { gSaveContext.inventory.dungeonItems[gSaveContext.mapIndex] |= gBitFlags[item - ITEM_KEY_BOSS]; @@ -1752,35 +1752,35 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } else { gSaveContext.inventory.dungeonItems[gSaveContext.mapIndex] |= gBitFlags[item - ITEM_KEY_BOSS]; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_KEY_SMALL) { // Small key exceptions for rando with keysanity off. // Rando should never be able to get here for Link's Pocket unless something goes wrong, - // but we check for a globalCtx here so the game won't crash if we do somehow get here. - if (gSaveContext.n64ddFlag && globalCtx != NULL) { - if (globalCtx->sceneNum == 10) { // ganon's tower -> ganon's castle + // but we check for a play here so the game won't crash if we do somehow get here. + if (gSaveContext.n64ddFlag && play != NULL) { + if (play->sceneNum == 10) { // ganon's tower -> ganon's castle gSaveContext.sohStats.dungeonKeys[13]++; if (gSaveContext.inventory.dungeonKeys[13] < 0) { gSaveContext.inventory.dungeonKeys[13] = 1; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else { gSaveContext.inventory.dungeonKeys[13]++; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } - if (globalCtx->sceneNum == 92) { // Desert Colossus -> Spirit Temple. + if (play->sceneNum == 92) { // Desert Colossus -> Spirit Temple. gSaveContext.sohStats.dungeonKeys[6]++; if (gSaveContext.inventory.dungeonKeys[6] < 0) { gSaveContext.inventory.dungeonKeys[6] = 1; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else { gSaveContext.inventory.dungeonKeys[6]++; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } @@ -1788,11 +1788,11 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { gSaveContext.sohStats.dungeonKeys[gSaveContext.mapIndex]++; if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { @@ -1800,7 +1800,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { Inventory_ChangeUpgrade(UPG_QUIVER, 1); INV_CONTENT(ITEM_BOW) = ITEM_BOW; AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 1); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else { AMMO(ITEM_BOW)++; @@ -1811,29 +1811,29 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } else if (item == ITEM_QUIVER_40) { Inventory_ChangeUpgrade(UPG_QUIVER, 2); AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 2); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_QUIVER_50) { Inventory_ChangeUpgrade(UPG_QUIVER, 3); AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 3); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BULLET_BAG_40) { Inventory_ChangeUpgrade(UPG_BULLET_BAG, 2); AMMO(ITEM_SLINGSHOT) = CAPACITY(UPG_BULLET_BAG, 2); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BULLET_BAG_50) { Inventory_ChangeUpgrade(UPG_BULLET_BAG, 3); AMMO(ITEM_SLINGSHOT) = CAPACITY(UPG_BULLET_BAG, 3); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BOMB_BAG_20) { if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { Inventory_ChangeUpgrade(UPG_BOMB_BAG, 1); INV_CONTENT(ITEM_BOMB) = ITEM_BOMB; AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 1); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else { AMMO(ITEM_BOMB)++; @@ -1844,46 +1844,46 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } else if (item == ITEM_BOMB_BAG_30) { Inventory_ChangeUpgrade(UPG_BOMB_BAG, 2); AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 2); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BOMB_BAG_40) { Inventory_ChangeUpgrade(UPG_BOMB_BAG, 3); AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 3); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BRACELET) { Inventory_ChangeUpgrade(UPG_STRENGTH, 1); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_GAUNTLETS_SILVER) { Inventory_ChangeUpgrade(UPG_STRENGTH, 2); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_GAUNTLETS_GOLD) { Inventory_ChangeUpgrade(UPG_STRENGTH, 3); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_SCALE_SILVER) { Inventory_ChangeUpgrade(UPG_SCALE, 1); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_SCALE_GOLDEN) { Inventory_ChangeUpgrade(UPG_SCALE, 2); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_WALLET_ADULT) { Inventory_ChangeUpgrade(UPG_WALLET, 1); if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { Rupees_ChangeBy(200); } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_WALLET_GIANT) { Inventory_ChangeUpgrade(UPG_WALLET, 2); if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { Rupees_ChangeBy(500); } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_STICK_UPGRADE_20) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { @@ -1891,7 +1891,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } Inventory_ChangeUpgrade(UPG_STICKS, 2); AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 2); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_STICK_UPGRADE_30) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { @@ -1899,7 +1899,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } Inventory_ChangeUpgrade(UPG_STICKS, 3); AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 3); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_NUT_UPGRADE_30) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { @@ -1907,7 +1907,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } Inventory_ChangeUpgrade(UPG_NUTS, 2); AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 2); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_NUT_UPGRADE_40) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { @@ -1915,7 +1915,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } Inventory_ChangeUpgrade(UPG_NUTS, 3); AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 3); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_LONGSHOT) { INV_CONTENT(item) = item; @@ -1923,8 +1923,8 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { if (gSaveContext.equips.buttonItems[i] == ITEM_HOOKSHOT) { gSaveContext.equips.buttonItems[i] = ITEM_LONGSHOT; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, i); + if (play != NULL) { + Interface_LoadItemIcon1(play, i); } } } @@ -1933,8 +1933,8 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < ARRAY_COUNT(gSaveContext.adultEquips.buttonItems); i++) { if (gSaveContext.adultEquips.buttonItems[i] == ITEM_HOOKSHOT) { gSaveContext.adultEquips.buttonItems[i] = ITEM_LONGSHOT; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, i); + if (play != NULL) { + Interface_LoadItemIcon1(play, i); } } } @@ -1943,13 +1943,13 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < ARRAY_COUNT(gSaveContext.childEquips.buttonItems); i++) { if (gSaveContext.childEquips.buttonItems[i] == ITEM_HOOKSHOT) { gSaveContext.childEquips.buttonItems[i] = ITEM_LONGSHOT; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, i); + if (play != NULL) { + Interface_LoadItemIcon1(play, i); } } } } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_STICK) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { @@ -2002,40 +2002,40 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if ((AMMO(ITEM_BOMB) += 1) > CUR_CAPACITY(UPG_BOMB_BAG)) { AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item >= ITEM_BOMBS_5) && (item <= ITEM_BOMBS_30)) { if ((AMMO(ITEM_BOMB) += sAmmoRefillCounts[item - ITEM_BOMBS_5]) > CUR_CAPACITY(UPG_BOMB_BAG)) { AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BOMBCHU) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; AMMO(ITEM_BOMBCHU) = 10; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else { AMMO(ITEM_BOMBCHU) += 10; if (AMMO(ITEM_BOMBCHU) > 50) { AMMO(ITEM_BOMBCHU) = 50; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } else if ((item == ITEM_BOMBCHUS_5) || (item == ITEM_BOMBCHUS_20)) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; AMMO(ITEM_BOMBCHU) += sAmmoRefillCounts[item - ITEM_BOMBCHUS_5 + 8]; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else { AMMO(ITEM_BOMBCHU) += sAmmoRefillCounts[item - ITEM_BOMBCHUS_5 + 8]; if (AMMO(ITEM_BOMBCHU) > 50) { AMMO(ITEM_BOMBCHU) = 50; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } else if ((item >= ITEM_ARROWS_SMALL) && (item <= ITEM_ARROWS_LARGE)) { @@ -2047,13 +2047,13 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf("%d本 Item_MaxGet=%d\n", AMMO(ITEM_BOW), CUR_CAPACITY(UPG_QUIVER)); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_BOW; } else if (item == ITEM_SLINGSHOT) { Inventory_ChangeUpgrade(UPG_BULLET_BAG, 1); INV_CONTENT(ITEM_SLINGSHOT) = ITEM_SLINGSHOT; AMMO(ITEM_SLINGSHOT) = 30; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_SEEDS) { AMMO(ITEM_SLINGSHOT) += 5; @@ -2064,11 +2064,11 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (!(gSaveContext.itemGetInf[1] & 8)) { gSaveContext.itemGetInf[1] |= 8; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_SEEDS; } else if (item == ITEM_SEEDS_30) { AMMO(ITEM_SLINGSHOT) += 30; @@ -2079,15 +2079,15 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (!(gSaveContext.itemGetInf[1] & 8)) { gSaveContext.itemGetInf[1] |= 8; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_SEEDS; } else if (item == ITEM_OCARINA_FAIRY) { INV_CONTENT(ITEM_OCARINA_FAIRY) = ITEM_OCARINA_FAIRY; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_OCARINA_TIME) { INV_CONTENT(ITEM_OCARINA_TIME) = ITEM_OCARINA_TIME; @@ -2095,7 +2095,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { if (gSaveContext.equips.buttonItems[i] == ITEM_OCARINA_FAIRY) { gSaveContext.equips.buttonItems[i] = ITEM_OCARINA_TIME; - Interface_LoadItemIcon1(globalCtx, i); + Interface_LoadItemIcon1(play, i); } } @@ -2104,8 +2104,8 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < ARRAY_COUNT(gSaveContext.adultEquips.buttonItems); i++) { if (gSaveContext.adultEquips.buttonItems[i] == ITEM_OCARINA_FAIRY) { gSaveContext.adultEquips.buttonItems[i] = ITEM_OCARINA_TIME; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, i); + if (play != NULL) { + Interface_LoadItemIcon1(play, i); } } } @@ -2114,13 +2114,13 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < ARRAY_COUNT(gSaveContext.childEquips.buttonItems); i++) { if (gSaveContext.childEquips.buttonItems[i] == ITEM_OCARINA_FAIRY) { gSaveContext.childEquips.buttonItems[i] = ITEM_OCARINA_TIME; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, i); + if (play != NULL) { + Interface_LoadItemIcon1(play, i); } } } } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BEAN) { if (gSaveContext.inventory.items[slot] == ITEM_NONE) { @@ -2131,66 +2131,66 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { AMMO(ITEM_BEAN)++; BEANS_BOUGHT++; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) { gSaveContext.inventory.questItems += 1 << (QUEST_HEART_PIECE + 4); gSaveContext.sohStats.heartPieces++; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_HEART_CONTAINER) { gSaveContext.healthCapacity += 0x10; gSaveContext.health += 0x10; gSaveContext.sohStats.heartContainers++; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_HEART) { osSyncPrintf("回復ハート回復ハート回復ハート\n"); // "Recovery Heart" - if (globalCtx != NULL) { - Health_ChangeBy(globalCtx, 0x10); + if (play != NULL) { + Health_ChangeBy(play, 0x10); } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return item; } else if (item == ITEM_MAGIC_SMALL) { if (gSaveContext.unk_13F0 != 10) { - if (globalCtx != NULL) { - Magic_Fill(globalCtx); + if (play != NULL) { + Magic_Fill(play); } } - if (globalCtx != NULL) { - func_80087708(globalCtx, 12, 5); + if (play != NULL) { + func_80087708(play, 12, 5); } if (!(gSaveContext.infTable[25] & 0x100)) { gSaveContext.infTable[25] |= 0x100; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return item; } else if (item == ITEM_MAGIC_LARGE) { if (gSaveContext.unk_13F0 != 10) { - if (globalCtx != NULL) { - Magic_Fill(globalCtx); + if (play != NULL) { + Magic_Fill(play); } } - if (globalCtx != NULL) { - func_80087708(globalCtx, 24, 5); + if (play != NULL) { + func_80087708(play, 24, 5); } if (!(gSaveContext.infTable[25] & 0x100)) { gSaveContext.infTable[25] |= 0x100; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return item; } else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_INVALID_8)) { Rupees_ChangeBy(sAmmoRefillCounts[item - ITEM_RUPEE_GREEN + 10]); - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } else if (item == ITEM_BOTTLE) { temp = SLOT(item); @@ -2198,7 +2198,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 0; i < 4; i++) { if (gSaveContext.inventory.items[temp + i] == ITEM_NONE) { gSaveContext.inventory.items[temp + i] = item; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } @@ -2221,8 +2221,8 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (int buttonIndex = 1; buttonIndex < ARRAY_COUNT(gSaveContext.equips.buttonItems); buttonIndex++) { if ((temp + i) == gSaveContext.equips.cButtonSlots[buttonIndex - 1]) { gSaveContext.equips.buttonItems[buttonIndex] = item; - if (globalCtx != NULL) { - Interface_LoadItemIcon2(globalCtx, buttonIndex); + if (play != NULL) { + Interface_LoadItemIcon2(play, buttonIndex); } gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(buttonIndex)] = BTN_ENABLED; break; @@ -2230,7 +2230,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } gSaveContext.inventory.items[temp + i] = item; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } @@ -2238,7 +2238,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 0; i < 4; i++) { if (gSaveContext.inventory.items[temp + i] == ITEM_NONE) { gSaveContext.inventory.items[temp + i] = item; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } @@ -2260,19 +2260,19 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (temp == gSaveContext.equips.buttonItems[i]) { if (item != ITEM_SOLD_OUT) { gSaveContext.equips.buttonItems[i] = item; - if (globalCtx != NULL) { - Interface_LoadItemIcon1(globalCtx, i); + if (play != NULL) { + Interface_LoadItemIcon1(play, i); } } else { gSaveContext.equips.buttonItems[i] = ITEM_NONE; } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } } } - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return ITEM_NONE; } @@ -2280,11 +2280,11 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp); INV_CONTENT(item) = item; - PerformAutosave(globalCtx, item); + PerformAutosave(play, item); return temp; } -u16 Randomizer_Item_Give(GlobalContext* globalCtx, GetItemEntry giEntry) { +u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { uint16_t item = giEntry.itemId; uint16_t temp; uint16_t i; @@ -2294,7 +2294,7 @@ u16 Randomizer_Item_Give(GlobalContext* globalCtx, GetItemEntry giEntry) { if (item == RG_MAGIC_SINGLE) { gSaveContext.magicAcquired = true; gSaveContext.unk_13F6 = 0x30; - Magic_Fill(globalCtx); + Magic_Fill(play); return RG_NONE; } else if (item == RG_MAGIC_DOUBLE) { if (!gSaveContext.magicAcquired) { @@ -2303,7 +2303,7 @@ u16 Randomizer_Item_Give(GlobalContext* globalCtx, GetItemEntry giEntry) { gSaveContext.doubleMagic = true; gSaveContext.unk_13F6 = 0x60; gSaveContext.magicLevel = 0; - Magic_Fill(globalCtx); + Magic_Fill(play); return RG_NONE; } @@ -2630,10 +2630,10 @@ u8 Item_CheckObtainability(u8 item) { return gSaveContext.inventory.items[slot]; } -void PerformAutosave(GlobalContext* globalCtx, u8 item) { +void PerformAutosave(PlayState* play, u8 item) { if (CVar_GetS32("gAutosave", 0)) { if (CVar_GetS32("gAutosaveAllItems", 0)) { - Gameplay_PerformSave(globalCtx); + Play_PerformSave(play); } else if (CVar_GetS32("gAutosaveMajorItems", 1)) { switch (item) { case ITEM_STICK: @@ -2669,11 +2669,11 @@ void PerformAutosave(GlobalContext* globalCtx, u8 item) { case ITEM_SEEDS_30: break; case ITEM_SWORD_MASTER: - if (globalCtx->sceneNum == SCENE_GANON_DEMO) { + if (play->sceneNum == SCENE_GANON_DEMO) { break; } default: - Gameplay_PerformSave(globalCtx); + Play_PerformSave(play); break; } } @@ -2699,7 +2699,7 @@ void Inventory_DeleteItem(u16 item, u16 invSlot) { } } -s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) { +s32 Inventory_ReplaceItem(PlayState* play, u16 oldItem, u16 newItem) { s16 i; for (i = 0; i < ARRAY_COUNT(gSaveContext.inventory.items); i++) { @@ -2709,7 +2709,7 @@ s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) { for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { if (gSaveContext.equips.buttonItems[i] == oldItem) { gSaveContext.equips.buttonItems[i] = newItem; - Interface_LoadItemIcon1(globalCtx, i); + Interface_LoadItemIcon1(play, i); break; } } @@ -2763,7 +2763,7 @@ s32 Inventory_HasSpecificBottle(u8 bottleItem) { } } -void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) { +void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) { osSyncPrintf("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", item, button, gSaveContext.equips.cButtonSlots[button - 1], gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]]); @@ -2777,13 +2777,13 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) { gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] = item; gSaveContext.equips.buttonItems[button] = item; - Interface_LoadItemIcon1(globalCtx, button); + Interface_LoadItemIcon1(play, button); - globalCtx->pauseCtx.cursorItem[PAUSE_ITEM] = item; + play->pauseCtx.cursorItem[PAUSE_ITEM] = item; gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(button)] = BTN_ENABLED; } -s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) { +s32 Inventory_ConsumeFairy(PlayState* play) { s32 bottleSlot = SLOT(ITEM_FAIRY); s16 i; s16 j; @@ -2793,7 +2793,7 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) { for (j = 1; j < ARRAY_COUNT(gSaveContext.equips.buttonItems); j++) { if (gSaveContext.equips.buttonItems[j] == ITEM_FAIRY) { gSaveContext.equips.buttonItems[j] = ITEM_BOTTLE; - Interface_LoadItemIcon1(globalCtx, j); + Interface_LoadItemIcon1(play, j); i = 0; bottleSlot = gSaveContext.equips.cButtonSlots[j - 1]; break; @@ -2808,9 +2808,9 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) { return 0; } -bool Inventory_HatchPocketCucco(GlobalContext* globalCtx) { +bool Inventory_HatchPocketCucco(PlayState* play) { if (!gSaveContext.n64ddFlag) { - return Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO); + return Inventory_ReplaceItem(play, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO); } if (!PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_POCKET_EGG)) { @@ -2819,7 +2819,7 @@ bool Inventory_HatchPocketCucco(GlobalContext* globalCtx) { gSaveContext.adultTradeItems &= ~ADULT_TRADE_FLAG(ITEM_POCKET_EGG); gSaveContext.adultTradeItems |= ADULT_TRADE_FLAG(ITEM_POCKET_CUCCO); - Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO); + Inventory_ReplaceItem(play, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO); return 1; } @@ -2883,9 +2883,9 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l } } -void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void Interface_SetDoAction(PlayState* play, u16 action) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; if (interfaceCtx->unk_1F0 != action) { interfaceCtx->unk_1F0 = action; @@ -2898,11 +2898,11 @@ void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) { } } -void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_SetNaviCall(PlayState* play, u16 naviCallState) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (((naviCallState == 0x1D) || (naviCallState == 0x1E)) && !interfaceCtx->naviCalling && - (globalCtx->csCtx.state == CS_STATE_IDLE)) { + (play->csCtx.state == CS_STATE_IDLE)) { if (!CVar_GetS32("gDisableNaviCallAudio", 0)) { // clang-format off if (naviCallState == 0x1E) { Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &D_801333D4, 4, @@ -2922,8 +2922,8 @@ void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) { } } -void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_LoadActionLabelB(PlayState* play, u16 action) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; char* doAction = actionsTbl[action]; char newName[512]; @@ -2966,7 +2966,7 @@ void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) { interfaceCtx->unk_1FA = 1; } -s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) { +s32 Health_ChangeBy(PlayState* play, s16 healthChange) { u16 heartCount; u16 healthLevel; @@ -3101,7 +3101,7 @@ void Inventory_ChangeAmmo(s16 item, s16 ammoChange) { osSyncPrintf("合計 = (%d)\n", AMMO(item)); // "Total = (%d)" } -void Magic_Fill(GlobalContext* globalCtx) { +void Magic_Fill(PlayState* play) { if (gSaveContext.magicAcquired) { gSaveContext.unk_13F2 = gSaveContext.unk_13F0; gSaveContext.unk_13F6 = (gSaveContext.doubleMagic + 1) * 0x30; @@ -3109,7 +3109,7 @@ void Magic_Fill(GlobalContext* globalCtx) { } } -void func_800876C8(GlobalContext* globalCtx) { +void func_800876C8(PlayState* play) { if ((gSaveContext.unk_13F0 != 8) && (gSaveContext.unk_13F0 != 9)) { if (gSaveContext.unk_13F0 == 10) { gSaveContext.unk_13F2 = gSaveContext.unk_13F0; @@ -3118,7 +3118,7 @@ void func_800876C8(GlobalContext* globalCtx) { } } -s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { +s32 func_80087708(PlayState* play, s16 arg1, s16 arg2) { if (!gSaveContext.magicAcquired) { return 0; } @@ -3135,7 +3135,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 2: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.lensActive = false; + play->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 1; @@ -3147,7 +3147,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 1: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.lensActive = false; + play->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 6; @@ -3159,7 +3159,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 3: if (gSaveContext.unk_13F0 == 0) { if (gSaveContext.magic != 0) { - globalCtx->interfaceCtx.unk_230 = 80; + play->interfaceCtx.unk_230 = 80; gSaveContext.unk_13F0 = 7; return 1; } else { @@ -3175,7 +3175,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 4: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.lensActive = false; + play->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 4; @@ -3201,7 +3201,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { return 0; } -void Interface_UpdateMagicBar(GlobalContext* globalCtx) { +void Interface_UpdateMagicBar(PlayState* play) { static s16 sMagicBorderColors[][3] = { { 255, 255, 255 }, { 150, 150, 150 }, @@ -3234,8 +3234,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { static s16 sMagicBorderIndexes[] = { 0, 1, 1, 0 }; static s16 sMagicBorderRatio = 2; static s16 sMagicBorderStep = 1; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 borderChangeR; s16 borderChangeG; s16 borderChangeB; @@ -3350,9 +3350,9 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { break; case 7: - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && - (globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->sceneLoadFlag == 0) && (play->transitionMode == 0) && !Play_InCsMode(play)) { bool hasLens = false; for (int buttonIndex = 1; buttonIndex < (CVar_GetS32("gDpadEquips", 0) != 0) ? ARRAY_COUNT(gSaveContext.equips.buttonItems) : 4; buttonIndex++) { if (gSaveContext.equips.buttonItems[buttonIndex] == ITEM_LENS) { @@ -3360,10 +3360,10 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { break; } } - if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) || + if ((gSaveContext.magic == 0) || ((func_8008F2F8(play) >= 2) && (func_8008F2F8(play) < 5)) || !hasLens || - !globalCtx->actorCtx.lensActive) { - globalCtx->actorCtx.lensActive = false; + !play->actorCtx.lensActive) { + play->actorCtx.lensActive = false; Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); gSaveContext.unk_13F0 = 0; @@ -3434,12 +3434,12 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { } } -void Interface_DrawLineupTick(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_DrawLineupTick(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetEnvColor(OVERLAY_DISP++, 255, 255, 255, 255); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); @@ -3453,17 +3453,17 @@ void Interface_DrawLineupTick(GlobalContext* globalCtx) { gDPPipeSync(OVERLAY_DISP++); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Interface_DrawMagicBar(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_DrawMagicBar(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 magicDrop = R_MAGIC_BAR_LARGE_Y-R_MAGIC_BAR_SMALL_Y+2; s16 magicBarY; Color_RGB8 magicbar_yellow = {250,250,0}; //Magic bar being used Color_RGB8 magicbar_green = {R_MAGIC_FILL_COLOR(0),R_MAGIC_FILL_COLOR(1),R_MAGIC_FILL_COLOR(2)}; //Magic bar fill - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (gSaveContext.magicLevel != 0) { s16 X_Margins; @@ -3534,7 +3534,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { rMagicFillX = rMagicFillX_original; } - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); if (CVar_GetS32("gHudColors", 1) == 2) {//Original game add color there so to prevent miss match we make it all white :) gDPSetEnvColor(OVERLAY_DISP++, 255, 255, 255, 255); @@ -3604,7 +3604,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80088AA0(s16 arg0) { @@ -3620,7 +3620,7 @@ void func_80088AA0(s16 arg0) { } } -void func_80088AF0(GlobalContext* globalCtx) { +void func_80088AF0(PlayState* play) { if (gSaveContext.timer2State != 0) { if (gSaveContext.eventInf[1] & 1) { gSaveContext.timer2Value = 239; @@ -3655,12 +3655,12 @@ void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) { CLOSE_DISPS(gfxCtx); } -void Interface_DrawItemButtons(GlobalContext* globalCtx) { +void Interface_DrawItemButtons(PlayState* play) { static void* cUpLabelTextures[] = { gNaviCUpENGTex, gNaviCUpENGTex, gNaviCUpENGTex }; static s16 startButtonLeftPos[] = { 132, 130, 130 }; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = GET_PLAYER(globalCtx); - PauseContext* pauseCtx = &globalCtx->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + PauseContext* pauseCtx = &play->pauseCtx; s16 temp; // Used as both an alpha value and a button index s16 dxdy; s16 width; @@ -3913,7 +3913,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { C_Down_BTN_Pos[0] = OTRGetRectDimensionFromRightEdge(C_Down_BTN_Pos_ori[0]); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // B Button Color & Texture // Also loads the Item Button Texture reused by other buttons afterwards @@ -3977,7 +3977,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1); if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) { - if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { // Start Button Texture, Color & Label gDPPipeSync(OVERLAY_DISP++); @@ -4029,23 +4029,23 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); Matrix_Translate(PosX_StartBtn-160+((Start_BTN_Scale+Start_BTN_Scale/3)*11.5f), (PosY_StartBtn-120+((Start_BTN_Scale+Start_BTN_Scale/3)*11.5f)) * -1, 1.0f, MTXMODE_NEW); Matrix_Scale(Start_BTN_Scale+(Start_BTN_Scale/3), Start_BTN_Scale+(Start_BTN_Scale/3), Start_BTN_Scale+(Start_BTN_Scale/3), MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0); - Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE() * 2); + Interface_DrawActionLabel(play->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE() * 2); gDPPipeSync(OVERLAY_DISP++); } } - if (interfaceCtx->naviCalling && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (globalCtx->csCtx.state == CS_STATE_IDLE)) { + if (interfaceCtx->naviCalling && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + (play->csCtx.state == CS_STATE_IDLE)) { if (!sCUpInvisible) { // C-Up Button Texture, Color & Label (Navi Text) gDPPipeSync(OVERLAY_DISP++); if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) { temp = 0; - } else if ((player->stateFlags1 & 0x00200000) || (func_8008F2F8(globalCtx) == 4) || + } else if ((player->stateFlags1 & 0x00200000) || (func_8008F2F8(play) == 4) || (player->stateFlags2 & 0x00040000)) { temp = 70; } else { @@ -4216,16 +4216,16 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } int16_t gItemIconWidth[] = { 30, 24, 24, 24, 16, 16, 16, 16 }; int16_t gItemIconDD[] = { 550, 680, 680, 680, 1024, 1024, 1024, 1024 }; -void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) { - OPEN_DISPS(globalCtx->state.gfxCtx); - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { + OPEN_DISPS(play->state.gfxCtx); + GraphicsContext* gfxCtx = play->state.gfxCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 X_Margins_CL; s16 X_Margins_CR; s16 X_Margins_CD; @@ -4418,7 +4418,7 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 (ItemIconPos[button][1] + gItemIconWidth[button]) << 2, G_TX_RENDERTILE, 0, 0, gItemIconDD[button] << 1, gItemIconDD[button] << 1); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } const char* _gAmmoDigit0Tex[] = @@ -4432,7 +4432,7 @@ static int16_t gItemAmmoX[] = { B_BUTTON_X + 2, C_LEFT_BUTTON_X + 1, C_DOWN_BUTT static int16_t gItemAmmoY[] = { B_BUTTON_Y + 18, C_LEFT_BUTTON_Y + 17, C_DOWN_BUTTON_Y + 17, C_RIGHT_BUTTON_Y + 17, DPAD_UP_Y + 11, DPAD_DOWN_Y + 11, DPAD_LEFT_Y + 11, DPAD_RIGHT_Y + 11 }; -void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { +void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { s16 i; s16 ammo; s16 X_Margins_CL; @@ -4611,7 +4611,7 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { ItemIconPos[3][1] = ItemIconPos_ori[3][1]; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); i = gSaveContext.equips.buttonItems[button]; @@ -4628,11 +4628,11 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { gDPPipeSync(OVERLAY_DISP++); if ((button == 0) && (gSaveContext.minigameState == 1)) { - ammo = globalCtx->interfaceCtx.hbaAmmo; - } else if ((button == 0) && (globalCtx->shootingGalleryStatus > 1)) { - ammo = globalCtx->shootingGalleryStatus - 1; - } else if ((button == 0) && (globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { - ammo = globalCtx->bombchuBowlingStatus; + ammo = play->interfaceCtx.hbaAmmo; + } else if ((button == 0) && (play->shootingGalleryStatus > 1)) { + ammo = play->shootingGalleryStatus - 1; + } else if ((button == 0) && (play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) { + ammo = play->bombchuBowlingStatus; if (ammo < 0) { ammo = 0; } @@ -4663,19 +4663,19 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Interface_DrawActionButton(GlobalContext* globalCtx, f32 x, f32 y) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_DrawActionButton(PlayState* play, f32 x, f32 y) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(-137.0f + x, 97.0f - y, XREG(18) / 10.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0); @@ -4685,14 +4685,14 @@ void Interface_DrawActionButton(GlobalContext* globalCtx, f32 x, f32 y) { gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Interface_InitVertices(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_InitVertices(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; - interfaceCtx->actionVtx = Graph_Alloc(globalCtx->state.gfxCtx, 8 * sizeof(Vtx)); + interfaceCtx->actionVtx = Graph_Alloc(play->state.gfxCtx, 8 * sizeof(Vtx)); // clang-format off interfaceCtx->actionVtx[0].v.ob[0] = @@ -4741,7 +4741,7 @@ void Interface_InitVertices(GlobalContext* globalCtx) { interfaceCtx->actionVtx[5].v.tc[0] = interfaceCtx->actionVtx[7].v.tc[0] = 1536; interfaceCtx->actionVtx[6].v.tc[1] = interfaceCtx->actionVtx[7].v.tc[1] = 512; - interfaceCtx->beatingHeartVtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Vtx)); + interfaceCtx->beatingHeartVtx = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Vtx)); interfaceCtx->beatingHeartVtx[0].v.ob[0] = interfaceCtx->beatingHeartVtx[2].v.ob[0] = -8; interfaceCtx->beatingHeartVtx[1].v.ob[0] = interfaceCtx->beatingHeartVtx[3].v.ob[0] = 8; @@ -4771,8 +4771,8 @@ void Interface_InitVertices(GlobalContext* globalCtx) { } /* -void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s32 rightX) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_8008A8B8(PlayState* play, s32 topY, s32 bottomY, s32 leftX, s32 rightX) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; Vec3f eye; Vec3f lookAt; Vec3f up; @@ -4809,7 +4809,7 @@ const char* digitTextures[] = gCounterDigit4Tex, gCounterDigit5Tex, gCounterDigit6Tex, gCounterDigit7Tex, gCounterDigit8Tex }; -void Interface_Draw(GlobalContext* globalCtx) { +void Interface_Draw(PlayState* play) { static s16 magicArrowEffectsR[] = { 255, 100, 255 }; static s16 magicArrowEffectsG[] = { 0, 100, 255 }; static s16 magicArrowEffectsB[] = { 0, 255, 100 }; @@ -4843,23 +4843,23 @@ void Interface_Draw(GlobalContext* globalCtx) { static s16 D_8015FFE4; static s16 D_8015FFE6; static s16 timerDigits[5]; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); s16 svar1; s16 svar2; s16 svar3; s16 svar4; s16 svar5; s16 svar6; - bool fullUi = !CVar_GetS32("gMinimalUI", 0) || !R_MINIMAP_DISABLED || globalCtx->pauseCtx.state != 0; + bool fullUi = !CVar_GetS32("gMinimalUI", 0) || !R_MINIMAP_DISABLED || play->pauseCtx.state != 0; if (chaosEffectNoUI) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // Invalidate Do Action textures as they may have changed gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->doActionSegment); @@ -4871,13 +4871,13 @@ void Interface_Draw(GlobalContext* globalCtx) { gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment); if (pauseCtx->debugState == 0) { - Interface_InitVertices(globalCtx); + Interface_InitVertices(play); func_8008A994(interfaceCtx); if (fullUi || gSaveContext.health != gSaveContext.healthCapacity) { - HealthMeter_Draw(globalCtx); + HealthMeter_Draw(play); } - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); if (fullUi) { // Rupee Icon @@ -4942,7 +4942,7 @@ void Interface_Draw(GlobalContext* globalCtx) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor.r, rColor.g, rColor.b, interfaceCtx->magicAlpha); OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, PosX_RC, PosY_RC, 16, 16, 1 << 10, 1 << 10); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_BMORI1: case SCENE_HIDAN: case SCENE_MIZUSIN: @@ -5073,23 +5073,23 @@ void Interface_Draw(GlobalContext* globalCtx) { } if (CVar_GetS32("gDrawLineupTick", 0)) { - Interface_DrawLineupTick(globalCtx); + Interface_DrawLineupTick(play); } if (fullUi || gSaveContext.unk_13F0 > 0) { - Interface_DrawMagicBar(globalCtx); + Interface_DrawMagicBar(play); } - Minimap_Draw(globalCtx); + Minimap_Draw(play); if ((R_PAUSE_MENU_MODE != 2) && (R_PAUSE_MENU_MODE != 3)) { - func_8002C124(&globalCtx->actorCtx.targetCtx, globalCtx); // Draw Z-Target + func_8002C124(&play->actorCtx.targetCtx, play); // Draw Z-Target } - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); if (fullUi) { - Interface_DrawItemButtons(globalCtx); + Interface_DrawItemButtons(play); } gDPPipeSync(OVERLAY_DISP++); @@ -5101,20 +5101,20 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { if (fullUi) { - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[0]], 0); } - if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) || - ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { + if ((player->stateFlags1 & 0x00800000) || (play->shootingGalleryStatus > 1) || + ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) { if (!fullUi) { - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[0]], 0); } gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 0, interfaceCtx->bAlpha); + Interface_DrawAmmoCount(play, 0, interfaceCtx->bAlpha); } } } else { @@ -5182,11 +5182,11 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[1] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[1]], 1); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[1]], 1); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 1, interfaceCtx->cLeftAlpha); + Interface_DrawAmmoCount(play, 1, interfaceCtx->cLeftAlpha); } gDPPipeSync(OVERLAY_DISP++); @@ -5195,11 +5195,11 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[2] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[2]], 2); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[2]], 2); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 2, interfaceCtx->cDownAlpha); + Interface_DrawAmmoCount(play, 2, interfaceCtx->cDownAlpha); } gDPPipeSync(OVERLAY_DISP++); @@ -5208,11 +5208,11 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[3] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[3]], 3); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[3]], 3); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 3, interfaceCtx->cRightAlpha); + Interface_DrawAmmoCount(play, 3, interfaceCtx->cRightAlpha); } if (CVar_GetS32("gDpadEquips", 0) != 0) { @@ -5271,49 +5271,49 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[4] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadUpAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[4]], 4); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[4]], 4); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 4, interfaceCtx->dpadUpAlpha); + Interface_DrawAmmoCount(play, 4, interfaceCtx->dpadUpAlpha); } // DPad-Down Button Icon & Ammo Count if (gSaveContext.equips.buttonItems[5] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadDownAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[5]], 5); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[5]], 5); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 5, interfaceCtx->dpadDownAlpha); + Interface_DrawAmmoCount(play, 5, interfaceCtx->dpadDownAlpha); } // DPad-Left Button Icon & Ammo Count if (gSaveContext.equips.buttonItems[6] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadLeftAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[6]], 6); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[6]], 6); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 6, interfaceCtx->dpadLeftAlpha); + Interface_DrawAmmoCount(play, 6, interfaceCtx->dpadLeftAlpha); } // DPad-Right Button Icon & Ammo Count if (gSaveContext.equips.buttonItems[7] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadRightAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[7]], 7); + Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[7]], 7); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 7, interfaceCtx->dpadRightAlpha); + Interface_DrawAmmoCount(play, 7, interfaceCtx->dpadRightAlpha); } } // A Button - func_80094A14(globalCtx->state.gfxCtx); + func_80094A14(play->state.gfxCtx); const Color_RGB8 A_Button_Colors = {R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2)}; s16 X_Margins_BtnA; s16 Y_Margins_BtnA; @@ -5366,7 +5366,7 @@ void Interface_Draw(GlobalContext* globalCtx) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCABtnPrim", A_Button_Colors).r,CVar_GetRGB("gCCABtnPrim", A_Button_Colors).g,CVar_GetRGB("gCCABtnPrim", A_Button_Colors).b, interfaceCtx->aAlpha); } if (fullUi) { - Interface_DrawActionButton(globalCtx, PosX_BtnA, PosY_BtnA); + Interface_DrawActionButton(play, PosX_BtnA, PosY_BtnA); } gDPPipeSync(OVERLAY_DISP++); gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK); @@ -5377,14 +5377,14 @@ void Interface_Draw(GlobalContext* globalCtx) { Matrix_Translate(-138.0f + rAIconX, rAIconY, WREG(46 + gSaveContext.language) / 10.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0); if ((interfaceCtx->unk_1EC < 2) || (interfaceCtx->unk_1EC == 3)) { - Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment); + Interface_DrawActionLabel(play->state.gfxCtx, interfaceCtx->doActionSegment); } else { - Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE()); + Interface_DrawActionLabel(play->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE()); } gDPPipeSync(OVERLAY_DISP++); @@ -5395,7 +5395,7 @@ void Interface_Draw(GlobalContext* globalCtx) { if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 3)) { // Inventory Equip Effects gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment); - func_80094A14(globalCtx->state.gfxCtx); + func_80094A14(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); @@ -5441,9 +5441,9 @@ void Interface_Draw(GlobalContext* globalCtx) { gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); } - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { if (gSaveContext.minigameState != 1) { // Carrots rendering if the action corresponds to riding a horse if (interfaceCtx->unk_1EE == 8 && !CVar_GetS32("gInfiniteEpona", 0)) { @@ -5540,12 +5540,12 @@ void Interface_Draw(GlobalContext* globalCtx) { } } - if ((gSaveContext.timer2State == 5) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT)) { + if ((gSaveContext.timer2State == 5) && (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) { // Trade quest timer reached 0 D_8015FFE6 = 40; gSaveContext.cutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.timer2State = 0; if ((gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI) && @@ -5564,25 +5564,25 @@ void Interface_Draw(GlobalContext* globalCtx) { if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[svar1]) { gSaveContext.eventInf[0] &= 0x7F80; osSyncPrintf("EVENT_INF=%x\n", gSaveContext.eventInf[0]); - globalCtx->nextEntranceIndex = spoilingItemEntrances[svar1]; + play->nextEntranceIndex = spoilingItemEntrances[svar1]; INV_CONTENT(gSpoilingItemReverts[svar1]) = gSpoilingItemReverts[svar1]; for (svar2 = 1; svar2 < ARRAY_COUNT(gSaveContext.equips.buttonItems); svar2++) { if (gSaveContext.equips.buttonItems[svar2] == gSpoilingItems[svar1]) { gSaveContext.equips.buttonItems[svar2] = gSpoilingItemReverts[svar1]; - Interface_LoadItemIcon1(globalCtx, svar2); + Interface_LoadItemIcon1(play, svar2); } } } } } - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && - !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && - (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx) && (gSaveContext.minigameState != 1) && - (globalCtx->shootingGalleryStatus <= 1) && - !((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && + !(player->stateFlags2 & 0x01000000) && (play->sceneLoadFlag == 0) && + (play->transitionMode == 0) && !Play_InCsMode(play) && (gSaveContext.minigameState != 1) && + (play->shootingGalleryStatus <= 1) && + !((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) { svar6 = 0; switch (gSaveContext.timer1State) { case 1: @@ -5672,7 +5672,7 @@ void Interface_Draw(GlobalContext* globalCtx) { gSaveContext.timer1State = 10; if (D_80125A5C != 0) { gSaveContext.health = 0; - globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 2)); + play->damagePlayer(play, -(gSaveContext.health + 2)); } D_80125A5C = 0; } else if (gSaveContext.timer1Value > 60) { @@ -5836,16 +5836,16 @@ void Interface_Draw(GlobalContext* globalCtx) { osSyncPrintf("TOTAL_EVENT_TM=%d\n", gSaveContext.timer2Value); if (gSaveContext.timer2Value <= 0) { - if (!Flags_GetSwitch(globalCtx, 0x37) || - ((globalCtx->sceneNum != SCENE_GANON_DEMO) && - (globalCtx->sceneNum != SCENE_GANON_FINAL) && - (globalCtx->sceneNum != SCENE_GANON_SONOGO) && - (globalCtx->sceneNum != SCENE_GANONTIKA_SONOGO))) { + if (!Flags_GetSwitch(play, 0x37) || + ((play->sceneNum != SCENE_GANON_DEMO) && + (play->sceneNum != SCENE_GANON_FINAL) && + (play->sceneNum != SCENE_GANON_SONOGO) && + (play->sceneNum != SCENE_GANONTIKA_SONOGO))) { D_8015FFE6 = 40; gSaveContext.timer2State = 5; gSaveContext.cutsceneIndex = 0; - Message_StartTextbox(globalCtx, 0x71B0, NULL); - func_8002DF54(globalCtx, NULL, 8); + Message_StartTextbox(play, 0x71B0, NULL); + func_8002DF54(play, NULL, 8); } else { D_8015FFE6 = 40; gSaveContext.timer2State = 6; @@ -5868,7 +5868,7 @@ void Interface_Draw(GlobalContext* globalCtx) { gSaveContext.timer2Value++; if (gSaveContext.eventInf[1] & 1) { if (gSaveContext.timer2Value == 240) { - Message_StartTextbox(globalCtx, 0x6083, NULL); + Message_StartTextbox(play, 0x6083, NULL); gSaveContext.eventInf[1] &= ~1; gSaveContext.timer2State = 0; } @@ -5981,7 +5981,7 @@ void Interface_Draw(GlobalContext* globalCtx) { } if (pauseCtx->debugState == 3) { - FlagSet_Update(globalCtx); + FlagSet_Update(play); } if (interfaceCtx->unk_244 != 0) { @@ -5991,19 +5991,19 @@ void Interface_Draw(GlobalContext* globalCtx) { gDPFillRectangle(OVERLAY_DISP++, 0, 0, gScreenWidth - 1, gScreenHeight - 1); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Interface_Update(GlobalContext* globalCtx) { +void Interface_Update(PlayState* play) { static u8 D_80125B60 = 0; static s16 sPrevTimeIncrement = 0; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = GET_PLAYER(globalCtx); + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); s16 alpha; s16 alpha1; u16 action; - Input* debugInput = &globalCtx->state.input[2]; + Input* debugInput = &play->state.input[2]; Top_HUD_Margin = CVar_GetS32("gHUDMargin_T", 0); Left_HUD_Margin = CVar_GetS32("gHUDMargin_L", 0); @@ -6021,13 +6021,13 @@ void Interface_Update(GlobalContext* globalCtx) { osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language); } - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneSetupIndex < 4) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) { + ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) { if ((msgCtx->msgMode == MSGMODE_NONE) || - ((msgCtx->msgMode != MSGMODE_NONE) && (globalCtx->sceneNum == SCENE_BOWLING))) { - if (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) { - func_80083108(globalCtx); + ((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneNum == SCENE_BOWLING))) { + if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { + func_80083108(play); } } } @@ -6052,7 +6052,7 @@ void Interface_Update(GlobalContext* globalCtx) { alpha = 0; } - func_80082850(globalCtx, alpha); + func_80082850(play, alpha); gSaveContext.unk_13EC++; if (alpha == 0) { @@ -6071,7 +6071,7 @@ void Interface_Update(GlobalContext* globalCtx) { } osSyncPrintf("case 50 : alpha=%d alpha1=%d\n", alpha, alpha1); - func_80082644(globalCtx, alpha1); + func_80082644(play, alpha1); if (interfaceCtx->healthAlpha != 255) { interfaceCtx->healthAlpha = alpha1; @@ -6081,7 +6081,7 @@ void Interface_Update(GlobalContext* globalCtx) { interfaceCtx->magicAlpha = alpha1; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -6123,13 +6123,13 @@ void Interface_Update(GlobalContext* globalCtx) { break; case 52: gSaveContext.unk_13E8 = 1; - func_80082850(globalCtx, 0); + func_80082850(play, 0); gSaveContext.unk_13E8 = 0; default: break; } - Map_Update(globalCtx); + Map_Update(play); if (gSaveContext.healthAccumulator != 0) { gSaveContext.healthAccumulator -= 4; @@ -6149,24 +6149,24 @@ void Interface_Update(GlobalContext* globalCtx) { } } - HealthMeter_HandleCriticalAlarm(globalCtx); - D_80125A58 = func_8008F2F8(globalCtx); + HealthMeter_HandleCriticalAlarm(play); + D_80125A58 = func_8008F2F8(play); if (D_80125A58 == 1) { if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 2 || CVar_GetS32("gSuperTunic", 0) != 0) { D_80125A58 = 0; } - } else if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) { + } else if ((func_8008F2F8(play) >= 2) && (func_8008F2F8(play) < 5)) { if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 3 || CVar_GetS32("gSuperTunic", 0) != 0) { D_80125A58 = 0; } } - HealthMeter_Update(globalCtx); + HealthMeter_Update(play); - if ((gSaveContext.timer1State >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && - (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {} + if ((gSaveContext.timer1State >= 3) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & 0x01000000) && (play->sceneLoadFlag == 0) && + (play->transitionMode == 0) && !Play_InCsMode(play)) {} if (gSaveContext.rupeeAccumulator != 0) { if (gSaveContext.rupeeAccumulator > 0) { @@ -6245,10 +6245,10 @@ void Interface_Update(GlobalContext* globalCtx) { WREG(7) = interfaceCtx->unk_1F4; - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && (globalCtx->sceneLoadFlag == 0) && - (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (globalCtx->transitionMode == 0) && - ((globalCtx->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(globalCtx))) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + (msgCtx->msgMode == MSGMODE_NONE) && (play->sceneLoadFlag == 0) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionMode == 0) && + ((play->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(play))) { if ((gSaveContext.magicAcquired != 0) && (gSaveContext.magicLevel == 0)) { gSaveContext.magicLevel = gSaveContext.doubleMagic + 1; gSaveContext.unk_13F0 = 8; @@ -6261,7 +6261,7 @@ void Interface_Update(GlobalContext* globalCtx) { osSyncPrintf(VT_RST); } - Interface_UpdateMagicBar(globalCtx); + Interface_UpdateMagicBar(play); } if (gSaveContext.timer1State == 0) { @@ -6315,11 +6315,11 @@ void Interface_Update(GlobalContext* globalCtx) { // exit out of ocarina mode after suns song finishes playing if ((msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE) && (gSaveContext.sunsSongState == SUNSSONG_START)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } // handle suns song in areas where time moves - if (globalCtx->envCtx.timeIncrement != 0) { + if (play->envCtx.timeIncrement != 0) { if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) { D_80125B60 = 0; if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) { @@ -6333,35 +6333,35 @@ void Interface_Update(GlobalContext* globalCtx) { if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gTimeIncrement = sPrevTimeIncrement; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } } else if (gSaveContext.dayTime > 0xC001) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gTimeIncrement = sPrevTimeIncrement; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } - } else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) && + } else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->restrictions.sunsSong != 3)) { if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime < 0xC001)) { gSaveContext.nextDayTime = 0; - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; gSaveContext.nextTransition = 2; - globalCtx->unk_11DE9 = 1; + play->unk_11DE9 = 1; } else { gSaveContext.nextDayTime = 0x8001; - globalCtx->fadeTransition = 5; + play->fadeTransition = 5; gSaveContext.nextTransition = 3; - globalCtx->unk_11DE9 = 1; + play->unk_11DE9 = 1; } - if (globalCtx->sceneNum == SCENE_SPOT13) { - globalCtx->fadeTransition = 14; + if (play->sceneNum == SCENE_SPOT13) { + play->fadeTransition = 14; gSaveContext.nextTransition = 14; } gSaveContext.respawnFlag = -2; - globalCtx->nextEntranceIndex = gSaveContext.entranceIndex; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = gSaveContext.entranceIndex; + play->sceneLoadFlag = 0x14; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; func_800F6964(30); gSaveContext.seqId = (u8)NA_BGM_DISABLED; diff --git a/soh/src/code/z_path.c b/soh/src/code/z_path.c index 8ff42c07a..3b4ec7d0e 100644 --- a/soh/src/code/z_path.c +++ b/soh/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/soh/src/code/z_play.c b/soh/src/code/z_play.c index 6729e9f55..a1d0a1722 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -25,40 +25,40 @@ s16 D_801614C8; u64 D_801614D0[0xA00]; #endif -GlobalContext* gGlobalCtx; +PlayState* gPlayState; -void func_800BC450(GlobalContext* globalCtx) { - Camera_ChangeDataIdx(GET_ACTIVE_CAM(globalCtx), globalCtx->unk_1242B - 1); +void func_800BC450(PlayState* play) { + Camera_ChangeDataIdx(GET_ACTIVE_CAM(play), play->unk_1242B - 1); } -void func_800BC490(GlobalContext* globalCtx, s16 point) { +void func_800BC490(PlayState* play, s16 point) { ASSERT(point == 1 || point == 2); - globalCtx->unk_1242B = point; + play->unk_1242B = point; if ((YREG(15) != 0x10) && (gSaveContext.cutsceneIndex < 0xFFF0)) { Audio_PlaySoundGeneral((point == 1) ? NA_SE_SY_CAMERA_ZOOM_DOWN : NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - func_800BC450(globalCtx); + func_800BC450(play); } -s32 func_800BC56C(GlobalContext* globalCtx, s16 arg1) { - return (arg1 == globalCtx->unk_1242B); +s32 func_800BC56C(PlayState* play, s16 arg1) { + return (arg1 == play->unk_1242B); } // original name: "Game_play_shop_pr_vr_switch_set" -void func_800BC590(GlobalContext* globalCtx) { +void func_800BC590(PlayState* play) { osSyncPrintf("Game_play_shop_pr_vr_switch_set()\n"); if (YREG(15) == 0x10) { - globalCtx->unk_1242B = 2; + play->unk_1242B = 2; } } -void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) { - TransitionContext* transitionCtx = &globalCtx->transitionCtx; +void func_800BC5E0(PlayState* play, s32 transitionType) { + TransitionContext* transitionCtx = &play->transitionCtx; memset(transitionCtx,0, sizeof(TransitionContext)); @@ -121,22 +121,22 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) { break; case 9: case 10: - globalCtx->transitionMode = 4; + play->transitionMode = 4; break; case 11: - globalCtx->transitionMode = 10; + play->transitionMode = 10; break; case 12: - globalCtx->transitionMode = 7; + play->transitionMode = 7; break; case 14: - globalCtx->transitionMode = 12; + play->transitionMode = 12; break; case 15: - globalCtx->transitionMode = 14; + play->transitionMode = 14; break; case 16: - globalCtx->transitionMode = 16; + play->transitionMode = 16; break; default: Fault_AddHungupAndCrash(__FILE__, __LINE__); @@ -145,94 +145,94 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) { } } -void func_800BC88C(GlobalContext* globalCtx) { - globalCtx->transitionCtx.transitionType = -1; +void func_800BC88C(PlayState* play) { + play->transitionCtx.transitionType = -1; } -Gfx* Gameplay_SetFog(GlobalContext* globalCtx, Gfx* gfx) { - return Gfx_SetFog2(gfx, globalCtx->lightCtx.fogColor[0], globalCtx->lightCtx.fogColor[1], - globalCtx->lightCtx.fogColor[2], 0, globalCtx->lightCtx.fogNear, 1000); +Gfx* Play_SetFog(PlayState* play, Gfx* gfx) { + return Gfx_SetFog2(gfx, play->lightCtx.fogColor[0], play->lightCtx.fogColor[1], + play->lightCtx.fogColor[2], 0, play->lightCtx.fogNear, 1000); } -void Gameplay_Destroy(GameState* thisx) { - GlobalContext* globalCtx = (GlobalContext*)thisx; - Player* player = GET_PLAYER(globalCtx); +void Play_Destroy(GameState* thisx) { + PlayState* play = (PlayState*)thisx; + Player* player = GET_PLAYER(play); - globalCtx->state.gfxCtx->callback = NULL; - globalCtx->state.gfxCtx->callbackParam = 0; + play->state.gfxCtx->callback = NULL; + play->state.gfxCtx->callbackParam = 0; SREG(91) = 0; R_PAUSE_MENU_MODE = 0; - PreRender_Destroy(&globalCtx->pauseBgPreRender); - Effect_DeleteAll(globalCtx); - EffectSs_ClearAll(globalCtx); - CollisionCheck_DestroyContext(globalCtx, &globalCtx->colChkCtx); + PreRender_Destroy(&play->pauseBgPreRender); + Effect_DeleteAll(play); + EffectSs_ClearAll(play); + CollisionCheck_DestroyContext(play, &play->colChkCtx); if (gTrnsnUnkState == 3) { TransitionUnk_Destroy(&sTrnsnUnk); gTrnsnUnkState = 0; } - if (globalCtx->transitionMode == 3) { - globalCtx->transitionCtx.destroy(&globalCtx->transitionCtx.data); - func_800BC88C(globalCtx); - globalCtx->transitionMode = 0; + if (play->transitionMode == 3) { + play->transitionCtx.destroy(&play->transitionCtx.data); + func_800BC88C(play); + play->transitionMode = 0; } ShrinkWindow_Destroy(); - TransitionFade_Destroy(&globalCtx->transitionFade); + TransitionFade_Destroy(&play->transitionFade); VisMono_Destroy(&D_80161498); - if (gSaveContext.linkAge != globalCtx->linkAgeOnLoad) { + if (gSaveContext.linkAge != play->linkAgeOnLoad) { Inventory_SwapAgeEquipment(); - Player_SetEquipmentData(globalCtx, player); + Player_SetEquipmentData(play, player); } - func_80031C3C(&globalCtx->actorCtx, globalCtx); - func_80110990(globalCtx); - KaleidoScopeCall_Destroy(globalCtx); + func_80031C3C(&play->actorCtx, play); + func_80110990(play); + KaleidoScopeCall_Destroy(play); KaleidoManager_Destroy(); ZeldaArena_Cleanup(); Fault_RemoveClient(&D_801614B8); disableBetaQuest(); - gGlobalCtx = NULL; + gPlayState = NULL; } -void GivePlayerRandoRewardSongOfTime(GlobalContext* globalCtx, RandomizerCheck check) { - Player* player = GET_PLAYER(globalCtx); +void GivePlayerRandoRewardSongOfTime(PlayState* play, RandomizerCheck check) { + Player* player = GET_PLAYER(play); - if (gSaveContext.entranceIndex == 0x050F && player != NULL && !Player_InBlockingCsMode(globalCtx, player) && - !Flags_GetTreasure(globalCtx, 0x1F) && gSaveContext.nextTransition == 0xFF && !gSaveContext.pendingIceTrapCount) { + if (gSaveContext.entranceIndex == 0x050F && player != NULL && !Player_InBlockingCsMode(play, player) && + !Flags_GetTreasure(play, 0x1F) && gSaveContext.nextTransition == 0xFF && !gSaveContext.pendingIceTrapCount) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_SONG_OF_TIME); - GiveItemEntryWithoutActor(globalCtx, getItemEntry); + GiveItemEntryWithoutActor(play, getItemEntry); player->pendingFlag.flagID = 0x1F; player->pendingFlag.flagType = FLAG_SCENE_TREASURE; } } -void GivePlayerRandoRewardNocturne(GlobalContext* globalCtx, RandomizerCheck check) { - Player* player = GET_PLAYER(globalCtx); +void GivePlayerRandoRewardNocturne(PlayState* play, RandomizerCheck check) { + Player* player = GET_PLAYER(play); if ((gSaveContext.entranceIndex == 0x00DB || gSaveContext.entranceIndex == 0x0191 || gSaveContext.entranceIndex == 0x0195) && LINK_IS_ADULT && CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST) && CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER) && player != NULL && - !Player_InBlockingCsMode(globalCtx, player) && !Flags_GetEventChkInf(0xAA)) { + !Player_InBlockingCsMode(play, player) && !Flags_GetEventChkInf(0xAA)) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_NOCTURNE_OF_SHADOW); - GiveItemEntryWithoutActor(globalCtx, getItemEntry); + GiveItemEntryWithoutActor(play, getItemEntry); player->pendingFlag.flagID = 0xAA; player->pendingFlag.flagType = FLAG_EVENT_CHECK_INF; } } -void GivePlayerRandoRewardRequiem(GlobalContext* globalCtx, RandomizerCheck check) { - Player* player = GET_PLAYER(globalCtx); +void GivePlayerRandoRewardRequiem(PlayState* play, RandomizerCheck check) { + Player* player = GET_PLAYER(play); if ((gSaveContext.gameMode == 0) && (gSaveContext.respawnFlag <= 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) { if ((gSaveContext.entranceIndex == 0x01E1) && !Flags_GetEventChkInf(0xAC) && player != NULL && - !Player_InBlockingCsMode(globalCtx, player)) { + !Player_InBlockingCsMode(play, player)) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_SONG_OF_TIME); - GiveItemEntryWithoutActor(globalCtx, getItemEntry); + GiveItemEntryWithoutActor(play, getItemEntry); player->pendingFlag.flagID = 0xAC; player->pendingFlag.flagType = FLAG_EVENT_CHECK_INF; } @@ -325,8 +325,8 @@ u8 CheckDungeonCount() { return dungeonCount; } -void GivePlayerRandoRewardZeldaLightArrowsGift(GlobalContext* globalCtx, RandomizerCheck check) { - Player* player = GET_PLAYER(globalCtx); +void GivePlayerRandoRewardZeldaLightArrowsGift(PlayState* play, RandomizerCheck check) { + Player* player = GET_PLAYER(play); u8 meetsRequirements = 0; @@ -365,35 +365,35 @@ void GivePlayerRandoRewardZeldaLightArrowsGift(GlobalContext* globalCtx, Randomi if (meetsRequirements && LINK_IS_ADULT && (gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_TOKINOMA) && - !Flags_GetTreasure(globalCtx, 0x1E) && player != NULL && !Player_InBlockingCsMode(globalCtx, player) && - globalCtx->sceneLoadFlag == 0) { + !Flags_GetTreasure(play, 0x1E) && player != NULL && !Player_InBlockingCsMode(play, player) && + play->sceneLoadFlag == 0) { GetItemEntry getItem = Randomizer_GetItemFromKnownCheck(check, GI_ARROW_LIGHT); - if (GiveItemEntryWithoutActor(globalCtx, getItem)) { + if (GiveItemEntryWithoutActor(play, getItem)) { player->pendingFlag.flagID = 0x1E; player->pendingFlag.flagType = FLAG_SCENE_TREASURE; } } } -void GivePlayerRandoRewardSariaGift(GlobalContext* globalCtx, RandomizerCheck check) { - Player* player = GET_PLAYER(globalCtx); +void GivePlayerRandoRewardSariaGift(PlayState* play, RandomizerCheck check) { + Player* player = GET_PLAYER(play); if (gSaveContext.entranceIndex == 0x05E0) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_ZELDAS_LULLABY); - if (!Flags_GetEventChkInf(0xC1) && player != NULL && !Player_InBlockingCsMode(globalCtx, player)) { - GiveItemEntryWithoutActor(globalCtx, getItemEntry); + if (!Flags_GetEventChkInf(0xC1) && player != NULL && !Player_InBlockingCsMode(play, player)) { + GiveItemEntryWithoutActor(play, getItemEntry); player->pendingFlag.flagType = FLAG_EVENT_CHECK_INF; player->pendingFlag.flagID = 0xC1; } } } -void Gameplay_Init(GameState* thisx) { - GlobalContext* globalCtx = (GlobalContext*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void Play_Init(GameState* thisx) { + PlayState* play = (PlayState*)thisx; + GraphicsContext* gfxCtx = play->state.gfxCtx; enableBetaQuest(); - gGlobalCtx = globalCtx; - //globalCtx->state.gfxCtx = NULL; + gPlayState = play; + //play->state.gfxCtx = NULL; uintptr_t zAlloc; uintptr_t zAllocAligned; size_t zAllocSize; @@ -417,8 +417,8 @@ void Gameplay_Init(GameState* thisx) { if (gSaveContext.entranceIndex == -1) { gSaveContext.entranceIndex = 0; - globalCtx->state.running = false; - SET_NEXT_GAMESTATE(&globalCtx->state, Opening_Init, OpeningContext); + play->state.running = false; + SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext); return; } @@ -426,37 +426,37 @@ void Gameplay_Init(GameState* thisx) { // OTRTODO allocate double the normal amount of memory // This is to avoid some parts of the game, like loading actors, causing OoM // This is potionally unavoidable due to struct size differences, but is x2 the right amount? - GameState_Realloc(&globalCtx->state, 0x1D4790 * 2); - KaleidoManager_Init(globalCtx); - View_Init(&globalCtx->view, gfxCtx); + GameState_Realloc(&play->state, 0x1D4790 * 2); + KaleidoManager_Init(play); + View_Init(&play->view, gfxCtx); Audio_SetExtraFilter(0); Quake_Init(); - for (i = 0; i < ARRAY_COUNT(globalCtx->cameraPtrs); i++) { - globalCtx->cameraPtrs[i] = NULL; + for (i = 0; i < ARRAY_COUNT(play->cameraPtrs); i++) { + play->cameraPtrs[i] = NULL; } - Camera_Init(&globalCtx->mainCamera, &globalCtx->view, &globalCtx->colCtx, globalCtx); - Camera_ChangeStatus(&globalCtx->mainCamera, CAM_STAT_ACTIVE); + Camera_Init(&play->mainCamera, &play->view, &play->colCtx, play); + Camera_ChangeStatus(&play->mainCamera, CAM_STAT_ACTIVE); for (i = 0; i < 3; i++) { - Camera_Init(&globalCtx->subCameras[i], &globalCtx->view, &globalCtx->colCtx, globalCtx); - Camera_ChangeStatus(&globalCtx->subCameras[i], CAM_STAT_UNK100); + Camera_Init(&play->subCameras[i], &play->view, &play->colCtx, play); + Camera_ChangeStatus(&play->subCameras[i], CAM_STAT_UNK100); } - globalCtx->cameraPtrs[MAIN_CAM] = &globalCtx->mainCamera; - globalCtx->cameraPtrs[MAIN_CAM]->uid = 0; - globalCtx->activeCamera = MAIN_CAM; - func_8005AC48(&globalCtx->mainCamera, 0xFF); - func_80112098(globalCtx); - Message_Init(globalCtx); - GameOver_Init(globalCtx); - SoundSource_InitAll(globalCtx); - Effect_InitContext(globalCtx); - EffectSs_InitInfo(globalCtx, 0x55); - CollisionCheck_InitContext(globalCtx, &globalCtx->colChkCtx); - AnimationContext_Reset(&globalCtx->animationCtx); - func_8006450C(globalCtx, &globalCtx->csCtx); + play->cameraPtrs[MAIN_CAM] = &play->mainCamera; + play->cameraPtrs[MAIN_CAM]->uid = 0; + play->activeCamera = MAIN_CAM; + func_8005AC48(&play->mainCamera, 0xFF); + func_80112098(play); + Message_Init(play); + GameOver_Init(play); + SoundSource_InitAll(play); + Effect_InitContext(play); + EffectSs_InitInfo(play, 0x55); + CollisionCheck_InitContext(play, &play->colChkCtx); + AnimationContext_Reset(&play->animationCtx); + func_8006450C(play, &play->csCtx); if (gSaveContext.nextCutsceneIndex != 0xFFEF) { gSaveContext.cutsceneIndex = gSaveContext.nextCutsceneIndex; @@ -478,11 +478,11 @@ void Gameplay_Init(GameState* thisx) { gSaveContext.nightFlag = 0; } - Cutscene_HandleConditionalTriggers(globalCtx); + Cutscene_HandleConditionalTriggers(play); if (gSaveContext.gameMode != 0 || gSaveContext.cutsceneIndex >= 0xFFF0) { gSaveContext.nayrusLoveTimer = 0; - func_800876C8(globalCtx); + func_800876C8(play); gSaveContext.sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4; } else if (!LINK_IS_ADULT && IS_DAY) { gSaveContext.sceneSetupIndex = 0; @@ -508,24 +508,24 @@ void Gameplay_Init(GameState* thisx) { gSaveContext.sceneSetupIndex = (gSaveContext.eventChkInf[4] & 0x100) ? 3 : 2; } - Gameplay_SpawnScene( - globalCtx, + Play_SpawnScene( + play, gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].scene, gEntranceTable[((void)0, gSaveContext.sceneSetupIndex) + ((void)0, gSaveContext.entranceIndex)].spawn); osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneSetupIndex); - Cutscene_HandleEntranceTriggers(globalCtx); - KaleidoScopeCall_Init(globalCtx); - func_801109B0(globalCtx); + Cutscene_HandleEntranceTriggers(play); + KaleidoScopeCall_Init(play); + func_801109B0(play); if (gSaveContext.nextDayTime != 0xFFFF) { if (gSaveContext.nextDayTime == 0x8001) { gSaveContext.totalDays++; gSaveContext.bgsDayCount++; gSaveContext.dogIsLost = true; - if (Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) || - Inventory_HatchPocketCucco(globalCtx)) { - Message_StartTextbox(globalCtx, 0x3066, NULL); + if (Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) || + Inventory_HatchPocketCucco(play)) { + Message_StartTextbox(play, 0x3066, NULL); } gSaveContext.nextDayTime = 0xFFFE; } else { @@ -535,52 +535,52 @@ void Gameplay_Init(GameState* thisx) { SREG(91) = -1; R_PAUSE_MENU_MODE = 0; - PreRender_Init(&globalCtx->pauseBgPreRender); - PreRender_SetValuesSave(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0); - PreRender_SetValues(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + PreRender_Init(&play->pauseBgPreRender); + PreRender_SetValuesSave(&play->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0); + PreRender_SetValues(&play->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); gTrnsnUnkState = 0; - globalCtx->transitionMode = 0; + play->transitionMode = 0; if (CVar_GetS32("gSceneTransitions", 255)!= 255){ - globalCtx->transitionMode = CVar_GetS32("gSceneTransitions", 0); + play->transitionMode = CVar_GetS32("gSceneTransitions", 0); gSaveContext.nextTransition = CVar_GetS32("gSceneTransitions", 0); - globalCtx->fadeTransition = CVar_GetS32("gSceneTransitions", 0); + play->fadeTransition = CVar_GetS32("gSceneTransitions", 0); } - FrameAdvance_Init(&globalCtx->frameAdvCtx); + FrameAdvance_Init(&play->frameAdvCtx); Rand_Seed((u32)osGetTime()); - Matrix_Init(&globalCtx->state); - globalCtx->state.main = Gameplay_Main; - globalCtx->state.destroy = Gameplay_Destroy; - globalCtx->sceneLoadFlag = -0x14; - globalCtx->unk_11E16 = 0xFF; - globalCtx->unk_11E18 = 0; - globalCtx->unk_11DE9 = 0; + Matrix_Init(&play->state); + play->state.main = Play_Main; + play->state.destroy = Play_Destroy; + play->sceneLoadFlag = -0x14; + play->unk_11E16 = 0xFF; + play->unk_11E18 = 0; + play->unk_11DE9 = 0; if (gSaveContext.gameMode != 1) { if (gSaveContext.nextTransition == 0xFF) { - globalCtx->fadeTransition = + play->fadeTransition = (gEntranceTable[((void)0, gSaveContext.entranceIndex) + tempSetupIndex].field >> 7) & 0x7F; // Fade In } else { - globalCtx->fadeTransition = gSaveContext.nextTransition; + play->fadeTransition = gSaveContext.nextTransition; gSaveContext.nextTransition = 0xFF; } } else { - globalCtx->fadeTransition = 6; + play->fadeTransition = 6; } ShrinkWindow_Init(); - TransitionFade_Init(&globalCtx->transitionFade); - TransitionFade_SetType(&globalCtx->transitionFade, 3); - TransitionFade_SetColor(&globalCtx->transitionFade, RGBA8(160, 160, 160, 255)); - TransitionFade_Start(&globalCtx->transitionFade); + TransitionFade_Init(&play->transitionFade); + TransitionFade_SetType(&play->transitionFade, 3); + TransitionFade_SetColor(&play->transitionFade, RGBA8(160, 160, 160, 255)); + TransitionFade_Start(&play->transitionFade); VisMono_Init(&D_80161498); D_801614B0.a = 0; - Flags_UnsetAllEnv(globalCtx); + Flags_UnsetAllEnv(play); - osSyncPrintf("ZELDA ALLOC SIZE=%x\n", THA_GetSize(&globalCtx->state.tha)); - zAllocSize = THA_GetSize(&globalCtx->state.tha); - zAlloc = GAMESTATE_ALLOC_MC(&globalCtx->state, zAllocSize); + osSyncPrintf("ZELDA ALLOC SIZE=%x\n", THA_GetSize(&play->state.tha)); + zAllocSize = THA_GetSize(&play->state.tha); + zAlloc = GAMESTATE_ALLOC_MC(&play->state, zAllocSize); zAllocAligned = (zAlloc + 8) & ~0xF; ZeldaArena_Init(zAllocAligned, zAllocSize - zAllocAligned + zAlloc); // "Zelda Heap" @@ -588,22 +588,22 @@ void Gameplay_Init(GameState* thisx) { (s32)(zAllocAligned + zAllocSize) - (s32)(zAllocAligned - zAlloc)); Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL); - func_800304DC(globalCtx, &globalCtx->actorCtx, globalCtx->linkActorEntry); + func_800304DC(play, &play->actorCtx, play->linkActorEntry); - while (!func_800973FC(globalCtx, &globalCtx->roomCtx)) { + while (!func_800973FC(play, &play->roomCtx)) { ; // Empty Loop } - player = GET_PLAYER(globalCtx); - Camera_InitPlayerSettings(&globalCtx->mainCamera, player); - Camera_ChangeMode(&globalCtx->mainCamera, CAM_MODE_NORMAL); + player = GET_PLAYER(play); + Camera_InitPlayerSettings(&play->mainCamera, player); + Camera_ChangeMode(&play->mainCamera, CAM_MODE_NORMAL); // OTRTODO: Bounds check cameraDataList to guard against scenes spawning the player with // an out of bounds background camera index. This requires adding an extra field to the // CollisionHeader struct to save the length of cameraDataList. // Fixes Dodongo's Cavern blue warp crash. { - CollisionHeader* colHeader = BgCheck_GetCollisionHeader(&globalCtx->colCtx, BGCHECK_SCENE); + CollisionHeader* colHeader = BgCheck_GetCollisionHeader(&play->colCtx, BGCHECK_SCENE); // If the player's start cam is out of bounds, set it to 0xFF so it isn't used. if (colHeader != NULL && ((player->actor.params & 0xFF) >= colHeader->cameraDataListLen)) { @@ -614,23 +614,23 @@ void Gameplay_Init(GameState* thisx) { playerStartCamId = player->actor.params & 0xFF; if (playerStartCamId != 0xFF) { osSyncPrintf("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartCamId); - Camera_ChangeDataIdx(&globalCtx->mainCamera, playerStartCamId); + Camera_ChangeDataIdx(&play->mainCamera, playerStartCamId); } if (YREG(15) == 32) { - globalCtx->unk_1242B = 2; + play->unk_1242B = 2; } else if (YREG(15) == 16) { - globalCtx->unk_1242B = 1; + play->unk_1242B = 1; } else { - globalCtx->unk_1242B = 0; + play->unk_1242B = 0; } - Interface_SetSceneRestrictions(globalCtx); - Environment_PlaySceneSequence(globalCtx); - gSaveContext.seqId = globalCtx->sequenceCtx.seqId; - gSaveContext.natureAmbienceId = globalCtx->sequenceCtx.natureAmbienceId; - func_8002DF18(globalCtx, GET_PLAYER(globalCtx)); - AnimationContext_Update(globalCtx, &globalCtx->animationCtx); + Interface_SetSceneRestrictions(play); + Environment_PlaySceneSequence(play); + gSaveContext.seqId = play->sequenceCtx.seqId; + gSaveContext.natureAmbienceId = play->sequenceCtx.natureAmbienceId; + func_8002DF18(play, GET_PLAYER(play)); + AnimationContext_Update(play, &play->animationCtx); gSaveContext.respawnFlag = 0; #if 0 if (dREG(95) != 0) { @@ -641,14 +641,14 @@ void Gameplay_Init(GameState* thisx) { #endif } -void Gameplay_Update(GlobalContext* globalCtx) { +void Play_Update(PlayState* play) { s32 pad1; s32 sp80; Input* input; u32 i; s32 pad2; - input = globalCtx->state.input; + input = play->state.input; if ((SREG(1) < 0) || (DREG(0) != 0)) { SREG(1) = 0; @@ -673,17 +673,17 @@ void Gameplay_Update(GlobalContext* globalCtx) { ActorOverlayTable_LogPrint(); } - if (CVar_GetS32("gFreeCamera", 0) && Player_InCsMode(globalCtx)) { - globalCtx->manualCamera = false; + if (CVar_GetS32("gFreeCamera", 0) && Player_InCsMode(play)) { + play->manualCamera = false; } - gSegments[4] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment); + gSegments[4] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.mainKeepIndex].segment); + gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); + gSegments[2] = VIRTUAL_TO_PHYSICAL(play->sceneSegment); - if (FrameAdvance_Update(&globalCtx->frameAdvCtx, &input[1])) { - if ((globalCtx->transitionMode == 0) && (globalCtx->sceneLoadFlag != 0)) { - globalCtx->transitionMode = 1; + if (FrameAdvance_Update(&play->frameAdvCtx, &input[1])) { + if ((play->transitionMode == 0) && (play->sceneLoadFlag != 0)) { + play->transitionMode = 1; } if (gTrnsnUnkState != 0) { @@ -704,10 +704,10 @@ void Gameplay_Update(GlobalContext* globalCtx) { } } - if (globalCtx->transitionMode) { - switch (globalCtx->transitionMode) { + if (play->transitionMode) { + switch (play->transitionMode) { case 1: - if (globalCtx->sceneLoadFlag != -0x14) { + if (play->sceneLoadFlag != -0x14) { s16 sp6E = 0; Interface_ChangeAlpha(1); @@ -715,10 +715,10 @@ void Gameplay_Update(GlobalContext* globalCtx) { sp6E = (gSaveContext.cutsceneIndex & 0xF) + 4; } - if (!(gEntranceTable[globalCtx->nextEntranceIndex + sp6E].field & 0x8000)) { // Continue BGM Off + if (!(gEntranceTable[play->nextEntranceIndex + sp6E].field & 0x8000)) { // Continue BGM Off // "Sound initalized. 111" osSyncPrintf("\n\n\nサウンドイニシャル来ました。111"); - if ((globalCtx->fadeTransition < 56) && !Environment_IsForcedSequenceDisabled()) { + if ((play->fadeTransition < 56) && !Environment_IsForcedSequenceDisabled()) { // "Sound initalized. 222" osSyncPrintf("\n\n\nサウンドイニシャル来ました。222"); func_800F6964(0x14); @@ -729,107 +729,107 @@ void Gameplay_Update(GlobalContext* globalCtx) { } if (CREG(11) == 0) { - func_800BC5E0(globalCtx, globalCtx->fadeTransition); + func_800BC5E0(play, play->fadeTransition); } else { - func_800BC5E0(globalCtx, CREG(12)); + func_800BC5E0(play, CREG(12)); } - if (globalCtx->transitionMode >= 4) { + if (play->transitionMode >= 4) { break; } case 2: - globalCtx->transitionCtx.init(&globalCtx->transitionCtx.data); + play->transitionCtx.init(&play->transitionCtx.data); - if ((globalCtx->transitionCtx.transitionType >> 5) == 1) { - globalCtx->transitionCtx.setType(&globalCtx->transitionCtx.data, - globalCtx->transitionCtx.transitionType | 0x80); + if ((play->transitionCtx.transitionType >> 5) == 1) { + play->transitionCtx.setType(&play->transitionCtx.data, + play->transitionCtx.transitionType | 0x80); } gSaveContext.unk_1419 = 14; - if ((globalCtx->transitionCtx.transitionType == 8) || - (globalCtx->transitionCtx.transitionType == 9)) { + if ((play->transitionCtx.transitionType == 8) || + (play->transitionCtx.transitionType == 9)) { gSaveContext.unk_1419 = 28; } gSaveContext.fadeDuration = 60; - if ((globalCtx->transitionCtx.transitionType == 4) || - (globalCtx->transitionCtx.transitionType == 5)) { + if ((play->transitionCtx.transitionType == 4) || + (play->transitionCtx.transitionType == 5)) { gSaveContext.fadeDuration = 20; - } else if ((globalCtx->transitionCtx.transitionType == 6) || - (globalCtx->transitionCtx.transitionType == 7)) { + } else if ((play->transitionCtx.transitionType == 6) || + (play->transitionCtx.transitionType == 7)) { gSaveContext.fadeDuration = 150; - } else if (globalCtx->transitionCtx.transitionType == 17) { + } else if (play->transitionCtx.transitionType == 17) { gSaveContext.fadeDuration = 2; } - if ((globalCtx->transitionCtx.transitionType == 3) || - (globalCtx->transitionCtx.transitionType == 5) || - (globalCtx->transitionCtx.transitionType == 7) || - (globalCtx->transitionCtx.transitionType == 13) || - (globalCtx->transitionCtx.transitionType == 17)) { - globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(160, 160, 160, 255)); - if (globalCtx->transitionCtx.setEnvColor != NULL) { - globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data, + if ((play->transitionCtx.transitionType == 3) || + (play->transitionCtx.transitionType == 5) || + (play->transitionCtx.transitionType == 7) || + (play->transitionCtx.transitionType == 13) || + (play->transitionCtx.transitionType == 17)) { + play->transitionCtx.setColor(&play->transitionCtx.data, RGBA8(160, 160, 160, 255)); + if (play->transitionCtx.setEnvColor != NULL) { + play->transitionCtx.setEnvColor(&play->transitionCtx.data, RGBA8(160, 160, 160, 255)); } - } else if (globalCtx->transitionCtx.transitionType == 18) { - globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(140, 140, 100, 255)); - if (globalCtx->transitionCtx.setEnvColor != NULL) { - globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data, + } else if (play->transitionCtx.transitionType == 18) { + play->transitionCtx.setColor(&play->transitionCtx.data, RGBA8(140, 140, 100, 255)); + if (play->transitionCtx.setEnvColor != NULL) { + play->transitionCtx.setEnvColor(&play->transitionCtx.data, RGBA8(140, 140, 100, 255)); } - } else if (globalCtx->transitionCtx.transitionType == 19) { - globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(70, 100, 110, 255)); - if (globalCtx->transitionCtx.setEnvColor != NULL) { - globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data, + } else if (play->transitionCtx.transitionType == 19) { + play->transitionCtx.setColor(&play->transitionCtx.data, RGBA8(70, 100, 110, 255)); + if (play->transitionCtx.setEnvColor != NULL) { + play->transitionCtx.setEnvColor(&play->transitionCtx.data, RGBA8(70, 100, 110, 255)); } } else { - globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(0, 0, 0, 0)); - if (globalCtx->transitionCtx.setEnvColor != NULL) { - globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data, RGBA8(0, 0, 0, 0)); + play->transitionCtx.setColor(&play->transitionCtx.data, RGBA8(0, 0, 0, 0)); + if (play->transitionCtx.setEnvColor != NULL) { + play->transitionCtx.setEnvColor(&play->transitionCtx.data, RGBA8(0, 0, 0, 0)); } } - if (globalCtx->sceneLoadFlag == -0x14) { - globalCtx->transitionCtx.setType(&globalCtx->transitionCtx.data, 1); + if (play->sceneLoadFlag == -0x14) { + play->transitionCtx.setType(&play->transitionCtx.data, 1); } else { - globalCtx->transitionCtx.setType(&globalCtx->transitionCtx.data, 2); + play->transitionCtx.setType(&play->transitionCtx.data, 2); } - globalCtx->transitionCtx.start(&globalCtx->transitionCtx); + play->transitionCtx.start(&play->transitionCtx); - if (globalCtx->transitionCtx.transitionType == 13) { - globalCtx->transitionMode = 11; + if (play->transitionCtx.transitionType == 13) { + play->transitionMode = 11; } else { - globalCtx->transitionMode = 3; + play->transitionMode = 3; } break; case 3: - if (globalCtx->transitionCtx.isDone(&globalCtx->transitionCtx) != 0) { - if (globalCtx->transitionCtx.transitionType >= 56) { - if (globalCtx->sceneLoadFlag == -0x14) { - globalCtx->transitionCtx.destroy(&globalCtx->transitionCtx); - func_800BC88C(globalCtx); - globalCtx->transitionMode = 0; + if (play->transitionCtx.isDone(&play->transitionCtx) != 0) { + if (play->transitionCtx.transitionType >= 56) { + if (play->sceneLoadFlag == -0x14) { + play->transitionCtx.destroy(&play->transitionCtx); + func_800BC88C(play); + play->transitionMode = 0; } - } else if (globalCtx->sceneLoadFlag != -0x14) { - globalCtx->state.running = 0; + } else if (play->sceneLoadFlag != -0x14) { + play->state.running = 0; if (gSaveContext.gameMode != 2) { - SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext); - gSaveContext.entranceIndex = globalCtx->nextEntranceIndex; + SET_NEXT_GAMESTATE(&play->state, Play_Init, PlayState); + gSaveContext.entranceIndex = play->nextEntranceIndex; if (gSaveContext.minigameState == 1) { gSaveContext.minigameState = 3; } } else { - SET_NEXT_GAMESTATE(&globalCtx->state, FileChoose_Init, FileChooseContext); + SET_NEXT_GAMESTATE(&play->state, FileChoose_Init, FileChooseContext); } } else { - globalCtx->transitionCtx.destroy(&globalCtx->transitionCtx); - func_800BC88C(globalCtx); - globalCtx->transitionMode = 0; + play->transitionCtx.destroy(&play->transitionCtx); + func_800BC88C(play); + play->transitionMode = 0; if (gTrnsnUnkState == 3) { TransitionUnk_Destroy(&sTrnsnUnk); gTrnsnUnkState = 0; @@ -837,54 +837,54 @@ void Gameplay_Update(GlobalContext* globalCtx) { } // Don't autosave in grottos or cutscenes - if (CVar_GetS32("gAutosave", 0) && (globalCtx->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (globalCtx->sceneNum != SCENE_KAKUSIANA) && (gSaveContext.cutsceneIndex == 0)) { - Gameplay_PerformSave(globalCtx); + if (CVar_GetS32("gAutosave", 0) && (play->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (play->sceneNum != SCENE_KAKUSIANA) && (gSaveContext.cutsceneIndex == 0)) { + Play_PerformSave(play); } } - globalCtx->sceneLoadFlag = 0; + play->sceneLoadFlag = 0; } else { - globalCtx->transitionCtx.update(&globalCtx->transitionCtx.data, R_UPDATE_RATE); + play->transitionCtx.update(&play->transitionCtx.data, R_UPDATE_RATE); } break; } - switch (globalCtx->transitionMode) { + switch (play->transitionMode) { case 4: D_801614C8 = 0; - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = 160; - globalCtx->envCtx.screenFillColor[1] = 160; - globalCtx->envCtx.screenFillColor[2] = 160; - if (globalCtx->sceneLoadFlag != -0x14) { - globalCtx->envCtx.screenFillColor[3] = 0; - globalCtx->transitionMode = 5; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = 160; + play->envCtx.screenFillColor[1] = 160; + play->envCtx.screenFillColor[2] = 160; + if (play->sceneLoadFlag != -0x14) { + play->envCtx.screenFillColor[3] = 0; + play->transitionMode = 5; } else { - globalCtx->envCtx.screenFillColor[3] = 255; - globalCtx->transitionMode = 6; + play->envCtx.screenFillColor[3] = 255; + play->transitionMode = 6; } break; case 5: - globalCtx->envCtx.screenFillColor[3] = (D_801614C8 / 20.0f) * 255.0f; + play->envCtx.screenFillColor[3] = (D_801614C8 / 20.0f) * 255.0f; if (D_801614C8 >= 20 && 1) { - globalCtx->state.running = 0; - SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext); - gSaveContext.entranceIndex = globalCtx->nextEntranceIndex; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; + play->state.running = 0; + SET_NEXT_GAMESTATE(&play->state, Play_Init, PlayState); + gSaveContext.entranceIndex = play->nextEntranceIndex; + play->sceneLoadFlag = 0; + play->transitionMode = 0; } else { D_801614C8++; } break; case 6: - globalCtx->envCtx.screenFillColor[3] = (1 - D_801614C8 / 20.0f) * 255.0f; + play->envCtx.screenFillColor[3] = (1 - D_801614C8 / 20.0f) * 255.0f; if (D_801614C8 >= 20 && 1) { gTrnsnUnkState = 0; R_UPDATE_RATE = 3; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; - globalCtx->envCtx.fillScreen = false; + play->sceneLoadFlag = 0; + play->transitionMode = 0; + play->envCtx.fillScreen = false; } else { D_801614C8++; } @@ -892,117 +892,117 @@ void Gameplay_Update(GlobalContext* globalCtx) { case 7: D_801614C8 = 0; - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = 170; - globalCtx->envCtx.screenFillColor[1] = 160; - globalCtx->envCtx.screenFillColor[2] = 150; - if (globalCtx->sceneLoadFlag != -0x14) { - globalCtx->envCtx.screenFillColor[3] = 0; - globalCtx->transitionMode = 5; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = 170; + play->envCtx.screenFillColor[1] = 160; + play->envCtx.screenFillColor[2] = 150; + if (play->sceneLoadFlag != -0x14) { + play->envCtx.screenFillColor[3] = 0; + play->transitionMode = 5; } else { - globalCtx->envCtx.screenFillColor[3] = 255; - globalCtx->transitionMode = 6; + play->envCtx.screenFillColor[3] = 255; + play->transitionMode = 6; } break; case 10: - if (globalCtx->sceneLoadFlag != -0x14) { - globalCtx->state.running = 0; - SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext); - gSaveContext.entranceIndex = globalCtx->nextEntranceIndex; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; + if (play->sceneLoadFlag != -0x14) { + play->state.running = 0; + SET_NEXT_GAMESTATE(&play->state, Play_Init, PlayState); + gSaveContext.entranceIndex = play->nextEntranceIndex; + play->sceneLoadFlag = 0; + play->transitionMode = 0; } else { gTrnsnUnkState = 0; R_UPDATE_RATE = 3; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; + play->sceneLoadFlag = 0; + play->transitionMode = 0; } break; case 11: if (gSaveContext.unk_1410 != 0) { - globalCtx->transitionMode = 3; + play->transitionMode = 3; } break; case 12: - if (globalCtx->sceneLoadFlag != -0x14) { - globalCtx->envCtx.sandstormState = 1; - globalCtx->transitionMode = 13; + if (play->sceneLoadFlag != -0x14) { + play->envCtx.sandstormState = 1; + play->transitionMode = 13; } else { - globalCtx->envCtx.sandstormState = 2; - globalCtx->envCtx.sandstormPrimA = 255; - globalCtx->envCtx.sandstormEnvA = 255; - globalCtx->transitionMode = 13; + play->envCtx.sandstormState = 2; + play->envCtx.sandstormPrimA = 255; + play->envCtx.sandstormEnvA = 255; + play->transitionMode = 13; } break; case 13: Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - if (globalCtx->sceneLoadFlag == -0x14) { - if (globalCtx->envCtx.sandstormPrimA < 110) { + if (play->sceneLoadFlag == -0x14) { + if (play->envCtx.sandstormPrimA < 110) { gTrnsnUnkState = 0; R_UPDATE_RATE = 3; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; + play->sceneLoadFlag = 0; + play->transitionMode = 0; } } else { - if (globalCtx->envCtx.sandstormEnvA == 255) { - globalCtx->state.running = 0; - SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext); - gSaveContext.entranceIndex = globalCtx->nextEntranceIndex; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; + if (play->envCtx.sandstormEnvA == 255) { + play->state.running = 0; + SET_NEXT_GAMESTATE(&play->state, Play_Init, PlayState); + gSaveContext.entranceIndex = play->nextEntranceIndex; + play->sceneLoadFlag = 0; + play->transitionMode = 0; } } break; case 14: - if (globalCtx->sceneLoadFlag == -0x14) { - globalCtx->envCtx.sandstormState = 4; - globalCtx->envCtx.sandstormPrimA = 255; - globalCtx->envCtx.sandstormEnvA = 255; + if (play->sceneLoadFlag == -0x14) { + play->envCtx.sandstormState = 4; + play->envCtx.sandstormPrimA = 255; + play->envCtx.sandstormEnvA = 255; // "It's here!!!!!!!!!" LOG_STRING("来た!!!!!!!!!!!!!!!!!!!!!"); - globalCtx->transitionMode = 15; + play->transitionMode = 15; } else { - globalCtx->transitionMode = 12; + play->transitionMode = 12; } break; case 15: Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - if (globalCtx->sceneLoadFlag == -0x14) { - if (globalCtx->envCtx.sandstormPrimA <= 0) { + if (play->sceneLoadFlag == -0x14) { + if (play->envCtx.sandstormPrimA <= 0) { gTrnsnUnkState = 0; R_UPDATE_RATE = 3; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; + play->sceneLoadFlag = 0; + play->transitionMode = 0; } } break; case 16: D_801614C8 = 0; - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[3] = 255; - globalCtx->transitionMode = 17; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[3] = 255; + play->transitionMode = 17; break; case 17: if (gSaveContext.unk_1410 != 0) { - globalCtx->envCtx.screenFillColor[3] = gSaveContext.unk_1410; + play->envCtx.screenFillColor[3] = gSaveContext.unk_1410; if (gSaveContext.unk_1410 < 0x65) { gTrnsnUnkState = 0; R_UPDATE_RATE = 3; - globalCtx->sceneLoadFlag = 0; - globalCtx->transitionMode = 0; + play->sceneLoadFlag = 0; + play->transitionMode = 0; } } break; @@ -1018,28 +1018,28 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1); } - if ((gSaveContext.gameMode == 0) && (globalCtx->msgCtx.msgMode == MSGMODE_NONE) && - (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE)) { - KaleidoSetup_Update(globalCtx); + if ((gSaveContext.gameMode == 0) && (play->msgCtx.msgMode == MSGMODE_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { + KaleidoSetup_Update(play); } if (1 && HREG(63)) { LOG_NUM("1", 1); } - sp80 = (globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0); + sp80 = (play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0); if (1 && HREG(63)) { LOG_NUM("1", 1); } - AnimationContext_Reset(&globalCtx->animationCtx); + AnimationContext_Reset(&play->animationCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - Object_UpdateBank(&globalCtx->objectCtx); + Object_UpdateBank(&play->objectCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); @@ -1050,83 +1050,83 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1); } - globalCtx->gameplayFrames++; + play->gameplayFrames++; func_800AA178(1); - if (globalCtx->actorCtx.freezeFlashTimer && (globalCtx->actorCtx.freezeFlashTimer-- < 5)) { - osSyncPrintf("FINISH=%d\n", globalCtx->actorCtx.freezeFlashTimer); - if ((globalCtx->actorCtx.freezeFlashTimer > 0) && - ((globalCtx->actorCtx.freezeFlashTimer % 2) != 0)) { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 150; - globalCtx->envCtx.screenFillColor[3] = 80; + if (play->actorCtx.freezeFlashTimer && (play->actorCtx.freezeFlashTimer-- < 5)) { + osSyncPrintf("FINISH=%d\n", play->actorCtx.freezeFlashTimer); + if ((play->actorCtx.freezeFlashTimer > 0) && + ((play->actorCtx.freezeFlashTimer % 2) != 0)) { + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = + play->envCtx.screenFillColor[2] = 150; + play->envCtx.screenFillColor[3] = 80; } else { - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; } } else { if (1 && HREG(63)) { LOG_NUM("1", 1); } - func_800973FC(globalCtx, &globalCtx->roomCtx); + func_800973FC(play, &play->roomCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - CollisionCheck_AT(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_AT(play, &play->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - CollisionCheck_OC(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_OC(play, &play->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - CollisionCheck_Damage(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_Damage(play, &play->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - CollisionCheck_ClearContext(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_ClearContext(play, &play->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - if (globalCtx->unk_11DE9 == 0) { - Actor_UpdateAll(globalCtx, &globalCtx->actorCtx); + if (play->unk_11DE9 == 0) { + Actor_UpdateAll(play, &play->actorCtx); } if (1 && HREG(63)) { LOG_NUM("1", 1); } - func_80064558(globalCtx, &globalCtx->csCtx); + func_80064558(play, &play->csCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - func_800645A0(globalCtx, &globalCtx->csCtx); + func_800645A0(play, &play->csCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - Effect_UpdateAll(globalCtx); + Effect_UpdateAll(play); if (1 && HREG(63)) { LOG_NUM("1", 1); } - EffectSs_UpdateAll(globalCtx); + EffectSs_UpdateAll(play); if (1 && HREG(63)) { LOG_NUM("1", 1); @@ -1140,63 +1140,63 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1); } - func_80095AA0(globalCtx, &globalCtx->roomCtx.curRoom, &input[1], 0); + func_80095AA0(play, &play->roomCtx.curRoom, &input[1], 0); if (1 && HREG(63)) { LOG_NUM("1", 1); } - func_80095AA0(globalCtx, &globalCtx->roomCtx.prevRoom, &input[1], 1); + func_80095AA0(play, &play->roomCtx.prevRoom, &input[1], 1); if (1 && HREG(63)) { LOG_NUM("1", 1); } - if (globalCtx->unk_1242B != 0) { + if (play->unk_1242B != 0) { if (CHECK_BTN_ALL(input[0].press.button, BTN_CUP)) { - if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { // "Changing viewpoint is prohibited due to the kaleidoscope" osSyncPrintf(VT_FGCOL(CYAN) "カレイドスコープ中につき視点変更を禁止しております\n" VT_RST); - } else if (Player_InCsMode(globalCtx)) { + } else if (Player_InCsMode(play)) { // "Changing viewpoint is prohibited during the cutscene" osSyncPrintf(VT_FGCOL(CYAN) "デモ中につき視点変更を禁止しております\n" VT_RST); } else if (YREG(15) == 0x10) { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { - func_800BC490(globalCtx, globalCtx->unk_1242B ^ 3); + func_800BC490(play, play->unk_1242B ^ 3); } } - func_800BC450(globalCtx); + func_800BC450(play); } if (1 && HREG(63)) { LOG_NUM("1", 1); } - SkyboxDraw_Update(&globalCtx->skyboxCtx); + SkyboxDraw_Update(&play->skyboxCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { if (1 && HREG(63)) { LOG_NUM("1", 1); } - KaleidoScopeCall_Update(globalCtx); - } else if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) { + KaleidoScopeCall_Update(play); + } else if (play->gameOverCtx.state != GAMEOVER_INACTIVE) { if (1 && HREG(63)) { LOG_NUM("1", 1); } - GameOver_Update(globalCtx); + GameOver_Update(play); } else { if (1 && HREG(63)) { LOG_NUM("1", 1); } - Message_Update(globalCtx); + Message_Update(play); } if (1 && HREG(63)) { @@ -1207,19 +1207,19 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1); } - Interface_Update(globalCtx); + Interface_Update(play); if (1 && HREG(63)) { LOG_NUM("1", 1); } - AnimationContext_Update(globalCtx, &globalCtx->animationCtx); + AnimationContext_Update(play, &play->animationCtx); if (1 && HREG(63)) { LOG_NUM("1", 1); } - SoundSource_UpdateAll(globalCtx); + SoundSource_UpdateAll(play); if (1 && HREG(63)) { LOG_NUM("1", 1); @@ -1231,7 +1231,7 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1); } - TransitionFade_Update(&globalCtx->transitionFade, R_UPDATE_RATE); + TransitionFade_Update(&play->transitionFade, R_UPDATE_RATE); } else { goto skip; } @@ -1250,23 +1250,23 @@ skip: s32 pad3[5]; s32 i; - globalCtx->nextCamera = globalCtx->activeCamera; + play->nextCamera = play->activeCamera; if (1 && HREG(63)) { LOG_NUM("1", 1); } for (i = 0; i < NUM_CAMS; i++) { - if ((i != globalCtx->nextCamera) && (globalCtx->cameraPtrs[i] != NULL)) { + if ((i != play->nextCamera) && (play->cameraPtrs[i] != NULL)) { if (1 && HREG(63)) { LOG_NUM("1", 1); } - Camera_Update(globalCtx->cameraPtrs[i]); + Camera_Update(play->cameraPtrs[i]); } } - Camera_Update(globalCtx->cameraPtrs[globalCtx->nextCamera]); + Camera_Update(play->cameraPtrs[play->nextCamera]); if (1 && HREG(63)) { LOG_NUM("1", 1); @@ -1277,87 +1277,87 @@ skip: LOG_NUM("1", 1); } - Environment_Update(globalCtx, &globalCtx->envCtx, &globalCtx->lightCtx, &globalCtx->pauseCtx, &globalCtx->msgCtx, - &globalCtx->gameOverCtx, globalCtx->state.gfxCtx); + Environment_Update(play, &play->envCtx, &play->lightCtx, &play->pauseCtx, &play->msgCtx, + &play->gameOverCtx, play->state.gfxCtx); if (gSaveContext.n64ddFlag) { - GivePlayerRandoRewardSariaGift(globalCtx, RC_LW_GIFT_FROM_SARIA); - GivePlayerRandoRewardSongOfTime(globalCtx, RC_SONG_FROM_OCARINA_OF_TIME); - GivePlayerRandoRewardZeldaLightArrowsGift(globalCtx, RC_TOT_LIGHT_ARROWS_CUTSCENE); - GivePlayerRandoRewardNocturne(globalCtx, RC_SHEIK_IN_KAKARIKO); - GivePlayerRandoRewardRequiem(globalCtx, RC_SHEIK_AT_COLOSSUS); + GivePlayerRandoRewardSariaGift(play, RC_LW_GIFT_FROM_SARIA); + GivePlayerRandoRewardSongOfTime(play, RC_SONG_FROM_OCARINA_OF_TIME); + GivePlayerRandoRewardZeldaLightArrowsGift(play, RC_TOT_LIGHT_ARROWS_CUTSCENE); + GivePlayerRandoRewardNocturne(play, RC_SHEIK_IN_KAKARIKO); + GivePlayerRandoRewardRequiem(play, RC_SHEIK_AT_COLOSSUS); } } -void Gameplay_DrawOverlayElements(GlobalContext* globalCtx) { - if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) { - KaleidoScopeCall_Draw(globalCtx); +void Play_DrawOverlayElements(PlayState* play) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { + KaleidoScopeCall_Draw(play); } if (gSaveContext.gameMode == 0) { - Interface_Draw(globalCtx); + Interface_Draw(play); } - Message_Draw(globalCtx); + Message_Draw(play); - if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) { - GameOver_FadeInLights(globalCtx); + if (play->gameOverCtx.state != GAMEOVER_INACTIVE) { + GameOver_FadeInLights(play); } } -void Gameplay_Draw(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void Play_Draw(PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; Lights* sp228; Vec3f sp21C; OPEN_DISPS(gfxCtx); - gSegments[4] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment); + gSegments[4] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.mainKeepIndex].segment); + gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); + gSegments[2] = VIRTUAL_TO_PHYSICAL(play->sceneSegment); gSPSegment(POLY_OPA_DISP++, 0x00, NULL); gSPSegment(POLY_XLU_DISP++, 0x00, NULL); gSPSegment(OVERLAY_DISP++, 0x00, NULL); - gSPSegment(POLY_OPA_DISP++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); - gSPSegment(OVERLAY_DISP++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x04, play->objectCtx.status[play->objectCtx.mainKeepIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x04, play->objectCtx.status[play->objectCtx.mainKeepIndex].segment); + gSPSegment(OVERLAY_DISP++, 0x04, play->objectCtx.status[play->objectCtx.mainKeepIndex].segment); - gSPSegment(POLY_OPA_DISP++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); - gSPSegment(OVERLAY_DISP++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x05, play->objectCtx.status[play->objectCtx.subKeepIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x05, play->objectCtx.status[play->objectCtx.subKeepIndex].segment); + gSPSegment(OVERLAY_DISP++, 0x05, play->objectCtx.status[play->objectCtx.subKeepIndex].segment); - gSPSegment(POLY_OPA_DISP++, 0x02, globalCtx->sceneSegment); - gSPSegment(POLY_XLU_DISP++, 0x02, globalCtx->sceneSegment); - gSPSegment(OVERLAY_DISP++, 0x02, globalCtx->sceneSegment); + gSPSegment(POLY_OPA_DISP++, 0x02, play->sceneSegment); + gSPSegment(POLY_XLU_DISP++, 0x02, play->sceneSegment); + gSPSegment(OVERLAY_DISP++, 0x02, play->sceneSegment); func_80095248(gfxCtx, 0, 0, 0); if ((HREG(80) != 10) || (HREG(82) != 0)) { - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); - POLY_XLU_DISP = Gameplay_SetFog(globalCtx, POLY_XLU_DISP); - POLY_KAL_DISP = Gameplay_SetFog(globalCtx, POLY_KAL_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + POLY_XLU_DISP = Play_SetFog(play, POLY_XLU_DISP); + POLY_KAL_DISP = Play_SetFog(play, POLY_KAL_DISP); - func_800AA460(&globalCtx->view, globalCtx->view.fovy, globalCtx->view.zNear, globalCtx->lightCtx.fogFar); - func_800AAA50(&globalCtx->view, 15); + func_800AA460(&play->view, play->view.fovy, play->view.zNear, play->lightCtx.fogFar); + func_800AAA50(&play->view, 15); // The billboard matrix temporarily stores the viewing matrix - Matrix_MtxToMtxF(&globalCtx->view.viewing, &globalCtx->billboardMtxF); - Matrix_MtxToMtxF(&globalCtx->view.projection, &globalCtx->viewProjectionMtxF); - Matrix_Mult(&globalCtx->viewProjectionMtxF, MTXMODE_NEW); + Matrix_MtxToMtxF(&play->view.viewing, &play->billboardMtxF); + Matrix_MtxToMtxF(&play->view.projection, &play->viewProjectionMtxF); + Matrix_Mult(&play->viewProjectionMtxF, MTXMODE_NEW); // The billboard is still a viewing matrix at this stage - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - Matrix_Get(&globalCtx->viewProjectionMtxF); - globalCtx->billboardMtxF.mf[0][3] = globalCtx->billboardMtxF.mf[1][3] = globalCtx->billboardMtxF.mf[2][3] = - globalCtx->billboardMtxF.mf[3][0] = globalCtx->billboardMtxF.mf[3][1] = globalCtx->billboardMtxF.mf[3][2] = + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_Get(&play->viewProjectionMtxF); + play->billboardMtxF.mf[0][3] = play->billboardMtxF.mf[1][3] = play->billboardMtxF.mf[2][3] = + play->billboardMtxF.mf[3][0] = play->billboardMtxF.mf[3][1] = play->billboardMtxF.mf[3][2] = 0.0f; // This transpose is where the viewing matrix is properly converted into a billboard matrix - Matrix_Transpose(&globalCtx->billboardMtxF); - globalCtx->billboardMtx = Matrix_MtxFToMtx(MATRIX_CHECKFLOATS(&globalCtx->billboardMtxF), + Matrix_Transpose(&play->billboardMtxF); + play->billboardMtx = Matrix_MtxFToMtx(MATRIX_CHECKFLOATS(&play->billboardMtxF), Graph_Alloc(gfxCtx, sizeof(Mtx))); - gSPSegment(POLY_OPA_DISP++, 0x01, globalCtx->billboardMtx); + gSPSegment(POLY_OPA_DISP++, 0x01, play->billboardMtx); if ((HREG(80) != 10) || (HREG(92) != 0)) { Gfx* gfxP; @@ -1367,8 +1367,8 @@ void Gameplay_Draw(GlobalContext* globalCtx) { gSPDisplayList(OVERLAY_DISP++, gfxP); gsSPGrayscale(gfxP++, false); - if ((globalCtx->transitionMode == 3) || (globalCtx->transitionMode == 11) || - (globalCtx->transitionCtx.transitionType >= 56)) { + if ((play->transitionMode == 3) || (play->transitionMode == 11) || + (play->transitionCtx.transitionType >= 56)) { View view; View_Init(&view, gfxCtx); @@ -1377,10 +1377,10 @@ void Gameplay_Draw(GlobalContext* globalCtx) { SET_FULLSCREEN_VIEWPORT(&view); func_800AB9EC(&view, 15, &gfxP); - globalCtx->transitionCtx.draw(&globalCtx->transitionCtx.data, &gfxP); + play->transitionCtx.draw(&play->transitionCtx.data, &gfxP); } - TransitionFade_Draw(&globalCtx->transitionFade, &gfxP); + TransitionFade_Draw(&play->transitionFade, &gfxP); if (D_801614B0.a > 0) { gsDPSetGrayscaleColor(gfxP++, D_801614B0.r, D_801614B0.g, D_801614B0.b, D_801614B0.a); @@ -1397,14 +1397,14 @@ void Gameplay_Draw(GlobalContext* globalCtx) { TransitionUnk_Draw(&sTrnsnUnk, &sp88); POLY_OPA_DISP = sp88; - goto Gameplay_Draw_DrawOverlayElements; + goto Play_Draw_DrawOverlayElements; } else { - PreRender_SetValues(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, gfxCtx->curFrameBuffer, + PreRender_SetValues(&play->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, gfxCtx->curFrameBuffer, gZBuffer); if (R_PAUSE_MENU_MODE == 2) { MsgEvent_SendNullTask(); - PreRender_Calc(&globalCtx->pauseBgPreRender); + PreRender_Calc(&play->pauseBgPreRender); R_PAUSE_MENU_MODE = 3; } else if (R_PAUSE_MENU_MODE >= 4) { R_PAUSE_MENU_MODE = 0; @@ -1413,50 +1413,50 @@ void Gameplay_Draw(GlobalContext* globalCtx) { if (R_PAUSE_MENU_MODE == 3) { Gfx* sp84 = POLY_OPA_DISP; - //func_800C24BC(&globalCtx->pauseBgPreRender, &sp84); + //func_800C24BC(&play->pauseBgPreRender, &sp84); POLY_OPA_DISP = sp84; - //goto Gameplay_Draw_DrawOverlayElements; + //goto Play_Draw_DrawOverlayElements; } //else { s32 sp80; if ((HREG(80) != 10) || (HREG(83) != 0)) { - if (globalCtx->skyboxId && (globalCtx->skyboxId != SKYBOX_UNSET_1D) && - !globalCtx->envCtx.skyboxDisabled) { - if ((globalCtx->skyboxId == SKYBOX_NORMAL_SKY) || - (globalCtx->skyboxId == SKYBOX_CUTSCENE_MAP)) { - Environment_UpdateSkybox(globalCtx, globalCtx->skyboxId, &globalCtx->envCtx, &globalCtx->skyboxCtx); + if (play->skyboxId && (play->skyboxId != SKYBOX_UNSET_1D) && + !play->envCtx.skyboxDisabled) { + if ((play->skyboxId == SKYBOX_NORMAL_SKY) || + (play->skyboxId == SKYBOX_CUTSCENE_MAP)) { + Environment_UpdateSkybox(play, play->skyboxId, &play->envCtx, &play->skyboxCtx); - SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, - globalCtx->envCtx.skyboxBlend, globalCtx->view.eye.x, globalCtx->view.eye.y, - globalCtx->view.eye.z); - } else if (globalCtx->skyboxCtx.unk_140 == 0) { - SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, 0, - globalCtx->view.eye.x, globalCtx->view.eye.y, globalCtx->view.eye.z); + SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, + play->envCtx.skyboxBlend, play->view.eye.x, play->view.eye.y, + play->view.eye.z); + } else if (play->skyboxCtx.unk_140 == 0) { + SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0, + play->view.eye.x, play->view.eye.y, play->view.eye.z); } } } if ((HREG(80) != 10) || (HREG(90) & 2)) { - if (!globalCtx->envCtx.sunMoonDisabled) { - Environment_DrawSunAndMoon(globalCtx); + if (!play->envCtx.sunMoonDisabled) { + Environment_DrawSunAndMoon(play); } } if ((HREG(80) != 10) || (HREG(90) & 1)) { - Environment_DrawSkyboxFilters(globalCtx); + Environment_DrawSkyboxFilters(play); } if ((HREG(80) != 10) || (HREG(90) & 4)) { - Environment_UpdateLightningStrike(globalCtx); - Environment_DrawLightning(globalCtx, 0); + Environment_UpdateLightningStrike(play); + Environment_DrawLightning(play, 0); } if ((HREG(80) != 10) || (HREG(90) & 8)) { - sp228 = LightContext_NewLights(&globalCtx->lightCtx, gfxCtx); - Lights_BindAll(sp228, globalCtx->lightCtx.listHead, NULL); + sp228 = LightContext_NewLights(&play->lightCtx, gfxCtx); + Lights_BindAll(sp228, play->lightCtx.listHead, NULL); Lights_Draw(sp228, gfxCtx); } @@ -1467,48 +1467,48 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } else { sp80 = HREG(84); } - Scene_Draw(globalCtx); - Room_Draw(globalCtx, &globalCtx->roomCtx.curRoom, sp80 & 3); - Room_Draw(globalCtx, &globalCtx->roomCtx.prevRoom, sp80 & 3); + Scene_Draw(play); + Room_Draw(play, &play->roomCtx.curRoom, sp80 & 3); + Room_Draw(play, &play->roomCtx.prevRoom, sp80 & 3); } } if ((HREG(80) != 10) || (HREG(83) != 0)) { - if ((globalCtx->skyboxCtx.unk_140 != 0) && - (GET_ACTIVE_CAM(globalCtx)->setting != CAM_SET_PREREND_FIXED)) { + if ((play->skyboxCtx.unk_140 != 0) && + (GET_ACTIVE_CAM(play)->setting != CAM_SET_PREREND_FIXED)) { Vec3f sp74; - Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(globalCtx)); - SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, 0, - globalCtx->view.eye.x + sp74.x, globalCtx->view.eye.y + sp74.y, - globalCtx->view.eye.z + sp74.z); + Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(play)); + SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0, + play->view.eye.x + sp74.x, play->view.eye.y + sp74.y, + play->view.eye.z + sp74.z); } } - if (globalCtx->envCtx.unk_EE[1] != 0) { - Environment_DrawRain(globalCtx, &globalCtx->view, gfxCtx); + if (play->envCtx.unk_EE[1] != 0) { + Environment_DrawRain(play, &play->view, gfxCtx); } if ((HREG(80) != 10) || (HREG(84) != 0)) { - Environment_FillScreen(gfxCtx, 0, 0, 0, globalCtx->unk_11E18, FILL_SCREEN_OPA); + Environment_FillScreen(gfxCtx, 0, 0, 0, play->unk_11E18, FILL_SCREEN_OPA); } - if ((globalCtx->pauseCtx.state != 0) && (HREG(80) != 10) || (HREG(89) != 0)) { - Gameplay_DrawOverlayElements(globalCtx); + if ((play->pauseCtx.state != 0) && (HREG(80) != 10) || (HREG(89) != 0)) { + Play_DrawOverlayElements(play); } if ((HREG(80) != 10) || (HREG(85) != 0)) { - func_800315AC(globalCtx, &globalCtx->actorCtx); + func_800315AC(play, &play->actorCtx); } if ((HREG(80) != 10) || (HREG(86) != 0)) { - if (!globalCtx->envCtx.sunMoonDisabled) { - sp21C.x = globalCtx->view.eye.x + globalCtx->envCtx.sunPos.x; - sp21C.y = globalCtx->view.eye.y + globalCtx->envCtx.sunPos.y; - sp21C.z = globalCtx->view.eye.z + globalCtx->envCtx.sunPos.z; - Environment_DrawSunLensFlare(globalCtx, &globalCtx->envCtx, &globalCtx->view, gfxCtx, sp21C, 0); + if (!play->envCtx.sunMoonDisabled) { + sp21C.x = play->view.eye.x + play->envCtx.sunPos.x; + sp21C.y = play->view.eye.y + play->envCtx.sunPos.y; + sp21C.z = play->view.eye.z + play->envCtx.sunPos.z; + Environment_DrawSunLensFlare(play, &play->envCtx, &play->view, gfxCtx, sp21C, 0); } - Environment_DrawCustomLensFlare(globalCtx); + Environment_DrawCustomLensFlare(play); } if ((HREG(80) != 10) || (HREG(87) != 0)) { @@ -1517,11 +1517,11 @@ void Gameplay_Draw(GlobalContext* globalCtx) { FILL_SCREEN_OPA | FILL_SCREEN_XLU); } - switch (globalCtx->envCtx.fillScreen) { + switch (play->envCtx.fillScreen) { case 1: Environment_FillScreen( - gfxCtx, globalCtx->envCtx.screenFillColor[0], globalCtx->envCtx.screenFillColor[1], - globalCtx->envCtx.screenFillColor[2], globalCtx->envCtx.screenFillColor[3], + gfxCtx, play->envCtx.screenFillColor[0], play->envCtx.screenFillColor[1], + play->envCtx.screenFillColor[2], play->envCtx.screenFillColor[3], FILL_SCREEN_OPA | FILL_SCREEN_XLU); break; default: @@ -1530,52 +1530,52 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } if ((HREG(80) != 10) || (HREG(88) != 0)) { - if (globalCtx->envCtx.sandstormState != 0) { - Environment_DrawSandstorm(globalCtx, globalCtx->envCtx.sandstormState); + if (play->envCtx.sandstormState != 0) { + Environment_DrawSandstorm(play, play->envCtx.sandstormState); } } if ((HREG(80) != 10) || (HREG(93) != 0)) { - DebugDisplay_DrawObjects(globalCtx); + DebugDisplay_DrawObjects(play); } if ((R_PAUSE_MENU_MODE == 1) || (gTrnsnUnkState == 1)) { Gfx* sp70 = OVERLAY_DISP; - globalCtx->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer; - globalCtx->pauseBgPreRender.fbufSave = (u16*)gZBuffer; - func_800C1F20(&globalCtx->pauseBgPreRender, &sp70); + play->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer; + play->pauseBgPreRender.fbufSave = (u16*)gZBuffer; + func_800C1F20(&play->pauseBgPreRender, &sp70); if (R_PAUSE_MENU_MODE == 1) { - globalCtx->pauseBgPreRender.cvgSave = (u8*)gfxCtx->curFrameBuffer; - func_800C20B4(&globalCtx->pauseBgPreRender, &sp70); + play->pauseBgPreRender.cvgSave = (u8*)gfxCtx->curFrameBuffer; + func_800C20B4(&play->pauseBgPreRender, &sp70); R_PAUSE_MENU_MODE = 2; } else { gTrnsnUnkState = 2; } OVERLAY_DISP = sp70; - globalCtx->unk_121C7 = 2; + play->unk_121C7 = 2; SREG(33) |= 1; } else if (R_PAUSE_MENU_MODE != 3) { - Gameplay_Draw_DrawOverlayElements: + Play_Draw_DrawOverlayElements: if ((HREG(80) != 10) || (HREG(89) != 0)) { - Gameplay_DrawOverlayElements(globalCtx); + Play_DrawOverlayElements(play); } } } } } - if (globalCtx->view.unk_124 != 0) { - Camera_Update(GET_ACTIVE_CAM(globalCtx)); - func_800AB944(&globalCtx->view); - globalCtx->view.unk_124 = 0; - if (globalCtx->skyboxId && (globalCtx->skyboxId != SKYBOX_UNSET_1D) && !globalCtx->envCtx.skyboxDisabled) { - SkyboxDraw_UpdateMatrix(&globalCtx->skyboxCtx, globalCtx->view.eye.x, globalCtx->view.eye.y, - globalCtx->view.eye.z); + if (play->view.unk_124 != 0) { + Camera_Update(GET_ACTIVE_CAM(play)); + func_800AB944(&play->view); + play->view.unk_124 = 0; + if (play->skyboxId && (play->skyboxId != SKYBOX_UNSET_1D) && !play->envCtx.skyboxDisabled) { + SkyboxDraw_UpdateMatrix(&play->skyboxCtx, play->view.eye.x, play->view.eye.y, + play->view.eye.z); } } - Camera_Finish(GET_ACTIVE_CAM(globalCtx)); + Camera_Finish(GET_ACTIVE_CAM(play)); { Gfx* prevDisplayList = POLY_OPA_DISP; @@ -1589,7 +1589,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -time_t Gameplay_GetRealTime() { +time_t Play_GetRealTime() { time_t t1, t2; struct tm* tms; time(&t1); @@ -1601,8 +1601,8 @@ time_t Gameplay_GetRealTime() { return t1 - t2; } -void Gameplay_Main(GameState* thisx) { - GlobalContext* globalCtx = (GlobalContext*)thisx; +void Play_Main(GameState* thisx) { + PlayState* play = (PlayState*)thisx; if (CVar_GetS32("gCheatEasyPauseBufferFrameAdvance", 0)) { CVar_SetS32("gCheatEasyPauseBufferFrameAdvance", CVar_GetS32("gCheatEasyPauseBufferFrameAdvance", 0) - 1); @@ -1611,7 +1611,7 @@ void Gameplay_Main(GameState* thisx) { CVar_SetS32("gPauseBufferBlockInputFrame", CVar_GetS32("gPauseBufferBlockInputFrame", 0) - 1); } - D_8012D1F8 = &globalCtx->state.input[0]; + D_8012D1F8 = &play->state.input[0]; DebugDisplay_Init(); @@ -1637,7 +1637,7 @@ void Gameplay_Main(GameState* thisx) { } if ((HREG(80) != 10) || (HREG(81) != 0)) { - Gameplay_Update(globalCtx); + Play_Update(play); } if (1 && HREG(63)) { @@ -1645,7 +1645,7 @@ void Gameplay_Main(GameState* thisx) { } FrameInterpolation_StartRecord(); - Gameplay_Draw(globalCtx); + Play_Draw(play); FrameInterpolation_StopRecord(); if (1 && HREG(63)) { @@ -1656,7 +1656,7 @@ void Gameplay_Main(GameState* thisx) { const int maxRealDaySeconds = 86400; const int maxInGameDayTicks = 65536; - int secs = (int)Gameplay_GetRealTime(); + int secs = (int)Play_GetRealTime(); float percent = (float)secs / (float)maxRealDaySeconds; int newIngameTime = maxInGameDayTicks * percent; @@ -1672,11 +1672,11 @@ u8 PlayerGrounded(Player* player) { } // original name: "Game_play_demo_mode_check" -s32 Gameplay_InCsMode(GlobalContext* globalCtx) { - return (globalCtx->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(globalCtx); +s32 Play_InCsMode(PlayState* play) { + return (play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play); } -f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) { +f32 func_800BFCB8(PlayState* play, MtxF* mf, Vec3f* vec) { CollisionPoly poly; f32 temp1; f32 temp2; @@ -1687,7 +1687,7 @@ f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) { f32 nz; s32 pad[5]; - floorY = BgCheck_AnyRaycastFloor1(&globalCtx->colCtx, &poly, vec); + floorY = BgCheck_AnyRaycastFloor1(&play->colCtx, &poly, vec); if (floorY > BGCHECK_Y_MIN) { nx = COLPOLY_GET_NORMAL(poly.normal.x); @@ -1742,66 +1742,66 @@ f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) { return floorY; } -void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) { +void* Play_LoadFile(PlayState* play, RomFile* file) { size_t size; void* allocp; size = file->vromEnd - file->vromStart; - allocp = GAMESTATE_ALLOC_MC(&globalCtx->state, size); + allocp = GAMESTATE_ALLOC_MC(&play->state, size); DmaMgr_SendRequest1(allocp, file->vromStart, size, __FILE__, __LINE__); return allocp; } -void Gameplay_InitEnvironment(GlobalContext* globalCtx, s16 skyboxId) { - Skybox_Init(&globalCtx->state, &globalCtx->skyboxCtx, skyboxId); - Environment_Init(globalCtx, &globalCtx->envCtx, 0); +void Play_InitEnvironment(PlayState* play, s16 skyboxId) { + Skybox_Init(&play->state, &play->skyboxCtx, skyboxId); + Environment_Init(play, &play->envCtx, 0); } -void Gameplay_InitScene(GlobalContext* globalCtx, s32 spawn) +void Play_InitScene(PlayState* play, s32 spawn) { - globalCtx->curSpawn = spawn; - globalCtx->linkActorEntry = NULL; - globalCtx->unk_11DFC = NULL; - globalCtx->setupEntranceList = NULL; - globalCtx->setupExitList = NULL; - globalCtx->cUpElfMsgs = NULL; - globalCtx->setupPathList = NULL; - globalCtx->numSetupActors = 0; - Object_InitBank(globalCtx, &globalCtx->objectCtx); - LightContext_Init(globalCtx, &globalCtx->lightCtx); - TransitionActor_InitContext(&globalCtx->state, &globalCtx->transiActorCtx); - func_80096FD4(globalCtx, &globalCtx->roomCtx.curRoom); + play->curSpawn = spawn; + play->linkActorEntry = NULL; + play->unk_11DFC = NULL; + play->setupEntranceList = NULL; + play->setupExitList = NULL; + play->cUpElfMsgs = NULL; + play->setupPathList = NULL; + play->numSetupActors = 0; + Object_InitBank(play, &play->objectCtx); + LightContext_Init(play, &play->lightCtx); + TransitionActor_InitContext(&play->state, &play->transiActorCtx); + func_80096FD4(play, &play->roomCtx.curRoom); YREG(15) = 0; gSaveContext.worldMapArea = 0; - Scene_ExecuteCommands(globalCtx, globalCtx->sceneSegment); - Gameplay_InitEnvironment(globalCtx, globalCtx->skyboxId); + Scene_ExecuteCommands(play, play->sceneSegment); + Play_InitEnvironment(play, play->skyboxId); } -void Gameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) { +void Play_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) { - OTRGameplay_SpawnScene(globalCtx, sceneNum, spawn); + OTRPlay_SpawnScene(play, sceneNum, spawn); } -void func_800C016C(GlobalContext* globalCtx, Vec3f* src, Vec3f* dest) { +void func_800C016C(PlayState* play, Vec3f* src, Vec3f* dest) { f32 temp; - Matrix_Mult(&globalCtx->viewProjectionMtxF, MTXMODE_NEW); + Matrix_Mult(&play->viewProjectionMtxF, MTXMODE_NEW); Matrix_MultVec3f(src, dest); - temp = globalCtx->viewProjectionMtxF.ww + - (globalCtx->viewProjectionMtxF.wx * src->x + globalCtx->viewProjectionMtxF.wy * src->y + - globalCtx->viewProjectionMtxF.wz * src->z); + temp = play->viewProjectionMtxF.ww + + (play->viewProjectionMtxF.wx * src->x + play->viewProjectionMtxF.wy * src->y + + play->viewProjectionMtxF.wz * src->z); dest->x = 160.0f + ((dest->x / temp) * 160.0f); dest->y = 120.0f + ((dest->y / temp) * 120.0f); } -s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) { +s16 Play_CreateSubCamera(PlayState* play) { s16 i; for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) { - if (globalCtx->cameraPtrs[i] == NULL) { + if (play->cameraPtrs[i] == NULL) { break; } } @@ -1815,37 +1815,37 @@ s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) { CYAN) " " VT_RST "\n", i); - globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - SUBCAM_FIRST]; - Camera_Init(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx); - globalCtx->cameraPtrs[i]->thisIdx = i; + play->cameraPtrs[i] = &play->subCameras[i - SUBCAM_FIRST]; + Camera_Init(play->cameraPtrs[i], &play->view, &play->colCtx, play); + play->cameraPtrs[i]->thisIdx = i; return i; } -s16 Gameplay_GetActiveCamId(GlobalContext* globalCtx) { - return globalCtx->activeCamera; +s16 Play_GetActiveCamId(PlayState* play) { + return play->activeCamera; } -s16 Gameplay_ChangeCameraStatus(GlobalContext* globalCtx, s16 camId, s16 status) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; +s16 Play_ChangeCameraStatus(PlayState* play, s16 camId, s16 status) { + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; if (status == CAM_STAT_ACTIVE) { - globalCtx->activeCamera = camIdx; + play->activeCamera = camIdx; } - return Camera_ChangeStatus(globalCtx->cameraPtrs[camIdx], status); + return Camera_ChangeStatus(play->cameraPtrs[camIdx], status); } -void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; +void Play_ClearCamera(PlayState* play, s16 camId) { + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; if (camIdx == MAIN_CAM) { osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: never clear camera !!\n" VT_RST); } - if (globalCtx->cameraPtrs[camIdx] != NULL) { - Camera_ChangeStatus(globalCtx->cameraPtrs[camIdx], CAM_STAT_UNK100); - globalCtx->cameraPtrs[camIdx] = NULL; + if (play->cameraPtrs[camIdx] != NULL) { + Camera_ChangeStatus(play->cameraPtrs[camIdx], CAM_STAT_UNK100); + play->cameraPtrs[camIdx] = NULL; osSyncPrintf("camera control: " VT_BGCOL(CYAN) " " VT_COL(WHITE, BLUE) " clear sub camera [%d] " VT_BGCOL( CYAN) " " VT_RST "\n", camIdx); @@ -1854,28 +1854,28 @@ void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId) { } } -void Gameplay_ClearAllSubCameras(GlobalContext* globalCtx) { +void Play_ClearAllSubCameras(PlayState* play) { s16 i; for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) { - if (globalCtx->cameraPtrs[i] != NULL) { - Gameplay_ClearCamera(globalCtx, i); + if (play->cameraPtrs[i] != NULL) { + Play_ClearCamera(play, i); } } - globalCtx->activeCamera = MAIN_CAM; + play->activeCamera = MAIN_CAM; } -Camera* Gameplay_GetCamera(GlobalContext* globalCtx, s16 camId) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; +Camera* Play_GetCamera(PlayState* play, s16 camId) { + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; - return globalCtx->cameraPtrs[camIdx]; + return play->cameraPtrs[camIdx]; } -s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye) { +s32 Play_CameraSetAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye) { s32 ret = 0; - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; - Camera* camera = globalCtx->cameraPtrs[camIdx]; + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; + Camera* camera = play->cameraPtrs[camIdx]; Player* player; ret |= Camera_SetParam(camera, 1, at); @@ -1898,10 +1898,10 @@ s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3 return ret; } -s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { +s32 Play_CameraSetAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { s32 ret = 0; - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; - Camera* camera = globalCtx->cameraPtrs[camIdx]; + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; + Camera* camera = play->cameraPtrs[camIdx]; Player* player; ret |= Camera_SetParam(camera, 1, at); @@ -1926,66 +1926,66 @@ s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Ve return ret; } -s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov) { - s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 0x20, &fov) & 1; +s32 Play_CameraSetFov(PlayState* play, s16 camId, f32 fov) { + s32 ret = Camera_SetParam(play->cameraPtrs[camId], 0x20, &fov) & 1; return ret; } -s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; - Camera* camera = globalCtx->cameraPtrs[camIdx]; +s32 Play_SetCameraRoll(PlayState* play, s16 camId, s16 roll) { + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; + Camera* camera = play->cameraPtrs[camIdx]; camera->roll = roll; return 1; } -void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 camId1, s16 camId2) { - s16 camIdx2 = (camId2 == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId2; - s16 camIdx1 = (camId1 == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId1; +void Play_CopyCamera(PlayState* play, s16 camId1, s16 camId2) { + s16 camIdx2 = (camId2 == SUBCAM_ACTIVE) ? play->activeCamera : camId2; + s16 camIdx1 = (camId1 == SUBCAM_ACTIVE) ? play->activeCamera : camId1; - Camera_Copy(globalCtx->cameraPtrs[camIdx1], globalCtx->cameraPtrs[camIdx2]); + Camera_Copy(play->cameraPtrs[camIdx1], play->cameraPtrs[camIdx2]); } -s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 setting) { +s32 func_800C0808(PlayState* play, s16 camId, Player* player, s16 setting) { Camera* camera; - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; - camera = globalCtx->cameraPtrs[camIdx]; + camera = play->cameraPtrs[camIdx]; Camera_InitPlayerSettings(camera, player); return Camera_ChangeSetting(camera, setting); } -s32 Gameplay_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting) { - return Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, camId), setting); +s32 Play_CameraChangeSetting(PlayState* play, s16 camId, s16 setting) { + return Camera_ChangeSetting(Play_GetCamera(play, camId), setting); } -void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; +void func_800C08AC(PlayState* play, s16 camId, s16 arg2) { + s16 camIdx = (camId == SUBCAM_ACTIVE) ? play->activeCamera : camId; s16 i; - Gameplay_ClearCamera(globalCtx, camIdx); + Play_ClearCamera(play, camIdx); for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) { - if (globalCtx->cameraPtrs[i] != NULL) { + if (play->cameraPtrs[i] != NULL) { osSyncPrintf( VT_COL(RED, WHITE) "camera control: error: return to main, other camera left. %d cleared!!\n" VT_RST, i); - Gameplay_ClearCamera(globalCtx, i); + Play_ClearCamera(play, i); } } if (arg2 <= 0) { - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - globalCtx->cameraPtrs[MAIN_CAM]->childCamIdx = globalCtx->cameraPtrs[MAIN_CAM]->parentCamIdx = SUBCAM_FREE; + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + play->cameraPtrs[MAIN_CAM]->childCamIdx = play->cameraPtrs[MAIN_CAM]->parentCamIdx = SUBCAM_FREE; } else { - OnePointCutscene_Init(globalCtx, 1020, arg2, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 1020, arg2, NULL, MAIN_CAM); } } -s16 Gameplay_CameraGetUID(GlobalContext* globalCtx, s16 camId) { - Camera* camera = globalCtx->cameraPtrs[camId]; +s16 Play_CameraGetUID(PlayState* play, s16 camId) { + Camera* camera = play->cameraPtrs[camId]; if (camera != NULL) { return camera->uid; @@ -1994,8 +1994,8 @@ s16 Gameplay_CameraGetUID(GlobalContext* globalCtx, s16 camId) { } } -s16 func_800C09D8(GlobalContext* globalCtx, s16 camId, s16 arg2) { - Camera* camera = globalCtx->cameraPtrs[camId]; +s16 func_800C09D8(PlayState* play, s16 camId, s16 arg2) { + Camera* camera = play->cameraPtrs[camId]; if (camera != NULL) { return 0; @@ -2008,16 +2008,16 @@ s16 func_800C09D8(GlobalContext* globalCtx, s16 camId, s16 arg2) { } } -void Gameplay_SaveSceneFlags(GlobalContext* globalCtx) { - SavedSceneFlags* savedSceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum]; +void Play_SaveSceneFlags(PlayState* play) { + SavedSceneFlags* savedSceneFlags = &gSaveContext.sceneFlags[play->sceneNum]; - savedSceneFlags->chest = globalCtx->actorCtx.flags.chest; - savedSceneFlags->swch = globalCtx->actorCtx.flags.swch; - savedSceneFlags->clear = globalCtx->actorCtx.flags.clear; - savedSceneFlags->collect = globalCtx->actorCtx.flags.collect; + savedSceneFlags->chest = play->actorCtx.flags.chest; + savedSceneFlags->swch = play->actorCtx.flags.swch; + savedSceneFlags->clear = play->actorCtx.flags.clear; + savedSceneFlags->collect = play->actorCtx.flags.collect; } -void Gameplay_SetRespawnData(GlobalContext* globalCtx, s32 respawnMode, s16 entranceIndex, s32 roomIndex, +void Play_SetRespawnData(PlayState* play, s32 respawnMode, s16 entranceIndex, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw) { RespawnData* respawnData = &gSaveContext.respawn[respawnMode]; @@ -2026,65 +2026,65 @@ void Gameplay_SetRespawnData(GlobalContext* globalCtx, s32 respawnMode, s16 entr respawnData->pos = *pos; respawnData->yaw = yaw; respawnData->playerParams = playerParams; - respawnData->tempSwchFlags = globalCtx->actorCtx.flags.tempSwch; - respawnData->tempCollectFlags = globalCtx->actorCtx.flags.tempCollect; + respawnData->tempSwchFlags = play->actorCtx.flags.tempSwch; + respawnData->tempCollectFlags = play->actorCtx.flags.tempCollect; } -void Gameplay_SetupRespawnPoint(GlobalContext* globalCtx, s32 respawnMode, s32 playerParams) { - Player* player = GET_PLAYER(globalCtx); +void Play_SetupRespawnPoint(PlayState* play, s32 respawnMode, s32 playerParams) { + Player* player = GET_PLAYER(play); s32 entranceIndex; s8 roomIndex; - if ((globalCtx->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (globalCtx->sceneNum != SCENE_KAKUSIANA)) { - roomIndex = globalCtx->roomCtx.curRoom.num; + if ((play->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (play->sceneNum != SCENE_KAKUSIANA)) { + roomIndex = play->roomCtx.curRoom.num; entranceIndex = gSaveContext.entranceIndex; - Gameplay_SetRespawnData(globalCtx, respawnMode, entranceIndex, roomIndex, playerParams, + Play_SetRespawnData(play, respawnMode, entranceIndex, roomIndex, playerParams, &player->actor.world.pos, player->actor.shape.rot.y); } } -void Gameplay_TriggerVoidOut(GlobalContext* globalCtx) { - gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = globalCtx->actorCtx.flags.tempSwch; - gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = globalCtx->actorCtx.flags.tempCollect; +void Play_TriggerVoidOut(PlayState* play) { + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = play->actorCtx.flags.tempSwch; + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = play->actorCtx.flags.tempCollect; gSaveContext.respawnFlag = 1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 0x14; + play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; + play->fadeTransition = 2; } -void Gameplay_LoadToLastEntrance(GlobalContext* globalCtx) { +void Play_LoadToLastEntrance(PlayState* play) { gSaveContext.respawnFlag = -1; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; - if ((globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO) || (globalCtx->sceneNum == SCENE_GANON_DEMO)) { - globalCtx->nextEntranceIndex = 0x043F; - Item_Give(globalCtx, ITEM_SWORD_MASTER); + if ((play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANONTIKA_SONOGO) || (play->sceneNum == SCENE_GANON_DEMO)) { + play->nextEntranceIndex = 0x043F; + Item_Give(play, ITEM_SWORD_MASTER); } else if ((gSaveContext.entranceIndex == 0x028A) || (gSaveContext.entranceIndex == 0x028E) || (gSaveContext.entranceIndex == 0x0292) || (gSaveContext.entranceIndex == 0x0476)) { - globalCtx->nextEntranceIndex = 0x01F9; + play->nextEntranceIndex = 0x01F9; } else { - globalCtx->nextEntranceIndex = gSaveContext.entranceIndex; + play->nextEntranceIndex = gSaveContext.entranceIndex; } - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; } -void Gameplay_TriggerRespawn(GlobalContext* globalCtx) { - Gameplay_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0xDFF); - Gameplay_LoadToLastEntrance(globalCtx); +void Play_TriggerRespawn(PlayState* play) { + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF); + Play_LoadToLastEntrance(play); } -s32 func_800C0CB8(GlobalContext* globalCtx) { - return (globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) && - (YREG(15) != 0x40) && (globalCtx->sceneNum != SCENE_HAIRAL_NIWA); +s32 func_800C0CB8(PlayState* play) { + return (play->roomCtx.curRoom.meshHeader->base.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) && + (YREG(15) != 0x40) && (play->sceneNum != SCENE_HAIRAL_NIWA); } -s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx) { - return !!globalCtx->frameAdvCtx.enabled; +s32 FrameAdvance_IsEnabled(PlayState* play) { + return !!play->frameAdvCtx.enabled; } -s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) { +s32 func_800C0D34(PlayState* play, Actor* actor, s16* yaw) { TransitionActorEntry* transitionActor; s32 frontRoom; @@ -2092,7 +2092,7 @@ s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) { return 0; } - transitionActor = &globalCtx->transiActorCtx.list[(u16)actor->params >> 10]; + transitionActor = &play->transiActorCtx.list[(u16)actor->params >> 10]; frontRoom = transitionActor->sides[0].room; if (frontRoom == transitionActor->sides[1].room) { @@ -2108,7 +2108,7 @@ s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) { return 1; } -s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) { +s32 func_800C0DB4(PlayState* play, Vec3f* pos) { WaterBox* waterBox; CollisionPoly* poly; Vec3f waterSurfacePos; @@ -2116,27 +2116,27 @@ s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) { waterSurfacePos = *pos; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y, + if (WaterBox_GetSurface1(play, &play->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(&play->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN) { return true; } else { return false; } } -void Gameplay_PerformSave(GlobalContext* globalCtx) { - if (globalCtx != NULL && gSaveContext.fileNum != 0xFF) { - Gameplay_SaveSceneFlags(globalCtx); - gSaveContext.savedSceneNum = globalCtx->sceneNum; +void Play_PerformSave(PlayState* play) { + if (play != NULL && gSaveContext.fileNum != 0xFF) { + Play_SaveSceneFlags(play); + gSaveContext.savedSceneNum = play->sceneNum; if (gSaveContext.temporaryWeapon) { gSaveContext.equips.buttonItems[0] = ITEM_NONE; - GET_PLAYER(globalCtx)->currentSwordItem = ITEM_NONE; + GET_PLAYER(play)->currentSwordItem = ITEM_NONE; Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE); Save_SaveFile(); gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI; - GET_PLAYER(globalCtx)->currentSwordItem = ITEM_SWORD_KOKIRI; + GET_PLAYER(play)->currentSwordItem = ITEM_SWORD_KOKIRI; Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI); } else { Save_SaveFile(); diff --git a/soh/src/code/z_player_call.c b/soh/src/code/z_player_call.c index 3d9ff0c98..901280787 100644 --- a/soh/src/code/z_player_call.c +++ b/soh/src/code/z_player_call.c @@ -2,20 +2,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26) -void (*sPlayerCallInitFunc)(Actor* thisx, GlobalContext* globalCtx); -void (*sPlayerCallDestroyFunc)(Actor* thisx, GlobalContext* globalCtx); -void (*sPlayerCallUpdateFunc)(Actor* thisx, GlobalContext* globalCtx); -void (*sPlayerCallDrawFunc)(Actor* thisx, GlobalContext* globalCtx); +void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play); +void (*sPlayerCallDestroyFunc)(Actor* thisx, PlayState* play); +void (*sPlayerCallUpdateFunc)(Actor* thisx, PlayState* play); +void (*sPlayerCallDrawFunc)(Actor* thisx, PlayState* play); -void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx); -void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx); -void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Init(Actor* thisx, PlayState* play); +void PlayerCall_Destroy(Actor* thisx, PlayState* play); +void PlayerCall_Update(Actor* thisx, PlayState* play); +void PlayerCall_Draw(Actor* thisx, PlayState* play); -void Player_Init(Actor* thisx, GlobalContext* globalCtx); -void Player_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Player_Update(Actor* thisx, GlobalContext* globalCtx); -void Player_Draw(Actor* thisx, GlobalContext* globalCtx); +void Player_Init(Actor* thisx, PlayState* play); +void Player_Destroy(Actor* thisx, PlayState* play); +void Player_Update(Actor* thisx, PlayState* play); +void Player_Draw(Actor* thisx, PlayState* play); const ActorInit Player_InitVars = { ACTOR_PLAYER, @@ -37,23 +37,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/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index e187707c4..29cdb05ca 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -285,7 +285,7 @@ Vec3f sGetItemRefPos; s32 D_80160014; s32 D_80160018; -void Player_SetBootData(GlobalContext* globalCtx, Player* this) { +void Player_SetBootData(PlayState* play, Player* this) { s32 currentBoots; s16* bootRegs; @@ -324,21 +324,21 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) { IREG(69) = bootRegs[15]; MREG(95) = bootRegs[16]; - if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) { REG(45) = 500; } } -s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) { - return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (globalCtx->sceneLoadFlag == 0x14) || +s32 Player_InBlockingCsMode(PlayState* play, Player* this) { + return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (play->sceneLoadFlag == 0x14) || (this->stateFlags1 & 1) || (this->stateFlags3 & 0x80) || ((gSaveContext.unk_13F0 != 0) && (Player_ActionToMagicSpell(this, this->itemActionParam) >= 0)); } -s32 Player_InCsMode(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_InCsMode(PlayState* play) { + Player* this = GET_PLAYER(play); - return Player_InBlockingCsMode(globalCtx, this) || (this->unk_6AD == 4); + return Player_InBlockingCsMode(play, this) || (this->unk_6AD == 4); } s32 func_8008E9C4(Player* this) { @@ -413,19 +413,19 @@ void func_8008EC70(Player* this) { this->unk_6AD = 0; } -void Player_SetEquipmentData(GlobalContext* globalCtx, Player* this) { +void Player_SetEquipmentData(PlayState* play, Player* this) { if (this->csMode != 0x56) { this->currentShield = CUR_EQUIP_VALUE(EQUIP_SHIELD); this->currentTunic = CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1; this->currentBoots = CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1; this->currentSwordItem = B_BTN_ITEM; Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam)); - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); } } -void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* this, s32 item, s32 actionParam) { - Inventory_UpdateBottleItem(globalCtx, item, this->heldItemButton); +void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam) { + Inventory_UpdateBottleItem(play, item, this->heldItemButton); if (item != ITEM_BOTTLE) { this->heldItemId = item; @@ -451,30 +451,30 @@ void func_8008EE08(Player* this) { func_8008EDF0(this); } -void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) { - Player* this = GET_PLAYER(globalCtx); +void func_8008EEAC(PlayState* play, Actor* actor) { + Player* this = GET_PLAYER(play); func_8008EE08(this); this->unk_664 = actor; this->unk_684 = actor; this->stateFlags1 |= 0x10000; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, actor); - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), 2); + Camera_SetParam(Play_GetCamera(play, 0), 8, actor); + Camera_ChangeMode(Play_GetCamera(play, 0), 2); } -s32 func_8008EF30(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 func_8008EF30(PlayState* play) { + Player* this = GET_PLAYER(play); return (this->stateFlags1 & 0x800000); } -s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) { - globalCtx->shootingGalleryStatus = ammo + 1; +s32 func_8008EF44(PlayState* play, s32 ammo) { + play->shootingGalleryStatus = ammo + 1; return 1; } -s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRange, f32 yRange) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) { + Player* this = GET_PLAYER(play); Vec3f diff; s32 pad; @@ -498,28 +498,28 @@ s32 Player_GetStrength(void) { } } -u8 Player_GetMask(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +u8 Player_GetMask(PlayState* play) { + Player* this = GET_PLAYER(play); return this->currentMask; } -Player* Player_UnsetMask(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +Player* Player_UnsetMask(PlayState* play) { + Player* this = GET_PLAYER(play); this->currentMask = PLAYER_MASK_NONE; return this; } -s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_HasMirrorShieldEquipped(PlayState* play) { + Player* this = GET_PLAYER(play); return (this->currentShield == PLAYER_SHIELD_MIRROR); } -s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_HasMirrorShieldSetToDraw(PlayState* play) { + Player* this = GET_PLAYER(play); return (this->rightHandType == 10) && (this->currentShield == PLAYER_SHIELD_MIRROR); } @@ -612,12 +612,12 @@ return_neg: return -1; } -s32 func_8008F2F8(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 func_8008F2F8(PlayState* play) { + Player* this = GET_PLAYER(play); TextTriggerEntry* triggerEntry; s32 var; - if (globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot + if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot var = 0; } else if ((this->unk_840 > 80) && ((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater @@ -629,14 +629,14 @@ s32 func_8008F2F8(GlobalContext* globalCtx) { } // Trigger general textboxes under certain conditions, like "It's so hot in here!" - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { triggerEntry = &sTextTriggers[var]; if ((triggerEntry->flag != 0) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) && (((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0)) || (((var == 1) || (var == 3)) && (this->currentBoots == PLAYER_BOOTS_IRON) && (this->currentTunic != PLAYER_TUNIC_ZORA && CVar_GetS32("gSuperTunic", 0) == 0)))) { - Message_StartTextbox(globalCtx, triggerEntry->textId, NULL); + Message_StartTextbox(play, triggerEntry->textId, NULL); gSaveContext.textTriggerFlags |= triggerEntry->flag; } } @@ -712,14 +712,14 @@ Gfx* sBootDListGroups[][2] = { { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, }; -void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, +void func_8008F470(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* data) { Color_RGB8* color; s32 eyeIndex = (jointTable[22].x & 0xF) - 1; s32 mouthIndex = (jointTable[22].x >> 4) - 1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (eyeIndex < 0) { eyeIndex = sEyeMouthIndexes[face][0]; @@ -775,7 +775,7 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, sDListsLodOffset = lod * 2; - SkelAnime_DrawFlexLod(globalCtx, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod); + SkelAnime_DrawFlexLod(play, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod); if ((overrideLimbDraw != func_800902F0) && (overrideLimbDraw != func_80090440) && (gSaveContext.gameMode != 3)) { if (LINK_IS_ADULT) { @@ -815,7 +815,7 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Vec3f D_8012602C = { 0.0f, 0.0f, 0.0f }; @@ -832,7 +832,7 @@ f32 D_80126068[] = { 5.0f, 3.0f }; Vec3f D_80126070 = { 0.0f, -300.0f, 0.0f }; -void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, +void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, s32 thighLimbIndex, s32 shinLimbIndex, s32 footLimbIndex) { Vec3f spA4; Vec3f sp98; @@ -875,7 +875,7 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, footprintPos.y += 15.0f; - sp80 = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74; + sp80 = BgCheck_EntityRaycastFloor4(&play->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74; if (sp98.y < sp80) { sp70 = sp98.x - spA4.x; @@ -915,17 +915,17 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, skelAnime->jointTable[shinLimbIndex].z = skelAnime->jointTable[shinLimbIndex].z + temp1; skelAnime->jointTable[footLimbIndex].z = skelAnime->jointTable[footLimbIndex].z + temp2 - temp1; - temp3 = func_80041D4C(&globalCtx->colCtx, sp88, sp84); + temp3 = func_80041D4C(&play->colCtx, sp88, sp84); - if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&globalCtx->colCtx, sp88, sp84)) { + if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&play->colCtx, sp88, sp84)) { footprintPos.y = sp80; - EffectSsGFire_Spawn(globalCtx, &footprintPos); + EffectSsGFire_Spawn(play, &footprintPos); } } } } -s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_8008FCC8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; if (limbIndex == PLAYER_LIMB_ROOT) { @@ -977,10 +977,10 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_RotateZ(this->unk_6C0 * (M_PI / 0x8000), MTXMODE_APPLY); } } else if (limbIndex == PLAYER_LIMB_L_THIGH) { - func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN, + func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN, PLAYER_LIMB_L_FOOT); } else if (limbIndex == PLAYER_LIMB_R_THIGH) { - func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN, + func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN, PLAYER_LIMB_R_FOOT); return false; } else { @@ -991,10 +991,10 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_80090014(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; - if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { + if (!func_8008FCC8(play, limbIndex, dList, pos, rot, thisx)) { if (limbIndex == PLAYER_LIMB_L_HAND) { Gfx** dLists = this->leftHandDLists; @@ -1054,10 +1054,10 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_800902F0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; - if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { + if (!func_8008FCC8(play, limbIndex, dList, pos, rot, thisx)) { if (this->unk_6AD != 2) { *dList = NULL; } else if (limbIndex == PLAYER_LIMB_L_FOREARM) { @@ -1079,19 +1079,19 @@ s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -s32 func_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { +s32 func_80090440(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { + if (!func_8008FCC8(play, limbIndex, dList, pos, rot, thisx)) { *dList = NULL; } return false; } -u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, +u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase) { if (weaponInfo->active == 0) { if (collider != NULL) { - Collider_ResetQuadAT(globalCtx, &collider->base); + Collider_ResetQuadAT(play, &collider->base); } Math_Vec3f_Copy(&weaponInfo->tip, newTip); Math_Vec3f_Copy(&weaponInfo->base, newBase); @@ -1101,13 +1101,13 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w (weaponInfo->tip.z == newTip->z) && (weaponInfo->base.x == newBase->x) && (weaponInfo->base.y == newBase->y) && (weaponInfo->base.z == newBase->z)) { if (collider != NULL) { - Collider_ResetQuadAT(globalCtx, &collider->base); + Collider_ResetQuadAT(play, &collider->base); } return 0; } else { if (collider != NULL) { Collider_SetQuadVertices(collider, newBase, newTip, &weaponInfo->base, &weaponInfo->tip); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } Math_Vec3f_Copy(&weaponInfo->base, newBase); Math_Vec3f_Copy(&weaponInfo->tip, newTip); @@ -1116,7 +1116,7 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w } } -void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collider, Vec3f* quadSrc) { +void func_80090604(PlayState* play, Player* this, ColliderQuad* collider, Vec3f* quadSrc) { static u8 shieldColTypes[PLAYER_SHIELD_MAX] = { COLTYPE_METAL, COLTYPE_WOOD, @@ -1135,8 +1135,8 @@ void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collide Matrix_MultVec3f(&quadSrc[3], &quadDest[3]); Collider_SetQuadVertices(collider, &quadDest[0], &quadDest[1], &quadDest[2], &quadDest[3]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base); + CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } } @@ -1150,29 +1150,29 @@ Vec3f D_801260A4[3] = { { 0.0f, -400.0f, 1000.0f }, }; -void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) { +void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { Vec3f newBasePos[3]; Matrix_MultVec3f(&D_801260A4[0], &newBasePos[0]); Matrix_MultVec3f(&D_801260A4[1], &newBasePos[1]); Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); - if (func_80090480(globalCtx, NULL, &this->swordInfo[0], &newTipPos[0], &newBasePos[0]) && + if (func_80090480(play, NULL, &this->swordInfo[0], &newTipPos[0], &newBasePos[0]) && !(this->stateFlags1 & 0x400000)) { EffectBlure_AddVertex(Effect_GetByIndex(this->swordEffectIndex), &this->swordInfo[0].tip, &this->swordInfo[0].base); } if ((this->swordState > 0) && ((this->swordAnimation < 0x18) || (this->stateFlags2 & 0x20000))) { - func_80090480(globalCtx, &this->swordQuads[0], &this->swordInfo[1], &newTipPos[1], &newBasePos[1]); - func_80090480(globalCtx, &this->swordQuads[1], &this->swordInfo[2], &newTipPos[2], &newBasePos[2]); + func_80090480(play, &this->swordQuads[0], &this->swordInfo[1], &newTipPos[1], &newBasePos[1]); + func_80090480(play, &this->swordQuads[1], &this->swordInfo[2], &newTipPos[2], &newBasePos[2]); } } -void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPos, s32 drawIdPlusOne) { +void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne) { f32 height = (this->exchangeItemId != EXCH_ITEM_NONE) ? 6.0f : 14.0f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment); @@ -1181,27 +1181,27 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height, refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW); - Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); if (!(this->getItemEntry.modIndex == MOD_RANDOMIZER && this->getItemEntry.getItemId == RG_ICE_TRAP)) { // RANDOTODO: Make this more flexible for easier toggling of individual item recolors in the future. if (this->getItemEntry.drawFunc != NULL && (CVar_GetS32("gRandoMatchKeyColors", 0) || this->getItemEntry.getItemId == RG_DOUBLE_DEFENSE)) { - this->getItemEntry.drawFunc(globalCtx, &this->getItemEntry); + this->getItemEntry.drawFunc(play, &this->getItemEntry); } else { - GetItem_Draw(globalCtx, drawIdPlusOne - 1); + GetItem_Draw(play, drawIdPlusOne - 1); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Player_DrawGetItem(GlobalContext* globalCtx, Player* this) { +void Player_DrawGetItem(PlayState* play, Player* this) { //if (!this->giObjectLoading || !osRecvMesg(&this->giObjectLoadQueue, NULL, OS_MESG_NOBLOCK)) // OTRTODO: Do something about osRecvMesg here... { this->giObjectLoading = false; - Player_DrawGetItemImpl(globalCtx, this, &sGetItemRefPos, ABS(this->unk_862)); + Player_DrawGetItemImpl(play, this, &sGetItemRefPos, ABS(this->unk_862)); } } @@ -1221,7 +1221,7 @@ void func_80090A28(Player* this, Vec3f* vecs) { Matrix_MultVec3f(&D_80126098, &vecs[2]); } -void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2) { +void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) { static Vec3f D_801260C8 = { -500.0f, -100.0f, 0.0f }; CollisionPoly* sp9C; s32 bgId; @@ -1237,24 +1237,24 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2 D_801260C8.z = arg2; Matrix_MultVec3f(&D_801260C8, &sp80); - if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + if (BgCheck_AnyLineTest3(&play->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) { + OPEN_DISPS(play->state.gfxCtx); WORLD_OVERLAY_DISP = Gfx_CallSetupDL(WORLD_OVERLAY_DISP, 0x07); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp74, &sp68, &sp64); sp60 = (sp64 < 200.0f) ? 0.08f : (sp64 / 200.0f) * 0.08f; Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY); - gSPMatrix(WORLD_OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(WORLD_OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(WORLD_OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(WORLD_OVERLAY_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); gSPDisplayList(WORLD_OVERLAY_DISP++, gLinkAdultHookshotReticleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -1308,7 +1308,7 @@ Vec3f D_801261E0[] = { { 200.0f, 200.0f, 0.0f }, }; -void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void func_80090D20(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; if (*dList != NULL) { @@ -1324,14 +1324,14 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* if (this->itemActionParam == PLAYER_AP_STICK) { Vec3f sp124[3]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actor.scale.y >= 0.0f) { D_80126080.x = this->unk_85C * 5000.0f; func_80090A28(this, sp124); if (this->swordState != 0) { EffectBlure_ChangeType(Effect_GetByIndex(this->swordEffectIndex), 7); // default sword type - func_800906D4(globalCtx, this, sp124); + func_800906D4(play, this, sp124); } else { Math_Vec3f_Copy(&this->swordInfo[0].tip, &sp124[0]); } @@ -1341,11 +1341,11 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY); Matrix_Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gLinkChildLinkDekuStickDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if ((this->actor.scale.y >= 0.0f) && (this->swordState != 0)) { Vec3f spE4[3]; @@ -1360,18 +1360,18 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } func_80090A28(this, spE4); - func_800906D4(globalCtx, this, spE4); + func_800906D4(play, this, spE4); } else if ((*dList != NULL) && (this->leftHandType == 7)) { Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - 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); gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0); gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[(gSaveContext.linkAge)]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (this->actor.scale.y >= 0.0f) { @@ -1407,7 +1407,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } else if ((this->rightHandType == 11) || (this->rightHandType == 12)) { BowStringData* stringData = &sBowStringData[gSaveContext.linkAge]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY); @@ -1438,16 +1438,16 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_RotateZ(this->unk_858 * -0.2f, 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++, stringData->dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == 10)) { Matrix_Get(&this->shieldMf); - func_80090604(globalCtx, this, &this->shieldQuad, D_80126154); + func_80090604(play, this, &this->shieldQuad, D_80126154); } if (this->actor.scale.y >= 0.0f) { @@ -1468,7 +1468,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* if (func_8002DD78(this) != 0) { Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); Player_DrawHookshotReticle( - globalCtx, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f); + play, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f); } } } @@ -1491,7 +1491,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* if (limbIndex == PLAYER_LIMB_SHEATH) { if ((this->rightHandType != 10) && (this->rightHandType != 0xFF)) { if (Player_IsChildWithHylianShield(this)) { - func_80090604(globalCtx, this, &this->shieldQuad, D_8012619C); + func_80090604(play, this, &this->shieldQuad, D_8012619C); } Matrix_TranslateRotateZYX(&D_801261CC, &D_801261D8); @@ -1507,7 +1507,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) { +u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) { s16 linkObjectId = gLinkObjectIds[gSaveContext.linkAge]; size_t size; void* ptr; @@ -1525,7 +1525,7 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) { gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800); gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800); - SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[gSaveContext.linkAge], &gPlayerAnim_link_normal_wait, 9, + SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[gSaveContext.linkAge], &gPlayerAnim_link_normal_wait, 9, ptr, ptr, PLAYER_LIMB_MAX); return size + 0x8800 + 0x90; @@ -1533,7 +1533,7 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) { u8 D_801261F8[] = { 2, 2, 5 }; -s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) { +s32 func_80091880(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) { u8* ptr = arg; u8 modelGroup = D_801261F8[ptr[0] > 0 ? ptr[0] - 1 : 0]; s32 type; @@ -1583,7 +1583,7 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p #include -void Pause_DrawTriforceSpot(GlobalContext* globalCtx, s32 showLightColumn) { +void Pause_DrawTriforceSpot(PlayState* play, s32 showLightColumn) { static DemoEffect triforce; static s16 rotation = 0; @@ -1592,12 +1592,12 @@ void Pause_DrawTriforceSpot(GlobalContext* globalCtx, s32 showLightColumn) { triforce.triforceSpot.lightColumnOpacity = showLightColumn ? 244 : 0; triforce.triforceSpot.rotation = rotation; - DemoEffect_DrawTriforceSpot(&triforce, globalCtx); + DemoEffect_DrawTriforceSpot(&triforce, play); rotation += 0x03E8; } -void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, +void func_80091A24(PlayState* play, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height, Vec3f* eye, Vec3f* at, f32 fovy, void* img1, void* img2) { static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 0 }; @@ -1608,10 +1608,10 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime Gfx* xluRef; Gfx* kalRef; u16 perspNorm; - Mtx* perspMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx)); - Mtx* lookAtMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx)); + Mtx* perspMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx)); + Mtx* lookAtMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x00, NULL); @@ -1653,15 +1653,15 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime gSPSetLights1(POLY_OPA_DISP++, lights1); - func_80093C80(globalCtx); + func_80093C80(play); POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP++, 0, 0, 0, 0, 997, 1000); - func_8002EABC(pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + func_8002EABC(pos, &play->view.eye, &lightDir, play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); - func_8008F470(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, + func_8008F470(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, func_80091880, NULL, &sp12C); if (CVar_GetS32("gPauseTriforce", 0)) { @@ -1673,15 +1673,15 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime Gfx* ohNo = POLY_XLU_DISP; POLY_XLU_DISP = POLY_OPA_DISP; - Pause_DrawTriforceSpot(globalCtx, 1); + Pause_DrawTriforceSpot(play, 1); POLY_OPA_DISP = POLY_XLU_DISP; POLY_XLU_DISP = ohNo; } - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP++); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP++); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } uintptr_t SelectedAnim = 0; // Current Animaiton on the menu @@ -1689,9 +1689,9 @@ s16 EquipedStance; // Link's current mode (Two handed, One handed...) s16 FrameCountSinceLastAnim = 0; // Time since last animation s16 MinFrameCount; // Frame to wait before checking if we need to change the animation -void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, +void func_8009214C(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots) { - Input* p1Input = &globalCtx->state.input[0]; + Input* p1Input = &play->state.input[0]; Vec3f eye = { 0.0f, 0.0f, -400.0f }; Vec3f at = { 0.0f, 0.0f, 0.0f }; Vec3s* destTable; @@ -1888,11 +1888,11 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, } if (skelAnime->animation != anim) { - LinkAnimation_Change(globalCtx, skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_LOOP, + LinkAnimation_Change(play, skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_LOOP, -6.0f); } - LinkAnimation_Update(globalCtx, skelAnime); + LinkAnimation_Update(play, skelAnime); if (!LINK_IS_ADULT) { // Link is placed too far up by default when animating @@ -1924,7 +1924,7 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, } - func_80091A24(globalCtx, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield, - boots, 64, 112, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer, - globalCtx->state.gfxCtx->curFrameBuffer + 0x1C00); + func_80091A24(play, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield, + boots, 64, 112, &eye, &at, 60.0f, play->state.gfxCtx->curFrameBuffer, + play->state.gfxCtx->curFrameBuffer + 0x1C00); } diff --git a/soh/src/code/z_quake.c b/soh/src/code/z_quake.c index 997d068c0..4cb9b7aa5 100644 --- a/soh/src/code/z_quake.c +++ b/soh/src/code/z_quake.c @@ -319,9 +319,9 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { s32 ret; u32 eq; Vec3f vec; - GlobalContext* globalCtx; + PlayState* play; - globalCtx = camera->globalCtx; + play = camera->play; vec.x = 0.0f; vec.y = 0.0f; vec.z = 0.0f; @@ -344,7 +344,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) { req = &sQuakeRequest[idx]; if (req->callbackIdx != 0) { - if (globalCtx->cameraPtrs[req->camPtrIdx] == NULL) { + if (play->cameraPtrs[req->camPtrIdx] == NULL) { osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST, req->camPtrIdx); Quake_Remove(req); diff --git a/soh/src/code/z_rcp.c b/soh/src/code/z_rcp.c index c6a50cf94..fa7fd71ad 100644 --- a/soh/src/code/z_rcp.c +++ b/soh/src/code/z_rcp.c @@ -1007,12 +1007,12 @@ void func_80093C14(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx); } -void func_80093C80(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80093C80(PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; func_80093D18(gfxCtx); - if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) { OPEN_DISPS(gfxCtx); gDPSetColorDither(POLY_OPA_DISP++, G_CD_DISABLE); diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 593406d69..e1a3ca1aa 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -1,9 +1,9 @@ #include "global.h" #include "vt.h" -void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags); -void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags); -void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags); +void func_80095AB4(PlayState* play, Room* room, u32 flags); +void func_80095D04(PlayState* play, Room* room, u32 flags); +void func_80096F6C(PlayState* play, Room* room, u32 flags); Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f }; @@ -22,34 +22,34 @@ Gfx D_801270B0[] = { gsSPEndDisplayList(), }; -void (*sRoomDrawHandlers[])(GlobalContext* globalCtx, Room* room, u32 flags) = { +void (*sRoomDrawHandlers[])(PlayState* play, Room* room, u32 flags) = { func_80095AB4, func_80096F6C, func_80095D04, }; -void func_80095AA0(GlobalContext* globalCtx, Room* room, Input* arg2, UNK_TYPE arg3) { +void func_80095AA0(PlayState* play, Room* room, Input* arg2, UNK_TYPE arg3) { } // Room Draw Polygon Type 0 -void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80095AB4(PlayState* play, Room* room, u32 flags) { s32 i; PolygonType0* polygon0; PolygonDlist* polygonDlist; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (flags & 1) { - func_800342EC(&D_801270A0, globalCtx); + func_800342EC(&D_801270A0, play); gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); - func_80093C80(globalCtx); + func_80093C80(play); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } if (flags & 2) { - func_8003435C(&D_801270A0, globalCtx); + func_8003435C(&D_801270A0, play); gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } @@ -67,7 +67,7 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) { polygonDlist++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #define SHAPE_SORT_MAX 64 @@ -80,7 +80,7 @@ typedef struct struct_80095D04 { } struct_80095D04; // size = 0x10 // Room Draw Polygon Type 2 -void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80095D04(PlayState* play, Room* room, u32 flags) { PolygonType2* polygon2; PolygonDlist2* polygonDlist; struct_80095D04 spB8[SHAPE_SORT_MAX]; @@ -99,17 +99,17 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { PolygonDlist2* temp; f32 temp_f2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (flags & 1) { - func_800342EC(&D_801270A0, globalCtx); + func_800342EC(&D_801270A0, play); //gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); - func_80093C80(globalCtx); + func_80093C80(play); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } if (flags & 2) { - func_8003435C(&D_801270A0, globalCtx); + func_8003435C(&D_801270A0, play); //gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } @@ -124,11 +124,11 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { sp90.x = polygonDlist->pos.x; sp90.y = polygonDlist->pos.y; sp90.z = polygonDlist->pos.z; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp90, &sp84, &sp80); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp90, &sp84, &sp80); if (-(f32)polygonDlist->unk_06 < sp84.z) { temp_f2 = sp84.z - polygonDlist->unk_06; - if (temp_f2 < globalCtx->lightCtx.fogFar) { + if (temp_f2 < play->lightCtx.fogFar) { phi_v0 = spB4; spA4->unk_00 = polygonDlist; spA4->unk_04 = temp_f2; @@ -214,7 +214,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { iREG(88) = sp9C - 1; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #define JPEG_MARKER 0xFFD8FFE0 @@ -332,7 +332,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h } // Room Draw Polygon Type 1 - Single Format -void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80096680(PlayState* play, Room* room, u32 flags) { Camera* camera; Gfx* spA8; PolygonType1* polygon1; @@ -342,9 +342,9 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { u32 sp94; u32 sp90; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - camera = GET_ACTIVE_CAM(globalCtx); + camera = GET_ACTIVE_CAM(play); sp9C = (camera->setting == CAM_SET_PREREND_FIXED); polygon1 = &room->meshHeader->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); @@ -356,7 +356,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); if (sp94) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa); } @@ -383,15 +383,15 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { if (sp90) { gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { +BgImage* func_80096A74(PolygonType1* polygon1, PlayState* play) { Camera* camera; s32 camId; s16 camId2; @@ -399,7 +399,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { BgImage* bgImage; s32 i; - camera = GET_ACTIVE_CAM(globalCtx); + camera = GET_ACTIVE_CAM(play); camId = camera->camDataIdx; if (camId == -1 && CVar_GetS32("gNoRestrictItems", 0)) { // This prevents a crash when using items that change the @@ -408,12 +408,12 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { } // jfifid - camId2 = func_80041C10(&globalCtx->colCtx, camId, BGCHECK_SCENE)[2].y; + camId2 = func_80041C10(&play->colCtx, camId, BGCHECK_SCENE)[2].y; if (camId2 >= 0) { camId = camId2; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->actor.params = (player->actor.params & 0xFF00) | camId; bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list); @@ -432,7 +432,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { } // Room Draw Polygon Type 1 - Multi Format -void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80096B6C(PlayState* play, Room* room, u32 flags) { Camera* camera; Gfx* spA8; PolygonType1* polygon1; @@ -443,13 +443,13 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { u32 sp90; u32 sp8C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - camera = GET_ACTIVE_CAM(globalCtx); + camera = GET_ACTIVE_CAM(play); sp98 = (camera->setting == CAM_SET_PREREND_FIXED); polygon1 = &room->meshHeader->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); - bgImage = func_80096A74(polygon1, globalCtx); + bgImage = func_80096A74(polygon1, play); sp94 = (flags & 1) && sp98 && bgImage->source && !(SREG(25) & 1); sp90 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2); sp8C = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4); @@ -458,7 +458,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); if (sp90) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa); } @@ -484,35 +484,35 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { if (sp8C) { gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Room Draw Polygon Type 1 -void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80096F6C(PlayState* play, Room* room, u32 flags) { PolygonType1* polygon1 = &room->meshHeader->polygon1; if (polygon1->format == 1) { - func_80096680(globalCtx, room, flags); + func_80096680(play, room, flags); } else if (polygon1->format == 2) { - func_80096B6C(globalCtx, room, flags); + func_80096B6C(play, room, flags); } else { LOG_HUNGUP_THREAD(); } } -void func_80096FD4(GlobalContext* globalCtx, Room* room) { +void func_80096FD4(PlayState* play, Room* room) { room->num = -1; room->segment = NULL; } -u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { +u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) { u32 maxRoomSize = 0; - RomFile* roomList = globalCtx->roomList; + RomFile* roomList = play->roomList; u32 roomSize; s32 i; s32 j; @@ -522,7 +522,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { u32 backRoomSize; u32 cumulRoomSize; - for (i = 0; i < globalCtx->numRooms; i++) { + for (i = 0; i < play->numRooms; i++) { roomSize = roomList[i].vromEnd - roomList[i].vromStart; osSyncPrintf("ROOM%d size=%d\n", i, roomSize); if (maxRoomSize < roomSize) { @@ -530,13 +530,13 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { } } - if (globalCtx->transiActorCtx.numActors != 0) { - RomFile* roomList = globalCtx->roomList; - TransitionActorEntry* transitionActor = &globalCtx->transiActorCtx.list[0]; + if (play->transiActorCtx.numActors != 0) { + RomFile* roomList = play->roomList; + TransitionActorEntry* transitionActor = &play->transiActorCtx.list[0]; - LOG_NUM("game_play->room_rom_address.num", globalCtx->numRooms); + LOG_NUM("game_play->room_rom_address.num", play->numRooms); - for (j = 0; j < globalCtx->transiActorCtx.numActors; j++) { + for (j = 0; j < play->transiActorCtx.numActors; j++) { frontRoom = transitionActor->sides[0].room; backRoom = transitionActor->sides[1].room; frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart; @@ -555,7 +555,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { osSyncPrintf(VT_FGCOL(YELLOW)); // "Room buffer size=%08x(%5.1fK)" osSyncPrintf("部屋バッファサイズ=%08x(%5.1fK)\n", maxRoomSize, maxRoomSize / 1024.0f); - roomCtx->bufPtrs[0] = GAMESTATE_ALLOC_MC(&globalCtx->state, maxRoomSize); + roomCtx->bufPtrs[0] = GAMESTATE_ALLOC_MC(&play->state, maxRoomSize); // "Room buffer initial pointer=%08x" osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]); roomCtx->bufPtrs[1] = (void*)((intptr_t)roomCtx->bufPtrs[0] + maxRoomSize); @@ -566,16 +566,16 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { roomCtx->status = 0; frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex) - : globalCtx->setupEntranceList[globalCtx->curSpawn].room; - func_8009728C(globalCtx, roomCtx, frontRoom); + : play->setupEntranceList[play->curSpawn].room; + func_8009728C(play, roomCtx, frontRoom); return maxRoomSize; } -s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { +s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { size_t size; - return OTRfunc_8009728C(globalCtx, roomCtx, roomNum); + return OTRfunc_8009728C(play, roomCtx, roomNum); if (roomCtx->status == 0) { roomCtx->prevRoom = roomCtx->curRoom; @@ -583,13 +583,13 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - ASSERT(roomNum < globalCtx->numRooms); + ASSERT(roomNum < play->numRooms); - size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart; + size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart; roomCtx->unk_34 = (void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); - DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0, + DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0, &roomCtx->loadQueue, OS_MESG_PTR(NULL), __FILE__, __LINE__); roomCtx->unk_30 ^= 1; @@ -599,8 +599,8 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { return 0; } -s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { - return OTRfunc_800973FC(globalCtx, roomCtx); +s32 func_800973FC(PlayState* play, RoomContext* roomCtx) { + return OTRfunc_800973FC(play, roomCtx); if (roomCtx->status == 1) { @@ -609,9 +609,9 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { roomCtx->curRoom.segment = roomCtx->unk_34; gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34); - Scene_ExecuteCommands(globalCtx, roomCtx->curRoom.segment); - Player_SetBootData(globalCtx, GET_PLAYER(globalCtx)); - Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); + Scene_ExecuteCommands(play, roomCtx->curRoom.segment); + Player_SetBootData(play, GET_PLAYER(play)); + Actor_SpawnTransitionActors(play, &play->actorCtx); return 1; } @@ -622,23 +622,23 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { return 1; } -void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) { +void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); ASSERT(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers)); - sRoomDrawHandlers[room->meshHeader->base.type](globalCtx, room, flags); + sRoomDrawHandlers[room->meshHeader->base.type](play, room, flags); } } -void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx) { +void func_80097534(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.num = -1; roomCtx->prevRoom.segment = NULL; - func_80031B14(globalCtx, &globalCtx->actorCtx); - Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); - Map_InitRoomData(globalCtx, roomCtx->curRoom.num); - if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20))) { - Map_SavePlayerInitialInfo(globalCtx); + func_80031B14(play, &play->actorCtx); + Actor_SpawnTransitionActors(play, &play->actorCtx); + Map_InitRoomData(play, roomCtx->curRoom.num); + if (!((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_SPOT20))) { + Map_SavePlayerInitialInfo(play); } - Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo); + Audio_SetEnvReverb(play->roomCtx.curRoom.echo); } diff --git a/soh/src/code/z_sample.c b/soh/src/code/z_sample.c index edb823988..0387d986b 100644 --- a/soh/src/code/z_sample.c +++ b/soh/src/code/z_sample.c @@ -2,7 +2,7 @@ void Sample_HandleStateChange(SampleContext* this) { if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) { - SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); this->state.running = false; } } diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index 145d039a1..d975c08ab 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -31,24 +31,24 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) { return objectCtx->num - 1; } -void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) { - GlobalContext* globalCtx2 = globalCtx; // Needs to be a new variable to match (possibly a sub struct?) +void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { + PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?) size_t spaceSize; s32 i; - if (globalCtx2->sceneNum == SCENE_SPOT00) { + if (play2->sceneNum == SCENE_SPOT00) { spaceSize = 1024000; - } else if (globalCtx2->sceneNum == SCENE_GANON_DEMO) { + } else if (play2->sceneNum == SCENE_GANON_DEMO) { if (gSaveContext.sceneSetupIndex != 4) { spaceSize = 1177600; } else { spaceSize = 1024000; } - } else if (globalCtx2->sceneNum == SCENE_JYASINBOSS) { + } else if (play2->sceneNum == SCENE_JYASINBOSS) { spaceSize = 1075200; - } else if (globalCtx2->sceneNum == SCENE_KENJYANOMA) { + } else if (play2->sceneNum == SCENE_KENJYANOMA) { spaceSize = 1075200; - } else if (globalCtx2->sceneNum == SCENE_GANON_BOSS) { + } else if (play2->sceneNum == SCENE_GANON_BOSS) { spaceSize = 1075200; } else { spaceSize = 1024000; @@ -68,7 +68,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) { osSyncPrintf(VT_RST); objectCtx->spaceStart = objectCtx->status[0].segment = - GAMESTATE_ALLOC_MC(&globalCtx->state, spaceSize); + GAMESTATE_ALLOC_MC(&play->state, spaceSize); objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP); @@ -160,7 +160,7 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) { return nextPtr; } -s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { +s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) { u32 cmdCode; while (true) { @@ -173,7 +173,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { } if (cmdCode < ARRAY_COUNT(gSceneCmdHandlers)) { - gSceneCmdHandlers[cmdCode](globalCtx, sceneCmd); + gSceneCmdHandlers[cmdCode](play, sceneCmd); } else { osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("code の値が異常です\n"); // "code variable is abnormal" @@ -184,29 +184,29 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { return 0; } -void Scene_CommandSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { - ActorEntry* linkEntry = globalCtx->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + - globalCtx->setupEntranceList[globalCtx->curSpawn].spawn; +void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { + ActorEntry* linkEntry = play->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + + play->setupEntranceList[play->curSpawn].spawn; s16 linkObjectId; - globalCtx->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); + play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)]; gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId; - Object_Spawn(&globalCtx->objectCtx, linkObjectId); + Object_Spawn(&play->objectCtx, linkObjectId); } -void Scene_CommandActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->numSetupActors = cmd->actorList.num; - globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment); +void Scene_CommandActorList(PlayState* play, SceneCmd* cmd) { + play->numSetupActors = cmd->actorList.num; + play->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment); } -void Scene_CommandUnused2(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); +void Scene_CommandUnused2(PlayState* play, SceneCmd* cmd) { + play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); } -void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) { CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.segment); colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList); @@ -215,41 +215,41 @@ void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) { colHeader->cameraDataList = SEGMENTED_TO_VIRTUAL(colHeader->cameraDataList); colHeader->waterBoxes = SEGMENTED_TO_VIRTUAL(colHeader->waterBoxes); - BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader); + BgCheck_Allocate(&play->colCtx, play, colHeader); } -void Scene_CommandRoomList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->numRooms = cmd->roomList.num; - globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment); +void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) { + play->numRooms = cmd->roomList.num; + play->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment); } -void Scene_CommandEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment); +void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) { + play->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment); } -void Scene_CommandSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) { - globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId); - gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); + play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.keepObjectId); + gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); } if (cmd->specialFiles.cUpElfMsgNum != 0) { - globalCtx->cUpElfMsgs = Gameplay_LoadFile(globalCtx, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]); + play->cUpElfMsgs = Play_LoadFile(play, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]); } } -void Scene_CommandRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1; - globalCtx->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF; - globalCtx->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1; - globalCtx->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; +void Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1; + play->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF; + play->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1; + play->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; } -void Scene_CommandMeshHeader(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment); +void Scene_CommandMeshHeader(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment); } -void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) { s32 i; s32 j; s32 k; @@ -260,19 +260,19 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { void* nextPtr; k = 0; - i = globalCtx->objectCtx.unk_09; - firstStatus = &globalCtx->objectCtx.status[0]; - status = &globalCtx->objectCtx.status[i]; + i = play->objectCtx.unk_09; + firstStatus = &play->objectCtx.status[0]; + status = &play->objectCtx.status[i]; - while (i < globalCtx->objectCtx.num) { + while (i < play->objectCtx.num) { if (status->id != *objectEntry) { - status2 = &globalCtx->objectCtx.status[i]; - for (j = i; j < globalCtx->objectCtx.num; j++) { + status2 = &play->objectCtx.status[i]; + for (j = i; j < play->objectCtx.num; j++) { status2->id = OBJECT_INVALID; status2++; } - globalCtx->objectCtx.num = i; - func_80031A28(globalCtx, &globalCtx->actorCtx); + play->objectCtx.num = i; + func_80031A28(play, &play->actorCtx); continue; } @@ -286,7 +286,7 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { ASSERT(cmd->objectList.num <= OBJECT_EXCHANGE_BANK_MAX); while (k < cmd->objectList.num) { - nextPtr = func_800982FC(&globalCtx->objectCtx, i, *objectEntry); + nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry); if (i < OBJECT_EXCHANGE_BANK_MAX - 1) { firstStatus[i + 1].segment = nextPtr; } @@ -295,69 +295,69 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { objectEntry++; } - globalCtx->objectCtx.num = i; + play->objectCtx.num = i; } -void Scene_CommandLightList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) { s32 i; LightInfo* lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.segment); for (i = 0; i < cmd->lightList.num; i++) { - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, lightInfo); + LightContext_InsertLight(play, &play->lightCtx, lightInfo); lightInfo++; } } -void Scene_CommandPathList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment); +void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) { + play->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment); } -void Scene_CommandTransitionActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->transiActorCtx.numActors = cmd->transiActorList.num; - globalCtx->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); +void Scene_CommandTransitionActorList(PlayState* play, SceneCmd* cmd) { + play->transiActorCtx.numActors = cmd->transiActorList.num; + play->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); } void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx) { transiActorCtx->numActors = 0; } -void Scene_CommandLightSettingsList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num; - globalCtx->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment); +void Scene_CommandLightSettingsList(PlayState* play, SceneCmd* cmd) { + play->envCtx.numLightSettings = cmd->lightSettingList.num; + play->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment); } -void Scene_CommandSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->skyboxId = cmd->skyboxSettings.skyboxId; - globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk_05; - globalCtx->envCtx.indoors = cmd->skyboxSettings.unk_06; +void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) { + play->skyboxId = cmd->skyboxSettings.skyboxId; + play->envCtx.unk_17 = play->envCtx.unk_18 = cmd->skyboxSettings.unk_05; + play->envCtx.indoors = cmd->skyboxSettings.unk_06; } -void Scene_CommandSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04; - globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05; +void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) { + play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04; + play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05; } -void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) { gSaveContext.skyboxTime = gSaveContext.dayTime = ((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000); } if (cmd->timeSettings.unk_06 != 0xFF) { - globalCtx->envCtx.timeIncrement = cmd->timeSettings.unk_06; + play->envCtx.timeIncrement = cmd->timeSettings.unk_06; } else { - globalCtx->envCtx.timeIncrement = 0; + play->envCtx.timeIncrement = 0; } if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) { - gTimeIncrement = globalCtx->envCtx.timeIncrement; + gTimeIncrement = play->envCtx.timeIncrement; } - globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f; + play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f; - if (((globalCtx->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) || + if (((play->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) || (gSaveContext.entranceIndex == 0x0604)) { gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime); if ((gSaveContext.skyboxTime >= 0x2AAC) && (gSaveContext.skyboxTime < 0x4555)) { @@ -372,39 +372,39 @@ void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } } -void Scene_CommandWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) { s8 x = cmd->windSettings.x; s8 y = cmd->windSettings.y; s8 z = cmd->windSettings.z; - globalCtx->envCtx.windDirection.x = x; - globalCtx->envCtx.windDirection.y = y; - globalCtx->envCtx.windDirection.z = z; + play->envCtx.windDirection.x = x; + play->envCtx.windDirection.y = y; + play->envCtx.windDirection.z = z; - globalCtx->envCtx.windSpeed = cmd->windSettings.unk_07; + play->envCtx.windSpeed = cmd->windSettings.unk_07; } -void Scene_CommandExitList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment); +void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) { + play->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment); } -void Scene_CommandUndefined9(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandUndefined9(PlayState* play, SceneCmd* cmd) { } -void Scene_CommandSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->sequenceCtx.seqId = cmd->soundSettings.seqId; - globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId; +void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) { + play->sequenceCtx.seqId = cmd->soundSettings.seqId; + play->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId; if (gSaveContext.seqId == (u8)NA_BGM_DISABLED) { Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000); } } -void Scene_CommandEchoSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.echo = cmd->echoSettings.echo; +void Scene_CommandEchoSettings(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.echo = cmd->echoSettings.echo; } -void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) { s32 pad; SceneCmd* altHeader; @@ -416,7 +416,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment))[gSaveContext.sceneSetupIndex - 1]; if (altHeader != NULL) { - Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); + Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader)); (cmd + 1)->base.code = SCENE_CMD_ID_END; } else { // "Coughh! There is no specified dataaaaa!" @@ -430,7 +430,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!"); if (altHeader != NULL) { - Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); + Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader)); (cmd + 1)->base.code = SCENE_CMD_ID_END; } } @@ -438,24 +438,24 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { } } -void Scene_CommandCutsceneData(GlobalContext* globalCtx, SceneCmd* cmd) { - osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment); +void Scene_CommandCutsceneData(PlayState* play, SceneCmd* cmd) { + osSyncPrintf("\ngame_play->demo_play.data=[%x]", play->csCtx.segment); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment); } // Camera & World Map Area -void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) { YREG(15) = cmd->miscSettings.cameraMovement; gSaveContext.worldMapArea = cmd->miscSettings.area; - if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) { + if ((play->sceneNum == SCENE_SHOP1) || (play->sceneNum == SCENE_SYATEKIJYOU)) { if (LINK_AGE_IN_YEARS == YEARS_ADULT) { gSaveContext.worldMapArea = 1; } } - if (((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_GANON_TOU)) || - ((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) { + if (((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_GANON_TOU)) || + ((play->sceneNum >= SCENE_ENTRA) && (play->sceneNum <= SCENE_SHRINE_R))) { if (gSaveContext.cutsceneIndex < 0xFFF0) { gSaveContext.worldMapAreaData |= gBitFlags[gSaveContext.worldMapArea]; osSyncPrintf("000 area_arrival=%x (%d)\n", gSaveContext.worldMapAreaData, @@ -464,7 +464,7 @@ void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } } -void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*) = { +void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*) = { Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 diff --git a/soh/src/code/z_scene_table.c b/soh/src/code/z_scene_table.c index 9bf710af1..33e58dbd0 100644 --- a/soh/src/code/z_scene_table.c +++ b/soh/src/code/z_scene_table.c @@ -956,34 +956,34 @@ Gfx sDefaultDisplayList[] = { }; // Computes next entrance index based on age and day time to set the fade out transition -void func_800994A0(GlobalContext* globalCtx) { +void func_800994A0(PlayState* play) { s16 computedEntranceIndex; if (!IS_DAY) { if (!LINK_IS_ADULT) { - computedEntranceIndex = globalCtx->nextEntranceIndex + 1; + computedEntranceIndex = play->nextEntranceIndex + 1; } else { - computedEntranceIndex = globalCtx->nextEntranceIndex + 3; + computedEntranceIndex = play->nextEntranceIndex + 3; } } else { if (!LINK_IS_ADULT) { - computedEntranceIndex = globalCtx->nextEntranceIndex; + computedEntranceIndex = play->nextEntranceIndex; } else { - computedEntranceIndex = globalCtx->nextEntranceIndex + 2; + computedEntranceIndex = play->nextEntranceIndex + 2; } } - globalCtx->fadeTransition = gEntranceTable[computedEntranceIndex].field & 0x7F; // Fade out + play->fadeTransition = gEntranceTable[computedEntranceIndex].field & 0x7F; // Fade out } // Scene Draw Config 0 -void func_80099550(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_80099550(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, sDefaultDisplayList); gSPDisplayList(POLY_XLU_DISP++, sDefaultDisplayList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* D_8012A2F8[] = { @@ -992,13 +992,13 @@ void* D_8012A2F8[] = { }; // Scene Draw Config 19 -void func_800995DC(GlobalContext* globalCtx) { - u32 gameplayFrames = globalCtx->gameplayFrames; +void func_800995DC(PlayState* play) { + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); @@ -1008,24 +1008,24 @@ void func_800995DC(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A2F8[gSaveContext.nightFlag])); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 28 -void func_80099760(GlobalContext* globalCtx) { +void func_80099760(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 0, 64, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 0, 64, 32, 1, 0, (gameplayFrames * 2) % 128, 64, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* gDCEntranceTextures[] = { @@ -1038,21 +1038,21 @@ void* sDCLavaFloorTextures[] = { }; // Scene Draw Config 20 - Dodongo's Cavern -void func_80099878(GlobalContext* globalCtx) { +void func_80099878(PlayState* play) { u32 gameplayFrames; s32 pad; - Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx[3])); + Gfx* displayListHead = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx[3])); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDCEntranceTextures[gSaveContext.nightFlag])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sDCLavaFloorTextures[(s32)(gameplayFrames & 14) >> 1])); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 0, 64, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 0, 64, 32, 1, 0, (gameplayFrames * 1) % 128, 64, 32)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 2) % 128, 32, 32)); { s32 pad2[2]; } @@ -1065,25 +1065,25 @@ void func_80099878(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT]); + gDPSetEnvColor(displayListHead++, 255, 255, 255, play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT]); + gDPSetEnvColor(displayListHead++, 255, 255, 255, play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT]); gSPEndDisplayList(displayListHead); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 30 -void func_80099BD8(GlobalContext* globalCtx) { +void func_80099BD8(PlayState* play) { f32 temp; - Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 18 * sizeof(Gfx)); + Gfx* displayListHead = Graph_Alloc(play->state.gfxCtx, 18 * sizeof(Gfx)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - temp = globalCtx->roomCtx.unk_74[0] / 255.0f; + temp = play->roomCtx.unk_74[0] / 255.0f; gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead); gSPSegment(POLY_OPA_DISP++, 0x08, displayListHead); @@ -1100,7 +1100,7 @@ void func_80099BD8(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0A, displayListHead); gSPSegment(POLY_XLU_DISP++, 0x0A, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead); @@ -1108,7 +1108,7 @@ void func_80099BD8(GlobalContext* globalCtx) { gDPSetPrimColor(displayListHead++, 0, 0, 89 + (u8)(166.0f * temp), 89 + (u8)(166.0f * temp), 89 + (u8)(166.0f * temp), 255); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); @@ -1116,16 +1116,16 @@ void func_80099BD8(GlobalContext* globalCtx) { gDPSetPrimColor(displayListHead++, 0, 0, 255 + (u8)(179.0f * temp), 255 + (u8)(179.0f * temp), 255 + (u8)(179.0f * temp), 255); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0D, displayListHead); gSPSegment(POLY_XLU_DISP++, 0x0D, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[1]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[1]); gSPEndDisplayList(displayListHead); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (gSaveContext.sceneSetupIndex == 5) { gCustomLensFlareOn = true; @@ -1139,25 +1139,25 @@ void func_80099BD8(GlobalContext* globalCtx) { } // Scene Draw Config 31 -void func_8009A45C(GlobalContext* globalCtx) { +void func_8009A45C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment( POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 1) % 128, 32, 32)); + gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 50) % 2048, 8, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 50) % 2048, 8, 512, 1, 0, (gameplayFrames * 60) % 2048, 8, 512)); gSPSegment(POLY_OPA_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); @@ -1165,26 +1165,26 @@ void func_8009A45C(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 32 -void func_8009A798(GlobalContext* globalCtx) { +void func_8009A798(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 64, 64)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 64, 64)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 256, 32, 64, 1, 0, 0, 32, 128)); gDPPipeSync(POLY_OPA_DISP++); @@ -1193,21 +1193,21 @@ void func_8009A798(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 33 -void func_8009A9DC(GlobalContext* globalCtx) { +void func_8009A9DC(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64, 1, gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -1216,17 +1216,17 @@ void func_8009A9DC(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 48 -void func_8009AB98(GlobalContext* globalCtx) { +void func_8009AB98(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); @@ -1234,20 +1234,20 @@ void func_8009AB98(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 39 -void func_8009ACA8(GlobalContext* globalCtx) { +void func_8009ACA8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1255,24 +1255,24 @@ void func_8009ACA8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 24 -void func_8009AE30(GlobalContext* globalCtx) { +void func_8009AE30(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; - if (globalCtx->sceneNum == SCENE_HAKADAN_BS) { + if (play->sceneNum == SCENE_HAKADAN_BS) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, (gameplayFrames * 2) % 128, 0, 32, 32)); } else { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, (gameplayFrames * 2) % 128, 0, 32, 32)); } @@ -1282,7 +1282,7 @@ void func_8009AE30(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sThievesHideoutEntranceTextures[] = { @@ -1291,19 +1291,19 @@ void* sThievesHideoutEntranceTextures[] = { }; // Scene Draw Config 40 -void func_8009AFE0(GlobalContext* globalCtx) { +void func_8009AFE0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); { s32 pad[2]; } gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sThievesHideoutEntranceTextures[gSaveContext.nightFlag])); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* D_8012A330[] = { @@ -1312,123 +1312,123 @@ void* D_8012A330[] = { }; // Scene Draw Config 23 (Water Temple) -void func_8009B0FC(GlobalContext* globalCtx) { +void func_8009B0FC(PlayState* play) { u32 gameplayFrames; s32 spB0; s32 spAC; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - spB0 = (globalCtx->roomCtx.unk_74[1] >> 8) & 0xFF; - spAC = globalCtx->roomCtx.unk_74[1] & 0xFF; - gameplayFrames = globalCtx->gameplayFrames; + spB0 = (play->roomCtx.unk_74[1] >> 8) & 0xFF; + spAC = play->roomCtx.unk_74[1] & 0xFF; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[gSaveContext.nightFlag])); if (spB0 == 1) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, spAC)); } else if (spB0 < 1) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 255)); } else { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160)); } if (spB0 == 2) { gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, spAC)); } else if (spB0 < 2) { gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 255)); } else { gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160)); } if (spB0 != 0) { gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 180)); } else { gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160 + (s32)((spAC / 200.0f) * 95.0f))); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 185 + (s32)((spAC / 200.0f) * 70.0f))); } gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, 0, 127 - (gameplayFrames * 1), 32, 32, 0, 0, 0, 128)); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 4, 0, 32, 32, 1, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 4, 0, 32, 32, 1, gameplayFrames * 4, 0, 32, 32, 0, 0, 0, 128)); { s32 pad[2]; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 29 -void func_8009B86C(GlobalContext* globalCtx) { +void func_8009B86C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, play->roomCtx.unk_74[0]); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 145); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 34 -void func_8009B9BC(GlobalContext* globalCtx) { +void func_8009B9BC(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 4, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, gameplayFrames % 64, 4, 16)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 35 -void func_8009BAA4(GlobalContext* globalCtx) { +void func_8009BAA4(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - if (globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { + if (play->sceneNum == SCENE_HAIRAL_NIWA) { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 10) % 256, 32, 64)); + Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 10) % 256, 32, 64)); } gDPPipeSync(POLY_OPA_DISP++); @@ -1437,30 +1437,30 @@ void func_8009BAA4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 36 -void func_8009BC44(GlobalContext* globalCtx) { +void func_8009BC44(PlayState* play) { u32 gameplayFrames; s8 sp83; - sp83 = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; + sp83 = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; - if (globalCtx->sceneNum == SCENE_GANON_TOU) { + if (play->sceneNum == SCENE_GANON_TOU) { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 64, 64)); + Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 1) % 256, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 1) % 256, 64, 64, 1, 0, (gameplayFrames * 1) % 256, 64, 64)); } gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 1) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 255 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, 32, 1, (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, 32)); @@ -1474,22 +1474,22 @@ void func_8009BC44(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sp83, sp83, sp83, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Screen Shake for Ganon's Tower Collapse -void func_8009BEEC(GlobalContext* globalCtx) { +void func_8009BEEC(PlayState* play) { s32 var; - if (globalCtx->gameplayFrames % 128 == 13) { - var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); + if (play->gameplayFrames % 128 == 13) { + var = Quake_Add(GET_ACTIVE_CAM(play), 2); Quake_SetSpeed(var, 10000); Quake_SetQuakeValues(var, 4, 0, 0, 0); Quake_SetCountdown(var, 127); } - if ((globalCtx->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) { - var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + if ((play->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) { + var = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(var, 32000.0f + (Rand_ZeroOne() * 3000.0f)); Quake_SetQuakeValues(var, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0); Quake_SetCountdown(var, 48.0f - (Rand_ZeroOne() * 15.0f)); @@ -1497,23 +1497,23 @@ void func_8009BEEC(GlobalContext* globalCtx) { } // Scene Draw Config 38 -void func_8009C0AC(GlobalContext* globalCtx) { +void func_8009C0AC(PlayState* play) { u32 gameplayFrames; s8 sp7B; - sp7B = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; + sp7B = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 512, 64, 128, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 512, 64, 128, 1, 0, 511 - (gameplayFrames * 1) % 512, 64, 128)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 32, 64, 1, 0, 255 - (gameplayFrames * 1) % 256, 32, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 20) % 2048, 16, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 20) % 2048, 16, 512, 1, 0, (gameplayFrames * 30) % 2048, 16, 512)); gDPPipeSync(POLY_OPA_DISP++); @@ -1526,12 +1526,12 @@ void func_8009C0AC(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sp7B, sp7B, sp7B, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - if (Flags_GetSwitch(globalCtx, 0x37)) { - if ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)) { - func_8009BEEC(globalCtx); + if (Flags_GetSwitch(play, 0x37)) { + if ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)) { + func_8009BEEC(play); } } } @@ -1542,18 +1542,18 @@ void* sIceCavernEntranceTextures[] = { }; // Scene Draw Config 37 -void func_8009C3EC(GlobalContext* globalCtx) { +void func_8009C3EC(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sIceCavernEntranceTextures[gSaveContext.nightFlag])); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); { s32 pad[2]; } @@ -1564,25 +1564,25 @@ void func_8009C3EC(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 42 -void func_8009C608(GlobalContext* globalCtx) { +void func_8009C608(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 60) % 2048, 8, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 60) % 2048, 8, 512, 1, 0, (gameplayFrames * 50) % 2048, 8, 512)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, 0, 32, 32, 1, (gameplayFrames * 1) % 128, 0, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256, 1, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256)); gDPPipeSync(POLY_OPA_DISP++); @@ -1591,23 +1591,23 @@ void func_8009C608(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 43 -void func_8009C8B8(GlobalContext* globalCtx) { +void func_8009C8B8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 10) % 256, 32, 64)); + Gfx_TexScroll(play->state.gfxCtx, 0, 255 - (gameplayFrames * 10) % 256, 32, 64)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1615,18 +1615,18 @@ void func_8009C8B8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 47 -void func_8009CAC0(GlobalContext* globalCtx) { +void func_8009CAC0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -1635,7 +1635,7 @@ void func_8009CAC0(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sGTGEntranceTextures[] = { @@ -1644,18 +1644,18 @@ void* sGTGEntranceTextures[] = { }; // Scene Draw Config 27 -void func_8009CC00(GlobalContext* globalCtx) { +void func_8009CC00(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sGTGEntranceTextures[gSaveContext.nightFlag])); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); { s32 pad[2]; } @@ -1666,7 +1666,7 @@ void func_8009CC00(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Gfx* Gfx_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, @@ -1689,17 +1689,17 @@ Gfx* Gfx_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y } // Scene Draw Config 50 -void func_8009CF84(GlobalContext* globalCtx) { +void func_8009CF84(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScrollPrimColor(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, + Gfx_TwoTexScrollPrimColor(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 255, 255, 255, - globalCtx->roomCtx.unk_74[0] + 127)); + play->roomCtx.unk_74[0] + 127)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1707,24 +1707,24 @@ void func_8009CF84(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 41 -void func_8009D0E8(GlobalContext* globalCtx) { +void func_8009D0E8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 4) % 128, 0, 32, 32)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 5) % 64, 16, 16)); + Gfx_TexScroll(play->state.gfxCtx, 127 - (gameplayFrames * 4) % 128, 0, 32, 32)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 5) % 64, 16, 16)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 63 - (gameplayFrames * 2) % 64, 16, 16)); + Gfx_TexScroll(play->state.gfxCtx, 0, 63 - (gameplayFrames * 2) % 64, 16, 16)); gSPSegment( POLY_XLU_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - (gameplayFrames * 3) % 128, 32, 32, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 127 - (gameplayFrames * 3) % 128, 32, 32, 1, 0, 0, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1732,7 +1732,7 @@ void func_8009D0E8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sLonLonHouseEntranceTextures[] = { @@ -1741,8 +1741,8 @@ void* sLonLonHouseEntranceTextures[] = { }; // Scene Draw Config 44 -void func_8009D31C(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_8009D31C(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); { s32 pad[2]; } @@ -1754,7 +1754,7 @@ void func_8009D31C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sGuardHouseView2Textures[] = { @@ -1767,10 +1767,10 @@ void* sGuardHouseView1Textures[] = { }; // Scene Draw Config 45 -void func_8009D438(GlobalContext* globalCtx) { +void func_8009D438(PlayState* play) { s32 var; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (LINK_IS_ADULT) { var = 1; @@ -1787,19 +1787,19 @@ void func_8009D438(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 46 -void func_8009D5B4(GlobalContext* globalCtx) { +void func_8009D5B4(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256, 1, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256)); gDPPipeSync(POLY_OPA_DISP++); @@ -1808,7 +1808,7 @@ void func_8009D5B4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sForestTempleEntranceTextures[] = { @@ -1817,18 +1817,18 @@ void* sForestTempleEntranceTextures[] = { }; // Scene Draw Config 22 -void func_8009D758(GlobalContext* globalCtx) { +void func_8009D758(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sForestTempleEntranceTextures[gSaveContext.nightFlag])); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); { s32 pad[2]; } @@ -1839,7 +1839,7 @@ void func_8009D758(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sSpiritTempleEntranceTextures[] = { @@ -1848,31 +1848,31 @@ void* sSpiritTempleEntranceTextures[] = { }; // Scene Draw Config 25 -void func_8009D974(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_8009D974(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); { s32 pad[2]; } gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sSpiritTempleEntranceTextures[gSaveContext.nightFlag])); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 1 -void func_8009DA30(GlobalContext* globalCtx) { +void func_8009DA30(PlayState* play) { u32 gameplayFrames; Gfx* displayListHead; - displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 3 * sizeof(Gfx)); + displayListHead = Graph_Alloc(play->state.gfxCtx, 3 * sizeof(Gfx)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -1887,21 +1887,21 @@ void func_8009DA30(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } else { if (gSaveContext.dayTime > 0xC555) { - if (globalCtx->roomCtx.unk_74[0] != 255) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5); + if (play->roomCtx.unk_74[0] != 255) { + Math_StepToS(&play->roomCtx.unk_74[0], 255, 5); } } else if (gSaveContext.dayTime >= 0x4000) { - if (globalCtx->roomCtx.unk_74[0] != 0) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10); + if (play->roomCtx.unk_74[0] != 0) { + Math_StepToS(&play->roomCtx.unk_74[0], 0, 10); } } - gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]); + gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]); gSPDisplayList(displayListHead++, spot00_room_0DL_012B20); gSPEndDisplayList(displayListHead); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sKakarikoWindowTextures[] = { @@ -1910,8 +1910,8 @@ void* sKakarikoWindowTextures[] = { }; // Scene Draw Config 2 -void func_8009DD5C(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_8009DD5C(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); { s32 pad[2]; } @@ -1923,24 +1923,24 @@ void func_8009DD5C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 3 -void func_8009DE78(GlobalContext* globalCtx) { +void func_8009DE78(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -1949,11 +1949,11 @@ void func_8009DE78(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 4 -void func_8009E0B8(GlobalContext* globalCtx) { +void func_8009E0B8(PlayState* play) { u32 gameplayFrames; u8 spA3; u16 spA0; @@ -1961,16 +1961,16 @@ void func_8009E0B8(GlobalContext* globalCtx) { spA3 = 128; spA0 = 500; - displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 6 * sizeof(Gfx)); + displayListHead = Graph_Alloc(play->state.gfxCtx, 6 * sizeof(Gfx)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -1980,9 +1980,9 @@ void func_8009E0B8(GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); if (gSaveContext.sceneSetupIndex == 4) { - spA3 = 255 - (u8)globalCtx->roomCtx.unk_74[0]; + spA3 = 255 - (u8)play->roomCtx.unk_74[0]; } else if (gSaveContext.sceneSetupIndex == 6) { - spA0 = globalCtx->roomCtx.unk_74[0] + 500; + spA0 = play->roomCtx.unk_74[0] + 500; } else if (((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) && (gSaveContext.eventChkInf[0] & 0x80)) { spA0 = 2150; } @@ -1999,34 +1999,34 @@ void func_8009E0B8(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); gSPSegment(POLY_OPA_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16, 1, - 0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (s16)(-play->roomCtx.unk_74[0] * 0.02f), 32, 16, 1, + 0, (s16)(-play->roomCtx.unk_74[0] * 0.02f), 32, 16)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 5 -void func_8009E54C(GlobalContext* globalCtx) { +void func_8009E54C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((gSaveContext.sceneSetupIndex > 3) || (LINK_IS_ADULT && !(gSaveContext.eventChkInf[6] & 0x200))) { - globalCtx->roomCtx.unk_74[0] = 87; + play->roomCtx.unk_74[0] = 87; } - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, 32, - 32, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, 32, + 32, 0, 0, 0, play->roomCtx.unk_74[0] + 168)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0, - 16, 64, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0, + 16, 64, 0, 0, 0, play->roomCtx.unk_74[0] + 168)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sZorasDomainEntranceTextures[] = { @@ -2035,18 +2035,18 @@ void* sZorasDomainEntranceTextures[] = { }; // Scene Draw Config 6 -void func_8009E730(GlobalContext* globalCtx) { +void func_8009E730(PlayState* play) { u32 gameplayFrames; u32 var; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; var = 127 - (gameplayFrames * 1) % 128; if (LINK_IS_ADULT) { var = 0; } - gSPSegment(POLY_OPA_DISP++, 0x0C, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 64, 32, 1, 0, var, 64, 32)); + gSPSegment(POLY_OPA_DISP++, 0x0C, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 64, 32, 1, 0, var, 64, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -2055,23 +2055,23 @@ void func_8009E730(GlobalContext* globalCtx) { { s32 pad[2]; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 7 -void func_8009E8C0(GlobalContext* globalCtx) { +void func_8009E8C0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 2) % 256, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 2) % 256, 64, 64, 1, 0, 255 - (gameplayFrames * 2) % 256, 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -2080,33 +2080,33 @@ void func_8009E8C0(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 8 -void func_8009EAD8(GlobalContext* globalCtx) { +void func_8009EAD8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 3) % 1024, 32, 256, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 3) % 1024, 32, 256, 1, 0, (gameplayFrames * 3) % 1024, 32, 256)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 64, 64, 1, 0, (gameplayFrames * 1) % 256, 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 2) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 2) % 128, 32, 32, 1, 0, (gameplayFrames * 2) % 128, 32, 32)); gSPSegment( POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 3) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 64, 16, 16, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 64, 16, 16, 1, 0, (gameplayFrames * 1) % 64, 16, 16)); gDPPipeSync(POLY_OPA_DISP++); @@ -2115,21 +2115,21 @@ void func_8009EAD8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 9 -void func_8009EE44(GlobalContext* globalCtx) { +void func_8009EE44(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, 0, 32, 16, 1, gameplayFrames % 128, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames % 128, 0, 32, 16, 1, gameplayFrames % 128, 0, 32, 16)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, gameplayFrames % 128, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, gameplayFrames % 128, 32, 32, 1, gameplayFrames % 128, gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); @@ -2142,26 +2142,26 @@ void func_8009EE44(GlobalContext* globalCtx) { if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE)) { playerHasCojiro = PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_COJIRO); } - if ((globalCtx->roomCtx.unk_74[0] == 0) && playerHasCojiro) { - if (globalCtx->roomCtx.unk_74[1] == 50) { - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_EV_CHICKEN_CRY_M); - globalCtx->roomCtx.unk_74[0] = 1; + if ((play->roomCtx.unk_74[0] == 0) && playerHasCojiro) { + if (play->roomCtx.unk_74[1] == 50) { + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_EV_CHICKEN_CRY_M); + play->roomCtx.unk_74[0] = 1; } - globalCtx->roomCtx.unk_74[1]++; + play->roomCtx.unk_74[1]++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 10 -void func_8009F074(GlobalContext* globalCtx) { +void func_8009F074(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - gameplayFrames % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -2169,7 +2169,7 @@ void func_8009F074(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* D_8012A380[] = { @@ -2178,28 +2178,28 @@ void* D_8012A380[] = { }; // Scene Draw Config 11 -void func_8009F1B4(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_8009F1B4(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); { s32 pad[2]; } gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A380[gSaveContext.nightFlag])); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 12 -void func_8009F270(GlobalContext* globalCtx) { +void func_8009F270(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -2208,21 +2208,21 @@ void func_8009F270(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 13 -void func_8009F40C(GlobalContext* globalCtx) { +void func_8009F40C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -2231,14 +2231,14 @@ void func_8009F40C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 14 -void func_8009F5D4(GlobalContext* globalCtx) { - Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 3 * sizeof(Gfx)); +void func_8009F5D4(PlayState* play) { + Gfx* displayListHead = Graph_Alloc(play->state.gfxCtx, 3 * sizeof(Gfx)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead); @@ -2246,16 +2246,16 @@ void func_8009F5D4(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } else { if (gSaveContext.dayTime > 0xC000) { - if (globalCtx->roomCtx.unk_74[0] != 255) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5); + if (play->roomCtx.unk_74[0] != 255) { + Math_StepToS(&play->roomCtx.unk_74[0], 255, 5); } } else if (gSaveContext.dayTime >= 0x4000) { - if (globalCtx->roomCtx.unk_74[0] != 0) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10); + if (play->roomCtx.unk_74[0] != 0) { + Math_StepToS(&play->roomCtx.unk_74[0], 0, 10); } } - gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]); + gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]); gSPDisplayList(displayListHead++, spot16_room_0DL_00AA48); gSPEndDisplayList(displayListHead); } @@ -2266,23 +2266,23 @@ void func_8009F5D4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 15 -void func_8009F7D4(GlobalContext* globalCtx) { - s8 sp6F = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; - s8 sp6E = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; +void func_8009F7D4(PlayState* play) { + s8 sp6F = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; + s8 sp6E = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; sp6F = (sp6F >> 1) + 192; sp6E = (sp6E >> 1) + 192; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -2291,7 +2291,7 @@ void func_8009F7D4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sGoronCityEntranceTextures[] = { @@ -2300,14 +2300,14 @@ void* sGoronCityEntranceTextures[] = { }; // Scene Draw Config 16 -void func_8009F9D0(GlobalContext* globalCtx) { +void func_8009F9D0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, gameplayFrames % 128, 0, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -2320,7 +2320,7 @@ void func_8009F9D0(GlobalContext* globalCtx) { { s32 pad[2]; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* sLonLonRanchWindowTextures[] = { @@ -2329,8 +2329,8 @@ void* sLonLonRanchWindowTextures[] = { }; // Scene Draw Config 17 -void func_8009FB74(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_8009FB74(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); { s32 pad[2]; } @@ -2342,21 +2342,21 @@ void func_8009FB74(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 18 -void func_8009FC90(GlobalContext* globalCtx) { +void func_8009FC90(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, 127 - gameplayFrames % 128, 0, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 127 - (gameplayFrames * 6) % 128, 32, 32, 1, (gameplayFrames * 6) % 128, 127 - (gameplayFrames * 3) % 128, 32, 32)); @@ -2366,30 +2366,30 @@ void func_8009FC90(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 64); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } f32 D_8012A398 = 0.0f; -void func_8009FE58(GlobalContext* globalCtx) { +void func_8009FE58(PlayState* play) { static s16 D_8012A39C = 538; static s16 D_8012A3A0 = 4272; u32 gameplayFrames; f32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - if (globalCtx->sceneNum == SCENE_BDAN) { + gameplayFrames = play->gameplayFrames; + if (play->sceneNum == SCENE_BDAN) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32, 1, 127 - gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 4) % 256, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 4) % 256, 32, 64, 1, 0, 255 - (gameplayFrames * 4) % 256, 32, 64)); } else { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, (127 - (gameplayFrames * 1)) % 128, + Gfx_TexScroll(play->state.gfxCtx, (127 - (gameplayFrames * 1)) % 128, (gameplayFrames * 1) % 128, 32, 32)); } @@ -2399,75 +2399,75 @@ void func_8009FE58(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(play) != true) { D_8012A39C += 1820; D_8012A3A0 += 1820; temp = 0.020000001f; - if (globalCtx->pauseCtx.state == 0) { - View_SetDistortionOrientation(&globalCtx->view, + if (play->pauseCtx.state == 0) { + View_SetDistortionOrientation(&play->view, ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_CosS(D_8012A39C), ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A39C), ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A3A0)); - View_SetDistortionScale(&globalCtx->view, 1.f + (0.79999995f * temp * Math_SinS(D_8012A3A0)), + View_SetDistortionScale(&play->view, 1.f + (0.79999995f * temp * Math_SinS(D_8012A3A0)), 1.f + (0.39999998f * temp * Math_CosS(D_8012A3A0)), 1.f + (1 * temp * Math_CosS(D_8012A39C))); - View_SetDistortionSpeed(&globalCtx->view, 0.95f); + View_SetDistortionSpeed(&play->view, 0.95f); } - switch (globalCtx->roomCtx.unk_74[0]) { + switch (play->roomCtx.unk_74[0]) { case 0: break; case 1: - if (globalCtx->roomCtx.unk_74[1] < 1200) { - globalCtx->roomCtx.unk_74[1] += 200; + if (play->roomCtx.unk_74[1] < 1200) { + play->roomCtx.unk_74[1] += 200; } else { - globalCtx->roomCtx.unk_74[0]++; + play->roomCtx.unk_74[0]++; } break; case 2: - if (globalCtx->roomCtx.unk_74[1] > 0) { - globalCtx->roomCtx.unk_74[1] -= 30; + if (play->roomCtx.unk_74[1] > 0) { + play->roomCtx.unk_74[1] -= 30; } else { - globalCtx->roomCtx.unk_74[1] = 0; - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[1] = 0; + play->roomCtx.unk_74[0] = 0; } break; } - if (globalCtx->pauseCtx.state == 0) { - D_8012A398 += 0.15f + (globalCtx->roomCtx.unk_74[1] * 0.001f); + if (play->pauseCtx.state == 0) { + D_8012A398 += 0.15f + (play->roomCtx.unk_74[1] * 0.001f); } } - if (globalCtx->roomCtx.curRoom.num == 2) { + if (play->roomCtx.curRoom.num == 2) { Matrix_Scale(1.0f, sinf(D_8012A398) * 0.8f, 1.0f, MTXMODE_NEW); } else { Matrix_Scale(1.005f, sinf(D_8012A398) * 0.8f, 1.005f, MTXMODE_NEW); } - gSPSegment(POLY_OPA_DISP++, 0x0D, MATRIX_NEWMTX(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0D, MATRIX_NEWMTX(play->state.gfxCtx)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 26 -void func_800A0334(GlobalContext* globalCtx) { +void func_800A0334(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128, 1, gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -2476,29 +2476,29 @@ void func_800A0334(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Scene Draw Config 52 -void func_800A055C(GlobalContext* globalCtx) { - func_8009BEEC(globalCtx); +void func_800A055C(PlayState* play) { + func_8009BEEC(play); } // Scene Draw Config 51 -void func_800A057C(GlobalContext* globalCtx) { - func_8009BEEC(globalCtx); +void func_800A057C(PlayState* play) { + func_8009BEEC(play); } // Scene Draw Config 49 -void func_800A059C(GlobalContext* globalCtx) { +void func_800A059C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 2) % 128, 0, 32, 64)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 128, 128)); + Gfx_TexScroll(play->state.gfxCtx, 127 - (gameplayFrames * 2) % 128, 0, 32, 64)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 128, 128)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -2506,10 +2506,10 @@ void func_800A059C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void (*sSceneDrawHandlers[])(GlobalContext*) = { +void (*sSceneDrawHandlers[])(PlayState*) = { func_80099550, func_8009DA30, func_8009DD5C, func_8009DE78, func_8009E0B8, func_8009E54C, func_8009E730, func_8009E8C0, func_8009EAD8, func_8009EE44, func_8009F074, func_8009F1B4, func_8009F270, func_8009F40C, func_8009F5D4, func_8009F7D4, func_8009F9D0, func_8009FB74, func_8009FC90, func_800995DC, func_80099878, @@ -2520,7 +2520,7 @@ void (*sSceneDrawHandlers[])(GlobalContext*) = { func_800A059C, func_8009CF84, func_800A057C, func_800A055C, }; -void Scene_Draw(GlobalContext* globalCtx) { +void Scene_Draw(PlayState* play) { if (HREG(80) == 17) { if (HREG(95) != 17) { HREG(95) = 17; @@ -2539,19 +2539,19 @@ void Scene_Draw(GlobalContext* globalCtx) { HREG(94) = 0; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (HREG(81) == 1) { gSPDisplayList(POLY_OPA_DISP++, sDefaultDisplayList); gSPDisplayList(POLY_XLU_DISP++, sDefaultDisplayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (HREG(82) == 1) { - sSceneDrawHandlers[globalCtx->sceneConfig](globalCtx); + sSceneDrawHandlers[play->sceneConfig](play); } } else { - sSceneDrawHandlers[globalCtx->sceneConfig](globalCtx); + sSceneDrawHandlers[play->sceneConfig](play); } } diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index cc969be45..ddfd99716 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -3,8 +3,8 @@ #define ANIM_INTERP 1 -s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime); -s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime); +s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime); +s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime); s32 SkelAnime_LoopFull(SkelAnime* skelAnime); s32 SkelAnime_Once(SkelAnime* skelAnime); s32 SkelAnime_LoopPartial(SkelAnime* skelAnime); @@ -18,14 +18,14 @@ static u32 sAnimQueueFlags; * Draw a limb of type `LodLimb` * Near or far display list is specified via `lod` */ -void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) { LodLimb* limb; Gfx* dList; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); limb = (LodLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]); @@ -38,36 +38,36 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele dList = limb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg); + postLimbDraw(play, limbIndex, &dList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); + SkelAnime_DrawLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); + SkelAnime_DrawLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + 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, +void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) { LodLimb* rootLimb; s32 pad; @@ -82,7 +82,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -94,32 +94,32 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa rot = jointTable[1]; dList = rootLimb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, arg); + postLimbDraw(play, 1, &dList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, 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, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod, Mtx** mtx) { LodLimb* limb; @@ -141,15 +141,15 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { MATRIX_TOMTX(*mtx); { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, *mtx, G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, newDList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } (*mtx)++; } else if (limbDList != NULL) { @@ -158,17 +158,17 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg); + postLimbDraw(play, limbIndex, &limbDList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod, mtx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod, mtx); } } @@ -178,7 +178,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs. * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up. */ -void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) { LodLimb* rootLimb; s32 pad; @@ -186,7 +186,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx)); if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -195,7 +195,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0xD, mtx); Matrix_Push(); @@ -209,7 +209,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dLists[lod]; - if ((overrideLimbDraw == 0) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == 0) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { MATRIX_TOMTX(mtx); @@ -224,29 +224,29 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, arg); + postLimbDraw(play, 1, &limbDList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod, &mtx); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw a limb of type `StandardLimb` to the polyOpa buffer */ -void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) { StandardLimb* limb; Gfx* dList; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); limb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]); @@ -257,34 +257,34 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele pos.z = limb->jointPos.z; dList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg); + postLimbDraw(play, limbIndex, &dList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); + SkelAnime_DrawLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); + SkelAnime_DrawLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + 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, +void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) { StandardLimb* rootLimb; s32 pad; @@ -299,7 +299,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); rootLimb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[0]); @@ -311,31 +311,31 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa rot = jointTable[1]; dList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, arg); + postLimbDraw(play, 1, &dList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); + SkelAnime_DrawLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw a limb of type `StandardLimb` contained within a flexible skeleton to the polyOpa buffer */ -void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, Mtx** limbMatricies) { StandardLimb* limb; @@ -344,7 +344,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(); @@ -358,7 +358,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { MATRIX_TOMTX(*limbMatricies); @@ -372,21 +372,21 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg); + postLimbDraw(play, limbIndex, &limbDList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, limbMatricies); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, limbMatricies); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -394,7 +394,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs. * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up. */ -void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) { StandardLimb* rootLimb; s32 pad; @@ -402,7 +402,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx)); if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -411,7 +411,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0xD, mtx); @@ -427,7 +427,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { MATRIX_TOMTX(mtx); @@ -441,16 +441,16 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, arg); + postLimbDraw(play, 1, &limbDList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, &mtx); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -507,7 +507,7 @@ s16 Animation_GetLastFrame(void* animation) { /** * Draw a limb of type `StandardLimb` to the specified display buffer */ -Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) { StandardLimb* limb; Gfx* dList; @@ -527,27 +527,27 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton dList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfx++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(gfx++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(gfx++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg, &gfx); + postLimbDraw(play, limbIndex, &dList, &rot, arg, &gfx); } if (limb->child != LIMB_DONE) { gfx = - SkelAnime_DrawLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); + SkelAnime_DrawLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - gfx = SkelAnime_DrawLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + gfx = SkelAnime_DrawLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); } @@ -557,7 +557,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton /** * Draw all limbs of type `StandardLimb` in a given skeleton to the specified display buffer */ -Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, +Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) { StandardLimb* rootLimb; s32 pad; @@ -585,20 +585,20 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable dList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfx++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(gfx++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(gfx++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, arg, &gfx); + postLimbDraw(play, 1, &dList, &rot, arg, &gfx); } if (rootLimb->child != LIMB_DONE) { - gfx = SkelAnime_DrawLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + gfx = SkelAnime_DrawLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); } @@ -610,7 +610,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable /** * Draw a limb of type `StandardLimb` contained within a flexible skeleton to the specified display buffer */ -Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Mtx** mtx, Gfx* gfx) { StandardLimb* limb; @@ -630,7 +630,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel pos.z = limb->jointPos.z; newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { MATRIX_TOMTX(*mtx); @@ -643,17 +643,17 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg, &gfx); + postLimbDraw(play, limbIndex, &limbDList, &rot, arg, &gfx); } if (limb->child != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + gfx = SkelAnime_DrawFlexLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, mtx, gfx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + gfx = SkelAnime_DrawFlexLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, mtx, gfx); } @@ -665,7 +665,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs. * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up. */ -Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) { StandardLimb* rootLimb; s32 pad; @@ -673,7 +673,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(*mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(*mtx)); if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -695,7 +695,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT newDList = limbDList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { MATRIX_TOMTX(mtx); @@ -708,10 +708,10 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, arg, &gfx); + postLimbDraw(play, 1, &limbDList, &rot, arg, &gfx); } if (rootLimb->child != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + gfx = SkelAnime_DrawFlexLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, &mtx, gfx); } @@ -815,14 +815,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; } @@ -843,7 +843,7 @@ 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) { if (CVar_GetS32("gN64WeirdFrames", 0) && frame < 0) { Vec3s* src = (Vec3s*)getN64WeirdFrame((sizeof(Vec3s) * limbCount + 2) * frame); @@ -851,7 +851,7 @@ void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader return; } - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_LOADFRAME); + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_LOADFRAME); if (entry != NULL) { @@ -891,8 +891,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; @@ -905,8 +905,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; @@ -920,8 +920,8 @@ void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* b /** * Requests copying vectors from src frame table to dst frame table whose copy flag is true */ -void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYTRUE); +void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYTRUE); if (entry != NULL) { entry->data.copy1.queueFlag = sAnimQueueFlags; @@ -935,8 +935,8 @@ void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* /** * Requests copying vectors from src frame table to dst frame table whose copy flag is false */ -void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYFALSE); +void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYFALSE); if (entry != NULL) { entry->data.copy0.queueFlag = sAnimQueueFlags; @@ -950,8 +950,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; @@ -963,7 +963,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); @@ -972,7 +972,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)) { @@ -989,7 +989,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)) { @@ -1000,7 +1000,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)) { @@ -1020,7 +1020,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)) { @@ -1040,7 +1040,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; @@ -1054,7 +1054,7 @@ void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* da /** * Performs all requests in the animation queue, then resets the queue flags. */ -void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx) { +void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) { static AnimationEntryCallback animFuncs[] = { AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp, AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor, @@ -1062,7 +1062,7 @@ void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animati AnimationEntry* entry; for (entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) { - animFuncs[entry->type](globalCtx, &entry->data); + animFuncs[entry->type](play, &entry->data); } sAnimQueueFlags = 1; @@ -1073,7 +1073,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) { if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg) != 0) @@ -1121,7 +1121,7 @@ void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel osSyncPrintf(VT_RST); } - LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f); + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f); } /** @@ -1140,15 +1140,15 @@ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) { * Advances the current Link animation and updates all frame tables. If the animation plays once, returns true when it * finishes. */ -s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime) { - return skelAnime->update(globalCtx, skelAnime); +s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) { + return skelAnime->update(play, skelAnime); } /** * Requests an interpolation between the pose in jointTable to the one in morphTable, advancing the morph but not the * animation frame */ -s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) { +s32 LinkAnimation_Morph(PlayState* play, SkelAnime* skelAnime) { f32 prevMorphWeight = skelAnime->morphWeight; f32 updateRate = R_UPDATE_RATE * 0.5f; @@ -1158,7 +1158,7 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) { LinkAnimation_SetUpdateFunction(skelAnime); } - AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, + AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, 1.0f - (skelAnime->morphWeight / prevMorphWeight)); return 0; } @@ -1167,8 +1167,8 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) { * Requests a load of the next frame of a Link animation, advances the morph, and requests an interpolation between * jointTable and morphTable */ -void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) { - AnimationContext_SetLoadFrame(globalCtx, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, +void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime) { + AnimationContext_SetLoadFrame(play, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, skelAnime->jointTable); if (skelAnime->morphWeight != 0) { f32 updateRate = R_UPDATE_RATE * 0.5f; @@ -1177,7 +1177,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) if (skelAnime->morphWeight <= 0.0f) { skelAnime->morphWeight = 0.0f; } else { - AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, + AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, skelAnime->morphWeight); } } @@ -1186,7 +1186,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) /** * Advances a Link animation that loops over its full length */ -s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) { +s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime) { f32 updateRate = R_UPDATE_RATE * 0.5f; skelAnime->curFrame += skelAnime->playSpeed * updateRate; @@ -1195,18 +1195,18 @@ s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) { } else if (skelAnime->animLength <= skelAnime->curFrame) { skelAnime->curFrame -= skelAnime->animLength; } - LinkAnimation_AnimateFrame(globalCtx, skelAnime); + LinkAnimation_AnimateFrame(play, skelAnime); return 0; } /** * Advances a Link animation that stops at endFrame and returns true when it is reached. */ -s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) { +s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime) { f32 updateRate = R_UPDATE_RATE * 0.5f; if (skelAnime->curFrame == skelAnime->endFrame) { - LinkAnimation_AnimateFrame(globalCtx, skelAnime); + LinkAnimation_AnimateFrame(play, skelAnime); return 1; } skelAnime->curFrame += skelAnime->playSpeed * updateRate; @@ -1217,14 +1217,14 @@ s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) { } else if (skelAnime->animLength <= skelAnime->curFrame) { skelAnime->curFrame -= skelAnime->animLength; } - LinkAnimation_AnimateFrame(globalCtx, skelAnime); + LinkAnimation_AnimateFrame(play, skelAnime); return 0; } /** * Sets a new morph and resets the morph weight for the current animation. */ -void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames) { +void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames) { skelAnime->morphWeight = 1.0f; skelAnime->morphRate = 1.0f / morphFrames; } @@ -1235,7 +1235,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) { LinkAnimationHeader* ogAnim = animation; @@ -1254,14 +1254,14 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn morphFrames = -morphFrames; } else { skelAnime->update = LinkAnimation_Morph; - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount, + AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->morphTable); } skelAnime->morphWeight = 1.0f; skelAnime->morphRate = 1.0f / morphFrames; } else { LinkAnimation_SetUpdateFunction(skelAnime); - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount, + AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->jointTable); skelAnime->morphWeight = 0.0f; } @@ -1278,105 +1278,105 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn /** * Immediately changes to a Link animation that plays once at the default speed. */ -void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) { - LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, +void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); } /** * Immediately changes to a Link animation that plays once at the specified speed. */ -void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed) { - LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), + LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); } /** * Immediately changes to a Link animation that loops at the default speed. */ -void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) { - LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, +void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, 0.0f); } /** * Immediately changes to a Link animation that loops at the specified speed. */ -void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed) { - LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), + LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, 0.0f); } /** * Requests copying jointTable to morphTable */ -void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime) { - AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable); +void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime) { + AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable); } /** * Requests copying morphTable to jointTable * unused */ -void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime) { - AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable); +void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime) { + AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable); } /** * Requests loading frame data from the Link animation into morphTable */ -void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) { - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable); + 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, +void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) { - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable); + 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, +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((uintptr_t)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, +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((uintptr_t)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); } /** @@ -1426,7 +1426,7 @@ s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) { /** * Initializes a normal skeleton to a looping animation, dynamically allocating the frame tables if not provided. */ -s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) { if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg)) skeletonHeaderSeg = ResourceMgr_LoadSkeletonByName(skeletonHeaderSeg); @@ -1459,7 +1459,7 @@ s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeade /** * Initializes a flex skeleton to a looping animation, dynamically allocating the frame tables if not given. */ -s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) { if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg) != 0) skeletonHeaderSeg = ResourceMgr_LoadSkeletonByName(skeletonHeaderSeg); @@ -1496,7 +1496,7 @@ s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkele /** * Initializes a skeleton with SkinLimbs to a looping animation, dynamically allocating the frame tables. */ -s32 SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation) { if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg) != 0) animation = ResourceMgr_LoadAnimByName(skeletonHeaderSeg); @@ -1909,7 +1909,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) { ZELDA_ARENA_FREE_DEBUG(skelAnime->jointTable); } else { diff --git a/soh/src/code/z_skin.c b/soh/src/code/z_skin.c index bd5f2288c..c8d0ce8df 100644 --- a/soh/src/code/z_skin.c +++ b/soh/src/code/z_skin.c @@ -185,12 +185,12 @@ 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; s32 segmentType; SkinLimb** skeleton; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; OPEN_DISPS(gfxCtx); @@ -218,7 +218,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD s32 shouldDraw = true; if (overrideLimbDraw != NULL) { - shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin); + shouldDraw = overrideLimbDraw(actor, play, i, skin); } segmentType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->segmentType; @@ -231,7 +231,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD } if (postDraw != NULL) { - postDraw(actor, globalCtx, skin); + postDraw(actor, play, skin); } close_disps: @@ -239,26 +239,26 @@ close_disps: } // allows specifying PostLimbDraw and setTranslation -void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0); +void func_800A6330(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) { + Skin_DrawImpl(actor, play, skin, postDraw, NULL, setTranslation, false, 0); } // allows specifying OverrideLimbDraw, PostLimbDraw and setTranslation -void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A6360(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, false, 0); + Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, false, 0); } // allows specifying OverrideLimbDraw, PostLimbDraw, setTranslation, and arg6 -void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A6394(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0); + Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0); } // allows specifying all variables -void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A63CC(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags); + Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags); } void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst) { diff --git a/soh/src/code/z_skin_awb.c b/soh/src/code/z_skin_awb.c index 81f4bcbab..f3a2e6390 100644 --- a/soh/src/code/z_skin_awb.c +++ b/soh/src/code/z_skin_awb.c @@ -4,7 +4,7 @@ /** * Initialises the Vtx buffers used for limb at index `limbIndex` */ -void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) { +void Skin_InitAnimatedLimb(PlayState* play, Skin* skin, s32 limbIndex) { s32 i; SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment); SkinAnimatedLimbData* animatedLimbData = @@ -36,7 +36,7 @@ void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) * Initializes a skin skeleton to looping animation, dynamically allocating the frame tables, * and dynamically allocating and initializing the Vtx and SkinLimbVtx buffers for its animated limbs */ -void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) { +void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) { if (ResourceMgr_OTRSigCheck(skeletonHeader)) skeletonHeader = ResourceMgr_LoadSkeletonByName(skeletonHeader); @@ -77,17 +77,17 @@ void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHea ZELDA_ARENA_MALLOC_DEBUG(animatedLimbData->totalVtxCount * sizeof(Vtx)); ASSERT(vtxEntry->buf[1] != NULL); - Skin_InitAnimatedLimb(globalCtx, skin, i); + Skin_InitAnimatedLimb(play, skin, i); } } - SkelAnime_InitSkin(globalCtx, &skin->skelAnime, skeletonHeader, animationHeader); + SkelAnime_InitSkin(play, &skin->skelAnime, skeletonHeader, animationHeader); } /** * Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables */ -void Skin_Free(GlobalContext* globalCtx, Skin* skin) { +void Skin_Free(PlayState* play, Skin* skin) { if (skin->vtxTable != NULL) { s32 i; @@ -106,7 +106,7 @@ void Skin_Free(GlobalContext* globalCtx, Skin* skin) { ZELDA_ARENA_FREE_DEBUG(skin->vtxTable); } - SkelAnime_Free(&skin->skelAnime, globalCtx); + SkelAnime_Free(&skin->skelAnime, play); } } diff --git a/soh/src/code/z_sound_source.c b/soh/src/code/z_sound_source.c index ce54ee393..16e3fee5b 100644 --- a/soh/src/code/z_sound_source.c +++ b/soh/src/code/z_sound_source.c @@ -1,24 +1,24 @@ #include "global.h" -void SoundSource_InitAll(GlobalContext* globalCtx) { - SoundSource* sources = &globalCtx->soundSources[0]; +void SoundSource_InitAll(PlayState* play) { + SoundSource* sources = &play->soundSources[0]; s32 i; // clang-format off - for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { sources[i].countdown = 0; } + for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { sources[i].countdown = 0; } // clang-format on } -void SoundSource_UpdateAll(GlobalContext* globalCtx) { - SoundSource* source = &globalCtx->soundSources[0]; +void SoundSource_UpdateAll(PlayState* play) { + SoundSource* source = &play->soundSources[0]; s32 i; - for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { + for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { if (source->countdown != 0) { if (DECR(source->countdown) == 0) { Audio_StopSfxByPos(&source->projectedPos); } else { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos); } } @@ -26,15 +26,15 @@ void SoundSource_UpdateAll(GlobalContext* globalCtx) { } } -void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, s32 duration, u16 sfxId) { +void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, s32 duration, u16 sfxId) { s32 countdown; SoundSource* source; s32 smallestCountdown = 0xFFFF; SoundSource* backupSource; s32 i; - source = &globalCtx->soundSources[0]; - for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { + source = &play->soundSources[0]; + for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { if (source->countdown == 0) { break; } @@ -49,7 +49,7 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo } // If no sound source is available, replace the sound source with the smallest remaining countdown - if (i >= ARRAY_COUNT(globalCtx->soundSources)) { + if (i >= ARRAY_COUNT(play->soundSources)) { source = backupSource; Audio_StopSfxByPos(&source->projectedPos); } @@ -57,6 +57,6 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo source->worldPos = *worldPos; source->countdown = duration; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos); Audio_PlaySoundGeneral(sfxId, &source->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index b43515386..a2017ce9a 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -32,7 +32,7 @@ void Sram_InitDebugSave(void) { // RANDOTODO replace most of these GiveLink functions with calls to // Item_Give in z_parameter, we'll need to update Item_Give to ensure -// nothing breaks when calling it without a valid globalCtx first +// nothing breaks when calling it without a valid play first void GiveLinkRupees(int numOfRupees) { int maxRupeeCount; if (CUR_UPG_VALUE(UPG_WALLET) == 0) { diff --git a/soh/src/code/z_vr_box.c b/soh/src/code/z_vr_box.c index 6a3ebb1dd..70e6fe31d 100644 --- a/soh/src/code/z_vr_box.c +++ b/soh/src/code/z_vr_box.c @@ -592,7 +592,7 @@ SkyboxTableEntry sSkyboxTable[] = }, }; -void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxId) { +void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) { size_t size; s16 i; u8 sp41; // imageIdx @@ -613,16 +613,16 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox if (gSaveContext.skyboxTime >= D_8011FC1C[phi_v1][i].startTime && (gSaveContext.skyboxTime < D_8011FC1C[phi_v1][i].endTime || D_8011FC1C[phi_v1][i].endTime == 0xFFFF)) { - globalCtx->envCtx.skybox1Index = sp41 = D_8011FC1C[phi_v1][i].skybox1Index; - globalCtx->envCtx.skybox2Index = sp40 = D_8011FC1C[phi_v1][i].skybox2Index; + play->envCtx.skybox1Index = sp41 = D_8011FC1C[phi_v1][i].skybox1Index; + play->envCtx.skybox2Index = sp40 = D_8011FC1C[phi_v1][i].skybox2Index; if (D_8011FC1C[phi_v1][i].blend != 0) { - globalCtx->envCtx.skyboxBlend = + play->envCtx.skyboxBlend = Environment_LerpWeight(D_8011FC1C[phi_v1][i].endTime, D_8011FC1C[phi_v1][i].startTime, ((void)0, gSaveContext.skyboxTime)) * 255.0f; } else { - globalCtx->envCtx.skyboxBlend = 0; + play->envCtx.skyboxBlend = 0; } break; } @@ -944,13 +944,13 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox } void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) { - GlobalContext* globalCtx = (GlobalContext*)state; + PlayState* play = (PlayState*)state; skyboxCtx->skyboxId = skyboxId; skyboxCtx->unk_140 = 0; skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f; - Skybox_Setup(globalCtx, skyboxCtx, skyboxId); + Skybox_Setup(play, skyboxCtx, skyboxId); osSyncPrintf("\n\n\n********************\n\n\n" "TYPE=%d" "\n\n\n********************\n\n\n", diff --git a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index de5829edc..3b5cc77ec 100644 --- a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -3,13 +3,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx); -void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx); -void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArmsHook_Init(Actor* thisx, PlayState* play); +void ArmsHook_Destroy(Actor* thisx, PlayState* play); +void ArmsHook_Update(Actor* thisx, PlayState* play); +void ArmsHook_Draw(Actor* thisx, PlayState* play); -void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx); -void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx); +void ArmsHook_Wait(ArmsHook* this, PlayState* play); +void ArmsHook_Shoot(ArmsHook* this, PlayState* play); const ActorInit Arms_Hook_InitVars = { ACTOR_ARMS_HOOK, @@ -63,33 +63,33 @@ void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Init(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit); ArmsHook_SetupAction(this, ArmsHook_Wait); this->unk_1E8 = this->actor.world.pos; } -void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Destroy(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; if (this->grabbed != NULL) { this->grabbed->flags &= ~ACTOR_FLAG_13; } - Collider_DestroyQuad(globalCtx, &this->collider); + Collider_DestroyQuad(play, &this->collider); } -void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) { +void ArmsHook_Wait(ArmsHook* this, PlayState* play) { if (this->actor.parent == NULL) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); // get correct timer length for hookshot or longshot s32 length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26; ArmsHook_SetupAction(this, ArmsHook_Shoot); func_8002D9A4(&this->actor, 20.0f); - this->actor.parent = &GET_PLAYER(globalCtx)->actor; + this->actor.parent = &GET_PLAYER(play)->actor; this->timer = length; } } @@ -138,8 +138,8 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->grabbedDistDiff); } -void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* touchedActor; Actor* grabbed; Vec3f bodyDistDiffVec; @@ -257,18 +257,18 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { sp60.x = this->unk_1F4.x - (this->unk_1E8.x - this->unk_1F4.x); sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y); sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, true, true, true, true, &bgId) && - !func_8002F9EC(globalCtx, &this->actor, poly, bgId, &sp78)) { + !func_8002F9EC(play, &this->actor, poly, bgId, &sp78)) { sp5C = COLPOLY_GET_NORMAL(poly->normal.x); sp58 = COLPOLY_GET_NORMAL(poly->normal.z); Math_Vec3f_Copy(&this->actor.world.pos, &sp78); this->actor.world.pos.x += 10.0f * sp5C; this->actor.world.pos.z += 10.0f * sp58; this->timer = 0; - if (SurfaceType_IsHookshotSurface(&globalCtx->colCtx, poly, bgId)) { + if (SurfaceType_IsHookshotSurface(&play->colCtx, poly, bgId)) { if (bgId != BGCHECK_SCENE) { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL) { ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor); } @@ -277,28 +277,28 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &this->actor.world.pos); + CollisionCheck_SpawnShieldParticlesMetal(play, &this->actor.world.pos); Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_REFLECT, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - } else if (CHECK_BTN_ANY(globalCtx->state.input[0].press.button, + } else if (CHECK_BTN_ANY(play->state.input[0].press.button, (BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN))) { this->timer = 0; } } } -void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Update(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_1F4 = this->unk_1E8; } -void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Draw(Actor* thisx, PlayState* play) { s32 pad; ArmsHook* this = (ArmsHook*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp78; Vec3f sp6C; Vec3f sp60; @@ -306,7 +306,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp58; if ((player->actor.draw != NULL) && (player->rightHandType == 15)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); @@ -319,9 +319,9 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80865BAC, &sp60); } - func_80090480(globalCtx, &this->collider, &this->hookInfo, &sp6C, &sp60); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80090480(play, &this->collider, &this->hookInfo, &sp6C, &sp60); + func_80093D18(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++, gLinkAdultHookshotTipDL); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); @@ -331,10 +331,10 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(Math_FAtan2F(sp78.x, sp78.z), MTXMODE_APPLY); Matrix_RotateX(Math_FAtan2F(-sp78.y, sp5C), MTXMODE_APPLY); Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotChainDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h index 822d87fec..b624599a5 100644 --- a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h +++ b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h @@ -6,7 +6,7 @@ struct ArmsHook; -typedef void (*ArmsHookActionFunc)(struct ArmsHook*, GlobalContext*); +typedef void (*ArmsHookActionFunc)(struct ArmsHook*, PlayState*); typedef struct ArmsHook { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index e6bf1026a..972a2ffad 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx); -void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx); -void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArrowFire_Init(Actor* thisx, PlayState* play); +void ArrowFire_Destroy(Actor* thisx, PlayState* play); +void ArrowFire_Update(Actor* thisx, PlayState* play); +void ArrowFire_Draw(Actor* thisx, PlayState* play); -void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx); -void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx); -void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx); +void ArrowFire_Charge(ArrowFire* this, PlayState* play); +void ArrowFire_Fly(ArrowFire* this, PlayState* play); +void ArrowFire_Hit(ArrowFire* this, PlayState* play); #include "overlays/ovl_Arrow_Fire/ovl_Arrow_Fire.h" @@ -41,7 +41,7 @@ void ArrowFire_SetupAction(ArrowFire* this, ArrowFireActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void ArrowFire_Init(Actor* thisx, PlayState* play) { ArrowFire* this = (ArrowFire*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -54,12 +54,12 @@ void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 0.0f; } -void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void ArrowFire_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); LOG_STRING("消滅"); // "Disappearance" } -void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) { +void ArrowFire_Charge(ArrowFire* this, PlayState* play) { EnArrow* arrow; arrow = (EnArrow*)this->actor.parent; @@ -92,7 +92,7 @@ void func_80865ECC(Vec3f* unkPos, Vec3f* firePos, f32 scale) { unkPos->z += ((firePos->z - unkPos->z) * scale); } -void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) { +void ArrowFire_Hit(ArrowFire* this, PlayState* play) { f32 scale; f32 offset; u16 timer; @@ -143,7 +143,7 @@ void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) { } } -void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) { +void ArrowFire_Fly(ArrowFire* this, PlayState* play) { EnArrow* arrow; f32 distanceScaled; s32 pad; @@ -177,20 +177,20 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) { } } -void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowFire_Update(Actor* thisx, PlayState* play) { ArrowFire* this = (ArrowFire*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || + play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(&this->actor); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void ArrowFire_Draw(Actor* thisx, PlayState* play2) { ArrowFire* this = (ArrowFire*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 stateFrames; EnArrow* arrow; Actor* tranform; @@ -199,13 +199,13 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { Color_RGB8 Arrow_env = CVar_GetRGB("gFireArrowColEnv", Arrow_env_ori); Color_RGB8 Arrow_col = CVar_GetRGB("gFireArrowCol", Arrow_col_ori); - stateFrames = globalCtx->state.frames; + stateFrames = play->state.frames; arrow = (EnArrow*)this->actor.parent; if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW); Matrix_RotateY(tranform->shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); @@ -232,7 +232,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { } // Draw fire on the arrow - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (CVar_GetS32("gUseArrowsCol", 0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128); @@ -248,14 +248,14 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { } Matrix_Scale(this->radius * 0.2f, this->unk_158 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1, 255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h b/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h index f5b2d3f63..44af3decf 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h +++ b/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h @@ -6,7 +6,7 @@ struct ArrowFire; -typedef void (*ArrowFireActionFunc)(struct ArrowFire*, GlobalContext*); +typedef void (*ArrowFireActionFunc)(struct ArrowFire*, PlayState*); typedef struct ArrowFire { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index a55a4ac4a..cd298abaa 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx); -void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx); -void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArrowIce_Init(Actor* thisx, PlayState* play); +void ArrowIce_Destroy(Actor* thisx, PlayState* play); +void ArrowIce_Update(Actor* thisx, PlayState* play); +void ArrowIce_Draw(Actor* thisx, PlayState* play); -void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx); -void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx); -void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx); +void ArrowIce_Charge(ArrowIce* this, PlayState* play); +void ArrowIce_Fly(ArrowIce* this, PlayState* play); +void ArrowIce_Hit(ArrowIce* this, PlayState* play); #include "overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.h" @@ -42,7 +42,7 @@ void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Init(Actor* thisx, PlayState* play) { ArrowIce* this = (ArrowIce*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -55,12 +55,12 @@ void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_164 = 0.0f; } -void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void ArrowIce_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); LOG_STRING("消滅"); // "Disappearance" } -void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Charge(ArrowIce* this, PlayState* play) { EnArrow* arrow; arrow = (EnArrow*)this->actor.parent; @@ -93,7 +93,7 @@ void func_80867E8C(Vec3f* unkPos, Vec3f* icePos, f32 scale) { unkPos->z += ((icePos->z - unkPos->z) * scale); } -void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Hit(ArrowIce* this, PlayState* play) { f32 scale; f32 offset; u16 timer; @@ -144,7 +144,7 @@ void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { } } -void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Fly(ArrowIce* this, PlayState* play) { EnArrow* arrow; f32 distanceScaled; s32 pad; @@ -178,22 +178,22 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { } } -void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Update(Actor* thisx, PlayState* play) { ArrowIce* this = (ArrowIce*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || + play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(&this->actor); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Draw(Actor* thisx, PlayState* play) { ArrowIce* this = (ArrowIce*)thisx; s32 pad; Actor* tranform; - u32 stateFrames = globalCtx->state.frames; + u32 stateFrames = play->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; Color_RGB8 Arrow_env_ori = {0,0,255}; Color_RGB8 Arrow_col_ori = {170, 255, 255}; @@ -203,7 +203,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW); Matrix_RotateY(tranform->shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); @@ -230,7 +230,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { } // Draw ice on the arrow - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (CVar_GetS32("gUseArrowsCol", 0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128); @@ -246,14 +246,14 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->unk_160 * 3.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h b/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h index b326f7c43..1a6ed24b3 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h +++ b/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h @@ -6,7 +6,7 @@ struct ArrowIce; -typedef void (*ArrowIceActionFunc)(struct ArrowIce*, GlobalContext*); +typedef void (*ArrowIceActionFunc)(struct ArrowIce*, PlayState*); typedef struct ArrowIce { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index 093cef89e..1edcd018e 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx); -void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx); -void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArrowLight_Init(Actor* thisx, PlayState* play); +void ArrowLight_Destroy(Actor* thisx, PlayState* play); +void ArrowLight_Update(Actor* thisx, PlayState* play); +void ArrowLight_Draw(Actor* thisx, PlayState* play); -void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx); -void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx); -void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx); +void ArrowLight_Charge(ArrowLight* this, PlayState* play); +void ArrowLight_Fly(ArrowLight* this, PlayState* play); +void ArrowLight_Hit(ArrowLight* this, PlayState* play); #include "overlays/ovl_Arrow_Light/ovl_Arrow_Light.h" @@ -42,7 +42,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); @@ -55,12 +55,12 @@ void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_164 = 0.0f; } -void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void ArrowLight_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); LOG_STRING("消滅"); // "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)) { @@ -92,7 +92,7 @@ void func_80869E6C(Vec3f* unkPos, Vec3f* lightPos, f32 scale) { unkPos->z += ((lightPos->z - unkPos->z) * scale); } -void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) { +void ArrowLight_Hit(ArrowLight* this, PlayState* play) { f32 scale; f32 offset; u16 timer; @@ -143,7 +143,7 @@ void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) { } } -void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) { +void ArrowLight_Fly(ArrowLight* this, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; f32 distanceScaled; s32 pad; @@ -176,21 +176,21 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) { } } -void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowLight_Update(Actor* thisx, PlayState* play) { ArrowLight* this = (ArrowLight*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || + play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(&this->actor); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArrowLight_Draw(Actor* thisx, PlayState* play) { ArrowLight* this = (ArrowLight*)thisx; s32 pad; - u32 stateFrames = globalCtx->state.frames; + u32 stateFrames = play->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; Actor* tranform; Color_RGB8 Arrow_env_ori = {255, 255, 0}; @@ -201,7 +201,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW); Matrix_RotateY(tranform->shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); @@ -228,7 +228,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { } // Draw light on the arrow - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (CVar_GetS32("gUseArrowsCol", 0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128); @@ -244,14 +244,14 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h b/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h index 79db3621a..78bef515e 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h +++ b/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h @@ -6,7 +6,7 @@ struct ArrowLight; -typedef void (*ArrowLightActionFunc)(struct ArrowLight*, GlobalContext*); +typedef void (*ArrowLightActionFunc)(struct ArrowLight*, PlayState*); typedef struct ArrowLight { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index e71aa8668..23bb66dc5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -9,27 +9,27 @@ #define FLAGS ACTOR_FLAG_4 -void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBdanObjects_Init(Actor* thisx, PlayState* play); +void BgBdanObjects_Destroy(Actor* thisx, PlayState* play); +void BgBdanObjects_Update(Actor* thisx, PlayState* play); +void BgBdanObjects_Draw(Actor* thisx, PlayState* play); -void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx); -void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx); +void func_8086C054(BgBdanObjects* this, PlayState* play); +void func_8086C1A0(BgBdanObjects* this, PlayState* play); +void func_8086C29C(BgBdanObjects* this, PlayState* play); +void func_8086C55C(BgBdanObjects* this, PlayState* play); +void func_8086C5BC(BgBdanObjects* this, PlayState* play); +void func_8086C618(BgBdanObjects* this, PlayState* play); +void func_8086C6EC(BgBdanObjects* this, PlayState* play); +void func_8086C76C(BgBdanObjects* this, PlayState* play); +void func_8086C7D0(BgBdanObjects* this, PlayState* play); +void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play); +void func_8086C874(BgBdanObjects* this, PlayState* play); +void func_8086C9A8(BgBdanObjects* this, PlayState* play); +void func_8086C9F0(BgBdanObjects* this, PlayState* play); +void func_8086CABC(BgBdanObjects* this, PlayState* play); +void func_8086CB10(BgBdanObjects* this, PlayState* play); +void func_8086CB8C(BgBdanObjects* this, PlayState* play); const ActorInit Bg_Bdan_Objects_InitVars = { ACTOR_BG_BDAN_OBJECTS, @@ -105,7 +105,7 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) { } } -void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Init(Actor* thisx, PlayState* play) { s32 pad; BgBdanObjects* this = (BgBdanObjects*)thisx; CollisionHeader* colHeader = NULL; @@ -116,21 +116,21 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; if (thisx->params == 2) { thisx->flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; - globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y; + play->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y; this->actionFunc = func_8086C9A8; return; } if (thisx->params == 0) { CollisionHeader_GetVirtual(&gJabuBigOctoPlatformCol, &colHeader); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); thisx->world.pos.y += -79.0f; - if (Flags_GetClear(globalCtx, thisx->room)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + if (Flags_GetClear(play, thisx->room)) { + Flags_SetSwitch(play, this->switchFlag); this->actionFunc = func_8086C6EC; } else { if (BgBdanObjects_GetContactRu1(this, 4)) { - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA, + if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA, thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, 0, thisx->shape.rot.y + 0x8000, 0, 3) != NULL) { thisx->child->world.pos.z = thisx->child->home.pos.z + 263.0f; @@ -139,7 +139,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8086C618; thisx->world.pos.y = thisx->home.pos.y + -70.0f; } else { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); this->timer = 0; this->actionFunc = func_8086C054; } @@ -152,7 +152,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8086C874; } else { CollisionHeader_GetVirtual(&gJabuLoweringPlatformCol, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgBdanObjects_DoNothing; thisx->world.pos.y = thisx->home.pos.y - 400.0f; } else { @@ -160,26 +160,26 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { } } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Destroy(Actor* thisx, PlayState* play) { BgBdanObjects* this = (BgBdanObjects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (thisx->params == 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8086C054(BgBdanObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (BgBdanObjects_GetContactRu1(this, 0)) { if (this->dyna.actor.xzDistToPlayer < 250.0f) { BgBdanObjects_SetContactRu1(this, 1); this->timer = 20; - OnePointCutscene_Init(globalCtx, 3070, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3070, -99, &this->dyna.actor, MAIN_CAM); player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3300.0f; @@ -194,14 +194,14 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { } } - if (!Gameplay_InCsMode(globalCtx) && !BgBdanObjects_GetContactRu1(this, 0)) { + if (!Play_InCsMode(play) && !BgBdanObjects_GetContactRu1(this, 0)) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + -79.0f; } else { this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y + -79.0f) - 5.0f; } } -void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C1A0(BgBdanObjects* this, PlayState* play) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 500.0f, 0.5f, 7.5f, 1.0f) < 0.1f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A); @@ -221,13 +221,13 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C29C(BgBdanObjects* this, PlayState* play) { s32 temp; if (this->timer != 0) { this->timer--; if (this->timer == 0) { - temp = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + temp = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(temp, 0x3A98); Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1); Quake_SetCountdown(temp, 0xA); @@ -235,18 +235,18 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { } if (BgBdanObjects_GetContactRu1(this, 3)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 140.0f, this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0); BgBdanObjects_SetContactRu1(this, 4); this->timer = 10; this->actionFunc = func_8086C55C; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } } -void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8086C3D8(BgBdanObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->dyna.actor.velocity.y += 0.5f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f, @@ -256,7 +256,7 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; this->actionFunc = func_8086C5BC; - OnePointCutscene_Init(globalCtx, 3080, -99, this->dyna.actor.child, MAIN_CAM); + OnePointCutscene_Init(play, 3080, -99, this->dyna.actor.child, MAIN_CAM); player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3500.0f; @@ -278,18 +278,18 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C55C(BgBdanObjects* this, PlayState* play) { this->timer--; if (this->timer == 0) { - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); } else if (this->timer == -40) { this->timer = 0; this->actionFunc = func_8086C3D8; } } -void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C5BC(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -302,11 +302,11 @@ void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C618(BgBdanObjects* this, PlayState* play) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + if (Flags_GetClear(play, this->dyna.actor.room)) { + Flags_SetSwitch(play, this->switchFlag); this->dyna.actor.home.rot.y = (s16)(this->dyna.actor.shape.rot.y + 0x2000) & 0xC000; this->actionFunc = func_8086C6EC; } else { @@ -315,7 +315,7 @@ void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C6EC(BgBdanObjects* this, PlayState* play) { s32 cond = Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.home.rot.y, 0x200); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -125.0f, 3.0f)) { @@ -325,16 +325,16 @@ void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C76C(BgBdanObjects* this, PlayState* play) { if (func_8004356C(&this->dyna)) { if (this->dyna.actor.xzDistToPlayer < 120.0f) { this->actionFunc = func_8086C7D0; - OnePointCutscene_Init(globalCtx, 3090, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3090, -99, &this->dyna.actor, MAIN_CAM); } } } -void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C7D0(BgBdanObjects* this, PlayState* play) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 965.0f, 0.5f, 15.0f, 0.2f) < 0.01f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A); @@ -344,30 +344,30 @@ void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx) { +void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play) { } -void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C874(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->switchFlag == 0) { if (func_8004356C(&this->dyna)) { - this->cameraSetting = globalCtx->cameraPtrs[MAIN_CAM]->setting; - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2); - func_8005AD1C(globalCtx->cameraPtrs[MAIN_CAM], 4); + this->cameraSetting = play->cameraPtrs[MAIN_CAM]->setting; + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2); + func_8005AD1C(play->cameraPtrs[MAIN_CAM], 4); this->switchFlag = 10; } } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2); if (!func_8004356C(&this->dyna)) { if (this->switchFlag != 0) { this->switchFlag--; } } if (this->switchFlag == 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], this->cameraSetting); - func_8005ACFC(globalCtx->cameraPtrs[MAIN_CAM], 4); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], this->cameraSetting); + func_8005ACFC(play->cameraPtrs[MAIN_CAM], 4); } } this->dyna.actor.world.pos.y = @@ -377,17 +377,17 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_8086C9A8(BgBdanObjects* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->timer = 100; this->actionFunc = func_8086C9F0; } } -void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C9F0(BgBdanObjects* this, PlayState* play) { if (this->timer == 0) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.5f)) { - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); this->actionFunc = func_8086C9A8; } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); @@ -397,10 +397,10 @@ void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) { } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } - globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y; } -void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086CABC(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -410,17 +410,17 @@ void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086CB10(BgBdanObjects* this, PlayState* play) { if (func_8004356C(&this->dyna)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); this->timer = 50; this->actionFunc = func_8086CB8C; this->dyna.actor.home.pos.y -= 200.0f; - OnePointCutscene_Init(globalCtx, 3100, 51, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3100, 51, &this->dyna.actor, MAIN_CAM); } } -void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086CB8C(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -430,20 +430,20 @@ void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) { if (this->timer == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->actionFunc = BgBdanObjects_DoNothing; - Gameplay_CopyCamera(globalCtx, MAIN_CAM, SUBCAM_ACTIVE); + Play_CopyCamera(play, MAIN_CAM, SUBCAM_ACTIVE); } else { func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG); } } -void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Update(Actor* thisx, PlayState* play) { BgBdanObjects* this = (BgBdanObjects*)thisx; Actor_SetFocus(thisx, 50.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Draw(Actor* thisx, PlayState* play) { BgBdanObjects* this = (BgBdanObjects*)thisx; if (thisx->params == 0) { @@ -455,8 +455,8 @@ void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (thisx->params == 2) { - Gfx_DrawDListXlu(globalCtx, gJabuWaterDL); + Gfx_DrawDListXlu(play, gJabuWaterDL); } else { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); + Gfx_DrawDListOpa(play, sDLists[thisx->params]); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h b/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h index e21fe6c96..358c6bcae 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h +++ b/soh/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h @@ -6,7 +6,7 @@ struct BgBdanObjects; -typedef void (*BgBdanObjectsActionFunc)(struct BgBdanObjects*, GlobalContext*); +typedef void (*BgBdanObjectsActionFunc)(struct BgBdanObjects*, PlayState*); typedef struct BgBdanObjects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index ea777aead..39581961f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -9,38 +9,38 @@ #define FLAGS ACTOR_FLAG_4 -void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBdanSwitch_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBdanSwitch_Init(Actor* thisx, PlayState* play); +void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play); +void BgBdanSwitch_Update(Actor* thisx, PlayState* play); +void BgBdanSwitch_Draw(Actor* thisx, PlayState* play); void func_8086D5C4(BgBdanSwitch* this); -void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D5E0(BgBdanSwitch* this, PlayState* play); void func_8086D67C(BgBdanSwitch* this); -void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D694(BgBdanSwitch* this, PlayState* play); void func_8086D730(BgBdanSwitch* this); -void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D754(BgBdanSwitch* this, PlayState* play); void func_8086D7FC(BgBdanSwitch* this); -void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D80C(BgBdanSwitch* this, PlayState* play); void func_8086D86C(BgBdanSwitch* this); -void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D888(BgBdanSwitch* this, PlayState* play); void func_8086D8BC(BgBdanSwitch* this); -void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx); -void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D8CC(BgBdanSwitch* this, PlayState* play); +void func_8086D95C(BgBdanSwitch* this, PlayState* play); void func_8086D9F8(BgBdanSwitch* this); -void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DA1C(BgBdanSwitch* this, PlayState* play); void func_8086DAB4(BgBdanSwitch* this); -void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DAC4(BgBdanSwitch* this, PlayState* play); void func_8086DB24(BgBdanSwitch* this); -void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DB40(BgBdanSwitch* this, PlayState* play); void func_8086DB4C(BgBdanSwitch* this); -void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DB68(BgBdanSwitch* this, PlayState* play); void func_8086DC30(BgBdanSwitch* this); -void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DC48(BgBdanSwitch* this, PlayState* play); void func_8086DCCC(BgBdanSwitch* this); -void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DCE8(BgBdanSwitch* this, PlayState* play); void func_8086DDA8(BgBdanSwitch* this); -void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DDC0(BgBdanSwitch* this, PlayState* play); const ActorInit Bg_Bdan_Switch_InitVars = { ACTOR_BG_BDAN_SWITCH, @@ -90,24 +90,24 @@ static InitChainEntry sInitChain[] = { static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f }; -void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) { s16 pad1; CollisionHeader* colHeader = NULL; s16 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void BgBdanSwitch_InitCollision(BgBdanSwitch* this, GlobalContext* globalCtx) { +void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) { Actor* actor = &this->dyna.actor; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, actor, &sJntSphInit, this->colliderItems); } void func_8086D0EC(BgBdanSwitch* this) { @@ -134,7 +134,7 @@ void func_8086D0EC(BgBdanSwitch* this) { this->dyna.actor.shape.yOffset = 1.2f / this->unk_1D0; } -void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Init(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; s32 pad; s16 type; @@ -156,17 +156,17 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { case BLUE: case YELLOW_HEAVY: case YELLOW: - BgBdanSwitch_InitDynaPoly(this, globalCtx, &gJabuFloorSwitchCol, DPM_PLAYER); + BgBdanSwitch_InitDynaPoly(this, play, &gJabuFloorSwitchCol, DPM_PLAYER); break; case YELLOW_TALL_1: case YELLOW_TALL_2: - BgBdanSwitch_InitCollision(this, globalCtx); + BgBdanSwitch_InitCollision(this, play); this->dyna.actor.flags |= ACTOR_FLAG_0; this->dyna.actor.targetMode = 4; break; } - flag = Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + flag = Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); switch (type) { case BLUE: @@ -201,42 +201,42 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(巨大魚ダンジョン 専用スイッチ)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; switch (this->dyna.actor.params & 0xFF) { case BLUE: case YELLOW_HEAVY: case YELLOW: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; case YELLOW_TALL_1: case YELLOW_TALL_2: - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); break; } } -void func_8086D4B4(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D4B4(BgBdanSwitch* this, PlayState* play) { s32 pad; s32 type; - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { type = this->dyna.actor.params & 0xFF; - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); if (type == BLUE || type == YELLOW_TALL_2) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } else { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); } } } -void func_8086D548(BgBdanSwitch* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); +void func_8086D548(BgBdanSwitch* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); if ((this->dyna.actor.params & 0xFF) == YELLOW_TALL_2) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } } } @@ -246,18 +246,18 @@ void func_8086D5C4(BgBdanSwitch* this) { this->unk_1C8 = 1.0f; } -void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D5E0(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case BLUE: if (func_800435B4(&this->dyna)) { func_8086D67C(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; case YELLOW: if (func_8004356C(&this->dyna)) { func_8086D67C(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; } @@ -268,7 +268,7 @@ void func_8086D67C(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D694(BgBdanSwitch* this, PlayState* play) { if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.1f) { @@ -285,20 +285,20 @@ void func_8086D730(BgBdanSwitch* this) { this->unk_1D8 = 6; } -void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D754(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case BLUE: if (!func_800435B4(&this->dyna)) { if (this->unk_1D8 <= 0) { func_8086D7FC(this); - func_8086D548(this, globalCtx); + func_8086D548(this, play); } } else { this->unk_1D8 = 6; } break; case YELLOW: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_8086D7FC(this); } break; @@ -309,7 +309,7 @@ void func_8086D7FC(BgBdanSwitch* this) { this->actionFunc = func_8086D80C; } -void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D80C(BgBdanSwitch* this, PlayState* play) { this->unk_1C8 += 0.2f; if (this->unk_1C8 >= 1.0f) { func_8086D5C4(this); @@ -322,7 +322,7 @@ void func_8086D86C(BgBdanSwitch* this) { this->unk_1C8 = 1.0f; } -void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D888(BgBdanSwitch* this, PlayState* play) { if (func_8004356C(&this->dyna)) { func_8086D8BC(this); } @@ -332,7 +332,7 @@ void func_8086D8BC(BgBdanSwitch* this) { this->actionFunc = func_8086D8CC; } -void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D8CC(BgBdanSwitch* this, PlayState* play) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.6f) { func_8086D9F8(this); @@ -346,7 +346,7 @@ void func_8086D944(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D95C(BgBdanSwitch* this, PlayState* play) { if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.1f) { @@ -363,14 +363,14 @@ void func_8086D9F8(BgBdanSwitch* this) { this->unk_1D8 = 6; } -void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx) { - Actor* heldActor = GET_PLAYER(globalCtx)->heldActor; +void func_8086DA1C(BgBdanSwitch* this, PlayState* play) { + Actor* heldActor = GET_PLAYER(play)->heldActor; if (func_8004356C(&this->dyna)) { if (heldActor != NULL && heldActor->id == ACTOR_EN_RU1) { if (this->unk_1D8 <= 0) { func_8086D944(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } } else { this->unk_1D8 = 6; @@ -386,7 +386,7 @@ void func_8086DAB4(BgBdanSwitch* this) { this->actionFunc = func_8086DAC4; } -void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DAC4(BgBdanSwitch* this, PlayState* play) { this->unk_1C8 += 0.2f; if (this->unk_1C8 >= 1.0f) { func_8086D86C(this); @@ -399,7 +399,7 @@ void func_8086DB24(BgBdanSwitch* this) { this->actionFunc = func_8086DB40; } -void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DB40(BgBdanSwitch* this, PlayState* play) { } void func_8086DB4C(BgBdanSwitch* this) { @@ -407,7 +407,7 @@ void func_8086DB4C(BgBdanSwitch* this) { this->unk_1C8 = 2.0f; } -void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DB68(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { default: return; @@ -415,14 +415,14 @@ void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) { if (((this->collider.base.acFlags & AC_HIT) != 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; case YELLOW_TALL_2: if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; } @@ -433,7 +433,7 @@ void func_8086DC30(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DC48(BgBdanSwitch* this, PlayState* play) { if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.3f; if (this->unk_1C8 <= 1.0f) { @@ -448,10 +448,10 @@ void func_8086DCCC(BgBdanSwitch* this) { this->unk_1C8 = 1.0f; } -void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DCE8(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case YELLOW_TALL_1: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_8086DDA8(this); } break; @@ -459,7 +459,7 @@ void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) { if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) { this->unk_1D8 = 0xA; func_8086DDA8(this); - func_8086D548(this, globalCtx); + func_8086D548(this, play); } break; } @@ -470,7 +470,7 @@ void func_8086DDA8(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DDC0(BgBdanSwitch* this, PlayState* play) { if ((((this->dyna.actor.params & 0xFF) != YELLOW_TALL_2) || (func_8005B198() == this->dyna.actor.category)) || (this->unk_1DA <= 0)) { this->unk_1C8 += 0.3f; @@ -481,7 +481,7 @@ void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) { } } -void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Update(Actor* thisx, PlayState* play) { s32 pad; BgBdanSwitch* this = (BgBdanSwitch*)thisx; s32 type; @@ -489,47 +489,47 @@ void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_1DA > 0) { this->unk_1DA--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8086D0EC(this); type = this->dyna.actor.params & 0xFF; if (type != 3 && type != 4) { this->unk_1D8--; } else { - if (!Player_InCsMode(globalCtx) && this->unk_1D8 > 0) { + if (!Player_InCsMode(play) && this->unk_1D8 > 0) { this->unk_1D8--; } this->unk_1DC = this->collider.base.acFlags; this->collider.base.acFlags &= ~AC_HIT; this->collider.elements[0].dim.modelSphere.radius = this->unk_1D4 * 370.0f; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, Gfx* dlist) { +void func_8086DF58(BgBdanSwitch* this, PlayState* play, Gfx* dlist) { Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->unk_1D0), this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->unk_1D4, this->unk_1D0, this->unk_1D4, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, dlist); + Gfx_DrawDListOpa(play, dlist); } -void BgBdanSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Draw(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; switch (this->dyna.actor.params & 0xFF) { case YELLOW_HEAVY: case YELLOW: - func_8086DF58(this, globalCtx, gJabuYellowFloorSwitchDL); + func_8086DF58(this, play, gJabuYellowFloorSwitchDL); break; case YELLOW_TALL_1: case YELLOW_TALL_2: - func_8086DF58(this, globalCtx, gJabuYellowFloorSwitchDL); + func_8086DF58(this, play, gJabuYellowFloorSwitchDL); Collider_UpdateSpheres(0, &this->collider); Matrix_MultVec3f(&D_8086E0E0, &this->dyna.actor.focus.pos); break; case BLUE: - func_8086DF58(this, globalCtx, gJabuBlueFloorSwitchDL); + func_8086DF58(this, play, gJabuBlueFloorSwitchDL); break; } } diff --git a/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h b/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h index 629643c7e..cc0d7cceb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h +++ b/soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h @@ -15,7 +15,7 @@ typedef enum { struct BgBdanSwitch; -typedef void (*BgBdanSwitchActionFunc)(struct BgBdanSwitch*, GlobalContext*); +typedef void (*BgBdanSwitchActionFunc)(struct BgBdanSwitch*, PlayState*); typedef struct BgBdanSwitch { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c b/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c index ed289bbb2..98e437547 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c +++ b/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c @@ -11,11 +11,11 @@ #define FLAGS ACTOR_FLAG_4 -void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBomGuard_Update(Actor* thisx, GlobalContext* globalCtx); +void BgBomGuard_Init(Actor* thisx, PlayState* play); +void BgBomGuard_Destroy(Actor* thisx, PlayState* play); +void BgBomGuard_Update(Actor* thisx, PlayState* play); -void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx); +void func_8086E638(BgBomGuard* this, PlayState* play); const ActorInit Bg_Bom_Guard_InitVars = { ACTOR_BG_BOM_GUARD, @@ -34,14 +34,14 @@ void BgBomGuard_SetupAction(BgBomGuard* this, BgBomGuardActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBomGuard_Init(Actor* thisx, PlayState* play) { BgBomGuard* this = (BgBomGuard*)thisx; s32 pad[2]; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gBowlingDefaultCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 透明ガード出現 ☆☆☆☆☆ \n" VT_RST); @@ -53,22 +53,22 @@ void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) { BgBomGuard_SetupAction(this, func_8086E638); } -void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBomGuard_Destroy(Actor* thisx, PlayState* play) { BgBomGuard* this = (BgBomGuard*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) { - Actor* it = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; +void func_8086E638(BgBomGuard* this, PlayState* play) { + Actor* it = play->actorCtx.actorLists[ACTORCAT_NPC].head; Actor* thisx = &this->dyna.actor; this->unk_168 = 0; while (it != 0) { if (it->id == ACTOR_EN_BOM_BOWL_MAN) { - if ((((EnBomBowlMan*)it)->minigamePlayStatus != 0) && (fabsf(globalCtx->view.eye.x) > -20.0f) && - (fabsf(globalCtx->view.eye.y) > 110.0f)) { + if ((((EnBomBowlMan*)it)->minigamePlayStatus != 0) && (fabsf(play->view.eye.x) > -20.0f) && + (fabsf(play->view.eye.y) > 110.0f)) { this->unk_168 = 1; } break; @@ -83,8 +83,8 @@ void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) { } } -void BgBomGuard_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBomGuard_Update(Actor* thisx, PlayState* play) { BgBomGuard* this = (BgBomGuard*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h b/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h index 41a395a38..9df9ab267 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h +++ b/soh/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h @@ -6,7 +6,7 @@ struct BgBomGuard; -typedef void (*BgBomGuardActionFunc)(struct BgBomGuard*, GlobalContext*); +typedef void (*BgBomGuardActionFunc)(struct BgBomGuard*, PlayState*); typedef struct BgBomGuard { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c b/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c index 4c972a195..9b559d7e2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c +++ b/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c @@ -9,16 +9,16 @@ #define FLAGS ACTOR_FLAG_22 -void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBombwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBombwall_Init(Actor* thisx, PlayState* play); +void BgBombwall_Destroy(Actor* thisx, PlayState* play); +void BgBombwall_Update(Actor* thisx, PlayState* play); +void BgBombwall_Draw(Actor* thisx, PlayState* play); -void func_8086ED50(BgBombwall* this, GlobalContext* globalCtx); -void func_8086ED70(BgBombwall* this, GlobalContext* globalCtx); -void func_8086EDFC(BgBombwall* this, GlobalContext* globalCtx); -void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx); -void func_8086EE94(BgBombwall* this, GlobalContext* globalCtx); +void func_8086ED50(BgBombwall* this, PlayState* play); +void func_8086ED70(BgBombwall* this, PlayState* play); +void func_8086EDFC(BgBombwall* this, PlayState* play); +void func_8086EE40(BgBombwall* this, PlayState* play); +void func_8086EE94(BgBombwall* this, PlayState* play); static ColliderTrisElementInit sTrisElementsInit[3] = { { @@ -82,14 +82,14 @@ const ActorInit Bg_Bombwall_InitVars = { NULL, }; -void BgBombwall_InitDynapoly(BgBombwall* this, GlobalContext* globalCtx) { +void BgBombwall_InitDynapoly(BgBombwall* this, PlayState* play) { s32 pad; s32 pad2; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gBgBombwallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -110,7 +110,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Init(Actor* thisx, PlayState* play) { s32 i; s32 j; Vec3f vecs[3]; @@ -123,13 +123,13 @@ void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, 0.1f); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { - func_8086EE94(this, globalCtx); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + func_8086EE94(this, play); } else { - BgBombwall_InitDynapoly(this, globalCtx); + BgBombwall_InitDynapoly(this, play); this->unk_2A2 |= 2; - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); for (i = 0; i <= 2; i++) { for (j = 0; j <= 2; j++) { @@ -147,36 +147,36 @@ void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { } this->unk_2A2 |= 1; - func_8086ED50(this, globalCtx); + func_8086ED50(this, play); } osSyncPrintf("(field keep 汎用爆弾壁)(arg_data 0x%04x)(angY %d)\n", this->dyna.actor.params, this->dyna.actor.shape.rot.y); } -void BgBombwall_DestroyCollision(BgBombwall* this, GlobalContext* globalCtx) { +void BgBombwall_DestroyCollision(BgBombwall* this, PlayState* play) { if (this->unk_2A2 & 2) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_2A2 &= ~2; } if (this->unk_2A2 & 1) { - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); this->unk_2A2 &= ~1; } } -void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Destroy(Actor* thisx, PlayState* play) { BgBombwall* this = (BgBombwall*)thisx; - BgBombwall_DestroyCollision(this, globalCtx); + BgBombwall_DestroyCollision(this, play); } static Vec3s D_8086F010[] = { { 40, 85, 21 }, { -43, 107, 14 }, { -1, 142, 14 }, { -27, 44, 27 }, { 28, 24, 20 }, { -39, 54, 21 }, { 49, 50, 20 }, }; -void func_8086EB5C(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EB5C(BgBombwall* this, PlayState* play) { s16 rand; s16 rand2; Vec3f sp88; @@ -195,43 +195,43 @@ void func_8086EB5C(BgBombwall* this, GlobalContext* globalCtx) { sp88.z = ((D_8086F010[i].z * cos) - (sin * D_8086F010[i].x)) + pos->z; rand = ((s16)(Rand_ZeroOne() * 120.0f)) + 0x14; rand2 = ((s16)(Rand_ZeroOne() * 240.0f)) + 0x14; - func_80033480(globalCtx, &sp88, 50.0f, 2, rand, rand2, 1); + func_80033480(play, &sp88, 50.0f, 2, rand, rand2, 1); } sp88.x = pos->x; new_var = pos->y + 90.0f; sp88.y = pos->y + 90.0f; sp88.z = pos->z + 15.0f; - func_80033480(globalCtx, &sp88, 40.0f, 4, 0xA, 0x32, 1); + func_80033480(play, &sp88, 40.0f, 4, 0xA, 0x32, 1); } -void func_8086ED50(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086ED50(BgBombwall* this, PlayState* play) { this->dList = gBgBombwallNormalDL; this->actionFunc = func_8086ED70; } -void func_8086ED70(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086ED70(BgBombwall* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - func_8086EDFC(this, globalCtx); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + func_8086EDFC(this, play); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_8086EDFC(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EDFC(BgBombwall* this, PlayState* play) { this->dList = gBgBombwallNormalDL; this->unk_2A0 = 1; - func_8086EB5C(this, globalCtx); + func_8086EB5C(this, play); this->actionFunc = func_8086EE40; } -void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EE40(BgBombwall* this, PlayState* play) { if (this->unk_2A0 > 0) { this->unk_2A0--; } else { - func_8086EE94(this, globalCtx); + func_8086EE94(this, play); if (((this->dyna.actor.params >> 0xF) & 1) != 0) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -239,22 +239,22 @@ void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx) { } } -void func_8086EE94(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EE94(BgBombwall* this, PlayState* play) { this->dList = gBgBombwallBrokenDL; - BgBombwall_DestroyCollision(this, globalCtx); + BgBombwall_DestroyCollision(this, play); this->actionFunc = NULL; } -void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Update(Actor* thisx, PlayState* play) { BgBombwall* this = (BgBombwall*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgBombwall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Draw(Actor* thisx, PlayState* play) { BgBombwall* this = (BgBombwall*)thisx; - Gfx_DrawDListOpa(globalCtx, this->dList); + Gfx_DrawDListOpa(play, this->dList); } diff --git a/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h b/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h index 68e17e028..f5c9cd2b5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h +++ b/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h @@ -6,7 +6,7 @@ struct BgBombwall; -typedef void (*BgBombwallActionFunc)(struct BgBombwall*, GlobalContext*); +typedef void (*BgBombwallActionFunc)(struct BgBombwall*, PlayState*); typedef struct BgBombwall { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 54ca9c641..cc5ebd060 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -12,16 +12,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBowlWall_Init(Actor* thisx, PlayState* play); +void BgBowlWall_Destroy(Actor* thisx, PlayState* play); +void BgBowlWall_Update(Actor* thisx, PlayState* play); +void BgBowlWall_Draw(Actor* thisx, PlayState* play); -void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_WaitForHit(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx); +void BgBowlWall_SpawnBullseyes(BgBowlWall* this, PlayState* play); +void BgBowlWall_WaitForHit(BgBowlWall* this, PlayState* play); +void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play); +void BgBowlWall_FinishFall(BgBowlWall* this, PlayState* play); +void BgBowlWall_Reset(BgBowlWall* this, PlayState* play); const ActorInit Bg_Bowl_Wall_InitVars = { ACTOR_BG_BOWL_WALL, @@ -45,7 +45,7 @@ static Vec3f sBullseyeOffset[] = { static s16 sTargetRot[] = { 0x0000, 0x0000, 0x3FFF, -0x3FFF }; -void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBowlWall_Init(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; s32 pad1; s32 pad2; @@ -59,7 +59,7 @@ void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gBowlingSecondRoundCol, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->initPos = this->dyna.actor.world.pos; osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n" VT_RST, this->dyna.actor.params); @@ -67,13 +67,13 @@ void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = 1.0f; } -void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBowlWall_Destroy(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_SpawnBullseyes(BgBowlWall* this, PlayState* play) { s32 pad; EnWallTubo* bullseye; Actor* lookForGirl; @@ -88,7 +88,7 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { this->bullseyeCenter.x = sBullseyeOffset[type].x + this->dyna.actor.world.pos.x; this->bullseyeCenter.y = sBullseyeOffset[type].y + this->dyna.actor.world.pos.y; this->bullseyeCenter.z = sBullseyeOffset[type].z + this->dyna.actor.world.pos.z; - bullseye = (EnWallTubo*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_WALL_TUBO, + bullseye = (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, this->bullseyeCenter.x, this->bullseyeCenter.y, this->bullseyeCenter.z, 0, 0, 0, this->dyna.actor.params); if (bullseye != NULL) { @@ -97,7 +97,7 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { bullseye->explosionCenter = this->bullseyeCenter = this->dyna.actor.world.pos; } if (this->chuGirl == NULL) { - lookForGirl = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + lookForGirl = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (lookForGirl != NULL) { if (lookForGirl->id != ACTOR_EN_BOM_BOWL_MAN) { lookForGirl = lookForGirl->next; @@ -111,13 +111,13 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_WaitForHit(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_WaitForHit(BgBowlWall* this, PlayState* play) { if (this->isHit) { this->actionFunc = BgBowlWall_FallDoEffects; } } -void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play) { s16 pad; Vec3f effectAccel = { 0.0f, 0.1f, 0.0f }; Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; @@ -146,12 +146,12 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) { effectPos.x = Rand_CenteredFloat(300.0f) + this->bullseyeCenter.x; effectPos.y = -100.0f; effectPos.z = Rand_CenteredFloat(400.0f) + this->bullseyeCenter.z; - EffectSsBomb2_SpawnLayered(globalCtx, &effectPos, &effectVelocity, &effectAccel, 100, 30); + EffectSsBomb2_SpawnLayered(play, &effectPos, &effectVelocity, &effectAccel, 100, 30); effectPos.y = -50.0f; - EffectSsHahen_SpawnBurst(globalCtx, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); } - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 300, 0, 0, 0); Quake_SetCountdown(quakeIndex, 30); @@ -160,7 +160,7 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_FinishFall(BgBowlWall* this, PlayState* play) { if (this->timer >= 2) { if (this->dyna.actor.params == 0) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 200, 0); @@ -175,7 +175,7 @@ void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_Reset(BgBowlWall* this, PlayState* play) { if (this->chuGirl->wallStatus[this->dyna.actor.params] != 2) { Math_ApproachF(&this->dyna.actor.world.pos.y, this->initPos.y, 0.3f, 50.0f); if (fabsf(this->dyna.actor.world.pos.y - this->initPos.y) <= 10.0f) { @@ -186,28 +186,28 @@ void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBowlWall_Update(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgBowlWall_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgBowlWall* this = (BgBowlWall*)thisx; u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x8, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, -2 * (frames = globalCtx->state.frames), 16, 16)); + Gfx_TexScroll(play->state.gfxCtx, 0, -2 * (frames = play->state.frames), 16, 16)); gDPPipeSync(POLY_OPA_DISP++); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { @@ -216,5 +216,5 @@ void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_OPA_DISP++, gBowlingRound2WallDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h b/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h index 0a5b7a512..12a4bdf3a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h +++ b/soh/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h @@ -7,7 +7,7 @@ struct BgBowlWall; -typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, GlobalContext*); +typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, PlayState*); typedef struct BgBowlWall { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 06e2f6ea4..7f498e764 100644 --- a/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -17,14 +17,14 @@ typedef struct { /* 0x08 */ s8 colType; } BombableWallInfo; -void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBreakwall_Init(Actor* thisx, PlayState* play); +void BgBreakwall_Destroy(Actor* thisx, PlayState* play); +void BgBreakwall_Update(Actor* thisx, PlayState* play); +void BgBreakwall_Draw(Actor* thisx, PlayState* play); -void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx); -void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx); -void BgBreakwall_LavaCoverMove(BgBreakwall* this, GlobalContext* globalCtx); +void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play); +void BgBreakwall_Wait(BgBreakwall* this, PlayState* play); +void BgBreakwall_LavaCoverMove(BgBreakwall* this, PlayState* play); const ActorInit Bg_Breakwall_InitVars = { ACTOR_BG_BREAKWALL, @@ -100,7 +100,7 @@ void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc this->actionFunc = actionFunc; } -void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Init(Actor* thisx, PlayState* play) { BgBreakwall* this = (BgBreakwall*)thisx; s32 pad; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; @@ -118,7 +118,7 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->bombableWallDList != NULL) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_Kill(&this->dyna.actor); return; } @@ -127,18 +127,18 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { // If "Blue Fire Arrows" are enabled, set up this collider for them if (blueFireArrowsEnabledOnMudwallLoad) { - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->dyna.actor, &sIceArrowQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->dyna.actor, &sIceArrowQuadInit); } else { - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->dyna.actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->dyna.actor, &sQuadInit); } } else { this->dyna.actor.world.pos.y -= 40.0f; } - this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_KINGDODONGO) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_BWALL); + this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO) + : Object_GetIndex(&play->objectCtx, OBJECT_BWALL); if (this->bankIndex < 0) { Actor_Kill(&this->dyna.actor); @@ -147,17 +147,17 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Destroy(Actor* thisx, PlayState* play) { BgBreakwall* this = (BgBreakwall*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } /** * Spawns fragments using ACTOR_EN_A_OBJ whenever the wall or floor is exploded. * Returns the last spawned actor */ -Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, Vec3f* pos, f32 velocity, f32 scaleY, +Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos, f32 velocity, f32 scaleY, f32 scaleX, s32 count, f32 accel) { Actor* actor; Vec3f actorPos; @@ -206,12 +206,12 @@ Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, V for (k = 3; k >= 0; k--) { Matrix_MultVec3f(&actorPosList[j][k], &actorPos); actor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_A_OBJ, Rand_CenteredFloat(20.0f) + actorPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_A_OBJ, Rand_CenteredFloat(20.0f) + actorPos.x, Rand_CenteredFloat(20.0f) + actorPos.y, Rand_CenteredFloat(20.0f) + actorPos.z, actorRotList[k].x, actorRotList[k].y + angle1, actorRotList[k].z, 0x000B); if ((j & 1) == 0) { - func_80033480(globalCtx, &actorPos, velocity * 200.0f, 1, 650, 150, 1); + func_80033480(play, &actorPos, velocity * 200.0f, 1, 650, 150, 1); } if (actor != NULL) { @@ -235,17 +235,17 @@ Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, V /** * Sets up the collision model as well is the object dependency and action function to use. */ -void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { +void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { CollisionHeader* colHeader = NULL; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; this->dyna.actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); this->dyna.actor.flags &= ~ACTOR_FLAG_4; this->dyna.actor.draw = BgBreakwall_Draw; CollisionHeader_GetVirtual(sBombableWallInfo[wallType].colHeader, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (wallType == BWALL_KD_LAVA_COVER) { BgBreakwall_SetupAction(this, BgBreakwall_LavaCoverMove); @@ -259,7 +259,7 @@ void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx) { * Checks for an explosion using quad collision. If the wall or floor is exploded then it will spawn fragments and * despawn itself. */ -void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { +void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) { bool blueFireArrowHit = false; // If "Blue Fire Arrows" enabled, check this collider for a hit if (blueFireArrowsEnabledOnMudwallLoad) { @@ -278,7 +278,7 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { Vec3f effectPos; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); effectPos.y = effectPos.z = effectPos.x = 0.0f; if (this->dyna.actor.world.rot.x == 0) { @@ -288,8 +288,8 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { effectPos.y = -10.0f; } - BgBreakwall_SpawnFragments(globalCtx, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + BgBreakwall_SpawnFragments(play, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); if (wallType == BWALL_KD_FLOOR) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_EXPLOSION); @@ -299,10 +299,10 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { if ((wallType == BWALL_DC_ENTRANCE) && (!(Flags_GetEventChkInf(0xB0)))) { Flags_SetEventChkInf(0xB0); - Cutscene_SetSegment(globalCtx, gDcOpeningCs); + Cutscene_SetSegment(play, gDcOpeningCs); gSaveContext.cutsceneTrigger = 1; Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - func_8002DF54(globalCtx, NULL, 0x31); + func_8002DF54(play, NULL, 0x31); } if (this->dyna.actor.params < 0) { @@ -317,14 +317,14 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { * Moves the actor's y position to cover the lava floor in King Dodongo's lair after he is defeated so the player is no * longer hurt by the lava. */ -void BgBreakwall_LavaCoverMove(BgBreakwall* this, GlobalContext* globalCtx) { +void BgBreakwall_LavaCoverMove(BgBreakwall* this, PlayState* play) { Math_StepToF(&this->dyna.actor.world.pos.y, KREG(80) + this->dyna.actor.home.pos.y, 1.0f); } -void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Update(Actor* thisx, PlayState* play) { BgBreakwall* this = (BgBreakwall*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } /** @@ -336,15 +336,15 @@ static Vec3f sColQuadList[][4] = { { { 10.0f, 0.0f, 10.0f }, { -10.0f, 0.0f, 10.0f }, { 10.0f, 0.0f, -10.0f }, { -10.0f, 0.0f, -10.0f } }, }; -void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Draw(Actor* thisx, PlayState* play) { s32 pad; BgBreakwall* this = (BgBreakwall*)thisx; if (this->bombableWallDList != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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++, this->bombableWallDList); @@ -359,9 +359,9 @@ void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) { } Collider_SetQuadVertices(&this->collider, &colQuad[0], &colQuad[1], &colQuad[2], &colQuad[3]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h b/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h index 43fd4ee93..022a439f2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h +++ b/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h @@ -6,7 +6,7 @@ struct BgBreakwall; -typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, GlobalContext*); +typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, PlayState*); typedef struct BgBreakwall { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c b/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c index f256c6e6e..5ee57a0d4 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c +++ b/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDdanJd_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDdanJd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDdanJd_Init(Actor* thisx, PlayState* play); +void BgDdanJd_Destroy(Actor* thisx, PlayState* play); +void BgDdanJd_Update(Actor* thisx, PlayState* play); +void BgDdanJd_Draw(Actor* thisx, PlayState* play); -void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx); -void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx); +void BgDdanJd_Idle(BgDdanJd* this, PlayState* play); +void BgDdanJd_Move(BgDdanJd* this, PlayState* play); const ActorInit Bg_Ddan_Jd_InitVars = { ACTOR_BG_DDAN_JD, @@ -51,7 +51,7 @@ typedef enum { #define DEFAULT_Y_SPEED 1 #define SHORTCUT_Y_SPEED 5 -void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanJd_Init(Actor* thisx, PlayState* play) { s32 pad; BgDdanJd* this = (BgDdanJd*)thisx; CollisionHeader* colHeader = NULL; @@ -59,14 +59,14 @@ void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gDodongoRisingPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->idleTimer = IDLE_FRAMES; this->state = STATE_GO_BOTTOM; // Missing check for actor.params < 0x40. This will cause inconsistent behavior if params >= 0x40 and the bound // switch state is turned on while in the same room, as the shortcut behavior won't become enabled until the actor // is reloaded. - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + if (Flags_GetSwitch(play, this->dyna.actor.params)) { this->ySpeed = SHORTCUT_Y_SPEED; } else { this->ySpeed = DEFAULT_Y_SPEED; @@ -74,25 +74,25 @@ void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgDdanJd_Idle; } -void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanJd_Destroy(Actor* thisx, PlayState* play) { BgDdanJd* this = (BgDdanJd*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx) { +void BgDdanJd_Idle(BgDdanJd* this, PlayState* play) { if (this->idleTimer != 0) { this->idleTimer--; } // if this is the platform that rises all the way to the top, and the switch state has just changed to on if (this->ySpeed == DEFAULT_Y_SPEED && this->dyna.actor.params < 0x40 && - Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + Flags_GetSwitch(play, this->dyna.actor.params)) { this->ySpeed = SHORTCUT_Y_SPEED; this->state = STATE_GO_MIDDLE_FROM_BOTTOM; this->idleTimer = 0; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE; - OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3060, -99, &this->dyna.actor, MAIN_CAM); } if (this->idleTimer == 0) { this->idleTimer = IDLE_FRAMES; @@ -126,25 +126,25 @@ void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx) { } // Handles dust particles and sfx when moving -void BgDdanJd_MoveEffects(BgDdanJd* this, GlobalContext* globalCtx) { +void BgDdanJd_MoveEffects(BgDdanJd* this, PlayState* play) { Vec3f dustPos; // Generate random dust particles at the platform's base. dustPos.y = this->dyna.actor.home.pos.y; - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { dustPos.x = this->dyna.actor.world.pos.x + 65.0f; dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); dustPos.x = this->dyna.actor.world.pos.x - 65.0f; dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); } else { dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.x; dustPos.z = this->dyna.actor.world.pos.z + 65.0f; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.x; dustPos.z = this->dyna.actor.world.pos.z - 65.0f; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); } if (this->ySpeed == SHORTCUT_Y_SPEED) { func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); @@ -152,29 +152,29 @@ void BgDdanJd_MoveEffects(BgDdanJd* this, GlobalContext* globalCtx) { } // Implements the platform's movement state -void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx) { +void BgDdanJd_Move(BgDdanJd* this, PlayState* play) { // if this is the platform that rises all the way to the top, and the switch state has just changed to on if (this->ySpeed == DEFAULT_Y_SPEED && this->dyna.actor.params < 0x40 && - Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + Flags_GetSwitch(play, this->dyna.actor.params)) { this->ySpeed = SHORTCUT_Y_SPEED; this->state = STATE_GO_MIDDLE_FROM_BOTTOM; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE; this->idleTimer = 0; this->actionFunc = BgDdanJd_Idle; - OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3060, -99, &this->dyna.actor, MAIN_CAM); } else if (Math_StepToF(&this->dyna.actor.world.pos.y, this->targetY, this->ySpeed)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_PILLAR_MOVE_STOP); this->actionFunc = BgDdanJd_Idle; } - BgDdanJd_MoveEffects(this, globalCtx); + BgDdanJd_MoveEffects(this, play); } -void BgDdanJd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanJd_Update(Actor* thisx, PlayState* play) { BgDdanJd* this = (BgDdanJd*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgDdanJd_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gDodongoRisingPlatformDL); +void BgDdanJd_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gDodongoRisingPlatformDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h b/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h index 33ab8be8a..649765794 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h +++ b/soh/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h @@ -6,7 +6,7 @@ struct BgDdanJd; -typedef void (*BgDdanJdActionFunc)(struct BgDdanJd*, GlobalContext*); +typedef void (*BgDdanJdActionFunc)(struct BgDdanJd*, PlayState*); typedef struct BgDdanJd { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index 9ca8599b9..5ee73ba2a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -9,15 +9,15 @@ #define FLAGS ACTOR_FLAG_4 -void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDdanKd_Init(Actor* thisx, PlayState* play); +void BgDdanKd_Destroy(Actor* thisx, PlayState* play); +void BgDdanKd_Update(Actor* thisx, PlayState* play); +void BgDdanKd_Draw(Actor* thisx, PlayState* play); void BgDdanKd_Reset(void); -void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx); -void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx); -void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx); +void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play); +void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play); +void BgDdanKd_DoNothing(BgDdanKd* this, PlayState* play); const ActorInit Bg_Ddan_Kd_InitVars = { ACTOR_BG_DDAN_KD, @@ -63,7 +63,7 @@ void BgDdanKd_SetupAction(BgDdanKd* this, BgDdanKdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanKd_Init(Actor* thisx, PlayState* play) { BgDdanKd* this = (BgDdanKd*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -72,13 +72,13 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); CollisionHeader_GetVirtual(&gDodongoFallingStairsCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params)) { BgDdanKd_SetupAction(this, BgDdanKd_CheckForExplosions); } else { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 200.0f - 20.0f; @@ -86,17 +86,17 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanKd_Destroy(Actor* thisx, PlayState* play) { BgDdanKd* this = (BgDdanKd*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } -void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { +void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play) { Actor* explosive; - explosive = Actor_GetCollidedExplosive(globalCtx, &this->collider.base); + explosive = Actor_GetCollidedExplosive(play, &this->collider.base); if (explosive != NULL) { osSyncPrintf("dam %d\n", this->dyna.actor.colChkInfo.damage); explosive->params = 2; @@ -105,7 +105,7 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) && (Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) { BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs); - OnePointCutscene_Init(globalCtx, 3050, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3050, 999, &this->dyna.actor, MAIN_CAM); } else { if (this->timer != 0) { this->timer--; @@ -117,14 +117,14 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { } } Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } Vec3f sBgDdanKdVelocity = { 0.0f, 5.0f, 0.0f }; Vec3f sBgDdanKdAccel = { 0.0f, -0.45f, 0.0f }; -void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { +void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) { Vec3f pos1; Vec3f pos2; f32 effectStrength; @@ -134,16 +134,16 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 200.0f - 20.0f, 0.075f, this->dyna.actor.speedXZ, 0.0075f) == 0.0f) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params); + Flags_SetSwitch(play, this->dyna.actor.params); BgDdanKd_SetupAction(this, BgDdanKd_DoNothing); } else { effectStrength = (this->dyna.actor.prevPos.y - this->dyna.actor.world.pos.y) + (this->dyna.actor.speedXZ * 0.25f); - if (globalCtx->state.frames & 1) { + if (play->state.frames & 1) { pos1 = pos2 = this->dyna.actor.world.pos; - if (globalCtx->state.frames & 2) { + if (play->state.frames & 2) { pos1.z += 210.0f + Rand_ZeroOne() * 230.0f; pos2.z += 210.0f + Rand_ZeroOne() * 230.0f; } else { @@ -155,40 +155,40 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { pos1.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne(); pos2.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne(); - func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); - func_80033480(globalCtx, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1); + func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); + func_80033480(play, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1); sBgDdanKdVelocity.x = Rand_CenteredFloat(3.0f); sBgDdanKdVelocity.z = Rand_CenteredFloat(3.0f); - func_8003555C(globalCtx, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel); - func_8003555C(globalCtx, &pos2, &sBgDdanKdVelocity, &sBgDdanKdAccel); + func_8003555C(play, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel); + func_8003555C(play, &pos2, &sBgDdanKdVelocity, &sBgDdanKdAccel); pos1 = this->dyna.actor.world.pos; pos1.z += 560.0f + Rand_ZeroOne() * 5.0f; pos1.x += (Rand_ZeroOne() - 0.5f) * 160.0f; pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f); - func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); - func_8003555C(globalCtx, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel); + func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); + func_8003555C(play, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel); } - Camera_AddQuake(&globalCtx->mainCamera, 0, effectStrength * 0.6f, 3); + Camera_AddQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3); Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } -void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx) { +void BgDdanKd_DoNothing(BgDdanKd* this, PlayState* play) { } -void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanKd_Update(Actor* thisx, PlayState* play) { BgDdanKd* this = (BgDdanKd*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gDodongoFallingStairsDL); +void BgDdanKd_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gDodongoFallingStairsDL); } void BgDdanKd_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h b/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h index 12048002b..2e80b64cb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h +++ b/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h @@ -6,7 +6,7 @@ struct BgDdanKd; -typedef void (*BgDdanKdActionFunc)(struct BgDdanKd*, GlobalContext*); +typedef void (*BgDdanKdActionFunc)(struct BgDdanKd*, PlayState*); typedef struct BgDdanKd { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 08eaed27b..42375931b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -10,16 +10,16 @@ #define FLAGS 0 -void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDodoago_Init(Actor* thisx, PlayState* play); +void BgDodoago_Destroy(Actor* thisx, PlayState* play); +void BgDodoago_Update(Actor* thisx, PlayState* play); +void BgDodoago_Draw(Actor* thisx, PlayState* play); void BgDodoago_Reset(void); -void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx); -void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx); -void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx); -void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx); +void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play); +void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play); +void BgDodoago_DoNothing(BgDodoago* this, PlayState* play); +void BgDodoago_LightOneEye(BgDodoago* this, PlayState* play); const ActorInit Bg_Dodoago_InitVars = { ACTOR_BG_DODOAGO, @@ -86,7 +86,7 @@ void BgDodoago_SetupAction(BgDodoago* this, BgDodoagoActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgDodoago_SpawnSparkles(Vec3f* meanPos, GlobalContext* globalCtx) { +void BgDodoago_SpawnSparkles(Vec3f* meanPos, PlayState* play) { Vec3f pos; Color_RGBA8 primColor = { 100, 100, 100, 0 }; Color_RGBA8 envColor = { 40, 40, 40, 0 }; @@ -98,7 +98,7 @@ void BgDodoago_SpawnSparkles(Vec3f* meanPos, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + meanPos->x; pos.y = Rand_CenteredFloat(10.0f) + meanPos->y; pos.z = Rand_CenteredFloat(20.0f) + meanPos->z; - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &acceleration, &primColor, &envColor); + EffectSsKiraKira_SpawnSmall(play, &pos, &velocity, &acceleration, &primColor, &envColor); } } @@ -109,7 +109,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDodoago_Init(Actor* thisx, PlayState* play) { BgDodoago* this = (BgDodoago*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -117,38 +117,38 @@ void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDodongoLowerJawCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { BgDodoago_SetupAction(this, BgDodoago_DoNothing); this->dyna.actor.shape.rot.x = 0x1333; - globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255; + play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255; return; } - Collider_InitCylinder(globalCtx, &this->colliderMain); - Collider_InitCylinder(globalCtx, &this->colliderLeft); - Collider_InitCylinder(globalCtx, &this->colliderRight); - Collider_SetCylinder(globalCtx, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain); - Collider_SetCylinder(globalCtx, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight); - Collider_SetCylinder(globalCtx, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight); + Collider_InitCylinder(play, &this->colliderMain); + Collider_InitCylinder(play, &this->colliderLeft); + Collider_InitCylinder(play, &this->colliderRight); + Collider_SetCylinder(play, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain); + Collider_SetCylinder(play, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight); + Collider_SetCylinder(play, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight); BgDodoago_SetupAction(this, BgDodoago_WaitExplosives); sBgDodoagoDisableBombCatcher = false; } -void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDodoago_Destroy(Actor* thisx, PlayState* play) { BgDodoago* this = (BgDodoago*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->colliderMain); - Collider_DestroyCylinder(globalCtx, &this->colliderLeft); - Collider_DestroyCylinder(globalCtx, &this->colliderRight); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->colliderMain); + Collider_DestroyCylinder(play, &this->colliderLeft); + Collider_DestroyCylinder(play, &this->colliderRight); } -void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) { - Actor* explosive = Actor_GetCollidedExplosive(globalCtx, &this->colliderMain.base); +void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) { + Actor* explosive = Actor_GetCollidedExplosive(play, &this->colliderMain.base); if (explosive != NULL) { this->state = @@ -156,19 +156,19 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) { ? BGDODOAGO_EYE_RIGHT : BGDODOAGO_EYE_LEFT; - if (((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) || - ((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + if (((play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) || + ((play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) { + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); this->state = 0; Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); BgDodoago_SetupAction(this, BgDodoago_OpenJaw); - OnePointCutscene_Init(globalCtx, 3380, 160, &this->dyna.actor, MAIN_CAM); - } else if (globalCtx->roomCtx.unk_74[this->state] == 0) { - OnePointCutscene_Init(globalCtx, 3065, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3380, 160, &this->dyna.actor, MAIN_CAM); + } else if (play->roomCtx.unk_74[this->state] == 0) { + OnePointCutscene_Init(play, 3065, 40, &this->dyna.actor, MAIN_CAM); BgDodoago_SetupAction(this, BgDodoago_LightOneEye); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { - OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3065, 20, &this->dyna.actor, MAIN_CAM); Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); sBgDodoagoTimer += 30; return; @@ -194,13 +194,13 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) { this->colliderRight.dim.pos.z += 215; this->colliderRight.dim.pos.x -= 90; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderMain.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderLeft.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderRight.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderMain.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderLeft.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderRight.base); } } -void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { +void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play) { Vec3f pos; Vec3f dustOffsets[] = { { 0.0f, -200.0f, 430.0f }, { 20.0f, -200.0f, 420.0f }, { -20.0f, -200.0f, 420.0f }, @@ -211,14 +211,14 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { s32 i; // make both eyes red (one already is) - if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] < 255) { - globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] += 5; + if (play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] < 255) { + play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] += 5; } - if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] < 255) { - globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] += 5; + if (play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] < 255) { + play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] += 5; } - if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) { + if (play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) { sBgDodoagoTimer--; return; } @@ -228,19 +228,19 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { pos.x = dustOffsets[i].x + this->dyna.actor.world.pos.x; pos.y = dustOffsets[i].y + this->dyna.actor.world.pos.y; pos.z = dustOffsets[i].z + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 2.0f, 3, 200, 75, 1); + func_80033480(play, &pos, 2.0f, 3, 200, 75, 1); } } pos.x = this->dyna.actor.world.pos.x + 200.0f; pos.y = this->dyna.actor.world.pos.y - 20.0f; pos.z = this->dyna.actor.world.pos.z + 100.0f; - BgDodoago_SpawnSparkles(&pos, globalCtx); + BgDodoago_SpawnSparkles(&pos, play); pos.x = this->dyna.actor.world.pos.x - 200.0f; pos.y = this->dyna.actor.world.pos.y - 20.0f; pos.z = this->dyna.actor.world.pos.z + 100.0f; - BgDodoago_SpawnSparkles(&pos, globalCtx); + BgDodoago_SpawnSparkles(&pos, play); Math_StepToS(&this->state, 100, 3); func_800AA000(500.0f, 0x78, 0x14, 0xA); @@ -255,18 +255,18 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { } } -void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx) { +void BgDodoago_DoNothing(BgDodoago* this, PlayState* play) { } -void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx) { - globalCtx->roomCtx.unk_74[this->state] += 5; +void BgDodoago_LightOneEye(BgDodoago* this, PlayState* play) { + play->roomCtx.unk_74[this->state] += 5; - if (globalCtx->roomCtx.unk_74[this->state] == 255) { + if (play->roomCtx.unk_74[this->state] == 255) { BgDodoago_SetupAction(this, BgDodoago_WaitExplosives); } } -void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDodoago_Update(Actor* thisx, PlayState* play) { BgDodoago* this = (BgDodoago*)thisx; Actor* actor; EnBom* bomb; @@ -295,9 +295,9 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) { } } else { sBgDodoagoTimer++; - Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_GetSwitch(play, this->dyna.actor.params & 0x3F); if (!sBgDodoagoDisableBombCatcher && sBgDodoagoTimer > 140) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { // this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher sBgDodoagoDisableBombCatcher++; } else { @@ -305,20 +305,20 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) { } } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgDodoago_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); if (Flags_GetEventChkInf(0xB0)) { - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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++, gDodongoLowerJawDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void BgDodoago_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h b/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h index 9729162f8..02603c6d0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h +++ b/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h @@ -11,7 +11,7 @@ typedef enum { struct BgDodoago; -typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, GlobalContext*); +typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, PlayState*); typedef struct BgDodoago { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 85d84c759..635afbd5d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -26,32 +26,32 @@ typedef enum { /* 2 */ FAIRY_SPELL_NAYRUS_LOVE } BgDyYoseizoSpellType; -void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDyYoseizo_Init(Actor* thisx, PlayState* play); +void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play); +void BgDyYoseizo_Update(Actor* thisx, PlayState* play); +void BgDyYoseizo_Draw(Actor* thisx, PlayState* play); -void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_Vanish(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx); +void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play); void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel, Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type); -void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx); +void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, PlayState* play); static s32 sUnusedGetItemIds[] = { GI_FARORES_WIND, GI_NAYRUS_LOVE, GI_DINS_FIRE }; @@ -68,24 +68,24 @@ const ActorInit Bg_Dy_Yoseizo_InitVars = { NULL, }; -void GivePlayerRandoRewardGreatFairy(BgDyYoseizo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->fountainType + 1, GI_NONE); +void GivePlayerRandoRewardGreatFairy(BgDyYoseizo* this, PlayState* play) { + Player* player = GET_PLAYER(play); + GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, play->sceneNum, this->fountainType + 1, GI_NONE); - if (this->actor.parent == GET_PLAYER(globalCtx) && !Flags_GetTreasure(globalCtx, this->fountainType + 1) && - !Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) { - Flags_SetTreasure(globalCtx, this->fountainType + 1); + if (this->actor.parent == GET_PLAYER(play) && !Flags_GetTreasure(play, this->fountainType + 1) && + !Player_InBlockingCsMode(play, GET_PLAYER(play))) { + Flags_SetTreasure(play, this->fountainType + 1); Actor_Kill(&this->actor); - } else if (!Flags_GetTreasure(globalCtx, this->fountainType + 1)) { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 100.0f); + } else if (!Flags_GetTreasure(play, this->fountainType + 1)) { + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 100.0f); } } -void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgDyYoseizo* this = (BgDyYoseizo*)thisx; - this->fountainType = globalCtx->curSpawn; + this->fountainType = play->curSpawn; if (this->fountainType < 0) { this->fountainType = 0; @@ -95,21 +95,21 @@ void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->grownHeight = this->vanishHeight + 40.0f; this->actor.focus.pos = this->actor.world.pos; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { // "Great Fairy Fountain" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, globalCtx->curSpawn); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->curSpawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, this->jointTable, this->morphTable, 28); } else { // "Stone/Jewel Fairy Fountain" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, globalCtx->curSpawn); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->curSpawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, this->jointTable, this->morphTable, 28); } this->actionFunc = BgDyYoseizo_CheckMagicAcquired; } -void BgDyYoseizo_Destroy(Actor* this, GlobalContext* globalCtx) { +void BgDyYoseizo_Destroy(Actor* this, PlayState* play) { } static Color_RGB8 sParticlePrimColors[] = { @@ -122,7 +122,7 @@ static Color_RGB8 sParticleEnvColors[] = { { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 100, 255, 255 }, }; -void BgDyYoseizo_SpawnParticles(BgDyYoseizo* this, GlobalContext* globalCtx, s16 type) { +void BgDyYoseizo_SpawnParticles(BgDyYoseizo* this, PlayState* play, s16 type) { Vec3f particleInitVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f particleAccel; Vec3f particleInitPos; @@ -154,7 +154,7 @@ void BgDyYoseizo_SpawnParticles(BgDyYoseizo* this, GlobalContext* globalCtx, s16 particleScale = 0.2f; particleInitPos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { particleInitPos.y = this->actor.world.pos.y + spawnPosVariation + 50.0f + ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f)); particleInitPos.z = this->actor.world.pos.z + 30.0f; @@ -181,34 +181,34 @@ void BgDyYoseizo_SpawnParticles(BgDyYoseizo* this, GlobalContext* globalCtx, s16 } } -void BgDyYoseizo_Bob(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_Bob(BgDyYoseizo* this, PlayState* play) { this->targetHeight = this->grownHeight + this->bobOffset; Math_ApproachF(&this->actor.world.pos.y, this->targetHeight, 0.1f, 10.0f); Math_ApproachF(&this->bobOffset, 10.0f, 0.1f, 0.5f); - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actor.velocity.y = Math_SinS(this->bobTimer); } else { this->actor.velocity.y = Math_SinS(this->bobTimer) * 0.4f; } } -void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, 0x38)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; +void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) { + if (Flags_GetSwitch(play, 0x38)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; if(gSaveContext.n64ddFlag) { gSaveContext.healthAccumulator = 0x140; - Magic_Fill(globalCtx); - if(Flags_GetTreasure(globalCtx, this->fountainType + 1)) { + Magic_Fill(play); + if(Flags_GetTreasure(play, this->fountainType + 1)) { Actor_Kill(&this->actor); } else { - GivePlayerRandoRewardGreatFairy(this, globalCtx); + GivePlayerRandoRewardGreatFairy(this, play); } return; } - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { if (!gSaveContext.magicAcquired && (this->fountainType != FAIRY_UPGRADE_MAGIC)) { Actor_Kill(&this->actor); return; @@ -219,20 +219,20 @@ void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, GlobalContext* globalCtx) return; } } - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = BgDyYoseizo_ChooseType; } } -void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { s32 givingReward; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); // "Mode" - osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, globalCtx->msgCtx.ocarinaMode); + osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); givingReward = false; - if (globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum != SCENE_DAIYOUSEI_IZUMI) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: if (!(gSaveContext.itemGetInf[1] & 0x100)) { @@ -281,33 +281,33 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { if (givingReward) { if (gSaveContext.sceneSetupIndex < 4) { - if (globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum != SCENE_DAIYOUSEI_IZUMI) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyFaroresWindCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyFaroresWindCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_SPELL_DINS_FIRE: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDinsFireCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDinsFireCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_SPELL_NAYRUS_LOVE: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyNayrusLoveCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyNayrusLoveCs); gSaveContext.cutsceneTrigger = 1; break; } } else { switch (this->fountainType) { case FAIRY_UPGRADE_MAGIC: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyMagicCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyMagicCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_UPGRADE_DOUBLE_MAGIC: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleMagicCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleMagicCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_UPGRADE_HALF_DAMAGE: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleDefenceCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleDefenceCs); gSaveContext.cutsceneTrigger = 1; break; } @@ -317,12 +317,12 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { return; } - globalCtx->envCtx.unk_BF = 2; + play->envCtx.unk_BF = 2; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { - OnePointCutscene_Init(globalCtx, 8603, -99, NULL, MAIN_CAM); + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + OnePointCutscene_Init(play, 8603, -99, NULL, MAIN_CAM); } else { - OnePointCutscene_Init(globalCtx, 8604, -99, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 8604, -99, NULL, MAIN_CAM); }; Audio_PlayActorSound2(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); @@ -331,8 +331,8 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { } // Sets animations for spingrow -void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { +void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -343,12 +343,12 @@ void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* global } Audio_PlayActorSound2(&this->actor, NA_SE_VO_FR_LAUGH_0); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = BgDyYoseizo_SpinGrow_NoReward; } -void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 1); +void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { + func_8002DF54(play, &this->actor, 1); Math_ApproachF(&this->actor.world.pos.y, this->grownHeight, this->heightFraction, 100.0f); Math_ApproachF(&this->scale, 0.035f, this->scaleFraction, 0.005f); Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f); @@ -368,13 +368,13 @@ void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) } else { this->actor.shape.rot.y += 3000; } - BgDyYoseizo_SpawnParticles(this, globalCtx, 0); + BgDyYoseizo_SpawnParticles(this, play, 0); } -void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); if ((this->frameCount * 1273.0f) <= this->bobTimer) { this->bobTimer = 0.0f; @@ -387,10 +387,10 @@ void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* glo } } -void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 1); +void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + func_8002DF54(play, &this->actor, 1); - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -402,13 +402,13 @@ void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* glo this->actor.textId = 0xDB; this->dialogState = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); - BgDyYoseizo_SpawnParticles(this, globalCtx, 0); + Message_StartTextbox(play, this->actor.textId, NULL); + BgDyYoseizo_SpawnParticles(this, play, 0); this->actionFunc = BgDyYoseizo_GreetPlayer_NoReward; } -void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 1); +void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + func_8002DF54(play, &this->actor, 1); this->bobTimer = this->skelAnime.curFrame * 1273.0f; if ((this->frameCount * 1273.0f) <= this->bobTimer) { @@ -417,18 +417,18 @@ void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCt SkelAnime_Update(&this->skelAnime); - if ((this->dialogState == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); Interface_ChangeAlpha(5); this->actionFunc = BgDyYoseizo_SetupHealPlayer_NoReward; } - BgDyYoseizo_Bob(this, globalCtx); - BgDyYoseizo_SpawnParticles(this, globalCtx, 0); + BgDyYoseizo_Bob(this, play); + BgDyYoseizo_SpawnParticles(this, play, 0); } -void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { +void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -443,8 +443,8 @@ void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* glob this->actionFunc = BgDyYoseizo_HealPlayer_NoReward; } -void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; Vec3f beamPos; s16 beamParams; @@ -458,7 +458,7 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx SkelAnime_Update(&this->skelAnime); if ((this->frameCount <= curFrame) && !(this->animationChanged)) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -474,10 +474,10 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx beamPos.y = player->actor.world.pos.y + 200.0f; beamPos.z = player->actor.world.pos.z; - beamParams = ((globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) ? 0 : 1); + beamParams = ((play->sceneNum == SCENE_DAIYOUSEI_IZUMI) ? 0 : 1); this->beam = - (EnDyExtra*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DY_EXTRA, + (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA, beamPos.x, beamPos.y, beamPos.z, 0, 0, 0, beamParams); } } @@ -491,7 +491,7 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx if (this->healingTimer == 110) { gSaveContext.healthAccumulator = 0x140; - Magic_Fill(globalCtx); + Magic_Fill(play); this->refillTimer = 200; } @@ -509,14 +509,14 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx if (this->healingTimer == 1) { this->actor.textId = 0xDA; this->dialogState = TEXT_STATE_EVENT; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = BgDyYoseizo_SayFarewell_NoReward; return; } - BgDyYoseizo_Bob(this, globalCtx); + BgDyYoseizo_Bob(this, play); } -void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, PlayState* play) { this->bobTimer = this->skelAnime.curFrame * 1400.0f; if (this->bobTimer >= (this->frameCount * 1400.0f)) { @@ -525,19 +525,19 @@ void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCt SkelAnime_Update(&this->skelAnime); - if ((this->dialogState == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->mouthState = 0; this->actionFunc = BgDyYoseizo_SetupSpinShrink; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } - BgDyYoseizo_Bob(this, globalCtx); - BgDyYoseizo_SpawnParticles(this, globalCtx, 0); + BgDyYoseizo_Bob(this, play); + BgDyYoseizo_SpawnParticles(this, play, 0); } -void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { +void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, PlayState* play) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim); Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -555,7 +555,7 @@ void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { this->actionFunc = BgDyYoseizo_SpinShrink; } -void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->vanishTimer == 0) { if (this->scale < 0.003f) { @@ -567,18 +567,18 @@ void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f); Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f); this->actor.shape.rot.y += 3000; - BgDyYoseizo_SpawnParticles(this, globalCtx, 0); + BgDyYoseizo_SpawnParticles(this, play, 0); } } } -void BgDyYoseizo_Vanish(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play) { Actor* findOcarinaSpot; if (this->vanishTimer == 0) { - func_8002DF54(globalCtx, &this->actor, 7); - globalCtx->envCtx.unk_BF = 0; - findOcarinaSpot = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + func_8002DF54(play, &this->actor, 7); + play->envCtx.unk_BF = 0; + findOcarinaSpot = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (findOcarinaSpot != NULL) { if (findOcarinaSpot->id != ACTOR_EN_OKARINA_TAG) { @@ -589,19 +589,19 @@ void BgDyYoseizo_Vanish(BgDyYoseizo* this, GlobalContext* globalCtx) { break; } - Flags_UnsetSwitch(globalCtx, 0x38); + Flags_UnsetSwitch(play, 0x38); Actor_Kill(&this->actor); } } -void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[0] != NULL) && (globalCtx->csCtx.npcActions[0]->action == 2)) { +void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[0] != NULL) && (play->csCtx.npcActions[0]->action == 2)) { this->actor.draw = BgDyYoseizo_Draw; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->finishedSpinGrow = false; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -617,7 +617,7 @@ void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, GlobalContext* globalCt } } -void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (!this->finishedSpinGrow) { @@ -644,7 +644,7 @@ void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* glob SkelAnime_Update(&this->skelAnime); if ((this->frameCount <= curFrame) && !this->animationChanged) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -656,10 +656,10 @@ void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* glob this->animationChanged = true; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && - ((globalCtx->csCtx.npcActions[0] != NULL) && (globalCtx->csCtx.npcActions[0]->action == 3))) { + if ((play->csCtx.state != CS_STATE_IDLE) && + ((play->csCtx.npcActions[0] != NULL) && (play->csCtx.npcActions[0]->action == 3))) { this->finishedSpinGrow = this->animationChanged = false; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -672,7 +672,7 @@ void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* glob this->actionFunc = BgDyYoseizo_Give_Reward; } } - BgDyYoseizo_SpawnParticles(this, globalCtx, 0); + BgDyYoseizo_SpawnParticles(this, play, 0); } static s16 sDemoEffectLightColors[] = { DEMO_EFFECT_LIGHT_GREEN, DEMO_EFFECT_LIGHT_RED, DEMO_EFFECT_LIGHT_BLUE }; @@ -683,9 +683,9 @@ static s16 sItemGetFlags[] = { 0x100, 0x200, 0x400 }; static u8 sItemIds[] = { ITEM_FARORES_WIND, ITEM_DINS_FIRE, ITEM_NAYRUS_LOVE }; -void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 actionIndex; s16 demoEffectParams; Vec3f itemPos; @@ -699,7 +699,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((this->frameCount <= curFrame) && !this->animationChanged) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -711,30 +711,30 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { this->animationChanged = true; } - if (globalCtx->csCtx.npcActions[0]->action == 13) { + if (play->csCtx.npcActions[0]->action == 13) { this->actionFunc = BgDyYoseizo_SetupSpinShrink; return; } - if ((globalCtx->csCtx.npcActions[0]->action >= 4) && (globalCtx->csCtx.npcActions[0]->action < 7)) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 4; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if ((play->csCtx.npcActions[0]->action >= 4) && (play->csCtx.npcActions[0]->action < 7)) { + actionIndex = play->csCtx.npcActions[0]->action - 4; + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { actionIndex++; - BgDyYoseizo_SpawnParticles(this, globalCtx, actionIndex); + BgDyYoseizo_SpawnParticles(this, play, actionIndex); } else if (!this->lightBallSpawned) { demoEffectParams = ((s16)(sDemoEffectLightColors[actionIndex] << 0xC) | DEMO_EFFECT_LIGHT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, (s32)demoEffectParams); this->lightBallSpawned = true; } } else { - BgDyYoseizo_SpawnParticles(this, globalCtx, 0); + BgDyYoseizo_SpawnParticles(this, play, 0); } - if ((globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action >= 10) && - (globalCtx->csCtx.npcActions[0]->action < 13)) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 10; + if ((play->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action >= 10) && + (play->csCtx.npcActions[0]->action < 13)) { + actionIndex = play->csCtx.npcActions[0]->action - 10; switch (actionIndex) { case FAIRY_UPGRADE_MAGIC: @@ -761,14 +761,14 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { gSaveContext.healthAccumulator = 0x140; this->healing = true; if (actionIndex == 2) { - Magic_Fill(globalCtx); + Magic_Fill(play); } } } - if ((globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action >= 14) && - (globalCtx->csCtx.npcActions[0]->action < 17)) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 14; + if ((play->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action >= 14) && + (play->csCtx.npcActions[0]->action < 17)) { + actionIndex = play->csCtx.npcActions[0]->action - 14; if (!this->itemSpawned) { itemPos.x = player->actor.world.pos.x; @@ -776,21 +776,21 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { itemPos.z = player->actor.world.pos.z; this->item = - (EnExItem*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, + (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemPos.x, itemPos.y, itemPos.z, 0, 0, 0, sExItemTypes[actionIndex]); if (this->item != NULL) { if (gSaveContext.magicAcquired == 0) { gSaveContext.magicAcquired = 1; } else { - Magic_Fill(globalCtx); + Magic_Fill(play); } this->itemSpawned = true; gSaveContext.healthAccumulator = 0x140; Interface_ChangeAlpha(9); gSaveContext.itemGetInf[1] |= sItemGetFlags[actionIndex]; - Item_Give(globalCtx, sItemIds[actionIndex]); + Item_Give(play, sItemIds[actionIndex]); } } else { this->item->actor.world.pos.x = player->actor.world.pos.x; @@ -801,13 +801,13 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { } } - if ((globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action == 17) && + if ((play->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action == 17) && (this->item != NULL)) { Actor_Kill(&this->item->actor); this->item = NULL; } - if ((globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action == 18)) { + if ((play->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action == 18)) { this->giveDefenseHearts = true; } @@ -817,18 +817,18 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { } } - if ((globalCtx->csCtx.npcActions[0]->action >= 19) && (globalCtx->csCtx.npcActions[0]->action < 22) && + if ((play->csCtx.npcActions[0]->action >= 19) && (play->csCtx.npcActions[0]->action < 22) && !this->warpEffectSpawned) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 11; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, player->actor.world.pos.x, + actionIndex = play->csCtx.npcActions[0]->action - 11; + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, actionIndex); this->warpEffectSpawned = true; } - BgDyYoseizo_Bob(this, globalCtx); + BgDyYoseizo_Bob(this, play); } -void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgDyYoseizo* this = (BgDyYoseizo*)thisx; s32 phi_v1; @@ -844,24 +844,24 @@ void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unusedTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { phi_v1 = 0; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { - if ((globalCtx->csCtx.frames == 32) || (globalCtx->csCtx.frames == 291) || - (globalCtx->csCtx.frames == 426) || (globalCtx->csCtx.frames == 851)) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if ((play->csCtx.frames == 32) || (play->csCtx.frames == 291) || + (play->csCtx.frames == 426) || (play->csCtx.frames == 851)) { phi_v1 = 1; } - if (globalCtx->csCtx.frames == 101) { + if (play->csCtx.frames == 101) { phi_v1 = 2; } } else { - if ((globalCtx->csCtx.frames == 35) || (globalCtx->csCtx.frames == 181) || - (globalCtx->csCtx.frames == 462) || (globalCtx->csCtx.frames == 795)) { + if ((play->csCtx.frames == 35) || (play->csCtx.frames == 181) || + (play->csCtx.frames == 462) || (play->csCtx.frames == 795)) { phi_v1 = 1; } - if (globalCtx->csCtx.frames == 90) { + if (play->csCtx.frames == 90) { phi_v1 = 2; } } @@ -887,12 +887,12 @@ void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->heightOffset = this->scale * 7500.0f; Actor_SetFocus(&this->actor, this->heightOffset); this->actor.focus.pos.y = this->heightOffset; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); - BgDyYoseizo_ParticleUpdate(this, globalCtx); + func_80038290(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); + BgDyYoseizo_ParticleUpdate(this, play); Actor_SetScale(&this->actor, this->scale); } -s32 BgDyYoseizo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BgDyYoseizo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BgDyYoseizo* this = (BgDyYoseizo*)thisx; @@ -917,12 +917,12 @@ static void* sMouthTextures[] = { gGreatFairyMouthOpenTex, // Open }; -void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgDyYoseizo_Draw(Actor* thisx, PlayState* play) { BgDyYoseizo* this = (BgDyYoseizo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc != BgDyYoseizo_Vanish) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState])); @@ -932,11 +932,11 @@ void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthState])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BgDyYoseizo_OverrideLimbDraw, NULL, this); } - CLOSE_DISPS(globalCtx->state.gfxCtx); - BgDyYoseizo_ParticleDraw(this, globalCtx); + CLOSE_DISPS(play->state.gfxCtx); + BgDyYoseizo_ParticleDraw(this, play); } void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel, @@ -967,9 +967,9 @@ void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelo } } -void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, PlayState* play) { BgDyYoseizoParticle* particle = this->particles; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp94; Vec3f sp88; f32 goalPitch; @@ -1031,14 +1031,14 @@ void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx) { } } -void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 phi_s3 = 0; BgDyYoseizoParticle* particle = this->particles; s16 i; OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < 200; i++, particle++) { FrameInterpolation_RecordOpenChild(particle, particle->epoch); @@ -1056,7 +1056,7 @@ void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, particle->envColor.r, particle->envColor.g, particle->envColor.b, 0); Matrix_Translate(particle->pos.x, particle->pos.y, particle->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(particle->scale, particle->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(particle->roll, MTXMODE_APPLY); diff --git a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h index c25205729..7e71c9090 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h +++ b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h @@ -8,7 +8,7 @@ struct BgDyYoseizo; -typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, GlobalContext*); +typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, PlayState*); typedef struct { /* 0x00 */ u8 alive; // drawn if 1, respawn if 0 diff --git a/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 6fbbf1d85..de4c51f6f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -18,14 +18,14 @@ typedef enum { /* 0x02 */ FLASH_SHRINK } FlashState; -void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGanonOtyuka_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGanonOtyuka_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGanonOtyuka_Init(Actor* thisx, PlayState* play); +void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play); +void BgGanonOtyuka_Update(Actor* thisx, PlayState* play); +void BgGanonOtyuka_Draw(Actor* thisx, PlayState* play); -void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx); -void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx); -void BgGanonOtyuka_DoNothing(Actor* thisx, GlobalContext* globalCtx); +void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play); +void BgGanonOtyuka_Fall(BgGanonOtyuka* this, PlayState* play); +void BgGanonOtyuka_DoNothing(Actor* thisx, PlayState* play); const ActorInit Bg_Ganon_Otyuka_InitVars = { ACTOR_BG_GANON_OTYUKA, @@ -68,15 +68,15 @@ static f32 sSideAngles[] = { M_PI / 2, -M_PI / 2, 0.0f, M_PI }; #include "overlays/ovl_Bg_Ganon_Otyuka/ovl_Bg_Ganon_Otyuka.h" -void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx2) { +void BgGanonOtyuka_Init(Actor* thisx, PlayState* play2) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&sCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (thisx->params != 0x23) { thisx->draw = NULL; @@ -86,18 +86,18 @@ void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void BgGanonOtyuka_Destroy(Actor* thisx, GlobalContext* globalCtx2) { +void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play2) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("WHY !!!!!!!!!!!!!!!!\n"); osSyncPrintf(VT_RST); } -void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { +void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { Actor* thisx = &this->dyna.actor; Actor* prop; BgGanonOtyuka* platform; @@ -107,11 +107,11 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { Vec3f center; s16 i; - if (this->isFalling || ((globalCtx->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < 4900.0f))) { + if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < 4900.0f))) { osSyncPrintf("OTC O 1\n"); for (i = 0; i < ARRAY_COUNT(D_80876A68); i++) { - prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { prop = prop->next; @@ -139,7 +139,7 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { center.x = this->dyna.actor.world.pos.x + D_80876A68[i].x; center.y = this->dyna.actor.world.pos.y; center.z = this->dyna.actor.world.pos.z + D_80876A68[i].z; - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, ¢er, 50.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, ¢er, 50.0f)) { this->unwalledSides |= sSides[i]; } } @@ -160,8 +160,8 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { } } -void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGanonOtyuka_Fall(BgGanonOtyuka* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 i; Vec3f pos; Vec3f velocity; @@ -210,12 +210,12 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(150.0f) + this->dyna.actor.world.pos.x; pos.y = Rand_ZeroFloat(60.0f) + -750.0f; pos.z = Rand_CenteredFloat(150.0f) + this->dyna.actor.world.pos.z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, + func_8002836C(play, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, (s16)Rand_ZeroFloat(100.0f) + 250, 5, (s16)Rand_ZeroFloat(5.0f) + 15); } - func_80033DB8(globalCtx, 10, 15); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_BOX_BREAK); + func_80033DB8(play, 10, 15); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_BOX_BREAK); } Actor_Kill(&this->dyna.actor); } @@ -233,33 +233,33 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) { osSyncPrintf("MODE DOWN END\n"); } -void BgGanonOtyuka_DoNothing(Actor* thisx, GlobalContext* globalCtx) { +void BgGanonOtyuka_DoNothing(Actor* thisx, PlayState* play) { } -void BgGanonOtyuka_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGanonOtyuka_Update(Actor* thisx, PlayState* play) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->flashTimer++; if (this->dropTimer != 0) { this->dropTimer--; } } -void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGanonOtyuka_Draw(Actor* thisx, PlayState* play) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; s16 i; Gfx* phi_s2; Gfx* phi_s1; - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* camera = Play_GetCamera(play, 0); Actor* actor; BgGanonOtyuka* platform; BossGanon* ganondorf; f32 spBC = -30.0f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; + actor = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actor != NULL) { if (actor->id == ACTOR_BOSS_GANON) { ganondorf = (BossGanon*)actor; @@ -276,10 +276,10 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { actor = actor->next; } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, sPlatformMaterialDL); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_BG_GANON_OTYUKA) { platform = (BgGanonOtyuka*)actor; @@ -303,7 +303,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { phi_s1 = sPlatformTopDL; } } - 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++, phi_s2); @@ -317,7 +317,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(sSideCenters[i].x, 0.0f, sSideCenters[i].z, MTXMODE_APPLY); Matrix_RotateY(sSideAngles[i], MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, - MATRIX_NEWMTX(globalCtx->state.gfxCtx), + MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sPlatformSideDL); Matrix_Pop(); @@ -330,8 +330,8 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { actor = actor->next; } - func_80093D84(globalCtx->state.gfxCtx); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + func_80093D84(play->state.gfxCtx); + actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_BG_GANON_OTYUKA) { platform = (BgGanonOtyuka*)actor; @@ -339,7 +339,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((platform->dyna.actor.projectedPos.z > -30.0f) && (platform->flashState != FLASH_NONE)) { FrameInterpolation_RecordOpenChild(platform, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, platform->flashTimer * 4, 0, 32, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, platform->flashTimer * 4, 0, 32, 64, 1, platform->flashTimer * 4, 0, 32, 64)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, platform->flashPrimColorR, platform->flashPrimColorG, @@ -355,7 +355,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(sSideAngles[i], MTXMODE_APPLY); Matrix_Scale(0.3f, platform->flashYScale * 0.3f, 0.3f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, - MATRIX_NEWMTX(globalCtx->state.gfxCtx), + MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sFlashDL); Matrix_Pop(); @@ -368,5 +368,5 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { actor = actor->next; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h b/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h index 79ba15e6d..376130ae5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h +++ b/soh/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h @@ -12,7 +12,7 @@ struct BgGanonOtyuka; -typedef void (*BgGanonOtyukaActionFunc)(struct BgGanonOtyuka*, GlobalContext*); +typedef void (*BgGanonOtyukaActionFunc)(struct BgGanonOtyuka*, PlayState*); typedef struct BgGanonOtyuka { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c b/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c index ec4dc030e..3dd44c1b9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c +++ b/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c @@ -10,15 +10,15 @@ #define FLAGS 0 -void BgGateShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGateShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGateShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGateShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGateShutter_Init(Actor* thisx, PlayState* play); +void BgGateShutter_Destroy(Actor* thisx, PlayState* play); +void BgGateShutter_Update(Actor* thisx, PlayState* play); +void BgGateShutter_Draw(Actor* thisx, PlayState* play); -void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx); -void func_80878300(BgGateShutter* this, GlobalContext* globalCtx); -void func_808783AC(BgGateShutter* this, GlobalContext* globalCtx); -void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx); +void func_8087828C(BgGateShutter* this, PlayState* play); +void func_80878300(BgGateShutter* this, PlayState* play); +void func_808783AC(BgGateShutter* this, PlayState* play); +void func_808783D4(BgGateShutter* this, PlayState* play); const ActorInit Bg_Gate_Shutter_InitVars = { ACTOR_BG_GATE_SHUTTER, @@ -33,21 +33,21 @@ const ActorInit Bg_Gate_Shutter_InitVars = { NULL, }; -void BgGateShutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGateShutter_Init(Actor* thisx, PlayState* play) { BgGateShutter* this = (BgGateShutter*)thisx; s32 pad[2]; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gKakarikoGuardGateCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->somePos.x = thisx->world.pos.x; this->somePos.y = thisx->world.pos.y; this->somePos.z = thisx->world.pos.z; if (((gSaveContext.infTable[7] & 0x40) || (!gSaveContext.n64ddFlag && (gSaveContext.eventChkInf[4] & 0x20)) || (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_KAK_GATE))) && - (globalCtx->sceneNum == SCENE_SPOT01)) { + (play->sceneNum == SCENE_SPOT01)) { thisx->world.pos.x = -89.0f; thisx->world.pos.z = -1375.0f; } @@ -59,13 +59,13 @@ void BgGateShutter_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8087828C; } -void BgGateShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGateShutter_Destroy(Actor* thisx, PlayState* play) { BgGateShutter* this = (BgGateShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx) { +void func_8087828C(BgGateShutter* this, PlayState* play) { if (this->openingState == 1 && !(gSaveContext.infTable[7] & 0x40)) { this->unk_178 = 2; this->actionFunc = func_80878300; @@ -78,7 +78,7 @@ void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx) { } } -void func_80878300(BgGateShutter* this, GlobalContext* globalCtx) { +void func_80878300(BgGateShutter* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (this->unk_178 == 0) { @@ -93,14 +93,14 @@ void func_80878300(BgGateShutter* this, GlobalContext* globalCtx) { } } -void func_808783AC(BgGateShutter* this, GlobalContext* globalCtx) { +void func_808783AC(BgGateShutter* this, PlayState* play) { if (this->unk_178 == 0) { this->openingState = 0; this->actionFunc = func_8087828C; } } -void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx) { +void func_808783D4(BgGateShutter* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (this->unk_178 == 0) { @@ -116,23 +116,23 @@ void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx) { } } -void BgGateShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGateShutter_Update(Actor* thisx, PlayState* play) { BgGateShutter* this = (BgGateShutter*)thisx; if (this->unk_178 != 0) { this->unk_178 -= 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGateShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgGateShutter_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, gKakarikoGuardGateDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h b/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h index 4f93b6778..cad165121 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h +++ b/soh/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h @@ -6,7 +6,7 @@ struct BgGateShutter; -typedef void (*BgGateShutterActionFunc)(struct BgGateShutter*, GlobalContext*); +typedef void (*BgGateShutterActionFunc)(struct BgGateShutter*, PlayState*); typedef struct BgGateShutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c b/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c index 96a492f9d..68dd1ee45 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c +++ b/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c @@ -10,14 +10,14 @@ #define FLAGS 0 -void BgGjyoBridge_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGjyoBridge_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGjyoBridge_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGjyoBridge_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGjyoBridge_Init(Actor* thisx, PlayState* play); +void BgGjyoBridge_Destroy(Actor* thisx, PlayState* play); +void BgGjyoBridge_Update(Actor* thisx, PlayState* play); +void BgGjyoBridge_Draw(Actor* thisx, PlayState* play); -void func_808787A4(BgGjyoBridge* this, GlobalContext* globalCtx); -void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, GlobalContext* globalCtx); -void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, GlobalContext* globalCtx); +void func_808787A4(BgGjyoBridge* this, PlayState* play); +void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, PlayState* play); +void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, PlayState* play); const ActorInit Bg_Gjyo_Bridge_InitVars = { ACTOR_BG_GJYO_BRIDGE, @@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgGjyoBridge_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Init(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; s32 pad; CollisionHeader* colHeader; @@ -48,46 +48,46 @@ void BgGjyoBridge_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gRainbowBridgeCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); int bridge = Randomizer_GetSettingValue(RSK_RAINBOW_BRIDGE); if (gSaveContext.eventChkInf[4] & 0x2000 || (gSaveContext.n64ddFlag && bridge == 0)) { this->actionFunc = func_808787A4; } else { this->dyna.actor.draw = NULL; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgGjyoBridge_TriggerCutscene; } } -void BgGjyoBridge_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Destroy(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808787A4(BgGjyoBridge* this, GlobalContext* globalCtx) { +void func_808787A4(BgGjyoBridge* this, PlayState* play) { } -void LaunchBridgeCutscene(BgGjyoBridge* this, GlobalContext* globalCtx) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gRainbowBridgeCs); +void LaunchBridgeCutscene(BgGjyoBridge* this, PlayState* play) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gRainbowBridgeCs); gSaveContext.cutsceneTrigger = 1; this->actionFunc = BgGjyoBridge_SpawnBridge; } -u8 CheckPlayerPosition(Player* player, GlobalContext* globalCtx) { +u8 CheckPlayerPosition(Player* player, PlayState* play) { return (player->actor.world.pos.x > -70.0f) && (player->actor.world.pos.x < 300.0f) && (player->actor.world.pos.y > 1340.0f) && (player->actor.world.pos.z > 1340.0f) && - (player->actor.world.pos.z < 1662.0f) && !Gameplay_InCsMode(globalCtx); + (player->actor.world.pos.z < 1662.0f) && !Play_InCsMode(play); } -void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!gSaveContext.n64ddFlag) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && - (INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_ARROW_LIGHT) && CheckPlayerPosition(player, globalCtx)) { - LaunchBridgeCutscene(this, globalCtx); + (INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_ARROW_LIGHT) && CheckPlayerPosition(player, play)) { + LaunchBridgeCutscene(this, play); } } else { int bridge = Randomizer_GetSettingValue(RSK_RAINBOW_BRIDGE); @@ -139,40 +139,40 @@ void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, GlobalContext* globalCtx) } } -void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, GlobalContext* globalCtx) { - if (gSaveContext.n64ddFlag || (globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[2] != NULL) && - (globalCtx->csCtx.npcActions[2]->action == 2)) { +void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, PlayState* play) { + if (gSaveContext.n64ddFlag || (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[2] != NULL) && + (play->csCtx.npcActions[2]->action == 2)) { this->dyna.actor.draw = BgGjyoBridge_Draw; - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); gSaveContext.eventChkInf[4] |= 0x2000; } } -void BgGjyoBridge_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Update(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGjyoBridge_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Draw(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TexScroll(globalCtx->state.gfxCtx, globalCtx->gameplayFrames & 127, - globalCtx->gameplayFrames * -3 & 127, 32, 32)); + Gfx_TexScroll(play->state.gfxCtx, play->gameplayFrames & 127, + play->gameplayFrames * -3 & 127, 32, 32)); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -globalCtx->gameplayFrames & 127, 32, 32, 1, 0, - globalCtx->gameplayFrames & 127, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -play->gameplayFrames & 127, 32, 32, 1, 0, + play->gameplayFrames & 127, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gRainbowBridgeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h b/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h index f0e74dbaf..0ca02453b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h +++ b/soh/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h @@ -6,7 +6,7 @@ struct BgGjyoBridge; -typedef void (*BgGjyoBridgeActionFunc)(struct BgGjyoBridge*, GlobalContext*); +typedef void (*BgGjyoBridgeActionFunc)(struct BgGjyoBridge*, PlayState*); typedef struct BgGjyoBridge { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c index de7a93706..707e4e115 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, GlobalContext* globalCtx); +void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_Update(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, PlayState* play); -void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, GlobalContext* globalCtx); -void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* globalCtx); -void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx); -void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx); +void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play); +void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play); +void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, PlayState* play); +void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, PlayState* play); const ActorInit Bg_Gnd_Darkmeiro_InitVars = { ACTOR_BG_GND_DARKMEIRO, @@ -34,20 +34,20 @@ const ActorInit Bg_Gnd_Darkmeiro_InitVars = { NULL, }; -void BgGndDarkmeiro_ToggleBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_ToggleBlock(BgGndDarkmeiro* this, PlayState* play) { if (this->actionFlags & 2) { if (this->timer1 == 0) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFlags &= ~2; } } else if (this->timer1 != 0) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFlags |= 2; } } -void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; CollisionHeader* colHeader = NULL; BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; @@ -60,7 +60,7 @@ void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { break; case DARKMEIRO_CLEAR_BLOCK: CollisionHeader_GetVirtual(&gClearBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (((this->dyna.actor.params >> 8) & 0x3F) == 0x3F) { this->updateFunc = BgGndDarkmeiro_UpdateStaticBlock; this->dyna.actor.draw = BgGndDarkmeiro_DrawStaticBlock; @@ -68,8 +68,8 @@ void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFlags = this->timer1 = this->timer2 = 0; thisx->draw = BgGndDarkmeiro_DrawSwitchBlock; this->updateFunc = BgGndDarkmeiro_UpdateSwitchBlock; - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { this->timer1 = 64; this->actionFlags |= 2; @@ -80,44 +80,44 @@ void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFlags = this->timer1 = this->timer2 = 0; this->updateFunc = BgGndDarkmeiro_UpdateBlockTimer; thisx->draw = NULL; - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { this->timer1 = 64; this->actionFlags |= 4; } - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { this->timer2 = 64; this->actionFlags |= 8; } if ((this->timer1 != 0) || (this->timer2 != 0)) { - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } else { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } break; } } -void BgGndDarkmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; if ((this->dyna.actor.params & 0xFF) == 1) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play) { } -void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) { s16 timeLeft; - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { if (this->actionFlags & 4) { if (this->timer1 > 0) { this->timer1--; } else { - Flags_UnsetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 1); + Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1); this->actionFlags &= ~4; } } else { @@ -127,12 +127,12 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* global } } - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { if (this->actionFlags & 8) { if (this->timer2 > 0) { this->timer2--; } else { - Flags_UnsetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 2); + Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2); this->actionFlags &= ~8; } } else { @@ -147,39 +147,39 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* global func_8002F994(&this->dyna.actor, timeLeft); } if ((this->timer1 >= 64) || (this->timer2 >= 64)) { - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } else { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } } -void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, PlayState* play) { } -void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, PlayState* play) { if (this->timer1 > 0) { this->timer1--; } - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { this->timer1 = 64; } - BgGndDarkmeiro_ToggleBlock(this, globalCtx); + BgGndDarkmeiro_ToggleBlock(this, play); } -void BgGndDarkmeiro_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BgGndDarkmeiro_Update(Actor* thisx, PlayState* play2) { BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - this->updateFunc(this, globalCtx2); + this->updateFunc(this, play2); } -void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListXlu(globalCtx, gShadowTrialPathDL); +void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, PlayState* play) { + Gfx_DrawDListXlu(play, gShadowTrialPathDL); } -void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx) { +void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, PlayState* play) { BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; s16 vanishTimer; @@ -196,19 +196,19 @@ void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx) { this->timer2 = vanishTimer * 8; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); //! @bug Due to a bug in the display list, the transparency data is not used. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 198, 202, 208, this->timer2); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - Gfx_DrawDListXlu(globalCtx, gClearBlockDL); + Gfx_DrawDListXlu(play, gClearBlockDL); } } -void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 198, 202, 208, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - Gfx_DrawDListXlu(globalCtx, gClearBlockDL); + Gfx_DrawDListXlu(play, gClearBlockDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h b/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h index 6e1936e35..64d6f50ba 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h @@ -6,7 +6,7 @@ struct BgGndDarkmeiro; -typedef void (*BgGndDarkmeiroUpdateFunc)(struct BgGndDarkmeiro*, GlobalContext*); +typedef void (*BgGndDarkmeiroUpdateFunc)(struct BgGndDarkmeiro*, PlayState*); typedef struct BgGndDarkmeiro { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c index 32dbcd8fa..199a83e7d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgGndFiremeiro_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndFiremeiro_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndFiremeiro_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndFiremeiro_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndFiremeiro_Init(Actor* thisx, PlayState* play); +void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play); +void BgGndFiremeiro_Update(Actor* thisx, PlayState* play); +void BgGndFiremeiro_Draw(Actor* thisx, PlayState* play); -void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx); -void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx); -void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx); +void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play); +void BgGndFiremeiro_Shake(BgGndFiremeiro* this, PlayState* play); +void BgGndFiremeiro_Rise(BgGndFiremeiro* this, PlayState* play); const ActorInit Bg_Gnd_Firemeiro_InitVars = { ACTOR_BG_GND_FIREMEIRO, @@ -31,7 +31,7 @@ const ActorInit Bg_Gnd_Firemeiro_InitVars = { NULL, }; -void BgGndFiremeiro_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndFiremeiro_Init(Actor* thisx, PlayState* play) { s32 pad; BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; CollisionHeader* colHeader = NULL; @@ -43,21 +43,21 @@ void BgGndFiremeiro_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->dyna.actor.params == 0) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFireTrialPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = BgGndFiremeiro_Rise; } } -void BgGndFiremeiro_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; if (this->dyna.actor.params == 0) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx) { +void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play) { f32 sunkHeight = this->initPos.y - 150.0f; if (func_8004356C(&this->dyna)) { @@ -81,7 +81,7 @@ void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx) { } } -void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx) { +void BgGndFiremeiro_Shake(BgGndFiremeiro* this, PlayState* play) { s32 pad; f32 randSign; @@ -110,8 +110,8 @@ void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx) { } } -void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGndFiremeiro_Rise(BgGndFiremeiro* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if ((player->currentBoots != PLAYER_BOOTS_HOVER) && func_8004356C(&this->dyna)) { // Player standing on it @@ -132,19 +132,19 @@ void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx) { } } -void BgGndFiremeiro_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndFiremeiro_Update(Actor* thisx, PlayState* play) { BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGndFiremeiro_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); +void BgGndFiremeiro_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_800943C8(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++, gFireTrialPlatformDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h b/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h index 1a9a55ffe..60a2254cf 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h @@ -6,7 +6,7 @@ struct BgGndFiremeiro; -typedef void (*BgGndFiremeiroActionFunc)(struct BgGndFiremeiro*, GlobalContext*); +typedef void (*BgGndFiremeiroActionFunc)(struct BgGndFiremeiro*, PlayState*); typedef struct BgGndFiremeiro { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index daf01bcf7..c2e4e24a7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -15,13 +15,13 @@ typedef enum { /* 2 */ GNDICE_HOLE } BgGndIceblockAction; -void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndIceblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndIceblock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndIceblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndIceblock_Init(Actor* thisx, PlayState* play); +void BgGndIceblock_Destroy(Actor* thisx, PlayState* play); +void BgGndIceblock_Update(Actor* thisx, PlayState* play); +void BgGndIceblock_Draw(Actor* thisx, PlayState* play); -void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx); -void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx); +void BgGndIceblock_Idle(BgGndIceblock* this, PlayState* play); +void BgGndIceblock_Slide(BgGndIceblock* this, PlayState* play); const ActorInit Bg_Gnd_Iceblock_InitVars = { ACTOR_BG_GND_ICEBLOCK, @@ -45,7 +45,7 @@ static InitChainEntry sInitChain[] = { static u8 sBlockPositions[2]; -void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Init(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; CollisionHeader* colHeader = NULL; @@ -55,7 +55,7 @@ void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gWaterTrialIceBlockCol, &colHeader); this->targetPos = this->dyna.actor.home.pos; this->actionFunc = BgGndIceblock_Idle; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.world.pos.x == 2792.0f) { this->dyna.actor.params = 0; sBlockPositions[0] = 7; @@ -68,11 +68,11 @@ void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgGndIceblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } /* @@ -232,15 +232,15 @@ void BgGndIceblock_SetNextPosition(BgGndIceblock* this) { } } -void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGndIceblock_Idle(BgGndIceblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; if (this->dyna.unk_150 > 0.0f) { BgGndIceblock_SetNextPosition(this); if (Actor_WorldDistXZToPoint(&this->dyna.actor, &this->targetPos) > 1.0f) { - func_8002DF54(globalCtx, &this->dyna.actor, 8); + func_8002DF54(play, &this->dyna.actor, 8); this->actionFunc = BgGndIceblock_Slide; } } @@ -248,8 +248,8 @@ void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx) { } } -void BgGndIceblock_Reset(BgGndIceblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGndIceblock_Reset(BgGndIceblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { @@ -271,7 +271,7 @@ void BgGndIceblock_Reset(BgGndIceblock* this, GlobalContext* globalCtx) { } } -void BgGndIceblock_Fall(BgGndIceblock* this, GlobalContext* globalCtx) { +void BgGndIceblock_Fall(BgGndIceblock* this, PlayState* play) { Actor* thisx = &this->dyna.actor; thisx->velocity.y += 1.0f; @@ -280,27 +280,27 @@ void BgGndIceblock_Fall(BgGndIceblock* this, GlobalContext* globalCtx) { thisx->world.pos.x = thisx->home.pos.x; thisx->world.pos.y = thisx->home.pos.y - 100.0f; thisx->world.pos.z = thisx->home.pos.z; - if (Player_InCsMode(globalCtx)) { - func_8002DF54(globalCtx, thisx, 7); + if (Player_InCsMode(play)) { + func_8002DF54(play, thisx, 7); } this->actionFunc = BgGndIceblock_Reset; } } -void BgGndIceblock_Hole(BgGndIceblock* this, GlobalContext* globalCtx) { +void BgGndIceblock_Hole(BgGndIceblock* this, PlayState* play) { Actor* thisx = &this->dyna.actor; thisx->velocity.y += 1.0f; if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 100.0f, thisx->velocity.y)) { thisx->velocity.y = 0.0f; - if (Player_InCsMode(globalCtx)) { - func_8002DF54(globalCtx, thisx, 7); + if (Player_InCsMode(play)) { + func_8002DF54(play, thisx, 7); } this->actionFunc = BgGndIceblock_Idle; } } -void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx) { +void BgGndIceblock_Slide(BgGndIceblock* this, PlayState* play) { s32 atTarget; Vec3f pos; Vec3f velocity; @@ -318,7 +318,7 @@ void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx) { switch (BgGndIceblock_NextAction(this)) { case GNDICE_IDLE: this->actionFunc = BgGndIceblock_Idle; - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); break; case GNDICE_FALL: this->actionFunc = BgGndIceblock_Fall; @@ -335,25 +335,25 @@ void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx) { pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) - (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) + (Math_SinS(this->dyna.unk_158) * spread); pos.y = thisx->world.pos.y; - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); spread = Rand_CenteredFloat(120.0f); pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) + (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) - (Math_SinS(this->dyna.unk_158) * spread); - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); func_8002F974(thisx, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } } -void BgGndIceblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Update(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGndIceblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Draw(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; - Gfx_DrawDListOpa(globalCtx, gWaterTrialIceBlockDL); + Gfx_DrawDListOpa(play, gWaterTrialIceBlockDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h index 0010de14a..1d9da28f7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h @@ -6,7 +6,7 @@ struct BgGndIceblock; -typedef void (*BgGndIceblockActionFunc)(struct BgGndIceblock*, GlobalContext*); +typedef void (*BgGndIceblockActionFunc)(struct BgGndIceblock*, PlayState*); typedef struct BgGndIceblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index 2bc55edc1..4a6a0fe55 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_4 -void BgGndNisekabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndNisekabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndNisekabe_Init(Actor* thisx, PlayState* play); +void BgGndNisekabe_Destroy(Actor* thisx, PlayState* play); +void BgGndNisekabe_Update(Actor* thisx, PlayState* play); +void BgGndNisekabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Gnd_Nisekabe_InitVars = { ACTOR_BG_GND_NISEKABE, @@ -27,27 +27,27 @@ const ActorInit Bg_Gnd_Nisekabe_InitVars = { NULL, }; -void BgGndNisekabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Init(Actor* thisx, PlayState* play) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; Actor_SetScale(&this->actor, 0.1); this->actor.uncullZoneForward = 3000.0; } -void BgGndNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Destroy(Actor* thisx, PlayState* play) { } -void BgGndNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Update(Actor* thisx, PlayState* play) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; } } -void BgGndNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gLightTrialFakeWallDL, gGanonsCastleUnusedFakeWallDL, @@ -57,8 +57,8 @@ void BgGndNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx) { u32 index = this->actor.params & 0xFF; if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, dLists[index]); + Gfx_DrawDListXlu(play, dLists[index]); } else { - Gfx_DrawDListOpa(globalCtx, dLists[index]); + Gfx_DrawDListOpa(play, dLists[index]); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c index 075ca8699..6332843db 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c @@ -10,14 +10,14 @@ #define FLAGS 0 -void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndSoulmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndSoulmeiro_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play); +void BgGndSoulmeiro_Destroy(Actor* thisx, PlayState* play); +void BgGndSoulmeiro_Update(Actor* thisx, PlayState* play); +void BgGndSoulmeiro_Draw(Actor* thisx, PlayState* play); -void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx); -void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx); -void func_8087B350(BgGndSoulmeiro* this, GlobalContext* globalCtx); +void func_8087AF38(BgGndSoulmeiro* this, PlayState* play); +void func_8087B284(BgGndSoulmeiro* this, PlayState* play); +void func_8087B350(BgGndSoulmeiro* this, PlayState* play); const ActorInit Bg_Gnd_Soulmeiro_InitVars = { ACTOR_BG_GND_SOULMEIRO, @@ -59,7 +59,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) { s32 pad; BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx; @@ -68,12 +68,12 @@ void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params & 0xFF) { case 0: - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actionFunc = func_8087B284; - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 9); this->actor.draw = NULL; Actor_Kill(&this->actor); @@ -84,7 +84,7 @@ void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 1: case 2: - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { this->actor.draw = BgGndSoulmeiro_Draw; } else { this->actor.draw = NULL; @@ -94,15 +94,15 @@ void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgGndSoulmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Destroy(Actor* thisx, PlayState* play) { BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx; if ((this->actor.params & 0xFF) == 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) { +void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f vecA; Vec3f vecB; @@ -113,15 +113,15 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) { } if (this->unk_198 == 20) { - Flags_SetSwitch(globalCtx, (thisx->params >> 8) & 0x3F); + Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F); thisx->draw = NULL; } // This should be this->unk_198 == 0, this is required to match if (!this->unk_198) { - Flags_SetSwitch(globalCtx, (thisx->params >> 8) & 0x3F); + Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F); Actor_Kill(&this->actor); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, thisx->world.pos.x, thisx->world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, 0, 0, 9); } else if ((this->unk_198 % 6) == 0) { s32 i; @@ -150,17 +150,17 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) { vecA.x = 4.0f * temp_3 * distXZ; vecA.y = 0.0f; vecA.z = 4.0f * temp_4 * distXZ; - EffectSsDeadDb_Spawn(globalCtx, &thisx->home.pos, &vecA, &zeroVec, 60, 6, 255, 255, 150, 170, 255, 0, 0, 1, + EffectSsDeadDb_Spawn(play, &thisx->home.pos, &vecA, &zeroVec, 60, 6, 255, 255, 150, 170, 255, 0, 0, 1, 14, true); temp_2 += 0x2AAA; } } } -void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx) { +void func_8087B284(BgGndSoulmeiro* this, PlayState* play) { s32 pad; - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { this->actor.draw = BgGndSoulmeiro_Draw; if (this->collider.base.acFlags & AC_HIT) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -168,28 +168,28 @@ void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx) { this->actionFunc = func_8087AF38; } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void func_8087B350(BgGndSoulmeiro* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { +void func_8087B350(BgGndSoulmeiro* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { this->actor.draw = BgGndSoulmeiro_Draw; } else { this->actor.draw = NULL; } } -void BgGndSoulmeiro_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Update(Actor* thisx, PlayState* play) { BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gSpiritTrialWebDL, gSpiritTrialLightSourceDL, @@ -199,18 +199,18 @@ void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx) { switch (params) { case 0: - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(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++, dLists[params]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); break; case 1: - Gfx_DrawDListXlu(globalCtx, dLists[params]); + Gfx_DrawDListXlu(play, dLists[params]); break; case 2: - Gfx_DrawDListOpa(globalCtx, dLists[params]); + Gfx_DrawDListOpa(play, dLists[params]); break; } } diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h b/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h index 1d7024fff..cbf9b854d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h @@ -6,7 +6,7 @@ struct BgGndSoulmeiro; -typedef void (*BgGndSoulmeiroActionFunc)(struct BgGndSoulmeiro*, GlobalContext*); +typedef void (*BgGndSoulmeiroActionFunc)(struct BgGndSoulmeiro*, PlayState*); typedef struct BgGndSoulmeiro { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 294787fe8..5e8729218 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgHaka_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHaka_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHaka_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHaka_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHaka_Init(Actor* thisx, PlayState* play); +void BgHaka_Destroy(Actor* thisx, PlayState* play); +void BgHaka_Update(Actor* thisx, PlayState* play); +void BgHaka_Draw(Actor* thisx, PlayState* play); void func_8087B758(BgHaka* this, Player* player); -void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx); -void func_8087B938(BgHaka* this, GlobalContext* globalCtx); -void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx); -void func_8087BAE4(BgHaka* this, GlobalContext* globalCtx); +void func_8087B7E8(BgHaka* this, PlayState* play); +void func_8087B938(BgHaka* this, PlayState* play); +void func_8087BAAC(BgHaka* this, PlayState* play); +void func_8087BAE4(BgHaka* this, PlayState* play); const ActorInit Bg_Haka_InitVars = { ACTOR_BG_HAKA, @@ -38,7 +38,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHaka_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHaka_Init(Actor* thisx, PlayState* play) { BgHaka* this = (BgHaka*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -46,14 +46,14 @@ void BgHaka_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gGravestoneCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = func_8087B7E8; } -void BgHaka_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHaka_Destroy(Actor* thisx, PlayState* play) { BgHaka* this = (BgHaka*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_8087B758(BgHaka* this, Player* player) { @@ -65,20 +65,20 @@ void func_8087B758(BgHaka* this, Player* player) { } } -void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087B7E8(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - if (globalCtx->sceneNum == SCENE_SPOT02 && !LINK_IS_ADULT && IS_DAY && !gSaveContext.n64ddFlag && !CVar_GetS32("gDayGravePull", 0)) { + if (play->sceneNum == SCENE_SPOT02 && !LINK_IS_ADULT && IS_DAY && !gSaveContext.n64ddFlag && !CVar_GetS32("gDayGravePull", 0)) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~0x10; - if (!Gameplay_InCsMode(globalCtx)) { - Message_StartTextbox(globalCtx, 0x5073, NULL); + if (!Play_InCsMode(play)) { + Message_StartTextbox(play, 0x5073, NULL); this->dyna.actor.params = 100; this->actionFunc = func_8087BAE4; } } else if (0.0f < this->dyna.unk_150 || - (globalCtx->sceneNum == SCENE_SPOT06 && !LINK_IS_ADULT && !Flags_GetSwitch(globalCtx, 0x23))) { + (play->sceneNum == SCENE_SPOT06 && !LINK_IS_ADULT && !Flags_GetSwitch(play, 0x23))) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~0x10; } else { @@ -89,8 +89,8 @@ void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx) { func_8087B758(this, player); } -void func_8087B938(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087B938(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp38; this->dyna.actor.speedXZ += 0.05f; @@ -105,8 +105,8 @@ void func_8087B938(BgHaka* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x10; if (this->dyna.actor.params == 1) { func_80078884(NA_SE_SY_CORRECT_CHIME); - } else if (!IS_DAY && globalCtx->sceneNum == SCENE_SPOT02) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_POH, this->dyna.actor.home.pos.x, + } else if (!IS_DAY && play->sceneNum == SCENE_SPOT02) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_POH, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, 0, this->dyna.actor.shape.rot.y, 0, 1); } @@ -115,8 +115,8 @@ void func_8087B938(BgHaka* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087BAAC(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { this->dyna.unk_150 = 0.0f; @@ -124,8 +124,8 @@ void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx) { } } -void func_8087BAE4(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087BAE4(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (this->dyna.actor.params != 0) { @@ -141,25 +141,25 @@ void func_8087BAE4(BgHaka* this, GlobalContext* globalCtx) { func_8087B758(this, player); } -void BgHaka_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHaka_Update(Actor* thisx, PlayState* play) { BgHaka* this = (BgHaka*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHaka_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgHaka_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGravestoneStoneDL); Matrix_Translate(0.0f, 0.0f, thisx->minVelocityY * 10.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGravestoneEarthDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h index 20d71be2b..093cab70f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h @@ -6,7 +6,7 @@ struct BgHaka; -typedef void (*BgHakaActionFunc)(struct BgHaka*, GlobalContext*); +typedef void (*BgHakaActionFunc)(struct BgHaka*, PlayState*); typedef struct BgHaka { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index a223c1fd6..2f09c0293 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -30,22 +30,22 @@ #define SKULL_OF_TRUTH_FOUND 100 -void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaGate_Draw(Actor* this, GlobalContext* globalCtx); +void BgHakaGate_Init(Actor* thisx, PlayState* play); +void BgHakaGate_Destroy(Actor* thisx, PlayState* play); +void BgHakaGate_Update(Actor* thisx, PlayState* play); +void BgHakaGate_Draw(Actor* this, PlayState* play); void BgHakaGate_Reset(void); -void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_GateWait(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_SkullOfTruth(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx); +void BgHakaGate_DoNothing(BgHakaGate* this, PlayState* play); +void BgHakaGate_StatueInactive(BgHakaGate* this, PlayState* play); +void BgHakaGate_StatueIdle(BgHakaGate* this, PlayState* play); +void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play); +void BgHakaGate_FloorClosed(BgHakaGate* this, PlayState* play); +void BgHakaGate_FloorOpen(BgHakaGate* this, PlayState* play); +void BgHakaGate_GateWait(BgHakaGate* this, PlayState* play); +void BgHakaGate_GateOpen(BgHakaGate* this, PlayState* play); +void BgHakaGate_SkullOfTruth(BgHakaGate* this, PlayState* play); +void BgHakaGate_FalseSkull(BgHakaGate* this, PlayState* play); static s16 sSkullOfTruthRotY = 0x100; static u8 sBgPoEventPuzzleState = 1; @@ -70,7 +70,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakaGate* this = (BgHakaGate*)thisx; CollisionHeader* colHeader = NULL; @@ -86,7 +86,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { if ((Rand_ZeroOne() * 3.0f) < sBgPoEventPuzzleState) { this->vIsSkullOfTruth = true; sSkullOfTruthRotY = thisx->shape.rot.y + 0x8000; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_DoNothing; } else { this->actionFunc = BgHakaGate_SkullOfTruth; @@ -100,7 +100,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { } this->vScrollTimer = Rand_ZeroOne() * 20.0f; thisx->flags |= ACTOR_FLAG_4; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->vFlameScale = 350; } } else { @@ -108,21 +108,21 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_0131C4, &colHeader); this->vTimer = 0; sStatueDistToPlayer = 0.0f; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_StatueInactive; } else { this->actionFunc = BgHakaGate_StatueIdle; } } else if (thisx->params == BGHAKAGATE_FLOOR) { CollisionHeader_GetVirtual(&object_haka_objects_Col_010E10, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_DoNothing; } else { this->actionFunc = BgHakaGate_FloorClosed; } } else { // BGHAKAGATE_GATE CollisionHeader_GetVirtual(&object_haka_objects_Col_00A938, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_DoNothing; thisx->world.pos.y += 80.0f; } else { @@ -131,26 +131,26 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHakaGate_GateWait; } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } } -void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgHakaGate* this = (BgHakaGate*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (this->dyna.actor.params == BGHAKAGATE_STATUE) { sSkullOfTruthRotY = 0x100; sBgPoEventPuzzleState = 1; } } -void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_DoNothing(BgHakaGate* this, PlayState* play) { } -void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHakaGate_StatueInactive(BgHakaGate* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -158,8 +158,8 @@ void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHakaGate_StatueIdle(BgHakaGate* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 linkDirection; f32 forceDirection; @@ -187,8 +187,8 @@ void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 turnFinished; s16 turnAngle; @@ -220,9 +220,9 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_FloorClosed(BgHakaGate* this, PlayState* play) { if ((sStatueDistToPlayer > 1.0f) && (sStatueRotY != 0)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 radialDist; f32 angDist; f32 cos = Math_CosS(sStatueRotY); @@ -238,13 +238,13 @@ void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) { sStatueDistToPlayer = 0.0f; if (ABS(yawDiff) < 0x80) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); sBgPoEventPuzzleState = SKULL_OF_TRUTH_FOUND; this->actionFunc = BgHakaGate_DoNothing; } else { func_80078884(NA_SE_SY_ERROR); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_GROUND_GATE_OPEN); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->vTimer = 60; this->actionFunc = BgHakaGate_FloorOpen; } @@ -252,13 +252,13 @@ void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_FloorOpen(BgHakaGate* this, PlayState* play) { if (this->vTimer != 0) { this->vTimer--; } if (this->vTimer == 0) { if (Math_ScaledStepToS(&this->vOpenAngle, 0, 0x800)) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgHakaGate_FloorClosed; } } else { @@ -266,14 +266,14 @@ void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_GateWait(BgHakaGate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); +void BgHakaGate_GateWait(BgHakaGate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = BgHakaGate_GateOpen; } } -void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_GateOpen(BgHakaGate* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 80.0f, 1.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP); this->dyna.actor.flags &= ~ACTOR_FLAG_4; @@ -283,59 +283,59 @@ void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_SkullOfTruth(BgHakaGate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) && Math_StepToS(&this->vFlameScale, 350, 20)) { +void BgHakaGate_SkullOfTruth(BgHakaGate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag) && Math_StepToS(&this->vFlameScale, 350, 20)) { this->actionFunc = BgHakaGate_DoNothing; } } -void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void BgHakaGate_FalseSkull(BgHakaGate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { Math_StepToS(&this->vFlameScale, 350, 20); } - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->dyna.actor.flags |= ACTOR_FLAG_7; } else { this->dyna.actor.flags &= ~ACTOR_FLAG_7; } } -void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Update(Actor* thisx, PlayState* play) { s32 pad; BgHakaGate* this = (BgHakaGate*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == BGHAKAGATE_SKULL) { this->vScrollTimer++; } } -void BgHakaGate_DrawFlame(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) { Actor* thisx = &this->dyna.actor; f32 scale; if (this->vFlameScale > 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->vScrollTimer * -20) & 0x1FF, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW); - Matrix_RotateY(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) * (M_PI / 0x8000), MTXMODE_APPLY); scale = this->vFlameScale * 0.00001f; Matrix_Scale(scale, scale, scale, 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++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { object_haka_objects_DL_012270, object_haka_objects_DL_010A10, @@ -346,32 +346,32 @@ void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx) { MtxF currentMtxF; if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, object_haka_objects_DL_00F1B0); + Gfx_DrawDListXlu(play, object_haka_objects_DL_00F1B0); } else { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (thisx->params == BGHAKAGATE_FLOOR) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Get(¤tMtxF); Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); Matrix_RotateX(this->vOpenAngle * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 2000.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); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_010A10); Matrix_Put(¤tMtxF); Matrix_Translate(0.0f, 0.0f, 2000.0f, MTXMODE_APPLY); Matrix_RotateX(-this->vOpenAngle * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -2000.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); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_010C10); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - Gfx_DrawDListOpa(globalCtx, displayLists[thisx->params]); + Gfx_DrawDListOpa(play, displayLists[thisx->params]); } } if (thisx->params == BGHAKAGATE_SKULL) { - BgHakaGate_DrawFlame(this, globalCtx); + BgHakaGate_DrawFlame(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h index 005cdefc2..d111c64b7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h @@ -6,7 +6,7 @@ struct BgHakaGate; -typedef void (*BgHakaGateActionFunc)(struct BgHakaGate*, GlobalContext*); +typedef void (*BgHakaGateActionFunc)(struct BgHakaGate*, PlayState*); typedef struct BgHakaGate { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c b/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c index b198d537a..69db133c6 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c @@ -9,18 +9,18 @@ #define FLAGS ACTOR_FLAG_4 -void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaHuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaHuta_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaHuta_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaHuta_Init(Actor* thisx, PlayState* play); +void BgHakaHuta_Destroy(Actor* thisx, PlayState* play); +void BgHakaHuta_Update(Actor* thisx, PlayState* play); +void BgHakaHuta_Draw(Actor* thisx, PlayState* play); -void BgHakaHuta_SpawnDust(BgHakaHuta* this, GlobalContext* globalCtx); -void BgHakaHuta_PlaySound(BgHakaHuta* this, GlobalContext* globalCtx, u16 sfx); -void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx); -void BgHakaHuta_Open(BgHakaHuta* this, GlobalContext* globalCtx); -void BgHakaHuta_SlideOpen(BgHakaHuta* this, GlobalContext* globalCtx); -void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx); -void BgHakaHuta_DoNothing(BgHakaHuta* this, GlobalContext* globalCtx); +void BgHakaHuta_SpawnDust(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_PlaySound(BgHakaHuta* this, PlayState* play, u16 sfx); +void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_Open(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_SlideOpen(BgHakaHuta* this, PlayState* play); +void func_8087D720(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play); const ActorInit Bg_Haka_Huta_InitVars = { ACTOR_BG_HAKA_HUTA, @@ -39,7 +39,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaHuta_Init(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; s16 pad; CollisionHeader* colHeader = NULL; @@ -47,10 +47,10 @@ void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->unk_16A = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; - if (Flags_GetSwitch(globalCtx, thisx->params)) { + if (Flags_GetSwitch(play, thisx->params)) { this->counter = -1; this->actionFunc = func_8087D720; } else { @@ -58,12 +58,12 @@ void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHakaHuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaHuta_Destroy(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgHakaHuta_SpawnDust(BgHakaHuta* this, GlobalContext* globalCtx) { +void BgHakaHuta_SpawnDust(BgHakaHuta* this, PlayState* play) { static Vec3f sEffectAccel[] = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 30, 20, 50, 255 }; static Color_RGBA8 envColor = { 0, 0, 0, 255 }; @@ -90,27 +90,27 @@ void BgHakaHuta_SpawnDust(BgHakaHuta* this, GlobalContext* globalCtx) { } effectPos.x = this->dyna.actor.home.pos.x - (Rand_ZeroOne() * xPosOffset); scale = ((Rand_ZeroOne() * 10.0f) + 50.0f); - func_8002829C(globalCtx, &effectPos, &effectVel, sEffectAccel, &primColor, &envColor, scale, 0xA); + func_8002829C(play, &effectPos, &effectVel, sEffectAccel, &primColor, &envColor, scale, 0xA); } } -void BgHakaHuta_PlaySound(BgHakaHuta* this, GlobalContext* globalCtx, u16 sfx) { +void BgHakaHuta_PlaySound(BgHakaHuta* this, PlayState* play, u16 sfx) { Vec3f pos; pos.z = (this->dyna.actor.shape.rot.y == 0) ? this->dyna.actor.world.pos.z + 120.0f : this->dyna.actor.world.pos.z - 120.0f; pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &pos, 30, sfx); + SoundSource_PlaySfxAtFixedWorldPos(play, &pos, 30, sfx); } -void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params) && !Player_InCsMode(globalCtx)) { +void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params) && !Player_InCsMode(play)) { this->counter = 25; this->actionFunc = BgHakaHuta_Open; - OnePointCutscene_Init(globalCtx, 6001, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 6001, 999, &this->dyna.actor, MAIN_CAM); if (this->unk_16A == 2) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FIREFLY, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, (this->dyna.actor.world.pos.x + (-25.0f) * Math_CosS(this->dyna.actor.shape.rot.y) + 40.0f * Math_SinS(this->dyna.actor.shape.rot.y)), this->dyna.actor.world.pos.y - 10.0f, @@ -118,7 +118,7 @@ void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { Math_CosS(this->dyna.actor.shape.rot.y) * 40.0f), 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FIREFLY, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, (this->dyna.actor.world.pos.x + (-25.0f) * (Math_CosS(this->dyna.actor.shape.rot.y)) + Math_SinS(this->dyna.actor.shape.rot.y) * 80.0f), this->dyna.actor.world.pos.y - 10.0f, @@ -127,7 +127,7 @@ void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { 0, this->dyna.actor.shape.rot.y, 0, 2); } else if (this->unk_16A == 1) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_RD, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RD, (this->dyna.actor.home.pos.x + (-25.0f) * (Math_CosS(this->dyna.actor.shape.rot.y)) + Math_SinS(this->dyna.actor.shape.rot.y) * 100.0f), this->dyna.actor.home.pos.y - 40.0f, @@ -138,7 +138,7 @@ void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { } } -void BgHakaHuta_Open(BgHakaHuta* this, GlobalContext* globalCtx) { +void BgHakaHuta_Open(BgHakaHuta* this, PlayState* play) { f32 posOffset; if (this->counter != 0) { @@ -148,12 +148,12 @@ void BgHakaHuta_Open(BgHakaHuta* this, GlobalContext* globalCtx) { Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + posOffset, 2.0f); if (this->counter == 0) { this->counter = 37; - BgHakaHuta_PlaySound(this, globalCtx, NA_SE_EV_COFFIN_CAP_OPEN); + BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_OPEN); this->actionFunc = BgHakaHuta_SlideOpen; } } -void BgHakaHuta_SlideOpen(BgHakaHuta* this, GlobalContext* globalCtx) { +void BgHakaHuta_SlideOpen(BgHakaHuta* this, PlayState* play) { f32 posOffset; if (this->counter != 0) { @@ -161,15 +161,15 @@ void BgHakaHuta_SlideOpen(BgHakaHuta* this, GlobalContext* globalCtx) { } posOffset = (this->dyna.actor.world.rot.y == 0) ? 24.0f : -24.0f; if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + posOffset, 0.5f)) { - BgHakaHuta_SpawnDust(this, globalCtx); + BgHakaHuta_SpawnDust(this, play); } if (this->counter == 0) { - BgHakaHuta_PlaySound(this, globalCtx, NA_SE_EV_COFFIN_CAP_BOUND); + BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_BOUND); this->actionFunc = func_8087D720; } } -void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { +void func_8087D720(BgHakaHuta* this, PlayState* play) { static Vec3f D_8087D958 = { 30.0f, 0.0f, 0.0f }; static Vec3f D_8087D964 = { 0.03258f, 0.3258f, -0.9449f }; MtxF mtx; @@ -179,7 +179,7 @@ void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { this->counter++; if (this->counter == 6) { this->actionFunc = BgHakaHuta_DoNothing; - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 0x7530); Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); Quake_SetCountdown(quakeIndex, 2); @@ -202,15 +202,15 @@ void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0); } -void BgHakaHuta_DoNothing(BgHakaHuta* this, GlobalContext* globalCtx) { +void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play) { } -void BgHakaHuta_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaHuta_Update(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaHuta_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gBotwCoffinLidDL); +void BgHakaHuta_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gBotwCoffinLidDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h b/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h index dff12e313..8897772b0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h @@ -6,7 +6,7 @@ struct BgHakaHuta; -typedef void (*BgHakaHutaActionFunc)(struct BgHakaHuta*, GlobalContext*); +typedef void (*BgHakaHutaActionFunc)(struct BgHakaHuta*, PlayState*); typedef struct BgHakaHuta { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 4203925b9..139d2f83f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_7) -void BgHakaMegane_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMegane_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMegane_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMegane_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaMegane_Init(Actor* thisx, PlayState* play); +void BgHakaMegane_Destroy(Actor* thisx, PlayState* play); +void BgHakaMegane_Update(Actor* thisx, PlayState* play); +void BgHakaMegane_Draw(Actor* thisx, PlayState* play); -void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx); -void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); -void BgHakaMegane_DoNothing(BgHakaMegane* this, GlobalContext* globalCtx); +void func_8087DB24(BgHakaMegane* this, PlayState* play); +void func_8087DBF0(BgHakaMegane* this, PlayState* play); +void BgHakaMegane_DoNothing(BgHakaMegane* this, PlayState* play); const ActorInit Bg_Haka_Megane_InitVars = { ACTOR_BG_HAKA_MEGANE, @@ -60,16 +60,16 @@ static Gfx* sDLists[] = { object_haka_objects_DL_002ED0, }; -void BgHakaMegane_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Init(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); if (thisx->params < 3) { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKACH_OBJECTS); + this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS); } else { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKA_OBJECTS); + this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); } if (this->objBankIndex < 0) { @@ -79,26 +79,26 @@ void BgHakaMegane_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHakaMegane_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Destroy(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { +void func_8087DB24(BgHakaMegane* this, PlayState* play) { CollisionHeader* colHeader; CollisionHeader* collision; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->dyna.actor.objBankIndex = this->objBankIndex; this->dyna.actor.draw = BgHakaMegane_Draw; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); - if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { + Actor_SetObjectDependency(play, &this->dyna.actor); + if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { this->actionFunc = func_8087DBF0; collision = sCollisionHeaders[this->dyna.actor.params]; if (collision != NULL) { CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } } else { this->actionFunc = BgHakaMegane_DoNothing; @@ -106,37 +106,37 @@ void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { } } -void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { +void func_8087DBF0(BgHakaMegane* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { thisx->flags |= ACTOR_FLAG_7; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { thisx->flags &= ~ACTOR_FLAG_7; - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgHakaMegane_DoNothing(BgHakaMegane* this, GlobalContext* globalCtx) { +void BgHakaMegane_DoNothing(BgHakaMegane* this, PlayState* play) { } -void BgHakaMegane_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Update(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaMegane_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Draw(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, sDLists[thisx->params]); + Gfx_DrawDListXlu(play, sDLists[thisx->params]); } else { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); + Gfx_DrawDListOpa(play, sDLists[thisx->params]); } if (thisx->params == 0) { - Gfx_DrawDListXlu(globalCtx, gBotwBloodSplatterDL); + Gfx_DrawDListXlu(play, gBotwBloodSplatterDL); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h b/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h index dabde490e..9de05508f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h @@ -6,7 +6,7 @@ struct BgHakaMegane; -typedef void (*BgHakaMeganeActionFunc)(struct BgHakaMegane*, GlobalContext*); +typedef void (*BgHakaMeganeActionFunc)(struct BgHakaMegane*, PlayState*); typedef struct BgHakaMegane { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c b/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c index f91be6f88..628f0bbc5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaMeganeBG_Init(Actor* thisx, PlayState* play); +void BgHakaMeganeBG_Destroy(Actor* thisx, PlayState* play); +void BgHakaMeganeBG_Update(Actor* thisx, PlayState* play); +void BgHakaMeganeBG_Draw(Actor* thisx, PlayState* play); -void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx); +void func_8087DFF8(BgHakaMeganeBG* this, PlayState* play); +void func_8087E040(BgHakaMeganeBG* this, PlayState* play); +void func_8087E10C(BgHakaMeganeBG* this, PlayState* play); +void func_8087E1E0(BgHakaMeganeBG* this, PlayState* play); +void func_8087E258(BgHakaMeganeBG* this, PlayState* play); +void func_8087E288(BgHakaMeganeBG* this, PlayState* play); +void func_8087E2D8(BgHakaMeganeBG* this, PlayState* play); +void func_8087E34C(BgHakaMeganeBG* this, PlayState* play); const ActorInit Bg_Haka_MeganeBG_InitVars = { ACTOR_BG_HAKA_MEGANEBG, @@ -54,7 +54,7 @@ static Gfx* D_8087E410[] = { object_haka_objects_DL_000040, }; -void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; CollisionHeader* colHeader = NULL; @@ -80,7 +80,7 @@ void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_000118, &colHeader); thisx->home.pos.y += 100.0f; - if (Flags_GetSwitch(globalCtx, this->unk_168)) { + if (Flags_GetSwitch(play, this->unk_168)) { this->actionFunc = func_8087E34C; thisx->world.pos.y = thisx->home.pos.y; } else { @@ -96,16 +96,16 @@ void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) { } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Destroy(Actor* thisx, PlayState* play) { BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087DFF8(BgHakaMeganeBG* this, PlayState* play) { if (this->unk_16A != 0) { this->unk_16A--; } @@ -117,7 +117,7 @@ void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E040(BgHakaMeganeBG* this, PlayState* play) { f32 xSub; if (this->unk_16A != 0) { @@ -138,7 +138,7 @@ void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E10C(BgHakaMeganeBG* this, PlayState* play) { this->dyna.actor.velocity.y += 1.0f; if (this->dyna.actor.velocity.y > 20.0f) { @@ -163,7 +163,7 @@ void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E1E0(BgHakaMeganeBG* this, PlayState* play) { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 16.0f / 3.0f); func_8002F974(&this->dyna.actor, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG); @@ -177,19 +177,19 @@ void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E258(BgHakaMeganeBG* this, PlayState* play) { this->dyna.actor.shape.rot.y += 0x180; func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); } -void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->unk_168)) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); +void func_8087E288(BgHakaMeganeBG* this, PlayState* play) { + if (Flags_GetSwitch(play, this->unk_168)) { + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_8087E2D8; } } -void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E2D8(BgHakaMeganeBG* this, PlayState* play) { Math_StepToF(&this->dyna.actor.speedXZ, 30.0f, 2.0f); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.speedXZ)) { @@ -200,22 +200,22 @@ void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E34C(BgHakaMeganeBG* this, PlayState* play) { } -void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Update(Actor* thisx, PlayState* play) { BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Draw(Actor* thisx, PlayState* play) { BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; s16 params = this->dyna.actor.params; if (params == 0) { - Gfx_DrawDListXlu(globalCtx, object_haka_objects_DL_008EB0); + Gfx_DrawDListXlu(play, object_haka_objects_DL_008EB0); } else { - Gfx_DrawDListOpa(globalCtx, D_8087E410[params]); + Gfx_DrawDListOpa(play, D_8087E410[params]); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h b/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h index 18a0ba238..933c49fbb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h @@ -6,7 +6,7 @@ struct BgHakaMeganeBG; -typedef void (*BgHakaMeganeBGActionFunc)(struct BgHakaMeganeBG*, GlobalContext*); +typedef void (*BgHakaMeganeBGActionFunc)(struct BgHakaMeganeBG*, PlayState*); typedef struct BgHakaMeganeBG { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index e952edff7..a82c2d4e3 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -18,13 +18,13 @@ typedef enum { #define SCYTHE_SPIN_TIME 32 -void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaSgami_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaSgami_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaSgami_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaSgami_Init(Actor* thisx, PlayState* play); +void BgHakaSgami_Destroy(Actor* thisx, PlayState* play); +void BgHakaSgami_Update(Actor* thisx, PlayState* play); +void BgHakaSgami_Draw(Actor* thisx, PlayState* play); -void BgHakaSgami_SetupSpin(BgHakaSgami* this, GlobalContext* globalCtx); -void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx); +void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play); +void BgHakaSgami_Spin(BgHakaSgami* this, PlayState* play); const ActorInit Bg_Haka_Sgami_InitVars = { ACTOR_BG_HAKA_SGAMI, @@ -127,7 +127,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Init(Actor* thisx, PlayState* play) { static u8 sP1StartColor[] = { 250, 250, 250, 200 }; static u8 sP2StartColor[] = { 200, 200, 200, 130 }; static u8 sP1EndColor[] = { 200, 200, 200, 60 }; @@ -146,10 +146,10 @@ void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->flags |= ACTOR_FLAG_7; } - Collider_InitTris(globalCtx, colliderScythe); - Collider_SetTris(globalCtx, colliderScythe, thisx, &sTrisInit, this->colliderScytheItems); - Collider_InitCylinder(globalCtx, &this->colliderScytheCenter); - Collider_SetCylinder(globalCtx, &this->colliderScytheCenter, thisx, &sCylinderInit); + Collider_InitTris(play, colliderScythe); + Collider_SetTris(play, colliderScythe, thisx, &sTrisInit, this->colliderScytheItems); + Collider_InitCylinder(play, &this->colliderScytheCenter); + Collider_SetCylinder(play, &this->colliderScytheCenter, thisx, &sCylinderInit); this->colliderScytheCenter.dim.pos.x = thisx->world.pos.x; this->colliderScytheCenter.dim.pos.y = thisx->world.pos.y; @@ -166,14 +166,14 @@ void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.elemDuration = 10; blureInit.unkFlag = false; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureEffectIndex[0], EFFECT_BLURE1, 0, 0, &blureInit); - Effect_Add(globalCtx, &this->blureEffectIndex[1], EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureEffectIndex[0], EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureEffectIndex[1], EFFECT_BLURE1, 0, 0, &blureInit); if (thisx->params == SCYTHE_TRAP_SHADOW_TEMPLE) { - this->requiredObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKA_OBJECTS); + this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); thisx->flags &= ~ACTOR_FLAG_0; } else { - this->requiredObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_ICE_OBJECTS); + this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_ICE_OBJECTS); this->colliderScytheCenter.dim.radius = 30; this->colliderScytheCenter.dim.height = 70; Actor_SetFocus(thisx, 40.0f); @@ -187,17 +187,17 @@ void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHakaSgami_SetupSpin; } -void BgHakaSgami_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Destroy(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; - Effect_Delete(globalCtx, this->blureEffectIndex[0]); - Effect_Delete(globalCtx, this->blureEffectIndex[1]); - Collider_DestroyTris(globalCtx, &this->colliderScythe); - Collider_DestroyCylinder(globalCtx, &this->colliderScytheCenter); + Effect_Delete(play, this->blureEffectIndex[0]); + Effect_Delete(play, this->blureEffectIndex[1]); + Collider_DestroyTris(play, &this->colliderScythe); + Collider_DestroyCylinder(play, &this->colliderScytheCenter); } -void BgHakaSgami_SetupSpin(BgHakaSgami* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->actor.objBankIndex = this->requiredObjBankIndex; this->actor.draw = BgHakaSgami_Draw; this->timer = SCYTHE_SPIN_TIME; @@ -206,7 +206,7 @@ void BgHakaSgami_SetupSpin(BgHakaSgami* this, GlobalContext* globalCtx) { } } -void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { +void BgHakaSgami_Spin(BgHakaSgami* this, PlayState* play) { static Vec3f blureEffectVertices2[] = { { -20.0f, 50.0f, 130.0f }, { -50.0f, 33.0f, 20.0f }, @@ -260,7 +260,7 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { &scytheVertices[2]); } - if ((this->unk_151 == 0) || globalCtx->actorCtx.lensActive) { + if ((this->unk_151 == 0) || play->actorCtx.lensActive) { scytheVertices[0].x = this->actor.world.pos.x + blureEffectVertices1[this->actor.params].z * actorRotYSin + blureEffectVertices1[this->actor.params].x * actorRotYCos; scytheVertices[0].y = this->actor.world.pos.y + blureEffectVertices1[this->actor.params].y; @@ -281,28 +281,28 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { EffectBlure_AddVertex(Effect_GetByIndex(this->blureEffectIndex[1]), &scytheVertices[0], &scytheVertices[1]); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderScythe.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderScytheCenter.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderScythe.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderScytheCenter.base); func_8002F974(&this->actor, NA_SE_EV_ROLLCUTTER_MOTOR - SFX_FLAG); } -void BgHakaSgami_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Update(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x300000C0) || (this->actionFunc == BgHakaSgami_SetupSpin)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgHakaSgami_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Draw(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; if (this->unk_151 != 0) { - Gfx_DrawDListXlu(globalCtx, object_haka_objects_DL_00BF20); + Gfx_DrawDListXlu(play, object_haka_objects_DL_00BF20); } else if (this->actor.params == SCYTHE_TRAP_SHADOW_TEMPLE) { - Gfx_DrawDListOpa(globalCtx, object_haka_objects_DL_00BF20); + Gfx_DrawDListOpa(play, object_haka_objects_DL_00BF20); } else { - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_0021F0); + Gfx_DrawDListOpa(play, object_ice_objects_DL_0021F0); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h index 2d97b4794..6f140a39c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h @@ -6,7 +6,7 @@ struct BgHakaSgami; -typedef void (*BgHakaSgamiActionFunc)(struct BgHakaSgami*, GlobalContext*); +typedef void (*BgHakaSgamiActionFunc)(struct BgHakaSgami*, PlayState*); typedef struct BgHakaSgami { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index 5f6f084d4..21d28813a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgHakaShip_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_Draw(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_WaitForSong(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_CutsceneStationary(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_SetupCrash(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_CrashShake(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_CrashFall(BgHakaShip* this, GlobalContext* globalCtx); +void BgHakaShip_Init(Actor* thisx, PlayState* play); +void BgHakaShip_Destroy(Actor* thisx, PlayState* play); +void BgHakaShip_Update(Actor* thisx, PlayState* play); +void BgHakaShip_Draw(Actor* thisx, PlayState* play); +void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, PlayState* play); +void BgHakaShip_WaitForSong(BgHakaShip* this, PlayState* play); +void BgHakaShip_CutsceneStationary(BgHakaShip* this, PlayState* play); +void BgHakaShip_Move(BgHakaShip* this, PlayState* play); +void BgHakaShip_SetupCrash(BgHakaShip* this, PlayState* play); +void BgHakaShip_CrashShake(BgHakaShip* this, PlayState* play); +void BgHakaShip_CrashFall(BgHakaShip* this, PlayState* play); const ActorInit Bg_Haka_Ship_InitVars = { ACTOR_BG_HAKA_SHIP, @@ -38,7 +38,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaShip_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Init(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -56,25 +56,25 @@ void BgHakaShip_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_00ED7C, &colHeader); this->actionFunc = BgHakaShip_ChildUpdatePosition; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y - 0x4000; this->yOffset = 0; if (this->dyna.actor.params == 0 && - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_HAKA_SHIP, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_HAKA_SHIP, this->dyna.actor.world.pos.x + -10.0f, this->dyna.actor.world.pos.y + 82.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 1) == NULL) { Actor_Kill(&this->dyna.actor); } } -void BgHakaShip_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Destroy(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); Audio_StopSfxByPos(&this->bellSoundPos); } -void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, PlayState* play) { Actor* parent = this->dyna.actor.parent; if (parent != NULL && parent->update != NULL) { @@ -86,8 +86,8 @@ void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, GlobalContext* globalCtx) } } -void BgHakaShip_WaitForSong(BgHakaShip* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void BgHakaShip_WaitForSong(BgHakaShip* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { if (this->counter) { this->counter--; } @@ -95,12 +95,12 @@ void BgHakaShip_WaitForSong(BgHakaShip* this, GlobalContext* globalCtx) { this->counter = 130; this->actionFunc = BgHakaShip_CutsceneStationary; osSyncPrintf("シーン 外輪船 ... アァクション!!\n"); - OnePointCutscene_Init(globalCtx, 3390, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3390, 999, &this->dyna.actor, MAIN_CAM); } } } -void BgHakaShip_CutsceneStationary(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_CutsceneStationary(BgHakaShip* this, PlayState* play) { if (this->counter) { this->counter--; } @@ -111,7 +111,7 @@ void BgHakaShip_CutsceneStationary(BgHakaShip* this, GlobalContext* globalCtx) { } } -void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_Move(BgHakaShip* this, PlayState* play) { f32 distanceFromHome; Actor* child; @@ -128,10 +128,10 @@ void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x - 7650.0f; this->dyna.actor.speedXZ = 0.0f; } - if (distanceFromHome > 7600.0f && !Gameplay_InCsMode(globalCtx)) { + if (distanceFromHome > 7600.0f && !Play_InCsMode(play)) { this->counter = 40; this->dyna.actor.speedXZ = 0.0f; - Message_StartTextbox(globalCtx, 0x5071, NULL); + Message_StartTextbox(play, 0x5071, NULL); this->actionFunc = BgHakaShip_SetupCrash; } else { Math_StepToF(&this->dyna.actor.speedXZ, 4.0f, 0.2f); @@ -145,7 +145,7 @@ void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx) { this->yOffset = sinf(this->counter * (M_PI / 25)) * 6144.0f; } -void BgHakaShip_SetupCrash(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_SetupCrash(BgHakaShip* this, PlayState* play) { if (this->counter) { this->counter--; } @@ -156,7 +156,7 @@ void BgHakaShip_SetupCrash(BgHakaShip* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->yOffset, 0, 128); } -void BgHakaShip_CrashShake(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_CrashShake(BgHakaShip* this, PlayState* play) { if (this->counter != 0) { this->counter--; } @@ -168,7 +168,7 @@ void BgHakaShip_CrashShake(BgHakaShip* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_BLOCKSINK - SFX_FLAG); } -void BgHakaShip_CrashFall(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_CrashFall(BgHakaShip* this, PlayState* play) { Actor* child; if (this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 2000.0f) { @@ -180,47 +180,47 @@ void BgHakaShip_CrashFall(BgHakaShip* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCKSINK - SFX_FLAG); if ((this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 500.0f) && func_8004356C(&this->dyna)) { - Gameplay_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } } } -void BgHakaShip_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Update(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == 0) { Actor_MoveForward(&this->dyna.actor); } } -void BgHakaShip_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Draw(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; f32 angleTemp; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->dyna.actor.params == 0) { - 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_haka_objects_DL_00D330); angleTemp = this->yOffset * (M_PI / 0x8000); Matrix_Translate(-3670.0f, 620.0f, 1150.0f, MTXMODE_APPLY); Matrix_RotateZ(angleTemp, 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_haka_objects_DL_005A70); Matrix_Translate(0.0f, 0.0f, -2300.0f, MTXMODE_APPLY); Matrix_RotateZ(-(2.0f * angleTemp), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_005A70); } else { - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) { s32 pad; Vec3f sp2C; @@ -229,7 +229,7 @@ void BgHakaShip_Draw(Actor* thisx, GlobalContext* globalCtx) { sp2C.y = this->dyna.actor.world.pos.y + 62.0f; sp2C.z = this->dyna.actor.world.pos.z; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &sp2C, &this->bellSoundPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &sp2C, &this->bellSoundPos); func_80078914(&this->bellSoundPos, NA_SE_EV_SHIP_BELL - SFX_FLAG); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h b/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h index 255c4c7d9..80f35d084 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h @@ -6,7 +6,7 @@ struct BgHakaShip; -typedef void (*BgHakaShipActionFunc)(struct BgHakaShip*, GlobalContext*); +typedef void (*BgHakaShipActionFunc)(struct BgHakaShip*, PlayState*); typedef struct BgHakaShip { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index e12549c2b..9c9393562 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -9,23 +9,23 @@ #define FLAGS 0 -void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTrap_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaTrap_Init(Actor* thisx, PlayState* play); +void BgHakaTrap_Destroy(Actor* thisx, PlayState* play); +void BgHakaTrap_Update(Actor* thisx, PlayState* play); +void BgHakaTrap_Draw(Actor* thisx, PlayState* play); void BgHakaTrap_Reset(void); -void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx); -void func_80880484(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808805C0(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808808F4(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808809B0(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2); -void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx); -void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx); +void func_8087FFC0(BgHakaTrap* this, PlayState* play); +void func_808801B8(BgHakaTrap* this, PlayState* play); +void func_808802D8(BgHakaTrap* this, PlayState* play); +void func_80880484(BgHakaTrap* this, PlayState* play); +void func_808805C0(BgHakaTrap* this, PlayState* play); +void func_808806BC(BgHakaTrap* this, PlayState* play); +void func_808808F4(BgHakaTrap* this, PlayState* play); +void func_808809B0(BgHakaTrap* this, PlayState* play); +void func_808809E4(BgHakaTrap* this, PlayState* play, s16 arg2); +void func_80880AE8(BgHakaTrap* this, PlayState* play); +void func_80880C0C(BgHakaTrap* this, PlayState* play); void func_80880D68(BgHakaTrap* this); UNK_TYPE D_80880F30 = 0; @@ -108,7 +108,7 @@ static InitChainEntry sInitChain[] = { }; UNK_TYPE D_80881014 = 0; -void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Init(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -117,8 +117,8 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; if (thisx->params != HAKA_TRAP_PROPELLER) { - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, thisx, &sCylinderInit); if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) { this->timer = 20; @@ -162,8 +162,8 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_008D10, &colHeader); } - Collider_InitTris(globalCtx, &this->colliderSpikes); - Collider_SetTris(globalCtx, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem); + Collider_InitTris(play, &this->colliderSpikes); + Collider_SetTris(play, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem); this->colliderCylinder.dim.radius = 18; this->colliderCylinder.dim.height = 115; @@ -174,7 +174,7 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808801B8; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } } else { this->timer = 40; @@ -185,30 +185,30 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&thisx->colChkInfo, 0, &sColChkInfoInit); } -void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Destroy(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; if (this->dyna.actor.params != HAKA_TRAP_PROPELLER) { if (this->dyna.actor.params != HAKA_TRAP_GUILLOTINE_SLOW) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) || (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_2)) { - Collider_DestroyTris(globalCtx, &this->colliderSpikes); + Collider_DestroyTris(play, &this->colliderSpikes); } } - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } Audio_StopSfxByPos(&this->unk_16C); } -void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_8087FFC0(BgHakaTrap* this, PlayState* play) { f32 cosine; Vec3f sp28; f32 sine; f32 zNonNegative; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_8002DBD0(&this->dyna.actor, &sp28, &player->actor.world.pos); @@ -229,10 +229,10 @@ void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) { } static UNK_TYPE D_80881018 = 0; -void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808801B8(BgHakaTrap* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((D_80880F30 == 0) && (!Player_InCsMode(globalCtx))) { + if ((D_80880F30 == 0) && (!Player_InCsMode(play))) { if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 0.5f)) { func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG); } else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) { @@ -242,7 +242,7 @@ void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { } } - func_8087FFC0(this, globalCtx); + func_8087FFC0(this, play); if (this->colliderSpikes.base.acFlags & AC_HIT) { this->timer = 20; @@ -254,7 +254,7 @@ void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808802D8(BgHakaTrap* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f vector; f32 xScale; @@ -275,7 +275,7 @@ void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx) { vector.y = Rand_ZeroOne() * 10.0f + this->dyna.actor.world.pos.y + 30.0f; vector.z = Rand_CenteredFloat(320.0f) + this->dyna.actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &vector, &zeroVec, &zeroVec, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, + EffectSsDeadDb_Spawn(play, &vector, &zeroVec, &zeroVec, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, false); } @@ -285,7 +285,7 @@ void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_80880484(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_80880484(BgHakaTrap* this, PlayState* play) { s32 sp24; s32 timer; @@ -314,14 +314,14 @@ void func_80880484(BgHakaTrap* this, GlobalContext* globalCtx) { this->actionFunc = func_808805C0; } - func_8087FFC0(this, globalCtx); + func_8087FFC0(this, play); if (sp24 == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } } -void func_808805C0(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808805C0(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -347,10 +347,10 @@ void func_808805C0(BgHakaTrap* this, GlobalContext* globalCtx) { this->actionFunc = func_80880484; } - func_8087FFC0(this, globalCtx); + func_8087FFC0(this, play); } -void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808806BC(BgHakaTrap* this, PlayState* play) { Vec3f vector; f32 tempf20; f32 temp; @@ -370,7 +370,7 @@ void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { tempf20 = this->dyna.actor.floorHeight; for (i = 0; i < 3; i++) { - temp = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &sp64, &this->dyna.actor, + temp = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &sp64, &this->dyna.actor, &vector) - 25.0f; if (tempf20 < temp) { @@ -401,7 +401,7 @@ void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808808F4(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808808F4(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -420,7 +420,7 @@ void func_808808F4(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808809B0(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808809B0(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer -= 1; } @@ -430,20 +430,20 @@ void func_808809B0(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2) { - Player* player = GET_PLAYER(globalCtx); +void func_808809E4(BgHakaTrap* this, PlayState* play, s16 arg2) { + Player* player = GET_PLAYER(play); Vec3f sp18; func_8002DBD0(&this->dyna.actor, &sp18, &player->actor.world.pos); if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) && - (GET_PLAYER(globalCtx)->currentBoots != PLAYER_BOOTS_IRON)) { + (GET_PLAYER(play)->currentBoots != PLAYER_BOOTS_IRON)) { player->windSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f); player->windDirection = this->dyna.actor.shape.rot.y; } } -void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_80880AE8(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0, this->dyna.actor.world.rot.z * 0.03f + 5.0f)) { this->timer = 40; @@ -461,10 +461,10 @@ void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_WIND_TRAP - SFX_FLAG); } - func_808809E4(this, globalCtx, this->dyna.actor.world.rot.z); + func_808809E4(this, play, this->dyna.actor.world.rot.z); } -void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_80880C0C(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -477,27 +477,27 @@ void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx) { } this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z; - func_808809E4(this, globalCtx, this->dyna.actor.world.rot.z); + func_808809E4(this, play, this->dyna.actor.world.rot.z); } -void BgHakaTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Update(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; Vec3f* actorPos = &this->dyna.actor.world.pos; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->dyna.actor.params != HAKA_TRAP_PROPELLER) && (thisx->params != HAKA_TRAP_SPIKED_BOX)) { this->colliderCylinder.dim.pos.y = actorPos->y; if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } else { if (this->actionFunc == func_808801B8) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSpikes.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSpikes.base); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } } } @@ -516,7 +516,7 @@ void func_80880D68(BgHakaTrap* this) { Collider_SetTrisVertices(&this->colliderSpikes, 1, &vec1, &vec3, &vec2); } -void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Draw(Actor* thisx, PlayState* play) { static Gfx* sDLists[5] = { object_haka_objects_DL_007610, object_haka_objects_DL_009860, object_haka_objects_DL_007EF0, object_haka_objects_DL_008A20, object_haka_objects_DL_0072C0, @@ -527,17 +527,17 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp2C; if (this->actionFunc == func_808802D8) { - func_80026230(globalCtx, &D_8088103C, this->timer + 20, 0x28); + func_80026230(play, &D_8088103C, this->timer + 20, 0x28); } - Gfx_DrawDListOpa(globalCtx, sDLists[this->dyna.actor.params]); + Gfx_DrawDListOpa(play, sDLists[this->dyna.actor.params]); if (this->actionFunc == func_808801B8) { func_80880D68(this); } if (this->actionFunc == func_808802D8) { - func_80026608(globalCtx); + func_80026608(play); } if ((this->actionFunc == func_808808F4) && !this->unk_169) { @@ -545,7 +545,7 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { sp2C.z = this->dyna.actor.world.pos.z; sp2C.y = this->dyna.actor.world.pos.y + 110.0f; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &sp2C, &this->unk_16C); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &sp2C, &this->unk_16C); func_80078914(&this->unk_16C, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h index f3024a086..111e08e24 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h @@ -15,7 +15,7 @@ typedef enum { struct BgHakaTrap; -typedef void (*BgHakaTrapActionFunc)(struct BgHakaTrap*, GlobalContext*); +typedef void (*BgHakaTrapActionFunc)(struct BgHakaTrap*, PlayState*); typedef struct BgHakaTrap { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index 7ccc3294e..c1477b760 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgHakaTubo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTubo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTubo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTubo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaTubo_Init(Actor* thisx, PlayState* play); +void BgHakaTubo_Destroy(Actor* thisx, PlayState* play); +void BgHakaTubo_Update(Actor* thisx, PlayState* play); +void BgHakaTubo_Draw(Actor* thisx, PlayState* play); -void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx); -void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx); +void BgHakaTubo_Idle(BgHakaTubo* this, PlayState* play); +void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play); const ActorInit Bg_Haka_Tubo_InitVars = { ACTOR_BG_HAKA_TUBO, @@ -77,7 +77,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaTubo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Init(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -85,25 +85,25 @@ void BgHakaTubo_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK3); CollisionHeader_GetVirtual(&object_haka_objects_Col_0108B8, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitCylinder(globalCtx, &this->potCollider); - Collider_SetCylinder(globalCtx, &this->potCollider, &this->dyna.actor, &sPotColliderInit); - Collider_InitCylinder(globalCtx, &this->flamesCollider); - Collider_SetCylinder(globalCtx, &this->flamesCollider, &this->dyna.actor, &sFlamesColliderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitCylinder(play, &this->potCollider); + Collider_SetCylinder(play, &this->potCollider, &this->dyna.actor, &sPotColliderInit); + Collider_InitCylinder(play, &this->flamesCollider); + Collider_SetCylinder(play, &this->flamesCollider, &this->dyna.actor, &sFlamesColliderInit); this->fireScroll = Rand_ZeroOne() * 15.0f; sPotsDestroyed = 0; this->actionFunc = BgHakaTubo_Idle; } -void BgHakaTubo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Destroy(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->potCollider); - Collider_DestroyCylinder(globalCtx, &this->flamesCollider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->potCollider); + Collider_DestroyCylinder(play, &this->flamesCollider); } -void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { +void BgHakaTubo_Idle(BgHakaTubo* this, PlayState* play) { static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f }; Vec3f pos; @@ -115,7 +115,7 @@ void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { // Colliding with flame circle if (this->flamesCollider.base.atFlags & AT_HIT) { this->flamesCollider.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f); + func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f); } // Colliding with hitbox inside the pot if (this->potCollider.base.acFlags & AC_HIT) { @@ -127,9 +127,9 @@ void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { pos.x = this->dyna.actor.world.pos.x; pos.z = this->dyna.actor.world.pos.z; pos.y = this->dyna.actor.world.pos.y + 80.0f; - EffectSsBomb2_SpawnLayered(globalCtx, &pos, &sZeroVector, &sZeroVector, 100, 45); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 50, NA_SE_EV_BOX_BREAK); - EffectSsHahen_SpawnBurst(globalCtx, &pos, 20.0f, 0, 350, 100, 50, OBJECT_HAKA_OBJECTS, 40, + EffectSsBomb2_SpawnLayered(play, &pos, &sZeroVector, &sZeroVector, 100, 45); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 50, NA_SE_EV_BOX_BREAK); + EffectSsHahen_SpawnBurst(play, &pos, 20.0f, 0, 350, 100, 50, OBJECT_HAKA_OBJECTS, 40, gEffFragments2DL); this->dropTimer = 5; this->dyna.actor.draw = NULL; @@ -139,13 +139,13 @@ void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { } else { Collider_UpdateCylinder(&this->dyna.actor, &this->flamesCollider); Collider_UpdateCylinder(&this->dyna.actor, &this->potCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->potCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->flamesCollider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->flamesCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->potCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->flamesCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->flamesCollider.base); } } -void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { +void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play) { EnItem00* collectible; f32 rnd; Vec3f spawnPos; @@ -166,7 +166,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_CORRECT_CHIME); // Drop rupees for (i = 0; i < 9; i++) { - collectible = Item_DropCollectible(globalCtx, &spawnPos, i % 3); + collectible = Item_DropCollectible(play, &spawnPos, i % 3); if (collectible != NULL) { collectible->actor.velocity.y = 15.0f; collectible->actor.world.rot.y = this->dyna.actor.shape.rot.y + (i * 0x1C71); @@ -175,7 +175,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { } else if (rnd < 0.2f) { // Unlucky, no reward and spawn keese collectibleParams = -1; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FIREFLY, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 80.0f, this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y, 0, 2); func_80078884(NA_SE_SY_ERROR); @@ -194,7 +194,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { } func_80078884(NA_SE_SY_TRE_BOX_APPEAR); } - } else if (Flags_GetCollectible(globalCtx, this->dyna.actor.params) != 0) { + } else if (Flags_GetCollectible(play, this->dyna.actor.params) != 0) { // If small key already collected, drop recovery heart instead if (CVar_GetS32("gNoHeartDrops", 0)) { collectibleParams = -1; @@ -209,7 +209,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_CORRECT_CHIME); } if (collectibleParams != -1) { - collectible = Item_DropCollectible(globalCtx, &spawnPos, collectibleParams); + collectible = Item_DropCollectible(play, &spawnPos, collectibleParams); if (collectible != NULL) { collectible->actor.velocity.y = 15.0f; collectible->actor.world.rot.y = this->dyna.actor.shape.rot.y; @@ -219,19 +219,19 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { } } -void BgHakaTubo_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Update(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->fireScroll++; } -void BgHakaTubo_DrawFlameCircle(BgHakaTubo* this, GlobalContext* globalCtx) { +void BgHakaTubo_DrawFlameCircle(BgHakaTubo* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 235.0f, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateY(this->dyna.actor.shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); @@ -239,18 +239,18 @@ void BgHakaTubo_DrawFlameCircle(BgHakaTubo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 170, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->fireScroll & 127, 0, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->fireScroll & 127, 0, 32, 64, 1, 0, (this->fireScroll * -15) & 0xFF, 32, 64)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgHakaTubo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Draw(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; - Gfx_DrawDListOpa(globalCtx, object_haka_objects_DL_00FE40); - BgHakaTubo_DrawFlameCircle(this, globalCtx); + Gfx_DrawDListOpa(play, object_haka_objects_DL_00FE40); + BgHakaTubo_DrawFlameCircle(this, play); } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h b/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h index 7d13044e3..fbed37aa2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h @@ -6,7 +6,7 @@ struct BgHakaTubo; -typedef void (*BgHakaTuboActionFunc)(struct BgHakaTubo*, GlobalContext*); +typedef void (*BgHakaTuboActionFunc)(struct BgHakaTubo*, PlayState*); typedef struct BgHakaTubo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c b/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c index 4ec1ea086..3df08a383 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgHakaWater_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaWater_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaWater_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaWater_Init(Actor* thisx, PlayState* play); +void BgHakaWater_Destroy(Actor* thisx, PlayState* play); +void BgHakaWater_Update(Actor* thisx, PlayState* play); +void BgHakaWater_Draw(Actor* thisx, PlayState* play); -void BgHakaWater_LowerWater(BgHakaWater* this, GlobalContext* globalCtx); -void BgHakaWater_Wait(BgHakaWater* this, GlobalContext* globalCtx); -void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, GlobalContext* globalCtx); +void BgHakaWater_LowerWater(BgHakaWater* this, PlayState* play); +void BgHakaWater_Wait(BgHakaWater* this, PlayState* play); +void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, PlayState* play); const ActorInit Bg_Haka_Water_InitVars = { ACTOR_BG_HAKA_WATER, @@ -35,35 +35,35 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaWater_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Init(Actor* thisx, PlayState* play) { BgHakaWater* this = (BgHakaWater*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { this->isLowered = true; this->actor.home.pos.y -= 200.0f; this->actor.world.pos.y = this->actor.home.pos.y; } else { this->isLowered = false; } - BgHakaWater_LowerWater(this, globalCtx); + BgHakaWater_LowerWater(this, play); this->actionFunc = BgHakaWater_Wait; } -void BgHakaWater_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Destroy(Actor* thisx, PlayState* play) { } -void BgHakaWater_LowerWater(BgHakaWater* this, GlobalContext* globalCtx) { +void BgHakaWater_LowerWater(BgHakaWater* this, PlayState* play) { s32 i; for (i = 0; i < 9; i++) { - globalCtx->colCtx.colHeader->waterBoxes[i].ySurface = (s16)this->actor.world.pos.y - 8; + play->colCtx.colHeader->waterBoxes[i].ySurface = (s16)this->actor.world.pos.y - 8; } } -void BgHakaWater_Wait(BgHakaWater* this, GlobalContext* globalCtx) { - if ((!this->isLowered && Flags_GetSwitch(globalCtx, this->actor.params)) || - (this->isLowered && !Flags_GetSwitch(globalCtx, this->actor.params))) { +void BgHakaWater_Wait(BgHakaWater* this, PlayState* play) { + if ((!this->isLowered && Flags_GetSwitch(play, this->actor.params)) || + (this->isLowered && !Flags_GetSwitch(play, this->actor.params))) { if (this->isLowered) { this->isLowered = false; this->actor.draw = BgHakaWater_Draw; @@ -76,11 +76,11 @@ void BgHakaWater_Wait(BgHakaWater* this, GlobalContext* globalCtx) { } } -void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, GlobalContext* globalCtx) { - if (!this->isLowered && Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, PlayState* play) { + if (!this->isLowered && Flags_GetSwitch(play, this->actor.params)) { this->isLowered = true; this->actor.home.pos.y -= 200.0f; - } else if (this->isLowered && !Flags_GetSwitch(globalCtx, this->actor.params)) { + } else if (this->isLowered && !Flags_GetSwitch(play, this->actor.params)) { this->isLowered = false; this->actor.home.pos.y += 200.0f; } @@ -97,23 +97,23 @@ void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, GlobalContext* globalCtx) { this->actor.draw = NULL; } } - BgHakaWater_LowerWater(this, globalCtx); + BgHakaWater_LowerWater(this, play); } -void BgHakaWater_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Update(Actor* thisx, PlayState* play) { BgHakaWater* this = (BgHakaWater*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Draw(Actor* thisx, PlayState* play) { BgHakaWater* this = (BgHakaWater*)thisx; s32 pad; f32 temp; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->isLowered) { temp = this->actor.world.pos.y - this->actor.home.pos.y; @@ -123,11 +123,11 @@ void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(0.765f * temp)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, - globalCtx->gameplayFrames % 128, 32, 32, 1, 0, (0 - globalCtx->gameplayFrames) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, + play->gameplayFrames % 128, 32, 32, 1, 0, (0 - play->gameplayFrames) % 128, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBotwWaterRingDL); @@ -140,9 +140,9 @@ void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(5.1f * temp)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBotwWaterFallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h b/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h index 037421515..b89d0fa52 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h @@ -6,7 +6,7 @@ struct BgHakaWater; -typedef void (*BgHakaWaterActionFunc)(struct BgHakaWater*, GlobalContext*); +typedef void (*BgHakaWaterActionFunc)(struct BgHakaWater*, PlayState*); typedef struct BgHakaWater { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index d9cde1803..40a032700 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -17,20 +17,20 @@ typedef enum { /* 0x3 */ STA_UNKNOWN } ShadowTempleAssetsType; -void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaZou_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaZou_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaZou_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaZou_Init(Actor* thisx, PlayState* play); +void BgHakaZou_Destroy(Actor* thisx, PlayState* play); +void BgHakaZou_Update(Actor* thisx, PlayState* play); +void BgHakaZou_Draw(Actor* thisx, PlayState* play); -void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx); -void func_80882BDC(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883000(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883104(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883144(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883254(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883328(BgHakaZou* this, GlobalContext* globalCtx); -void func_808834D8(BgHakaZou* this, GlobalContext* globalCtx); -void BgHakaZou_DoNothing(BgHakaZou* this, GlobalContext* globalCtx); +void BgHakaZou_Wait(BgHakaZou* this, PlayState* play); +void func_80882BDC(BgHakaZou* this, PlayState* play); +void func_80883000(BgHakaZou* this, PlayState* play); +void func_80883104(BgHakaZou* this, PlayState* play); +void func_80883144(BgHakaZou* this, PlayState* play); +void func_80883254(BgHakaZou* this, PlayState* play); +void func_80883328(BgHakaZou* this, PlayState* play); +void func_808834D8(BgHakaZou* this, PlayState* play); +void BgHakaZou_DoNothing(BgHakaZou* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -72,7 +72,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakaZou* this = (BgHakaZou*)thisx; @@ -90,8 +90,8 @@ void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->world.rot.x = Rand_S16Offset(0x100, 0x300) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1); thisx->world.rot.z = Rand_S16Offset(0x400, 0x800) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1); } else { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); Collider_UpdateCylinder(thisx, &this->collider); DynaPolyActor_Init(&this->dyna, 0); @@ -104,12 +104,12 @@ void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { } this->requiredObjBankIndex = (thisx->params == STA_BOMBABLE_RUBBLE) - ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKACH_OBJECTS) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKA_OBJECTS); + ? Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS) + : Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); if (this->requiredObjBankIndex < 0) { Actor_Kill(thisx); - } else if ((thisx->params != STA_UNKNOWN) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + } else if ((thisx->params != STA_UNKNOWN) && Flags_GetSwitch(play, this->switchFlag)) { if (thisx->params != STA_GIANT_BIRD_STATUE) { Actor_Kill(thisx); } else { @@ -122,16 +122,16 @@ void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHakaZou_Wait; } -void BgHakaZou_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Destroy(Actor* thisx, PlayState* play) { BgHakaZou* this = (BgHakaZou*)thisx; if (this->dyna.actor.params != STA_UNKNOWN) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } } -void func_808828F4(BgHakaZou* this, GlobalContext* globalCtx) { +void func_808828F4(BgHakaZou* this, PlayState* play) { Vec3f effectPos; Vec3f effectVelocity; f32 rand; @@ -152,21 +152,21 @@ void func_808828F4(BgHakaZou* this, GlobalContext* globalCtx) { effectPos.y = this->dyna.actor.world.pos.y + (60.0f * rand); effectPos.z = this->dyna.actor.world.pos.z + (112.0f * rand); - func_800286CC(globalCtx, &effectPos, &effectVelocity, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 100); + func_800286CC(play, &effectPos, &effectVelocity, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 100); } } -void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx) { +void BgHakaZou_Wait(BgHakaZou* this, PlayState* play) { CollisionHeader* colHeader; - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->dyna.actor.objBankIndex = this->requiredObjBankIndex; this->dyna.actor.draw = BgHakaZou_Draw; if (this->dyna.actor.params == STA_UNKNOWN) { this->actionFunc = func_80882BDC; } else { - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); colHeader = NULL; @@ -187,9 +187,9 @@ void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx) { this->collider.dim.height = 20; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if ((this->dyna.actor.params == STA_GIANT_BIRD_STATUE) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->dyna.actor.params == STA_GIANT_BIRD_STATUE) && Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaZou_DoNothing; } else { this->actionFunc = func_80883000; @@ -197,7 +197,7 @@ void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx) { } } } -void func_80882BDC(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80882BDC(BgHakaZou* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -221,7 +221,7 @@ void func_80882BDC(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_80882CC4(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80882CC4(BgHakaZou* this, PlayState* play) { s32 i; s32 j; Vec3f actorSpawnPos; @@ -238,14 +238,14 @@ void func_80882CC4(BgHakaZou* this, GlobalContext* globalCtx) { actorSpawnPos.z = this->dyna.actor.world.pos.z + (j - 1) * cos; actorSpawnPos.y = this->dyna.actor.world.pos.y + (i - 1) * 55; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HAKA_ZOU, actorSpawnPos.x, actorSpawnPos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_HAKA_ZOU, actorSpawnPos.x, actorSpawnPos.y, actorSpawnPos.z, 0, this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 2); - func_800286CC(globalCtx, &actorSpawnPos, &sZeroVec, &sZeroVec, 1000, 50); + func_800286CC(play, &actorSpawnPos, &sZeroVec, &sZeroVec, 1000, 50); } } } -void func_80882E54(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80882E54(BgHakaZou* this, PlayState* play) { Vec3f fragmentPos; s32 i; s32 j; @@ -255,44 +255,44 @@ void func_80882E54(BgHakaZou* this, GlobalContext* globalCtx) { fragmentPos.y = this->collider.dim.pos.y; fragmentPos.z = this->collider.dim.pos.z; - EffectSsHahen_SpawnBurst(globalCtx, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); + EffectSsHahen_SpawnBurst(play, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { fragmentPos.x = this->collider.dim.pos.x + (((j * 2) - 1) * num); fragmentPos.z = this->collider.dim.pos.z + (((i * 2) - 1) * num); - EffectSsHahen_SpawnBurst(globalCtx, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); - func_800286CC(globalCtx, &fragmentPos, &sZeroVec, &sZeroVec, 1000, 50); + EffectSsHahen_SpawnBurst(play, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); + func_800286CC(play, &fragmentPos, &sZeroVec, &sZeroVec, 1000, 50); } } } -void func_80883000(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883000(BgHakaZou* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); if (this->dyna.actor.params == STA_GIANT_BIRD_STATUE) { this->timer = 20; this->actionFunc = func_80883144; - OnePointCutscene_Init(globalCtx, 3400, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3400, 999, &this->dyna.actor, MAIN_CAM); } else if (this->dyna.actor.params == 2) { - func_80882E54(this, globalCtx); + func_80882E54(this, play); this->dyna.actor.draw = NULL; this->timer = 1; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_EXPLOSION); this->actionFunc = func_80883104; } else { - func_80882CC4(this, globalCtx); + func_80882CC4(this, play); this->timer = 1; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = func_80883104; } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80883104(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883104(BgHakaZou* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -302,7 +302,7 @@ void func_80883104(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_80883144(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883144(BgHakaZou* this, PlayState* play) { Vec3f explosionPos; if (this->timer != 0) { @@ -314,7 +314,7 @@ void func_80883144(BgHakaZou* this, GlobalContext* globalCtx) { explosionPos.y = (Rand_ZeroOne() * 80.0f) + this->dyna.actor.world.pos.y; explosionPos.z = Rand_CenteredFloat(200.0f) + (this->dyna.actor.world.pos.z + 56.0f); - EffectSsBomb2_SpawnLayered(globalCtx, &explosionPos, &sZeroVec, &sZeroVec, 150, 70); + EffectSsBomb2_SpawnLayered(play, &explosionPos, &sZeroVec, &sZeroVec, 150, 70); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); } @@ -324,7 +324,7 @@ void func_80883144(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_80883254(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883254(BgHakaZou* this, PlayState* play) { f32 moveDist = (Rand_ZeroOne() * 0.5f) + 0.5f; Math_StepToF(&this->dyna.actor.world.pos.z, this->dyna.actor.home.pos.z - 80.0f, 2.0f * moveDist); @@ -340,11 +340,11 @@ void func_80883254(BgHakaZou* this, GlobalContext* globalCtx) { this->actionFunc = func_80883328; } } else { - func_808828F4(this, globalCtx); + func_808828F4(this, play); } } -void func_80883328(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883328(BgHakaZou* this, PlayState* play) { Vec3f effectPos; s32 i; s32 j; @@ -360,7 +360,7 @@ void func_80883328(BgHakaZou* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { effectPos.z -= (i == 2) ? 550.0f : 50.0f; - func_800286CC(globalCtx, &effectPos, &sZeroVec, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 200); + func_800286CC(play, &effectPos, &sZeroVec, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 200); } effectPos.x -= 112.0f; @@ -372,7 +372,7 @@ void func_80883328(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_808834D8(BgHakaZou* this, GlobalContext* globalCtx) { +void func_808834D8(BgHakaZou* this, PlayState* play) { f32 moveDist; if (this->timer != 0) { @@ -387,20 +387,20 @@ void func_808834D8(BgHakaZou* this, GlobalContext* globalCtx) { } } -void BgHakaZou_DoNothing(BgHakaZou* this, GlobalContext* globalCtx) { +void BgHakaZou_DoNothing(BgHakaZou* this, PlayState* play) { } -void BgHakaZou_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Update(Actor* thisx, PlayState* play) { BgHakaZou* this = (BgHakaZou*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == 3) { Actor_MoveForward(&this->dyna.actor); } } -void BgHakaZou_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { object_haka_objects_DL_0064E0, object_haka_objects_DL_005CE0, @@ -408,5 +408,5 @@ void BgHakaZou_Draw(Actor* thisx, GlobalContext* globalCtx) { object_haka_objects_DL_005CE0, }; - Gfx_DrawDListOpa(globalCtx, dLists[thisx->params]); + Gfx_DrawDListOpa(play, dLists[thisx->params]); } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h b/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h index eafdcc888..b5fe2a2fd 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h @@ -6,7 +6,7 @@ struct BgHakaZou; -typedef void (*BgHakaZouActionFunc)(struct BgHakaZou*, GlobalContext*); +typedef void (*BgHakaZouActionFunc)(struct BgHakaZou*, PlayState*); typedef struct BgHakaZou { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index fb7196a20..17ec02f45 100644 --- a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -12,19 +12,19 @@ #define PIECE_FLAG_HIT_FLOOR (1 << 0) -void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHeavyBlock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHeavyBlock_Init(Actor* thisx, PlayState* play); +void BgHeavyBlock_Destroy(Actor* thisx, PlayState* play); +void BgHeavyBlock_Update(Actor* thisx, PlayState* play); +void BgHeavyBlock_Draw(Actor* thisx, PlayState* play); -void BgHeavyBlock_DrawPiece(Actor* thisx, GlobalContext* globalCtx); +void BgHeavyBlock_DrawPiece(Actor* thisx, PlayState* play); -void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx); +void BgHeavyBlock_MovePiece(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_Land(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_DoNothing(BgHeavyBlock* this, PlayState* play); const ActorInit Bg_Heavy_Block_InitVars = { ACTOR_BG_HEAVY_BLOCK, @@ -73,23 +73,23 @@ void BgHeavyBlock_InitPiece(BgHeavyBlock* this, f32 scale) { Actor_SetScale(&this->dyna.actor, Rand_CenteredFloat(0.2f) + 1.0f); } -void BgHeavyBlock_SetupDynapoly(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_SetupDynapoly(BgHeavyBlock* this, PlayState* play) { s32 pad[2]; CollisionHeader* colHeader = NULL; this->dyna.actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_17; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gHeavyBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Init(Actor* thisx, PlayState* play) { BgHeavyBlock* this = (BgHeavyBlock*)thisx; Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); this->pieceFlags = 0; - if (globalCtx->sceneNum == SCENE_GANON_TOU) { + if (play->sceneNum == SCENE_GANON_TOU) { thisx->params &= 0xFF00; thisx->params |= 4; } @@ -112,9 +112,9 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_164.y = -20.0f; break; case HEAVYBLOCK_BREAKABLE: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { Actor_Kill(thisx); return; } @@ -122,9 +122,9 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHeavyBlock_Wait; break; case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { this->actionFunc = BgHeavyBlock_DoNothing; thisx->shape.rot.x = thisx->world.rot.x = 0x8AD0; thisx->shape.rot.y = thisx->world.rot.y = 0xC000; @@ -137,11 +137,11 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHeavyBlock_Wait; break; case HEAVYBLOCK_UNBREAKABLE: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); this->actionFunc = BgHeavyBlock_Wait; break; default: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); this->actionFunc = BgHeavyBlock_Wait; break; } @@ -149,7 +149,7 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(CYAN) " 最大 ブロック セーブビット %x\n" VT_RST, thisx->params); } -void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Destroy(Actor* thisx, PlayState* play) { BgHeavyBlock* this = (BgHeavyBlock*)thisx; switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BIG_PIECE: @@ -157,11 +157,11 @@ void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { case HEAVYBLOCK_SMALL_PIECE: break; default: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_MovePiece(BgHeavyBlock* this, PlayState* play) { Actor* thisx = &this->dyna.actor; thisx->velocity.y += thisx->gravity; @@ -180,7 +180,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) { if (!(this->pieceFlags & PIECE_FLAG_HIT_FLOOR)) { thisx->world.pos.y += this->unk_164.y; thisx->prevPos.y += this->unk_164.y; - Actor_UpdateBgCheckInfo(globalCtx, thisx, 50.0f, 50.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, thisx, 50.0f, 50.0f, 0.0f, 5); thisx->world.pos.y -= this->unk_164.y; thisx->prevPos.y -= this->unk_164.y; if (thisx->bgCheckFlags & 1) { @@ -201,7 +201,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) { } } -void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, +void BgHeavyBlock_SpawnDust(PlayState* play, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, u8 dustParams) { Color_RGBA8 primColor; Color_RGBA8 envColor; @@ -238,8 +238,8 @@ void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 po accel.x = 0.0f; accel.y = (dustParams & 8) ? 0.0f : 0.5f; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - at = GET_ACTIVE_CAM(globalCtx)->at; + eye = GET_ACTIVE_CAM(play)->eye; + at = GET_ACTIVE_CAM(play)->at; scale = 1000; scaleStep = 160; @@ -275,11 +275,11 @@ void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 po break; } - func_8002843C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, scaleStep, + func_8002843C(play, &pos, &velocity, &accel, &primColor, &envColor, scale, scaleStep, (s32)Rand_ZeroFloat(10.0f) + 20); } -void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, PlayState* play) { s32 i; Vec3f spA4[] = { { 0.0f, 300.0f, -20.0f }, { 50.0f, 200.0f, -20.0f }, { -50.0f, 200.0f, -20.0f }, @@ -304,37 +304,37 @@ void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, GlobalContext* globalCtx) { pos.y = this->dyna.actor.world.pos.y + (spA4[i].y * cosPitch) + (-spA4[i].z * sinPitch); pos.z = this->dyna.actor.world.pos.z + (spA4[i].x * -sinYaw) + (cosYaw * pos.z); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, 0, 2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, 0, 3); - BgHeavyBlock_SpawnDust(globalCtx, pos.x, pos.y, pos.z, 0.0f, 0.0f, 0.0f, 0); + BgHeavyBlock_SpawnDust(play, pos.x, pos.y, pos.z, 0.0f, 0.0f, 0.0f, 0); } } -void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play) { s32 quakeIndex; // if block has a parent link has lifted it, start one point cutscene and quake - if (Actor_HasParent(&this->dyna.actor, globalCtx)) { + if (Actor_HasParent(&this->dyna.actor, play)) { this->timer = 0; if (!CVar_GetS32("gFasterHeavyBlockLift", 0)) { switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BREAKABLE: - OnePointCutscene_Init(globalCtx, 4020, 270, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4020, 270, &this->dyna.actor, MAIN_CAM); break; case HEAVYBLOCK_UNBREAKABLE: - OnePointCutscene_Init(globalCtx, 4021, 220, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4021, 220, &this->dyna.actor, MAIN_CAM); break; case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - OnePointCutscene_Init(globalCtx, 4022, 210, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4022, 210, &this->dyna.actor, MAIN_CAM); break; } } - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 25000); Quake_SetQuakeValues(quakeIndex, 1, 1, 5, 0); Quake_SetCountdown(quakeIndex, 10); @@ -342,8 +342,8 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { } } -void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; f32 cosYaw; f32 zOffset; @@ -362,7 +362,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { zOffset = Rand_CenteredFloat(110.0f); cosYaw = Math_CosS(this->dyna.actor.shape.rot.y); - BgHeavyBlock_SpawnDust(globalCtx, (sinYaw * -70.0f) + (this->dyna.actor.world.pos.x + xOffset), + BgHeavyBlock_SpawnDust(play, (sinYaw * -70.0f) + (this->dyna.actor.world.pos.x + xOffset), this->dyna.actor.world.pos.y + 10.0f, (cosYaw * -70.0f) + (this->dyna.actor.world.pos.z + zOffset), 0.0f, -1.0f, 0.0f, 0xC); } @@ -370,17 +370,17 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { this->timer++; if (!CVar_GetS32("gFasterHeavyBlockLift", 0)) { - func_8002DF54(globalCtx, &player->actor, 8); + func_8002DF54(play, &player->actor, 8); } // if parent is NULL, link threw it - if (Actor_HasNoParent(&this->dyna.actor, globalCtx)) { + if (Actor_HasNoParent(&this->dyna.actor, play)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_HEAVY_THROW); this->actionFunc = BgHeavyBlock_Fly; } } -void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) { s32 bgId; s32 quakeIndex; Vec3f pos; @@ -391,7 +391,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { pos.y = this->dyna.actor.home.pos.y + 1000.0f; pos.z = this->dyna.actor.home.pos.z; raycastResult = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &pos); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &pos); this->dyna.actor.floorHeight = raycastResult; if (this->dyna.actor.home.pos.y <= raycastResult) { @@ -399,41 +399,41 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BREAKABLE: - BgHeavyBlock_SpawnPieces(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + BgHeavyBlock_SpawnPieces(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); Actor_Kill(&this->dyna.actor); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 30); // We don't want this arbitrarily long quake with the enhancement enabled if (!CVar_GetS32("gFasterHeavyBlockLift", 0)) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 2); Quake_SetSpeed(quakeIndex, 12000); Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); Quake_SetCountdown(quakeIndex, 999); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_ELECTRIC_EXPLOSION); return; case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 16, 2, 120, 0); Quake_SetCountdown(quakeIndex, 40); this->actionFunc = BgHeavyBlock_Land; - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); break; case HEAVYBLOCK_UNBREAKABLE: Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 40); @@ -441,7 +441,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { this->actionFunc = BgHeavyBlock_Land; break; default: - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 40); @@ -452,10 +452,10 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x = Math_Atan2S(this->dyna.actor.velocity.y, this->dyna.actor.speedXZ); } -void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_DoNothing(BgHeavyBlock* this, PlayState* play) { } -void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_Land(BgHeavyBlock* this, PlayState* play) { s32 pad; if (Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, 0x8AD0, 6, 2000, 100) != 0) { @@ -467,13 +467,13 @@ void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) { this->dyna.actor.home.pos = this->dyna.actor.world.pos; switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(30.0f) + 1678.0f, Rand_ZeroFloat(100.0f) + 1286.0f, + BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(30.0f) + 1678.0f, Rand_ZeroFloat(100.0f) + 1286.0f, Rand_CenteredFloat(30.0f) + 552.0f, 0.0f, 0.0f, 0.0f, 0); - BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(30.0f) + 1729.0f, Rand_ZeroFloat(80.0f) + 1269.0f, + BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(30.0f) + 1729.0f, Rand_ZeroFloat(80.0f) + 1269.0f, Rand_CenteredFloat(30.0f) + 600.0f, 0.0f, 0.0f, 0.0f, 0); break; case HEAVYBLOCK_UNBREAKABLE: - BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(100.0f) + -735.0f, 29.0f, + BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(100.0f) + -735.0f, 29.0f, Rand_CenteredFloat(100.0f) + -3418.0f, 0.0f, 0.0f, 0.0f, 3); break; } @@ -483,20 +483,20 @@ void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) { } } -void BgHeavyBlock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Update(Actor* thisx, PlayState* play) { BgHeavyBlock* this = (BgHeavyBlock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) { static Vec3f D_80884EC8 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80884ED4 = { 0.0f, 400.0f, 0.0f }; BgHeavyBlock* this = (BgHeavyBlock*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (BgHeavyBlock_LiftedUp == this->actionFunc) { Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, @@ -509,24 +509,24 @@ void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80884EC8, &thisx->world.pos); Matrix_MultVec3f(&D_80884ED4, &thisx->home.pos); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gHeavyBlockEntirePillarDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgHeavyBlock_DrawPiece(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_DrawPiece(Actor* thisx, PlayState* play) { switch (thisx->params & 0xFF) { case HEAVYBLOCK_BIG_PIECE: Matrix_Translate(50.0f, -260.0f, -20.0f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gHeavyBlockBigPieceDL); + Gfx_DrawDListOpa(play, gHeavyBlockBigPieceDL); break; case HEAVYBLOCK_SMALL_PIECE: Matrix_Translate(45.0f, -280.0f, -5.0f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gHeavyBlockSmallPieceDL); + Gfx_DrawDListOpa(play, gHeavyBlockSmallPieceDL); break; } } diff --git a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h index e816bcf7a..c6c21d2df 100644 --- a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h +++ b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h @@ -6,7 +6,7 @@ struct BgHeavyBlock; -typedef void (*BgHeavyBlockActionFunc)(struct BgHeavyBlock*, GlobalContext*); +typedef void (*BgHeavyBlockActionFunc)(struct BgHeavyBlock*, PlayState*); typedef struct BgHeavyBlock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index 9cb8c28ae..445108c11 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanCurtain_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanCurtain_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanCurtain_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanCurtain_Init(Actor* thisx, PlayState* play); +void BgHidanCurtain_Destroy(Actor* thisx, PlayState* play); +void BgHidanCurtain_Update(Actor* thisx, PlayState* play); +void BgHidanCurtain_Draw(Actor* thisx, PlayState* play); -void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_TurnOn(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_TurnOff(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, GlobalContext* globalCtx); +void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_TurnOn(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_TurnOff(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, PlayState* play); typedef struct { /* 0x00 */ s16 radius; @@ -66,7 +66,7 @@ const ActorInit Bg_Hidan_Curtain_InitVars = { NULL, }; -void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { s32 pad; BgHidanCurtain* this = (BgHidanCurtain*)thisx; BgHidanCurtainParams* hcParams; @@ -93,8 +93,8 @@ void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx) { __FILE__, __LINE__, this->actor.params); } Actor_SetScale(&this->actor, hcParams->scale); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.dim.pos.x = this->actor.world.pos.x; this->collider.dim.pos.y = this->actor.world.pos.y; this->collider.dim.pos.z = this->actor.world.pos.z; @@ -110,29 +110,29 @@ void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y = this->actor.home.pos.y - hcParams->riseDist; } } - if (((this->type == 1) && Flags_GetTreasure(globalCtx, this->treasureFlag)) || - (((this->type == 0) || (this->type == 6)) && Flags_GetClear(globalCtx, this->actor.room))) { + if (((this->type == 1) && Flags_GetTreasure(play, this->treasureFlag)) || + (((this->type == 0) || (this->type == 6)) && Flags_GetClear(play, this->actor.room))) { Actor_Kill(&this->actor); } this->texScroll = Rand_ZeroOne() * 15.0f; } -void BgHidanCurtain_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanCurtain_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgHidanCurtain* this = (BgHidanCurtain*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, PlayState* play) { + if (Flags_GetSwitch(play, this->actor.params)) { if (this->type == 1) { this->actionFunc = BgHidanCurtain_WaitForCutscene; - OnePointCutscene_Init(globalCtx, 3350, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3350, -99, &this->actor, MAIN_CAM); this->timer = 50; } else if (this->type == 3) { this->actionFunc = BgHidanCurtain_WaitForCutscene; - OnePointCutscene_Init(globalCtx, 3360, 60, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3360, 60, &this->actor, MAIN_CAM); this->timer = 30; } else { this->actionFunc = BgHidanCurtain_TurnOff; @@ -140,34 +140,34 @@ void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, GlobalContext* globalC } } -void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, PlayState* play) { if (this->timer-- == 0) { this->actionFunc = BgHidanCurtain_TurnOff; } } -void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->actor.room)) { +void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, PlayState* play) { + if (Flags_GetClear(play, this->actor.room)) { this->actionFunc = BgHidanCurtain_TurnOff; } } -void BgHidanCurtain_WaitForSwitchOff(BgHidanCurtain* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHidanCurtain_WaitForSwitchOff(BgHidanCurtain* this, PlayState* play) { + if (!Flags_GetSwitch(play, this->actor.params)) { this->actionFunc = BgHidanCurtain_TurnOn; } } -void BgHidanCurtain_TurnOn(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_TurnOn(BgHidanCurtain* this, PlayState* play) { f32 riseSpeed = sHCParams[this->size].riseSpeed; if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, riseSpeed)) { - Flags_UnsetSwitch(globalCtx, this->actor.params); + Flags_UnsetSwitch(play, this->actor.params); this->actionFunc = BgHidanCurtain_WaitForSwitchOn; } } -void BgHidanCurtain_TurnOff(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_TurnOff(BgHidanCurtain* this, PlayState* play) { BgHidanCurtainParams* hcParams = &sHCParams[this->size]; if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - hcParams->riseDist, hcParams->riseSpeed)) { @@ -190,7 +190,7 @@ void BgHidanCurtain_TurnOff(BgHidanCurtain* this, GlobalContext* globalCtx) { } } -void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, PlayState* play) { DECR(this->timer); if (this->timer == 0) { this->actionFunc = BgHidanCurtain_TurnOn; @@ -200,25 +200,25 @@ void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, GlobalContext* globalCtx) } } -void BgHidanCurtain_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanCurtain_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanCurtain* this = (BgHidanCurtain*)thisx; BgHidanCurtainParams* hcParams = &sHCParams[this->size]; f32 riseProgress; - if ((globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_SLOW_CHEST_CS) || - (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_TURN_AROUND)) { + if ((play->cameraPtrs[MAIN_CAM]->setting == CAM_SET_SLOW_CHEST_CS) || + (play->cameraPtrs[MAIN_CAM]->setting == CAM_SET_TURN_AROUND)) { this->collider.base.atFlags &= ~AT_HIT; } else { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); } if ((this->type == 4) || (this->type == 5)) { this->actor.world.pos.y = (2.0f * this->actor.home.pos.y) - hcParams->riseDist - this->actor.world.pos.y; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->type == 4) || (this->type == 5)) { this->actor.world.pos.y = (2.0f * this->actor.home.pos.y) - hcParams->riseDist - this->actor.world.pos.y; @@ -227,36 +227,36 @@ void BgHidanCurtain_Update(Actor* thisx, GlobalContext* globalCtx2) { this->alpha = 255.0f * riseProgress; if (this->alpha > 50) { this->collider.dim.height = hcParams->height * riseProgress; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (gSaveContext.sceneSetupIndex <= 3) { func_8002F974(&this->actor, NA_SE_EV_FIRE_PILLAR_S - SFX_FLAG); } - } else if ((this->type == 1) && Flags_GetTreasure(globalCtx, this->treasureFlag)) { + } else if ((this->type == 1) && Flags_GetTreasure(play, this->treasureFlag)) { Actor_Kill(&this->actor); } this->texScroll++; } } -void BgHidanCurtain_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanCurtain_Draw(Actor* thisx, PlayState* play) { BgHidanCurtain* this = (BgHidanCurtain*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 220, 0, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->texScroll & 0x7F, 0, 0x20, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->texScroll & 0x7F, 0, 0x20, 0x40, 1, 0, (this->texScroll * -0xF) & 0xFF, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h index de3b647b7..54a99a796 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h @@ -6,7 +6,7 @@ struct BgHidanCurtain; -typedef void (*BgHidanCurtainActionFunc)(struct BgHidanCurtain*, GlobalContext*); +typedef void (*BgHidanCurtainActionFunc)(struct BgHidanCurtain*, PlayState*); typedef struct BgHidanCurtain { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index a53826435..1161127cc 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgHidanDalm_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanDalm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanDalm_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanDalm_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanDalm_Init(Actor* thisx, PlayState* play); +void BgHidanDalm_Destroy(Actor* thisx, PlayState* play); +void BgHidanDalm_Update(Actor* thisx, PlayState* play); +void BgHidanDalm_Draw(Actor* thisx, PlayState* play); -void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx); -void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx); +void BgHidanDalm_Wait(BgHidanDalm* this, PlayState* play); +void BgHidanDalm_Shrink(BgHidanDalm* this, PlayState* play); const ActorInit Bg_Hidan_Dalm_InitVars = { ACTOR_BG_HIDAN_DALM, @@ -95,7 +95,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -200, ICHAIN_STOP), }; -void BgHidanDalm_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Init(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -103,30 +103,30 @@ void BgHidanDalm_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFireTempleHammerableTotemCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->colliderItems); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); this->switchFlag = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(thisx); } else { this->actionFunc = BgHidanDalm_Wait; } } -void BgHidanDalm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Destroy(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->collider); } -void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHidanDalm_Wait(BgHidanDalm* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(globalCtx) && + if ((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(play) && (player->swordAnimation == 22 || player->swordAnimation == 23)) { this->collider.base.acFlags &= ~AC_HIT; if ((this->collider.elements[0].info.bumperFlags & BUMP_HIT) || @@ -138,28 +138,28 @@ void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.x += 32.5f * Math_SinS(this->dyna.actor.world.rot.y); this->dyna.actor.world.pos.z += 32.5f * Math_CosS(this->dyna.actor.world.rot.y); - func_8002DF54(globalCtx, &this->dyna.actor, 8); + func_8002DF54(play, &this->dyna.actor, 8); this->dyna.actor.flags |= ACTOR_FLAG_4; this->actionFunc = BgHidanDalm_Shrink; this->dyna.actor.bgCheckFlags &= ~2; this->dyna.actor.bgCheckFlags &= ~8; this->dyna.actor.speedXZ = 10.0f; - Flags_SetSwitch(globalCtx, this->switchFlag); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_IT_HAMMER_HIT); + Flags_SetSwitch(play, this->switchFlag); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_IT_HAMMER_HIT); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_DARUMA_VANISH); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx) { +void BgHidanDalm_Shrink(BgHidanDalm* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; s32 i; Vec3f velocity; Vec3f pos; if (Math_StepToF(&this->dyna.actor.scale.x, 0.0f, 0.004f)) { - func_8002DF54(globalCtx, &this->dyna.actor, 7); + func_8002DF54(play, &this->dyna.actor, 7); Actor_Kill(&this->dyna.actor); } @@ -173,16 +173,16 @@ void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx) { velocity.x = 5.0f * Math_SinS(this->dyna.actor.world.rot.y + 0x8000) + (Rand_ZeroOne() - 0.5f) * 5.0f; velocity.z = 5.0f * Math_CosS(this->dyna.actor.world.rot.y + 0x8000) + (Rand_ZeroOne() - 0.5f) * 5.0f; velocity.y = (Rand_ZeroOne() - 0.5f) * 1.5f; - EffectSsKiraKira_SpawnSmallYellow(globalCtx, &pos, &velocity, &accel); + EffectSsKiraKira_SpawnSmallYellow(play, &pos, &velocity, &accel); } } -void BgHidanDalm_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Update(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 10.0f, 15.0f, 32.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 10.0f, 15.0f, 32.0f, 5); } /** @@ -208,13 +208,13 @@ void BgHidanDalm_UpdateCollider(BgHidanDalm* this) { Collider_SetTrisVertices(&this->collider, 3, &pos0, &pos2, &pos1); } -void BgHidanDalm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Draw(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; if (this->dyna.actor.params == 0) { - Gfx_DrawDListOpa(globalCtx, gFireTempleHammerableTotemBodyDL); + Gfx_DrawDListOpa(play, gFireTempleHammerableTotemBodyDL); } else { - Gfx_DrawDListOpa(globalCtx, gFireTempleHammerableTotemHeadDL); + Gfx_DrawDListOpa(play, gFireTempleHammerableTotemHeadDL); } if (this->actionFunc == BgHidanDalm_Wait) { diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h index 53d740114..1ded5bdcb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h @@ -6,7 +6,7 @@ struct BgHidanDalm; -typedef void (*BgHidanDalmActionFunc)(struct BgHidanDalm*, GlobalContext*); +typedef void (*BgHidanDalmActionFunc)(struct BgHidanDalm*, PlayState*); typedef struct BgHidanDalm { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index aed7011ce..6dcc36dc5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFirewall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFirewall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFirewall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanFirewall_Init(Actor* thisx, PlayState* play); +void BgHidanFirewall_Destroy(Actor* thisx, PlayState* play); +void BgHidanFirewall_Update(Actor* thisx, PlayState* play); +void BgHidanFirewall_Draw(Actor* thisx, PlayState* play); -s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx); +s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Wait(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Countdown(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Erupt(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Collide(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, PlayState* play); const ActorInit Bg_Hidan_Firewall_InitVars = { ACTOR_BG_HIDAN_FIREWALL, @@ -56,7 +56,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE }; -void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Init(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; this->actor.scale.x = 0.12f; @@ -65,8 +65,8 @@ void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_150 = 0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.dim.pos.y = this->actor.world.pos.y; @@ -75,17 +75,17 @@ void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHidanFirewall_Wait; } -void BgHidanFirewall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Destroy(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx) { +s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, PlayState* play) { Player* player; Vec3f distance; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); func_8002DBD0(&this->actor, &distance, &player->actor.world.pos); if (fabsf(distance.x) < 100.0f && fabsf(distance.z) < 120.0f) { @@ -94,15 +94,15 @@ s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalC return 0; } -void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx) { - if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) { +void BgHidanFirewall_Wait(BgHidanFirewall* this, PlayState* play) { + if (BgHidanFirewall_CheckProximity(this, play) != 0) { this->actor.draw = BgHidanFirewall_Draw; this->actor.params = 5; this->actionFunc = BgHidanFirewall_Countdown; } } -void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) { +void BgHidanFirewall_Countdown(BgHidanFirewall* this, PlayState* play) { if (this->actor.params != 0) { this->actor.params--; @@ -112,8 +112,8 @@ void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) } } -void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { - if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) { +void BgHidanFirewall_Erupt(BgHidanFirewall* this, PlayState* play) { + if (BgHidanFirewall_CheckProximity(this, play) != 0) { Math_StepToF(&this->actor.scale.y, 0.1f, 0.01f / 0.4f); } else { if (Math_StepToF(&this->actor.scale.y, 0.01f, 0.01f) != 0) { @@ -125,7 +125,7 @@ void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { } } -void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) { +void BgHidanFirewall_Collide(BgHidanFirewall* this, PlayState* play) { s16 phi_a3; if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { @@ -134,17 +134,17 @@ void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) { phi_a3 = this->actor.shape.rot.y + 0x8000; } - func_8002F71C(globalCtx, &this->actor, 5.0f, phi_a3, 1.0f); + func_8002F71C(play, &this->actor, 5.0f, phi_a3, 1.0f); } -void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx) { +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, PlayState* play) { Player* player; Vec3f sp30; f32 temp_ret; f32 sp28; f32 phi_f0; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); func_8002DBD0(&this->actor, &sp30, &player->actor.world.pos); if (sp30.x < -70.0f) { @@ -174,7 +174,7 @@ void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* this->collider.dim.pos.z = this->actor.world.pos.z - sp30.x * sp28 + sp30.z * temp_ret; } -void BgHidanFirewall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Update(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; s32 pad; @@ -182,14 +182,14 @@ void BgHidanFirewall_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - BgHidanFirewall_Collide(this, globalCtx); + BgHidanFirewall_Collide(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == BgHidanFirewall_Erupt) { - BgHidanFirewall_ColliderFollowPlayer(this, globalCtx); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + BgHidanFirewall_ColliderFollowPlayer(this, play); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->actor, NA_SE_EV_FIRE_PLATE - SFX_FLAG); } } @@ -199,19 +199,19 @@ static void* sFireballTexs[] = { gFireTempleFireball4Tex, gFireTempleFireball5Tex, gFireTempleFireball6Tex, gFireTempleFireball7Tex, }; -void BgHidanFirewall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Draw(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFireballTexs[this->unk_150])); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x01, 255, 255, 0, 150); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFireTempleFireballUpperHalfDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h index 8ea5aedfe..ab60763f7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h @@ -6,7 +6,7 @@ struct BgHidanFirewall; -typedef void (*BgHidanFirewallActionFunc)(struct BgHidanFirewall*, GlobalContext*); +typedef void (*BgHidanFirewallActionFunc)(struct BgHidanFirewall*, PlayState*); typedef struct BgHidanFirewall { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c index 4bf62670e..2dd63d120 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFslift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFslift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanFslift_Init(Actor* thisx, PlayState* play); +void BgHidanFslift_Destroy(Actor* thisx, PlayState* play); +void BgHidanFslift_Update(Actor* thisx, PlayState* play); +void BgHidanFslift_Draw(Actor* thisx, PlayState* play); -void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx); -void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx); -void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx); +void func_80886FCC(BgHidanFslift* this, PlayState* play); +void func_8088706C(BgHidanFslift* this, PlayState* play); +void func_808870D8(BgHidanFslift* this, PlayState* play); const ActorInit Bg_Hidan_Fslift_InitVars = { ACTOR_BG_HIDAN_FSLIFT, @@ -38,7 +38,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_STOP), }; -void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFslift_Init(Actor* thisx, PlayState* play) { s32 pad1; BgHidanFslift* this = (BgHidanFslift*)thisx; CollisionHeader* colHeader = NULL; @@ -47,8 +47,8 @@ void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gFireTempleHookshotElevatorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_HSBLOCK, + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_HSBLOCK, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 40.0f, this->dyna.actor.world.pos.z + -28.0f, 0, 0, 0, 2) == NULL) { Actor_Kill(&this->dyna.actor); @@ -67,10 +67,10 @@ void func_80886F24(BgHidanFslift* this) { } } -void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFslift_Destroy(Actor* thisx, PlayState* play) { BgHidanFslift* this = (BgHidanFslift*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80886FB4(BgHidanFslift* this) { @@ -78,7 +78,7 @@ void func_80886FB4(BgHidanFslift* this) { this->actionFunc = func_80886FCC; } -void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) { +void func_80886FCC(BgHidanFslift* this, PlayState* play) { s32 heightBool; if (this->timer) { @@ -98,7 +98,7 @@ void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) { } } -void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) { +void func_8088706C(BgHidanFslift* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 4.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_80886FB4(this); @@ -108,7 +108,7 @@ void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) { func_80886F24(this); } -void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) { +void func_808870D8(BgHidanFslift* this, PlayState* play) { if (func_80043590(&this->dyna)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 790.0f, 4.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); @@ -122,23 +122,23 @@ void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) { func_80886F24(this); } -void BgHidanFslift_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFslift_Update(Actor* thisx, PlayState* play) { BgHidanFslift* this = (BgHidanFslift*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (func_8004356C(&this->dyna)) { if (this->unk_16A == 0) { this->unk_16A = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_16A != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); } this->unk_16A = 0; } } -void BgHidanFslift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gFireTempleHookshotElevatorDL); +void BgHidanFslift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gFireTempleHookshotElevatorDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h index b18da3e95..731a8e2ce 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h @@ -6,7 +6,7 @@ struct BgHidanFslift; -typedef void (*BgHidanFsliftActionFunc)(struct BgHidanFslift*, GlobalContext*); +typedef void (*BgHidanFsliftActionFunc)(struct BgHidanFslift*, PlayState*); typedef struct BgHidanFslift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index e0d28ea1d..944ac957d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -17,19 +17,19 @@ typedef enum { /* 2 */ FWBIG_KILL } HidanFwbigMoveState; -void BgHidanFwbig_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFwbig_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFwbig_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFwbig_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanFwbig_Init(Actor* thisx, PlayState* play); +void BgHidanFwbig_Destroy(Actor* thisx, PlayState* play); +void BgHidanFwbig_Update(Actor* thisx, PlayState* play); +void BgHidanFwbig_Draw(Actor* thisx, PlayState* play); void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this); -void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_Lower(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx); +void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_Lower(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_Move(BgHidanFwbig* this, PlayState* play); const ActorInit Bg_Hidan_Fwbig_InitVars = { ACTOR_BG_HIDAN_FWBIG, @@ -68,14 +68,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_STOP), }; -void BgHidanFwbig_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanFwbig_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanFwbig* this = (BgHidanFwbig*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->direction = (u16)(thisx->params >> 8); thisx->params &= 0xFF; @@ -105,11 +105,11 @@ void BgHidanFwbig_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void BgHidanFwbig_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFwbig_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgHidanFwbig* this = (BgHidanFwbig*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this) { @@ -119,24 +119,24 @@ void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this) { this->actor.world.pos.z = (Math_CosS(startAngle) * 885.4f) + this->actor.home.pos.z; } -void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, PlayState* play) { + if (Flags_GetSwitch(play, this->actor.params)) { this->actionFunc = BgHidanFwbig_WaitForCs; - OnePointCutscene_Init(globalCtx, 3340, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3340, -99, &this->actor, MAIN_CAM); this->timer = 35; } } -void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, PlayState* play) { if (this->timer-- == 0) { this->actionFunc = BgHidanFwbig_Lower; } } -void BgHidanFwbig_Rise(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_Rise(BgHidanFwbig* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 10.0f)) { if (this->direction == 0) { - Flags_UnsetSwitch(globalCtx, this->actor.params); + Flags_UnsetSwitch(play, this->actor.params); this->actionFunc = BgHidanFwbig_WaitForSwitch; } else { this->actionFunc = BgHidanFwbig_Move; @@ -144,7 +144,7 @@ void BgHidanFwbig_Rise(BgHidanFwbig* this, GlobalContext* globalCtx) { } } -void BgHidanFwbig_Lower(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_Lower(BgHidanFwbig* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - (2400.0f * this->actor.scale.y), 10.0f)) { if (this->direction == 0) { this->actionFunc = BgHidanFwbig_WaitForTimer; @@ -164,7 +164,7 @@ void BgHidanFwbig_Lower(BgHidanFwbig* this, GlobalContext* globalCtx) { } } -void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -174,17 +174,17 @@ void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, GlobalContext* globalCtx) { func_8002F994(&this->actor, this->timer); } -void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->actor.world.pos.x < 1150.0f) { this->actionFunc = BgHidanFwbig_Rise; - OnePointCutscene_Init(globalCtx, 3290, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3290, -99, &this->actor, MAIN_CAM); } } -void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) { - if (!Player_InCsMode(globalCtx)) { +void BgHidanFwbig_Move(BgHidanFwbig* this, PlayState* play) { + if (!Player_InCsMode(play)) { if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y + (this->direction * 0x6390), 0x20)) { this->moveState = FWBIG_RESET; this->actionFunc = BgHidanFwbig_Lower; @@ -194,8 +194,8 @@ void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) { } } -void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f projPos; f32 cs; f32 sn; @@ -217,23 +217,23 @@ void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, GlobalContext* globalCtx) { this->actor.world.rot.y = (projPos.z < 0.0f) ? this->actor.shape.rot.y : this->actor.shape.rot.y + 0x8000; } -void BgHidanFwbig_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFwbig_Update(Actor* thisx, PlayState* play) { s32 pad; BgHidanFwbig* this = (BgHidanFwbig*)thisx; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f); if (this->direction != 0) { this->actionFunc = BgHidanFwbig_Lower; } } - if ((this->direction != 0) && (globalCtx->roomCtx.prevRoom.num == this->actor.room)) { + if ((this->direction != 0) && (play->roomCtx.prevRoom.num == this->actor.room)) { this->moveState = FWBIG_KILL; this->actionFunc = BgHidanFwbig_Lower; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actor.home.pos.y - 200.0f) < this->actor.world.pos.y) { if (gSaveContext.sceneSetupIndex < 4) { @@ -241,19 +241,19 @@ void BgHidanFwbig_Update(Actor* thisx, GlobalContext* globalCtx) { } else if ((s16)this->actor.world.pos.x == -513) { func_8002F974(&this->actor, NA_SE_EV_FLAME_OF_FIRE - SFX_FLAG); } - BgHidanFwbig_MoveCollider(this, globalCtx); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + BgHidanFwbig_MoveCollider(this, play); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void BgHidanFwbig_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFwbig_Draw(Actor* thisx, PlayState* play) { s32 pad; f32 height; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gEffUnknown4Tex)); @@ -266,13 +266,13 @@ void BgHidanFwbig_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 0x80, 0, 0x20, 0x40, 1, 0, - (u8)(globalCtx->gameplayFrames * -15), 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 0x80, 0, 0x20, 0x40, 1, 0, + (u8)(play->gameplayFrames * -15), 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFireTempleBigFireWallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h index c0fd6db5f..9bf96e22d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h @@ -6,7 +6,7 @@ struct BgHidanFwbig; -typedef void (*BgHidanFwbigActionFunc)(struct BgHidanFwbig*, GlobalContext*); +typedef void (*BgHidanFwbigActionFunc)(struct BgHidanFwbig*, PlayState*); typedef struct BgHidanFwbig { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index bfc04ebf2..32c4bbf70 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHamstep_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHamstep_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHamstep_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanHamstep_Init(Actor* thisx, PlayState* play); +void BgHidanHamstep_Destroy(Actor* thisx, PlayState* play); +void BgHidanHamstep_Update(Actor* thisx, PlayState* play); +void BgHidanHamstep_Draw(Actor* thisx, PlayState* play); -void func_808887C4(BgHidanHamstep* this, GlobalContext* globalCtx); -void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx); -void func_808889B8(BgHidanHamstep* this, GlobalContext* globalCtx); -void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx); -void BgHidanHamstep_DoNothing(BgHidanHamstep* this, GlobalContext* globalCtx); +void func_808887C4(BgHidanHamstep* this, PlayState* play); +void func_80888860(BgHidanHamstep* this, PlayState* play); +void func_808889B8(BgHidanHamstep* this, PlayState* play); +void func_80888A58(BgHidanHamstep* this, PlayState* play); +void BgHidanHamstep_DoNothing(BgHidanHamstep* this, PlayState* play); static f32 sYPosOffsets[] = { -20.0f, -120.0f, -220.0f, -320.0f, -420.0f, @@ -94,14 +94,14 @@ void BgHidanHamstep_SetupAction(BgHidanHamstep* this, s32 action) { this->actionFunc = sActionFuncs[action]; } -s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, GlobalContext* globalCtx2) { +s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, PlayState* play2) { BgHidanHamstep* step = this; s32 i; Vec3f pos; f32 sin; f32 cos; s16 params; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; pos = pos; // Required to match pos.y = this->dyna.actor.home.pos.y - 100.0f; @@ -116,7 +116,7 @@ s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, GlobalContext* globalCtx2 params |= (this->dyna.actor.params & 0xFF00); step = (BgHidanHamstep*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &step->dyna.actor, globalCtx, ACTOR_BG_HIDAN_HAMSTEP, pos.x, pos.y, pos.z, + &play->actorCtx, &step->dyna.actor, play, ACTOR_BG_HIDAN_HAMSTEP, pos.x, pos.y, pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, params); if (step == NULL) { @@ -126,7 +126,7 @@ s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, GlobalContext* globalCtx2 return 1; } -void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { BgHidanHamstep* this = (BgHidanHamstep*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -139,8 +139,8 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if ((this->dyna.actor.params & 0xFF) == 0) { - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); for (i = 0; i < 2; i++) { for (i2 = 0; i2 < 3; i2++) { @@ -158,9 +158,9 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gFireTempleStoneStep2Col, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) { if ((this->dyna.actor.params & 0xFF) == 0) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + (-20.0f); BgHidanHamstep_SetupAction(this, 4); @@ -181,7 +181,7 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { if ((this->dyna.actor.params & 0xFF) == 0) { // "Fire Temple Object [Hammer Step] appears" osSyncPrintf("◯◯◯炎の神殿オブジェクト【ハンマーステップ】出現\n"); - if (BgHidanHamstep_SpawnChildren(this, globalCtx) == 0) { + if (BgHidanHamstep_SpawnChildren(this, play) == 0) { step = this; // "[Hammer Step] I can't create a step!" @@ -196,17 +196,17 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHidanHamstep_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHamstep_Destroy(Actor* thisx, PlayState* play) { BgHidanHamstep* this = (BgHidanHamstep*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params & 0xFF) == 0) { - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); } } -void func_808884C8(BgHidanHamstep* step, GlobalContext* globalCtx) { +void func_808884C8(BgHidanHamstep* step, PlayState* play) { Vec3f pos = step->dyna.actor.world.pos; s32 i; f32 sin; @@ -214,7 +214,7 @@ void func_808884C8(BgHidanHamstep* step, GlobalContext* globalCtx) { pos.y -= 20.0f; - func_80033480(globalCtx, &pos, 0.0f, 0, 600, 300, 0); + func_80033480(play, &pos, 0.0f, 0, 600, 300, 0); sin = Math_SinS(step->dyna.actor.shape.rot.y + 0x8000); cos = Math_CosS(step->dyna.actor.shape.rot.y + 0x8000); @@ -224,16 +224,16 @@ void func_808884C8(BgHidanHamstep* step, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sEffectPositions); i++) { pos.x = (sEffectPositions[i][1] * sin) + (sEffectPositions[i][0] * cos) + step->dyna.actor.world.pos.x; pos.z = ((sEffectPositions[i][1] * cos) - (sEffectPositions[i][0] * sin)) + step->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 0.0f, 0, 150, 150, 0); + func_80033480(play, &pos, 0.0f, 0, 150, 150, 0); } } -void func_80888638(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_80888638(BgHidanHamstep* this, PlayState* play) { BgHidanHamstep* child = (BgHidanHamstep*)this->dyna.actor.child; while (child != NULL) { if ((child->dyna.actor.params & 0xFF) != 0) { - func_808884C8(child, globalCtx); + func_808884C8(child, play); } child = (BgHidanHamstep*)child->dyna.actor.child; } @@ -277,19 +277,19 @@ void func_80888734(BgHidanHamstep* this) { } } -void func_808887C4(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_808887C4(BgHidanHamstep* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { - OnePointCutscene_Init(globalCtx, 3310, 100, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3310, 100, &this->dyna.actor, MAIN_CAM); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_HAMMER_SWITCH); this->collider.base.acFlags = AC_NONE; BgHidanHamstep_SetupAction(this, 1); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0xFF); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_80888860(BgHidanHamstep* this, PlayState* play) { s32 pad; s32 pad2; s32 quakeIndex; @@ -308,20 +308,20 @@ void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx) { if (this->unk_244 == 1) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, -15536); Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0); Quake_SetCountdown(quakeIndex, 20); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 255, 20, 150); - func_80888638(this, globalCtx); + func_80888638(this, play); osSyncPrintf("A(%d)\n", this->dyna.actor.params); } } } } -void func_808889B8(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_808889B8(BgHidanHamstep* this, PlayState* play) { s32 pad; BgHidanHamstep* parent = (BgHidanHamstep*)this->dyna.actor.parent; @@ -338,7 +338,7 @@ void func_808889B8(BgHidanHamstep* this, GlobalContext* globalCtx) { } } -void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_80888A58(BgHidanHamstep* this, PlayState* play) { s32 pad; s32 pad2; s32 quakeIndex; @@ -366,14 +366,14 @@ void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx) { if (this->unk_244 == 1) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, -15536); Quake_SetQuakeValues(quakeIndex, 20, 1, 0, 0); Quake_SetCountdown(quakeIndex, 7); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_800AA000(10000.0f, 255, 20, 150); - func_808884C8(this, globalCtx); + func_808884C8(this, play); if ((this->dyna.actor.params & 0xFF) == 5) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -385,21 +385,21 @@ void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx) { } } -void BgHidanHamstep_DoNothing(BgHidanHamstep* this, GlobalContext* globalCtx) { +void BgHidanHamstep_DoNothing(BgHidanHamstep* this, PlayState* play) { } -void BgHidanHamstep_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHamstep_Update(Actor* thisx, PlayState* play) { BgHidanHamstep* this = (BgHidanHamstep*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHidanHamstep_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgHidanHamstep_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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); if ((thisx->params & 0xFF) == 0) { @@ -408,5 +408,5 @@ void BgHidanHamstep_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStoneStep2DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h index 223ac6278..eca062fa9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h @@ -6,7 +6,7 @@ struct BgHidanHamstep; -typedef void (*BgHidanHamstepActionFunc)(struct BgHidanHamstep*, GlobalContext*); +typedef void (*BgHidanHamstepActionFunc)(struct BgHidanHamstep*, PlayState*); typedef struct BgHidanHamstep { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index 6e70d64ce..70d847d29 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -9,14 +9,14 @@ #define FLAGS 0 -void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHrock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHrock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHrock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanHrock_Init(Actor* thisx, PlayState* play); +void BgHidanHrock_Destroy(Actor* thisx, PlayState* play); +void BgHidanHrock_Update(Actor* thisx, PlayState* play); +void BgHidanHrock_Draw(Actor* thisx, PlayState* play); -void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx); -void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx); -void func_808894A4(BgHidanHrock* this, GlobalContext* globalCtx); +void func_8088960C(BgHidanHrock* this, PlayState* play); +void func_808896B8(BgHidanHrock* this, PlayState* play); +void func_808894A4(BgHidanHrock* this, PlayState* play); const ActorInit Bg_Hidan_Hrock_InitVars = { ACTOR_BG_HIDAN_HROCK, @@ -74,7 +74,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(gravity, -1, ICHAIN_STOP), }; -void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Init(Actor* thisx, PlayState* play) { BgHidanHrock* this = (BgHidanHrock*)thisx; ColliderTrisElementInit* colliderElementInit; Vec3f vertices[3]; @@ -87,8 +87,8 @@ void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); this->unk_16A = thisx->params & 0x3F; thisx->params = (thisx->params >> 8) & 0xFF; - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->colliderItems); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); DynaPolyActor_Init(&this->dyna, DPM_UNK); sinRotY = Math_SinS(thisx->shape.rot.y); @@ -114,7 +114,7 @@ void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetTrisVertices(&this->collider, i, &vertices[0], &vertices[1], &vertices[2]); } - if (Flags_GetSwitch(globalCtx, this->unk_16A)) { + if (Flags_GetSwitch(play, this->unk_16A)) { this->actionFunc = func_808894A4; if (thisx->params == 0) { thisx->world.pos.y -= 2800.0f; @@ -138,20 +138,20 @@ void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gFireTemplePillarInsertedInGroundCol, &collisionHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, collisionHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, collisionHeader); } -void BgHidanHrock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Destroy(Actor* thisx, PlayState* play) { BgHidanHrock* this = (BgHidanHrock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->collider); } -void func_808894A4(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_808894A4(BgHidanHrock* this, PlayState* play) { } -void func_808894B0(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_808894B0(BgHidanHrock* this, PlayState* play) { if (this->unk_168 != 0) { this->unk_168--; } @@ -181,7 +181,7 @@ void func_808894B0(BgHidanHrock* this, GlobalContext* globalCtx) { } } -void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_8088960C(BgHidanHrock* this, PlayState* play) { this->dyna.actor.velocity.y++; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { @@ -189,7 +189,7 @@ void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); if (this->dyna.actor.params == 0) { - if (globalCtx->roomCtx.curRoom.num == 10) { + if (play->roomCtx.curRoom.num == 10) { this->dyna.actor.room = 10; } else { Actor_Kill(&this->dyna.actor); @@ -200,7 +200,7 @@ void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx) { } } -void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_808896B8(BgHidanHrock* this, PlayState* play) { if (this->collider.base.acFlags & 2) { this->collider.base.acFlags &= ~2; this->actionFunc = func_808894B0; @@ -211,9 +211,9 @@ void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx) { } this->unk_168 = 20; - Flags_SetSwitch(globalCtx, this->unk_16A); + Flags_SetSwitch(play, this->unk_16A); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (func_8004356C(&this->dyna)) { @@ -223,18 +223,18 @@ void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx) { } } -void BgHidanHrock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Update(Actor* thisx, PlayState* play) { BgHidanHrock* this = (BgHidanHrock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHidanHrock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Draw(Actor* thisx, PlayState* play) { static Gfx* dlists[] = { gFireTempleTallestPillarAboveRoomBeforeBossDL, gFireTemplePillarInsertedInGroundDL, gFireTemplePillarInsertedInGroundDL, }; - Gfx_DrawDListOpa(globalCtx, dlists[thisx->params]); + Gfx_DrawDListOpa(play, dlists[thisx->params]); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h index 3333f5bc4..9835f6887 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h @@ -6,7 +6,7 @@ struct BgHidanHrock; -typedef void (*BgHidanHrockActionFunc)(struct BgHidanHrock*, GlobalContext*); +typedef void (*BgHidanHrockActionFunc)(struct BgHidanHrock*, PlayState*); typedef struct BgHidanHrock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index 71256c5ef..418079e1e 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKousi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKousi_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKousi_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanKousi_Init(Actor* thisx, PlayState* play); +void BgHidanKousi_Destroy(Actor* thisx, PlayState* play); +void BgHidanKousi_Update(Actor* thisx, PlayState* play); +void BgHidanKousi_Draw(Actor* thisx, PlayState* play); void func_80889ACC(BgHidanKousi* this); -void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889BC0(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889D28(BgHidanKousi* this, GlobalContext* globalCtx); +void func_80889B5C(BgHidanKousi* this, PlayState* play); +void func_80889BC0(BgHidanKousi* this, PlayState* play); +void func_80889C18(BgHidanKousi* this, PlayState* play); +void func_80889C90(BgHidanKousi* this, PlayState* play); +void func_80889D28(BgHidanKousi* this, PlayState* play); static f32 D_80889E40[] = { 120.0f, 150.0f, 150.0f }; @@ -63,7 +63,7 @@ void BgHidanKousi_SetupAction(BgHidanKousi* this, BgHidanKousiActionFunc actionF this->actionFunc = actionFunc; } -void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKousi_Init(Actor* thisx, PlayState* play) { BgHidanKousi* this = (BgHidanKousi*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -79,9 +79,9 @@ void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx) { } CollisionHeader_GetVirtual(sMetalFencesCollisions[thisx->params & 0xFF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); thisx->world.rot.y = D_80889E7C[this->dyna.actor.params & 0xFF] + thisx->shape.rot.y; - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) { func_80889ACC(this); BgHidanKousi_SetupAction(this, func_80889D28); } else { @@ -89,9 +89,9 @@ void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHidanKousi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKousi_Destroy(Actor* thisx, PlayState* play) { BgHidanKousi* this = (BgHidanKousi*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80889ACC(BgHidanKousi* this) { @@ -104,22 +104,22 @@ void func_80889ACC(BgHidanKousi* this) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp2; } -void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0xFF)) { +void func_80889B5C(BgHidanKousi* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) { BgHidanKousi_SetupAction(this, func_80889BC0); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_168 = 0xC8; } } -void func_80889BC0(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889BC0(BgHidanKousi* this, PlayState* play) { this->unk_168 -= 1; if (this->dyna.actor.category == func_8005B198() || (this->unk_168 <= 0)) { BgHidanKousi_SetupAction(this, func_80889C18); } } -void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889C18(BgHidanKousi* this, PlayState* play) { this->dyna.actor.speedXZ += 0.2f; if (this->dyna.actor.speedXZ > 2.0f) { this->dyna.actor.speedXZ = 2.0f; @@ -129,7 +129,7 @@ void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); } -void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889C90(BgHidanKousi* this, PlayState* play) { func_8002D7EC(&this->dyna.actor); if (D_80889E40[this->dyna.actor.params & 0xFF] < Math_Vec3f_DistXYZ(&this->dyna.actor.home.pos, &this->dyna.actor.world.pos)) { @@ -141,23 +141,23 @@ void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx) { } } -void func_80889D28(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889D28(BgHidanKousi* this, PlayState* play) { } -void BgHidanKousi_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKousi_Update(Actor* thisx, PlayState* play) { BgHidanKousi* this = (BgHidanKousi*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHidanKousi_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgHidanKousi_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, sMetalFencesDLs[thisx->params & 0xFF]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h index 5507726ae..94a5aad2a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h @@ -6,7 +6,7 @@ struct BgHidanKousi; -typedef void (*BgHidanKousiActionFunc)(struct BgHidanKousi*, GlobalContext*); +typedef void (*BgHidanKousiActionFunc)(struct BgHidanKousi*, PlayState*); typedef struct BgHidanKousi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index cea7a0e03..4491eba26 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -17,10 +17,10 @@ typedef enum { /* 2 */ LARGE_BOMBABLE_WALL } FireTempleBombableObjectsType; -void BgHidanKowarerukabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKowarerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKowarerukabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKowarerukabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play); +void BgHidanKowarerukabe_Destroy(Actor* thisx, PlayState* play); +void BgHidanKowarerukabe_Update(Actor* thisx, PlayState* play); +void BgHidanKowarerukabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Hidan_Kowarerukabe_InitVars = { ACTOR_BG_HIDAN_KOWARERUKABE, @@ -68,7 +68,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, PlayState* play) { static CollisionHeader* collisionHeaders[] = { &gFireTempleCrackedStoneFloorCol, &gFireTempleBombableWallCol, @@ -81,19 +81,19 @@ void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, GlobalContext* if (collisionHeaders[this->dyna.actor.params & 0xFF] != NULL) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(collisionHeaders[this->dyna.actor.params & 0xFF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } else { this->dyna.bgId = BGACTOR_NEG_ONE; } } -void BgHidanKowarerukabe_InitColliderSphere(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_InitColliderSphere(BgHidanKowarerukabe* this, PlayState* play) { static s16 sphereRadii[] = { 80, 45, 80 }; static s16 sphereYPositions[] = { 0, 500, 500 }; s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); this->collider.elements[0].dim.modelSphere.radius = sphereRadii[this->dyna.actor.params & 0xFF]; this->collider.elements[0].dim.modelSphere.center.y = sphereYPositions[this->dyna.actor.params & 0xFF]; @@ -111,10 +111,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgHidanKowarerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; - BgHidanKowarerukabe_InitDynaPoly(this, globalCtx); + BgHidanKowarerukabe_InitDynaPoly(this, play); if (((this->dyna.actor.params & 0xFF) < CRACKED_STONE_FLOOR) || ((this->dyna.actor.params & 0xFF) > LARGE_BOMBABLE_WALL)) { @@ -125,43 +125,43 @@ void BgHidanKowarerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { Actor_Kill(&this->dyna.actor); return; } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, 0.1f); - BgHidanKowarerukabe_InitColliderSphere(this, globalCtx); + BgHidanKowarerukabe_InitColliderSphere(this, play); BgHidanKowarerukabe_OffsetActorYPos(this); // "(fire walls, floors, destroyed by bombs)(arg_data 0x%04x)" osSyncPrintf("(hidan 爆弾で壊れる 壁 床)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgHidanKowarerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Destroy(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgHidanKowarerukabe_SpawnDust(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_SpawnDust(BgHidanKowarerukabe* this, PlayState* play) { s32 pad; Vec3f pos; pos = this->dyna.actor.world.pos; pos.y += 10.0f; - func_80033480(globalCtx, &pos, 0.0f, 0, 600, 300, 1); + func_80033480(play, &pos, 0.0f, 0, 600, 300, 1); pos.x = ((Rand_ZeroOne() - 0.5f) * 80.0f) + this->dyna.actor.world.pos.x; pos.y = (Rand_ZeroOne() * 100.0f) + this->dyna.actor.world.pos.y; pos.z = ((Rand_ZeroOne() - 0.5f) * 80.0f) + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 100.0f, 4, 200, 250, 1); + func_80033480(play, &pos, 100.0f, 4, 200, 250, 1); } -void BgHidanKowarerukabe_FloorBreak(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_FloorBreak(BgHidanKowarerukabe* this, PlayState* play) { s32 i; s32 j; Vec3f velocity; @@ -195,13 +195,13 @@ void BgHidanKowarerukabe_FloorBreak(BgHidanKowarerukabe* this, GlobalContext* gl arg5 = (((i == 0) || (i == 4)) && ((j == 0) || (j == 4))) ? 65 : 64; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world.pos, -550, arg5, 15, 15, 0, arg9, 2, 16, 100, + EffectSsKakera_Spawn(play, &pos, &velocity, &thisx->world.pos, -550, arg5, 15, 15, 0, arg9, 2, 16, 100, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gBrownFragmentDL); } } } -void func_8088A67C(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void func_8088A67C(BgHidanKowarerukabe* this, PlayState* play) { s32 i; s32 j; Vec3f velocity; @@ -236,13 +236,13 @@ void func_8088A67C(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { arg5 |= 1; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world.pos, -540, arg5, 20, 20, 0, arg9, 2, 32, 100, + EffectSsKakera_Spawn(play, &pos, &velocity, &thisx->world.pos, -540, arg5, 20, 20, 0, arg9, 2, 32, 100, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gBrownFragmentDL); } } } -void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, PlayState* play) { s32 i; s32 j; Vec3f velocity; @@ -277,40 +277,40 @@ void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, GlobalContext arg5 |= 1; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world.pos, -650, arg5, 20, 20, 0, arg9, 2, 32, 100, + EffectSsKakera_Spawn(play, &pos, &velocity, &thisx->world.pos, -650, arg5, 20, 20, 0, arg9, 2, 32, 100, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gBrownFragmentDL); } } } -void BgHidanKowarerukabe_Break(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Break(BgHidanKowarerukabe* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case CRACKED_STONE_FLOOR: - BgHidanKowarerukabe_FloorBreak(this, globalCtx); + BgHidanKowarerukabe_FloorBreak(this, play); break; case BOMBABLE_WALL: - func_8088A67C(this, globalCtx); + func_8088A67C(this, play); break; case LARGE_BOMBABLE_WALL: - BgHidanKowarerukabe_LargeWallBreak(this, globalCtx); + BgHidanKowarerukabe_LargeWallBreak(this, play); break; } - BgHidanKowarerukabe_SpawnDust(this, globalCtx); + BgHidanKowarerukabe_SpawnDust(this, play); } -void BgHidanKowarerukabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Update(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; s32 pad; - if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) != NULL) { - BgHidanKowarerukabe_Break(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + if (Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) { + BgHidanKowarerukabe_Break(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); if ((this->dyna.actor.params & 0xFF) == 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_EXPLOSION); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); } func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -318,21 +318,21 @@ void BgHidanKowarerukabe_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgHidanKowarerukabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Draw(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, sBreakableWallDLists[this->dyna.actor.params & 0xFF]); Collider_UpdateSpheres(0, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 02cda0571..9c77f916d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -9,24 +9,24 @@ #define FLAGS 0 -void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanRock_Init(Actor* thisx, PlayState* play); +void BgHidanRock_Destroy(Actor* thisx, PlayState* play); +void BgHidanRock_Update(Actor* thisx, PlayState* play); +void BgHidanRock_Draw(Actor* thisx, PlayState* play); void BgHidanRock_Reset(void); void func_8088B24C(BgHidanRock* this); -void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B5F4(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B634(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B69C(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B90C(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B954(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx); +void func_8088B268(BgHidanRock* this, PlayState* play); +void func_8088B5F4(BgHidanRock* this, PlayState* play); +void func_8088B634(BgHidanRock* this, PlayState* play); +void func_8088B69C(BgHidanRock* this, PlayState* play); +void func_8088B79C(BgHidanRock* this, PlayState* play); +void func_8088B90C(BgHidanRock* this, PlayState* play); +void func_8088B954(BgHidanRock* this, PlayState* play); +void func_8088B990(BgHidanRock* this, PlayState* play); -void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this); +void func_8088BC40(PlayState* play, BgHidanRock* this); static Vec3f D_8088BF60 = { 3310.0f, 120.0f, 0.0f }; @@ -68,7 +68,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -600, ICHAIN_STOP), }; -void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Init(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -81,11 +81,11 @@ void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params = ((thisx->params) >> 8) & 0xFF; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); if (this->type == 0) { - if (Flags_GetSwitch(globalCtx, thisx->params)) { + if (Flags_GetSwitch(play, thisx->params)) { Math_Vec3f_Copy(&thisx->home.pos, &D_8088BF60); Math_Vec3f_Copy(&thisx->world.pos, &D_8088BF60); this->timer = 60; @@ -103,15 +103,15 @@ void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8088B634; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->timer = 0; } -void BgHidanRock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Destroy(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); Audio_StopSfxByPos(&this->unk_170); } @@ -121,11 +121,11 @@ void func_8088B24C(BgHidanRock* this) { } f32 D_8088BFC0 = 0.0f; -void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B268(BgHidanRock* this, PlayState* play) { f32 sp2C; s32 temp_v1; s32 frame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { if (this->timer == 0) { @@ -173,7 +173,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { sp2C = this->dyna.actor.world.pos.z - D_8088BF60.z; if (sp2C < 0.5f) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params); + Flags_SetSwitch(play, this->dyna.actor.params); Math_Vec3f_Copy(&this->dyna.actor.home.pos, &D_8088BF60); this->dyna.actor.world.pos.x = D_8088BF60.x; this->dyna.actor.world.pos.z = D_8088BF60.z; @@ -183,8 +183,8 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { this->actionFunc = func_8088B79C; } - frame = globalCtx->gameplayFrames & 0xFF; - if (globalCtx->gameplayFrames & 0x100) { + frame = play->gameplayFrames & 0xFF; + if (play->gameplayFrames & 0x100) { this->unk_16C = 0.0f; } else if (frame < 128) { this->unk_16C = sinf(frame * (4 * 0.001f * M_PI)) * 19.625f; @@ -200,7 +200,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B5F4(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B5F4(BgHidanRock* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -210,15 +210,15 @@ void func_8088B5F4(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B634(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B634(BgHidanRock* this, PlayState* play) { if (func_8004356C(&this->dyna)) { this->timer = 20; - this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4000; + this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4000; this->actionFunc = func_8088B69C; } } -void func_8088B69C(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B69C(BgHidanRock* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -240,7 +240,7 @@ void func_8088B69C(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B79C(BgHidanRock* this, PlayState* play) { this->timer--; if (this->dyna.actor.bgCheckFlags & 2) { if (this->type == 0) { @@ -255,7 +255,7 @@ void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Audio_PlayActorSound2( &this->dyna.actor, - SurfaceType_GetSfx(&globalCtx->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + 0x800); + SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + 0x800); } this->unk_16C -= 0.5f; @@ -266,23 +266,23 @@ void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { if (this->unk_169 == 0) { this->unk_169 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_169 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); } this->unk_169 = 0; } } } -void func_8088B90C(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B90C(BgHidanRock* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f)) { this->actionFunc = func_8088B634; } } -void func_8088B954(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B954(BgHidanRock* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -293,8 +293,8 @@ void func_8088B954(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088B990(BgHidanRock* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->timer++; if (this->dyna.unk_150 != 0.0f) { @@ -319,28 +319,28 @@ void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx) { if (this->unk_169 == 0) { this->unk_169 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_169 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); } this->unk_169 = 0; } } } -void BgHidanRock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Update(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == func_8088B79C) { Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); } if (this->unk_16C > 0.0f) { this->collider.dim.height = sCylinderInit.dim.height * this->unk_16C; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -350,10 +350,10 @@ static void* sVerticalFlamesTexs[] = { gFireTempleBigVerticalFlame6Tex, gFireTempleBigVerticalFlame7Tex, }; -void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this) { +void func_8088BC40(PlayState* play, BgHidanRock* this) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x01, 255, 255, 0, 150); @@ -366,37 +366,37 @@ void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this) { MTXMODE_NEW); } - Matrix_RotateZYX(0, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, 0, MTXMODE_APPLY); Matrix_Translate(-10.5f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(6.0f, this->unk_16C, 6.0f, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sVerticalFlamesTexs[globalCtx->gameplayFrames & 7])); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sVerticalFlamesTexs[play->gameplayFrames & 7])); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFireTempleBigVerticalFlameDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgHidanRock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Draw(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; s32 pad; if (this->type == 0) { - Gfx_DrawDListOpa(globalCtx, gFireTempleStoneBlock1DL); + Gfx_DrawDListOpa(play, gFireTempleStoneBlock1DL); } else { - Gfx_DrawDListOpa(globalCtx, gFireTempleStoneBlock2DL); + Gfx_DrawDListOpa(play, gFireTempleStoneBlock2DL); } if (this->unk_16C > 0.0f) { if (this->type == 0) { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &D_8088BF60, &this->unk_170); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &D_8088BF60, &this->unk_170); } else { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->dyna.actor.home.pos, &this->unk_170); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->dyna.actor.home.pos, &this->unk_170); } func_80078914(&this->unk_170, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); - func_8088BC40(globalCtx, this); + func_8088BC40(play, this); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h index a65c4234e..35ba9ef62 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h @@ -6,7 +6,7 @@ struct BgHidanRock; -typedef void (*BgHidanRockActionFunc)(struct BgHidanRock*, GlobalContext*); +typedef void (*BgHidanRockActionFunc)(struct BgHidanRock*, PlayState*); typedef struct BgHidanRock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 8e6389227..4eecfde32 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRsekizou_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRsekizou_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRsekizou_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanRsekizou_Init(Actor* thisx, PlayState* play); +void BgHidanRsekizou_Destroy(Actor* thisx, PlayState* play); +void BgHidanRsekizou_Update(Actor* thisx, PlayState* play); +void BgHidanRsekizou_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Hidan_Rsekizou_InitVars = { ACTOR_BG_HIDAN_RSEKIZOU, @@ -120,7 +120,7 @@ static void* sFireballsTexs[] = { gFireTempleFireball4Tex, gFireTempleFireball5Tex, gFireTempleFireball6Tex, gFireTempleFireball7Tex, }; -void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; s32 i; s32 pad; @@ -130,9 +130,9 @@ void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); for (i = 0; i < ARRAY_COUNT(this->colliderItems); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } @@ -140,14 +140,14 @@ void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx) { this->bendFrame = 0; } -void BgHidanRsekizou_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Destroy(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgHidanRsekizou_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; s32 i; ColliderJntSphElement* sphere; @@ -178,11 +178,11 @@ void BgHidanRsekizou_Update(Actor* thisx, GlobalContext* globalCtx) { yawCosine * sphere->dim.modelSphere.center.z; } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); } -Gfx* BgHidanRsekizou_DrawFireball(GlobalContext* globalCtx, BgHidanRsekizou* this, s16 frame, MtxF* mf, s32 a, +Gfx* BgHidanRsekizou_DrawFireball(PlayState* play, BgHidanRsekizou* this, s16 frame, MtxF* mf, s32 a, Gfx* displayList) { f32 coss; f32 sins; @@ -216,24 +216,24 @@ Gfx* BgHidanRsekizou_DrawFireball(GlobalContext* globalCtx, BgHidanRsekizou* thi gSPMatrix(displayList++, Matrix_MtxFToMtx(MATRIX_CHECKFLOATS(mf), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(displayList++, gFireTempleFireballDL); return displayList; } -void BgHidanRsekizou_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Draw(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; s32 i; s32 pad; MtxF mf; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, gFireTempleSpinningFlamethrowerDL); Matrix_MtxFCopy(&mf, &gMtxFClear); @@ -241,23 +241,23 @@ void BgHidanRsekizou_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); // Strange original code. Add || 1 for frame interpolation to get correct. - if ((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= 0 || 1) { + if ((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= 0 || 1) { for (i = 3; i >= 0; i--) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 0, POLY_XLU_DISP); } for (i = 0; i < 4; i++) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 1, POLY_XLU_DISP); } } else { for (i = 3; i >= 0; i--) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 1, POLY_XLU_DISP); } for (i = 0; i < 4; i++) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 0, POLY_XLU_DISP); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 58a88f76c..967396c34 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSekizou_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSekizou_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSekizou_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanSekizou_Init(Actor* thisx, PlayState* play); +void BgHidanSekizou_Destroy(Actor* thisx, PlayState* play); +void BgHidanSekizou_Update(Actor* thisx, PlayState* play); +void BgHidanSekizou_Draw(Actor* thisx, PlayState* play); -void func_8088D434(BgHidanSekizou* this, GlobalContext* globalCtx); -void func_8088D720(BgHidanSekizou* this, GlobalContext* globalCtx); +void func_8088D434(BgHidanSekizou* this, PlayState* play); +void func_8088D720(BgHidanSekizou* this, PlayState* play); const ActorInit Bg_Hidan_Sekizou_InitVars = { ACTOR_BG_HIDAN_SEKIZOU, @@ -145,7 +145,7 @@ void func_8088CEC0(BgHidanSekizou* this, s32 arg1, s16 arg2) { } } -void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSekizou_Init(Actor* thisx, PlayState* play) { s32 pad; BgHidanSekizou* this = (BgHidanSekizou*)thisx; s32 i; @@ -153,8 +153,8 @@ void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); for (i = 0; i < ARRAY_COUNT(this->elements); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } @@ -171,20 +171,20 @@ void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx) { this->updateFunc = func_8088D434; } this->unk_170 = 0; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); CollisionCheck_SetInfo(&this->dyna.actor.colChkInfo, NULL, &sColChkInfoInit); } -void BgHidanSekizou_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanSekizou_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanSekizou* this = (BgHidanSekizou*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void func_8088D434(BgHidanSekizou* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088D434(BgHidanSekizou* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s32 isAligned[2]; s32 isClose; @@ -216,14 +216,14 @@ void func_8088D434(BgHidanSekizou* this, GlobalContext* globalCtx) { } } -void func_8088D720(BgHidanSekizou* this, GlobalContext* globalCtx) { +void func_8088D720(BgHidanSekizou* this, PlayState* play) { this->unk_168[0]--; if (this->unk_168[0] <= -36) { this->unk_168[0] = 36; } } -void func_8088D750(BgHidanSekizou* this, GlobalContext* globalCtx) { +void func_8088D750(BgHidanSekizou* this, PlayState* play) { s16 phi_a3; if (this->dyna.actor.xzDistToPlayer > 200.0f) { @@ -259,11 +259,11 @@ void func_8088D750(BgHidanSekizou* this, GlobalContext* globalCtx) { phi_a3 = -0x4000; } } - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, phi_a3, 1.0f); + func_8002F71C(play, &this->dyna.actor, 5.0f, phi_a3, 1.0f); } -void BgHidanSekizou_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanSekizou_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanSekizou* this = (BgHidanSekizou*)thisx; if (this->unk_170 != 0) { @@ -275,27 +275,27 @@ void BgHidanSekizou_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8088D750(this, globalCtx); + func_8088D750(this, play); } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); if (this->dyna.actor.params == 0) { if (this->unk_168[0] > 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); } } else { if ((this->unk_168[0] > 0) || (this->unk_168[1] > 0) || (this->unk_168[2] > 0) || (this->unk_168[3] > 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); } } } -Gfx* func_8088D9F4(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 arg4, f32 arg5, s16 arg6, +Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 arg4, f32 arg5, s16 arg6, Gfx* arg7) { f32 temp_f0; f32 temp_f2; @@ -320,7 +320,7 @@ Gfx* func_8088D9F4(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, Mtx arg3->zw = (temp_f2 * arg5) + this->dyna.actor.world.pos.z; gSPMatrix(arg7++, Matrix_MtxFToMtx(MATRIX_CHECKFLOATS(arg3), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(arg7++, gFireTempleFireballDL); @@ -328,7 +328,7 @@ Gfx* func_8088D9F4(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, Mtx return arg7; } -Gfx* func_8088DC50(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, s16 arg3, Gfx* arg4) { +Gfx* func_8088DC50(PlayState* play, BgHidanSekizou* this, s16 arg2, s16 arg3, Gfx* arg4) { s32 pad; s16 temp_v1; s32 phi_s1; @@ -349,15 +349,15 @@ Gfx* func_8088DC50(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, s16 temp_f20 = Math_SinS(arg2); temp_f22 = Math_CosS(arg2); Matrix_MtxFCopy(&sp68, &gMtxFClear); - temp_v1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - arg2; + temp_v1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - arg2; if (ABS(temp_v1) < 0x4000) { for (i = phi_s2 - 1; i >= phi_s1; i--) { - arg4 = func_8088D9F4(globalCtx, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); + arg4 = func_8088D9F4(play, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); } } else { for (i = phi_s1; i < phi_s2; i++) { - arg4 = func_8088D9F4(globalCtx, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); + arg4 = func_8088D9F4(play, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); } } return arg4; @@ -389,15 +389,15 @@ void func_8088DE08(s16 arg0, s16 arg1, s32 arg2[]) { } } -void BgHidanSekizou_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanSekizou_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanSekizou* this = (BgHidanSekizou*)thisx; s32 i; s32 sp6C[4]; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStationaryFlamethrowerShortDL); @@ -407,28 +407,28 @@ void BgHidanSekizou_Draw(Actor* thisx, GlobalContext* globalCtx2) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); if (this->dyna.actor.params == 0) { if (this->unk_168[0] > 0) { - if ((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->dyna.actor.shape.rot.y) >= 0) { - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], + if ((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->dyna.actor.shape.rot.y) >= 0) { + POLY_XLU_DISP = func_8088DC50(play, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], POLY_XLU_DISP); - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], + POLY_XLU_DISP = func_8088DC50(play, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], POLY_XLU_DISP); } else { - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], + POLY_XLU_DISP = func_8088DC50(play, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], POLY_XLU_DISP); - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], + POLY_XLU_DISP = func_8088DC50(play, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], POLY_XLU_DISP); } } } else { - func_8088DE08(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)), this->dyna.actor.shape.rot.y, sp6C); + func_8088DE08(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)), this->dyna.actor.shape.rot.y, sp6C); for (i = 0; i < 4; i++) { s32 index = sp6C[i]; if (this->unk_168[index] > 0) { - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y + index * 0x4000, + POLY_XLU_DISP = func_8088DC50(play, this, this->dyna.actor.shape.rot.y + index * 0x4000, this->unk_168[index], POLY_XLU_DISP); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h index ed513f660..86b9427df 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h @@ -6,7 +6,7 @@ struct BgHidanSekizou; -typedef void (*BgHidanSekizouUpdateFunc)(struct BgHidanSekizou*, GlobalContext*); +typedef void (*BgHidanSekizouUpdateFunc)(struct BgHidanSekizou*, PlayState*); typedef struct BgHidanSekizou { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index ba638d8bc..86848297c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSima_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSima_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSima_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanSima_Init(Actor* thisx, PlayState* play); +void BgHidanSima_Destroy(Actor* thisx, PlayState* play); +void BgHidanSima_Update(Actor* thisx, PlayState* play); +void BgHidanSima_Draw(Actor* thisx, PlayState* play); -void func_8088E518(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E5D0(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E6D0(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E760(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E7A8(BgHidanSima* this, GlobalContext* globalCtx); +void func_8088E518(BgHidanSima* this, PlayState* play); +void func_8088E5D0(BgHidanSima* this, PlayState* play); +void func_8088E6D0(BgHidanSima* this, PlayState* play); +void func_8088E760(BgHidanSima* this, PlayState* play); +void func_8088E7A8(BgHidanSima* this, PlayState* play); void func_8088E90C(BgHidanSima* this); const ActorInit Bg_Hidan_Sima_InitVars = { @@ -81,7 +81,7 @@ static void* sFireballsTexs[] = { gFireTempleFireball4Tex, gFireTempleFireball5Tex, gFireTempleFireball6Tex, gFireTempleFireball7Tex, }; -void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Init(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -94,9 +94,9 @@ void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx) { } else { CollisionHeader_GetVirtual(&gFireTempleStonePlatform2Col, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); for (i = 0; i < ARRAY_COUNT(sJntSphElementsInit); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } @@ -107,20 +107,20 @@ void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHidanSima_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Destroy(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void func_8088E518(BgHidanSima* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088E518(BgHidanSima* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.4f); if (func_8004356C(&this->dyna) && !(player->stateFlags1 & 0x6000)) { this->timer = 20; - this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4000; + this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4000; if (this->dyna.actor.home.pos.y <= this->dyna.actor.world.pos.y) { this->actionFunc = func_8088E5D0; } else { @@ -129,7 +129,7 @@ void func_8088E518(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E5D0(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E5D0(BgHidanSima* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -149,7 +149,7 @@ void func_8088E5D0(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E6D0(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E6D0(BgHidanSima* this, PlayState* play) { if (func_8004356C(&this->dyna)) { this->timer = 20; } else if (this->timer != 0) { @@ -161,7 +161,7 @@ void func_8088E6D0(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E760(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E760(BgHidanSima* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -172,7 +172,7 @@ void func_8088E760(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E7A8(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E7A8(BgHidanSima* this, PlayState* play) { f32 temp; if (this->timer != 0) { @@ -206,11 +206,11 @@ void func_8088E90C(BgHidanSima* this) { } } -void BgHidanSima_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Update(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params != 0) { s32 temp = (this->dyna.actor.world.rot.y == this->dyna.actor.shape.rot.y) ? this->timer : (this->timer + 80); @@ -220,12 +220,12 @@ void BgHidanSima_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - ((1.0f - cosf(temp * (M_PI / 20))) * 5.0f); if (this->actionFunc == func_8088E7A8) { func_8088E90C(this); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { +Gfx* func_8088EB54(PlayState* play, BgHidanSima* this, Gfx* gfx) { MtxF mtxF; s32 phi_s5; s32 s3; @@ -261,7 +261,7 @@ Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { gSPSegment(gfx++, 0x09, SEGMENTED_TO_VIRTUAL(sFireballsTexs[(this->timer + s3) % 7])); gSPMatrix(gfx++, Matrix_MtxFToMtx(MATRIX_CHECKFLOATS(&mtxF), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gFireTempleFireballDL); } @@ -270,18 +270,18 @@ Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { gSPSegment(gfx++, 0x09, SEGMENTED_TO_VIRTUAL(sFireballsTexs[(this->timer + s3) % 7])); gSPMatrix(gfx++, Matrix_MtxFToMtx(MATRIX_CHECKFLOATS(&mtxF), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gFireTempleFireballDL); return gfx; } -void BgHidanSima_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Draw(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStonePlatform1DL); @@ -291,8 +291,8 @@ void BgHidanSima_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gDPSetPrimColor(POLY_XLU_DISP++, 0, 1, 255, 255, 0, 150); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255); - POLY_XLU_DISP = func_8088EB54(globalCtx, this, POLY_XLU_DISP); + POLY_XLU_DISP = func_8088EB54(play, this, POLY_XLU_DISP); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h index f31999c3b..927391110 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h @@ -6,7 +6,7 @@ struct BgHidanSima; -typedef void (*BgHidanSimaActionFunc)(struct BgHidanSima*, GlobalContext*); +typedef void (*BgHidanSimaActionFunc)(struct BgHidanSima*, PlayState*); typedef struct BgHidanSima { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c index 1d494690a..30dcbca85 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSyoku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSyoku_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSyoku_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanSyoku_Init(Actor* thisx, PlayState* play); +void BgHidanSyoku_Destroy(Actor* thisx, PlayState* play); +void BgHidanSyoku_Update(Actor* thisx, PlayState* play); +void BgHidanSyoku_Draw(Actor* thisx, PlayState* play); -void func_8088F4B8(BgHidanSyoku* this, GlobalContext* globalCtx); -void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx); -void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx); +void func_8088F4B8(BgHidanSyoku* this, PlayState* play); +void func_8088F514(BgHidanSyoku* this, PlayState* play); +void func_8088F62C(BgHidanSyoku* this, PlayState* play); const ActorInit Bg_Hidan_Syoku_InitVars = { ACTOR_BG_HIDAN_SYOKU, @@ -35,7 +35,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSyoku_Init(Actor* thisx, PlayState* play) { s32 pad; BgHidanSyoku* this = (BgHidanSyoku*)thisx; CollisionHeader* colHeader = NULL; @@ -43,15 +43,15 @@ void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gFireTempleFlareDancerPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = func_8088F4B8; this->dyna.actor.home.pos.y += 540.0f; } -void BgHidanSyoku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSyoku_Destroy(Actor* thisx, PlayState* play) { BgHidanSyoku* this = (BgHidanSyoku*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_8088F47C(BgHidanSyoku* this) { @@ -60,14 +60,14 @@ void func_8088F47C(BgHidanSyoku* this) { this->actionFunc = func_8088F62C; } -void func_8088F4B8(BgHidanSyoku* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room) && func_8004356C(&this->dyna)) { +void func_8088F4B8(BgHidanSyoku* this, PlayState* play) { + if (Flags_GetClear(play, this->dyna.actor.room) && func_8004356C(&this->dyna)) { this->timer = 140; this->actionFunc = func_8088F514; } } -void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) { +void func_8088F514(BgHidanSyoku* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -79,7 +79,7 @@ void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) { } } -void func_8088F5A0(BgHidanSyoku* this, GlobalContext* globalCtx) { +void func_8088F5A0(BgHidanSyoku* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -91,7 +91,7 @@ void func_8088F5A0(BgHidanSyoku* this, GlobalContext* globalCtx) { } } -void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx) { +void func_8088F62C(BgHidanSyoku* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -105,23 +105,23 @@ void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx) { } } -void BgHidanSyoku_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSyoku_Update(Actor* thisx, PlayState* play) { BgHidanSyoku* this = (BgHidanSyoku*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (func_8004356C(&this->dyna)) { if (this->unk_168 == 0) { this->unk_168 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_168 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); } this->unk_168 = 0; } } -void BgHidanSyoku_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gFireTempleFlareDancerPlatformDL); +void BgHidanSyoku_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gFireTempleFlareDancerPlatformDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h b/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h index 9147c8c76..61e3520b7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h @@ -6,7 +6,7 @@ struct BgHidanSyoku; -typedef void (*BgHidanSyokuActionFunc)(struct BgHidanSyoku*, GlobalContext*); +typedef void (*BgHidanSyokuActionFunc)(struct BgHidanSyoku*, PlayState*); typedef struct BgHidanSyoku { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c index b49813245..9c5751561 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void BgIceObjects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceObjects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceObjects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceObjects_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceObjects_Init(Actor* thisx, PlayState* play); +void BgIceObjects_Destroy(Actor* thisx, PlayState* play); +void BgIceObjects_Update(Actor* thisx, PlayState* play); +void BgIceObjects_Draw(Actor* thisx, PlayState* play); -void BgIceObjects_Idle(BgIceObjects* this, GlobalContext* globalCtx); -void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx); -void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx); -void BgIceObjects_Stuck(BgIceObjects* this, GlobalContext* globalCtx); +void BgIceObjects_Idle(BgIceObjects* this, PlayState* play); +void BgIceObjects_Slide(BgIceObjects* this, PlayState* play); +void BgIceObjects_Reset(BgIceObjects* this, PlayState* play); +void BgIceObjects_Stuck(BgIceObjects* this, PlayState* play); static Color_RGBA8 sWhite = { 250, 250, 250, 255 }; static Color_RGBA8 sGray = { 180, 180, 180, 255 }; @@ -40,7 +40,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgIceObjects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Init(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; CollisionHeader* colHeader = NULL; @@ -50,15 +50,15 @@ void BgIceObjects_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_ice_objects_Col_0003F0, &colHeader); Math_Vec3f_Copy(&this->targetPos, &this->dyna.actor.home.pos); this->actionFunc = BgIceObjects_Idle; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.params = 0; } -void BgIceObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } static s16 sXStarts[] = { @@ -80,7 +80,7 @@ static s16 sXStops[7][2] = { * defaulting to the maximum x wall or minimum z wall. Each x and z position * has only one possible wall or pit on each side of it. */ -void BgIceObjects_SetNextTarget(BgIceObjects* this, GlobalContext* globalCtx) { +void BgIceObjects_SetNextTarget(BgIceObjects* this, PlayState* play) { s16 x16; s16 z16 = 0; // needed to match s32 i; @@ -111,7 +111,7 @@ void BgIceObjects_SetNextTarget(BgIceObjects* this, GlobalContext* globalCtx) { /* * Checks if the block has fallen into any of the pits. */ -void BgIceObjects_CheckPits(BgIceObjects* this, GlobalContext* globalCtx) { +void BgIceObjects_CheckPits(BgIceObjects* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if ((thisx->velocity.y > 0.0f) || ((thisx->world.pos.x <= -1660.0f) && (thisx->world.pos.z <= -1060.0f)) || @@ -126,24 +126,24 @@ void BgIceObjects_CheckPits(BgIceObjects* this, GlobalContext* globalCtx) { thisx->world.pos.y = thisx->home.pos.y - 60.0f; thisx->world.pos.z = thisx->home.pos.z; if (thisx->params != 0) { - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); } this->actionFunc = BgIceObjects_Reset; } } } -void BgIceObjects_Idle(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgIceObjects_Idle(BgIceObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; - if ((this->dyna.unk_150 > 0.0f) && !Player_InCsMode(globalCtx)) { - BgIceObjects_SetNextTarget(this, globalCtx); + if ((this->dyna.unk_150 > 0.0f) && !Player_InCsMode(play)) { + BgIceObjects_SetNextTarget(this, play); if (Actor_WorldDistXZToPoint(thisx, &this->targetPos) > 1.0f) { thisx->flags |= ACTOR_FLAG_4; - func_8002DF54(globalCtx, thisx, 8); + func_8002DF54(play, thisx, 8); thisx->params = 1; this->actionFunc = BgIceObjects_Slide; } @@ -151,11 +151,11 @@ void BgIceObjects_Idle(BgIceObjects* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; } if (thisx->velocity.y > 0.0f) { - BgIceObjects_CheckPits(this, globalCtx); + BgIceObjects_CheckPits(this, play); } } -void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx) { +void BgIceObjects_Slide(BgIceObjects* this, PlayState* play) { s32 atTarget; Vec3f pos; Vec3f velocity; @@ -173,7 +173,7 @@ void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx) { thisx->flags &= ~ACTOR_FLAG_4; } thisx->params = 0; - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); if ((fabsf(thisx->world.pos.x + 1387.0f) < 1.0f) && (fabsf(thisx->world.pos.z + 260.0f) < 1.0f)) { this->actionFunc = BgIceObjects_Stuck; @@ -188,18 +188,18 @@ void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx) { pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) - (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) + (Math_SinS(this->dyna.unk_158) * spread); pos.y = thisx->world.pos.y; - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); spread = Rand_CenteredFloat(120.0f); pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) + (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) - (Math_SinS(this->dyna.unk_158) * spread); - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); func_8002F974(thisx, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } - BgIceObjects_CheckPits(this, globalCtx); + BgIceObjects_CheckPits(this, play); } -void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgIceObjects_Reset(BgIceObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { @@ -214,8 +214,8 @@ void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx) { } } -void BgIceObjects_Stuck(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgIceObjects_Stuck(BgIceObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -223,16 +223,16 @@ void BgIceObjects_Stuck(BgIceObjects* this, GlobalContext* globalCtx) { } } -void BgIceObjects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Update(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Draw(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_000190); + Gfx_DrawDListOpa(play, object_ice_objects_DL_000190); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h b/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h index ef9872823..13a2334c3 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h @@ -6,7 +6,7 @@ struct BgIceObjects; -typedef void (*BgIceObjectsActionFunc) (struct BgIceObjects*, GlobalContext*); +typedef void (*BgIceObjectsActionFunc) (struct BgIceObjects*, PlayState*); typedef struct BgIceObjects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index b72ee7f93..5c1e0c111 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -3,19 +3,19 @@ #define FLAGS 0 -void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceShelter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceShelter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceShelter_Init(Actor* thisx, PlayState* play); +void BgIceShelter_Destroy(Actor* thisx, PlayState* play); +void BgIceShelter_Update(Actor* thisx, PlayState* play); +void BgIceShelter_Draw(Actor* thisx, PlayState* play); void func_80891064(BgIceShelter* this); void func_808911BC(BgIceShelter* this); -void func_8089107C(BgIceShelter* this, GlobalContext* globalCtx); -void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx); +void func_8089107C(BgIceShelter* this, PlayState* play); +void func_808911D4(BgIceShelter* this, PlayState* play); // For "Blue Fire Arrows" enhancement -void MeltOnIceArrowHit(BgIceShelter* this, ColliderCylinder cylinder, s16 type, GlobalContext* globalCtx); +void MeltOnIceArrowHit(BgIceShelter* this, ColliderCylinder cylinder, s16 type, PlayState* play); const ActorInit Bg_Ice_Shelter_InitVars = { ACTOR_BG_ICE_SHELTER, @@ -98,7 +98,7 @@ static ColliderCylinderInit sIceArrowCylinderInit = { bool blueFireArrowsEnabledOnRedIceLoad = false; -void func_80890740(BgIceShelter* this, GlobalContext* globalCtx) { +void func_80890740(BgIceShelter* this, PlayState* play) { static s16 cylinderRadii[] = { 47, 33, 44, 41, 100 }; static s16 cylinderHeights[] = { 80, 54, 90, 60, 200 }; s32 pad; @@ -107,12 +107,12 @@ void func_80890740(BgIceShelter* this, GlobalContext* globalCtx) { // Initialize this with the red ice, so it can't be affected by toggling while the actor is loaded blueFireArrowsEnabledOnRedIceLoad = CVar_GetS32("gBlueFireArrows", 0) || (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_BLUE_FIRE_ARROWS)); - Collider_InitCylinder(globalCtx, &this->cylinder1); + Collider_InitCylinder(play, &this->cylinder1); // If "Blue Fire Arrows" is enabled, set up a collider on the red ice that responds to them if (blueFireArrowsEnabledOnRedIceLoad) { - Collider_SetCylinder(globalCtx, &this->cylinder1, &this->dyna.actor, &sIceArrowCylinderInit); + Collider_SetCylinder(play, &this->cylinder1, &this->dyna.actor, &sIceArrowCylinderInit); } else { - Collider_SetCylinder(globalCtx, &this->cylinder1, &this->dyna.actor, &sCylinder1Init); + Collider_SetCylinder(play, &this->cylinder1, &this->dyna.actor, &sCylinder1Init); } Collider_UpdateCylinder(&this->dyna.actor, &this->cylinder1); @@ -120,8 +120,8 @@ void func_80890740(BgIceShelter* this, GlobalContext* globalCtx) { this->cylinder1.dim.height = cylinderHeights[type]; if (type == 0 || type == 1 || type == 4) { - Collider_InitCylinder(globalCtx, &this->cylinder2); - Collider_SetCylinder(globalCtx, &this->cylinder2, &this->dyna.actor, &sCylinder2Init); + Collider_InitCylinder(play, &this->cylinder2); + Collider_SetCylinder(play, &this->cylinder2, &this->dyna.actor, &sCylinder2Init); Collider_UpdateCylinder(&this->dyna.actor, &this->cylinder2); this->cylinder2.dim.radius = cylinderRadii[type]; this->cylinder2.dim.height = cylinderHeights[type]; @@ -133,14 +133,14 @@ void func_80890740(BgIceShelter* this, GlobalContext* globalCtx) { } } -void func_80890874(BgIceShelter* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void func_80890874(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG registration failed" @@ -164,7 +164,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShelter_Init(Actor* thisx, PlayState* play) { static Vec3f kzIceScale = { 0.18f, 0.27f, 0.24f }; BgIceShelter* this = (BgIceShelter*)thisx; s16 type = (this->dyna.actor.params >> 8) & 7; @@ -186,18 +186,18 @@ void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx) { switch (type) { case 2: - func_80890874(this, globalCtx, &object_ice_objects_Col_001C1C, 0); + func_80890874(this, play, &object_ice_objects_Col_001C1C, 0); break; case 3: - func_80890874(this, globalCtx, &object_ice_objects_Col_002920, 0); + func_80890874(this, play, &object_ice_objects_Col_002920, 0); break; } - func_80890740(this, globalCtx); + func_80890740(this, play); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - if (!((this->dyna.actor.params >> 6) & 1) && (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F))) { + if (!((this->dyna.actor.params >> 6) & 1) && (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } @@ -207,29 +207,29 @@ void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(ice shelter)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgIceShelter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShelter_Destroy(Actor* thisx, PlayState* play) { BgIceShelter* this = (BgIceShelter*)thisx; switch ((this->dyna.actor.params >> 8) & 7) { case 2: case 3: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; case 0: case 1: case 4: - Collider_DestroyCylinder(globalCtx, &this->cylinder2); + Collider_DestroyCylinder(play, &this->cylinder2); break; } - Collider_DestroyCylinder(globalCtx, &this->cylinder1); + Collider_DestroyCylinder(play, &this->cylinder1); } static s16 D_80891794[] = { 0x0000, 0x4000, 0x2000, 0x6000, 0x1000, 0x5000, 0x3000, 0x7000 }; static s16 D_808917A4[] = { 0x0000, 0x003C, 0x0018, 0x0054, 0x0030, 0x000C, 0x0048, 0x0024 }; -void func_80890B8C(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 scale) { +void func_80890B8C(BgIceShelter* this, PlayState* play, f32 chance, f32 scale) { f32 cos; f32 sin; f32 xzOffset; @@ -242,7 +242,7 @@ void func_80890B8C(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 Vec3f dustVel; Vec3f dustAccel; - frames = (s16)globalCtx->state.frames & 7; + frames = (s16)play->state.frames & 7; for (i = 0; i < 2; i++) { if (chance < Rand_ZeroOne()) { @@ -267,12 +267,12 @@ void func_80890B8C(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 dustAccel.y = 0.8f; dustAccel.z = 0.07f * cos; - func_8002829C(globalCtx, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450.0f * scale, + func_8002829C(play, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450.0f * scale, (s16)((Rand_ZeroOne() * 40.0f) + 40.0f) * scale); } } -void func_80890E00(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 arg3) { +void func_80890E00(BgIceShelter* this, PlayState* play, f32 chance, f32 arg3) { static f32 D_808917B4[] = { -1.0f, 1.0f }; Vec3f* icePos; s16 frames; @@ -283,7 +283,7 @@ void func_80890E00(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 Vec3f posOffset; s32 i; - frames = (s16)globalCtx->state.frames & 7; + frames = (s16)play->state.frames & 7; for (i = 0; i < 2; i++) { icePos = &this->dyna.actor.world.pos; @@ -307,7 +307,7 @@ void func_80890E00(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 dustAccel.y = 0.8f; dustAccel.z = (Rand_ZeroOne() * 0.14f) - 0.07f; - func_8002829C(globalCtx, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450, + func_8002829C(play, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450, (Rand_ZeroOne() * 40.0f) + 40.0f); } } @@ -317,7 +317,7 @@ void func_80891064(BgIceShelter* this) { this->alpha = 255; } -void func_8089107C(BgIceShelter* this, GlobalContext* globalCtx) { +void func_8089107C(BgIceShelter* this, PlayState* play) { s32 pad; s16 type = (this->dyna.actor.params >> 8) & 7; @@ -328,8 +328,8 @@ void func_8089107C(BgIceShelter* this, GlobalContext* globalCtx) { } // If we have "Blue Fire Arrows" enabled, check both cylinders for a hit if (blueFireArrowsEnabledOnRedIceLoad) { - MeltOnIceArrowHit(this, this->cylinder1, type, globalCtx); - MeltOnIceArrowHit(this, this->cylinder2, type, globalCtx); + MeltOnIceArrowHit(this, this->cylinder1, type, play); + MeltOnIceArrowHit(this, this->cylinder2, type, play); } // Default blue fire check if (this->cylinder1.base.acFlags & AC_HIT) { @@ -351,16 +351,16 @@ void func_8089107C(BgIceShelter* this, GlobalContext* globalCtx) { case 0: case 1: case 4: - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder2.base); break; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder1.base); } // For "Blue Fire Arrows" enhancement: If hit by an Ice Arrow, melt the red ice (copied from the default blue fire function above). -void MeltOnIceArrowHit(BgIceShelter* this, ColliderCylinder cylinder, s16 type, GlobalContext* globalCtx) { +void MeltOnIceArrowHit(BgIceShelter* this, ColliderCylinder cylinder, s16 type, PlayState* play) { if (cylinder.base.acFlags & AC_HIT) { cylinder.base.acFlags &= ~AC_HIT; if ((cylinder.base.ac != NULL) && (cylinder.base.ac->id == ACTOR_EN_ARROW)) { @@ -385,11 +385,11 @@ void func_808911BC(BgIceShelter* this) { static f32 D_808917BC[] = { -0.0015f, -0.0009f, -0.0016f, -0.0016f, -0.00375f }; static f32 D_808917D0[] = { 1.0f, 0.6f, 1.2f, 1.0f, 1.8f }; -static void (*sEffSpawnFuncs[])(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 scale) = { +static void (*sEffSpawnFuncs[])(BgIceShelter* this, PlayState* play, f32 chance, f32 scale) = { func_80890B8C, func_80890B8C, func_80890B8C, func_80890E00, func_80890B8C, }; -void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { +void func_808911D4(BgIceShelter* this, PlayState* play) { s32 pad; s32 type = (this->dyna.actor.params >> 8) & 7; @@ -406,8 +406,8 @@ void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { case 0: case 1: case 4: - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder2.base); break; } } @@ -420,11 +420,11 @@ void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { phi_f0 = 0.0f; } - sEffSpawnFuncs[type](this, globalCtx, phi_f0, D_808917D0[type]); + sEffSpawnFuncs[type](this, play, phi_f0, D_808917D0[type]); if (this->alpha <= 0) { if (!((this->dyna.actor.params >> 6) & 1)) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } if (type == 4) { @@ -435,21 +435,21 @@ void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { } } -void BgIceShelter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShelter_Update(Actor* thisx, PlayState* play) { BgIceShelter* this = (BgIceShelter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgIceShelter_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgIceShelter* this = (BgIceShelter*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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); switch ((this->dyna.actor.params >> 8) & 7) { @@ -457,7 +457,7 @@ void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { case 1: case 2: case 4: - func_8002ED80(&this->dyna.actor, globalCtx, 0); + func_8002ED80(&this->dyna.actor, play, 0); break; } @@ -468,21 +468,21 @@ void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { case 1: case 4: gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->gameplayFrames & 0x7F, - -globalCtx->gameplayFrames & 0x7F, 0x20, 0x20, 1, - -globalCtx->gameplayFrames & 0x7F, globalCtx->gameplayFrames & 0x7F, 0x20, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->gameplayFrames & 0x7F, + -play->gameplayFrames & 0x7F, 0x20, 0x20, 1, + -play->gameplayFrames & 0x7F, play->gameplayFrames & 0x7F, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, object_ice_objects_DL_0006F0); break; case 2: gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->gameplayFrames & 0xFF, 0x40, 0x40, 1, - 0, -globalCtx->gameplayFrames & 0xFF, 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames & 0xFF, 0x40, 0x40, 1, + 0, -play->gameplayFrames & 0xFF, 0x40, 0x40)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->gameplayFrames & 0xFF, - globalCtx->gameplayFrames & 0xFF, 0x40, 0x40, 1, - globalCtx->gameplayFrames & 0xFF, globalCtx->gameplayFrames & 0xFF, 0x40, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->gameplayFrames & 0xFF, + play->gameplayFrames & 0xFF, 0x40, 0x40, 1, + play->gameplayFrames & 0xFF, play->gameplayFrames & 0xFF, 0x40, 0x40)); gSPDisplayList(POLY_XLU_DISP++, object_ice_objects_DL_0012A0); break; @@ -492,5 +492,5 @@ void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h index 6f67f274e..40c715f64 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h @@ -6,7 +6,7 @@ struct BgIceShelter; -typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, GlobalContext*); +typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, PlayState*); typedef struct BgIceShelter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c b/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c index 7e49925b3..07e36a463 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceShutter_Init(Actor* thisx, PlayState* play); +void BgIceShutter_Destroy(Actor* thisx, PlayState* play); +void BgIceShutter_Update(Actor* thisx, PlayState* play); +void BgIceShutter_Draw(Actor* thisx, PlayState* play); -void func_80891CF4(BgIceShutter* thisx, GlobalContext* globalCtx); -void func_80891D6C(BgIceShutter* thisx, GlobalContext* globalCtx); -void func_80891DD4(BgIceShutter* thisx, GlobalContext* globalCtx); +void func_80891CF4(BgIceShutter* thisx, PlayState* play); +void func_80891D6C(BgIceShutter* thisx, PlayState* play); +void func_80891DD4(BgIceShutter* thisx, PlayState* play); const ActorInit Bg_Ice_Shutter_InitVars = { ACTOR_BG_ICE_SHUTTER, @@ -45,7 +45,7 @@ void func_80891AC0(BgIceShutter* this) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.home.pos.z; } -void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShutter_Init(Actor* thisx, PlayState* play) { BgIceShutter* this = (BgIceShutter*)thisx; f32 sp24; CollisionHeader* colHeader; @@ -58,20 +58,20 @@ void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) { sp28 = this->dyna.actor.params & 0xFF; this->dyna.actor.params = (this->dyna.actor.params >> 8) & 0xFF; CollisionHeader_GetVirtual(&object_ice_objects_Col_002854, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (sp28 == 2) { this->dyna.actor.shape.rot.x = -0x4000; } if (sp28 != 1) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (Flags_GetClear(play, this->dyna.actor.room)) { Actor_Kill(&this->dyna.actor); } else { this->actionFunc = func_80891CF4; } } else { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + if (Flags_GetSwitch(play, this->dyna.actor.params)) { Actor_Kill(&this->dyna.actor); } else { this->actionFunc = func_80891D6C; @@ -90,31 +90,31 @@ void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIceShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShutter_Destroy(Actor* thisx, PlayState* play) { BgIceShutter* this = (BgIceShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80891CF4(BgIceShutter* this, GlobalContext* globalCtx) { - if (Flags_GetTempClear(globalCtx, this->dyna.actor.room)) { - Flags_SetClear(globalCtx, this->dyna.actor.room); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); +void func_80891CF4(BgIceShutter* this, PlayState* play) { + if (Flags_GetTempClear(play, this->dyna.actor.room)) { + Flags_SetClear(play, this->dyna.actor.room); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_80891DD4; if (this->dyna.actor.shape.rot.x == 0) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); } } } -void func_80891D6C(BgIceShutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); +void func_80891D6C(BgIceShutter* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params)) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_80891DD4; - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); } } -void func_80891DD4(BgIceShutter* this, GlobalContext* globalCtx) { +void func_80891DD4(BgIceShutter* this, PlayState* play) { Math_StepToF(&this->dyna.actor.speedXZ, 30.0f, 2.0f); if (Math_StepToF(&this->dyna.actor.velocity.y, 210.0f, this->dyna.actor.speedXZ)) { Actor_Kill(&this->dyna.actor); @@ -124,12 +124,12 @@ void func_80891DD4(BgIceShutter* this, GlobalContext* globalCtx) { func_80891AC0(this); } -void BgIceShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShutter_Update(Actor* thisx, PlayState* play) { BgIceShutter* this = (BgIceShutter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_002740); +void BgIceShutter_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_ice_objects_DL_002740); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h b/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h index 68ac83f10..db8a7ff61 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h @@ -6,7 +6,7 @@ struct BgIceShutter; -typedef void (*BgIceShutterActionFunc)(struct BgIceShutter*, GlobalContext*); +typedef void (*BgIceShutterActionFunc)(struct BgIceShutter*, PlayState*); typedef struct BgIceShutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index 65a6ecc37..30c09ad33 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceTurara_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceTurara_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceTurara_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceTurara_Init(Actor* thisx, PlayState* play); +void BgIceTurara_Destroy(Actor* thisx, PlayState* play); +void BgIceTurara_Update(Actor* thisx, PlayState* play); +void BgIceTurara_Draw(Actor* thisx, PlayState* play); -void BgIceTurara_Stalagmite(BgIceTurara* this, GlobalContext* globalCtx); -void BgIceTurara_Wait(BgIceTurara* this, GlobalContext* globalCtx); -void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx); -void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx); -void BgIceTurara_Regrow(BgIceTurara* this, GlobalContext* globalCtx); +void BgIceTurara_Stalagmite(BgIceTurara* this, PlayState* play); +void BgIceTurara_Wait(BgIceTurara* this, PlayState* play); +void BgIceTurara_Shiver(BgIceTurara* this, PlayState* play); +void BgIceTurara_Fall(BgIceTurara* this, PlayState* play); +void BgIceTurara_Regrow(BgIceTurara* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -60,7 +60,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceTurara_Init(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -68,10 +68,10 @@ void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &colHeader); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == TURARA_STALAGMITE) { this->actionFunc = BgIceTurara_Stalagmite; } else { @@ -81,14 +81,14 @@ void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIceTurara_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceTurara_Destroy(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } -void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) { +void BgIceTurara_Break(BgIceTurara* this, PlayState* play, f32 arg2) { static Vec3f accel = { 0.0f, -1.0f, 0.0f }; static Color_RGBA8 primColor = { 170, 255, 255, 255 }; static Color_RGBA8 envColor = { 0, 50, 100, 255 }; @@ -97,7 +97,7 @@ void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) { s32 j; s32 i; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < 2; i++) { for (j = 0; j < 10; j++) { pos.x = this->dyna.actor.world.pos.x + Rand_CenteredFloat(8.0f); @@ -108,29 +108,29 @@ void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) { vel.z = Rand_CenteredFloat(7.0f); vel.y = (Rand_ZeroOne() * 4.0f) + 8.0f; - EffectSsEnIce_Spawn(globalCtx, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor, &envColor, + EffectSsEnIce_Spawn(play, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor, &envColor, 30); } } } -void BgIceTurara_Stalagmite(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Stalagmite(BgIceTurara* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { - BgIceTurara_Break(this, globalCtx, 50.0f); + BgIceTurara_Break(this, play, 50.0f); Actor_Kill(&this->dyna.actor); return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgIceTurara_Wait(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Wait(BgIceTurara* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 60.0f) { this->shiverTimer = 10; this->actionFunc = BgIceTurara_Shiver; } } -void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Shiver(BgIceTurara* this, PlayState* play) { s16 phi_v0_3; s16 phi_v0_2; f32 sp28; @@ -145,8 +145,8 @@ void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIceTurara_Fall; } else { sp28 = Rand_ZeroOne(); @@ -158,17 +158,17 @@ void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) { } } -void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Fall(BgIceTurara* this, PlayState* play) { if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & 1)) { this->collider.base.atFlags &= ~AT_HIT; this->dyna.actor.bgCheckFlags &= ~1; if (this->dyna.actor.world.pos.y < this->dyna.actor.floorHeight) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } - BgIceTurara_Break(this, globalCtx, 40.0f); + BgIceTurara_Break(this, play, 40.0f); if (this->dyna.actor.params == TURARA_STALACTITE_REGROW) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIceTurara_Regrow; } else { Actor_Kill(&this->dyna.actor); @@ -177,26 +177,26 @@ void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx) { } else { Actor_MoveForward(&this->dyna.actor); this->dyna.actor.world.pos.y += 40.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); this->dyna.actor.world.pos.y -= 40.0f; Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void BgIceTurara_Regrow(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Regrow(BgIceTurara* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f)) { this->actionFunc = BgIceTurara_Wait; this->dyna.actor.velocity.y = 0.0f; } } -void BgIceTurara_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceTurara_Update(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceTurara_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_0023D0); +void BgIceTurara_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_ice_objects_DL_0023D0); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h b/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h index aff6417df..a869888a8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h @@ -6,7 +6,7 @@ struct BgIceTurara; -typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, GlobalContext*); +typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, PlayState*); typedef enum { /* 0 */ TURARA_STALAGMITE, diff --git a/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 811440d55..abfcacfd2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx); -void BgInGate_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgInGate_Update(Actor* thisx, GlobalContext* globalCtx); -void BgInGate_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgInGate_Init(Actor* thisx, PlayState* play); +void BgInGate_Destroy(Actor* thisx, PlayState* play); +void BgInGate_Update(Actor* thisx, PlayState* play); +void BgInGate_Draw(Actor* thisx, PlayState* play); -void func_80892890(BgInGate* this, GlobalContext* globalCtx); -void BgInGate_DoNothing(BgInGate* this, GlobalContext* globalCtx); +void func_80892890(BgInGate* this, PlayState* play); +void BgInGate_DoNothing(BgInGate* this, PlayState* play); const ActorInit Bg_Ingate_InitVars = { ACTOR_BG_INGATE, @@ -34,7 +34,7 @@ void BgInGate_SetupAction(BgInGate* this, BgInGateActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgInGate_Init(Actor* thisx, PlayState* play) { BgInGate* this = (BgInGate*)thisx; s32 pad; @@ -43,9 +43,9 @@ void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gIngoGateCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if ((globalCtx->sceneNum != SCENE_SPOT20 || !LINK_IS_ADULT) || + if ((play->sceneNum != SCENE_SPOT20 || !LINK_IS_ADULT) || (((gSaveContext.eventChkInf[1] & 0x100)) && (gSaveContext.cutsceneIndex != 0xFFF0))) { Actor_Kill(&this->dyna.actor); return; @@ -53,33 +53,33 @@ void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, 0.1f); if (((this->dyna.actor.params & 1) != 0) && ((gSaveContext.eventInf[0] & 0xF) == 6)) { - globalCtx->csCtx.frames = 0; + play->csCtx.frames = 0; BgInGate_SetupAction(this, func_80892890); } else { BgInGate_SetupAction(this, BgInGate_DoNothing); } } -void BgInGate_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgInGate_Destroy(Actor* thisx, PlayState* play) { BgInGate* this = (BgInGate*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80892890(BgInGate* this, GlobalContext* globalCtx) { +void func_80892890(BgInGate* this, PlayState* play) { s32 phi0; s16 phi1; s16 csFrames; - if (globalCtx->csCtx.frames >= 50) { + if (play->csCtx.frames >= 50) { phi0 = 0x4000; if ((this->dyna.actor.params & 2) == 0) { phi0 = -0x4000; } this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y + phi0; BgInGate_SetupAction(this, BgInGate_DoNothing); - } else if (globalCtx->csCtx.frames >= 10) { - csFrames = globalCtx->csCtx.frames - 10; + } else if (play->csCtx.frames >= 10) { + csFrames = play->csCtx.frames - 10; csFrames *= 400; phi1 = csFrames; if (csFrames > 0x4000) { @@ -94,24 +94,24 @@ void func_80892890(BgInGate* this, GlobalContext* globalCtx) { } } -void BgInGate_DoNothing(BgInGate* this, GlobalContext* globalCtx) { +void BgInGate_DoNothing(BgInGate* this, PlayState* play) { } -void BgInGate_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgInGate_Update(Actor* thisx, PlayState* play) { BgInGate* this = (BgInGate*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgInGate_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgInGate_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, gIngoGateDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h b/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h index ba6e294d4..2137cc646 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h +++ b/soh/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h @@ -6,7 +6,7 @@ struct BgInGate; -typedef void (*BgInGateActionFunc)(struct BgInGate*, GlobalContext*); +typedef void (*BgInGateActionFunc)(struct BgInGate*, PlayState*); typedef struct BgInGate { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index ccb7a831c..b58b94991 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -9,19 +9,19 @@ #define FLAGS ACTOR_FLAG_4 -void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJya1flift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJya1flift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJya1flift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJya1flift_Init(Actor* thisx, PlayState* play); +void BgJya1flift_Destroy(Actor* thisx, PlayState* play); +void BgJya1flift_Update(Actor* thisx, PlayState* play); +void BgJya1flift_Draw(Actor* thisx, PlayState* play); void BgJya1flift_SetupWaitForSwitch(BgJya1flift* this); -void BgJya1flift_WaitForSwitch(BgJya1flift* this, GlobalContext* globalCtx); -void BgJya1flift_DoNothing(BgJya1flift* this, GlobalContext* globalCtx); +void BgJya1flift_WaitForSwitch(BgJya1flift* this, PlayState* play); +void BgJya1flift_DoNothing(BgJya1flift* this, PlayState* play); void BgJya1flift_ChangeDirection(BgJya1flift* this); -void BgJya1flift_Move(BgJya1flift* this, GlobalContext* globalCtx); +void BgJya1flift_Move(BgJya1flift* this, PlayState* play); void BgJya1flift_SetupDoNothing(BgJya1flift* this); void BgJya1flift_ResetMoveDelay(BgJya1flift* this); -void BgJya1flift_DelayMove(BgJya1flift* this, GlobalContext* globalCtx); +void BgJya1flift_DelayMove(BgJya1flift* this, PlayState* play); static u8 sKankyoIsSpawned = false; @@ -67,14 +67,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -void BgJya1flift_InitDynapoly(BgJya1flift* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -83,27 +83,27 @@ void BgJya1flift_InitDynapoly(BgJya1flift* this, GlobalContext* globalCtx, Colli } } -void BgJya1flift_InitCollision(Actor* thisx, GlobalContext* globalCtx) { +void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; } -void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJya1flift_Init(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; // "1 F lift" - osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sKankyoIsSpawned, globalCtx->roomCtx.curRoom.num); + osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sKankyoIsSpawned, play->roomCtx.curRoom.num); this->hasInitialized = false; if (sKankyoIsSpawned) { Actor_Kill(thisx); return; } - BgJya1flift_InitDynapoly(this, globalCtx, &g1fliftCol, 0); + BgJya1flift_InitDynapoly(this, play, &g1fliftCol, 0); Actor_ProcessInitChain(thisx, sInitChain); - BgJya1flift_InitCollision(thisx, globalCtx); - if (Flags_GetSwitch(globalCtx, (thisx->params & 0x3F))) { + BgJya1flift_InitCollision(thisx, play); + if (Flags_GetSwitch(play, (thisx->params & 0x3F))) { LINK_AGE_IN_YEARS == YEARS_ADULT ? BgJya1flift_ChangeDirection(this) : BgJya1flift_SetupDoNothing(this); } else { BgJya1flift_SetupWaitForSwitch(this); @@ -113,13 +113,13 @@ void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) { this->hasInitialized = true; } -void BgJya1flift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJya1flift_Destroy(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; if (this->hasInitialized) { sKankyoIsSpawned = false; - Collider_DestroyCylinder(globalCtx, &this->collider); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -128,8 +128,8 @@ void BgJya1flift_SetupWaitForSwitch(BgJya1flift* this) { this->dyna.actor.world.pos.y = sFinalPositions[0]; } -void BgJya1flift_WaitForSwitch(BgJya1flift* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { +void BgJya1flift_WaitForSwitch(BgJya1flift* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { BgJya1flift_ChangeDirection(this); } } @@ -139,7 +139,7 @@ void BgJya1flift_SetupDoNothing(BgJya1flift* this) { this->dyna.actor.world.pos.y = sFinalPositions[0]; } -void BgJya1flift_DoNothing(BgJya1flift* this, GlobalContext* globalCtx) { +void BgJya1flift_DoNothing(BgJya1flift* this, PlayState* play) { } void BgJya1flift_ChangeDirection(BgJya1flift* this) { @@ -148,7 +148,7 @@ void BgJya1flift_ChangeDirection(BgJya1flift* this) { this->dyna.actor.velocity.y = 0.0f; } -void BgJya1flift_Move(BgJya1flift* this, GlobalContext* globalCtx) { +void BgJya1flift_Move(BgJya1flift* this, PlayState* play) { f32 tempVelocity; Math_StepToF(&this->dyna.actor.velocity.y, 6.0f, 0.4f); @@ -172,37 +172,37 @@ void BgJya1flift_ResetMoveDelay(BgJya1flift* this) { this->moveDelay = 0; } -void BgJya1flift_DelayMove(BgJya1flift* this, GlobalContext* globalCtx) { +void BgJya1flift_DelayMove(BgJya1flift* this, PlayState* play) { this->moveDelay++; if (this->moveDelay >= 21) { BgJya1flift_ChangeDirection(this); } } -void BgJya1flift_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BgJya1flift_Update(Actor* thisx, PlayState* play2) { BgJya1flift* this = (BgJya1flift*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 tempIsRiding; // Room 0 is the first room and 6 is the room that the lift starts on - if (globalCtx->roomCtx.curRoom.num == 6 || globalCtx->roomCtx.curRoom.num == 0) { - this->actionFunc(this, globalCtx); + if (play->roomCtx.curRoom.num == 6 || play->roomCtx.curRoom.num == 0) { + this->actionFunc(this, play); tempIsRiding = func_8004356C(&this->dyna) ? true : false; if ((this->actionFunc == BgJya1flift_Move) || (this->actionFunc == BgJya1flift_DelayMove)) { if (tempIsRiding) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); } else if (!tempIsRiding && this->isLinkRiding) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); } } this->isLinkRiding = tempIsRiding; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { Actor_Kill(thisx); } } -void BgJya1flift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, g1fliftDL); +void BgJya1flift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, g1fliftDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h b/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h index fbcc7afc0..31ce5a7f4 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h @@ -6,7 +6,7 @@ struct BgJya1flift; -typedef void (*BgJya1fliftActionFunc)(struct BgJya1flift*, GlobalContext*); +typedef void (*BgJya1fliftActionFunc)(struct BgJya1flift*, PlayState*); typedef struct BgJya1flift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/soh/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index fbd73d614..366dd841a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgJyaAmishutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaAmishutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaAmishutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaAmishutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaAmishutter_Init(Actor* thisx, PlayState* play); +void BgJyaAmishutter_Destroy(Actor* thisx, PlayState* play); +void BgJyaAmishutter_Update(Actor* thisx, PlayState* play); +void BgJyaAmishutter_Draw(Actor* thisx, PlayState* play); void BgJyaAmishutter_SetupWaitForPlayer(BgJyaAmishutter* this); void BgJyaAmishutter_WaitForPlayer(BgJyaAmishutter* this); @@ -43,7 +43,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, GlobalContext* globalCtx, CollisionHeader* collision, +void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad1; CollisionHeader* colHeader = NULL; @@ -51,25 +51,25 @@ void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, GlobalContext* globalCt DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void BgJyaAmishutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) { BgJyaAmishutter* this = (BgJyaAmishutter*)thisx; - BgJyaAmishutter_InitDynaPoly(this, globalCtx, &gAmishutterCol, DPM_UNK); + BgJyaAmishutter_InitDynaPoly(this, play, &gAmishutterCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); BgJyaAmishutter_SetupWaitForPlayer(this); } -void BgJyaAmishutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaAmishutter_Destroy(Actor* thisx, PlayState* play) { BgJyaAmishutter* this = (BgJyaAmishutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgJyaAmishutter_SetupWaitForPlayer(BgJyaAmishutter* this) { @@ -118,12 +118,12 @@ void func_8089350C(BgJyaAmishutter* this) { } } -void BgJyaAmishutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaAmishutter_Update(Actor* thisx, PlayState* play) { BgJyaAmishutter* this = (BgJyaAmishutter*)thisx; this->actionFunc(this); } -void BgJyaAmishutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gAmishutterDL); +void BgJyaAmishutter_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gAmishutterDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/soh/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index f2822285b..5e91ef51b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBigmirror_Init(Actor* thisx, PlayState* play); +void BgJyaBigmirror_Destroy(Actor* thisx, PlayState* play); +void BgJyaBigmirror_Update(Actor* thisx, PlayState* play); +void BgJyaBigmirror_Draw(Actor* thisx, PlayState* play); static u8 sKankyoIsSpawned = false; @@ -41,21 +41,21 @@ static BigMirrorDataEntry sCobraSpawnData[] = { { { 60.0f, 1743.0f, -310.0f }, 0xFF02, 0x8000, 0xA000 }, }; -void BgJyaBigmirror_SetRoomFlag(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_SetRoomFlag(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; this->puzzleFlags &= ~(BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM); - if (globalCtx->roomCtx.curRoom.num == 5) { + if (play->roomCtx.curRoom.num == 5) { this->puzzleFlags |= BIGMIR_PUZZLE_IN_STATUE_ROOM; - } else if (globalCtx->roomCtx.curRoom.num == 0x19) { + } else if (play->roomCtx.curRoom.num == 0x19) { this->puzzleFlags |= BIGMIR_PUZZLE_IN_1ST_TOP_ROOM; - } else if (globalCtx->roomCtx.curRoom.num == 0x1A) { + } else if (play->roomCtx.curRoom.num == 0x1A) { this->puzzleFlags |= BIGMIR_PUZZLE_IN_2ND_TOP_ROOM; } } -void BgJyaBigmirror_HandleCobra(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { static u8 cobraPuzzleFlags[] = { BIGMIR_PUZZLE_COBRA1_SOLVED, BIGMIR_PUZZLE_COBRA2_SOLVED }; BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; BigMirrorDataEntry* curSpawnData; @@ -81,7 +81,7 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, GlobalContext* globalCtx) { } } else { curCobraInfo->cobra = (BgJyaCobra*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, + &play->actorCtx, &this->actor, play, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, curSpawnData->pos.y, curSpawnData->pos.z, 0, curCobraInfo->rotY, 0, curSpawnData->params); this->actor.child = NULL; @@ -107,17 +107,17 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - if (Flags_GetSwitch(globalCtx, 0x29)) { + if (Flags_GetSwitch(play, 0x29)) { this->puzzleFlags |= BIGMIR_PUZZLE_BOMBIWA_DESTROYED; } else { this->puzzleFlags &= ~(BIGMIR_PUZZLE_BOMBIWA_DESTROYED); } } -void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { static s16 sMirRayParamss[] = { 0x0005, 0x0007, 0x0008 }; static Vec3f sMirRayPoss[] = { { 60.0f, 1802.0f, -1102.0f }, @@ -130,7 +130,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { s32 i; s32 objBankIndex; - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MIR_RAY); + objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MIR_RAY); if ((objBankIndex < 0) || (objBankIndex != this->mirRayObjIndex)) { this->lightBeams[2] = NULL; @@ -152,8 +152,8 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 3; i++) { if (lightBeamToggles[i]) { - if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&globalCtx->objectCtx, objBankIndex)) { - this->lightBeams[i] = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, sMirRayPoss[i].x, + if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { + this->lightBeams[i] = Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPoss[i].x, sMirRayPoss[i].y, sMirRayPoss[i].z, 0, 0, 0, sMirRayParamss[i]); if (this->lightBeams[i] == NULL) { @@ -172,7 +172,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { this->mirRayObjIndex = objBankIndex; } -void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; if (sKankyoIsSpawned) { @@ -192,7 +192,7 @@ void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params); } -void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_Destroy(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; if (this->spawned) { @@ -200,53 +200,53 @@ void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx) { - BgJyaBigmirror_SetRoomFlag(thisx, globalCtx); - BgJyaBigmirror_HandleCobra(thisx, globalCtx); - BgJyaBigmirror_SetBombiwaFlag(thisx, globalCtx); - BgJyaBigmirror_HandleMirRay(thisx, globalCtx); +void BgJyaBigmirror_Update(Actor* thisx, PlayState* play) { + BgJyaBigmirror_SetRoomFlag(thisx, play); + BgJyaBigmirror_HandleCobra(thisx, play); + BgJyaBigmirror_SetBombiwaFlag(thisx, play); + BgJyaBigmirror_HandleMirRay(thisx, play); } -void BgJyaBigmirror_DrawLightBeam(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_DrawLightBeam(Actor* thisx, PlayState* play) { static Vec3s D_80893F4C = { 0, 0, 0 }; BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; Actor* lift; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - lift = Actor_Find(&globalCtx->actorCtx, ACTOR_BG_JYA_LIFT, ACTORCAT_BG); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + lift = Actor_Find(&play->actorCtx, ACTOR_BG_JYA_LIFT, ACTORCAT_BG); if (lift != NULL) { this->liftHeight = lift->world.pos.y; } Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, &this->actor.shape.rot); Matrix_Scale(0.1f, (this->liftHeight * -(1.0f / 1280.0f)) + (1779.4f / 1280.0f), 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBigMirror1DL); if (lift != NULL) { Matrix_SetTranslateRotateYXZ(lift->world.pos.x, lift->world.pos.y, lift->world.pos.z, &D_80893F4C); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBigMirror2DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_Draw(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; if (this->puzzleFlags & BIGMIR_PUZZLE_IN_1ST_TOP_ROOM) { - Gfx_DrawDListOpa(globalCtx, gBigMirror3DL); - Gfx_DrawDListXlu(globalCtx, gBigMirror4DL); + Gfx_DrawDListOpa(play, gBigMirror3DL); + Gfx_DrawDListXlu(play, gBigMirror4DL); } if ((this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM)) && (this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED) && (this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED)) { - BgJyaBigmirror_DrawLightBeam(&this->actor, globalCtx); + BgJyaBigmirror_DrawLightBeam(&this->actor, play); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index 0ca8520b1..2315c452d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgJyaBlock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBlock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBlock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBlock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBlock_Init(Actor* thisx, PlayState* play); +void BgJyaBlock_Destroy(Actor* thisx, PlayState* play); +void BgJyaBlock_Update(Actor* thisx, PlayState* play); +void BgJyaBlock_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Jya_Block_InitVars = { ACTOR_BG_JYA_BLOCK, @@ -34,45 +34,45 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_STOP), }; -void BgJyaBlock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBlock_Init(Actor* thisx, PlayState* play) { s32 pad; BgJyaBlock* this = (BgJyaBlock*)thisx; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gPushBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(play, thisx->params & 0x3F)) { Actor_Kill(&this->dyna.actor); } } -void BgJyaBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBlock_Destroy(Actor* thisx, PlayState* play) { BgJyaBlock* this = (BgJyaBlock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgJyaBlock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBlock_Update(Actor* thisx, PlayState* play) { BgJyaBlock* this = (BgJyaBlock*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; } -void BgJyaBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgJyaBlock_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gPushBlockGrayTex)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_OPA_DISP++, 232, 210, 176, 255); gSPDisplayList(POLY_OPA_DISP++, gPushBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index 0b94e7415..e1737a7ef 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -3,16 +3,16 @@ #include "objects/object_jya_obj/object_jya_obj.h" #define FLAGS ACTOR_FLAG_0 -void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombchuiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombchuiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBombchuiwa_Init(Actor* thisx, PlayState* play); +void BgJyaBombchuiwa_Destroy(Actor* thisx, PlayState* play); +void BgJyaBombchuiwa_Update(Actor* thisx, PlayState* play); +void BgJyaBombchuiwa_Draw(Actor* thisx, PlayState* play); -void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void func_808949B8(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, GlobalContext* globalCtx); +void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, PlayState* play); +void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, PlayState* play); +void func_808949B8(BgJyaBombchuiwa* this, PlayState* play); +void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, PlayState* play); +void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, PlayState* play); const ActorInit Bg_Jya_Bombchuiwa_InitVars = { ACTOR_BG_JYA_BOMBCHUIWA, @@ -62,11 +62,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaBombchuiwa_SetupCollider(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_SetupCollider(BgJyaBombchuiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderItems); } void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) { @@ -74,27 +74,27 @@ void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) { this->drawFlags |= drawFlags; } -void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Init(Actor* thisx, PlayState* play) { BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - BgJyaBombchuiwa_SetupCollider(this, globalCtx); - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { - BgJyaBombchuiwa_SpawnLightRay(this, globalCtx); + BgJyaBombchuiwa_SetupCollider(this, play); + if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { + BgJyaBombchuiwa_SpawnLightRay(this, play); } else { - BgJyaBombchuiwa_SetupWaitForExplosion(this, globalCtx); + BgJyaBombchuiwa_SetupWaitForExplosion(this, play); } Actor_SetFocus(&this->actor, 0.0f); } -void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgJyaBombchuiwa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, PlayState* play) { Vec3f pos; Vec3f velocity; s16 scale; @@ -129,36 +129,36 @@ void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { arg7 = 0x28; } } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -300, arg5, arg6, arg7, 0, scale, 1, 15, 80, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -300, arg5, arg6, arg7, 0, scale, 1, 15, 80, KAKERA_COLOR_NONE, OBJECT_JYA_OBJ, gBombiwaEffectDL); } - func_80033480(globalCtx, &this->actor.world.pos, 100.0f, 8, 100, 160, 0); + func_80033480(play, &this->actor.world.pos, 100.0f, 8, 100, 160, 0); } -void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, PlayState* play) { this->actionFunc = BgJyaBombchuiwa_WaitForExplosion; BgJyaBombchuiwa_SetDrawFlags(this, 3); this->timer = 0; } -void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) || (this->timer > 0)) { if (this->timer == 0) { - OnePointCutscene_Init(globalCtx, 3410, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3410, -99, &this->actor, MAIN_CAM); } this->timer++; if (this->timer > 10) { - BgJyaBombchuiwa_Break(this, globalCtx); - BgJyaBombchuiwa_CleanUpAfterExplosion(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + BgJyaBombchuiwa_Break(this, play); + BgJyaBombchuiwa_CleanUpAfterExplosion(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, PlayState* play) { this->actionFunc = func_808949B8; BgJyaBombchuiwa_SetDrawFlags(this, 4); this->lightRayIntensity = 0.3f; @@ -166,21 +166,21 @@ void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, GlobalContext* this->actor.flags &= ~ACTOR_FLAG_0; } -void func_808949B8(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void func_808949B8(BgJyaBombchuiwa* this, PlayState* play) { this->timer++; if (this->timer & 4) { - func_80033480(globalCtx, &this->actor.world.pos, 60.0f, 3, 100, 100, 0); + func_80033480(play, &this->actor.world.pos, 60.0f, 3, 100, 100, 0); } if (Math_StepToF(&this->lightRayIntensity, 1.0f, 0.028)) { - BgJyaBombchuiwa_SpawnLightRay(this, globalCtx); + BgJyaBombchuiwa_SpawnLightRay(this, play); } } -void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, PlayState* play) { this->actionFunc = NULL; this->lightRayIntensity = 153.0f; BgJyaBombchuiwa_SetDrawFlags(this, 4); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0) == NULL) { // "Occurrence failure" osSyncPrintf("Error : Mir_Ray 発生失敗(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, @@ -188,56 +188,56 @@ void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, GlobalContext* globalC } } -void BgJyaBombchuiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Update(Actor* thisx, PlayState* play) { BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgJyaBombchuiwa_DrawRock(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), +void BgJyaBombchuiwa_DrawRock(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(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++, gBombchuiwa2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgJyaBombchuiwa_DrawLight(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_DrawLight(Actor* thisx, PlayState* play) { BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(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++, 0, 0, 255, 255, 255, CLAMP_MAX((u32)(this->lightRayIntensity * 153.0f), 153)); gSPDisplayList(POLY_XLU_DISP++, gBombchuiwaLight1DL); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, CLAMP_MAX((u32)(this->lightRayIntensity * 255.0f), 255)); gSPDisplayList(POLY_XLU_DISP++, gBombchuiwaLight2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgJyaBombchuiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Draw(Actor* thisx, PlayState* play) { static Vec3f D_80894F88 = { -920.0f, 480.0f, -889.0f }; static Vec3s D_80894F94 = { 0, 0, 0 }; BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; if (this->drawFlags & 1) { - Gfx_DrawDListOpa(globalCtx, gBombchuiwaDL); + Gfx_DrawDListOpa(play, gBombchuiwaDL); Collider_UpdateSpheres(0, &this->collider); } if (this->drawFlags & 2) { - BgJyaBombchuiwa_DrawRock(globalCtx); + BgJyaBombchuiwa_DrawRock(play); } if (this->drawFlags & 4) { Matrix_SetTranslateRotateYXZ(D_80894F88.x, D_80894F88.y, D_80894F88.z, &D_80894F94); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); if (this->drawFlags & 4) { - BgJyaBombchuiwa_DrawLight(thisx, globalCtx); + BgJyaBombchuiwa_DrawLight(thisx, play); } } } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h b/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h index aa91448f3..e93616710 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h @@ -6,7 +6,7 @@ struct BgJyaBombchuiwa; -typedef void (*BgJyaBombchuiwaActionFunc)(struct BgJyaBombchuiwa*, GlobalContext*); +typedef void (*BgJyaBombchuiwaActionFunc)(struct BgJyaBombchuiwa*, PlayState*); typedef struct BgJyaBombchuiwa { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index 52d1ea54d..d0e4b9471 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -11,10 +11,10 @@ #define FLAGS 0 -void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBombiwa_Init(Actor* thisx, PlayState* play); +void BgJyaBombiwa_Destroy(Actor* thisx, PlayState* play); +void BgJyaBombiwa_Update(Actor* thisx, PlayState* play); +void BgJyaBombiwa_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Jya_Bombiwa_InitVars = { ACTOR_BG_JYA_BOMBIWA, @@ -63,14 +63,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHeader* collision, s32 flag) { s16 pad1; CollisionHeader* colHeader = NULL; s16 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning: move BG registration failed" @@ -79,14 +79,14 @@ void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, GlobalContext* globalCtx, Co } } -void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, GlobalContext* globalCtx) { +void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); } -void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; if ((this->dyna.actor.params & 0x3F) != 0x29) { @@ -97,9 +97,9 @@ void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.params & 0x3F); osSyncPrintf(VT_RST); } - BgJyaBombiwa_SetupDynaPoly(this, globalCtx, &gBombiwaCol, DPM_UNK); - BgJyaBombiwa_InitCollider(this, globalCtx); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, DPM_UNK); + BgJyaBombiwa_InitCollider(this, play); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_Kill(&this->dyna.actor); } else { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -109,14 +109,14 @@ void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Destroy(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgJyaBombiwa_Break(BgJyaBombiwa* this, GlobalContext* globalCtx) { +void BgJyaBombiwa_Break(BgJyaBombiwa* this, PlayState* play) { Vec3f pos; Vec3f velocity; s16 arg5; @@ -151,31 +151,31 @@ void BgJyaBombiwa_Break(BgJyaBombiwa* this, GlobalContext* globalCtx) { arg7 = 80; } } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -400, arg5, arg6, arg7, 0, scale, 1, 20, 80, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -400, arg5, arg6, arg7, 0, scale, 1, 20, 80, KAKERA_COLOR_NONE, OBJECT_JYA_OBJ, gBombiwaEffectDL); } pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 70.0f; pos.z = this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 100.0f, 0xA, 0x64, 0xA0, 1); + func_80033480(play, &pos, 100.0f, 0xA, 0x64, 0xA0, 1); } -void BgJyaBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Update(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; if (this->collider.base.acFlags & AC_HIT) { - BgJyaBombiwa_Break(this, globalCtx); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + BgJyaBombiwa_Break(this, play); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); Actor_Kill(&this->dyna.actor); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgJyaBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Draw(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; - Gfx_DrawDListOpa(globalCtx, gBombiwaDL); + Gfx_DrawDListOpa(play, gBombiwaDL); Collider_UpdateSpheres(0, &this->collider); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 748a4de27..455cfcd05 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -9,15 +9,15 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaCobra_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaCobra_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaCobra_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaCobra_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaCobra_Init(Actor* thisx, PlayState* play); +void BgJyaCobra_Destroy(Actor* thisx, PlayState* play); +void BgJyaCobra_Update(Actor* thisx, PlayState* play); +void BgJyaCobra_Draw(Actor* thisx, PlayState* play); -void func_80896918(BgJyaCobra* this, GlobalContext* globalCtx); -void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx); -void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx); -void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx); +void func_80896918(BgJyaCobra* this, PlayState* play); +void func_80896950(BgJyaCobra* this, PlayState* play); +void func_808969F8(BgJyaCobra* this, PlayState* play); +void func_80896ABC(BgJyaCobra* this, PlayState* play); #include "overlays/ovl_Bg_Jya_Cobra/ovl_Bg_Jya_Cobra.h" @@ -119,14 +119,14 @@ void func_808958F0(Vec3f* dest, Vec3f* src, f32 arg2, f32 arg3) { dest->z = (src->z * arg3) - (src->x * arg2); } -void BgJyaCobra_InitDynapoly(BgJyaCobra* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void BgJyaCobra_InitDynapoly(BgJyaCobra* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG Registration Failure" osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, @@ -134,8 +134,8 @@ void BgJyaCobra_InitDynapoly(BgJyaCobra* this, GlobalContext* globalCtx, Collisi } } -void BgJyaCobra_SpawnRay(BgJyaCobra* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x, +void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 57.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 6); if (this->dyna.actor.child == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -192,8 +192,8 @@ void func_80895A70(BgJyaCobra* this) { } } -void func_80895BEC(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80895BEC(BgJyaCobra* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp2C; @@ -203,7 +203,7 @@ void func_80895BEC(BgJyaCobra* this, GlobalContext* globalCtx) { player->actor.world.pos.z = this->dyna.actor.world.pos.z + sp2C.z; } -void func_80895C74(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80895C74(BgJyaCobra* this, PlayState* play) { s16 phi_v0; s16 params = this->dyna.actor.params; BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent; @@ -397,20 +397,20 @@ void BgJyaCobra_UpdateShadowFromTop(BgJyaCobra* this) { } } -void BgJyaCobra_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaCobra_Init(Actor* thisx, PlayState* play) { BgJyaCobra* this = (BgJyaCobra*)thisx; - BgJyaCobra_InitDynapoly(this, globalCtx, &gCobraCol, DPM_UNK); + BgJyaCobra_InitDynapoly(this, play, &gCobraCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(globalCtx, ((s32)this->dyna.actor.params >> 8) & 0x3F)) { + if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(play, ((s32)this->dyna.actor.params >> 8) & 0x3F)) { this->dyna.actor.world.rot.y = this->dyna.actor.home.rot.y = this->dyna.actor.shape.rot.y = 0; } if (!(this->dyna.actor.params & 3)) { - BgJyaCobra_SpawnRay(this, globalCtx); + BgJyaCobra_SpawnRay(this, play); } - func_80896918(this, globalCtx); + func_80896918(this, play); if ((this->dyna.actor.params & 3) == 1 || (this->dyna.actor.params & 3) == 2) { this->dyna.actor.room = -1; @@ -425,26 +425,26 @@ void BgJyaCobra_Init(Actor* thisx, GlobalContext* globalCtx) { &this->shadowTexture, ALIGN16((s32)(&this->shadowTexture))); } -void BgJyaCobra_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaCobra_Destroy(Actor* thisx, PlayState* play) { BgJyaCobra* this = (BgJyaCobra*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80896918(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80896918(BgJyaCobra* this, PlayState* play) { this->actionFunc = func_80896950; this->unk_168 = 0; this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y = (this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y; } -void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80896950(BgJyaCobra* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 > 0.001f) { this->unk_168++; if (this->unk_168 >= (15 - CVar_GetS32("gFasterBlockPush", 0) * 2)) { - func_808969F8(this, globalCtx); + func_808969F8(this, play); } } else { this->unk_168 = 0; @@ -456,8 +456,8 @@ void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) { } } -void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808969F8(BgJyaCobra* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_a3; s16 temp2; @@ -481,9 +481,9 @@ void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) { this->unk_16E = CVar_GetS32("gFasterBlockPush", 0) * 20; } -void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80896ABC(BgJyaCobra* this, PlayState* play) { s16 temp_v0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); temp_v0 = (s16)((this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y) - this->dyna.actor.world.rot.y; if (ABS(temp_v0) < 7424) { @@ -496,7 +496,7 @@ void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { this->unk_16C = (this->unk_16C + this->unk_16A) & 7; player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; - func_80896918(this, globalCtx); + func_80896918(this, play); } else { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y = (this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y + this->unk_170; @@ -504,7 +504,7 @@ void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { if (player->stateFlags2 & 0x10) { if (this->unk_172) { - func_80895BEC(this, globalCtx); + func_80895BEC(this, play); } } else if (fabsf(this->dyna.unk_150) < 0.001f) { this->unk_172 = false; @@ -514,13 +514,13 @@ void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void BgJyaCobra_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgJyaCobra_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgJyaCobra* this = (BgJyaCobra*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80895C74(this, globalCtx); + func_80895C74(this, play); func_80895A70(this); if ((this->dyna.actor.params & 3) == 0 || (this->dyna.actor.params & 3) == 2) { @@ -528,23 +528,23 @@ void BgJyaCobra_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_80896CB4(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_80896CB4(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(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++, gCobra2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80896D78(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80896D78(BgJyaCobra* this, PlayState* play) { s32 pad; Vec3s sp44; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); sp44.x = D_80897308[this->dyna.actor.params & 3] + this->dyna.actor.shape.rot.x; sp44.y = this->dyna.actor.shape.rot.y; @@ -552,23 +552,23 @@ void func_80896D78(BgJyaCobra* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(this->unk_180.x, this->unk_180.y, this->unk_180.z, &sp44); Matrix_Scale(0.1f, 0.1f, this->unk_190, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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)(this->unk_18C * 140.0f)); gSPDisplayList(POLY_XLU_DISP++, gCobra3DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgJyaCobra_DrawShadow(BgJyaCobra* this, GlobalContext* globalCtx) { +void BgJyaCobra_DrawShadow(BgJyaCobra* this, PlayState* play) { s32 pad; s16 params = this->dyna.actor.params & 3; Vec3f sp64; Vec3s* phi_a3; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); if (params == 0) { sp64.x = this->dyna.actor.world.pos.x - 50.0f; @@ -591,7 +591,7 @@ void BgJyaCobra_DrawShadow(BgJyaCobra* this, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 40.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 120); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPLoadTextureBlock(POLY_XLU_DISP++, ALIGN16((uintptr_t)(&this->shadowTexture)), G_IM_FMT_I, G_IM_SIZ_8b, 0x40, 0x40, 0, @@ -600,17 +600,17 @@ void BgJyaCobra_DrawShadow(BgJyaCobra* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, sShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgJyaCobra_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaCobra_Draw(Actor* thisx, PlayState* play) { BgJyaCobra* this = (BgJyaCobra*)thisx; - func_80896CB4(globalCtx); - Gfx_DrawDListOpa(globalCtx, gCobra1DL); + func_80896CB4(play); + Gfx_DrawDListOpa(play, gCobra1DL); if (this->unk_18C > 0.0f) { - func_80896D78(this, globalCtx); + func_80896D78(this, play); } if ((this->dyna.actor.params & 3) == 2) { @@ -618,9 +618,9 @@ void BgJyaCobra_Draw(Actor* thisx, GlobalContext* globalCtx) { if (mirror != NULL && (mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED) && (mirror->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED)) { - BgJyaCobra_DrawShadow(this, globalCtx); + BgJyaCobra_DrawShadow(this, play); } } else { - BgJyaCobra_DrawShadow(this, globalCtx); + BgJyaCobra_DrawShadow(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h index f9ad1e6c5..48dfed51b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h @@ -6,7 +6,7 @@ struct BgJyaCobra; -typedef void (*BgJyaCobraActionFunc)(struct BgJyaCobra*, GlobalContext*); +typedef void (*BgJyaCobraActionFunc)(struct BgJyaCobra*, PlayState*); typedef struct BgJyaCobra { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 6ff676f7a..b78455231 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaGoroiwa_Init(Actor* thisx, PlayState* play); +void BgJyaGoroiwa_Destroy(Actor* thisx, PlayState* play); +void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play); +void BgJyaGoroiwa_Draw(Actor* thisx, PlayState* play); -void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx); -void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx); +void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, PlayState* play); +void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play); void BgJyaGoroiwa_SetupWait(BgJyaGoroiwa* this); void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this); @@ -80,11 +80,11 @@ void BgJyaGoroiwa_UpdateCollider(BgJyaGoroiwa* this) { worldSphere->center.z = this->actor.world.pos.z; } -void BgJyaGoroiwa_InitCollider(BgJyaGoroiwa* this, GlobalContext* globalCtx) { +void BgJyaGoroiwa_InitCollider(BgJyaGoroiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderItem); BgJyaGoroiwa_UpdateCollider(this); this->collider.elements[0].dim.worldSphere.radius = 58; } @@ -95,11 +95,11 @@ void BgJyaGoroiwa_UpdateRotation(BgJyaGoroiwa* this) { this->actor.shape.rot.z -= 0x10000 / (119 * M_PI) * xDiff; } -void BgJyaGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Init(Actor* thisx, PlayState* play) { BgJyaGoroiwa* this = (BgJyaGoroiwa*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - BgJyaGoroiwa_InitCollider(this, globalCtx); + BgJyaGoroiwa_InitCollider(this, play); this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = 0; CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 595.0f, ActorShadow_DrawCircle, 9.0f); @@ -107,10 +107,10 @@ void BgJyaGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { BgJyaGoroiwa_SetupMove(this); } -void BgJyaGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Destroy(Actor* thisx, PlayState* play) { BgJyaGoroiwa* this = (BgJyaGoroiwa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this) { @@ -120,7 +120,7 @@ void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this) { this->speedFactor = 1.0f; } -void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play) { Actor* thisx = &this->actor; s16 relYawTowardsPlayer; f32 speedXZsqBase = (-100.0f - thisx->world.pos.y) * 2.5f; @@ -153,8 +153,8 @@ void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx) { thisx->world.rot.y += 0x8000; } - func_8002F6D4(globalCtx, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F6D4(play, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); this->yOffsetSpeed = 10.0f; this->speedFactor = 0.5f; @@ -186,7 +186,7 @@ void BgJyaGoroiwa_SetupWait(BgJyaGoroiwa* this) { this->waitTimer = 0; } -void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, PlayState* play) { this->waitTimer++; if (this->waitTimer > 60) { BgJyaGoroiwa_SetupMove(this); @@ -194,29 +194,29 @@ void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx) { } } -void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play) { s32 pad; BgJyaGoroiwa* this = (BgJyaGoroiwa*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 bgId; Vec3f pos; if (!(player->stateFlags1 & 0x300000C0)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); BgJyaGoroiwa_UpdateRotation(this); pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 59.5f; pos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); BgJyaGoroiwa_UpdateCollider(this); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void BgJyaGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gRollingRockDL); +void BgJyaGoroiwa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gRollingRockDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h index 803f30d95..272247548 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h @@ -6,7 +6,7 @@ struct BgJyaGoroiwa; -typedef void (*BgJyaGoroiwaFunc)(struct BgJyaGoroiwa*, GlobalContext*); +typedef void (*BgJyaGoroiwaFunc)(struct BgJyaGoroiwa*, PlayState*); typedef struct BgJyaGoroiwa { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index ec75ec8ec..b78dadd69 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -10,17 +10,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaHaheniron_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaHaheniron_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaHaheniron_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaHaheniron_Init(Actor* thisx, PlayState* play); +void BgJyaHaheniron_Destroy(Actor* thisx, PlayState* play); +void BgJyaHaheniron_Update(Actor* thisx, PlayState* play); +void BgJyaHaheniron_Draw(Actor* thisx, PlayState* play); void BgJyaHaheniron_SetupChairCrumble(BgJyaHaheniron* this); -void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx); +void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, PlayState* play); void BgJyaHaheniron_SetupPillarCrumble(BgJyaHaheniron* this); -void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx); +void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, PlayState* play); void BgJyaHaheniron_SetupRubbleCollide(BgJyaHaheniron* this); -void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, GlobalContext* globalCtx); +void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, PlayState* play); const ActorInit Bg_Jya_Haheniron_InitVars = { ACTOR_BG_JYA_HAHENIRON, @@ -76,14 +76,14 @@ static Vec3f D_808987A0[] = { 0.0f, 14.0f, 0.0f }; static Vec3f D_808987AC[] = { 0.0f, 8.0f, 0.0f }; -void BgJyaHaheniron_ColliderInit(BgJyaHaheniron* this, GlobalContext* globalCtx) { +void BgJyaHaheniron_ColliderInit(BgJyaHaheniron* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); } -void BgJyaHaheniron_SpawnFragments(GlobalContext* globalCtx, Vec3f* vec1, Vec3f* vec2) { +void BgJyaHaheniron_SpawnFragments(PlayState* play, Vec3f* vec1, Vec3f* vec2) { Vec3f vel; Vec3f pos; s16 arg5; @@ -106,24 +106,24 @@ void BgJyaHaheniron_SpawnFragments(GlobalContext* globalCtx, Vec3f* vec1, Vec3f* arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, vec1, &vel, vec1, -350, arg5, 40, 4, 0, sKakeraScales[i], 0, 20, 40, + EffectSsKakera_Spawn(play, vec1, &vel, vec1, -350, arg5, 40, 4, 0, sKakeraScales[i], 0, 20, 40, KAKERA_COLOR_NONE, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); angle += 0x3333; } pos.x = vec1->x + (vec2->x * 5.0f); pos.y = vec1->y + (vec2->y * 5.0f); pos.z = vec1->z + (vec2->z * 5.0f); - func_80033480(globalCtx, &pos, 100.0f, 4, 100, 160, 1); + func_80033480(play, &pos, 100.0f, 4, 100, 160, 1); } -void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Init(Actor* thisx, PlayState* play) { s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, D_80898794[this->actor.params]); if (this->actor.params == 0) { - BgJyaHaheniron_ColliderInit(this, globalCtx); + BgJyaHaheniron_ColliderInit(this, play); this->actor.shape.rot.z = (Rand_ZeroOne() * 65535.0f); BgJyaHaheniron_SetupChairCrumble(this); } else if (this->actor.params == 1) { @@ -133,12 +133,12 @@ void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaHaheniron_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; if (this->actor.params == 0) { - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } } @@ -146,22 +146,22 @@ void BgJyaHaheniron_SetupChairCrumble(BgJyaHaheniron* this) { this->actionFunc = BgJyaHaheniron_ChairCrumble; } -void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx) { +void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, PlayState* play) { Vec3f vec; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 8.0f, 0.0f, 0x85); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 8.0f, 0.0f, 0x85); if ((this->actor.bgCheckFlags & 9) || ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.at != NULL) && (this->collider.base.at->category == ACTORCAT_PLAYER))) { vec.x = -Rand_ZeroOne() * this->actor.velocity.x; vec.y = -Rand_ZeroOne() * this->actor.velocity.y; vec.z = -Rand_ZeroOne() * this->actor.velocity.z; - BgJyaHaheniron_SpawnFragments(globalCtx, &this->actor.world.pos, &vec); + BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, &vec); Actor_Kill(&this->actor); } else if (this->timer > 60) { Actor_Kill(&this->actor); } else { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } this->actor.shape.rot.y += 0x4B0; this->actor.shape.rot.x += 0xFA0; @@ -171,11 +171,11 @@ void BgJyaHaheniron_SetupPillarCrumble(BgJyaHaheniron* this) { this->actionFunc = BgJyaHaheniron_PillarCrumble; } -void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx) { +void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, PlayState* play) { if (this->timer >= 8) { Actor_MoveForward(&this->actor); } else if (this->timer >= 17) { - BgJyaHaheniron_SpawnFragments(globalCtx, &this->actor.world.pos, D_808987A0); + BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, D_808987A0); Actor_Kill(&this->actor); } this->actor.shape.rot.y += 0x258; @@ -186,23 +186,23 @@ void BgJyaHaheniron_SetupRubbleCollide(BgJyaHaheniron* this) { this->actionFunc = BgJyaHaheniron_RubbleCollide; } -void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, GlobalContext* globalCtx) { +void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, PlayState* play) { if (this->timer >= 17) { - BgJyaHaheniron_SpawnFragments(globalCtx, &this->actor.world.pos, D_808987AC); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR2); + BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, D_808987AC); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR2); Actor_Kill(&this->actor); } } -void BgJyaHaheniron_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Update(Actor* thisx, PlayState* play) { s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgJyaHaheniron_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gObjectJyaIronDL_000880, gObjectJyaIronDL_000AE0, @@ -214,5 +214,5 @@ void BgJyaHaheniron_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 0) { Collider_UpdateSpheres(0, &this->collider); } - Gfx_DrawDListOpa(globalCtx, dLists[this->actor.params]); + Gfx_DrawDListOpa(play, dLists[this->actor.params]); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h b/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h index 6cdcf6ee5..60f9c6ef9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h @@ -6,7 +6,7 @@ struct BgJyaHaheniron; -typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, GlobalContext*); +typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, PlayState*); typedef struct BgJyaHaheniron { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index 54437a953..413f66035 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -10,17 +10,17 @@ #define FLAGS 0 -typedef void (*BgJyaIronobjIkFunc)(BgJyaIronobj*, GlobalContext*, EnIk*); +typedef void (*BgJyaIronobjIkFunc)(BgJyaIronobj*, PlayState*, EnIk*); -void BgJyaIronobj_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaIronobj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaIronobj_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaIronobj_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaIronobj_Init(Actor* thisx, PlayState* play); +void BgJyaIronobj_Destroy(Actor* thisx, PlayState* play); +void BgJyaIronobj_Update(Actor* thisx, PlayState* play); +void BgJyaIronobj_Draw(Actor* thisx, PlayState* play); void func_808992D8(BgJyaIronobj* this); -void func_808992E8(BgJyaIronobj* this, GlobalContext* globalCtx); +void func_808992E8(BgJyaIronobj* this, PlayState* play); -void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* globalCtx, EnIk* enIk); -void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, EnIk* enIk); +void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk); +void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk); static int sUnused = 0; @@ -80,11 +80,11 @@ static InitChainEntry sInitChain[] = { static CollisionHeader* sCollisionHeaders[] = { &gPillarCol, &gThroneCol }; -void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, GlobalContext* globalCtx) { +void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, PlayState* play) { ColliderCylinder* colCylinder = &this->colCylinder; - Collider_InitCylinder(globalCtx, colCylinder); - Collider_SetCylinder(globalCtx, colCylinder, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, colCylinder); + Collider_SetCylinder(play, colCylinder, &this->dyna.actor, &sCylinderInit); if ((this->dyna.actor.params & 1) == 1) { this->colCylinder.dim.radius = 40; this->colCylinder.dim.height = 100; @@ -95,7 +95,7 @@ void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, GlobalContext* globalCtx) { /* * Spawns particles for the destroyed pillar */ -void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* globalCtx, EnIk* enIk) { +void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk) { s32 i; s32 j; s16 unkArg5; @@ -116,7 +116,7 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global for (i = 0; i < 8; i++) { Actor* actor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, Rand_ZeroOne() * 80.0f + this->dyna.actor.world.pos.y + 20.0f, this->dyna.actor.world.pos.z, 0, (s16)(Rand_ZeroOne() * 0x4000) + rotY - 0x2000, 0, 0); if (actor != NULL) { @@ -124,9 +124,9 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global actor->velocity.y = Rand_ZeroOne() * 10.0f + 6.0f; } } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 150.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, 2); sins = Math_SinS(rotY); coss = Math_CosS(rotY); @@ -147,10 +147,10 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global vel.x = 2.0f * ((Rand_ZeroOne() * 6.0f) - 3.0f) + (Rand_ZeroOne() * sins * 8.0f * temp_f22); vel.y = (Rand_ZeroOne() * 8.0f) - 3.0f; vel.z = 2.0f * ((Rand_ZeroOne() * 6.0f) - 3.0f) + (Rand_ZeroOne() * coss * 8.0f * temp_f22); - EffectSsKakera_Spawn(globalCtx, &pos, &vel, &pos, -350, unkArg5, D_80899500[j & 7], 4, 0, D_808994E0[j & 7], 0, + EffectSsKakera_Spawn(play, &pos, &vel, &pos, -350, unkArg5, D_80899500[j & 7], 4, 0, D_808994E0[j & 7], 0, 5, D_808994F0[j & 7], -1, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); if (Rand_ZeroOne() < 0.26f) { - func_80033480(globalCtx, &pos, 200.0f, 1, D_808994E0[j & 7] * 4 + 60, D_808994E0[j & 7] * 4 + 80, 1); + func_80033480(play, &pos, 200.0f, 1, D_808994E0[j & 7] * 4 + 60, D_808994E0[j & 7] * 4 + 80, 1); } } } @@ -158,7 +158,7 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global /* * Spawns particles for the destroyed throne */ -void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, EnIk* enIk) { +void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk) { s32 i; s32 j; s16 unkArg5; @@ -178,7 +178,7 @@ void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, E rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1]; for (i = 0; i < 8; i++) { Actor* actor = - Actor_Spawn(&arg1->actorCtx, arg1, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, (Rand_ZeroOne() * 80.0f) + this->dyna.actor.world.pos.y + 10.0f, this->dyna.actor.world.pos.z, 0, ((s16)(s32)(Rand_ZeroOne() * 0x4000) + rotY) - 0x2000, 0, 0); if (actor != NULL) { @@ -206,39 +206,39 @@ void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, E vel.x = 2.0f * (Rand_ZeroOne() * 6.0f - 3.0f) + (Rand_ZeroOne() * sins * 8.0f * temp_f22); vel.y = Rand_ZeroOne() * 8.0f - 3.0f; vel.z = 2.0f * (Rand_ZeroOne() * 6.0f - 3.0f) + (Rand_ZeroOne() * coss * 8.0f * temp_f22); - EffectSsKakera_Spawn(arg1, &pos, &vel, &pos, -350, unkArg5, D_80899530[j & 7], 4, 0, D_80899510[j & 7], 0, 5, + EffectSsKakera_Spawn(play, &pos, &vel, &pos, -350, unkArg5, D_80899530[j & 7], 4, 0, D_80899510[j & 7], 0, 5, D_80899520[j & 7], -1, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); if (Rand_ZeroOne() < 0.26f) { - func_80033480(arg1, &pos, 200.0f, 1, D_80899510[j & 7] * 4 + 60, D_80899510[j & 7] * 4 + 80, 1); + func_80033480(play, &pos, 200.0f, 1, D_80899510[j & 7] * 4 + 60, D_80899510[j & 7] * 4 + 80, 1); } } } -void BgJyaIronobj_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaIronobj_Init(Actor* thisx, PlayState* play) { BgJyaIronobj* this = (BgJyaIronobj*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - BgJyaIronobj_InitCylinder(this, globalCtx); + BgJyaIronobj_InitCylinder(this, play); CollisionHeader_GetVirtual(sCollisionHeaders[thisx->params & 1], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); func_808992D8(this); } -void BgJyaIronobj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaIronobj_Destroy(Actor* thisx, PlayState* play) { BgJyaIronobj* this = (BgJyaIronobj*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colCylinder); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->colCylinder); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808992D8(BgJyaIronobj* this) { this->actionFunc = func_808992E8; } -void func_808992E8(BgJyaIronobj* this, GlobalContext* globalCtx) { +void func_808992E8(BgJyaIronobj* this, PlayState* play) { static BgJyaIronobjIkFunc particleFunc[] = { BgJyaIronobj_SpawnPillarParticles, BgJyaIronobj_SpawnThoneParticles }; Actor* actor; Vec3f dropPos; @@ -248,30 +248,30 @@ void func_808992E8(BgJyaIronobj* this, GlobalContext* globalCtx) { actor = this->colCylinder.base.ac; this->colCylinder.base.acFlags &= ~AC_HIT; if (actor != NULL && actor->id == ACTOR_EN_IK) { - particleFunc[this->dyna.actor.params & 1](this, globalCtx, (EnIk*)actor); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 80, + particleFunc[this->dyna.actor.params & 1](this, play, (EnIk*)actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR); dropPos.x = this->dyna.actor.world.pos.x; dropPos.y = this->dyna.actor.world.pos.y + 20.0f; dropPos.z = this->dyna.actor.world.pos.z; for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &dropPos, ITEM00_HEART); + Item_DropCollectible(play, &dropPos, ITEM00_HEART); dropPos.y += 18.0f; } Actor_Kill(&this->dyna.actor); return; } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); } } -void BgJyaIronobj_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaIronobj_Update(Actor* thisx, PlayState* play) { BgJyaIronobj* this = (BgJyaIronobj*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgJyaIronobj_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sOpaDL[thisx->params & 1]); +void BgJyaIronobj_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sOpaDL[thisx->params & 1]); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h b/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h index 1abdd4be1..a8189049a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h @@ -6,7 +6,7 @@ struct BgJyaIronobj; -typedef void (*BgJyaIronobjActionFunc)(struct BgJyaIronobj*, GlobalContext*); +typedef void (*BgJyaIronobjActionFunc)(struct BgJyaIronobj*, PlayState*); typedef struct BgJyaIronobj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index 38df5c5ba..c983c0d84 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void BgJyaKanaami_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaKanaami_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaKanaami_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaKanaami_Init(Actor* thisx, PlayState* play); +void BgJyaKanaami_Destroy(Actor* thisx, PlayState* play); +void BgJyaKanaami_Update(Actor* thisx, PlayState* play); +void BgJyaKanaami_Draw(Actor* thisx, PlayState* play); void func_80899880(BgJyaKanaami* this); -void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx); +void func_80899894(BgJyaKanaami* this, PlayState* play); void func_8089993C(BgJyaKanaami* this); -void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx); +void func_80899950(BgJyaKanaami* this, PlayState* play); void func_80899A08(BgJyaKanaami* this); const ActorInit Bg_Jya_Kanaami_InitVars = { @@ -40,26 +40,26 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void BgJyaKanaami_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaKanaami_Init(Actor* thisx, PlayState* play) { BgJyaKanaami* this = (BgJyaKanaami*)thisx; - BgJyaKanaami_InitDynaPoly(this, globalCtx, &gKanaamiCol, DPM_UNK); + BgJyaKanaami_InitDynaPoly(this, play, &gKanaamiCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_80899A08(this); } else { func_80899880(this); @@ -67,10 +67,10 @@ void BgJyaKanaami_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(jya 金網)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgJyaKanaami_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaKanaami_Destroy(Actor* thisx, PlayState* play) { BgJyaKanaami* this = (BgJyaKanaami*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80899880(BgJyaKanaami* this) { @@ -78,10 +78,10 @@ void func_80899880(BgJyaKanaami* this) { this->unk_16A = 0; } -void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) { +void func_80899894(BgJyaKanaami* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) { if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) { - OnePointCutscene_Init(globalCtx, 3450, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3450, -99, &this->dyna.actor, MAIN_CAM); } this->unk_16A += 1; if (this->unk_16A >= 0xA) { @@ -95,7 +95,7 @@ void func_8089993C(BgJyaKanaami* this) { this->unk_168 = 0; } -void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { +void func_80899950(BgJyaKanaami* this, PlayState* play) { s32 pad[2]; s32 quakeId; @@ -103,7 +103,7 @@ void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.x, 0x4000, this->unk_168)) { func_80899A08(this); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_TRAP_BOUND); - quakeId = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeId = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeId, 25000); Quake_SetQuakeValues(quakeId, 2, 0, 0, 0); Quake_SetCountdown(quakeId, 16); @@ -115,15 +115,15 @@ void func_80899A08(BgJyaKanaami* this) { this->dyna.actor.world.rot.x = 0x4000; } -void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaKanaami_Update(Actor* thisx, PlayState* play) { BgJyaKanaami* this = (BgJyaKanaami*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } this->dyna.actor.shape.rot.x = this->dyna.actor.world.rot.x; } -void BgJyaKanaami_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gKanaamiDL); +void BgJyaKanaami_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gKanaamiDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h b/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h index b57f51838..6e5d670fd 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h @@ -6,7 +6,7 @@ struct BgJyaKanaami; -typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, GlobalContext*); +typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, PlayState*); typedef struct BgJyaKanaami { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 07deab277..2ca35dc04 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -9,16 +9,16 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaLift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaLift_Init(Actor* thisx, PlayState* play); +void BgJyaLift_Destroy(Actor* thisx, PlayState* play); +void BgJyaLift_Update(Actor* thisx, PlayState* play); +void BgJyaLift_Draw(Actor* thisx, PlayState* play); void BgJyaLift_SetFinalPosY(BgJyaLift* this); void BgJyaLift_SetInitPosY(BgJyaLift* this); -void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx); +void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play); void BgJyaLift_SetupMove(BgJyaLift* this); -void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx); +void BgJyaLift_Move(BgJyaLift* this, PlayState* play); static s16 sKankyoIsSpawned = false; @@ -42,16 +42,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_STOP), }; -void BgJyaLift_InitDynapoly(BgJyaLift* this, GlobalContext* globalCtx, CollisionHeader* collisionHeader, s32 moveFlag) { +void BgJyaLift_InitDynapoly(BgJyaLift* this, PlayState* play, CollisionHeader* collisionHeader, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collisionHeader, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaLift_Init(Actor* thisx, PlayState* play) { BgJyaLift* this = (BgJyaLift*)thisx; this->isSpawned = false; @@ -62,9 +62,9 @@ void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { // "Goddess lift CT" osSyncPrintf("女神リフト CT\n"); - BgJyaLift_InitDynapoly(this, globalCtx, &gLiftCol, DPM_UNK); + BgJyaLift_InitDynapoly(this, play, &gLiftCol, DPM_UNK); Actor_ProcessInitChain(thisx, sInitChain); - if (Flags_GetSwitch(globalCtx, (thisx->params & 0x3F))) { + if (Flags_GetSwitch(play, (thisx->params & 0x3F))) { BgJyaLift_SetFinalPosY(this); } else { BgJyaLift_SetInitPosY(this); @@ -74,7 +74,7 @@ void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { this->isSpawned = true; } -void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaLift_Destroy(Actor* thisx, PlayState* play) { BgJyaLift* this = (BgJyaLift*)thisx; if (this->isSpawned) { @@ -82,7 +82,7 @@ void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx) { // "Goddess Lift DT" osSyncPrintf("女神リフト DT\n"); sKankyoIsSpawned = false; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -92,19 +92,19 @@ void BgJyaLift_SetInitPosY(BgJyaLift* this) { this->moveDelay = 0; } -void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) { +void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) { this->moveDelay++; if (this->moveDelay >= 20) { // The cutscene of the platform lowering will show the central room in an unloaded state if // Link is not standing on the platform as it lowers. Therefore check for the Sunlight arrows // enhancement and if it's enabled, check that Link is on the platform. Otherwise skip it. if (!(CVar_GetS32("gSunlightArrows", 0) || Randomizer_GetSettingValue(RSK_SUNLIGHT_ARROWS)) || - (GET_PLAYER(globalCtx)->actor.world.pos.x > -19.0f && - GET_PLAYER(globalCtx)->actor.world.pos.x < 139.0f && - GET_PLAYER(globalCtx)->actor.world.pos.z > -1172.0f && - GET_PLAYER(globalCtx)->actor.world.pos.z < -1009.0f)) { - OnePointCutscene_Init(globalCtx, 3430, -99, &this->dyna.actor, MAIN_CAM); + (GET_PLAYER(play)->actor.world.pos.x > -19.0f && + GET_PLAYER(play)->actor.world.pos.x < 139.0f && + GET_PLAYER(play)->actor.world.pos.z > -1172.0f && + GET_PLAYER(play)->actor.world.pos.z < -1009.0f)) { + OnePointCutscene_Init(play, 3430, -99, &this->dyna.actor, MAIN_CAM); } BgJyaLift_SetupMove(this); } @@ -115,7 +115,7 @@ void BgJyaLift_SetupMove(BgJyaLift* this) { this->actionFunc = BgJyaLift_Move; } -void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx) { +void BgJyaLift_Move(BgJyaLift* this, PlayState* play) { f32 distFromBottom; f32 tempVelocity; @@ -123,7 +123,7 @@ void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx) { tempVelocity = (this->dyna.actor.velocity.y < 0.2f) ? 0.2f : this->dyna.actor.velocity.y; distFromBottom = Math_SmoothStepToF(&this->dyna.actor.world.pos.y, 973.0f, 0.1f, tempVelocity, 0.2f); if ((this->dyna.actor.world.pos.y < 1440.0f) && (1440.0f <= this->dyna.actor.prevPos.y)) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } if (fabsf(distFromBottom) < 0.001f) { BgJyaLift_SetFinalPosY(this); @@ -138,27 +138,27 @@ void BgJyaLift_SetFinalPosY(BgJyaLift* this) { this->dyna.actor.world.pos.y = 973.0f; } -void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BgJyaLift_Update(Actor* thisx, PlayState* play2) { BgJyaLift* this = (BgJyaLift*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } if ((this->dyna.unk_160 & 4) && ((this->unk_16B & 4) == 0)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DIRECTED_YAW); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DIRECTED_YAW); } else if (((this->dyna.unk_160) & 4) == 0 && ((this->unk_16B & 4)) && - (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_DIRECTED_YAW)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + (play->cameraPtrs[MAIN_CAM]->setting == CAM_SET_DIRECTED_YAW)) { + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); } this->unk_16B = this->dyna.unk_160; // Spirit Temple room 5 is the main room with the statue room 25 is directly above room 5 - if ((globalCtx->roomCtx.curRoom.num != 5) && (globalCtx->roomCtx.curRoom.num != 25)) { + if ((play->roomCtx.curRoom.num != 5) && (play->roomCtx.curRoom.num != 25)) { Actor_Kill(thisx); } } -void BgJyaLift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gLiftDL); +void BgJyaLift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gLiftDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h b/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h index 2b5bc918f..b6c951dc1 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h @@ -5,7 +5,7 @@ #include "global.h" struct BgJyaLift; -typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*, GlobalContext*); +typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*, PlayState*); typedef struct BgJyaLift { /* 0x000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 4b2bb78c5..0aa7c61e7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -5,15 +5,15 @@ #define FLAGS 0 -void BgJyaMegami_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaMegami_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaMegami_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaMegami_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaMegami_Init(Actor* thisx, PlayState* play); +void BgJyaMegami_Destroy(Actor* thisx, PlayState* play); +void BgJyaMegami_Update(Actor* thisx, PlayState* play); +void BgJyaMegami_Draw(Actor* thisx, PlayState* play); void BgJyaMegami_SetupDetectLight(BgJyaMegami* this); -void BgJyaMegami_DetectLight(BgJyaMegami* this, GlobalContext* globalCtx); +void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play); void BgJyaMegami_SetupExplode(BgJyaMegami* this); -void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx); +void BgJyaMegami_Explode(BgJyaMegami* this, PlayState* play); const ActorInit Bg_Jya_Megami_InitVars = { ACTOR_BG_JYA_MEGAMI, @@ -106,40 +106,40 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -void BgJyaMegami_InitDynaPoly(BgJyaMegami* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgJyaMegami_InitDynaPoly(BgJyaMegami* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgJyaMegami_InitCollider(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_InitCollider(BgJyaMegami* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colliderItem); } -void BgJyaMegami_SpawnEffect(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, s32 num, s32 arg4) { +void BgJyaMegami_SpawnEffect(PlayState* play, Vec3f* pos, Vec3f* velocity, s32 num, s32 arg4) { Vec3f spB4; s32 i; for (i = 0; i < num; i++) { s32 idx = ((s16)(Rand_ZeroOne() * 8.0f)) & D_8089B17C[arg4]; s16 arg5 = ((idx < 5) && (Rand_ZeroOne() < 0.7f)) ? 0x40 : 0x20; - EffectSsKakera_Spawn(globalCtx, pos, velocity, pos, -90, arg5, D_8089B16C[idx], 4, 0, D_8089B14C[idx], 0, 5, + EffectSsKakera_Spawn(play, pos, velocity, pos, -90, arg5, D_8089B16C[idx], 4, 0, D_8089B14C[idx], 0, 5, D_8089B15C[idx], KAKERA_COLOR_NONE, OBJECT_JYA_OBJ, gMegami2DL); if (Rand_ZeroOne() < 0.45f) { Math_Vec3f_Copy(&spB4, pos); spB4.z += 25.0f; - func_80033480(globalCtx, &spB4, 60.0f, 0, D_8089B14C[idx] * 4 + 50, D_8089B14C[idx] * 4 + 70, 1); + func_80033480(play, &spB4, 60.0f, 0, D_8089B14C[idx] * 4 + 50, D_8089B14C[idx] * 4 + 70, 1); } } } -void BgJyaMegami_SetupSpawnEffect(BgJyaMegami* this, GlobalContext* globalCtx, f32 arg2) { +void BgJyaMegami_SetupSpawnEffect(BgJyaMegami* this, PlayState* play, f32 arg2) { s32 i; Vec3f pos; @@ -147,17 +147,17 @@ void BgJyaMegami_SetupSpawnEffect(BgJyaMegami* this, GlobalContext* globalCtx, f if (Rand_ZeroOne() < arg2) { Math_Vec3f_Sum(&this->dyna.actor.world.pos, &sPiecesInit[i].unk_00, &pos); pos.z += 15.0f; - BgJyaMegami_SpawnEffect(globalCtx, &pos, &sVelocity, 1, 0); + BgJyaMegami_SpawnEffect(play, &pos, &sVelocity, 1, 0); } } } -void BgJyaMegami_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Init(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; - BgJyaMegami_InitDynaPoly(this, globalCtx, &GMegamiCol, DPM_UNK); - BgJyaMegami_InitCollider(this, globalCtx); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + BgJyaMegami_InitDynaPoly(this, play, &GMegamiCol, DPM_UNK); + BgJyaMegami_InitCollider(this, play); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_Kill(&this->dyna.actor); } else { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -166,11 +166,11 @@ void BgJyaMegami_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaMegami_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Destroy(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } void BgJyaMegami_SetupDetectLight(BgJyaMegami* this) { @@ -179,22 +179,22 @@ void BgJyaMegami_SetupDetectLight(BgJyaMegami* this) { this->crumbleIndex = 0; } -void BgJyaMegami_DetectLight(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->lightTimer++; this->collider.base.acFlags &= ~AC_HIT; - if (globalCtx->gameplayFrames % 4 == 0) { - BgJyaMegami_SetupSpawnEffect(this, globalCtx, (this->crumbleIndex * 0.04f) + 0.05f); + if (play->gameplayFrames % 4 == 0) { + BgJyaMegami_SetupSpawnEffect(this, play, (this->crumbleIndex * 0.04f) + 0.05f); } func_8002F974(&this->dyna.actor, NA_SE_EV_FACE_CRUMBLE_SLOW - SFX_FLAG); } else if (this->lightTimer > 0) { this->lightTimer--; } if (this->lightTimer > 40) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); BgJyaMegami_SetupExplode(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_EXPLOSION); - OnePointCutscene_Init(globalCtx, 3440, -99, &this->dyna.actor, MAIN_CAM); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_EXPLOSION); + OnePointCutscene_Init(play, 3440, -99, &this->dyna.actor, MAIN_CAM); } else { if (this->lightTimer < 8) { this->crumbleIndex = 0; @@ -207,7 +207,7 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, GlobalContext* globalCtx) { } else { this->crumbleIndex = 4; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -223,7 +223,7 @@ void BgJyaMegami_SetupExplode(BgJyaMegami* this) { this->explosionTimer = 0; } -void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_Explode(BgJyaMegami* this, PlayState* play) { static Vec3f sVec = { 0.0f, 0.0f, 0.0f }; BgJyaMegamiPiece* temp; u32 i; @@ -233,7 +233,7 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { this->explosionTimer++; if (this->explosionTimer == 30) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_BREAKDOWN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_BREAKDOWN); } for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { @@ -252,12 +252,12 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.067f) { Math_Vec3f_Sum(&temp->pos, &temp2->unk_00, &sp8C); sp8C.z += 10.0f; - BgJyaMegami_SpawnEffect(globalCtx, &sp8C, &temp->vel, 3, 2); + BgJyaMegami_SpawnEffect(play, &sp8C, &temp->vel, 3, 2); } } else if (this->explosionTimer == temp2->delay) { Math_Vec3f_Sum(&temp->pos, &temp2->unk_00, &sp8C); sp8C.z += 10.0f; - BgJyaMegami_SpawnEffect(globalCtx, &sp8C, &temp->vel, 4, 2); + BgJyaMegami_SpawnEffect(play, &sp8C, &temp->vel, 4, 2); } } @@ -266,13 +266,13 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { sp8C.x = ((Rand_ZeroOne() - 0.5f) * 90.0f) + this->dyna.actor.world.pos.x; sp8C.y = (this->dyna.actor.world.pos.y - (Rand_ZeroOne() * 80.0f)) - 20.0f; sp8C.z = this->dyna.actor.world.pos.z - (Rand_ZeroOne() - 0.5f) * 50.0f; - BgJyaMegami_SpawnEffect(globalCtx, &sp8C, &sVec, 1, 0); + BgJyaMegami_SpawnEffect(play, &sp8C, &sVec, 1, 0); } if (this->explosionTimer < ARRAY_COUNT(this->pieces)) { sp8C.x = this->dyna.actor.world.pos.x; sp8C.y = this->dyna.actor.world.pos.y - 60.0f; sp8C.z = this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &sp8C, 100.0f, 1, 150, 100, 1); + func_80033480(play, &sp8C, 100.0f, 1, 150, 100, 1); } if (this->explosionTimer == 60) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -282,10 +282,10 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { } } -void BgJyaMegami_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Update(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } static void* sRightSideCrumbles[] = { @@ -298,17 +298,17 @@ static void* sLeftSideCrumbles[] = { gMegamiLeftCrumble4Tex, gMegamiLeftCrumble5Tex, }; -void BgJyaMegami_DrawFace(BgJyaMegami* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgJyaMegami_DrawFace(BgJyaMegami* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRightSideCrumbles[this->crumbleIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sLeftSideCrumbles[this->crumbleIndex])); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMegami1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static Gfx* sDLists[] = { @@ -317,14 +317,14 @@ static Gfx* sDLists[] = { gMegamiPiece11DL, gMegamiPiece12DL, gMegamiPiece13DL, }; -void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_DrawExplode(BgJyaMegami* this, PlayState* play) { s32 pad; BgJyaMegamiPiece* piece; u32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { piece = &this->pieces[i]; @@ -339,23 +339,23 @@ void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { Matrix_Translate(sPiecesInit[i].unk_00.x * -10.0f, sPiecesInit[i].unk_00.y * -10.0f, sPiecesInit[i].unk_00.z * -10.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[i]); FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgJyaMegami_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Draw(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; Collider_UpdateSpheres(0, &this->collider); if (this->actionFunc == BgJyaMegami_Explode) { - BgJyaMegami_DrawExplode(this, globalCtx); + BgJyaMegami_DrawExplode(this, play); } else { - BgJyaMegami_DrawFace(this, globalCtx); + BgJyaMegami_DrawFace(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h index 8ccac6a95..467444c74 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h @@ -6,7 +6,7 @@ struct BgJyaMegami; -typedef void (*BgJyaMegamiActionFunc)(struct BgJyaMegami*, GlobalContext*); +typedef void (*BgJyaMegamiActionFunc)(struct BgJyaMegami*, PlayState*); typedef struct { /* 0x00 */ Vec3f pos; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index 904c50a21..8d9b275c2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -10,16 +10,16 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaZurerukabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaZurerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaZurerukabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaZurerukabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaZurerukabe_Init(Actor* thisx, PlayState* play); +void BgJyaZurerukabe_Destroy(Actor* thisx, PlayState* play); +void BgJyaZurerukabe_Update(Actor* thisx, PlayState* play); +void BgJyaZurerukabe_Draw(Actor* thisx, PlayState* play); -void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx); +void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play); void func_8089B7B4(BgJyaZurerukabe* this); -void func_8089B7C4(BgJyaZurerukabe* this, GlobalContext* globalCtx); +void func_8089B7C4(BgJyaZurerukabe* this, PlayState* play); void func_8089B80C(BgJyaZurerukabe* this); -void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx); +void func_8089B870(BgJyaZurerukabe* this, PlayState* play); static f32 D_8089B9C0[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; @@ -60,7 +60,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, GlobalContext* globalCtx, CollisionHeader* collision, +void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; @@ -68,15 +68,15 @@ void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, GlobalContext* globalCt DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 == 0x200000) && (player->actor.wallPoly != NULL)) { s32 i; @@ -95,24 +95,24 @@ void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx) { case 3: case 5: if (fabsf(D_8089B9C0[D_8089BA30[i]]) > 1.0f) { - func_8002F6D4(globalCtx, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); + func_8002F6D4(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); } break; case 1: case 4: if (fabsf(D_8089B9C0[D_8089BA30[i]] - D_8089B9C0[D_8089BA30[i + 1]]) > 1.0f) { - func_8002F6D4(globalCtx, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); + func_8002F6D4(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); } break; } } } -void BgJyaZurerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaZurerukabe_Init(Actor* thisx, PlayState* play) { BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx; s32 i; - BgJyaZurerukabe_InitDynaPoly(this, globalCtx, &gZurerukabeCol, DPM_UNK); + BgJyaZurerukabe_InitDynaPoly(this, play, &gZurerukabeCol, DPM_UNK); Actor_ProcessInitChain(thisx, sInitChain); for (i = 0; i < ARRAY_COUNT(D_8089B9F0); i++) { @@ -134,10 +134,10 @@ void BgJyaZurerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(jya ずれる壁)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgJyaZurerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaZurerukabe_Destroy(Actor* thisx, PlayState* play) { BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); D_8089B9C0[this->unk_168] = 0.0f; } @@ -145,7 +145,7 @@ void func_8089B7B4(BgJyaZurerukabe* this) { this->actionFunc = func_8089B7C4; } -void func_8089B7C4(BgJyaZurerukabe* this, GlobalContext* globalCtx) { +void func_8089B7C4(BgJyaZurerukabe* this, PlayState* play) { if (this->unk_16A <= 0) { func_8089B80C(this); } @@ -161,7 +161,7 @@ void func_8089B80C(BgJyaZurerukabe* this) { this->unk_16C += this->unk_16E; } -void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx) { +void func_8089B870(BgJyaZurerukabe* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + (this->unk_16C * 75), D_8089BA08[this->unk_168])) { func_8089B7B4(this); @@ -171,20 +171,20 @@ void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); } -void BgJyaZurerukabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaZurerukabe_Update(Actor* thisx, PlayState* play) { BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx; if (this->unk_16A > 0) { this->unk_16A--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_168 == 0) { - func_8089B4C8(this, globalCtx); + func_8089B4C8(this, play); } } -void BgJyaZurerukabe_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gZurerukabeDL); +void BgJyaZurerukabe_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gZurerukabeDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h b/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h index d2cb8ff97..683f68199 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h @@ -6,7 +6,7 @@ struct BgJyaZurerukabe; -typedef void (*BgJyaZurerukabeActionFunc)(struct BgJyaZurerukabe*, GlobalContext*); +typedef void (*BgJyaZurerukabeActionFunc)(struct BgJyaZurerukabe*, PlayState*); typedef struct BgJyaZurerukabe { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index 2795769bc..0187a8104 100644 --- a/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_5 -void BgMenkuriEye_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriEye_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMenkuriEye_Init(Actor* thisx, PlayState* play); +void BgMenkuriEye_Destroy(Actor* thisx, PlayState* play); +void BgMenkuriEye_Update(Actor* thisx, PlayState* play); +void BgMenkuriEye_Draw(Actor* thisx, PlayState* play); void BgMenkuriEye_Reset(void); const ActorInit Bg_Menkuri_Eye_InitVars = { @@ -61,34 +61,34 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMenkuriEye_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Init(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; ColliderJntSphElement* colliderList; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; colliderList = this->collider.elements; colliderList->dim.worldSphere.radius = colliderList->dim.modelSphere.radius; - if (!Flags_GetSwitch(globalCtx, this->actor.params)) { + if (!Flags_GetSwitch(play, this->actor.params)) { D_8089C1A0 = 0; } this->framesUntilDisable = -1; } -void BgMenkuriEye_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Destroy(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Update(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; - if (!Flags_GetSwitch(globalCtx, this->actor.params)) { + if (!Flags_GetSwitch(play, this->actor.params)) { if (this->framesUntilDisable != -1) { if (this->framesUntilDisable != 0) { this->framesUntilDisable -= 1; @@ -109,23 +109,23 @@ void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx) { } this->framesUntilDisable = 416; if (D_8089C1A0 == 4) { - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); func_80078884(NA_SE_SY_CORRECT_CHIME); } } if (this->framesUntilDisable == -1) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 0.0f); } -void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Draw(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + if (Flags_GetSwitch(play, this->actor.params)) { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 255); } else if (this->framesUntilDisable == -1) { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 0); @@ -135,11 +135,11 @@ void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGTGEyeStatueEyeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void BgMenkuriEye_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c b/soh/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c index 5df145a76..739f8011a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c +++ b/soh/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriKaiten_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriKaiten_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMenkuriKaiten_Init(Actor* thisx, PlayState* play); +void BgMenkuriKaiten_Destroy(Actor* thisx, PlayState* play); +void BgMenkuriKaiten_Update(Actor* thisx, PlayState* play); +void BgMenkuriKaiten_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Menkuri_Kaiten_InitVars = { ACTOR_BG_MENKURI_KAITEN, @@ -31,7 +31,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriKaiten_Init(Actor* thisx, PlayState* play) { BgMenkuriKaiten* this = (BgMenkuriKaiten*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -39,24 +39,24 @@ void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK3); CollisionHeader_GetVirtual(&gGTGRotatingRingPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgMenkuriKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriKaiten_Destroy(Actor* thisx, PlayState* play) { BgMenkuriKaiten* this = (BgMenkuriKaiten*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMenkuriKaiten_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriKaiten_Update(Actor* thisx, PlayState* play) { BgMenkuriKaiten* this = (BgMenkuriKaiten*)thisx; - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params) && func_80043590(&this->dyna)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params) && func_80043590(&this->dyna)) { func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); this->dyna.actor.shape.rot.y += 0x80; } } -void BgMenkuriKaiten_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGTGRotatingRingPlatformDL); +void BgMenkuriKaiten_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGTGRotatingRingPlatformDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index 7c94a16c5..6cde7b643 100644 --- a/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgMenkuriNisekabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriNisekabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMenkuriNisekabe_Init(Actor* thisx, PlayState* play); +void BgMenkuriNisekabe_Destroy(Actor* thisx, PlayState* play); +void BgMenkuriNisekabe_Update(Actor* thisx, PlayState* play); +void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Menkuri_Nisekabe_InitVars = { ACTOR_BG_MENKURI_NISEKABE, @@ -29,32 +29,32 @@ const ActorInit Bg_Menkuri_Nisekabe_InitVars = { static Gfx* sDLists[] = { gGTGFakeWallDL, gGTGFakeCeilingDL }; -void BgMenkuriNisekabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Init(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; Actor_SetScale(&this->actor, 0.1f); } -void BgMenkuriNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Destroy(Actor* thisx, PlayState* play) { } -void BgMenkuriNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Update(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; } } -void BgMenkuriNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; u32 index = this->actor.params & 0xFF; if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, sDLists[index]); + Gfx_DrawDListXlu(play, sDLists[index]); } else { - Gfx_DrawDListOpa(globalCtx, sDLists[index]); + Gfx_DrawDListOpa(play, sDLists[index]); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 96257051c..3cce58ebf 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -10,14 +10,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuBwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuBwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuBwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuBwall_Init(Actor* thisx, PlayState* play); +void BgMizuBwall_Destroy(Actor* thisx, PlayState* play); +void BgMizuBwall_Update(Actor* thisx, PlayState* play); +void BgMizuBwall_Draw(Actor* thisx, PlayState* play); -void BgMizuBwall_Idle(BgMizuBwall* this, GlobalContext* globalCtx); -void BgMizuBwall_Break(BgMizuBwall* this, GlobalContext* globalCtx); -void BgMizuBwall_DoNothing(BgMizuBwall* this, GlobalContext* globalCtx); +void BgMizuBwall_Idle(BgMizuBwall* this, PlayState* play); +void BgMizuBwall_Break(BgMizuBwall* this, PlayState* play); +void BgMizuBwall_DoNothing(BgMizuBwall* this, PlayState* play); const ActorInit Bg_Mizu_Bwall_InitVars = { ACTOR_BG_MIZU_BWALL, @@ -170,7 +170,7 @@ void BgMizuBwall_RotateVec3f(Vec3f* out, Vec3f* in, f32 sin, f32 cos) { out->z = (in->z * cos) - (in->x * sin); } -void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuBwall_Init(Actor* thisx, PlayState* play) { s32 pad; BgMizuBwall* this = (BgMizuBwall*)thisx; CollisionHeader* colHeader = NULL; @@ -180,17 +180,17 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { this->dList = sDLists[(u16)this->dyna.actor.params & 0xF]; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(sColHeaders[(u16)this->dyna.actor.params & 0xF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); switch ((u16)this->dyna.actor.params & 0xF) { case MIZUBWALL_FLOOR: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitFloor, this->elements)) { + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitFloor, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); @@ -219,13 +219,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_RUTO_ROOM: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitRutoWall, + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitRutoWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.params); @@ -255,13 +255,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_UNUSED: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitUnusedWall, + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitUnusedWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.params); @@ -293,13 +293,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_STINGER_ROOM_1: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.params); @@ -331,13 +331,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_STINGER_ROOM_2: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.params); @@ -371,18 +371,18 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMizuBwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuBwall_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMizuBwall* this = (BgMizuBwall*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->collider); } -void BgMizuBwall_SetAlpha(BgMizuBwall* this, GlobalContext* globalCtx) { - f32 waterLevel = globalCtx->colCtx.colHeader->waterBoxes[2].ySurface; +void BgMizuBwall_SetAlpha(BgMizuBwall* this, PlayState* play) { + f32 waterLevel = play->colCtx.colHeader->waterBoxes[2].ySurface; - if (globalCtx->colCtx.colHeader->waterBoxes) {} + if (play->colCtx.colHeader->waterBoxes) {} if (waterLevel < WATER_TEMPLE_WATER_F1_Y) { this->scrollAlpha1 = 255; @@ -414,7 +414,7 @@ void BgMizuBwall_SetAlpha(BgMizuBwall* this, GlobalContext* globalCtx) { this->scrollAlpha4 = this->scrollAlpha3; } -void BgMizuBwall_SpawnDebris(BgMizuBwall* this, GlobalContext* globalCtx) { +void BgMizuBwall_SpawnDebris(BgMizuBwall* this, PlayState* play) { s32 i; s32 pad; s16 rand1; @@ -459,30 +459,30 @@ void BgMizuBwall_SpawnDebris(BgMizuBwall* this, GlobalContext* globalCtx) { rand1 = (s16)(Rand_ZeroOne() * 120.0f) + 20; rand2 = (s16)(Rand_ZeroOne() * 240.0f) + 20; - func_80033480(globalCtx, &debrisPos, 50.0f, 2, rand1, rand2, 0); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_A_OBJ, debrisPos.x, debrisPos.y, debrisPos.z, 0, 0, 0, + func_80033480(play, &debrisPos, 50.0f, 2, rand1, rand2, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_A_OBJ, debrisPos.x, debrisPos.y, debrisPos.z, 0, 0, 0, 0xB); } } -void BgMizuBwall_Idle(BgMizuBwall* this, GlobalContext* globalCtx) { - BgMizuBwall_SetAlpha(this, globalCtx); +void BgMizuBwall_Idle(BgMizuBwall* this, PlayState* play) { + BgMizuBwall_SetAlpha(this, play); if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - Flags_SetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F); this->breakTimer = 1; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; - BgMizuBwall_SpawnDebris(this, globalCtx); + BgMizuBwall_SpawnDebris(this, play); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); this->actionFunc = BgMizuBwall_Break; } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgMizuBwall_Break(BgMizuBwall* this, GlobalContext* globalCtx) { +void BgMizuBwall_Break(BgMizuBwall* this, PlayState* play) { if (this->breakTimer > 0) { this->breakTimer--; } else { @@ -490,41 +490,41 @@ void BgMizuBwall_Break(BgMizuBwall* this, GlobalContext* globalCtx) { } } -void BgMizuBwall_DoNothing(BgMizuBwall* this, GlobalContext* globalCtx) { +void BgMizuBwall_DoNothing(BgMizuBwall* this, PlayState* play) { } -void BgMizuBwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuBwall_Update(Actor* thisx, PlayState* play) { s32 pad; BgMizuBwall* this = (BgMizuBwall*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuBwall_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void BgMizuBwall_Draw(Actor* thisx, PlayState* play2) { BgMizuBwall* this = (BgMizuBwall*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); - frames = globalCtx->gameplayFrames; + OPEN_DISPS(play->state.gfxCtx); + frames = play->gameplayFrames; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, this->scrollAlpha1)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, this->scrollAlpha2)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, this->scrollAlpha3)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 3 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 3 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, this->scrollAlpha4)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), 2); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), 2); if (this->dList != NULL) { gSPDisplayList(POLY_OPA_DISP++, this->dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h index b4172f8d5..37c0fe2b3 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h @@ -6,7 +6,7 @@ struct BgMizuBwall; -typedef void (*BgMizuBwallActionFunc)(struct BgMizuBwall*, GlobalContext*); +typedef void (*BgMizuBwallActionFunc)(struct BgMizuBwall*, PlayState*); typedef struct BgMizuBwall { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index 6099eb527..0744d75d3 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -16,13 +16,13 @@ #define MOVEBG_POINT_ID(params) ((u16)(params)&0xF) #define MOVEBG_SPEED(params) (((u16)(params) >> 0x4) & 0xF) -void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuMovebg_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuMovebg_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuMovebg_Init(Actor* thisx, PlayState* play); +void BgMizuMovebg_Destroy(Actor* thisx, PlayState* play); +void BgMizuMovebg_Update(Actor* thisx, PlayState* play); +void BgMizuMovebg_Draw(Actor* thisx, PlayState* play); -void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx); -void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx); +void func_8089E318(BgMizuMovebg* this, PlayState* play); +void func_8089E650(BgMizuMovebg* this, PlayState* play); s32 func_8089E108(Path* pathList, Vec3f* pos, s32 pathId, s32 pointId); const ActorInit Bg_Mizu_Movebg_InitVars = { @@ -64,14 +64,14 @@ static Vec3f D_8089EBAC = { 0.0f, 80.0f, 23.0f }; static u8 D_8089EE40; -s32 func_8089DC30(GlobalContext* globalCtx) { +s32 func_8089DC30(PlayState* play) { s32 result; - if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG)) { + if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG)) { result = 1; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG)) { result = 2; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)) { result = 3; } else { result = 1; @@ -79,10 +79,10 @@ s32 func_8089DC30(GlobalContext* globalCtx) { return result; } -void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuMovebg_Init(Actor* thisx, PlayState* play) { s32 type; s32 waypointId; - WaterBox* waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; + WaterBox* waterBoxes = play->colCtx.colHeader->waterBoxes; f32 temp; CollisionHeader* colHeader = NULL; Vec3f sp48; @@ -92,7 +92,7 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { ((BgMizuMovebg*)thisx)->dlist = D_8089EB50[MOVEBG_TYPE(thisx->params)]; DynaPolyActor_Init(&((BgMizuMovebg*)thisx)->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(D_8089EB70[MOVEBG_TYPE(thisx->params)], &colHeader); - ((BgMizuMovebg*)thisx)->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + ((BgMizuMovebg*)thisx)->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); type = MOVEBG_TYPE(thisx->params); switch (type) { @@ -124,13 +124,13 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { ((BgMizuMovebg*)thisx)->actionFunc = func_8089E318; break; case 3: - thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY + D_8089EB40[func_8089DC30(globalCtx)]; + thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY + D_8089EB40[func_8089DC30(play)]; ((BgMizuMovebg*)thisx)->actionFunc = func_8089E318; break; case 4: case 5: case 6: - if (Flags_GetSwitch(globalCtx, MOVEBG_FLAGS(thisx->params))) { + if (Flags_GetSwitch(play, MOVEBG_FLAGS(thisx->params))) { thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY + 115.19999999999999; } else { thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY; @@ -144,7 +144,7 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { ((BgMizuMovebg*)thisx)->scrollAlpha4 = 160; waypointId = MOVEBG_POINT_ID(thisx->params); ((BgMizuMovebg*)thisx)->waypointId = waypointId; - func_8089E108(globalCtx->setupPathList, &thisx->world.pos, MOVEBG_PATH_ID(thisx->params), waypointId); + func_8089E108(play->setupPathList, &thisx->world.pos, MOVEBG_PATH_ID(thisx->params), waypointId); ((BgMizuMovebg*)thisx)->actionFunc = func_8089E650; break; } @@ -158,7 +158,7 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(thisx->world.rot.y * (M_PI / 32768), MTXMODE_NEW); Matrix_MultVec3f(&D_8089EBA0, &sp48); - if (Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_HSBLOCK, + if (Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_HSBLOCK, thisx->world.pos.x + sp48.x, thisx->world.pos.y + sp48.y, thisx->world.pos.z + sp48.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z, 2) == NULL) { @@ -168,10 +168,10 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMizuMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuMovebg_Destroy(Actor* thisx, PlayState* play) { BgMizuMovebg* this = (BgMizuMovebg*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); switch (MOVEBG_TYPE(thisx->params)) { case 3: case 4: @@ -203,8 +203,8 @@ s32 func_8089E108(Path* pathList, Vec3f* pos, s32 pathId, s32 pointId) { return 0; } -void func_8089E198(BgMizuMovebg* this, GlobalContext* globalCtx) { - f32 waterLevel = globalCtx->colCtx.colHeader->waterBoxes[2].ySurface; +void func_8089E198(BgMizuMovebg* this, PlayState* play) { + f32 waterLevel = play->colCtx.colHeader->waterBoxes[2].ySurface; if (waterLevel < WATER_TEMPLE_WATER_F1_Y) { this->scrollAlpha1 = 255; @@ -236,13 +236,13 @@ void func_8089E198(BgMizuMovebg* this, GlobalContext* globalCtx) { this->scrollAlpha4 = this->scrollAlpha3; } -void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { - WaterBox* waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; +void func_8089E318(BgMizuMovebg* this, PlayState* play) { + WaterBox* waterBoxes = play->colCtx.colHeader->waterBoxes; f32 phi_f0; s32 type; Vec3f sp28; - func_8089E198(this, globalCtx); + func_8089E198(this, play); type = MOVEBG_TYPE(this->dyna.actor.params); switch (type) { @@ -264,7 +264,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { } break; case 3: - phi_f0 = this->homeY + D_8089EB40[func_8089DC30(globalCtx)]; + phi_f0 = this->homeY + D_8089EB40[func_8089DC30(play)]; if (!Math_StepToF(&this->dyna.actor.world.pos.y, phi_f0, 1.0f)) { if (!(D_8089EE40 & 2) && MOVEBG_SPEED(this->dyna.actor.params) != 0) { D_8089EE40 |= 2; @@ -282,7 +282,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (Flags_GetSwitch(globalCtx, MOVEBG_FLAGS(this->dyna.actor.params))) { + if (Flags_GetSwitch(play, MOVEBG_FLAGS(this->dyna.actor.params))) { phi_f0 = this->homeY + 115.200005f; } else { phi_f0 = this->homeY; @@ -305,7 +305,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (globalCtx->roomCtx.curRoom.num == this->dyna.actor.room) { + if (play->roomCtx.curRoom.num == this->dyna.actor.room) { Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 32768), MTXMODE_NEW); Matrix_MultVec3f(&D_8089EBAC, &sp28); this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x + sp28.x; @@ -317,7 +317,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { } } -void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { +void func_8089E650(BgMizuMovebg* this, PlayState* play) { Vec3f waypoint; f32 dist; f32 dx; @@ -325,7 +325,7 @@ void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { f32 dz; this->dyna.actor.speedXZ = MOVEBG_SPEED(this->dyna.actor.params) * 0.1f; - func_8089E108(globalCtx->setupPathList, &waypoint, MOVEBG_PATH_ID(this->dyna.actor.params), this->waypointId); + func_8089E108(play->setupPathList, &waypoint, MOVEBG_PATH_ID(this->dyna.actor.params), this->waypointId); dist = Actor_WorldDistXYZToPoint(&this->dyna.actor, &waypoint); if (dist < this->dyna.actor.speedXZ) { this->dyna.actor.speedXZ = dist; @@ -337,9 +337,9 @@ void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { dz = waypoint.z - this->dyna.actor.world.pos.z; if (fabsf(dx) < 2.0f && fabsf(dy) < 2.0f && fabsf(dz) < 2.0f) { this->waypointId++; - if (this->waypointId >= globalCtx->setupPathList[MOVEBG_PATH_ID(this->dyna.actor.params)].count) { + if (this->waypointId >= play->setupPathList[MOVEBG_PATH_ID(this->dyna.actor.params)].count) { this->waypointId = 0; - func_8089E108(globalCtx->setupPathList, &this->dyna.actor.world.pos, + func_8089E108(play->setupPathList, &this->dyna.actor.world.pos, MOVEBG_PATH_ID(this->dyna.actor.params), 0); } } @@ -352,44 +352,44 @@ void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { } } -void BgMizuMovebg_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuMovebg_Update(Actor* thisx, PlayState* play) { BgMizuMovebg* this = (BgMizuMovebg*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void BgMizuMovebg_Draw(Actor* thisx, PlayState* play2) { BgMizuMovebg* this = (BgMizuMovebg*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - frames = globalCtx->gameplayFrames; - func_80093D18(globalCtx->state.gfxCtx); + frames = play->gameplayFrames; + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha1)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha2)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha3)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha4)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dlist != NULL) { gSPDisplayList(POLY_OPA_DISP++, this->dlist); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h b/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h index bf17eeac2..8b5218e4b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h @@ -6,7 +6,7 @@ struct BgMizuMovebg; -typedef void (*BgMizuMovebgActionFunc)(struct BgMizuMovebg*, GlobalContext*); +typedef void (*BgMizuMovebgActionFunc)(struct BgMizuMovebg*, PlayState*); typedef struct BgMizuMovebg { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c index f1eb34c50..33f01d82f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c @@ -6,15 +6,15 @@ #define SIZE_PARAM (((u16)this->dyna.actor.params >> 0xC) & 0xF) #define TIMER_PARAM (((u16)this->dyna.actor.params >> 6) & 0x3F) -void BgMizuShutter_Init(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Destroy(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Update(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Draw(BgMizuShutter* this, GlobalContext* globalCtx); +void BgMizuShutter_Init(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Destroy(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Update(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Draw(BgMizuShutter* this, PlayState* play); -void BgMizuShutter_WaitForTimer(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, GlobalContext* globalCtx); +void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, PlayState* play); const ActorInit Bg_Mizu_Shutter_InitVars = { ACTOR_BG_MIZU_SHUTTER, @@ -48,7 +48,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Init(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; s32 pad2; @@ -59,7 +59,7 @@ void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { this->displayList = sDisplayLists[SIZE_PARAM]; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(sCollisionHeaders[SIZE_PARAM], &sp30); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp30); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); if ((SIZE_PARAM == BGMIZUSHUTTER_SMALL) || (SIZE_PARAM == BGMIZUSHUTTER_LARGE)) { this->closedPos = this->dyna.actor.world.pos; this->timer = 0; @@ -72,10 +72,10 @@ void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { this->openPos.y += this->dyna.actor.world.pos.y; this->openPos.z += this->dyna.actor.world.pos.z; if (this->timerMax != 0x3F * 20) { - Flags_UnsetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F); + Flags_UnsetSwitch(play, (u16)this->dyna.actor.params & 0x3F); this->dyna.actor.world.pos = this->closedPos; } - if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, (u16)this->dyna.actor.params & 0x3F)) { this->dyna.actor.world.pos = this->openPos; this->actionFunc = BgMizuShutter_WaitForTimer; } else { @@ -84,34 +84,34 @@ void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { } } -void BgMizuShutter_Destroy(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Destroy(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { +void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, PlayState* play) { + if (Flags_GetSwitch(play, (u16)this->dyna.actor.params & 0x3F)) { if (ABS(this->dyna.actor.world.rot.x) > 0x2C60) { - OnePointCutscene_Init(globalCtx, 4510, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4510, -99, &this->dyna.actor, MAIN_CAM); } else { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); } this->actionFunc = BgMizuShutter_WaitForCutscene; this->timer = 30; } } -void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, GlobalContext* globalCtx) { +void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, PlayState* play) { if (this->timer-- == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN); this->actionFunc = BgMizuShutter_Move; } } -void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { +void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play) { + if (Flags_GetSwitch(play, (u16)this->dyna.actor.params & 0x3F)) { Math_SmoothStepToF(&this->dyna.actor.world.pos.x, this->openPos.x, 1.0f, 4.0f, 0.1f); Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->openPos.y, 1.0f, 4.0f, 0.1f); Math_SmoothStepToF(&this->dyna.actor.world.pos.z, this->openPos.z, 1.0f, 4.0f, 0.1f); @@ -135,36 +135,36 @@ void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx) { } } -void BgMizuShutter_WaitForTimer(BgMizuShutter* this, GlobalContext* globalCtx) { +void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play) { if (this->timerMax != 0x3F * 20) { this->timer--; func_8002F994(&this->dyna.actor, this->timer); if (this->timer == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE); - Flags_UnsetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F); + Flags_UnsetSwitch(play, (u16)this->dyna.actor.params & 0x3F); this->actionFunc = BgMizuShutter_Move; } } } -void BgMizuShutter_Update(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Update(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuShutter_Draw(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Draw(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->displayList != NULL) { gSPDisplayList(POLY_OPA_DISP++, this->displayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h b/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h index 1889da300..af4d34035 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h @@ -8,7 +8,7 @@ struct BgMizuShutter; -typedef void (*BgMizuShutterActionFunc)(struct BgMizuShutter*, GlobalContext*); +typedef void (*BgMizuShutterActionFunc)(struct BgMizuShutter*, PlayState*); typedef struct BgMizuShutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c index c6e1fdfd8..c9e4d2462 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c @@ -9,12 +9,12 @@ #define FLAGS 0 -void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuUzu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuUzu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuUzu_Init(Actor* thisx, PlayState* play); +void BgMizuUzu_Destroy(Actor* thisx, PlayState* play); +void BgMizuUzu_Update(Actor* thisx, PlayState* play); +void BgMizuUzu_Draw(Actor* thisx, PlayState* play); -void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx); +void func_8089F788(BgMizuUzu* this, PlayState* play); const ActorInit Bg_Mizu_Uzu_InitVars = { ACTOR_BG_MIZU_UZU, @@ -35,7 +35,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Init(Actor* thisx, PlayState* play) { s32 pad; BgMizuUzu* this = (BgMizuUzu*)thisx; CollisionHeader* colHeader = NULL; @@ -44,33 +44,33 @@ void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gObjectMizuObjectsUzuCol_0074EC, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = func_8089F788; } -void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Destroy(Actor* thisx, PlayState* play) { BgMizuUzu* this = (BgMizuUzu*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx) { +void func_8089F788(BgMizuUzu* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - if (GET_PLAYER(globalCtx)->currentBoots == PLAYER_BOOTS_IRON) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (GET_PLAYER(play)->currentBoots == PLAYER_BOOTS_IRON) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } Audio_PlayActorSound2(thisx, NA_SE_EV_WATER_CONVECTION - SFX_FLAG); thisx->shape.rot.y += 0x1C0; } -void BgMizuUzu_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Update(Actor* thisx, PlayState* play) { BgMizuUzu* this = (BgMizuUzu*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuUzu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Draw(Actor* thisx, PlayState* play) { } diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h b/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h index 528a9386b..94e6b3c9d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h @@ -6,7 +6,7 @@ struct BgMizuUzu; -typedef void (*BgMizuUzuActionFunc)(struct BgMizuUzu*, GlobalContext*); +typedef void (*BgMizuUzuActionFunc)(struct BgMizuUzu*, PlayState*); typedef struct BgMizuUzu { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 2d82f1799..b741ff4d4 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuWater_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuWater_Init(Actor* thisx, PlayState* play); +void BgMizuWater_Destroy(Actor* thisx, PlayState* play); +void BgMizuWater_Update(Actor* thisx, PlayState* play); +void BgMizuWater_Draw(Actor* thisx, PlayState* play); -void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx); -void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx); +void BgMizuWater_WaitForAction(BgMizuWater* this, PlayState* play); +void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, PlayState* play); typedef struct { s32 switchFlag; @@ -51,28 +51,28 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_STOP), }; -u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, GlobalContext* globalCtx) { +u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) { u32 ret; if (bREG(0) != 0) { switch (bREG(1)) { case 0: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG); break; case 1: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG); break; case 2: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG); break; } bREG(0) = 0; } - if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) { + if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) { ret = 3; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) { ret = 2; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F3_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F3_FLAG)) { ret = 1; } else { ret = 0; @@ -89,13 +89,13 @@ void BgMizuWater_SetWaterBoxesHeight(WaterBox* waterBoxes, s16 height) { } } -void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Init(Actor* thisx, PlayState* play) { BgMizuWater* this = (BgMizuWater*)thisx; f32 initialActorY; WaterBox* waterBoxes; s32 waterLevelActionIndex; - waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; + waterBoxes = play->colCtx.colHeader->waterBoxes; this->type = this->actor.params & 0xFF; this->switchFlag = (this->actor.params >> 8) & 0xFF; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -106,28 +106,28 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->type) { case 0: if (bREG(15) == 0) { - osSyncPrintf("<コンストラクト>%x %x %x\n", Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG)); + osSyncPrintf("<コンストラクト>%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); } - waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(-1, globalCtx); + waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(-1, play); this->actor.world.pos.y = sWaterLevels[waterLevelActionIndex].yDiff + this->baseY; BgMizuWater_SetWaterBoxesHeight(waterBoxes, this->actor.world.pos.y); this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag; - Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG); - Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG); - Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG); + Flags_UnsetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG); + Flags_UnsetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG); + Flags_UnsetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG); switch (this->actor.params) { case 0x1E: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG); break; case 0x1D: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG); break; case 0x1C: default: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG); break; } this->targetY = this->actor.world.pos.y; @@ -135,20 +135,20 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { case 1: break; case 2: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actor.world.pos.y = this->baseY + 85.0f; } waterBoxes[6].ySurface = this->actor.world.pos.y; break; case 3: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actor.world.pos.y = this->baseY + 110.0f; this->targetY = this->actor.world.pos.y; } waterBoxes[8].ySurface = this->actor.world.pos.y; break; case 4: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actor.world.pos.y = this->baseY + 160.0f; this->targetY = this->actor.world.pos.y; } @@ -159,10 +159,10 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgMizuWater_WaitForAction; } -void BgMizuWater_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Destroy(Actor* thisx, PlayState* play) { } -void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx) { +void BgMizuWater_WaitForAction(BgMizuWater* this, PlayState* play) { s32 pad; s32 waterLevelActionIndex; s16 prevSwitchFlag; @@ -170,36 +170,36 @@ void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx) { switch (this->type) { case 0: prevSwitchFlag = this->actor.params; - waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, globalCtx); + waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, play); if (waterLevelActionIndex != 0) { if (prevSwitchFlag != sWaterLevels[waterLevelActionIndex].switchFlag) { - OnePointCutscene_Init(globalCtx, 3120, -100 - waterLevelActionIndex, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 3120, -100 - waterLevelActionIndex, NULL, MAIN_CAM); this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag; this->targetY = sWaterLevels[waterLevelActionIndex].yDiff + this->baseY; } } if ((prevSwitchFlag != this->actor.params) && (prevSwitchFlag != 0)) { - Flags_UnsetSwitch(globalCtx, prevSwitchFlag); + Flags_UnsetSwitch(play, prevSwitchFlag); } break; case 1: break; case 2: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 85.0f; } else { this->targetY = this->baseY; } break; case 3: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 110.0f; } else { this->targetY = this->baseY; } break; case 4: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 160.0f; } else { this->targetY = this->baseY; @@ -211,17 +211,17 @@ void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx) { } } -void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) { +void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, PlayState* play) { s32 pad; s16 prevSwitchFlag; s32 waterLevelActionIndex; WaterBox* waterBoxes; - waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; + waterBoxes = play->colCtx.colHeader->waterBoxes; switch (this->type) { case 0: prevSwitchFlag = this->actor.params; - waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, globalCtx); + waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, play); if (waterLevelActionIndex != 0) { if (prevSwitchFlag != sWaterLevels[waterLevelActionIndex].switchFlag) { this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag; @@ -230,50 +230,50 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) { } if ((prevSwitchFlag != this->actor.params) && (prevSwitchFlag != 0)) { - Flags_UnsetSwitch(globalCtx, prevSwitchFlag); + Flags_UnsetSwitch(play, prevSwitchFlag); } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 5.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } - BgMizuWater_SetWaterBoxesHeight(globalCtx->colCtx.colHeader->waterBoxes, this->actor.world.pos.y); + BgMizuWater_SetWaterBoxesHeight(play->colCtx.colHeader->waterBoxes, this->actor.world.pos.y); break; case 1: break; case 2: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 85.0f; } else { this->targetY = this->baseY; } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 1.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; } waterBoxes[6].ySurface = this->actor.world.pos.y; break; case 3: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 110.0f; } else { this->targetY = this->baseY; } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 1.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; } waterBoxes[8].ySurface = this->actor.world.pos.y; break; case 4: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 160.0f; } else { this->targetY = this->baseY; } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 1.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; } waterBoxes[16].ySurface = this->actor.world.pos.y; @@ -289,7 +289,7 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) { } } -void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Update(Actor* thisx, PlayState* play) { BgMizuWater* this = (BgMizuWater*)thisx; s32 posY; s32 unk0; @@ -297,9 +297,9 @@ void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; if (bREG(15) == 0) { - osSyncPrintf("%x %x %x\n", Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG)); + osSyncPrintf("%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); } if (this->type == 0) { posY = this->actor.world.pos.y; @@ -317,25 +317,25 @@ void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx) { unk1 = 255 - (s32)((posY - WATER_TEMPLE_WATER_F2_Y) / (WATER_TEMPLE_WATER_F3_Y - WATER_TEMPLE_WATER_F2_Y) * (255 - 160)); } - globalCtx->roomCtx.unk_74[1] = ((u8)unk0 << 8) | (unk1 & 0xFF); + play->roomCtx.unk_74[1] = ((u8)unk0 << 8) | (unk1 & 0xFF); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Draw(Actor* thisx, PlayState* play) { BgMizuWater* this = (BgMizuWater*)thisx; s32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + gameplayFrames = play->gameplayFrames; + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, 0, -gameplayFrames * 1, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); @@ -344,5 +344,5 @@ void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gObjectMizuObjectsWaterDL_004B20); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h b/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h index cb9d96bca..21196022f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h @@ -6,7 +6,7 @@ struct BgMizuWater; -typedef void (*BgMizuWaterActionFunc)(struct BgMizuWater*, GlobalContext*); +typedef void (*BgMizuWaterActionFunc)(struct BgMizuWater*, PlayState*); typedef struct BgMizuWater { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index c1e190b45..e3c365a3a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -16,13 +16,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMjin_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMjin_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMjin_Init(Actor* thisx, PlayState* play); +void BgMjin_Destroy(Actor* thisx, PlayState* play); +void BgMjin_Update(Actor* thisx, PlayState* play); +void BgMjin_Draw(Actor* thisx, PlayState* play); -void func_808A0850(BgMjin* this, GlobalContext* globalCtx); -void BgMjin_DoNothing(BgMjin* this, GlobalContext* globalCtx); +void func_808A0850(BgMjin* this, PlayState* play); +void BgMjin_DoNothing(BgMjin* this, PlayState* play); const ActorInit Bg_Mjin_InitVars = { ACTOR_BG_MJIN, @@ -56,12 +56,12 @@ void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Init(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; s8 objBankIndex; Actor_ProcessInitChain(thisx, sInitChain); - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA)); + objBankIndex = Object_GetIndex(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA)); this->objBankIndex = objBankIndex; if (objBankIndex < 0) { Actor_Kill(thisx); @@ -70,50 +70,50 @@ void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMjin_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Destroy(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808A0850(BgMjin* this, GlobalContext* globalCtx) { +void func_808A0850(BgMjin* this, PlayState* play) { CollisionHeader* colHeader; CollisionHeader* collision; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { colHeader = NULL; this->dyna.actor.flags &= ~ACTOR_FLAG_4; this->dyna.actor.objBankIndex = this->objBankIndex; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_Init(&this->dyna, 0); collision = this->dyna.actor.params != 0 ? &gWarpPadCol : &gOcarinaWarpPadCol; CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); BgMjin_SetupAction(this, BgMjin_DoNothing); this->dyna.actor.draw = BgMjin_Draw; } } -void BgMjin_DoNothing(BgMjin* this, GlobalContext* globalCtx) { +void BgMjin_DoNothing(BgMjin* this, PlayState* play) { } -void BgMjin_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Update(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Draw(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; Gfx* dlist; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (thisx->params != 0) { - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIDs[thisx->params - 1]); + s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[thisx->params - 1]); if (objBankIndex >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); } gSPSegment(POLY_OPA_DISP++, 0x08, gPedestalEmblems[thisx->params - 1]); @@ -122,10 +122,10 @@ void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx) { dlist = gOcarinaWarpPadDL; } - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h b/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h index dd5964ed4..415625574 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h +++ b/soh/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h @@ -6,7 +6,7 @@ struct BgMjin; -typedef void (*BgMjinActionFunc)(struct BgMjin*, GlobalContext*); +typedef void (*BgMjinActionFunc)(struct BgMjin*, PlayState*); typedef struct BgMjin { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 4998d7b93..e0d87f7ef 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -9,23 +9,23 @@ #define FLAGS ACTOR_FLAG_4 -void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriBigst_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriBigst_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriBigst_Init(Actor* thisx, PlayState* play); +void BgMoriBigst_Destroy(Actor* thisx, PlayState* play); +void BgMoriBigst_Update(Actor* thisx, PlayState* play); +void BgMoriBigst_Draw(Actor* thisx, PlayState* play); -void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupNoop(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupFall(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_Fall(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupLanding(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_Landing(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupDone(BgMoriBigst* this, GlobalContext* globalCtx); +void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupNoop(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_StalfosFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupFall(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_Fall(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupLanding(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_Landing(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupDone(BgMoriBigst* this, PlayState* play); const ActorInit Bg_Mori_Bigst_InitVars = { ACTOR_BG_MORI_BIGST, @@ -50,14 +50,14 @@ void BgMoriBigst_SetupAction(BgMoriBigst* this, BgMoriBigstActionFunc actionFunc this->actionFunc = actionFunc; } -void BgMoriBigst_InitDynapoly(BgMoriBigst* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -66,18 +66,18 @@ void BgMoriBigst_InitDynapoly(BgMoriBigst* this, GlobalContext* globalCtx, Colli } } -void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; // "mori (bigST.keyceiling)" osSyncPrintf("mori (bigST.鍵型天井)(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", this->dyna.actor.params, - Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F), - Flags_GetTempClear(globalCtx, this->dyna.actor.room), Flags_GetClear(globalCtx, this->dyna.actor.room), - GET_PLAYER(globalCtx)->actor.world.pos.y); - BgMoriBigst_InitDynapoly(this, globalCtx, &gMoriBigstCol, DPM_UNK); + Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F), + Flags_GetTempClear(play, this->dyna.actor.room), Flags_GetClear(play, this->dyna.actor.room), + GET_PLAYER(play)->actor.world.pos.y); + BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { // "【Big Stalfos key ceiling】 bank danger!" osSyncPrintf("【ビッグスタルフォス鍵型天井】 バンク危険!\n"); @@ -85,53 +85,53 @@ void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->dyna.actor); return; } - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } else { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 270.0f; } Actor_SetFocus(&this->dyna.actor, 50.0f); - BgMoriBigst_SetupWaitForMoriTex(this, globalCtx); + BgMoriBigst_SetupWaitForMoriTex(this, play); } -void BgMoriBigst_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, BgMoriBigst_WaitForMoriTex); } -void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { thisx->draw = BgMoriBigst_Draw; - if (Flags_GetClear(globalCtx, thisx->room) && (GET_PLAYER(globalCtx)->actor.world.pos.y > 700.0f)) { - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { - BgMoriBigst_SetupDone(this, globalCtx); + if (Flags_GetClear(play, thisx->room) && (GET_PLAYER(play)->actor.world.pos.y > 700.0f)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + BgMoriBigst_SetupDone(this, play); } else { - BgMoriBigst_SetupStalfosFight(this, globalCtx); + BgMoriBigst_SetupStalfosFight(this, play); } } else { - BgMoriBigst_SetupNoop(this, globalCtx); + BgMoriBigst_SetupNoop(this, play); } } } -void BgMoriBigst_SetupNoop(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupNoop(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, NULL); } -void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, PlayState* play) { Actor* stalfos; BgMoriBigst_SetupAction(this, BgMoriBigst_StalfosFight); - Flags_UnsetClear(globalCtx, this->dyna.actor.room); - stalfos = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 209.0f, 827.0f, + Flags_UnsetClear(play, this->dyna.actor.room); + stalfos = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_TEST, 209.0f, 827.0f, -3320.0f, 0, 0, 0, 1); if (stalfos != NULL) { this->dyna.actor.child = NULL; @@ -140,59 +140,59 @@ void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) // "Second Stalfos failure" osSyncPrintf("Warning : 第2スタルフォス発生失敗\n"); } - Flags_SetClear(globalCtx, this->dyna.actor.room); + Flags_SetClear(play, this->dyna.actor.room); } -void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgMoriBigst_StalfosFight(BgMoriBigst* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->dyna.actor.home.rot.z == 0) && - ((this->dyna.actor.home.pos.y - 5.0f) <= GET_PLAYER(globalCtx)->actor.world.pos.y)) { - BgMoriBigst_SetupFall(this, globalCtx); - OnePointCutscene_Init(globalCtx, 3220, 72, &this->dyna.actor, MAIN_CAM); + ((this->dyna.actor.home.pos.y - 5.0f) <= GET_PLAYER(play)->actor.world.pos.y)) { + BgMoriBigst_SetupFall(this, play); + OnePointCutscene_Init(play, 3220, 72, &this->dyna.actor, MAIN_CAM); } } -void BgMoriBigst_SetupFall(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupFall(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, BgMoriBigst_Fall); } -void BgMoriBigst_Fall(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_Fall(BgMoriBigst* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - BgMoriBigst_SetupLanding(this, globalCtx); + BgMoriBigst_SetupLanding(this, play); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - OnePointCutscene_Init(globalCtx, 1020, 8, &this->dyna.actor, MAIN_CAM); - func_8002DF38(globalCtx, NULL, 0x3C); + OnePointCutscene_Init(play, 1020, 8, &this->dyna.actor, MAIN_CAM); + func_8002DF38(play, NULL, 0x3C); } } -void BgMoriBigst_SetupLanding(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupLanding(BgMoriBigst* this, PlayState* play) { s32 pad; s32 quake; BgMoriBigst_SetupAction(this, BgMoriBigst_Landing); this->waitTimer = 18; - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 25000); Quake_SetQuakeValues(quake, 5, 0, 0, 0); Quake_SetCountdown(quake, 16); } -void BgMoriBigst_Landing(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_Landing(BgMoriBigst* this, PlayState* play) { if (this->waitTimer <= 0) { - BgMoriBigst_SetupStalfosPairFight(this, globalCtx); + BgMoriBigst_SetupStalfosPairFight(this, play); } } -void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play) { Actor* stalfos1; Actor* stalfos2; BgMoriBigst_SetupAction(this, BgMoriBigst_StalfosPairFight); - Flags_UnsetClear(globalCtx, this->dyna.actor.room); - stalfos1 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 70.0f, 827.0f, + Flags_UnsetClear(play, this->dyna.actor.room); + stalfos1 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_TEST, 70.0f, 827.0f, -3383.0f, 0, 0, 0, 5); if (stalfos1 != NULL) { this->dyna.actor.child = NULL; @@ -201,7 +201,7 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalC // "Warning: 3-1 Stalfos failure" osSyncPrintf("Warning : 第3-1スタルフォス発生失敗\n"); } - stalfos2 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 170.0f, 827.0f, + stalfos2 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_TEST, 170.0f, 827.0f, -3260.0f, 0, 0, 0, 5); if (stalfos2 != NULL) { this->dyna.actor.child = NULL; @@ -210,21 +210,21 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalC // "Warning: 3-2 Stalfos failure" osSyncPrintf("Warning : 第3-2スタルフォス発生失敗\n"); } - Flags_SetClear(globalCtx, this->dyna.actor.room); + Flags_SetClear(play, this->dyna.actor.room); } -void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx) { - if ((this->dyna.actor.home.rot.z == 0) && !Player_InCsMode(globalCtx)) { - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); - BgMoriBigst_SetupDone(this, globalCtx); +void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, PlayState* play) { + if ((this->dyna.actor.home.rot.z == 0) && !Player_InCsMode(play)) { + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + BgMoriBigst_SetupDone(this, play); } } -void BgMoriBigst_SetupDone(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupDone(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, NULL); } -void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; @@ -233,25 +233,25 @@ void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx) { this->waitTimer--; } if (func_80043590(&this->dyna)) { - func_80074CE8(globalCtx, 6); + func_80074CE8(play, 6); } if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriBigst_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriBigstDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h b/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h index 7f18e8b0c..c2a97444e 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h @@ -6,7 +6,7 @@ struct BgMoriBigst; -typedef void (*BgMoriBigstActionFunc)(struct BgMoriBigst*, GlobalContext*); +typedef void (*BgMoriBigstActionFunc)(struct BgMoriBigst*, PlayState*); typedef struct BgMoriBigst { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index 09f82f3e2..1ee1beac5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -3,19 +3,19 @@ #define FLAGS ACTOR_FLAG_4 -void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriElevator_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriElevator_Update(Actor* thisx, GlobalContext* globalCtx); +void BgMoriElevator_Init(Actor* thisx, PlayState* play); +void BgMoriElevator_Destroy(Actor* thisx, PlayState* play); +void BgMoriElevator_Update(Actor* thisx, PlayState* play); void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this); -void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, GlobalContext* globalCtx); +void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play); void BgMoriElevator_SetupSetPosition(BgMoriElevator* this); -void BgMoriElevator_SetPosition(BgMoriElevator* this, GlobalContext* globalCtx); -void BgMoriElevator_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play); +void BgMoriElevator_Draw(Actor* thisx, PlayState* play); void BgMoriElevator_StopMovement(BgMoriElevator* this); -void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx); -void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCtx); -void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx); +void func_808A2008(BgMoriElevator* this, PlayState* play); +void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, PlayState* play); +void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, PlayState* play); static s16 sKankyoIsSpawned = false; @@ -82,13 +82,13 @@ void func_808A18FC(BgMoriElevator* this, f32 distTo) { func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_ELEVATOR_MOVE2 - SFX_FLAG, CLAMP(temp, 0.0f, 1.0f)); } -void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Init(Actor* thisx, PlayState* play) { BgMoriElevator* this = (BgMoriElevator*)thisx; s32 pad; CollisionHeader* colHeader = NULL; this->unk_172 = sKankyoIsSpawned; - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(thisx); // "Forest Temple obj elevator Bank Danger!" @@ -103,7 +103,7 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); BgMoriElevator_SetupWaitAfterInit(this); break; case true: @@ -113,30 +113,30 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriElevator_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Destroy(Actor* thisx, PlayState* play) { BgMoriElevator* this = (BgMoriElevator*)thisx; if (this->unk_172 == 0) { // "Forest Temple elevator DT" osSyncPrintf("森の神殿 elevator DT\n"); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); sKankyoIsSpawned = false; } } -s32 BgMoriElevator_IsPlayerRiding(BgMoriElevator* this, GlobalContext* globalCtx) { +s32 BgMoriElevator_IsPlayerRiding(BgMoriElevator* this, PlayState* play) { return ((this->dyna.unk_160 & 2) && !(this->unk_170 & 2) && - ((GET_PLAYER(globalCtx)->actor.world.pos.y - this->dyna.actor.world.pos.y) < 80.0f)); + ((GET_PLAYER(play)->actor.world.pos.y - this->dyna.actor.world.pos.y) < 80.0f)); } void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) { this->actionFunc = BgMoriElevator_WaitAfterInit; } -void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { - if (globalCtx->roomCtx.curRoom.num == 2) { +void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (play->roomCtx.curRoom.num == 2) { this->dyna.actor.world.pos.y = 73.0f; BgMoriElevator_SetupSetPosition(this); } else { @@ -154,7 +154,7 @@ void func_808A1C30(BgMoriElevator* this) { this->actionFunc = BgMoriElevator_MoveIntoGround; } -void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCtx) { +void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, PlayState* play) { f32 distToTarget; func_808A1800(&this->dyna.actor.velocity.y, 2.0f, 0.05f, 1.0f, 0.0f); @@ -167,13 +167,13 @@ void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCt } } -void func_808A1CF4(BgMoriElevator* this, GlobalContext* globalCtx) { +void func_808A1CF4(BgMoriElevator* this, PlayState* play) { this->actionFunc = BgMoriElevator_MoveAboveGround; - OnePointCutscene_Init(globalCtx, 3230, 70, &this->dyna.actor, MAIN_CAM); - OnePointCutscene_Init(globalCtx, 1020, 15, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3230, 70, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 1020, 15, &this->dyna.actor, MAIN_CAM); } -void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx) { +void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, PlayState* play) { f32 distToTarget; func_808A1800(&this->dyna.actor.velocity.y, 2.0f, 0.05f, 1.0f, 0.0f); @@ -190,34 +190,34 @@ void BgMoriElevator_SetupSetPosition(BgMoriElevator* this) { this->actionFunc = BgMoriElevator_SetPosition; } -void BgMoriElevator_SetPosition(BgMoriElevator* this, GlobalContext* globalCtx) { +void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play) { s32 pad; - if (BgMoriElevator_IsPlayerRiding(this, globalCtx)) { - if (globalCtx->roomCtx.curRoom.num == 2) { + if (BgMoriElevator_IsPlayerRiding(this, play)) { + if (play->roomCtx.curRoom.num == 2) { this->targetY = -779.0f; BgMoriElevator_StopMovement(this); - } else if (globalCtx->roomCtx.curRoom.num == 17) { + } else if (play->roomCtx.curRoom.num == 17) { this->targetY = 233.0f; BgMoriElevator_StopMovement(this); } else { // "Error:Forest Temple obj elevator Room setting is dangerous(%s %d)" osSyncPrintf("Error : 森の神殿 obj elevator 部屋設定が危険(%s %d)\n", __FILE__, __LINE__); } - } else if ((globalCtx->roomCtx.curRoom.num == 2) && (this->dyna.actor.world.pos.y < -275.0f)) { + } else if ((play->roomCtx.curRoom.num == 2) && (this->dyna.actor.world.pos.y < -275.0f)) { this->targetY = 233.0f; BgMoriElevator_StopMovement(this); - } else if ((globalCtx->roomCtx.curRoom.num == 17) && (-275.0f < this->dyna.actor.world.pos.y)) { + } else if ((play->roomCtx.curRoom.num == 17) && (-275.0f < this->dyna.actor.world.pos.y)) { this->targetY = -779.0f; BgMoriElevator_StopMovement(this); - } else if ((globalCtx->roomCtx.curRoom.num == 2) && Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) && + } else if ((play->roomCtx.curRoom.num == 2) && Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) && (this->unk_16C == 0)) { this->targetY = 73.0f; func_808A1C30(this); - } else if ((globalCtx->roomCtx.curRoom.num == 2) && !Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) && + } else if ((play->roomCtx.curRoom.num == 2) && !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) && (this->unk_16C != 0)) { this->targetY = 233.0f; - func_808A1CF4(this, globalCtx); + func_808A1CF4(this, play); } } @@ -226,7 +226,7 @@ void BgMoriElevator_StopMovement(BgMoriElevator* this) { this->dyna.actor.velocity.y = 0.0f; } -void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx) { +void func_808A2008(BgMoriElevator* this, PlayState* play) { f32 distTo; func_808A1800(&this->dyna.actor.velocity.y, 12.0f, 0.1f, 1.0f, 0.0f); @@ -240,25 +240,25 @@ void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx) { } } -void BgMoriElevator_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Update(Actor* thisx, PlayState* play) { BgMoriElevator* this = (BgMoriElevator*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_170 = this->dyna.unk_160; - this->unk_16C = Flags_GetSwitch(globalCtx, (thisx->params & 0x3F)); + this->unk_16C = Flags_GetSwitch(play, (thisx->params & 0x3F)); } -void BgMoriElevator_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriElevator* this = (BgMoriElevator*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriElevatorDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h b/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h index 6c202bb22..a981c71dd 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h @@ -6,7 +6,7 @@ struct BgMoriElevator; -typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, GlobalContext*); +typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, PlayState*); typedef struct BgMoriElevator { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index db96878c0..aa71e6846 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgMoriHashigo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashigo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashigo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashigo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriHashigo_Init(Actor* thisx, PlayState* play); +void BgMoriHashigo_Destroy(Actor* thisx, PlayState* play); +void BgMoriHashigo_Update(Actor* thisx, PlayState* play); +void BgMoriHashigo_Draw(Actor* thisx, PlayState* play); void BgMoriHashigo_SetupWaitForMoriTex(BgMoriHashigo* this); -void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupClasp(BgMoriHashigo* this); -void BgMoriHashigo_Clasp(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_Clasp(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupLadderWait(BgMoriHashigo* this); -void BgMoriHashigo_LadderWait(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_LadderWait(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupLadderFall(BgMoriHashigo* this); -void BgMoriHashigo_LadderFall(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_LadderFall(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupLadderRest(BgMoriHashigo* this); const ActorInit Bg_Mori_Hashigo_InitVars = { @@ -77,7 +77,7 @@ static InitChainEntry sInitChainLadder[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, GlobalContext* globalCtx, CollisionHeader* collision, +void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader; @@ -86,7 +86,7 @@ void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, GlobalContext* globalCtx, C colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -95,11 +95,11 @@ void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, GlobalContext* globalCtx, C } } -void BgMoriHashigo_InitCollider(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_InitCollider(BgMoriHashigo* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); this->collider.elements[0].dim.worldSphere.center.x = (s16)this->dyna.actor.world.pos.x; this->collider.elements[0].dim.worldSphere.center.y = (s16)this->dyna.actor.world.pos.y + 21; @@ -107,7 +107,7 @@ void BgMoriHashigo_InitCollider(BgMoriHashigo* this, GlobalContext* globalCtx) { this->collider.elements[0].dim.worldSphere.radius = 19; } -s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { +s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, PlayState* play) { f32 sn; f32 cs; Vec3f pos; @@ -120,7 +120,7 @@ s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { pos.y = -210.0f + this->dyna.actor.world.pos.y; pos.z = 6.0f * cs + this->dyna.actor.world.pos.z; - ladder = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_MORI_HASHIGO, pos.x, pos.y, + ladder = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_MORI_HASHIGO, pos.x, pos.y, pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 0); if (ladder != NULL) { @@ -133,40 +133,40 @@ s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { } } -s32 BgMoriHashigo_InitClasp(BgMoriHashigo* this, GlobalContext* globalCtx) { +s32 BgMoriHashigo_InitClasp(BgMoriHashigo* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChainClasp); this->dyna.actor.flags |= ACTOR_FLAG_0; Actor_SetFocus(&this->dyna.actor, 55.0f); - BgMoriHashigo_InitCollider(this, globalCtx); - if ((this->dyna.actor.params == HASHIGO_CLASP) && !BgMoriHashigo_SpawnLadder(this, globalCtx)) { + BgMoriHashigo_InitCollider(this, play); + if ((this->dyna.actor.params == HASHIGO_CLASP) && !BgMoriHashigo_SpawnLadder(this, play)) { return false; } else { return true; } } -s32 BgMoriHashigo_InitLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { - BgMoriHashigo_InitDynapoly(this, globalCtx, &gMoriHashigoCol, DPM_UNK); +s32 BgMoriHashigo_InitLadder(BgMoriHashigo* this, PlayState* play) { + BgMoriHashigo_InitDynapoly(this, play, &gMoriHashigoCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChainLadder); return true; } -void BgMoriHashigo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; if (this->dyna.actor.params == HASHIGO_CLASP) { - if (!BgMoriHashigo_InitClasp(this, globalCtx)) { + if (!BgMoriHashigo_InitClasp(this, play)) { Actor_Kill(&this->dyna.actor); return; } } else if (this->dyna.actor.params == HASHIGO_LADDER) { - if (!BgMoriHashigo_InitLadder(this, globalCtx)) { + if (!BgMoriHashigo_InitLadder(this, play)) { Actor_Kill(&this->dyna.actor); return; } } - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { // "Bank danger!" osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, @@ -179,15 +179,15 @@ void BgMoriHashigo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriHashigo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; if (this->dyna.actor.params == HASHIGO_LADDER) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->dyna.actor.params == HASHIGO_CLASP) { - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } } @@ -195,8 +195,8 @@ void BgMoriHashigo_SetupWaitForMoriTex(BgMoriHashigo* this) { this->actionFunc = BgMoriHashigo_WaitForMoriTex; } -void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { if (this->dyna.actor.params == HASHIGO_CLASP) { BgMoriHashigo_SetupClasp(this); } else if (this->dyna.actor.params == HASHIGO_LADDER) { @@ -210,13 +210,13 @@ void BgMoriHashigo_SetupClasp(BgMoriHashigo* this) { this->actionFunc = BgMoriHashigo_Clasp; } -void BgMoriHashigo_Clasp(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_Clasp(BgMoriHashigo* this, PlayState* play) { if (this->hitTimer <= 0) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; this->hitTimer = 10; } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } @@ -225,7 +225,7 @@ void BgMoriHashigo_SetupLadderWait(BgMoriHashigo* this) { this->actionFunc = BgMoriHashigo_LadderWait; } -void BgMoriHashigo_LadderWait(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_LadderWait(BgMoriHashigo* this, PlayState* play) { BgMoriHashigo* clasp = (BgMoriHashigo*)this->dyna.actor.parent; if (clasp->hitTimer > 0) { @@ -241,7 +241,7 @@ void BgMoriHashigo_SetupLadderFall(BgMoriHashigo* this) { this->dyna.actor.velocity.y = 2.0f; } -void BgMoriHashigo_LadderFall(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_LadderFall(BgMoriHashigo* this, PlayState* play) { static f32 bounceSpeed[3] = { 4.0f, 2.7f, 1.7f }; Actor* thisx = &this->dyna.actor; @@ -250,12 +250,12 @@ void BgMoriHashigo_LadderFall(BgMoriHashigo* this, GlobalContext* globalCtx) { if (this->bounceCounter >= ARRAY_COUNT(bounceSpeed)) { BgMoriHashigo_SetupLadderRest(this); } else { - Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 0x1C); thisx->velocity.y = bounceSpeed[this->bounceCounter]; this->bounceCounter++; } } else { - Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 0x1C); } } @@ -266,7 +266,7 @@ void BgMoriHashigo_SetupLadderRest(BgMoriHashigo* this) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } -void BgMoriHashigo_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; @@ -274,19 +274,19 @@ void BgMoriHashigo_Update(Actor* thisx, GlobalContext* globalCtx) { this->hitTimer--; } if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriHashigo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - 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); switch (this->dyna.actor.params) { @@ -297,5 +297,5 @@ void BgMoriHashigo_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gMoriHashigoLadderDL); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h b/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h index 55c07ca92..35281d5c7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h @@ -6,7 +6,7 @@ struct BgMoriHashigo; -typedef void (*BgMoriHashigoActionFunc)(struct BgMoriHashigo*, GlobalContext*); +typedef void (*BgMoriHashigoActionFunc)(struct BgMoriHashigo*, PlayState*); typedef struct BgMoriHashigo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index b4fee0fae..813b7900c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashira4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashira4_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashira4_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriHashira4_Init(Actor* thisx, PlayState* play); +void BgMoriHashira4_Destroy(Actor* thisx, PlayState* play); +void BgMoriHashira4_Update(Actor* thisx, PlayState* play); +void BgMoriHashira4_Draw(Actor* thisx, PlayState* play); void BgMoriHashira4_SetupWaitForMoriTex(BgMoriHashira4* this); -void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, GlobalContext* globalCtx); +void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, PlayState* play); void BgMoriHashira4_SetupPillarsRotate(BgMoriHashira4* this); -void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, GlobalContext* globalCtx); -void BgMoriHashira4_GateWait(BgMoriHashira4* this, GlobalContext* globalCtx); -void BgMoriHashira4_GateOpen(BgMoriHashira4* this, GlobalContext* globalCtx); +void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, PlayState* play); +void BgMoriHashira4_GateWait(BgMoriHashira4* this, PlayState* play); +void BgMoriHashira4_GateOpen(BgMoriHashira4* this, PlayState* play); const ActorInit Bg_Mori_Hashira4_InitVars = { ACTOR_BG_MORI_HASHIRA4, @@ -49,7 +49,7 @@ void BgMoriHashira4_SetupAction(BgMoriHashira4* this, BgMoriHashira4ActionFunc a this->actionFunc = actionFunc; } -void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, GlobalContext* globalCtx, CollisionHeader* collision, +void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader; @@ -58,7 +58,7 @@ void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, GlobalContext* globalCtx, colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -67,7 +67,7 @@ void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, GlobalContext* globalCtx, } } -void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; @@ -75,12 +75,12 @@ void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.params &= 0xFF; if (this->dyna.actor.params == 0) { - BgMoriHashira4_InitDynaPoly(this, globalCtx, &gMoriHashira1Col, DPM_UNK3); + BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira1Col, DPM_UNK3); } else { - BgMoriHashira4_InitDynaPoly(this, globalCtx, &gMoriHashira2Col, DPM_UNK); + BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira2Col, DPM_UNK); } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(&this->dyna.actor); // "Bank danger!" @@ -88,7 +88,7 @@ void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { __FILE__, __LINE__); return; } - if ((this->dyna.actor.params != 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->dyna.actor.params != 0) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(&this->dyna.actor); return; } @@ -99,19 +99,19 @@ void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { sUnkTimer = 0; } -void BgMoriHashira4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgMoriHashira4_SetupWaitForMoriTex(BgMoriHashira4* this) { BgMoriHashira4_SetupAction(this, BgMoriHashira4_WaitForMoriTex); } -void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { this->gateTimer = 0; if (this->dyna.actor.params == 0) { BgMoriHashira4_SetupPillarsRotate(this); @@ -126,50 +126,50 @@ void BgMoriHashira4_SetupPillarsRotate(BgMoriHashira4* this) { BgMoriHashira4_SetupAction(this, BgMoriHashira4_PillarsRotate); } -void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, GlobalContext* globalCtx) { +void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, PlayState* play) { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y += 0x96; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_ROLL_STAND_2 - SFX_FLAG); } -void BgMoriHashira4_GateWait(BgMoriHashira4* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) || (this->gateTimer != 0)) { +void BgMoriHashira4_GateWait(BgMoriHashira4* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag) || (this->gateTimer != 0)) { this->gateTimer++; if (this->gateTimer > 30) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN); BgMoriHashira4_SetupAction(this, BgMoriHashira4_GateOpen); - OnePointCutscene_Init(globalCtx, 6010, 20, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 6010, 20, &this->dyna.actor, MAIN_CAM); sUnkTimer++; } } } -void BgMoriHashira4_GateOpen(BgMoriHashira4* this, GlobalContext* globalCtx) { +void BgMoriHashira4_GateOpen(BgMoriHashira4* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 120.0f, 10.0f)) { Actor_Kill(&this->dyna.actor); } } -void BgMoriHashira4_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriHashira4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDisplayLists[this->dyna.actor.params]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h b/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h index 447acdab9..797688bdb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h @@ -6,7 +6,7 @@ struct BgMoriHashira4; -typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, GlobalContext*); +typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, PlayState*); typedef struct BgMoriHashira4 { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index e848c1625..e4d1cc77c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -15,18 +15,18 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHineri_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHineri_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx); +void BgMoriHineri_Init(Actor* thisx, PlayState* play); +void BgMoriHineri_Destroy(Actor* thisx, PlayState* play); +void BgMoriHineri_Update(Actor* thisx, PlayState* play); +void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play); void BgMoriHineri_Reset(void); -void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx); -void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx); -void func_808A3C8C(BgMoriHineri* this, GlobalContext* globalCtx); -void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, GlobalContext* globalCtx); -void BgMoriHineri_DoNothing(BgMoriHineri* this, GlobalContext* globalCtx); -void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx); +void func_808A39FC(BgMoriHineri* this, PlayState* play); +void func_808A3E54(BgMoriHineri* this, PlayState* play); +void func_808A3C8C(BgMoriHineri* this, PlayState* play); +void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, PlayState* play); +void BgMoriHineri_DoNothing(BgMoriHineri* this, PlayState* play); +void func_808A3D58(BgMoriHineri* this, PlayState* play); s16 sBgMoriHineriNextCamIdx = SUBCAM_NONE; @@ -54,7 +54,7 @@ static Gfx* sDLists[] = { object_mori_hineri2a_DL_002B70, }; -void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_Init(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; s8 moriHineriObjIdx; u32 switchFlagParam; @@ -70,10 +70,10 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = switchFlagParam; } else { this->switchFlag = ((this->dyna.actor.params >> 8) & 0x3F); - this->switchFlag = (Flags_GetSwitch(globalCtx, this->switchFlag)) ? 1 : 0; + this->switchFlag = (Flags_GetSwitch(play, this->switchFlag)) ? 1 : 0; } this->dyna.actor.params = ((this->dyna.actor.params & 0x8000) >> 0xE); - if (Flags_GetSwitch(globalCtx, switchFlagParam)) { + if (Flags_GetSwitch(play, switchFlagParam)) { if (this->dyna.actor.params == 0) { this->dyna.actor.params = 1; } else if (this->dyna.actor.params == 2) { @@ -82,21 +82,21 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { } this->boxObjIdx = -1; if (this->dyna.actor.params == 0) { - this->moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1); + this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1); if (t6 == 0) { - this->boxObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_BOX); + this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX); } } else { if (this->dyna.actor.params == 1) { - moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1A); + moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A); } else { moriHineriObjIdx = (this->dyna.actor.params == 2) - ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2A); + ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2) + : Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A); } this->moriHineriObjIdx = moriHineriObjIdx; } - this->moriTexObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (t6 != 0) { this->dyna.actor.params += 4; } @@ -107,28 +107,28 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriHineri_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_Destroy(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A39FC(BgMoriHineri* this, PlayState* play) { CollisionHeader* colHeader; - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriHineriObjIdx) && - Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIdx) && - ((this->boxObjIdx < 0) || Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx))) { + if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjIdx) && + Object_IsLoaded(&play->objectCtx, this->moriTexObjIdx) && + ((this->boxObjIdx < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjIdx))) { this->dyna.actor.objBankIndex = this->moriHineriObjIdx; if (this->dyna.actor.params >= 4) { this->dyna.actor.params -= 4; if (this->dyna.actor.params == 0) { - this->moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1A); + this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A); } else if (this->dyna.actor.params == 1) { - this->moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1); + this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1); } else { this->moriHineriObjIdx = (this->dyna.actor.params == 2) - ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2A) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2); + ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A) + : Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2); } if (this->moriHineriObjIdx < 0) { Actor_Kill(&this->dyna.actor); @@ -136,7 +136,7 @@ void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx) { this->actionFunc = func_808A3D58; } } else { - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); colHeader = NULL; this->dyna.actor.draw = BgMoriHineri_DrawHallAndRoom; if (this->dyna.actor.params == 0) { @@ -154,62 +154,62 @@ void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx) { this->actionFunc = func_808A3C8C; CollisionHeader_GetVirtual(&object_mori_hineri2a_Col_006078, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } } } -void BgMoriHineri_DoNothing(BgMoriHineri* this, GlobalContext* globalCtx) { +void BgMoriHineri_DoNothing(BgMoriHineri* this, PlayState* play) { } -void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, GlobalContext* globalCtx) { +void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, PlayState* play) { if (this->dyna.actor.params == 0) { - Object_Spawn(&globalCtx->objectCtx, OBJECT_BOX); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, -1515.0f, 1440.0f, -3475.0f, -0x4000, 0x4000, 0, 0x27EE); + Object_Spawn(&play->objectCtx, OBJECT_BOX); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOX, -1515.0f, 1440.0f, -3475.0f, -0x4000, 0x4000, 0, 0x27EE); this->actionFunc = func_808A3C8C; } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, this->dyna.actor.world.pos.x + 147.0f, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOX, this->dyna.actor.world.pos.x + 147.0f, this->dyna.actor.world.pos.y + -245.0f, this->dyna.actor.world.pos.z + -453.0f, 0, 0x4000, 0, 0x27EE); this->actionFunc = BgMoriHineri_DoNothing; } } -void func_808A3C8C(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A3C8C(BgMoriHineri* this, PlayState* play) { f32 f0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f0 = 1100.0f - (player->actor.world.pos.z - this->dyna.actor.world.pos.z); this->dyna.actor.shape.rot.z = CLAMP(f0, 0.0f, 1000.0f) * 16.384f; - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON1); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON1); if (this->dyna.actor.params != 0) { this->dyna.actor.shape.rot.z = -this->dyna.actor.shape.rot.z; } } -void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A3D58(BgMoriHineri* this, PlayState* play) { s16 mainCamChildIdx; - if ((Flags_GetSwitch(globalCtx, this->switchFlag) && + if ((Flags_GetSwitch(play, this->switchFlag) && (this->dyna.actor.params == 0 || this->dyna.actor.params == 2)) || - (!Flags_GetSwitch(globalCtx, this->switchFlag) && + (!Flags_GetSwitch(play, this->switchFlag) && (this->dyna.actor.params == 1 || this->dyna.actor.params == 3))) { this->dyna.actor.draw = BgMoriHineri_DrawHallAndRoom; this->actionFunc = func_808A3E54; - mainCamChildIdx = globalCtx->cameraPtrs[MAIN_CAM]->childCamIdx; + mainCamChildIdx = play->cameraPtrs[MAIN_CAM]->childCamIdx; if ((mainCamChildIdx != SUBCAM_FREE) && - (globalCtx->cameraPtrs[mainCamChildIdx]->setting == CAM_SET_CS_TWISTED_HALLWAY)) { - OnePointCutscene_EndCutscene(globalCtx, mainCamChildIdx); + (play->cameraPtrs[mainCamChildIdx]->setting == CAM_SET_CS_TWISTED_HALLWAY)) { + OnePointCutscene_EndCutscene(play, mainCamChildIdx); } - OnePointCutscene_Init(globalCtx, 3260, 40, &this->dyna.actor, MAIN_CAM); - sBgMoriHineriNextCamIdx = OnePointCutscene_Init(globalCtx, 3261, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3260, 40, &this->dyna.actor, MAIN_CAM); + sBgMoriHineriNextCamIdx = OnePointCutscene_Init(play, 3261, 40, &this->dyna.actor, MAIN_CAM); } } -void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A3E54(BgMoriHineri* this, PlayState* play) { s8 objBankIndex; - if (globalCtx->activeCamera == sBgMoriHineriNextCamIdx) { + if (play->activeCamera == sBgMoriHineriNextCamIdx) { if (sBgMoriHineriNextCamIdx != MAIN_CAM) { objBankIndex = this->dyna.actor.objBankIndex; this->dyna.actor.objBankIndex = this->moriHineriObjIdx; @@ -224,34 +224,34 @@ void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) { } } if ((sBgMoriHineriNextCamIdx >= SUBCAM_FIRST) && - ((GET_ACTIVE_CAM(globalCtx)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) { + ((GET_ACTIVE_CAM(play)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) { func_8002F948(&this->dyna.actor, NA_SE_EV_FLOOR_ROLLING - SFX_FLAG); } } -void BgMoriHineri_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_Update(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; s8 objIndex; MtxF mtx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIdx].segment); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIdx].segment); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[this->dyna.actor.params]); if (this->boxObjIdx > 0) { Matrix_Get(&mtx); } if ((this->actionFunc == func_808A3C8C) && (this->dyna.actor.shape.rot.z != 0)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->dyna.actor.params == 0) { Matrix_Translate(-1761.0f, 1278.0f, -1821.0f, MTXMODE_NEW); } else { @@ -259,12 +259,12 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { } Matrix_RotateZYX(0, -0x8000, this->dyna.actor.shape.rot.z, MTXMODE_APPLY); Matrix_Translate(0.0f, -50.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDungeonDoorDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void BgMoriHineri_Reset() { diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h index a8187138c..e42c23a43 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h @@ -6,7 +6,7 @@ struct BgMoriHineri; -typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, GlobalContext*); +typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*); typedef struct BgMoriHineri { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c b/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index 0afb823d7..860b1a320 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriIdomizu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriIdomizu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriIdomizu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriIdomizu_Init(Actor* thisx, PlayState* play); +void BgMoriIdomizu_Destroy(Actor* thisx, PlayState* play); +void BgMoriIdomizu_Update(Actor* thisx, PlayState* play); +void BgMoriIdomizu_Draw(Actor* thisx, PlayState* play); void BgMoriIdomizu_SetupWaitForMoriTex(BgMoriIdomizu* this); -void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, GlobalContext* globalCtx); +void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play); void BgMoriIdomizu_SetupMain(BgMoriIdomizu* this); -void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx); +void BgMoriIdomizu_Main(BgMoriIdomizu* this, PlayState* play); static s16 sKankyoIsSpawned = false; @@ -38,15 +38,15 @@ void BgMoriIdomizu_SetupAction(BgMoriIdomizu* this, BgMoriIdomizuActionFunc acti this->actionFunc = actionFunc; } -void BgMoriIdomizu_SetWaterLevel(GlobalContext* globalCtx, s16 waterLevel) { - WaterBox* waterBox = globalCtx->colCtx.colHeader->waterBoxes; +void BgMoriIdomizu_SetWaterLevel(PlayState* play, s16 waterLevel) { + WaterBox* waterBox = play->colCtx.colHeader->waterBoxes; waterBox[2].ySurface = waterLevel; waterBox[3].ySurface = waterLevel; waterBox[4].ySurface = waterLevel; } -void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; @@ -59,15 +59,15 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.z = 1.0f; this->actor.world.pos.x = 119.0f; this->actor.world.pos.z = -1820.0f; - this->prevSwitchFlagSet = Flags_GetSwitch(globalCtx, this->actor.params & 0x3F); + this->prevSwitchFlagSet = Flags_GetSwitch(play, this->actor.params & 0x3F); if (this->prevSwitchFlagSet != 0) { this->actor.world.pos.y = -282.0f; - BgMoriIdomizu_SetWaterLevel(globalCtx, -282); + BgMoriIdomizu_SetWaterLevel(play, -282); } else { this->actor.world.pos.y = 184.0f; - BgMoriIdomizu_SetWaterLevel(globalCtx, 184); + BgMoriIdomizu_SetWaterLevel(play, 184); } - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(&this->actor); // "Bank danger!" @@ -83,7 +83,7 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(森の神殿 井戸水)(arg_data 0x%04x)\n", this->actor.params); } -void BgMoriIdomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; @@ -96,8 +96,8 @@ void BgMoriIdomizu_SetupWaitForMoriTex(BgMoriIdomizu* this) { BgMoriIdomizu_SetupAction(this, BgMoriIdomizu_WaitForMoriTex); } -void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { BgMoriIdomizu_SetupMain(this); this->actor.draw = BgMoriIdomizu_Draw; } @@ -107,23 +107,23 @@ void BgMoriIdomizu_SetupMain(BgMoriIdomizu* this) { BgMoriIdomizu_SetupAction(this, BgMoriIdomizu_Main); } -void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) { +void BgMoriIdomizu_Main(BgMoriIdomizu* this, PlayState* play) { s8 roomNum; Actor* thisx = &this->actor; s32 switchFlagSet; - roomNum = globalCtx->roomCtx.curRoom.num; - switchFlagSet = Flags_GetSwitch(globalCtx, thisx->params & 0x3F); + roomNum = play->roomCtx.curRoom.num; + switchFlagSet = Flags_GetSwitch(play, thisx->params & 0x3F); if (switchFlagSet) { this->targetWaterLevel = -282.0f; } else { this->targetWaterLevel = 184.0f; } if (switchFlagSet && !this->prevSwitchFlagSet) { - OnePointCutscene_Init(globalCtx, 3240, 70, thisx, MAIN_CAM); + OnePointCutscene_Init(play, 3240, 70, thisx, MAIN_CAM); this->drainTimer = 90; } else if (!switchFlagSet && this->prevSwitchFlagSet) { - OnePointCutscene_Init(globalCtx, 3240, 70, thisx, MAIN_CAM); + OnePointCutscene_Init(play, 3240, 70, thisx, MAIN_CAM); this->drainTimer = 90; thisx->world.pos.y = 0.0f; } @@ -131,7 +131,7 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) { if ((roomNum == 7) || (roomNum == 8) || (roomNum == 9)) { if (this->drainTimer < 70) { Math_StepToF(&thisx->world.pos.y, this->targetWaterLevel, 3.5f); - BgMoriIdomizu_SetWaterLevel(globalCtx, thisx->world.pos.y); + BgMoriIdomizu_SetWaterLevel(play, thisx->world.pos.y); if (this->drainTimer > 0) { if (switchFlagSet) { func_800788CC(NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); @@ -142,43 +142,43 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) { } } else { thisx->world.pos.y = this->targetWaterLevel; - BgMoriIdomizu_SetWaterLevel(globalCtx, thisx->world.pos.y); + BgMoriIdomizu_SetWaterLevel(play, thisx->world.pos.y); Actor_Kill(thisx); return; } this->prevSwitchFlagSet = switchFlagSet; } -void BgMoriIdomizu_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriIdomizu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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); - gSPSegment(POLY_XLU_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0x7F - (gameplayFrames & 0x7F), gameplayFrames % 0x80, 0x20, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0x7F - (gameplayFrames & 0x7F), gameplayFrames % 0x80, 0x20, 0x20, 1, gameplayFrames & 0x7F, gameplayFrames % 0x80, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gMoriIdomizuWaterDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h b/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h index be9032337..d2e6f173a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h @@ -6,7 +6,7 @@ struct BgMoriIdomizu; -typedef void (*BgMoriIdomizuActionFunc)(struct BgMoriIdomizu*, GlobalContext*); +typedef void (*BgMoriIdomizuActionFunc)(struct BgMoriIdomizu*, PlayState*); typedef struct BgMoriIdomizu { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 42babb904..7e765f21f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriKaitenkabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriKaitenkabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriKaitenkabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play); +void BgMoriKaitenkabe_Destroy(Actor* thisx, PlayState* play); +void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play); +void BgMoriKaitenkabe_Draw(Actor* thisx, PlayState* play); -void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, GlobalContext* globalCtx); +void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, PlayState* play); void BgMoriKaitenkabe_SetupWait(BgMoriKaitenkabe* this); -void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx); +void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play); void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this); -void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx); +void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play); const ActorInit Bg_Mori_Kaitenkabe_InitVars = { ACTOR_BG_MORI_KAITENKABE, @@ -46,7 +46,7 @@ void BgMoriKaitenkabe_CrossProduct(Vec3f* dest, Vec3f* v1, Vec3f* v2) { dest->z = (v1->x * v2->y) - (v1->y * v2->x); } -void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; CollisionHeader* colHeader = NULL; @@ -56,8 +56,8 @@ void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(&this->dyna.actor); // "【Rotating wall】 Bank danger!" @@ -67,15 +67,15 @@ void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriKaitenkabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { BgMoriKaitenkabe_SetupWait(this); this->dyna.actor.draw = BgMoriKaitenkabe_Draw; } @@ -86,17 +86,17 @@ void BgMoriKaitenkabe_SetupWait(BgMoriKaitenkabe* this) { this->timer = 0; } -void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { Vec3f push; Vec3f leverArm; Vec3f torque; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 > 0.001f) { this->timer++; - if ((this->timer > (28 - CVar_GetS32("gFasterBlockPush", 0) * 4)) && !Player_InCsMode(globalCtx)) { + if ((this->timer > (28 - CVar_GetS32("gFasterBlockPush", 0) * 4)) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); - func_8002DF54(globalCtx, &this->dyna.actor, 8); + func_8002DF54(play, &this->dyna.actor, 8); Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); push.x = Math_SinS(this->dyna.unk_158); push.y = 0.0f; @@ -122,15 +122,15 @@ void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this) { this->rotYdeg = 0.0f; } -void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; s16 rotY; Math_StepToF(&this->rotSpeed, 0.6f, 0.02f); if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) { BgMoriKaitenkabe_SetupWait(this); - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); if (this->rotDirection > 0.0f) { thisx->home.rot.y += 0x2000; } else { @@ -150,26 +150,26 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); } -void BgMoriKaitenkabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMoriKaitenkabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriKaitenkabeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h index aa52d21a4..05272c6f2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h @@ -6,7 +6,7 @@ struct BgMoriKaitenkabe; -typedef void (*BgMoriKaitenkabeActionFunc)(struct BgMoriKaitenkabe*, GlobalContext*); +typedef void (*BgMoriKaitenkabeActionFunc)(struct BgMoriKaitenkabe*, PlayState*); typedef struct BgMoriKaitenkabe { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 093faf2d8..52e46f678 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -9,21 +9,21 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriRakkatenjo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriRakkatenjo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriRakkatenjo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Destroy(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play); void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupWait(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupFall(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupRest(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupRise(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, PlayState* play); static s16 sCamSetting = 0; @@ -46,7 +46,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; CollisionHeader* colHeader = NULL; @@ -64,7 +64,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx) { // "The set Angle has changed. Let's fix the program." osSyncPrintf("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n"); } - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { // "Forest Temple obj Falling Ceiling Bank Danger!" osSyncPrintf("Error : 森の神殿 obj 落下天井 バンク危険!(%s %d)\n", __FILE__, __LINE__); @@ -73,26 +73,26 @@ void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); CollisionHeader_GetVirtual(&gMoriRakkatenjoCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); BgMoriRakkatenjo_SetupWaitForMoriTex(this); sCamSetting = 0; } -void BgMoriRakkatenjo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -s32 BgMoriRakkatenjo_IsLinkUnder(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - Vec3f* pos = &GET_PLAYER(globalCtx)->actor.world.pos; +s32 BgMoriRakkatenjo_IsLinkUnder(BgMoriRakkatenjo* this, PlayState* play) { + Vec3f* pos = &GET_PLAYER(play)->actor.world.pos; return (-3300.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f); } -s32 BgMoriRakkatenjo_IsLinkClose(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - Vec3f* pos = &GET_PLAYER(globalCtx)->actor.world.pos; +s32 BgMoriRakkatenjo_IsLinkClose(BgMoriRakkatenjo* this, PlayState* play) { + Vec3f* pos = &GET_PLAYER(play)->actor.world.pos; return (-3360.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f); } @@ -101,8 +101,8 @@ void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this) { this->actionFunc = BgMoriRakkatenjo_WaitForMoriTex; } -void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { BgMoriRakkatenjo_SetupWait(this); this->dyna.actor.draw = BgMoriRakkatenjo_Draw; } @@ -114,9 +114,9 @@ void BgMoriRakkatenjo_SetupWait(BgMoriRakkatenjo* this) { this->actionFunc = BgMoriRakkatenjo_Wait; } -void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, PlayState* play) { if (this->fallCount == 0) { - if (BgMoriRakkatenjo_IsLinkClose(this, globalCtx) || (this->timer < 20)) { + if (BgMoriRakkatenjo_IsLinkClose(this, play) || (this->timer < 20)) { if (this->timer <= 0) { BgMoriRakkatenjo_SetupFall(this); } @@ -124,7 +124,7 @@ void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { this->timer = 21; } } else { - if (BgMoriRakkatenjo_IsLinkUnder(this, globalCtx) || (this->timer < 20)) { + if (BgMoriRakkatenjo_IsLinkUnder(this, play) || (this->timer < 20)) { if (this->timer <= 0) { BgMoriRakkatenjo_SetupFall(this); } @@ -143,7 +143,7 @@ void BgMoriRakkatenjo_SetupFall(BgMoriRakkatenjo* this) { this->dyna.actor.velocity.y = 0.0f; } -void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play) { static f32 bounceVel[] = { 4.0f, 1.5f, 0.4f, 0.1f }; s32 pad; Actor* thisx = &this->dyna.actor; @@ -163,7 +163,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { 403.0f - (thisx->world.pos.y - 403.0f) * bounceVel[this->bounceCount] / fabsf(thisx->velocity.y); thisx->velocity.y = bounceVel[this->bounceCount]; this->bounceCount++; - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 50000); Quake_SetQuakeValues(quake, 5, 0, 0, 0); Quake_SetCountdown(quake, 5); @@ -177,7 +177,7 @@ void BgMoriRakkatenjo_SetupRest(BgMoriRakkatenjo* this) { this->timer = 20; } -void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, PlayState* play) { if (this->timer <= 0) { BgMoriRakkatenjo_SetupRise(this); } @@ -188,7 +188,7 @@ void BgMoriRakkatenjo_SetupRise(BgMoriRakkatenjo* this) { this->dyna.actor.velocity.y = -0.1f; } -void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.velocity.y, 5.0f, 0.06f, 0.1f, 0.0f); this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y >= 683.0f) { @@ -196,41 +196,41 @@ void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { } } -void BgMoriRakkatenjo_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; if (this->timer > 0) { this->timer--; } - this->actionFunc(this, globalCtx); - if (BgMoriRakkatenjo_IsLinkUnder(this, globalCtx)) { + this->actionFunc(this, play); + if (BgMoriRakkatenjo_IsLinkUnder(this, play)) { if (sCamSetting == CAM_SET_NONE) { osSyncPrintf("camera changed (mori rakka tenjyo) ... \n"); - sCamSetting = globalCtx->cameraPtrs[MAIN_CAM]->setting; - Camera_SetCameraData(globalCtx->cameraPtrs[MAIN_CAM], 1, &this->dyna.actor, NULL, 0, 0, 0); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FOREST_BIRDS_EYE); + sCamSetting = play->cameraPtrs[MAIN_CAM]->setting; + Camera_SetCameraData(play->cameraPtrs[MAIN_CAM], 1, &this->dyna.actor, NULL, 0, 0, 0); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_FOREST_BIRDS_EYE); } } else if (sCamSetting != CAM_SET_NONE) { osSyncPrintf("camera changed (previous) ... \n"); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON1); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON1); sCamSetting = 0; } } -void BgMoriRakkatenjo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriRakkatenjoDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h b/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h index 305e48a0a..b263892f0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h @@ -6,7 +6,7 @@ struct BgMoriRakkatenjo; -typedef void (*BgMoriRakkatenjoActionFunction)(struct BgMoriRakkatenjo*, GlobalContext*); +typedef void (*BgMoriRakkatenjoActionFunction)(struct BgMoriRakkatenjo*, PlayState*); typedef struct BgMoriRakkatenjo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index e4accc8c9..5ca3cb290 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -9,25 +9,25 @@ #define FLAGS 0 -void BgPoEvent_Init(Actor* thisx, GlobalContext* globalCtx); -void BgPoEvent_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgPoEvent_Update(Actor* thisx, GlobalContext* globalCtx); -void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgPoEvent_Init(Actor* thisx, PlayState* play); +void BgPoEvent_Destroy(Actor* thisx, PlayState* play); +void BgPoEvent_Update(Actor* thisx, PlayState* play); +void BgPoEvent_Draw(Actor* thisx, PlayState* play); void BgPoEvent_Reset(void); -void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockShake(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx); // Amy is the green Poe -void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingEmpty(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingAppear(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx); +void BgPoEvent_BlockWait(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockShake(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockReset(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockSolved(BgPoEvent* this, PlayState* play); +void BgPoEvent_AmyWait(BgPoEvent* this, PlayState* play); // Amy is the green Poe +void BgPoEvent_AmyPuzzle(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingEmpty(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingAppear(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingPresent(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingBurn(BgPoEvent* this, PlayState* play); const ActorInit Bg_Po_Event_InitVars = { ACTOR_BG_PO_EVENT, @@ -86,7 +86,7 @@ static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; u8 sBgPoEventPuzzleState; -void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_InitPaintings(BgPoEvent* this, PlayState* play) { static s16 paintingPosX[] = { -1302, -866, 1421, 985 }; static s16 paintingPosY[] = { 1107, 1091 }; static s16 paintingPosZ[] = { -3384, -3252 }; @@ -122,7 +122,7 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) { } if ((this->type != 4) && (this->index != 2)) { phi_t2 = (this->type == 2) ? this->index : this->index + 2; - newPainting = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_PO_EVENT, + newPainting = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_PO_EVENT, paintingPosX[phi_t2], paintingPosY[this->index], paintingPosZ[this->index], 0, this->dyna.actor.shape.rot.y + 0x8000, 0, ((this->index + 1) << 0xC) + (this->type << 8) + this->dyna.actor.params); @@ -149,7 +149,7 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_InitBlocks(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_InitBlocks(BgPoEvent* this, PlayState* play) { static s16 blockPosX[] = { 2149, 1969, 1909 }; static s16 blockPosZ[] = { -1410, -1350, -1530 }; Actor* newBlock; @@ -158,9 +158,9 @@ void BgPoEvent_InitBlocks(BgPoEvent* this, GlobalContext* globalCtx) { this->dyna.actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; CollisionHeader_GetVirtual(&gPoSistersAmyBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if ((this->type == 0) && (this->index != 3)) { - newBlock = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_PO_EVENT, + newBlock = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_PO_EVENT, blockPosX[this->index], this->dyna.actor.world.pos.y, blockPosZ[this->index], 0, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z - 0x4000, ((this->index + 1) << 0xC) + (this->type << 8) + this->dyna.actor.params); @@ -183,7 +183,7 @@ void BgPoEvent_InitBlocks(BgPoEvent* this, GlobalContext* globalCtx) { } } this->dyna.actor.world.pos.y = 833.0f; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &this->dyna.actor.world.pos); this->actionFunc = BgPoEvent_BlockWait; } @@ -192,7 +192,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgPoEvent_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Init(Actor* thisx, PlayState* play) { s32 pad; BgPoEvent* this = (BgPoEvent*)thisx; @@ -202,42 +202,42 @@ void BgPoEvent_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0x3F; if (this->type >= 2) { - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->colliderItems); - if (Flags_GetSwitch(globalCtx, thisx->params)) { + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); + if (Flags_GetSwitch(play, thisx->params)) { Actor_Kill(thisx); } else { - BgPoEvent_InitPaintings(this, globalCtx); + BgPoEvent_InitPaintings(this, play); } } else { DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, thisx->params)) { + if (Flags_GetSwitch(play, thisx->params)) { Actor_Kill(thisx); } else { - BgPoEvent_InitBlocks(this, globalCtx); + BgPoEvent_InitBlocks(this, play); } } } -void BgPoEvent_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgPoEvent* this = (BgPoEvent*)thisx; if (this->type >= 2) { - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); } else { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->type == 1) && (gSaveContext.timer1Value > 0)) { gSaveContext.timer1State = 0xA; } } } -void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockWait(BgPoEvent* this, PlayState* play) { this->dyna.actor.world.pos.y = 833.0f; if (sBgPoEventPuzzleState == 0x3F) { if (this->type == 1) { - OnePointCutscene_Init(globalCtx, 3150, 65, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 3150, 65, NULL, MAIN_CAM); } this->timer = 45; this->actionFunc = BgPoEvent_BlockShake; @@ -254,7 +254,7 @@ void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_BlockShake(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockShake(BgPoEvent* this, PlayState* play) { DECR(this->timer); if (this->timer < 15) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + 2.0f * ((this->timer % 3) - 1); @@ -304,7 +304,7 @@ void BgPoEvent_CheckBlock(BgPoEvent* this) { } } -void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play) { static s32 firstFall = 0; this->dyna.actor.velocity.y++; @@ -316,12 +316,12 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { BgPoEvent_CheckBlock(this); } else { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - func_80033E88(&this->dyna.actor, globalCtx, 5, 5); + func_80033E88(&this->dyna.actor, play, 5, 5); func_80088B34(this->timer); if (firstFall == 0) { firstFall = 1; } else { - func_8002DF54(globalCtx, &GET_PLAYER(globalCtx)->actor, 7); + func_8002DF54(play, &GET_PLAYER(play)->actor, 7); } } this->direction = 0; @@ -329,19 +329,19 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* amy; if (sBgPoEventPuzzleState == 0xF) { this->actionFunc = BgPoEvent_BlockSolved; if ((this->type == 0) && (this->index == 0)) { amy = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->dyna.actor.world.pos.x + 30.0f, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->dyna.actor.world.pos.x + 30.0f, this->dyna.actor.world.pos.y - 30.0f, this->dyna.actor.world.pos.z + 30.0f, 0, this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 0x300); if (amy != NULL) { - OnePointCutscene_Init(globalCtx, 3170, 30, amy, MAIN_CAM); + OnePointCutscene_Init(play, 3170, 30, amy, MAIN_CAM); } func_80078884(NA_SE_SY_CORRECT_CHIME); gSaveContext.timer1State = 0xA; @@ -352,17 +352,17 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { sBgPoEventPuzzleState = 0x10; sBgPoEventBlocksAtRest = 0; } - if ((sBgPoEventPuzzleState == 0x40) || ((sBgPoEventPuzzleState == 0x10) && !Player_InCsMode(globalCtx))) { + if ((sBgPoEventPuzzleState == 0x40) || ((sBgPoEventPuzzleState == 0x10) && !Player_InCsMode(play))) { this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z; this->actionFunc = BgPoEvent_BlockReset; if (sBgPoEventPuzzleState == 0x10) { sBgPoEventPuzzleState = 0x40; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_RISING); - func_8002DF54(globalCtx, &player->actor, 8); + func_8002DF54(play, &player->actor, 8); } } else if (this->dyna.unk_150 != 0.0f) { if (this->direction == 0) { - if (func_800435D8(globalCtx, &this->dyna, 0x1E, 0x32, -0x14) != 0) { + if (func_800435D8(play, &this->dyna, 0x1E, 0x32, -0x14) != 0) { sBgPoEventBlocksAtRest--; this->direction = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f; this->actionFunc = BgPoEvent_BlockPush; @@ -382,10 +382,10 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { } f32 sBgPoEventblockPushDist = 0.0f; -void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) { f32 displacement; s32 blockStop; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->dyna.actor.speedXZ = this->dyna.actor.speedXZ + (CVar_GetS32("gFasterBlockPush", 0) * 0.3) + 0.5f; this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f); @@ -395,7 +395,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.z; if (blockStop) { player->stateFlags2 &= ~0x10; - if ((this->dyna.unk_150 > 0.0f) && (func_800435D8(globalCtx, &this->dyna, 0x1E, 0x32, -0x14) == 0)) { + if ((this->dyna.unk_150 > 0.0f) && (func_800435D8(play, &this->dyna, 0x1E, 0x32, -0x14) == 0)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } this->dyna.unk_150 = 0.0f; @@ -415,8 +415,8 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgPoEvent_BlockReset(BgPoEvent* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -435,8 +435,8 @@ void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgPoEvent_BlockSolved(BgPoEvent* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -447,7 +447,7 @@ void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_AmyWait(BgPoEvent* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { sBgPoEventPuzzleState |= 0x20; this->timer = 5; @@ -457,14 +457,14 @@ void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_AmyPuzzle(BgPoEvent* this, PlayState* play) { Vec3f pos; if (sBgPoEventPuzzleState == 0xF) { pos.x = this->dyna.actor.world.pos.x - 5.0f; pos.y = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.y; pos.z = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true); } else if (sBgPoEventPuzzleState == 0x20) { Actor_Kill(&this->dyna.actor); } else { @@ -489,14 +489,14 @@ s32 BgPoEvent_NextPainting(BgPoEvent* this) { return true; } -void BgPoEvent_PaintingEmpty(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingEmpty(BgPoEvent* this, PlayState* play) { if (sBgPoEventPuzzleState == this->index) { this->timer = 255; this->actionFunc = BgPoEvent_PaintingAppear; } } -void BgPoEvent_PaintingAppear(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingAppear(BgPoEvent* this, PlayState* play) { this->timer -= 20; if (this->timer <= 0) { this->timer = 1000; @@ -504,7 +504,7 @@ void BgPoEvent_PaintingAppear(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_PaintingVanish(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingVanish(BgPoEvent* this, PlayState* play) { this->timer += 20; if (this->timer >= 255) { BgPoEvent_NextPainting(this); @@ -512,16 +512,16 @@ void BgPoEvent_PaintingVanish(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingPresent(BgPoEvent* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); DECR(this->timer); if (((this->timer == 0) || ((thisx->xzDistToPlayer < 150.0f) && (thisx->yDistToPlayer < 50.0f)) || (func_8002DD78(player) && (thisx->xzDistToPlayer < 320.0f) && ((this->index != 2) ? (thisx->yDistToPlayer < 100.0f) : (thisx->yDistToPlayer < 0.0f)) && - Player_IsFacingActor(thisx, 0x2000, globalCtx))) && + Player_IsFacingActor(thisx, 0x2000, play))) && ((thisx->parent != NULL) || (thisx->child != NULL))) { /*The third condition in the || is checking if 1) Link is holding a ranged weapon @@ -534,15 +534,15 @@ void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { this->actionFunc = BgPoEvent_PaintingVanish; } else if (this->collider.base.acFlags & AC_HIT) { if (!BgPoEvent_NextPainting(this)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, thisx->world.pos.y - 40.0f, thisx->world.pos.z, 0, thisx->shape.rot.y, 0, thisx->params + ((this->type - 1) << 8)); - OnePointCutscene_Init(globalCtx, 3160, 80, thisx, MAIN_CAM); + OnePointCutscene_Init(play, 3160, 80, thisx, MAIN_CAM); func_80078884(NA_SE_SY_CORRECT_CHIME); } else { Audio_PlayActorSound2(thisx, NA_SE_EN_PO_LAUGH2); - OnePointCutscene_Init(globalCtx, 3160, 35, thisx, MAIN_CAM); + OnePointCutscene_Init(play, 3160, 35, thisx, MAIN_CAM); } if (thisx->parent != NULL) { thisx->parent->child = NULL; @@ -557,7 +557,7 @@ void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingBurn(BgPoEvent* this, PlayState* play) { Vec3f sp54; this->timer--; @@ -566,10 +566,10 @@ void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx) { sp54.z = Rand_CenteredFloat(50.0f) + this->dyna.actor.world.pos.z; if (this->timer >= 0) { if (this->type == 2) { - EffectSsDeadDb_Spawn(globalCtx, &sp54, &sZeroVec, &sZeroVec, 100, 0, 255, 255, 150, 170, 255, 0, 0, 1, 9, + EffectSsDeadDb_Spawn(play, &sp54, &sZeroVec, &sZeroVec, 100, 0, 255, 255, 150, 170, 255, 0, 0, 1, 9, true); } else { - EffectSsDeadDb_Spawn(globalCtx, &sp54, &sZeroVec, &sZeroVec, 100, 0, 200, 255, 255, 170, 50, 100, 255, 1, 9, + EffectSsDeadDb_Spawn(play, &sp54, &sZeroVec, &sZeroVec, 100, 0, 200, 255, 255, 170, 50, 100, 255, 1, 9, true); } } @@ -581,17 +581,17 @@ void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Update(Actor* thisx, PlayState* play) { s32 pad; BgPoEvent* this = (BgPoEvent*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc == BgPoEvent_AmyWait) || (this->actionFunc == BgPoEvent_PaintingPresent)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { gPoSistersAmyBlockDL, gPoSistersAmyBethBlockDL, gPoSistersJoellePaintingDL, gPoSistersBethPaintingDL, gPoSistersAmyPaintingDL, @@ -604,8 +604,8 @@ void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp48; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((this->type == 3) || (this->type == 2)) { if (this->actionFunc == BgPoEvent_PaintingEmpty) { alpha = 255; @@ -616,10 +616,10 @@ void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { } gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, alpha); } - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, displayLists[this->type]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if ((this->type == 0) || (this->type == 1)) { sp48 = (833.0f - this->dyna.actor.world.pos.y) * 0.0025f; @@ -629,7 +629,7 @@ void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { sp58.z = this->dyna.actor.world.pos.z; sp4C.y = 1.0f; sp4C.x = sp4C.z = (sp48 * 0.3f) + 0.4f; - func_80033C30(&sp58, &sp4C, (u8)(155.0f + sp48 * 100.0f), globalCtx); + func_80033C30(&sp58, &sp4C, (u8)(155.0f + sp48 * 100.0f), play); } } } diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h index 3023774f9..412c18722 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h +++ b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h @@ -6,7 +6,7 @@ struct BgPoEvent; -typedef void (*BgPoEventActionFunc)(struct BgPoEvent*, GlobalContext*); +typedef void (*BgPoEventActionFunc)(struct BgPoEvent*, PlayState*); typedef struct BgPoEvent { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/soh/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index b7bdc5237..91f13b083 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/soh/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -19,10 +19,10 @@ typedef enum { #define POE_TORCH_FLAG 0x1C -void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx); -void BgPoSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgPoSyokudai_Update(Actor* thisx, GlobalContext* globalCtx); -void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgPoSyokudai_Init(Actor* thisx, PlayState* play); +void BgPoSyokudai_Destroy(Actor* thisx, PlayState* play); +void BgPoSyokudai_Update(Actor* thisx, PlayState* play); +void BgPoSyokudai_Draw(Actor* thisx, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -75,7 +75,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; @@ -86,78 +86,78 @@ void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->colChkInfo.mass = MASS_IMMOVABLE; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, thisx->world.pos.x, (s16)thisx->world.pos.y + 65, thisx->world.pos.z, 0, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); this->collider.dim.pos.x = thisx->world.pos.x; this->collider.dim.pos.y = thisx->world.pos.y; this->collider.dim.pos.z = thisx->world.pos.z; - if (this->flameColor == POE_FLAME_PURPLE && Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_GREEN) && - Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_BLUE) && - Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_RED) && !Flags_GetSwitch(globalCtx, thisx->params)) { + if (this->flameColor == POE_FLAME_PURPLE && Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_GREEN) && + Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_BLUE) && + Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_RED) && !Flags_GetSwitch(play, thisx->params)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0, thisx->params); - globalCtx->envCtx.unk_BF = 0x4; + play->envCtx.unk_BF = 0x4; - } else if (!Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_PURPLE) && !Flags_GetSwitch(globalCtx, 0x1B)) { + } else if (!Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_PURPLE) && !Flags_GetSwitch(play, 0x1B)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, thisx->world.pos.y + 52.0f, thisx->world.pos.z, 0, 0, 0, (this->flameColor << 8) + thisx->params + 0x1000); - } else if (!Flags_GetSwitch(globalCtx, thisx->params)) { - if (globalCtx->envCtx.unk_BF == 0xFF) { - globalCtx->envCtx.unk_BF = 4; + } else if (!Flags_GetSwitch(play, thisx->params)) { + if (play->envCtx.unk_BF == 0xFF) { + play->envCtx.unk_BF = 4; } } this->flameTextureScroll = (s16)(Rand_ZeroOne() * 20.0f); } -void BgPoSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Destroy(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); - if (globalCtx->envCtx.unk_BF != 0xFF) { - globalCtx->envCtx.unk_BF = 0xFF; + if (play->envCtx.unk_BF != 0xFF) { + play->envCtx.unk_BF = 0xFF; } } -void BgPoSyokudai_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Update(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (Flags_GetSwitch(play, this->actor.params)) { func_8002F974(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } this->flameTextureScroll++; } -void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Draw(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; f32 lightBrightness; u8 red; u8 green; u8 blue; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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++, gGoldenTorchDL); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { Color_RGBA8* primColor = &sPrimColors[this->flameColor]; Color_RGBA8* envColor = &sEnvColors[this->flameColor]; @@ -169,23 +169,23 @@ void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { Lights_PointSetColorAndRadius(&this->lightInfo, red, green, blue, 200); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->flameTextureScroll * -20) & 0x1FF, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, primColor->r, primColor->g, primColor->b, 255); gDPSetEnvColor(POLY_XLU_DISP++, envColor->r, envColor->g, envColor->b, 255); Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(0.0027f, 0.0027f, 0.0027f, 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++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c b/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c index bc50153c2..9136e8b36 100644 --- a/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c +++ b/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c @@ -9,12 +9,12 @@ #define FLAGS 0 -void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx); -void BgPushbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx); -void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgPushbox_Init(Actor* thisx, PlayState* play); +void BgPushbox_Destroy(Actor* thisx, PlayState* play); +void BgPushbox_Update(Actor* thisx, PlayState* play); +void BgPushbox_Draw(Actor* thisx, PlayState* play); -void BgPushbox_UpdateImpl(BgPushbox* this, GlobalContext* globalCtx); +void BgPushbox_UpdateImpl(BgPushbox* this, PlayState* play); const ActorInit Bg_Pushbox_InitVars = { ACTOR_BG_PUSHBOX, @@ -37,7 +37,7 @@ void BgPushbox_SetupAction(BgPushbox* this, BgPushboxActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Init(Actor* thisx, PlayState* play) { s32 pad; BgPushbox* this = (BgPushbox*)thisx; CollisionHeader* colHeader = NULL; @@ -46,18 +46,18 @@ void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gBlockSmallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); BgPushbox_SetupAction(this, BgPushbox_UpdateImpl); } -void BgPushbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Destroy(Actor* thisx, PlayState* play) { BgPushbox* this = (BgPushbox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgPushbox_UpdateImpl(BgPushbox* this, GlobalContext* globalCtx) { +void BgPushbox_UpdateImpl(BgPushbox* this, PlayState* play) { this->dyna.actor.speedXZ += this->dyna.unk_150 * 0.2f; this->dyna.actor.speedXZ = (this->dyna.actor.speedXZ < -1.0f) ? -1.0f @@ -65,25 +65,25 @@ void BgPushbox_UpdateImpl(BgPushbox* this, GlobalContext* globalCtx) { Math_StepToF(&this->dyna.actor.speedXZ, 0.0f, 0.2f); this->dyna.actor.world.rot.y = this->dyna.unk_158; Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 40.0f, 40.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 40.0f, 40.0f, 0x1D); } -void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Update(Actor* thisx, PlayState* play) { BgPushbox* this = (BgPushbox*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002DF90(&this->dyna); } -void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gBlockSmallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h b/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h index 31b8aac83..577ebaabb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h +++ b/soh/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h @@ -6,7 +6,7 @@ struct BgPushbox; -typedef void (*BgPushboxActionFunc)(struct BgPushbox*, GlobalContext*); +typedef void (*BgPushboxActionFunc)(struct BgPushbox*, PlayState*); typedef struct BgPushbox { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 58d0f62d8..0d3fbf229 100644 --- a/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -14,18 +14,18 @@ typedef enum { /* 1 */ WINDMILL_DAMPE_STONE_DOOR } WindmillSetpiecesMode; -void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgRelayObjects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgRelayObjects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgRelayObjects_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgRelayObjects_Init(Actor* thisx, PlayState* play); +void BgRelayObjects_Destroy(Actor* thisx, PlayState* play); +void BgRelayObjects_Update(Actor* thisx, PlayState* play); +void BgRelayObjects_Draw(Actor* thisx, PlayState* play); void BgRelayObjects_Reset(void); -void func_808A90F4(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A91AC(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A9234(BgRelayObjects* this, GlobalContext* globalCtx); -void BgRelayObjects_DoNothing(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A932C(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A939C(BgRelayObjects* this, GlobalContext* globalCtx); +void func_808A90F4(BgRelayObjects* this, PlayState* play); +void func_808A91AC(BgRelayObjects* this, PlayState* play); +void func_808A9234(BgRelayObjects* this, PlayState* play); +void BgRelayObjects_DoNothing(BgRelayObjects* this, PlayState* play); +void func_808A932C(BgRelayObjects* this, PlayState* play); +void func_808A939C(BgRelayObjects* this, PlayState* play); const ActorInit Bg_Relay_Objects_InitVars = { ACTOR_BG_RELAY_OBJECTS, @@ -46,7 +46,7 @@ static InitChainEntry sInitChain[] = { }; u32 D_808A9508 = 0; -void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Init(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -89,7 +89,7 @@ void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgRelayObjects_DoNothing; } } else if (this->unk_169 != 5) { - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); if (D_808A9508 & (1 << this->unk_169)) { Actor_Kill(thisx); } else { @@ -97,26 +97,26 @@ void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808A90F4; } } else { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); this->actionFunc = func_808A91AC; thisx->world.pos.y += 120.0f; D_808A9508 |= 1; } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void BgRelayObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Destroy(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && (gSaveContext.cutsceneIndex < 0xFFF0)) { gSaveContext.eventChkInf[6] &= ~0x20; } } -void func_808A90F4(BgRelayObjects* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_808A90F4(BgRelayObjects* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { if (this->timer != 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); if (INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE) { @@ -131,57 +131,57 @@ void func_808A90F4(BgRelayObjects* this, GlobalContext* globalCtx) { } } -void func_808A91AC(BgRelayObjects* this, GlobalContext* globalCtx) { +void func_808A91AC(BgRelayObjects* this, PlayState* play) { if (this->unk_169 != 5) { if (this->timer != 0) { this->timer--; } func_8002F994(&this->dyna.actor, this->timer); } - if ((this->timer == 0) || (this->unk_169 == globalCtx->roomCtx.curRoom.num)) { + if ((this->timer == 0) || (this->unk_169 == play->roomCtx.curRoom.num)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); this->actionFunc = func_808A9234; } } -void func_808A9234(BgRelayObjects* this, GlobalContext* globalCtx) { +void func_808A9234(BgRelayObjects* this, PlayState* play) { this->dyna.actor.velocity.y += this->dyna.actor.gravity; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - if (this->unk_169 != globalCtx->roomCtx.curRoom.num) { + if (this->unk_169 != play->roomCtx.curRoom.num) { func_800788CC(NA_SE_EN_PO_LAUGH); this->timer = 5; this->actionFunc = func_808A932C; return; } - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); this->dyna.actor.flags &= ~ACTOR_FLAG_4; - if (globalCtx->roomCtx.curRoom.num == 4) { + if (play->roomCtx.curRoom.num == 4) { gSaveContext.timer1State = 0xF; } this->actionFunc = BgRelayObjects_DoNothing; } } -void BgRelayObjects_DoNothing(BgRelayObjects* this, GlobalContext* globalCtx) { +void BgRelayObjects_DoNothing(BgRelayObjects* this, PlayState* play) { } -void func_808A932C(BgRelayObjects* this, GlobalContext* globalCtx) { +void func_808A932C(BgRelayObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { func_80078884(NA_SE_OC_ABYSS); - Gameplay_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); this->actionFunc = BgRelayObjects_DoNothing; } } } -void func_808A939C(BgRelayObjects* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 5)) { +void func_808A939C(BgRelayObjects* this, PlayState* play) { + if (Flags_GetEnv(play, 5)) { gSaveContext.eventChkInf[6] |= 0x20; } if (gSaveContext.eventChkInf[6] & 0x20) { @@ -194,19 +194,19 @@ void func_808A939C(BgRelayObjects* this, GlobalContext* globalCtx) { ((this->dyna.actor.world.rot.y - 0x80) * (1.0f / 0x380)) + 1.0f); } -void BgRelayObjects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Update(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgRelayObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Draw(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; if (this->dyna.actor.params == WINDMILL_ROTATING_GEAR) { - Gfx_DrawDListOpa(globalCtx, gWindmillRotatingPlatformDL); + Gfx_DrawDListOpa(play, gWindmillRotatingPlatformDL); } else { - Gfx_DrawDListOpa(globalCtx, gDampeRaceDoorDL); + Gfx_DrawDListOpa(play, gDampeRaceDoorDL); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h b/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h index fa39ad76c..802d84064 100644 --- a/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h +++ b/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h @@ -6,7 +6,7 @@ struct BgRelayObjects; -typedef void (*BgRelayObjectsActionFunc)(struct BgRelayObjects*, GlobalContext*); +typedef void (*BgRelayObjectsActionFunc)(struct BgRelayObjects*, PlayState*); typedef struct BgRelayObjects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c b/soh/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c index f0ea847d4..e0f12e64e 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Break_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Break_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot00Break_Init(Actor* thisx, PlayState* play); +void BgSpot00Break_Destroy(Actor* thisx, PlayState* play); +void BgSpot00Break_Update(Actor* thisx, PlayState* play); +void BgSpot00Break_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot00_Break_InitVars = { ACTOR_BG_SPOT00_BREAK, @@ -34,7 +34,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Init(Actor* thisx, PlayState* play) { BgSpot00Break* this = (BgSpot00Break*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -48,28 +48,28 @@ void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gBrokenDrawbridgeCol, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (!LINK_IS_ADULT) { Actor_Kill(&this->dyna.actor); } } -void BgSpot00Break_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Destroy(Actor* thisx, PlayState* play) { BgSpot00Break* this = (BgSpot00Break*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Update(Actor* thisx, PlayState* play) { } -void BgSpot00Break_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Draw(Actor* thisx, PlayState* play) { BgSpot00Break* this = (BgSpot00Break*)thisx; if (this->dyna.actor.params == 1) { - Gfx_DrawDListOpa(globalCtx, gBarbedWireFenceDL); + Gfx_DrawDListOpa(play, gBarbedWireFenceDL); } else { - Gfx_DrawDListOpa(globalCtx, gBrokenDrawbridgeDL); + Gfx_DrawDListOpa(play, gBrokenDrawbridgeDL); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 4479ede06..87bb4b283 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -17,14 +17,14 @@ typedef enum { /* 1 */ DT_CHAIN_2 } DrawbridgeType; -void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Hanebasi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play); +void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play); +void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play); +void BgSpot00Hanebasi_Draw(Actor* thisx, PlayState* play); -void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, GlobalContext* globalCtx); -void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContext* globalCtx); -void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, GlobalContext* globalCtx); +void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play); +void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play); +void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, PlayState* play); const ActorInit Bg_Spot00_Hanebasi_InitVars = { ACTOR_BG_SPOT00_HANEBASI, @@ -48,7 +48,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) { BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; s32 pad; Vec3f chainPos; @@ -63,7 +63,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gHyruleFieldCastleDrawbridgeChainsCol, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == DT_DRAWBRIDGE) { if (LINK_IS_ADULT && (gSaveContext.sceneSetupIndex < 4)) { @@ -96,7 +96,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { chainPos.z = (-158.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + (Math_CosS(this->dyna.actor.shape.rot.y) * chainPos.z); - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT00_HANEBASI, + if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT00_HANEBASI, this->dyna.actor.world.pos.x + chainPos.x, this->dyna.actor.world.pos.y + chainPos.y, this->dyna.actor.world.pos.z + chainPos.z, ((this->dyna.actor.shape.rot.x == 0) ? 0 : 0xF020), this->dyna.actor.shape.rot.y, 0, @@ -107,7 +107,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeWait; this->destAngle = 40; } else if (this->dyna.actor.params == DT_CHAIN_1) { - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT00_HANEBASI, + if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT00_HANEBASI, this->dyna.actor.world.pos.x - (Math_CosS(this->dyna.actor.shape.rot.y) * 316.0f), this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z + (Math_SinS(this->dyna.actor.shape.rot.y) * 316.0f), @@ -122,30 +122,30 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->dyna.actor.params >= DT_CHAIN_1) { - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, ((this->dyna.actor.params == DT_CHAIN_1) ? 260.0f : -260.0f), 168, 690, 255, 255, 0, 0); } } -void BgSpot00Hanebasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play) { BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (this->dyna.actor.params >= DT_CHAIN_1) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } } -void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child = (BgSpot00Hanebasi*)this->dyna.actor.child; if ((gSaveContext.sceneSetupIndex >= 4) || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY) || !CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) || (gSaveContext.eventChkInf[8] & 1)) { if (this->dyna.actor.shape.rot.x != 0) { - if (Flags_GetEnv(globalCtx, 0) || ((gSaveContext.sceneSetupIndex < 4) && IS_DAY)) { + if (Flags_GetEnv(play, 0) || ((gSaveContext.sceneSetupIndex < 4) && IS_DAY)) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; this->destAngle = 0; child->destAngle = 0; @@ -162,10 +162,10 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, GlobalContext* glob } } -void BgSpot00Hanebasi_DoNothing(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_DoNothing(BgSpot00Hanebasi* this, PlayState* play) { } -void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child; Actor* childsChild; s16 angle = 80; @@ -197,7 +197,7 @@ void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContex } } -void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, PlayState* play) { u8 lightColor = (u8)(Rand_ZeroOne() * 127.0f) + 128; // intensity of the red and green channels Lights_PointGlowSetInfo(&this->lightInfo, (this->dyna.actor.params == DT_CHAIN_1) ? 260.0f : -260.0f, @@ -205,31 +205,31 @@ void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, GlobalContext* g sTorchFlameScale * 37500.0f); } -void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == DT_DRAWBRIDGE) { - if (globalCtx->sceneNum == SCENE_SPOT00) { + if (play->sceneNum == SCENE_SPOT00) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !(gSaveContext.eventChkInf[8] & 1) && LINK_IS_CHILD) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((player->actor.world.pos.x > -450.0f) && (player->actor.world.pos.x < 450.0f) && (player->actor.world.pos.z > 1080.0f) && (player->actor.world.pos.z < 1700.0f) && - (!(Gameplay_InCsMode(globalCtx)))) { + (!(Play_InCsMode(play)))) { gSaveContext.eventChkInf[8] |= 1; Flags_SetEventChkInf(0x82); this->actionFunc = BgSpot00Hanebasi_DoNothing; - func_8002DF54(globalCtx, &player->actor, 8); - globalCtx->nextEntranceIndex = 0x00CD; + func_8002DF54(play, &player->actor, 8); + play->nextEntranceIndex = 0x00CD; gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 4; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 4; } else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 3000.0f, 0x7530)) { - globalCtx->envCtx.gloomySkyMode = 1; + play->envCtx.gloomySkyMode = 1; } } } @@ -257,14 +257,14 @@ void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgSpot00Hanebasi_DrawTorches(Actor* thisx, PlayState* play2) { + PlayState* play = play2; f32 angle; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (gSaveContext.sceneSetupIndex >= 4) { sTorchFlameScale = 0.008f; @@ -272,7 +272,7 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { sTorchFlameScale = ((thisx->shape.rot.x * -1) - 0x2000) * (1.0f / 1024000.0f); } - angle = (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 32768.0f); + angle = (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 32768.0f); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); @@ -280,32 +280,32 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { FrameInterpolation_RecordOpenChild("Hanebasi Torch", i); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - ((globalCtx->gameplayFrames + i) * -20) & 0x1FF, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + ((play->gameplayFrames + i) * -20) & 0x1FF, 32, 128)); Matrix_Translate((i == 0) ? 260.0f : -260.0f, 128.0f, 690.0f, MTXMODE_NEW); Matrix_RotateY(angle, MTXMODE_APPLY); Matrix_Scale(sTorchFlameScale, sTorchFlameScale, sTorchFlameScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Draw(Actor* thisx, PlayState* play) { Vec3f basePos = { 158.0f, 10.0f, 400.0f }; Vec3f newPos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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); if (thisx->params == DT_DRAWBRIDGE) { @@ -324,7 +324,7 @@ void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.sceneSetupIndex != 12) { if ((gSaveContext.sceneSetupIndex >= 4) || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) { - BgSpot00Hanebasi_DrawTorches(thisx, globalCtx); + BgSpot00Hanebasi_DrawTorches(thisx, play); } else { sTorchFlameScale = 0.0f; } @@ -333,5 +333,5 @@ void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gHyruleFieldCastleDrawbridgeChainsDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h index 71d41f9ad..fc6427ae8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h @@ -6,7 +6,7 @@ struct BgSpot00Hanebasi; -typedef void (*BgSpot00HanebasiActionFunc)(struct BgSpot00Hanebasi*, GlobalContext*); +typedef void (*BgSpot00HanebasiActionFunc)(struct BgSpot00Hanebasi*, PlayState*); typedef struct BgSpot00Hanebasi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index 7bc73baa1..0b4f6f972 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Fusya_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Fusya_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Fusya_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Fusya_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Fusya_Init(Actor* thisx, PlayState* play); +void BgSpot01Fusya_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Fusya_Update(Actor* thisx, PlayState* play); +void BgSpot01Fusya_Draw(Actor* thisx, PlayState* play); -void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx); +void func_808AAA50(BgSpot01Fusya* this, PlayState* play); const ActorInit Bg_Spot01_Fusya_InitVars = { ACTOR_BG_SPOT01_FUSYA, @@ -40,7 +40,7 @@ void BgSpot01Fusya_SetupAction(BgSpot01Fusya* this, BgSpot01FusyaActionFunc acti this->actionFunc = actionFunc; } -void BgSpot01Fusya_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Fusya_Init(Actor* thisx, PlayState* play) { BgSpot01Fusya* this = (BgSpot01Fusya*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -53,10 +53,10 @@ void BgSpot01Fusya_Init(Actor* thisx, GlobalContext* globalCtx) { BgSpot01Fusya_SetupAction(this, func_808AAA50); } -void BgSpot01Fusya_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Fusya_Destroy(Actor* thisx, PlayState* play) { } -void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) { +void func_808AAA50(BgSpot01Fusya* this, PlayState* play) { f32 temp; Actor* thisx = &this->actor; @@ -69,20 +69,20 @@ void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_154, this->unk_158, this->unk_15C, 100.0f); } -void BgSpot01Fusya_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Fusya_Update(Actor* thisx, PlayState* play) { BgSpot01Fusya* this = (BgSpot01Fusya*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot01Fusya_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgSpot01Fusya_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, gKakarikoWindmillSailsDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h b/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h index ba0ece272..1e7a83131 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h @@ -6,7 +6,7 @@ struct BgSpot01Fusya; -typedef void (*BgSpot01FusyaActionFunc)(struct BgSpot01Fusya*, GlobalContext*); +typedef void (*BgSpot01FusyaActionFunc)(struct BgSpot01Fusya*, PlayState*); typedef struct BgSpot01Fusya { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index d5e6a3f03..54217f757 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -10,16 +10,16 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idohashira_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idohashira_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idohashira_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play); +void BgSpot01Idohashira_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Idohashira_Update(Actor* thisx, PlayState* play); +void BgSpot01Idohashira_Draw(Actor* thisx, PlayState* play); -void func_808AB504(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB510(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB530(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB570(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB700(BgSpot01Idohashira* this, GlobalContext* globalCtx); +void func_808AB504(BgSpot01Idohashira* this, PlayState* play); +void func_808AB510(BgSpot01Idohashira* this, PlayState* play); +void func_808AB530(BgSpot01Idohashira* this, PlayState* play); +void func_808AB570(BgSpot01Idohashira* this, PlayState* play); +void func_808AB700(BgSpot01Idohashira* this, PlayState* play); static BgSpot01IdohashiraActionFunc sActionFuncs[] = { func_808AB504, @@ -53,11 +53,11 @@ void BgSpot01Idohashira_PlayBreakSfx1(BgSpot01Idohashira* this) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_BOX_BREAK); } -void BgSpot01Idohashira_PlayBreakSfx2(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 60, NA_SE_EV_WOODBOX_BREAK); +void BgSpot01Idohashira_PlayBreakSfx2(BgSpot01Idohashira* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WOODBOX_BREAK); } -void func_808AAD3C(GlobalContext* globalCtx, Vec3f* vec, u32 arg2) { +void func_808AAD3C(PlayState* play, Vec3f* vec, u32 arg2) { EffectSparkInit effect; s32 sp24; @@ -103,20 +103,20 @@ void func_808AAD3C(GlobalContext* globalCtx, Vec3f* vec, u32 arg2) { effect.timer = 0; effect.duration = 32; - Effect_Add(globalCtx, &sp24, EFFECT_SPARK, 0, 1, &effect); + Effect_Add(play, &sp24, EFFECT_SPARK, 0, 1, &effect); } -void func_808AAE6C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AAE6C(BgSpot01Idohashira* this, PlayState* play) { s32 pad; Vec3f sp30 = this->dyna.actor.world.pos; sp30.y += kREG(15); - func_80033480(globalCtx, &sp30, kREG(11) + 350.0f, kREG(12) + 5, kREG(13) + 0x7D0, kREG(14) + 0x320, 0); - func_808AAD3C(globalCtx, &sp30, 5); - BgSpot01Idohashira_PlayBreakSfx2(this, globalCtx); + func_80033480(play, &sp30, kREG(11) + 350.0f, kREG(12) + 5, kREG(13) + 0x7D0, kREG(14) + 0x320, 0); + func_808AAD3C(play, &sp30, 5); + BgSpot01Idohashira_PlayBreakSfx2(this, play); } -void func_808AAF34(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AAF34(BgSpot01Idohashira* this, PlayState* play) { s32 pad[2]; Vec3f dest; Vec3f src; @@ -126,38 +126,38 @@ void func_808AAF34(BgSpot01Idohashira* this, GlobalContext* globalCtx) { src.y = kREG(21) + 200.0f; src.z = 0.0f; Matrix_MultVec3f(&src, &dest); - func_80033480(globalCtx, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); - func_808AAD3C(globalCtx, &dest, 3); + func_80033480(play, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); + func_808AAD3C(play, &dest, 3); src.x = -(kREG(20) + 1300.0f); src.y = kREG(21) + 200.0f; src.z = 0.0f; Matrix_MultVec3f(&src, &dest); - func_80033480(globalCtx, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); - func_808AAD3C(globalCtx, &dest, 3); + func_80033480(play, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); + func_808AAD3C(play, &dest, 3); this->unk_170 = 0; BgSpot01Idohashira_PlayBreakSfx1(this); } } -void BgSpot01Idohashira_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Destroy(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -s32 BgSpot01Idohashira_NotInCsMode(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +s32 BgSpot01Idohashira_NotInCsMode(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } return false; } -CsCmdActorAction* BgSpot01Idohashira_GetNpcAction(GlobalContext* globalCtx, s32 actionIdx) { +CsCmdActorAction* BgSpot01Idohashira_GetNpcAction(PlayState* play, s32 actionIdx) { s32 pad[2]; CsCmdActorAction* npcAction = NULL; - if (!BgSpot01Idohashira_NotInCsMode(globalCtx)) { - npcAction = globalCtx->csCtx.npcActions[actionIdx]; + if (!BgSpot01Idohashira_NotInCsMode(play)) { + npcAction = play->csCtx.npcActions[actionIdx]; } return npcAction; } @@ -185,7 +185,7 @@ f32 func_808AB1DC(f32 arg0, f32 arg1, u16 arg2, u16 arg3, u16 arg4) { return 0.0f; } -s32 func_808AB29C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +s32 func_808AB29C(BgSpot01Idohashira* this, PlayState* play) { CsCmdActorAction* npcAction; Vec3f* thisPos; f32 endX; @@ -196,9 +196,9 @@ s32 func_808AB29C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { f32 tempY; f32 tempZ; - npcAction = BgSpot01Idohashira_GetNpcAction(globalCtx, 2); + npcAction = BgSpot01Idohashira_GetNpcAction(play, 2); if (npcAction != NULL) { - temp_f0 = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames); + temp_f0 = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames); initPos = this->dyna.actor.home.pos; endX = npcAction->endPos.x; tempY = ((kREG(10) + 1100.0f) / 10.0f) + npcAction->endPos.y; @@ -206,7 +206,7 @@ s32 func_808AB29C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { thisPos = &this->dyna.actor.world.pos; thisPos->x = ((endX - initPos.x) * temp_f0) + initPos.x; thisPos->y = - func_808AB1DC(initPos.y, tempY, npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames) + + func_808AB1DC(initPos.y, tempY, npcAction->endFrame, npcAction->startFrame, play->csCtx.frames) + initPos.y; thisPos->z = ((endZ - initPos.z) * temp_f0) + initPos.z; @@ -224,20 +224,20 @@ void func_808AB3E8(BgSpot01Idohashira* this) { this->drawConfig = 0; } -void func_808AB3F8(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AB3F8(BgSpot01Idohashira* this, PlayState* play) { this->action = 2; this->drawConfig = 0; this->unk_170 = 1; } -void func_808AB414(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - func_808AAE6C(this, globalCtx); +void func_808AB414(BgSpot01Idohashira* this, PlayState* play) { + func_808AAE6C(this, play); this->action = 3; this->drawConfig = 0; } -void func_808AB444(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = BgSpot01Idohashira_GetNpcAction(globalCtx, 2); +void func_808AB444(BgSpot01Idohashira* this, PlayState* play) { + CsCmdActorAction* npcAction = BgSpot01Idohashira_GetNpcAction(play, 2); u32 action; u32 currentNpcAction; @@ -250,7 +250,7 @@ void func_808AB444(BgSpot01Idohashira* this, GlobalContext* globalCtx) { func_808AB3E8(this); break; case 2: - func_808AB3F8(this, globalCtx); + func_808AB3F8(this, play); break; case 3: Actor_Kill(&this->dyna.actor); @@ -263,35 +263,35 @@ void func_808AB444(BgSpot01Idohashira* this, GlobalContext* globalCtx) { } } -void func_808AB504(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AB504(BgSpot01Idohashira* this, PlayState* play) { } -void func_808AB510(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - func_808AB444(this, globalCtx); +void func_808AB510(BgSpot01Idohashira* this, PlayState* play) { + func_808AB444(this, play); } -void func_808AB530(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AB530(BgSpot01Idohashira* this, PlayState* play) { func_808AB18C(this); - if (func_808AB29C(this, globalCtx)) { - func_808AB414(this, globalCtx); + if (func_808AB29C(this, play)) { + func_808AB414(this, play); } } -void func_808AB570(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - func_808AB444(this, globalCtx); +void func_808AB570(BgSpot01Idohashira* this, PlayState* play) { + func_808AB444(this, play); } -void BgSpot01Idohashira_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Update(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; if (this->action < 0 || this->action >= 4 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play) { s32 pad[2]; BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; CollisionHeader* colHeader; @@ -300,7 +300,7 @@ void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); colHeader = NULL; CollisionHeader_GetVirtual(&gKakarikoWellArchCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (gSaveContext.sceneSetupIndex < 4) { if ((gSaveContext.eventChkInf[5] & 0x10) && LINK_IS_ADULT) { @@ -318,8 +318,8 @@ void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_808AB700(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; +void func_808AB700(BgSpot01Idohashira* this, PlayState* play) { + GraphicsContext* localGfxCtx = play->state.gfxCtx; OPEN_DISPS(localGfxCtx); @@ -327,18 +327,18 @@ void func_808AB700(BgSpot01Idohashira* this, GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(localGfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_808AAF34(this, globalCtx); + func_808AAF34(this, play); gSPDisplayList(POLY_OPA_DISP++, gKakarikoWellArchDL); CLOSE_DISPS(localGfxCtx); } -void BgSpot01Idohashira_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Draw(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; if (this->drawConfig < 0 || this->drawConfig > 0 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h b/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h index f3779352f..216008321 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h @@ -6,8 +6,8 @@ struct BgSpot01Idohashira; -typedef void (*BgSpot01IdohashiraActionFunc)(struct BgSpot01Idohashira*, GlobalContext*); -typedef void (*BgSpot01IdohashiraDrawFunc)(struct BgSpot01Idohashira*, GlobalContext*); +typedef void (*BgSpot01IdohashiraActionFunc)(struct BgSpot01Idohashira*, PlayState*); +typedef void (*BgSpot01IdohashiraDrawFunc)(struct BgSpot01Idohashira*, PlayState*); typedef struct BgSpot01Idohashira { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c index 72a874d89..62900a648 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_5 -void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idomizu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Idomizu_Init(Actor* thisx, PlayState* play); +void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Idomizu_Update(Actor* thisx, PlayState* play); +void BgSpot01Idomizu_Draw(Actor* thisx, PlayState* play); -void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx); +void func_808ABB84(BgSpot01Idomizu* this, PlayState* play); const ActorInit Bg_Spot01_Idomizu_InitVars = { ACTOR_BG_SPOT01_IDOMIZU, @@ -33,7 +33,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Init(Actor* thisx, PlayState* play) { BgSpot01Idomizu* this = (BgSpot01Idomizu*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -46,14 +46,14 @@ void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y = this->waterHeight; } -void BgSpot01Idomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play) { } -void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx) { +void func_808ABB84(BgSpot01Idomizu* this, PlayState* play) { if (gSaveContext.eventChkInf[6] & 0x80) { this->waterHeight = -550.0f; } - globalCtx->colCtx.colHeader->waterBoxes[0].ySurface = this->actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[0].ySurface = this->actor.world.pos.y; if (this->waterHeight < this->actor.world.pos.y) { Audio_PlaySoundGeneral(NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -61,28 +61,28 @@ void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.y, this->waterHeight, 1.0f, 2.0f); } -void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Update(Actor* thisx, PlayState* play) { BgSpot01Idomizu* this = (BgSpot01Idomizu*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Draw(Actor* thisx, PlayState* play) { u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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); - frames = globalCtx->state.frames; + frames = play->state.frames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1, frames % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1, frames % 128, frames & 0x7F, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, gKakarikoWellWaterDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h b/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h index 35087146e..3c5929714 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h @@ -6,7 +6,7 @@ struct BgSpot01Idomizu; -typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, GlobalContext*); +typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, PlayState*); typedef struct BgSpot01Idomizu { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c index 92e4a6e13..c525f08df 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idosoko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idosoko_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idosoko_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Idosoko_Init(Actor* thisx, PlayState* play); +void BgSpot01Idosoko_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Idosoko_Update(Actor* thisx, PlayState* play); +void BgSpot01Idosoko_Draw(Actor* thisx, PlayState* play); -void func_808ABF54(BgSpot01Idosoko* this, GlobalContext* globalCtx); +void func_808ABF54(BgSpot01Idosoko* this, PlayState* play); const ActorInit Bg_Spot01_Idosoko_InitVars = { ACTOR_BG_SPOT01_IDOSOKO, @@ -37,7 +37,7 @@ void BgSpot01Idosoko_SetupAction(BgSpot01Idosoko* this, BgSpot01IdosokoActionFun this->actionFunc = actionFunc; } -void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idosoko_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot01Idosoko* this = (BgSpot01Idosoko*)thisx; CollisionHeader* colHeader = NULL; @@ -46,7 +46,7 @@ void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_PLAYER); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); CollisionHeader_GetVirtual(&gKakarikoBOTWStoneCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (!LINK_IS_ADULT) { Actor_Kill(&this->dyna.actor); } else { @@ -54,29 +54,29 @@ void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot01Idosoko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idosoko_Destroy(Actor* thisx, PlayState* play) { BgSpot01Idosoko* this = (BgSpot01Idosoko*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808ABF54(BgSpot01Idosoko* this, GlobalContext* globalCtx) { +void func_808ABF54(BgSpot01Idosoko* this, PlayState* play) { } -void BgSpot01Idosoko_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idosoko_Update(Actor* thisx, PlayState* play) { BgSpot01Idosoko* this = (BgSpot01Idosoko*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot01Idosoko_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgSpot01Idosoko_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, gKakarikoBOTWStoneDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h b/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h index 9356c2a97..c17b0a43e 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h @@ -6,7 +6,7 @@ struct BgSpot01Idosoko; -typedef void (*BgSpot01IdosokoActionFunc)(struct BgSpot01Idosoko*, GlobalContext*); +typedef void (*BgSpot01IdosokoActionFunc)(struct BgSpot01Idosoko*, PlayState*); typedef struct BgSpot01Idosoko { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index 724be0d4d..2edc0d255 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Objects2_Init(Actor* thisx, PlayState* play); +void BgSpot01Objects2_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Objects2_Update(Actor* thisx, PlayState* play); -void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx); -void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx); -void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx); +void func_808AC2BC(BgSpot01Objects2* this, PlayState* play); +void func_808AC474(BgSpot01Objects2* this, PlayState* play); +void func_808AC4A4(Actor* thisx, PlayState* play); const ActorInit Bg_Spot01_Objects2_InitVars = { ACTOR_BG_SPOT01_OBJECTS2, @@ -43,7 +43,7 @@ static Gfx* D_808AC510[] = { gKakarikoConstructionSiteDL, gKakarikoShootingGalleryDL, }; -void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) { BgSpot01Objects2* this = (BgSpot01Objects2*)thisx; switch (this->dyna.actor.params & 7) { @@ -60,7 +60,7 @@ void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->objectId >= 0) { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, this->objectId); + this->objBankIndex = Object_GetIndex(&play->objectCtx, this->objectId); if (this->objBankIndex < 0) { // "There was no bank setting." osSyncPrintf("-----------------------------バンク設定ありませんでした."); @@ -74,7 +74,7 @@ void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Objects2_Destroy(Actor* thisx, PlayState* play) { } s32 func_808AC22C(Path* pathList, Vec3f* pos, s32 path, s32 waypoint) { @@ -86,16 +86,16 @@ s32 func_808AC22C(Path* pathList, Vec3f* pos, s32 path, s32 waypoint) { return 0; } -void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) { +void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) { CollisionHeader* colHeader = NULL; Actor* thisx = &this->dyna.actor; s32 pad; Vec3f position; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { // "---- Successful bank switching!!" osSyncPrintf("-----バンク切り換え成功!!\n"); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex].segment); this->dyna.actor.objBankIndex = this->objBankIndex; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); @@ -103,14 +103,14 @@ void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) { switch (this->dyna.actor.params & 7) { case 4: // Shooting gallery CollisionHeader_GetVirtual(&gKakarikoShootingGalleryCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); break; case 3: // Shooting Gallery, spawns Carpenter Sabooro during the day CollisionHeader_GetVirtual(&object_spot01_matoyab_col, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (IS_DAY) { - func_808AC22C(globalCtx->setupPathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0); - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_DAIKU_KAKARIKO, position.x, + func_808AC22C(play->setupPathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_DAIKU_KAKARIKO, position.x, position.y, position.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z, ((((s32)thisx->params >> 8) & 0xFF) << 8) + 1); } @@ -126,15 +126,15 @@ void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) { } } -void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx) { +void func_808AC474(BgSpot01Objects2* this, PlayState* play) { } -void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Objects2_Update(Actor* thisx, PlayState* play) { BgSpot01Objects2* this = (BgSpot01Objects2*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_808AC510[thisx->params & 7]); +void func_808AC4A4(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_808AC510[thisx->params & 7]); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h b/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h index 0ee7d814e..1da5f4f3f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h @@ -6,7 +6,7 @@ struct BgSpot01Objects2; -typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, GlobalContext*); +typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, PlayState*); typedef struct BgSpot01Objects2 { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index 60fc796a6..ce874b031 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -9,20 +9,20 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot02Objects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot02Objects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot02Objects_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx); -void func_808AD450(Actor* thisx, GlobalContext* globalCtx); +void BgSpot02Objects_Init(Actor* thisx, PlayState* play); +void BgSpot02Objects_Destroy(Actor* thisx, PlayState* play); +void BgSpot02Objects_Update(Actor* thisx, PlayState* play); +void BgSpot02Objects_Draw(Actor* thisx, PlayState* play); +void func_808ACCB8(Actor* thisx, PlayState* play); +void func_808AD450(Actor* thisx, PlayState* play); -void func_808AC8FC(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808AC908(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACAFC(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACB58(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACC34(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808AD3D4(BgSpot02Objects* this, GlobalContext* globalCtx); +void func_808AC8FC(BgSpot02Objects* this, PlayState* play); +void func_808AC908(BgSpot02Objects* this, PlayState* play); +void func_808ACA08(BgSpot02Objects* this, PlayState* play); +void func_808ACAFC(BgSpot02Objects* this, PlayState* play); +void func_808ACB58(BgSpot02Objects* this, PlayState* play); +void func_808ACC34(BgSpot02Objects* this, PlayState* play); +void func_808AD3D4(BgSpot02Objects* this, PlayState* play); static void* D_808AD850[] = { object_spot02_objects_Tex_0096B0, object_spot02_objects_Tex_00A2B0, object_spot02_objects_Tex_00AEB0, @@ -48,7 +48,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot02Objects* this = (BgSpot02Objects*)thisx; CollisionHeader* colHeader = NULL; @@ -64,7 +64,7 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); if (thisx->params == 0) { - if (Flags_GetSwitch(globalCtx, this->unk_16B)) { + if (Flags_GetSwitch(play, this->unk_16B)) { this->actionFunc = func_808AC8FC; thisx->world.pos.y += 255.0f; } else { @@ -77,7 +77,7 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_spot02_objects_Col_0128D8, &colHeader); thisx->flags |= ACTOR_FLAG_22; } else { - if (globalCtx->sceneNum == SCENE_SPOT02) { + if (play->sceneNum == SCENE_SPOT02) { this->actionFunc = func_808AC908; } else { this->actionFunc = func_808AC8FC; @@ -86,9 +86,9 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_spot02_objects_Col_0133EC, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if (((gSaveContext.eventChkInf[1] & 0x2000) && (globalCtx->sceneNum == SCENE_SPOT02) && + if (((gSaveContext.eventChkInf[1] & 0x2000) && (play->sceneNum == SCENE_SPOT02) && (thisx->params == 2)) || (LINK_IS_ADULT && (thisx->params == 1))) { Actor_Kill(thisx); @@ -97,7 +97,7 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { case 3: this->unk_16A = 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ITEMACTION); this->actionFunc = func_808ACC34; thisx->draw = func_808ACCB8; @@ -109,23 +109,23 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: this->timer = -12; this->unk_170 = 0xFFFF; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ITEMACTION); this->actionFunc = func_808AD3D4; thisx->draw = func_808AD450; break; } } -void BgSpot02Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Destroy(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808AC8FC(BgSpot02Objects* this, GlobalContext* globalCtx) { +void func_808AC8FC(BgSpot02Objects* this, PlayState* play) { } -void func_808AC908(BgSpot02Objects* this, GlobalContext* globalCtx) { +void func_808AC908(BgSpot02Objects* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f pos; @@ -137,26 +137,26 @@ void func_808AC908(BgSpot02Objects* this, GlobalContext* globalCtx) { pos.x = (Math_SinS(this->dyna.actor.shape.rot.y) * 50.0f) + this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 30.0f; pos.z = (Math_CosS(this->dyna.actor.shape.rot.y) * 50.0f) + this->dyna.actor.world.pos.z; - EffectSsBomb2_SpawnLayered(globalCtx, &pos, &zeroVec, &zeroVec, 70, 30); + EffectSsBomb2_SpawnLayered(play, &pos, &zeroVec, &zeroVec, 70, 30); this->actionFunc = func_808ACA08; } - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[3] != NULL && globalCtx->csCtx.npcActions[3]->action == 2) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[3] != NULL && play->csCtx.npcActions[3]->action == 2) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_GRAVE_EXPLOSION); gSaveContext.eventChkInf[1] |= 0x2000; this->timer = 25; pos.x = (Math_SinS(this->dyna.actor.shape.rot.y) * 50.0f) + this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 30.0f; pos.z = (Math_CosS(this->dyna.actor.shape.rot.y) * 50.0f) + this->dyna.actor.world.pos.z; - EffectSsBomb2_SpawnLayered(globalCtx, &pos, &zeroVec, &zeroVec, 70, 30); + EffectSsBomb2_SpawnLayered(play, &pos, &zeroVec, &zeroVec, 70, 30); this->actionFunc = func_808ACA08; } } } -void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808ACA08(BgSpot02Objects* this, PlayState* play) { + Player* player = GET_PLAYER(play); // The visual effects play the same way whether in rando or not, we just don't want // to play the damage animation on link. @@ -166,7 +166,7 @@ void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { if (this->timer == 20) { this->dyna.actor.draw = NULL; - EffectSsHahen_SpawnBurst(globalCtx, &this->dyna.actor.world.pos, 30.0f, 0, 25, 5, 40, OBJECT_SPOT02_OBJECTS, + EffectSsHahen_SpawnBurst(play, &this->dyna.actor.world.pos, 30.0f, 0, 25, 5, 40, OBJECT_SPOT02_OBJECTS, 20, object_spot02_objects_DL_012D30); } else if (this->timer == 0) { Actor_Kill(&this->dyna.actor); @@ -174,7 +174,7 @@ void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { // This shouldn't execute in rando even without the check since we never // enter the cutscene context. - if (globalCtx->csCtx.frames == 402 && !(gSaveContext.n64ddFlag)) { + if (play->csCtx.frames == 402 && !(gSaveContext.n64ddFlag)) { if (!LINK_IS_ADULT) { func_8002F7DC(&player->actor, NA_SE_VO_LI_DEMO_DAMAGE_KID); } else { @@ -183,15 +183,15 @@ void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { } } -void func_808ACAFC(BgSpot02Objects* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->unk_16B)) { +void func_808ACAFC(BgSpot02Objects* this, PlayState* play) { + if (Flags_GetSwitch(play, this->unk_16B)) { Actor_SetFocus(&this->dyna.actor, 60.0f); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808ACB58; } } -void func_808ACB58(BgSpot02Objects* this, GlobalContext* globalCtx) { +void func_808ACB58(BgSpot02Objects* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 255.0f, 1.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); this->actionFunc = func_808AC8FC; @@ -200,23 +200,23 @@ void func_808ACB58(BgSpot02Objects* this, GlobalContext* globalCtx) { } } -void BgSpot02Objects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Update(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot02Objects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { object_spot02_objects_DL_012A50, object_spot02_objects_DL_0127C0, object_spot02_objects_DL_0130B0, }; - Gfx_DrawDListOpa(globalCtx, dLists[thisx->params]); + Gfx_DrawDListOpa(play, dLists[thisx->params]); } -void func_808ACC34(BgSpot02Objects* this, GlobalContext* globalCtx) { +void func_808ACC34(BgSpot02Objects* this, PlayState* play) { // This is the actionFunc that the game settles on when you load the Graveyard // When we're in rando and the flag for the gravestone being destroyed gets set, // set the actionFunc to the function where the gravestone explodes. @@ -224,8 +224,8 @@ void func_808ACC34(BgSpot02Objects* this, GlobalContext* globalCtx) { this->actionFunc = func_808AC908; } - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[0] != NULL && + play->csCtx.npcActions[0]->action == 2) { this->unk_16A++; if (this->unk_16A >= 12) { @@ -233,12 +233,12 @@ void func_808ACC34(BgSpot02Objects* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.frames == 245 || globalCtx->csCtx.frames == 351) { + if (play->csCtx.frames == 245 || play->csCtx.frames == 351) { func_800788CC(NA_SE_EV_LIGHTNING); } } -void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { +void func_808ACCB8(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; f32 rate; s32 pad; @@ -249,10 +249,10 @@ void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { u8 greenEnv; u8 blueEnv; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[0] != NULL && + play->csCtx.npcActions[0]->action == 2) { if (this->unk_16A < 5) { rate = (this->unk_16A / 5.0f); redPrim = greenPrim = bluePrim = 255; @@ -269,18 +269,18 @@ void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { blueEnv = 100.0f + (100.0f * rate); } - Matrix_Translate(globalCtx->csCtx.npcActions[0]->startPos.x, globalCtx->csCtx.npcActions[0]->startPos.y, - globalCtx->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); - Matrix_RotateX(globalCtx->csCtx.npcActions[0]->urot.x * (M_PI / (f32)0x8000), MTXMODE_APPLY); - Matrix_RotateY(globalCtx->csCtx.npcActions[0]->urot.y * (M_PI / (f32)0x8000), MTXMODE_APPLY); - Matrix_RotateZ(globalCtx->csCtx.npcActions[0]->urot.z * (M_PI / (f32)0x8000), MTXMODE_APPLY); + Matrix_Translate(play->csCtx.npcActions[0]->startPos.x, play->csCtx.npcActions[0]->startPos.y, + play->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); + Matrix_RotateX(play->csCtx.npcActions[0]->urot.x * (M_PI / (f32)0x8000), MTXMODE_APPLY); + Matrix_RotateY(play->csCtx.npcActions[0]->urot.y * (M_PI / (f32)0x8000), MTXMODE_APPLY); + Matrix_RotateZ(play->csCtx.npcActions[0]->urot.z * (M_PI / (f32)0x8000), MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, redPrim, greenPrim, bluePrim, 255); gDPSetEnvColor(POLY_XLU_DISP++, redEnv, greenEnv, blueEnv, 255); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_808AD850[this->unk_16A])); gDPPipeSync(POLY_XLU_DISP++); @@ -288,12 +288,12 @@ void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808AD3D4(BgSpot02Objects* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[2] != NULL && - globalCtx->csCtx.npcActions[2]->action == 2) { +void func_808AD3D4(BgSpot02Objects* this, PlayState* play) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[2] != NULL && + play->csCtx.npcActions[2]->action == 2) { if (this->timer == 2) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_EXPLOSION_ICE); } @@ -306,15 +306,15 @@ void func_808AD3D4(BgSpot02Objects* this, GlobalContext* globalCtx) { } } -void func_808AD450(Actor* thisx, GlobalContext* globalCtx) { +void func_808AD450(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; s32 pad; f32 lerp; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[2] != NULL) { - u16 temp_v1 = globalCtx->csCtx.npcActions[2]->urot.z * 0.00549325f; + if (play->csCtx.state != 0 && play->csCtx.npcActions[2] != NULL) { + u16 temp_v1 = play->csCtx.npcActions[2]->urot.z * 0.00549325f; if (this->unk_170 != temp_v1) { if (this->unk_170 == 0xFFFF) { @@ -326,25 +326,25 @@ void func_808AD450(Actor* thisx, GlobalContext* globalCtx) { } } - lerp = Environment_LerpWeight(globalCtx->csCtx.npcActions[2]->endFrame, - globalCtx->csCtx.npcActions[2]->startFrame, globalCtx->csCtx.frames); + lerp = Environment_LerpWeight(play->csCtx.npcActions[2]->endFrame, + play->csCtx.npcActions[2]->startFrame, play->csCtx.frames); // should be able to remove & 0xFFFF with some other change - if ((globalCtx->csCtx.npcActions[2]->action & 0xFFFF) == 2) { - Matrix_Translate(globalCtx->csCtx.npcActions[2]->startPos.x, globalCtx->csCtx.npcActions[2]->startPos.y, - globalCtx->csCtx.npcActions[2]->startPos.z, MTXMODE_NEW); - Matrix_RotateX(globalCtx->csCtx.npcActions[2]->urot.x * (M_PI / (f32)0x8000), MTXMODE_APPLY); - Matrix_RotateY(globalCtx->csCtx.npcActions[2]->urot.y * (M_PI / (f32)0x8000), MTXMODE_APPLY); + if ((play->csCtx.npcActions[2]->action & 0xFFFF) == 2) { + Matrix_Translate(play->csCtx.npcActions[2]->startPos.x, play->csCtx.npcActions[2]->startPos.y, + play->csCtx.npcActions[2]->startPos.z, MTXMODE_NEW); + Matrix_RotateX(play->csCtx.npcActions[2]->urot.x * (M_PI / (f32)0x8000), MTXMODE_APPLY); + Matrix_RotateY(play->csCtx.npcActions[2]->urot.y * (M_PI / (f32)0x8000), MTXMODE_APPLY); Matrix_Scale(0.9f, 0.9f, (((this->unk_170 - this->unk_172) * lerp) + this->unk_172) * 0.1f, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 128); gDPSetEnvColor(POLY_XLU_DISP++, 150, 120, 0, 128); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 2 * this->timer, -3 * this->timer, 32, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 2 * this->timer, -3 * this->timer, 32, 64, 1, 4 * this->timer, -6 * this->timer, 32, 64)); gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, object_spot02_objects_DL_0013F0); @@ -352,5 +352,5 @@ void func_808AD450(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h b/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h index 89bbf7d5e..873fe15a5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h @@ -6,7 +6,7 @@ struct BgSpot02Objects; -typedef void (*BgSpot02ObjectsActionFunc)(struct BgSpot02Objects*, GlobalContext*); +typedef void (*BgSpot02ObjectsActionFunc)(struct BgSpot02Objects*, PlayState*); typedef struct BgSpot02Objects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index 12234f00d..0263a8a3f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot03Taki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot03Taki_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot03Taki_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot03Taki_Init(Actor* thisx, PlayState* play); +void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play); +void BgSpot03Taki_Update(Actor* thisx, PlayState* play); +void BgSpot03Taki_Draw(Actor* thisx, PlayState* play); -void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx); +void func_808ADEF0(BgSpot03Taki* this, PlayState* play); const ActorInit Bg_Spot03_Taki_InitVars = { ACTOR_BG_SPOT03_TAKI, @@ -45,7 +45,7 @@ void BgSpot03Taki_ApplyOpeningAlpha(BgSpot03Taki* this, s32 bufferIndex) { } } -void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Init(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; s16 pad; CollisionHeader* colHeader = NULL; @@ -53,7 +53,7 @@ void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = (this->dyna.actor.params & 0x3F); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&object_spot03_object_Col_000C98, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->bufferIndex = 0; this->openingAlpha = 255.0f; @@ -62,18 +62,18 @@ void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808ADEF0; } -void BgSpot03Taki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { +void func_808ADEF0(BgSpot03Taki* this, PlayState* play) { if (this->state == WATERFALL_CLOSED) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->state = WATERFALL_OPENING_ANIMATED; this->timer = 40; - OnePointCutscene_Init(globalCtx, 4100, -99, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 4100, -99, NULL, MAIN_CAM); } } else if (this->state == WATERFALL_OPENING_IDLE) { this->timer--; @@ -84,7 +84,7 @@ void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { if (this->openingAlpha > 0) { this->openingAlpha -= 5; if (this->openingAlpha <= 0.0f) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->timer = 400; this->state = WATERFALL_OPENED; this->openingAlpha = 0; @@ -99,10 +99,10 @@ void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { if (this->openingAlpha < 255.0f) { this->openingAlpha += 5.0f; if (this->openingAlpha >= 255.0f) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->state = WATERFALL_CLOSED; this->openingAlpha = 255.0f; - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); } } } @@ -110,29 +110,29 @@ void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { BgSpot03Taki_ApplyOpeningAlpha(this, this->bufferIndex); } -void BgSpot03Taki_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Update(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot03Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Draw(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; s32 pad; u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; - 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); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment( POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames * 5, 64, 64, 1, 0, gameplayFrames * 5, 64, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames * 5, 64, 64, 1, 0, gameplayFrames * 5, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_000B20); @@ -145,12 +145,12 @@ void BgSpot03Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_000BC0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 3, 64, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 3, 64, 64, 1, -gameplayFrames, gameplayFrames * 3, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_001580); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); this->bufferIndex = this->bufferIndex == 0; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h b/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h index 405ad9696..3055fb7f8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h @@ -14,7 +14,7 @@ typedef enum { struct BgSpot03Taki; -typedef void (*BgSpot03TakiActionFunc)(struct BgSpot03Taki*, GlobalContext*); +typedef void (*BgSpot03TakiActionFunc)(struct BgSpot03Taki*, PlayState*); typedef struct BgSpot03Taki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c b/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c index ae7094368..5eeecb83d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot05Soko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot05Soko_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot05Soko_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx); -void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx); -void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx); +void BgSpot05Soko_Init(Actor* thisx, PlayState* play); +void BgSpot05Soko_Destroy(Actor* thisx, PlayState* play); +void BgSpot05Soko_Update(Actor* thisx, PlayState* play); +void BgSpot05Soko_Draw(Actor* thisx, PlayState* play); +void func_808AE5A8(BgSpot05Soko* this, PlayState* play); +void func_808AE5B4(BgSpot05Soko* this, PlayState* play); +void func_808AE630(BgSpot05Soko* this, PlayState* play); const ActorInit Bg_Spot05_Soko_InitVars = { ACTOR_BG_SPOT05_SOKO, @@ -39,7 +39,7 @@ static Gfx* sDLists[] = { object_spot05_objects_DL_001190, }; -void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot05Soko_Init(Actor* thisx, PlayState* play) { s32 pad1; BgSpot05Soko* this = (BgSpot05Soko*)thisx; CollisionHeader* colHeader = NULL; @@ -58,36 +58,36 @@ void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx) { } } else { CollisionHeader_GetVirtual(&object_spot05_objects_Col_0012C0, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { + if (Flags_GetSwitch(play, this->switchFlag) != 0) { Actor_Kill(thisx); } else { this->actionFunc = func_808AE5B4; thisx->flags |= ACTOR_FLAG_4; } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void BgSpot05Soko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot05Soko_Destroy(Actor* thisx, PlayState* play) { BgSpot05Soko* this = (BgSpot05Soko*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx) { +void func_808AE5A8(BgSpot05Soko* this, PlayState* play) { } -void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); +void func_808AE5B4(BgSpot05Soko* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); Actor_SetFocus(&this->dyna.actor, 50.0f); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808AE630; this->dyna.actor.speedXZ = 0.5f; } } -void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) { +void func_808AE630(BgSpot05Soko* this, PlayState* play) { this->dyna.actor.speedXZ *= 1.5f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 120.0f, this->dyna.actor.speedXZ) != 0) { @@ -95,12 +95,12 @@ void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) { } } -void BgSpot05Soko_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot05Soko_Update(Actor* thisx, PlayState* play) { BgSpot05Soko* this = (BgSpot05Soko*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot05Soko_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); +void BgSpot05Soko_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDLists[thisx->params]); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h b/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h index 1dc53b792..849e5b226 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h @@ -6,7 +6,7 @@ struct BgSpot05Soko; -typedef void (*BgSpot05SokoActionFunc)(struct BgSpot05Soko*, GlobalContext*); +typedef void (*BgSpot05SokoActionFunc)(struct BgSpot05Soko*, PlayState*); typedef struct BgSpot05Soko { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 713314002..2790c3f36 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -29,20 +29,20 @@ typedef enum { #define WATER_LEVEL_LOWERED (WATER_LEVEL_RAISED - 680) #define WATER_LEVEL_RIVER_LOWERED (WATER_LEVEL_RIVER_RAISED - 80) -void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_Draw(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_GateOpen(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_DoNothing(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockFloat(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, GlobalContext* globalCtx); +void BgSpot06Objects_Init(Actor* thisx, PlayState* play); +void BgSpot06Objects_Destroy(Actor* thisx, PlayState* play); +void BgSpot06Objects_Update(Actor* thisx, PlayState* play); +void BgSpot06Objects_Draw(Actor* thisx, PlayState* play); +void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_GateOpen(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_DoNothing(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockWait(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockFloat(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, PlayState* play); const ActorInit Bg_Spot06_Objects_InitVars = { ACTOR_BG_SPOT06_OBJECTS, @@ -92,7 +92,7 @@ static InitChainEntry sInitChainWaterPlane[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Init(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -107,9 +107,9 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gLakeHyliaWaterTempleGateCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if (LINK_IS_ADULT && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (LINK_IS_ADULT && Flags_GetSwitch(play, this->switchFlag)) { thisx->world.pos.y = thisx->home.pos.y + 120.0f; this->actionFunc = BgSpot06Objects_DoNothing; @@ -120,10 +120,10 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: Actor_ProcessInitChain(thisx, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->colliderItem); - if (LINK_IS_ADULT && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (LINK_IS_ADULT && Flags_GetSwitch(play, this->switchFlag)) { if (!(gSaveContext.eventChkInf[6] & 0x200)) { thisx->home.pos.y = thisx->world.pos.y = WATER_LEVEL_LOWERED; } else { @@ -155,11 +155,11 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { (gSaveContext.n64ddFlag && !Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_WATER_TEMPLE)))) { if (gSaveContext.sceneSetupIndex < 4) { this->lakeHyliaWaterLevel = -681.0f; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = + play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin -= 50; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = WATER_LEVEL_LOWERED; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = WATER_LEVEL_LOWERED; + play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin -= 50; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = WATER_LEVEL_LOWERED; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = WATER_LEVEL_LOWERED; this->actionFunc = BgSpot06Objects_DoNothing; } else { thisx->world.pos.y = this->lakeHyliaWaterLevel = -681.0f; @@ -168,7 +168,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { } } else { this->lakeHyliaWaterLevel = 0.0f; - WaterBox* water_boxes = globalCtx->colCtx.colHeader->waterBoxes; + WaterBox* water_boxes = play->colCtx.colHeader->waterBoxes; water_boxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_RAISED; water_boxes[LHWB_MAIN_1].ySurface = WATER_LEVEL_RAISED; water_boxes[LHWB_MAIN_2].ySurface = WATER_LEVEL_RAISED; @@ -179,7 +179,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gLakeHyliaZoraShortcutIceblockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->actionFunc = BgSpot06Objects_DoNothing; if (!LINK_IS_ADULT) { @@ -189,16 +189,16 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Destroy(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; switch (this->dyna.actor.params) { case LHO_WATER_TEMPLE_ENTRACE_GATE: case LHO_ICE_BLOCK: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); break; case LHO_WATER_PLANE: break; @@ -208,32 +208,32 @@ void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) { /** * Water Temple entrance gate effect functions */ -void BgSpot06Objects_GateSpawnBubbles(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_GateSpawnBubbles(BgSpot06Objects* this, PlayState* play) { Vec3f sp34; f32 tmp; - if ((globalCtx->gameplayFrames % 3) == 0) { + if ((play->gameplayFrames % 3) == 0) { tmp = Rand_CenteredFloat(160.0f); sp34.x = (Math_SinS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.x; sp34.y = this->dyna.actor.world.pos.y; sp34.z = (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.z; - EffectSsBubble_Spawn(globalCtx, &sp34, 50.0f, 70.0f, 10.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); + EffectSsBubble_Spawn(play, &sp34, 50.0f, 70.0f, 10.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); } } /** * This is where the gate waits for the switch to be set by the fish shaped lock. */ -void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, PlayState* play) { s32 i; - if ((CVar_GetS32("gWaterTempleGateFix", 0) == 0 || LINK_IS_ADULT) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((CVar_GetS32("gWaterTempleGateFix", 0) == 0 || LINK_IS_ADULT) && Flags_GetSwitch(play, this->switchFlag)) { this->timer = 100; this->dyna.actor.world.pos.y += 3.0f; this->actionFunc = BgSpot06Objects_GateWaitToOpen; for (i = 0; i < 15; i++) { - BgSpot06Objects_GateSpawnBubbles(this, globalCtx); + BgSpot06Objects_GateSpawnBubbles(this, play); } } } @@ -241,7 +241,7 @@ void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, GlobalContext* glo /** * This is where the gate waits a few frames before rising after the switch is set. */ -void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -254,8 +254,8 @@ void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, GlobalContext* global /** * This is where the gate finally rises upward. */ -void BgSpot06Objects_GateOpen(BgSpot06Objects* this, GlobalContext* globalCtx) { - BgSpot06Objects_GateSpawnBubbles(this, globalCtx); +void BgSpot06Objects_GateOpen(BgSpot06Objects* this, PlayState* play) { + BgSpot06Objects_GateSpawnBubbles(this, play); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 120.0f, 0.6f)) { this->actionFunc = BgSpot06Objects_DoNothing; @@ -266,21 +266,21 @@ void BgSpot06Objects_GateOpen(BgSpot06Objects* this, GlobalContext* globalCtx) { } } -void BgSpot06Objects_DoNothing(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_DoNothing(BgSpot06Objects* this, PlayState* play) { } /** * Fish shaped lock effect functions */ -void BgSpot06Objects_LockSpawnWaterRipples(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) { - if (flag || !(globalCtx->gameplayFrames % 7)) { - EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.home.pos, 300, 700, 0); +void BgSpot06Objects_LockSpawnWaterRipples(BgSpot06Objects* this, PlayState* play, s32 flag) { + if (flag || !(play->gameplayFrames % 7)) { + EffectSsGRipple_Spawn(play, &this->dyna.actor.home.pos, 300, 700, 0); } } -void BgSpot06Objects_LockSpawnBubbles(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) { - if (!(globalCtx->gameplayFrames % 7) || flag) { - EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world.pos, 0.0f, 40.0f, 30.0f, +void BgSpot06Objects_LockSpawnBubbles(BgSpot06Objects* this, PlayState* play, s32 flag) { + if (!(play->gameplayFrames % 7) || flag) { + EffectSsBubble_Spawn(play, &this->dyna.actor.world.pos, 0.0f, 40.0f, 30.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); } } @@ -288,7 +288,7 @@ void BgSpot06Objects_LockSpawnBubbles(BgSpot06Objects* this, GlobalContext* glob /** * This is where the fish shaped lock waits to be pulled out by the hookshot. Once it does it will spawn bubbles. */ -void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_LockWait(BgSpot06Objects* this, PlayState* play) { s32 pad; s32 i; s32 pad2; @@ -305,7 +305,7 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z += (3.0f * cos); for (i = 0; i < 20; i++) { - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 1); + BgSpot06Objects_LockSpawnBubbles(this, play, 1); } effectPos.x = this->dyna.actor.world.pos.x + (5.0f * sin); @@ -313,31 +313,31 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) { effectPos.z = this->dyna.actor.world.pos.z + (5.0f * cos); for (i = 0; i < 3; i++) { - EffectSsBubble_Spawn(globalCtx, &effectPos, 0.0f, 20.0f, 20.0f, (Rand_ZeroOne() * 0.1f) + 0.7f); + EffectSsBubble_Spawn(play, &effectPos, 0.0f, 20.0f, 20.0f, (Rand_ZeroOne() * 0.1f) + 0.7f); } - EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.world.pos, NULL, NULL, 1, 700); + EffectSsGSplash_Spawn(play, &this->dyna.actor.world.pos, NULL, NULL, 1, 700); this->collider.elements->dim.worldSphere.radius = 45; this->actionFunc = BgSpot06Objects_LockPullOutward; Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Flags_SetSwitch(globalCtx, this->switchFlag); - OnePointCutscene_Init(globalCtx, 4120, 170, &this->dyna.actor, MAIN_CAM); + Flags_SetSwitch(play, this->switchFlag); + OnePointCutscene_Init(play, 4120, 170, &this->dyna.actor, MAIN_CAM); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } /** * Once the fish shaped lock is pulled out from the Hookshot it will move outward. */ -void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } this->dyna.actor.world.pos.x += (0.3f * Math_SinS(this->dyna.actor.world.rot.y)); this->dyna.actor.world.pos.z += (0.3f * Math_CosS(this->dyna.actor.world.rot.y)); - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 0); + BgSpot06Objects_LockSpawnBubbles(this, play, 0); if (this->timer == 0) { this->dyna.actor.velocity.y = 0.5f; @@ -351,7 +351,7 @@ void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, GlobalContext* globa * After being pulled all the way out the fish shaped lock will rise to the surface, creating bubbles in the water as it * does so. */ -void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, PlayState* play) { f32 cos; f32 pad; @@ -362,7 +362,7 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo this->dyna.actor.world.pos.x += (cos * Math_SinS(this->dyna.actor.shape.rot.y)); this->dyna.actor.world.pos.z += (cos * Math_CosS(this->dyna.actor.shape.rot.y)); this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y - 1.3f; - BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 0); + BgSpot06Objects_LockSpawnWaterRipples(this, play, 0); if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, 0, 0x260) != 0) { this->dyna.actor.home.pos.x = @@ -378,17 +378,17 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo } else { if (this->dyna.actor.world.pos.y >= -1973.0f) { this->dyna.actor.velocity.y = 0.0f; - BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 1); - EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.home.pos, NULL, NULL, 1, 700); + BgSpot06Objects_LockSpawnWaterRipples(this, play, 1); + EffectSsGSplash_Spawn(play, &this->dyna.actor.home.pos, NULL, NULL, 1, 700); } else if (this->dyna.actor.shape.rot.x == -0x4000) { this->dyna.actor.velocity.y += 0.02f; this->dyna.actor.world.pos.x = Rand_CenteredFloat(1.0f) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = Rand_CenteredFloat(1.0f) + this->dyna.actor.home.pos.z; this->dyna.actor.velocity.y = (this->dyna.actor.velocity.y > 10.0f) ? (10.0f) : (this->dyna.actor.velocity.y); - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 0); + BgSpot06Objects_LockSpawnBubbles(this, play, 0); } else { - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 0); + BgSpot06Objects_LockSpawnBubbles(this, play, 0); if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, -0x4000, 0x30)) { this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x; @@ -403,8 +403,8 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo * Once the fish shaped lock finishes rising to the surface it will float and create ripples in the water every few * frames. */ -void BgSpot06Objects_LockFloat(BgSpot06Objects* this, GlobalContext* globalCtx) { - BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 0); +void BgSpot06Objects_LockFloat(BgSpot06Objects* this, PlayState* play) { + BgSpot06Objects_LockSpawnWaterRipples(this, play, 0); if (this->timer != 0) { this->timer--; @@ -417,37 +417,37 @@ void BgSpot06Objects_LockFloat(BgSpot06Objects* this, GlobalContext* globalCtx) } } -void BgSpot06Objects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Update(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (thisx->params == LHO_WATER_TEMPLE_ENTRANCE_LOCK) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } /** * Draw the Lake Hylia water plane, and scroll its texture */ -void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, PlayState* play) { s32 pad; s32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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); - gameplayFrames = globalCtx->state.frames; + gameplayFrames = play->state.frames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -gameplayFrames, gameplayFrames, 32, 32, 1, gameplayFrames, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -gameplayFrames, gameplayFrames, 32, 32, 1, gameplayFrames, gameplayFrames, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -gameplayFrames, gameplayFrames * 6, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -gameplayFrames, gameplayFrames * 6, 32, 32, 1, gameplayFrames, gameplayFrames * 6, 32, 32)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); @@ -458,28 +458,28 @@ void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, GlobalContext* gl gSPDisplayList(POLY_XLU_DISP++, gLakeHyliaHighWaterDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgSpot06Objects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Draw(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; switch (this->dyna.actor.params) { case LHO_WATER_TEMPLE_ENTRACE_GATE: - Gfx_DrawDListOpa(globalCtx, gLakeHyliaWaterTempleGateDL); + Gfx_DrawDListOpa(play, gLakeHyliaWaterTempleGateDL); break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: - Gfx_DrawDListOpa(globalCtx, gLakeHyliaWaterTempleKeyDL); + Gfx_DrawDListOpa(play, gLakeHyliaWaterTempleKeyDL); if (this->actionFunc == BgSpot06Objects_LockSwimToSurface) { Collider_UpdateSpheres(1, &this->collider); } break; case LHO_WATER_PLANE: - BgSpot06Objects_DrawLakeHyliaWater(this, globalCtx); + BgSpot06Objects_DrawLakeHyliaWater(this, play); break; case LHO_ICE_BLOCK: - Gfx_DrawDListOpa(globalCtx, gLakeHyliaZoraShortcutIceblockDL); + Gfx_DrawDListOpa(play, gLakeHyliaZoraShortcutIceblockDL); break; } } @@ -488,7 +488,7 @@ void BgSpot06Objects_Draw(Actor* thisx, GlobalContext* globalCtx) { * This is where the Lake Hylia water plane waits for the cutscene to set the water risen flag after the Water Temple is * cleared. */ -void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, PlayState* play) { if (gSaveContext.eventChkInf[6] & 0x200) { this->actionFunc = BgSpot06Objects_WaterPlaneCutsceneRise; } @@ -497,7 +497,7 @@ void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, GlobalContext /** * This is where the Lake Hylia water plane rises in the cutscene after the Water Temple is cleared. */ -void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, PlayState* play) { s32 pad; this->dyna.actor.world.pos.y = this->lakeHyliaWaterLevel + WATER_LEVEL_RAISED; @@ -507,9 +507,9 @@ void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, GlobalContext this->actionFunc = BgSpot06Objects_DoNothing; } else { Math_SmoothStepToF(&this->lakeHyliaWaterLevel, 1.0f, 0.1f, 1.0f, 0.001f); - globalCtx->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = this->dyna.actor.world.pos.y; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = this->dyna.actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = this->dyna.actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = this->dyna.actor.world.pos.y; } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); diff --git a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h index 2deb727b0..08fdf1e9a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h @@ -6,7 +6,7 @@ struct BgSpot06Objects; -typedef void (*BgSpot06ObjectsActionFunc)(struct BgSpot06Objects*, GlobalContext*); +typedef void (*BgSpot06ObjectsActionFunc)(struct BgSpot06Objects*, PlayState*); typedef struct BgSpot06Objects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c b/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c index 4e6d3f9ff..8f60e0dbc 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot07Taki_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot07Taki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot07Taki_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot07Taki_Init(Actor* thisx, PlayState* play); +void BgSpot07Taki_Destroy(Actor* thisx, PlayState* play); +void BgSpot07Taki_Update(Actor* thisx, PlayState* play); +void BgSpot07Taki_Draw(Actor* thisx, PlayState* play); -void BgSpot07Taki_DoNothing(BgSpot07Taki* this, GlobalContext* globalCtx); +void BgSpot07Taki_DoNothing(BgSpot07Taki* this, PlayState* play); const ActorInit Bg_Spot07_Taki_InitVars = { ACTOR_BG_SPOT07_TAKI, @@ -33,7 +33,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot07Taki_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Init(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -46,35 +46,35 @@ void BgSpot07Taki_Init(Actor* thisx, GlobalContext* globalCtx) { } else { CollisionHeader_GetVirtual(&object_spot07_object_Col_0038FC, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } this->actionFunc = BgSpot07Taki_DoNothing; } -void BgSpot07Taki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Destroy(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot07Taki_DoNothing(BgSpot07Taki* this, GlobalContext* globalCtx) { +void BgSpot07Taki_DoNothing(BgSpot07Taki* this, PlayState* play) { } -void BgSpot07Taki_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Update(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Draw(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); - frames = globalCtx->gameplayFrames; + OPEN_DISPS(play->state.gfxCtx); + frames = play->gameplayFrames; if (LINK_IS_ADULT) { - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { gSPDisplayList(POLY_OPA_DISP++, object_spot07_object_DL_001CF0); @@ -82,31 +82,31 @@ void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, object_spot07_object_DL_003210); } } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, ((frames * -1) & 0x7F), ((frames * 1) & 0x7F), 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * 1) & 0x7F), 32, 32, 1, ((frames * 1) & 0x7F), ((frames * 1) & 0x7F), 32, 32)); if (!LINK_IS_ADULT) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); if (this->dyna.actor.params == 0) { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * -3) & 0xFF), 64, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * -3) & 0xFF), 64, 64, 1, ((frames * 1) & 0x7F), ((frames * -3) & 0xFF), 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, frames * 0, ((frames * 3) & 0x1FF), 32, 128)); gSPDisplayList(POLY_XLU_DISP++, object_spot07_object_DL_000460); } else { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * -1) & 0x7F), 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 0, ((frames * -1) & 0x7F), 32, 32, 1, frames * 0, ((frames * -1) & 0x7F), 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, frames * 0, ((frames * 3) & 0x1FF), 32, 128)); gSPDisplayList(POLY_XLU_DISP++, object_spot07_object_DL_000BE0); } @@ -115,5 +115,5 @@ void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { } else { gSPDisplayList(POLY_XLU_DISP++, object_spot07_object_DL_0032D8); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h b/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h index c033c68fb..dcf6ef8ed 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h @@ -6,7 +6,7 @@ struct BgSpot07Taki; -typedef void (*BgSpot07TakiActionFunc)(struct BgSpot07Taki*, GlobalContext*); +typedef void (*BgSpot07TakiActionFunc)(struct BgSpot07Taki*, PlayState*); typedef struct BgSpot07Taki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index 23dec68be..ce8cea9fb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -11,13 +11,13 @@ #define FLAGS ACTOR_FLAG_22 -void BgSpot08Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot08Bakudankabe_Init(Actor* thisx, PlayState* play); +void BgSpot08Bakudankabe_Destroy(Actor* thisx, PlayState* play); +void BgSpot08Bakudankabe_Update(Actor* thisx, PlayState* play); +void BgSpot08Bakudankabe_Draw(Actor* thisx, PlayState* play); -void func_808B02D0(BgSpot08Bakudankabe* this, GlobalContext* globalCtx); -void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx); +void func_808B02D0(BgSpot08Bakudankabe* this, PlayState* play); +void func_808B0324(BgSpot08Bakudankabe* this, PlayState* play); const ActorInit Bg_Spot08_Bakudankabe_InitVars = { ACTOR_BG_SPOT08_BAKUDANKABE, @@ -94,14 +94,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void func_808B02D0(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B02D0(BgSpot08Bakudankabe* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); } -void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B0324(BgSpot08Bakudankabe* this, PlayState* play) { s32 pad[2]; s32 i; Vec3f burstDepthY; @@ -145,7 +145,7 @@ void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) { rotationSpeed = 33; } - EffectSsKakera_Spawn(globalCtx, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, + EffectSsKakera_Spawn(play, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, 4, 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } @@ -153,52 +153,52 @@ void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) { burstDepthY.x = this->dyna.actor.world.pos.x + D_808B08AC[i].z * sinY + D_808B08AC[i].x * cosY; burstDepthY.y = this->dyna.actor.world.pos.y + D_808B08AC[i].y; burstDepthY.z = this->dyna.actor.world.pos.z + D_808B08AC[i].z * cosY - (D_808B08AC[i].x * sinY); - func_80033480(globalCtx, &burstDepthY, 120.0f, 4, 0x78, 0xA0, 1); + func_80033480(play, &burstDepthY, 120.0f, 4, 0x78, 0xA0, 1); } } -void BgSpot08Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Init(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } - func_808B02D0(this, globalCtx); + func_808B02D0(this, play); CollisionHeader_GetVirtual(&gZorasFountainBombableWallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot08Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Destroy(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgSpot08Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; if (this->collider.base.acFlags & AC_HIT) { - func_808B0324(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + func_808B0324(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); } else if (this->dyna.actor.xzDistToPlayer < 800.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgSpot08Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Draw(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; Collider_UpdateSpheres(0, &this->collider); Collider_UpdateSpheres(1, &this->collider); Collider_UpdateSpheres(2, &this->collider); - Gfx_DrawDListOpa(globalCtx, gZorasFountainBombableWallDL); + Gfx_DrawDListOpa(play, gZorasFountainBombableWallDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index 1f352c4a9..d7b45c9b6 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Iceblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Iceblock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Iceblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play); +void BgSpot08Iceblock_Destroy(Actor* thisx, PlayState* play); +void BgSpot08Iceblock_Update(Actor* thisx, PlayState* play); +void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play); void BgSpot08Iceblock_SetupFloatNonrotating(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, GlobalContext* globalCtx); +void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, PlayState* play); void BgSpot08Iceblock_SetupFloatRotating(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, GlobalContext* globalCtx); +void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, PlayState* play); void BgSpot08Iceblock_SetupFloatOrbitingTwins(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, GlobalContext* globalCtx); +void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play); void BgSpot08Iceblock_SetupNoAction(BgSpot08Iceblock* this); const ActorInit Bg_Spot08_Iceblock_InitVars = { @@ -39,7 +39,7 @@ void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, BgSpot08IceblockAction this->actionFunc = actionFunc; } -void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, GlobalContext* globalCtx, CollisionHeader* collision, +void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; @@ -47,7 +47,7 @@ void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, GlobalContext* global DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning: move BG registration failed" osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, @@ -159,7 +159,7 @@ static f32 sRollCoss[] = { * Handles all the factors that influence rolling: inertia, random oscillations, and most significantly, player weight, * and combines them to produce a matrix that rotates the actor to match the surface normal */ -void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, PlayState* play) { f32 deviationFromVertSq; f32 stabilityCorrection; Vec3f surfaceNormalHorizontal; @@ -173,7 +173,7 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, GlobalContext* globalCtx) { s32 rollDataIndex; MtxF mtx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); switch (this->dyna.actor.params & 0xFF) { case 0x11: // Medium nonrotating @@ -252,7 +252,7 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, GlobalContext* globalCtx) { Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0); } -void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, PlayState* play) { s32 pad[2]; f32 sin; f32 cos; @@ -261,7 +261,7 @@ void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, GlobalContext* globa cos = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; if (!(this->dyna.actor.params & 0x100)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT08_ICEBLOCK, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT08_ICEBLOCK, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, this->dyna.actor.home.rot.x, this->dyna.actor.home.rot.y, this->dyna.actor.home.rot.z, 0x123); @@ -281,7 +281,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2200, ICHAIN_STOP), }; -void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; CollisionHeader* colHeader; @@ -301,10 +301,10 @@ void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->dyna.actor.params & 0xF) { case 2: case 3: - BgSpot08Iceblock_InitDynaPoly(this, globalCtx, colHeader, DPM_UNK3); + BgSpot08Iceblock_InitDynaPoly(this, play, colHeader, DPM_UNK3); break; default: - BgSpot08Iceblock_InitDynaPoly(this, globalCtx, colHeader, DPM_UNK); + BgSpot08Iceblock_InitDynaPoly(this, play, colHeader, DPM_UNK); break; } @@ -341,7 +341,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { BgSpot08Iceblock_SetupFloatRotating(this); break; case 3: - BgSpot08Iceblock_SpawnTwinFloe(this, globalCtx); + BgSpot08Iceblock_SpawnTwinFloe(this, play); break; case 4: BgSpot08Iceblock_SetupNoAction(this); @@ -349,42 +349,42 @@ void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot08Iceblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Destroy(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgSpot08Iceblock_SetupFloatNonrotating(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatNonrotating); } -void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, PlayState* play) { BgSpot08Iceblock_Bobbing(this); BgSpot08Iceblock_SinkUnderPlayer(this); BgSpot08Iceblock_SetWaterline(this); this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - BgSpot08Iceblock_Roll(this, globalCtx); + BgSpot08Iceblock_Roll(this, play); } void BgSpot08Iceblock_SetupFloatRotating(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatRotating); } -void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, PlayState* play) { BgSpot08Iceblock_Bobbing(this); BgSpot08Iceblock_SinkUnderPlayer(this); BgSpot08Iceblock_SetWaterline(this); this->dyna.actor.world.rot.y = this->dyna.actor.world.rot.y + 0x190; this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; - BgSpot08Iceblock_Roll(this, globalCtx); + BgSpot08Iceblock_Roll(this, play); } void BgSpot08Iceblock_SetupFloatOrbitingTwins(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatOrbitingTwins); } -void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play) { f32 cos; f32 sin; @@ -408,14 +408,14 @@ void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, GlobalContext* } this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - BgSpot08Iceblock_Roll(this, globalCtx); + BgSpot08Iceblock_Roll(this, play); } void BgSpot08Iceblock_SetupNoAction(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, NULL); } -void BgSpot08Iceblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Update(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; if (Rand_ZeroOne() < 0.05f) { @@ -426,11 +426,11 @@ void BgSpot08Iceblock_Update(Actor* thisx, GlobalContext* globalCtx) { this->bobPhaseSlow += this->bobIncrSlow; this->bobPhaseFast += this->bobIncrFast; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgSpot08Iceblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play) { Gfx* dList; BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; @@ -443,5 +443,5 @@ void BgSpot08Iceblock_Draw(Actor* thisx, GlobalContext* globalCtx) { break; } - Gfx_DrawDListOpa(globalCtx, dList); + Gfx_DrawDListOpa(play, dList); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h b/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h index 2fc0b2a72..a59e3a356 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h @@ -6,7 +6,7 @@ struct BgSpot08Iceblock; -typedef void (*BgSpot08IceblockActionFunc)(struct BgSpot08Iceblock*, GlobalContext*); +typedef void (*BgSpot08IceblockActionFunc)(struct BgSpot08Iceblock*, PlayState*); typedef struct BgSpot08Iceblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/soh/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 5af973e3d..4b879da03 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -9,14 +9,14 @@ #define FLAGS 0 -void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot09Obj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot09Obj_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot09Obj_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot09Obj_Init(Actor* thisx, PlayState* play); +void BgSpot09Obj_Destroy(Actor* thisx, PlayState* play); +void BgSpot09Obj_Update(Actor* thisx, PlayState* play); +void BgSpot09Obj_Draw(Actor* thisx, PlayState* play); -s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx); -s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx); -s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx); +s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play); +s32 func_808B1BA0(BgSpot09Obj* this, PlayState* play); +s32 func_808B1BEC(BgSpot09Obj* this, PlayState* play); const ActorInit Bg_Spot09_Obj_InitVars = { ACTOR_BG_SPOT09_OBJ, @@ -35,7 +35,7 @@ static CollisionHeader* D_808B1F90[] = { NULL, &gValleyObjects1Col, &gValleyObjects2Col, &gValleyObjects3Col, &gValleyObjects4Col, }; -static s32 (*D_808B1FA4[])(BgSpot09Obj* this, GlobalContext* globalCtx) = { +static s32 (*D_808B1FA4[])(BgSpot09Obj* this, PlayState* play) = { func_808B1BEC, func_808B1AE0, func_808B1BA0, @@ -57,7 +57,7 @@ static Gfx* sDLists[] = { gValleyBridgeSidesDL, gValleyBrokenBridgeDL, gValleyBridgeChildDL, gCarpentersTentDL, gValleyRepairedBridgeDL, }; -s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play) { s32 carpentersRescued; if (gSaveContext.sceneSetupIndex >= 4) { @@ -84,7 +84,7 @@ s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { return 0; } -s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1BA0(BgSpot09Obj* this, PlayState* play) { if (this->dyna.actor.params == 3) { Actor_SetScale(&this->dyna.actor, 0.1f); } else { @@ -93,7 +93,7 @@ s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) { return 1; } -s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1BEC(BgSpot09Obj* this, PlayState* play) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2[2]; @@ -101,41 +101,41 @@ s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) { if (D_808B1F90[this->dyna.actor.params] != NULL) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(D_808B1F90[this->dyna.actor.params], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } return true; } -s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1C70(BgSpot09Obj* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { - if (!D_808B1FA4[i](this, globalCtx)) { + if (!D_808B1FA4[i](this, play)) { return false; } } return true; } -s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1CEC(BgSpot09Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); return true; } -s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1D18(BgSpot09Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); return true; } -s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1D44(BgSpot09Obj* this, PlayState* play) { if (this->dyna.actor.params == 3) { - return func_808B1D18(this, globalCtx); + return func_808B1D18(this, play); } else { - return func_808B1CEC(this, globalCtx); + return func_808B1CEC(this, play); } } -void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot09Obj_Init(Actor* thisx, PlayState* play) { BgSpot09Obj* this = (BgSpot09Obj*)thisx; osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params, @@ -146,37 +146,37 @@ void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) { __FILE__, __LINE__, this->dyna.actor.params); } - if (!func_808B1C70(this, globalCtx)) { + if (!func_808B1C70(this, play)) { Actor_Kill(&this->dyna.actor); - } else if (!func_808B1D44(this, globalCtx)) { + } else if (!func_808B1D44(this, play)) { Actor_Kill(&this->dyna.actor); } } -void BgSpot09Obj_Destroy(Actor* thisx, GlobalContext* globalCtx) { - DynaCollisionContext* dynaColCtx = &globalCtx->colCtx.dyna; +void BgSpot09Obj_Destroy(Actor* thisx, PlayState* play) { + DynaCollisionContext* dynaColCtx = &play->colCtx.dyna; BgSpot09Obj* this = (BgSpot09Obj*)thisx; if (this->dyna.actor.params != 0) { - DynaPoly_DeleteBgActor(globalCtx, dynaColCtx, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, dynaColCtx, this->dyna.bgId); } } -void BgSpot09Obj_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot09Obj_Update(Actor* thisx, PlayState* play) { } -void BgSpot09Obj_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); +void BgSpot09Obj_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDLists[thisx->params]); if (thisx->params == 3) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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++, gCarpentersTentEntranceDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index f24b35019..adece5af7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c @@ -11,10 +11,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot11Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot11Bakudankabe_Init(Actor* thisx, PlayState* play); +void BgSpot11Bakudankabe_Destroy(Actor* thisx, PlayState* play); +void BgSpot11Bakudankabe_Update(Actor* thisx, PlayState* play); +void BgSpot11Bakudankabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot11_Bakudankabe_InitVars = { ACTOR_BG_SPOT11_BAKUDANKABE, @@ -52,17 +52,17 @@ static ColliderCylinderInit sCylinderInit = { static Vec3f D_808B272C = { 2259.0f, 108.0f, -1550.0f }; static Vec3f D_808B2738 = { 2259.0f, 108.0f, -1550.0f }; -void func_808B2180(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B2180(BgSpot11Bakudankabe* this, PlayState* play) { s32 pad; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->collider.dim.pos.x += (s16)this->dyna.actor.world.pos.x; this->collider.dim.pos.y += (s16)this->dyna.actor.world.pos.y; this->collider.dim.pos.z += (s16)this->dyna.actor.world.pos.z; } -void func_808B2218(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B2218(BgSpot11Bakudankabe* this, PlayState* play) { Actor* thisx = &this->dyna.actor; Vec3f burstDepthY; Vec3f burstDepthX; @@ -97,57 +97,57 @@ void func_808B2218(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) { } else { rotationSpeed = 33; } - EffectSsKakera_Spawn(globalCtx, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, + EffectSsKakera_Spawn(play, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, 4, 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } Math_Vec3f_Sum(&thisx->world.pos, &D_808B272C, &burstDepthY); - func_80033480(globalCtx, &burstDepthY, 70, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 70, 4, 110, 160, 1); burstDepthY.y += 40; - func_80033480(globalCtx, &burstDepthY, 70, 5, 110, 160, 1); + func_80033480(play, &burstDepthY, 70, 5, 110, 160, 1); burstDepthY.y += 40; - func_80033480(globalCtx, &burstDepthY, 70, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 70, 4, 110, 160, 1); } -void BgSpot11Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Init(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } - func_808B2180(this, globalCtx); + func_808B2180(this, play); CollisionHeader_GetVirtual(&gDesertColossusBombableWallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_SetScale(&this->dyna.actor, 1.0f); osSyncPrintf("(spot11 爆弾壁)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgSpot11Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Destroy(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } -void BgSpot11Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; if (this->collider.base.acFlags & AC_HIT) { - func_808B2218(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN); + func_808B2218(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + SoundSource_PlaySfxAtFixedWorldPos(play, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgSpot11Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Draw(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; - Gfx_DrawDListOpa(globalCtx, gDesertColossusBombableWallDL); + Gfx_DrawDListOpa(play, gDesertColossusBombableWallDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index 373b4d36d..92c4b3a72 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -10,15 +10,15 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot11Oasis_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Oasis_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Oasis_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot11Oasis_Init(Actor* thisx, PlayState* play); +void BgSpot11Oasis_Update(Actor* thisx, PlayState* play); +void BgSpot11Oasis_Draw(Actor* thisx, PlayState* play); void func_808B2970(BgSpot11Oasis* this); -void func_808B2980(BgSpot11Oasis* this, GlobalContext* globalCtx); +void func_808B2980(BgSpot11Oasis* this, PlayState* play); void func_808B29E0(BgSpot11Oasis* this); -void func_808B29F0(BgSpot11Oasis* this, GlobalContext* globalCtx); +void func_808B29F0(BgSpot11Oasis* this, PlayState* play); void func_808B2AA8(BgSpot11Oasis* this); -void func_808B2AB8(BgSpot11Oasis* this, GlobalContext* globalCtx); +void func_808B2AB8(BgSpot11Oasis* this, PlayState* play); const ActorInit Bg_Spot11_Oasis_InitVars = { ACTOR_BG_SPOT11_OASIS, @@ -49,14 +49,14 @@ static Vec3f D_808B2E34[] = { { -75.0f, -90.0f, 90.0f }, { 30.0f, -100.0f, 40.0f }, }; -void func_808B27F0(GlobalContext* globalCtx, s16 waterSurface) { - WaterBox* waterBox = &globalCtx->colCtx.colHeader->waterBoxes[0]; +void func_808B27F0(PlayState* play, s16 waterSurface) { + WaterBox* waterBox = &play->colCtx.colHeader->waterBoxes[0]; waterBox->ySurface = waterSurface; } -s32 func_808B280C(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_808B280C(PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp58; Vec3f sp4C; Vec3f sp40; @@ -81,22 +81,22 @@ s32 func_808B280C(GlobalContext* globalCtx) { return 0; } -void BgSpot11Oasis_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Oasis_Init(Actor* thisx, PlayState* play) { BgSpot11Oasis* this = (BgSpot11Oasis*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); func_808B2970(this); this->actor.world.pos.y = -100.0f; - func_808B27F0(globalCtx, -100); + func_808B27F0(play, -100); } void func_808B2970(BgSpot11Oasis* this) { this->actionFunc = func_808B2980; } -void func_808B2980(BgSpot11Oasis* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 5) && func_808B280C(globalCtx)) { - OnePointCutscene_Init(globalCtx, 4150, -99, &this->actor, MAIN_CAM); +void func_808B2980(BgSpot11Oasis* this, PlayState* play) { + if (Flags_GetEnv(play, 5) && func_808B280C(play)) { + OnePointCutscene_Init(play, 4150, -99, &this->actor, MAIN_CAM); func_808B29E0(this); } } @@ -105,40 +105,40 @@ void func_808B29E0(BgSpot11Oasis* this) { this->actionFunc = func_808B29F0; } -void func_808B29F0(BgSpot11Oasis* this, GlobalContext* globalCtx) { +void func_808B29F0(BgSpot11Oasis* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, 0.0f, 0.7f)) { func_808B2AA8(this); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, FAIRY_SPAWNER); func_80078884(NA_SE_SY_CORRECT_CHIME); } - func_808B27F0(globalCtx, this->actor.world.pos.y); + func_808B27F0(play, this->actor.world.pos.y); } void func_808B2AA8(BgSpot11Oasis* this) { this->actionFunc = func_808B2AB8; } -void func_808B2AB8(BgSpot11Oasis* this, GlobalContext* globalCtx) { +void func_808B2AB8(BgSpot11Oasis* this, PlayState* play) { } -void BgSpot11Oasis_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Oasis_Update(Actor* thisx, PlayState* play) { BgSpot11Oasis* this = (BgSpot11Oasis*)thisx; s32 pad; u32 gameplayFrames; Vec3f sp30; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == func_808B2980) { this->actor.draw = NULL; return; } this->actor.draw = BgSpot11Oasis_Draw; if (this->unk_150 && (this->actor.projectedPos.z < 400.0f) && (this->actor.projectedPos.z > -40.0f)) { - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; if (gameplayFrames & 4) { Math_Vec3f_Sum(&this->actor.world.pos, &D_808B2E34[this->unk_151], &sp30); - EffectSsBubble_Spawn(globalCtx, &sp30, 0.0f, 15.0f, 50.0f, (Rand_ZeroOne() * 0.12f) + 0.02f); + EffectSsBubble_Spawn(play, &sp30, 0.0f, 15.0f, 50.0f, (Rand_ZeroOne() * 0.12f) + 0.02f); if (Rand_ZeroOne() < 0.3f) { this->unk_151 = Rand_ZeroOne() * 4.9f; } @@ -148,16 +148,16 @@ void BgSpot11Oasis_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot11Oasis_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 gameplayFrames = globalCtx->gameplayFrames; +void BgSpot11Oasis_Draw(Actor* thisx, PlayState* play) { + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(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, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, gDesertColossusOasisDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h b/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h index a1e18e87a..cae716a00 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h @@ -6,7 +6,7 @@ struct BgSpot11Oasis; -typedef void (*BgSpot11OasisActionFunc)(struct BgSpot11Oasis*, GlobalContext*); +typedef void (*BgSpot11OasisActionFunc)(struct BgSpot11Oasis*, PlayState*); typedef struct BgSpot11Oasis { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 0977b187a..be4eee82a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgSpot12Gate_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Gate_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Gate_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Gate_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot12Gate_Init(Actor* thisx, PlayState* play); +void BgSpot12Gate_Destroy(Actor* thisx, PlayState* play); +void BgSpot12Gate_Update(Actor* thisx, PlayState* play); +void BgSpot12Gate_Draw(Actor* thisx, PlayState* play); void func_808B30C0(BgSpot12Gate* this); -void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B30D8(BgSpot12Gate* this, PlayState* play); void func_808B3134(BgSpot12Gate* this); -void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B314C(BgSpot12Gate* this, PlayState* play); void func_808B317C(BgSpot12Gate* this); -void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B318C(BgSpot12Gate* this, PlayState* play); void func_808B3274(BgSpot12Gate* this); -void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B3298(BgSpot12Gate* this, PlayState* play); const ActorInit Bg_Spot12_Gate_InitVars = { ACTOR_BG_SPOT12_GATE, @@ -43,37 +43,37 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void BgSpot12Gate_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Gate_Init(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; - BgSpot12Gate_InitDynaPoly(this, globalCtx, &gGerudoFortressWastelandGateCol, DPM_UNK); + BgSpot12Gate_InitDynaPoly(this, play, &gGerudoFortressWastelandGateCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B3274(this); } else { func_808B30C0(this); } } -void BgSpot12Gate_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Gate_Destroy(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808B30C0(BgSpot12Gate* this) { @@ -81,10 +81,10 @@ void func_808B30C0(BgSpot12Gate* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } -void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_808B30D8(BgSpot12Gate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B3134(this); - OnePointCutscene_Init(globalCtx, 4160, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4160, -99, &this->dyna.actor, MAIN_CAM); } } @@ -93,7 +93,7 @@ void func_808B3134(BgSpot12Gate* this) { this->unk_168 = 40; } -void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) { +void func_808B314C(BgSpot12Gate* this, PlayState* play) { if (this->unk_168 <= 0) { func_808B317C(this); } @@ -103,7 +103,7 @@ void func_808B317C(BgSpot12Gate* this) { this->actionFunc = func_808B318C; } -void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { +void func_808B318C(BgSpot12Gate* this, PlayState* play) { s32 pad; s32 var; @@ -111,7 +111,7 @@ void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y)) { func_808B3274(this); - var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + var = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(var, -0x3CB0); Quake_SetQuakeValues(var, 3, 0, 0, 0); Quake_SetCountdown(var, 0xC); @@ -126,18 +126,18 @@ void func_808B3274(BgSpot12Gate* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 200.0f; } -void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx) { +void func_808B3298(BgSpot12Gate* this, PlayState* play) { } -void BgSpot12Gate_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Gate_Update(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; if (this->unk_168 > 0) { this->unk_168--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot12Gate_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGerudoFortressWastelandGateDL); +void BgSpot12Gate_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGerudoFortressWastelandGateDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h b/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h index 361873d25..2e9989fc2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h @@ -6,7 +6,7 @@ struct BgSpot12Gate; -typedef void (*BgSpot12GateActionFunc)(struct BgSpot12Gate*, GlobalContext*); +typedef void (*BgSpot12GateActionFunc)(struct BgSpot12Gate*, PlayState*); typedef struct BgSpot12Gate { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 771049931..d19ab61b4 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void BgSpot12Saku_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Saku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Saku_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Saku_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot12Saku_Init(Actor* thisx, PlayState* play); +void BgSpot12Saku_Destroy(Actor* thisx, PlayState* play); +void BgSpot12Saku_Update(Actor* thisx, PlayState* play); +void BgSpot12Saku_Draw(Actor* thisx, PlayState* play); void func_808B3550(BgSpot12Saku* this); -void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx); +void func_808B357C(BgSpot12Saku* this, PlayState* play); void func_808B35E4(BgSpot12Saku* this); -void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx); +void func_808B3604(BgSpot12Saku* this, PlayState* play); void func_808B3714(BgSpot12Saku* this); -void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx); +void func_808B37AC(BgSpot12Saku* this, PlayState* play); const ActorInit Bg_Spot12_Saku_InitVars = { ACTOR_BG_SPOT12_SAKU, @@ -41,36 +41,36 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void func_808B3420(BgSpot12Saku* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void BgSpot12Saku_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Saku_Init(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; - func_808B3420(this, globalCtx, &gGerudoFortressGTGShutterCol, DPM_UNK); + func_808B3420(this, play, &gGerudoFortressGTGShutterCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B3714(this); } else { func_808B3550(this); } } -void BgSpot12Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Saku_Destroy(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808B3550(BgSpot12Saku* this) { @@ -80,11 +80,11 @@ void func_808B3550(BgSpot12Saku* this) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; } -void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_808B357C(BgSpot12Saku* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B35E4(this); this->timer = 20; - OnePointCutscene_Init(globalCtx, 4170, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4170, -99, &this->dyna.actor, MAIN_CAM); } } @@ -94,7 +94,7 @@ void func_808B35E4(BgSpot12Saku* this) { } } -void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx) { +void func_808B3604(BgSpot12Saku* this, PlayState* play) { f32 temp_ret = Math_SmoothStepToF(&this->dyna.actor.scale.x, 0.001f / 0.14f, 0.16f, 0.0022f, 0.001f); f32 temp_f18 = ((0.1f - this->dyna.actor.scale.x) * 840.0f); @@ -119,18 +119,18 @@ void func_808B3714(BgSpot12Saku* this) { this->dyna.actor.home.pos.z - (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * 78.0f); } -void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) { +void func_808B37AC(BgSpot12Saku* this, PlayState* play) { } -void BgSpot12Saku_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Saku_Update(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; if (this->timer > 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot12Saku_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGerudoFortressGTGShutterDL); +void BgSpot12Saku_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGerudoFortressGTGShutterDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h b/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h index b8c8ef739..d96967300 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h @@ -6,7 +6,7 @@ struct BgSpot12Saku; -typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, GlobalContext*); +typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, PlayState*); typedef struct BgSpot12Saku { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 15935af2d..3b90939aa 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgSpot15Rrbox_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Rrbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Rrbox_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Rrbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot15Rrbox_Init(Actor* thisx, PlayState* play); +void BgSpot15Rrbox_Destroy(Actor* thisx, PlayState* play); +void BgSpot15Rrbox_Update(Actor* thisx, PlayState* play); +void BgSpot15Rrbox_Draw(Actor* thisx, PlayState* play); -void func_808B4084(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B40AC(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B4380(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B43D0(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B44B8(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B4178(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B44CC(BgSpot15Rrbox* this, GlobalContext* globalCtx); +void func_808B4084(BgSpot15Rrbox* this, PlayState* play); +void func_808B40AC(BgSpot15Rrbox* this, PlayState* play); +void func_808B4194(BgSpot15Rrbox* this, PlayState* play); +void func_808B4380(BgSpot15Rrbox* this, PlayState* play); +void func_808B43D0(BgSpot15Rrbox* this, PlayState* play); +void func_808B44B8(BgSpot15Rrbox* this, PlayState* play); +void func_808B4178(BgSpot15Rrbox* this, PlayState* play); +void func_808B44CC(BgSpot15Rrbox* this, PlayState* play); static s16 D_808B4590 = 0; @@ -55,7 +55,7 @@ static Vec3f D_808B45DC[] = { { 29.99f, 0.01f, 29.99f }, { 0.0f, 0.01f, 0.0f }, }; -void func_808B3960(BgSpot15Rrbox* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void func_808B3960(BgSpot15Rrbox* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; u32 pad2; @@ -63,7 +63,7 @@ void func_808B3960(BgSpot15Rrbox* this, GlobalContext* globalCtx, CollisionHeade DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, @@ -81,8 +81,8 @@ void func_808B3A34(BgSpot15Rrbox* this) { this->bgId = BG_ACTOR_MAX; } -s32 func_808B3A40(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->bgId); +s32 func_808B3A40(BgSpot15Rrbox* this, PlayState* play) { + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->bgId); if ((dynaPolyActor != NULL) && Math3D_Dist2DSq(dynaPolyActor->actor.world.pos.x, dynaPolyActor->actor.world.pos.z, @@ -92,13 +92,13 @@ s32 func_808B3A40(BgSpot15Rrbox* this, GlobalContext* globalCtx) { return false; } -s32 func_808B3AAC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +s32 func_808B3AAC(BgSpot15Rrbox* this, PlayState* play) { s16 rotY; Actor* actor = &this->dyna.actor; - if (globalCtx->sceneNum == SCENE_SOUKO) { + if (play->sceneNum == SCENE_SOUKO) { return true; - } else if (func_808B3A40(this, globalCtx)) { + } else if (func_808B3A40(this, play)) { return false; } @@ -118,30 +118,30 @@ s32 func_808B3AAC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { return true; } -void BgSpot15Rrbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Rrbox_Init(Actor* thisx, PlayState* play) { BgSpot15Rrbox* this = (BgSpot15Rrbox*)thisx; - func_808B3960(this, globalCtx, &gLonLonMilkCrateCol, DPM_UNK); + func_808B3960(this, play, &gLonLonMilkCrateCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); func_808B3A34(this); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { - func_808B44B8(this, globalCtx); + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + func_808B44B8(this, play); this->dyna.actor.world.pos = D_808B45C4[D_808B4590]; D_808B4590++; } else { - func_808B4084(this, globalCtx); + func_808B4084(this, play); } osSyncPrintf("(spot15 ロンロン木箱)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgSpot15Rrbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Rrbox_Destroy(Actor* thisx, PlayState* play) { BgSpot15Rrbox* this = (BgSpot15Rrbox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); D_808B4590 = 0; } -s32 func_808B3CA0(BgSpot15Rrbox* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_808B3CA0(BgSpot15Rrbox* this, PlayState* play, s32 arg2) { f32 chkDist = 0.0f; Vec3f actorPosition; Vec3f actorScale; @@ -158,7 +158,7 @@ s32 func_808B3CA0(BgSpot15Rrbox* this, GlobalContext* globalCtx, s32 arg2) { actorPosition.y += this->dyna.actor.prevPos.y; actorPosition.z += this->dyna.actor.world.pos.z; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, &this->dyna.actor.floorPoly, + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor6(&play->colCtx, &this->dyna.actor.floorPoly, &this->bgId, &this->dyna.actor, &actorPosition, chkDist); if ((this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) >= -0.001f) { @@ -168,7 +168,7 @@ s32 func_808B3CA0(BgSpot15Rrbox* this, GlobalContext* globalCtx, s32 arg2) { return false; } -f32 func_808B3DDC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +f32 func_808B3DDC(BgSpot15Rrbox* this, PlayState* play) { s32 i; Vec3f position; Vec3f scale; @@ -189,7 +189,7 @@ f32 func_808B3DDC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { position.y += actor->prevPos.y; position.z += actor->world.pos.z; - yIntersect = BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, &actor->floorPoly, &bgId, actor, &position, 0); + yIntersect = BgCheck_EntityRaycastFloor6(&play->colCtx, &actor->floorPoly, &bgId, actor, &position, 0); if (returnValue < yIntersect) { returnValue = yIntersect; @@ -199,31 +199,31 @@ f32 func_808B3DDC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { return returnValue; } -s32 func_808B3F58(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - if (func_808B3CA0(this, globalCtx, 0)) { +s32 func_808B3F58(BgSpot15Rrbox* this, PlayState* play) { + if (func_808B3CA0(this, play, 0)) { return true; } - if (func_808B3CA0(this, globalCtx, 1)) { + if (func_808B3CA0(this, play, 1)) { return true; } - if (func_808B3CA0(this, globalCtx, 2)) { + if (func_808B3CA0(this, play, 2)) { return true; } - if (func_808B3CA0(this, globalCtx, 3)) { + if (func_808B3CA0(this, play, 3)) { return true; } - if (func_808B3CA0(this, globalCtx, 4)) { + if (func_808B3CA0(this, play, 4)) { return true; } return false; } -s32 func_808B4010(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - return !func_800435D8(globalCtx, &this->dyna, this->dyna.actor.scale.x * 290.0f, +s32 func_808B4010(BgSpot15Rrbox* this, PlayState* play) { + return !func_800435D8(play, &this->dyna, this->dyna.actor.scale.x * 290.0f, this->dyna.actor.scale.x * 290.0f + 20.0f, 1.0f); } -void func_808B4084(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4084(BgSpot15Rrbox* this, PlayState* play) { this->actionFunc = func_808B40AC; this->dyna.actor.gravity = 0.0f; this->dyna.actor.velocity.x = 0.0f; @@ -231,13 +231,13 @@ void func_808B4084(BgSpot15Rrbox* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.z = 0.0f; } -void func_808B40AC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B40AC(BgSpot15Rrbox* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_168 <= 0 && fabsf(this->dyna.unk_150) > 0.001f) { - if (func_808B3AAC(this, globalCtx) && !func_808B4010(this, globalCtx)) { + if (func_808B3AAC(this, play) && !func_808B4010(this, play)) { this->unk_17C = this->dyna.unk_150; - func_808B4178(this, globalCtx); + func_808B4178(this, play); } else { player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; @@ -248,14 +248,14 @@ void func_808B40AC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { } } -void func_808B4178(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4178(BgSpot15Rrbox* this, PlayState* play) { this->actionFunc = func_808B4194; this->dyna.actor.gravity = 0.0f; } -void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { f32 sign; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 tempUnk178; s32 approxFResult; Actor* actor = &this->dyna.actor; @@ -272,20 +272,20 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { actor->world.pos.x = actor->home.pos.x + (tempUnk178 * this->unk_16C); actor->world.pos.z = actor->home.pos.z + (tempUnk178 * this->unk_170); - if (!func_808B3F58(this, globalCtx)) { + if (!func_808B3F58(this, play)) { actor->home.pos.x = actor->world.pos.x; actor->home.pos.z = actor->world.pos.z; player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; this->unk_178 = 0.0f; this->unk_174 = 0.0f; - func_808B4380(this, globalCtx); + func_808B4380(this, play); } else if (approxFResult) { - player = GET_PLAYER(globalCtx); - if (func_808B4010(this, globalCtx)) { + player = GET_PLAYER(play); + if (func_808B4010(this, play)) { Audio_PlayActorSound2(actor, NA_SE_EV_WOOD_BOUND); } - if (func_808B3A40(this, globalCtx)) { + if (func_808B3A40(this, play)) { func_80078884(NA_SE_SY_CORRECT_CHIME); } actor->home.pos.x = actor->world.pos.x; @@ -295,23 +295,23 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { this->unk_178 = 0.0f; this->unk_174 = 0.0f; this->unk_168 = 10 - ((CVar_GetS32("gFasterBlockPush", 0) * 3) / 2); - func_808B4084(this, globalCtx); + func_808B4084(this, play); } Audio_PlayActorSound2(actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void func_808B4380(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4380(BgSpot15Rrbox* this, PlayState* play) { this->dyna.actor.velocity.x = 0.0f; this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; - this->dyna.actor.floorHeight = func_808B3DDC(this, globalCtx); + this->dyna.actor.floorHeight = func_808B3DDC(this, play); this->actionFunc = func_808B43D0; } -void func_808B43D0(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B43D0(BgSpot15Rrbox* this, PlayState* play) { f32 floorHeight; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* actor = &this->dyna.actor; if (fabsf(this->dyna.unk_150) > 0.001f) { @@ -335,23 +335,23 @@ void func_808B43D0(BgSpot15Rrbox* this, GlobalContext* globalCtx) { if ((floorHeight - actor->world.pos.y) >= -0.001f) { actor->world.pos.y = floorHeight; - func_808B4084(this, globalCtx); + func_808B4084(this, play); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WOOD_BOUND); } } -void func_808B44B8(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B44B8(BgSpot15Rrbox* this, PlayState* play) { this->actionFunc = func_808B44CC; } -void func_808B44CC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B44CC(BgSpot15Rrbox* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; } -void BgSpot15Rrbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Rrbox_Update(Actor* thisx, PlayState* play) { BgSpot15Rrbox* this = (BgSpot15Rrbox*)thisx; if (this->unk_168 > 0) { @@ -360,9 +360,9 @@ void BgSpot15Rrbox_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.rot.y = this->dyna.unk_158; this->unk_16C = Math_SinS(this->dyna.actor.world.rot.y); this->unk_170 = Math_CosS(this->dyna.actor.world.rot.y); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot15Rrbox_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gLonLonMilkCrateDL); +void BgSpot15Rrbox_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gLonLonMilkCrateDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h index d1e8e86b7..d0178e7d0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h @@ -6,7 +6,7 @@ struct BgSpot15Rrbox; -typedef void (*BgSpot15RrboxActionFunc)(struct BgSpot15Rrbox*, GlobalContext*); +typedef void (*BgSpot15RrboxActionFunc)(struct BgSpot15Rrbox*, PlayState*); typedef struct BgSpot15Rrbox { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c b/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c index 99f6bf704..d48ffe055 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c @@ -9,14 +9,14 @@ #define FLAGS 0 -void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Saku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Saku_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot15Saku_Init(Actor* thisx, PlayState* play); +void BgSpot15Saku_Destroy(Actor* thisx, PlayState* play); +void BgSpot15Saku_Update(Actor* thisx, PlayState* play); +void BgSpot15Saku_Draw(Actor* thisx, PlayState* play); -void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx); -void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx); -void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx); +void func_808B4930(BgSpot15Saku* this, PlayState* play); +void func_808B4978(BgSpot15Saku* this, PlayState* play); +void func_808B4A04(BgSpot15Saku* this, PlayState* play); const ActorInit Bg_Spot15_Saku_InitVars = { ACTOR_BG_SPOT15_SAKU, @@ -31,7 +31,7 @@ const ActorInit Bg_Spot15_Saku_InitVars = { NULL, }; -void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Saku_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot15Saku* this = (BgSpot15Saku*)thisx; s32 pad2; @@ -39,7 +39,7 @@ void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gLonLonCorralFenceCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.scale.x = 0.1f; this->dyna.actor.scale.y = 0.1f; this->dyna.actor.scale.z = 0.1f; @@ -52,20 +52,20 @@ void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808B4930; } -void BgSpot15Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Saku_Destroy(Actor* thisx, PlayState* play) { BgSpot15Saku* this = (BgSpot15Saku*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) { +void func_808B4930(BgSpot15Saku* this, PlayState* play) { if (this->unk_168 && !(gSaveContext.infTable[7] & 2)) { this->timer = 2; this->actionFunc = func_808B4978; } } -void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { +void func_808B4978(BgSpot15Saku* this, PlayState* play) { if (this->timer == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); this->dyna.actor.world.pos.z -= 2.0f; @@ -77,31 +77,31 @@ void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { } } -void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) { +void func_808B4A04(BgSpot15Saku* this, PlayState* play) { if (this->timer == 0) { this->unk_168 = 0; this->actionFunc = func_808B4930; } } -void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Saku_Update(Actor* thisx, PlayState* play) { BgSpot15Saku* this = (BgSpot15Saku*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot15Saku_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgSpot15Saku_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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++, gLonLonCorralFenceDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h b/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h index d722b80e9..f7ac8d09c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h @@ -6,7 +6,7 @@ struct BgSpot15Saku; -typedef void (*BgSpot15SakuActionFunc)(struct BgSpot15Saku*, GlobalContext*); +typedef void (*BgSpot15SakuActionFunc)(struct BgSpot15Saku*, PlayState*); typedef struct BgSpot15Saku { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 912468e68..7e6a7aa8d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -6,17 +6,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Bombstone_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Bombstone_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Bombstone_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play); +void BgSpot16Bombstone_Destroy(Actor* thisx, PlayState* play); +void BgSpot16Bombstone_Update(Actor* thisx, PlayState* play); +void BgSpot16Bombstone_Draw(Actor* thisx, PlayState* play); void BgSpot16Bombstone_Reset(void); -void func_808B5A94(BgSpot16Bombstone* this, GlobalContext* globalCtx); -void func_808B5B04(BgSpot16Bombstone* this, GlobalContext* globalCtx); -void func_808B5B6C(BgSpot16Bombstone* this, GlobalContext* globalCtx); +void func_808B5A94(BgSpot16Bombstone* this, PlayState* play); +void func_808B5B04(BgSpot16Bombstone* this, PlayState* play); +void func_808B5B6C(BgSpot16Bombstone* this, PlayState* play); void func_808B5B58(BgSpot16Bombstone* this); -void func_808B5950(BgSpot16Bombstone* this, GlobalContext* globalCtx); +void func_808B5950(BgSpot16Bombstone* this, PlayState* play); void func_808B5934(BgSpot16Bombstone* this); void func_808B5AF0(BgSpot16Bombstone* this); void func_808B5A78(BgSpot16Bombstone* this); @@ -150,37 +150,37 @@ void func_808B4C30(BgSpot16Bombstone* this) { this->actor.params = this->actor.params & 0xFF; } -void func_808B4C4C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B4C4C(BgSpot16Bombstone* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderElements); this->colliderJntSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->colliderJntSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + 50.0f; this->colliderJntSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; this->colliderJntSph.elements[0].dim.worldSphere.radius = 120; } -void func_808B4D04(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B4D04(BgSpot16Bombstone* this, PlayState* play) { s32 pad; - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); this->colliderCylinder.dim.pos.x += (s16)this->actor.world.pos.x; this->colliderCylinder.dim.pos.y += (s16)this->actor.world.pos.y; this->colliderCylinder.dim.pos.z += (s16)this->actor.world.pos.z; } -s32 func_808B4D9C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +s32 func_808B4D9C(BgSpot16Bombstone* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf("Spot16 obj 爆弾石 破壊済み\n"); return false; } Actor_ProcessInitChain(&this->actor, sInitChainBoulder); Actor_SetScale(&this->actor, 0.4f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - func_808B4C4C(this, globalCtx); - func_808B4D04(this, globalCtx); + func_808B4C4C(this, play); + func_808B4D04(this, play); this->sinRotation = Math_SinS(this->actor.shape.rot.y); this->cosRotation = Math_CosS(this->actor.shape.rot.y); this->dList = gDodongosCavernRock3DL; @@ -189,7 +189,7 @@ s32 func_808B4D9C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { return true; } -s32 func_808B4E58(BgSpot16Bombstone* this, GlobalContext* globalctx) { +s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) { Actor* actor = &this->actor; f32 scaleFactor = 1.0f / 600.0f; f32 sinCosPosFactor = 50.0f; @@ -220,7 +220,7 @@ s32 func_808B4E58(BgSpot16Bombstone* this, GlobalContext* globalctx) { actor->shape.rot.z = D_808B5DD8[actor->params][9]; this->dList = object_bombiwa_DL_0009E0; - this->bombiwaBankIndex = Object_GetIndex(&globalctx->objectCtx, OBJECT_BOMBIWA); + this->bombiwaBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_BOMBIWA); if (this->bombiwaBankIndex < 0) { osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", actor->params, __FILE__, @@ -232,7 +232,7 @@ s32 func_808B4E58(BgSpot16Bombstone* this, GlobalContext* globalctx) { return true; } -void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; s16 shouldLive; @@ -241,7 +241,7 @@ void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case 0xFF: // The boulder is intact - shouldLive = func_808B4D9C(this, globalCtx); + shouldLive = func_808B4D9C(this, play); break; case 0: case 1: @@ -250,7 +250,7 @@ void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: case 5: // The boulder is debris - shouldLive = func_808B4E58(this, globalCtx); + shouldLive = func_808B4E58(this, play); break; default: osSyncPrintf("Error : arg_data おかしいな(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, @@ -266,17 +266,17 @@ void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("Spot16 obj 爆弾石 (scaleX %f)(arg_data 0x%04x)\n", this->actor.scale.x, this->actor.params); } -void BgSpot16Bombstone_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Destroy(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; if (this->actor.params == 0xFF) { // Boulder is intact so remove its collider - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); } } -void BgSpot16Bombstone_SpawnDust(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void BgSpot16Bombstone_SpawnDust(BgSpot16Bombstone* this, PlayState* play) { f32 scaleX1 = this->actor.scale.x * 150; s16 scaleX2 = this->actor.scale.x * 250; Vec3f world; @@ -285,10 +285,10 @@ void BgSpot16Bombstone_SpawnDust(BgSpot16Bombstone* this, GlobalContext* globalC world.y = this->actor.world.pos.y + 50.0f; world.z = this->actor.world.pos.z; - func_80033480(globalCtx, &world, scaleX1, 2, scaleX2, 0xA0, 1); + func_80033480(play, &world, scaleX1, 2, scaleX2, 0xA0, 1); } -void func_808B5240(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5240(BgSpot16Bombstone* this, PlayState* play) { f32 tempUnk6; f32 tempUnk2; s16 index; @@ -309,14 +309,14 @@ void func_808B5240(BgSpot16Bombstone* this, GlobalContext* globalCtx) { position.y = D_808B5EB0[index][2] + actorPosition->y; position.z = ((this->cosRotation * tempUnk6) - (tempUnk2 * this->sinRotation)) + actorPosition->z; - func_800287AC(globalCtx, &position, &sVelocity, &sAcceleration, D_808B5EB0[index][4], D_808B5EB0[index][5], + func_800287AC(play, &position, &sVelocity, &sAcceleration, D_808B5EB0[index][4], D_808B5EB0[index][5], D_808B5EB0[index][6]); this->unk_158 += 1; } } -void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, PlayState* play) { f32 velocityYMultiplier = 1.3f; Vec3f pos; Vec3f velocity; @@ -324,7 +324,7 @@ void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, GlobalContext* gl s16 scale; if (this->actor.params == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SPOT16_BOMBSTONE, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SPOT16_BOMBSTONE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 5); index = 3; } else { @@ -343,28 +343,28 @@ void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, GlobalContext* gl scale = D_808B6074[index] * this->actor.scale.x * 3; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -420, 0x31, 0xF, 0xF, 0, scale, 2, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -420, 0x31, 0xF, 0xF, 0, scale, 2, 0x40, 160, KAKERA_COLOR_NONE, OBJECT_BOMBIWA, object_bombiwa_DL_0009E0); index += 1; } while (index != ARRAY_COUNT(D_808B6074)); } } -void func_808B561C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B561C(BgSpot16Bombstone* this, PlayState* play) { s32 index; PosRot* world; world = &this->actor.world; for (index = 0; index < ARRAY_COUNT(D_808B6088); index++) { - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SPOT16_BOMBSTONE, world->pos.x, world->pos.y, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SPOT16_BOMBSTONE, world->pos.x, world->pos.y, world->pos.z, 0, 0, 0, D_808B6088[index]) == NULL) { break; } } } -void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B56BC(BgSpot16Bombstone* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sinValue; s16 adjustedYawDiff; s32 yawDiff; @@ -391,9 +391,9 @@ void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) { } } -void func_808B57E0(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B57E0(BgSpot16Bombstone* this, PlayState* play) { Actor* playerHeldActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnBombf* currentBomb; if (sTimer > 0) { @@ -410,7 +410,7 @@ void func_808B57E0(BgSpot16Bombstone* this, GlobalContext* globalCtx) { currentBomb = sPlayerBomb; if (currentBomb->timer > 0) { sTimer = currentBomb->timer + 20; - OnePointCutscene_Init(globalCtx, 4180, sTimer, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 4180, sTimer, NULL, MAIN_CAM); } } } else if (player->stateFlags1 & 0x800) { @@ -427,33 +427,33 @@ void func_808B5934(BgSpot16Bombstone* this) { this->actionFunc = func_808B5950; } -void func_808B5950(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5950(BgSpot16Bombstone* this, PlayState* play) { s32 pad; - func_808B56BC(this, globalCtx); - func_808B57E0(this, globalCtx); + func_808B56BC(this, play); + func_808B57E0(this, play); - if (globalCtx) {} + if (play) {} if (this->colliderCylinder.base.acFlags & AC_HIT) { this->colliderCylinder.base.acFlags &= ~AC_HIT; - func_808B561C(this, globalCtx); + func_808B561C(this, play); - OnePointCutscene_Init(globalCtx, 4180, 50, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 4180, 50, NULL, MAIN_CAM); - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); gSaveContext.eventChkInf[2] |= 8; func_808B5A78(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (mREG(64) == 1) { - func_808B561C(this, globalCtx); + func_808B561C(this, play); mREG(64) = -10; } else if (mREG(64) < 0) { mREG(64)++; @@ -467,9 +467,9 @@ void func_808B5A78(BgSpot16Bombstone* this) { this->actionFunc = func_808B5A94; } -void func_808B5A94(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5A94(BgSpot16Bombstone* this, PlayState* play) { - func_808B5240(this, globalCtx); + func_808B5240(this, play); if (this->unk_154 == 56) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -485,8 +485,8 @@ void func_808B5AF0(BgSpot16Bombstone* this) { this->actor.draw = NULL; } -void func_808B5B04(BgSpot16Bombstone* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->bombiwaBankIndex)) { +void func_808B5B04(BgSpot16Bombstone* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->bombiwaBankIndex)) { func_808B5B58(this); this->actor.draw = BgSpot16Bombstone_Draw; } @@ -497,7 +497,7 @@ void func_808B5B58(BgSpot16Bombstone* this) { this->actionFunc = func_808B5B6C; } -void func_808B5B6C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5B6C(BgSpot16Bombstone* this, PlayState* play) { Actor* actor = &this->actor; Actor_MoveForward(actor); @@ -510,34 +510,34 @@ void func_808B5B6C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { } if (actor->bgCheckFlags & 8 || (actor->bgCheckFlags & 1 && actor->velocity.y < 0.0f)) { - BgSpot16Bombstone_SpawnFragments(this, globalCtx); - BgSpot16Bombstone_SpawnDust(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 20, NA_SE_EV_ROCK_BROKEN); + BgSpot16Bombstone_SpawnFragments(this, play); + BgSpot16Bombstone_SpawnDust(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 20, NA_SE_EV_ROCK_BROKEN); Actor_Kill(actor); return; } - Actor_UpdateBgCheckInfo(globalCtx, actor, 17.5f, 35.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, actor, 17.5f, 35.0f, 0.0f, 5); } -void BgSpot16Bombstone_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Update(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; this->unk_154++; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgSpot16Bombstone_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Draw(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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); if (this->actor.params == 0xFF) { @@ -545,11 +545,11 @@ void BgSpot16Bombstone_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, this->dList); } else { // The boulder is debris - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->bombiwaBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->bombiwaBankIndex].segment); gSPDisplayList(POLY_OPA_DISP++, this->dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void BgSpot16Bombstone_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h index 924a0b1f7..499b01031 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h @@ -6,7 +6,7 @@ struct BgSpot16Bombstone; -typedef void (*BgSpot16BombstoneActionFunc)(struct BgSpot16Bombstone*, GlobalContext*); +typedef void (*BgSpot16BombstoneActionFunc)(struct BgSpot16Bombstone*, PlayState*); typedef struct BgSpot16Bombstone { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c b/soh/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c index 5f3c798c6..88008b018 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c @@ -10,13 +10,13 @@ #define FLAGS 0 -void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot16Doughnut_Init(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_Destroy(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_Update(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_Draw(Actor* thisx, PlayState* play); -void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_DrawExpanding(Actor* thisx, GlobalContext* globalCtx); +void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_DrawExpanding(Actor* thisx, PlayState* play); const ActorInit Bg_Spot16_Doughnut_InitVars = { ACTOR_BG_SPOT16_DOUGHNUT, @@ -41,7 +41,7 @@ static s16 sScales[] = { 0, 0, 70, 210, 300, }; -void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Init(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; s32 params; @@ -57,7 +57,7 @@ void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx) { } else { // Scales this actor for scenes where it is featured in the background, // Death Mountain itself falls into the default case. - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT01: Actor_SetScale(&this->actor, 0.04f); break; @@ -80,10 +80,10 @@ void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot16Doughnut_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Destroy(Actor* thisx, PlayState* play) { } -void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Update(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; if (!(this->fireFlag & 1)) { @@ -93,8 +93,8 @@ void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->envColorAlpha = 255; } - } else if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[2] != NULL && - globalCtx->csCtx.npcActions[2]->action == 2) { + } else if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[2] != NULL && + play->csCtx.npcActions[2]->action == 2) { if (this->envColorAlpha >= 6) { this->envColorAlpha -= 5; } else { @@ -105,7 +105,7 @@ void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx) { } // Update function for outwardly expanding and dissipating -void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; if (this->envColorAlpha >= 6) { @@ -117,21 +117,21 @@ void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x + 0.0019999998f); } -void BgSpot16Doughnut_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Draw(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; - u32 scroll = globalCtx->gameplayFrames & 0xFFFF; + u32 scroll = play->gameplayFrames & 0xFFFF; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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->fireFlag & 1) { gSPSegment( POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * (-1), 0, 16, 32, 1, scroll, scroll * (-2), 16, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * (-1), 0, 16, 32, 1, scroll, scroll * (-2), 16, 32)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, this->envColorAlpha); gSPDisplayList(POLY_XLU_DISP++, gDeathMountainCloudCircleFieryDL); } else { @@ -140,22 +140,22 @@ void BgSpot16Doughnut_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDeathMountainCloudCircleNormalDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Draw function for outwardly expanding and dissipating -void BgSpot16Doughnut_DrawExpanding(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_DrawExpanding(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->envColorAlpha); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gSPDisplayList(POLY_XLU_DISP++, gDeathMountainCloudCircleNormalDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index 42716383a..5cfc412a9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -11,10 +11,10 @@ #define FLAGS 0 -void BgSpot17Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot17Bakudankabe_Init(Actor* thisx, PlayState* play); +void BgSpot17Bakudankabe_Destroy(Actor* thisx, PlayState* play); +void BgSpot17Bakudankabe_Update(Actor* thisx, PlayState* play); +void BgSpot17Bakudankabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot17_Bakudankabe_InitVars = { ACTOR_BG_SPOT17_BAKUDANKABE, @@ -36,7 +36,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void func_808B6BC0(BgSpot17Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B6BC0(BgSpot17Bakudankabe* this, PlayState* play) { s32 pad[2]; s32 i; Vec3f burstDepthY; @@ -80,59 +80,59 @@ void func_808B6BC0(BgSpot17Bakudankabe* this, GlobalContext* globalCtx) { } else { rotationSpeed = 33; } - EffectSsKakera_Spawn(globalCtx, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, + EffectSsKakera_Spawn(play, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, 4, 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } Math_Vec3f_Copy(&burstDepthY, &this->dyna.actor.world.pos); - func_80033480(globalCtx, &burstDepthY, 60.0f, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 60.0f, 4, 110, 160, 1); burstDepthY.y += 40.0f; - func_80033480(globalCtx, &burstDepthY, 60.0f, 4, 120, 160, 1); + func_80033480(play, &burstDepthY, 60.0f, 4, 120, 160, 1); burstDepthY.y += 40.0f; - func_80033480(globalCtx, &burstDepthY, 60.0f, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 60.0f, 4, 110, 160, 1); } -void BgSpot17Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Init(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } CollisionHeader_GetVirtual(&gCraterBombableWallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot17Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Destroy(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot17Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; - if (this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(globalCtx, &this->dyna.actor) != NULL) { - func_808B6BC0(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + if (this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(play, &this->dyna.actor) != NULL) { + func_808B6BC0(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); } } -void BgSpot17Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Draw(Actor* thisx, PlayState* play) { s32 pad; - s8 r = coss(globalCtx->gameplayFrames * 1500) >> 8; - s8 g = coss(globalCtx->gameplayFrames * 1500) >> 8; + s8 r = coss(play->gameplayFrames * 1500) >> 8; + s8 g = coss(play->gameplayFrames * 1500) >> 8; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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); r = (r >> 1) + 0xC0; @@ -142,15 +142,15 @@ void BgSpot17Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gCraterBombableWallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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++, gCraterBombableWallCracksDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c b/soh/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c index 44e026821..82da3d1c8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c @@ -9,11 +9,11 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot17Funen_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Funen_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Funen_Update(Actor* thisx, GlobalContext* globalCtx); -void func_808B746C(Actor* thisx, GlobalContext* globalCtx); -void func_808B7478(Actor* thisx, GlobalContext* globalCtx); +void BgSpot17Funen_Init(Actor* thisx, PlayState* play); +void BgSpot17Funen_Destroy(Actor* thisx, PlayState* play); +void BgSpot17Funen_Update(Actor* thisx, PlayState* play); +void func_808B746C(Actor* thisx, PlayState* play); +void func_808B7478(Actor* thisx, PlayState* play); const ActorInit Bg_Spot17_Funen_InitVars = { ACTOR_BG_SPOT17_FUNEN, @@ -32,42 +32,42 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot17Funen_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Funen_Init(Actor* thisx, PlayState* play) { BgSpot17Funen* this = (BgSpot17Funen*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); osSyncPrintf("spot17 obj. 噴煙 (arg_data 0x%04x)\n", this->actor.params); } -void BgSpot17Funen_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Funen_Destroy(Actor* thisx, PlayState* play) { } -void BgSpot17Funen_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Funen_Update(Actor* thisx, PlayState* play) { BgSpot17Funen* this = (BgSpot17Funen*)thisx; this->actor.draw = func_808B7478; this->actor.update = func_808B746C; } -void func_808B746C(Actor* thisx, GlobalContext* globalCtx) { +void func_808B746C(Actor* thisx, PlayState* play) { } -void func_808B7478(Actor* thisx, GlobalContext* globalCtx) { +void func_808B7478(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y + 0x8000) * + func_80093D84(play->state.gfxCtx); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - thisx->shape.rot.y + 0x8000) * 9.58738019108e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 - globalCtx->gameplayFrames) & 0x7F, 0x20, 0x20, 1, 0, - (0 - globalCtx->gameplayFrames) & 0x7F, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (0 - play->gameplayFrames) & 0x7F, 0x20, 0x20, 1, 0, + (0 - play->gameplayFrames) & 0x7F, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gCraterSmokeConeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index f2eee7556..7185ae110 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -4,24 +4,24 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Basket_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Basket_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Basket_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Basket_Init(Actor* thisx, PlayState* play); +void BgSpot18Basket_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Basket_Update(Actor* thisx, PlayState* play); +void BgSpot18Basket_Draw(Actor* thisx, PlayState* play); void BgSpot18Basket_Reset(void); -void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx); +void func_808B7BCC(BgSpot18Basket* this, PlayState* play); void func_808B7AEC(BgSpot18Basket* this); void func_808B7B58(BgSpot18Basket* this); void func_808B7BB0(BgSpot18Basket* this); void func_808B7D38(BgSpot18Basket* this); void func_808B7F74(BgSpot18Basket* this); void func_808B818C(BgSpot18Basket* this); -void func_808B7AFC(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B7B6C(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B7D50(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B7FC0(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx); +void func_808B7AFC(BgSpot18Basket* this, PlayState* play); +void func_808B7B6C(BgSpot18Basket* this, PlayState* play); +void func_808B7D50(BgSpot18Basket* this, PlayState* play); +void func_808B7FC0(BgSpot18Basket* this, PlayState* play); +void func_808B81A0(BgSpot18Basket* this, PlayState* play); const ActorInit Bg_Spot18_Basket_InitVars = { ACTOR_BG_SPOT18_BASKET, @@ -76,16 +76,16 @@ static ColliderJntSphInit sJntSphInit = { static s16 D_808B85C8[] = { 0x8000, 0x2AAA, 0xD555, 0x0000 }; -void func_808B7710(Actor* thisx, GlobalContext* globalCtx) { +void func_808B7710(Actor* thisx, PlayState* play) { BgSpot18Basket* this = (BgSpot18Basket*)thisx; - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, this->ColliderJntSphElements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, this->ColliderJntSphElements); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; } s16 D_808B85D0 = 0; -void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) { +void func_808B7770(BgSpot18Basket* this, PlayState* play, f32 arg2) { Vec3f acceleration; Vec3f velocity; Vec3f position; @@ -96,7 +96,7 @@ void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) { s32 count; for (i = 0, count = 2; i != count; i++) { - if (globalCtx) {} + if (play) {} if (!(arg2 < Rand_ZeroOne())) { D_808B85D0 += 0x7530; @@ -117,7 +117,7 @@ void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) { acceleration.y = 0.5f; acceleration.z = 0.0f; - func_800286CC(globalCtx, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), + func_800286CC(play, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), ((Rand_ZeroOne() * 30) + 80)); } } @@ -130,29 +130,29 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot18Basket* this = (BgSpot18Basket*)thisx; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK3); - func_808B7710(&this->dyna.actor, globalCtx); + func_808B7710(&this->dyna.actor, play); CollisionHeader_GetVirtual(&gGoronCityVaseCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); this->dyna.actor.home.pos.y += 0.01f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_808B7BB0(this); return; } func_808B7AEC(this); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT18_FUTA, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT18_FUTA, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y + 0x1555, this->dyna.actor.shape.rot.z, -1); @@ -165,20 +165,20 @@ void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot18Basket_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Destroy(Actor* thisx, PlayState* play) { BgSpot18Basket* this = (BgSpot18Basket*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void func_808B7AEC(BgSpot18Basket* this) { this->actionFunc = func_808B7AFC; } -void func_808B7AFC(BgSpot18Basket* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { - OnePointCutscene_Init(globalCtx, 4220, 80, &this->dyna.actor, MAIN_CAM); +void func_808B7AFC(BgSpot18Basket* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + OnePointCutscene_Init(play, 4220, 80, &this->dyna.actor, MAIN_CAM); func_808B7B58(this); } } @@ -188,7 +188,7 @@ void func_808B7B58(BgSpot18Basket* this) { this->unk_216 = 0; } -void func_808B7B6C(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7B6C(BgSpot18Basket* this, PlayState* play) { if (this->unk_216 > 20) { func_808B7BB0(this); this->dyna.actor.child->parent = NULL; @@ -201,7 +201,7 @@ void func_808B7BB0(BgSpot18Basket* this) { this->unk_210 = this->unk_20C = 0; } -void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7BCC(BgSpot18Basket* this, PlayState* play) { f32 positionDiff; Actor* colliderBaseAc; @@ -226,9 +226,9 @@ void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) { if (positionDiff > 120.0f && positionDiff < 200.0f) { if (Math3D_Dist2DSq(colliderBaseAc->world.pos.z, this->colliderJntSph.base.ac->world.pos.x, this->dyna.actor.world.pos.z, this->dyna.actor.world.pos.x) < SQ(32.0f)) { - OnePointCutscene_Init(globalCtx, 4210, 240, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4210, 240, &this->dyna.actor, MAIN_CAM); func_808B7D38(this); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } } } @@ -242,7 +242,7 @@ void func_808B7D38(BgSpot18Basket* this) { this->unk_214 = 0; } -void func_808B7D50(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7D50(BgSpot18Basket* this, PlayState* play) { f32 tempValue2; f32 tempValue; @@ -279,9 +279,9 @@ void func_808B7D50(BgSpot18Basket* this, GlobalContext* globalCtx) { } if (this->unk_216 < 80) { - func_808B7770(this, globalCtx, 1.0f); + func_808B7770(this, play, 1.0f); } else { - func_808B7770(this, globalCtx, 0.8f); + func_808B7770(this, play, 0.8f); } tempValue2 = (this->unk_210 - 500) * 0.0006f; @@ -308,7 +308,7 @@ void func_808B7F74(BgSpot18Basket* this) { this->unk_216 = 0; } -void func_808B7FC0(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7FC0(BgSpot18Basket* this, PlayState* play) { s32 pad; s32 tempUnk214; f32 tempUnk210; @@ -336,14 +336,14 @@ void func_808B7FC0(BgSpot18Basket* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y = arrayValue; func_808B818C(this); - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } } if (this->unk_216 < 30) { - func_808B7770(this, globalCtx, 0.5f); + func_808B7770(this, play, 0.5f); } else { - func_808B7770(this, globalCtx, 0.3f); + func_808B7770(this, play, 0.3f); } tempUnk210 = (this->unk_210 - 500) * 0.0006f; @@ -360,7 +360,7 @@ void func_808B818C(BgSpot18Basket* this) { static s16 D_808B85E4[] = { -0x0FA0, 0x0320, 0x0FA0 }; -void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B81A0(BgSpot18Basket* this, PlayState* play) { s32 i; Actor* actor = &this->dyna.actor; Vec3f tempVector; @@ -373,7 +373,7 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { if (this->unk_218 == 0) { for (i = 0; i < ARRAY_COUNT(D_808B85E4); i++) { - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_BOMBS_A); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_BOMBS_A); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[i]; @@ -381,22 +381,22 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { } } else if (this->unk_218 == 1) { for (i = 0; i < ARRAY_COUNT(D_808B85E4); i++) { - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_GREEN); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_GREEN); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[i]; } } } else if (this->unk_218 == 2) { - if ((this->unk_21A != 0) || Flags_GetCollectible(globalCtx, (actor->params & 0x3F))) { - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_PURPLE); + if ((this->unk_21A != 0) || Flags_GetCollectible(play, (actor->params & 0x3F))) { + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_PURPLE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[1]; } } else { collectible = - Item_DropCollectible(globalCtx, &tempVector, ((actor->params & 0x3F) << 8) | ITEM00_HEART_PIECE); + Item_DropCollectible(play, &tempVector, ((actor->params & 0x3F) << 8) | ITEM00_HEART_PIECE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[1]; @@ -404,13 +404,13 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { } } - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_RED); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_RED); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[0]; } - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_BLUE); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_BLUE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[2]; @@ -427,30 +427,30 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { } } -void BgSpot18Basket_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Update(Actor* thisx, PlayState* play) { s32 pad; BgSpot18Basket* this = (BgSpot18Basket*)thisx; s32 bgId; this->unk_216++; - this->actionFunc(this, globalCtx); - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, + this->actionFunc(this, play); + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &this->dyna.actor.world.pos); if (this->actionFunc != func_808B7AFC) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); if (this->actionFunc != func_808B7B6C) { this->colliderJntSph.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } } } -void BgSpot18Basket_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Draw(Actor* thisx, PlayState* play) { BgSpot18Basket* this = (BgSpot18Basket*)thisx; Collider_UpdateSpheres(0, &this->colliderJntSph); Collider_UpdateSpheres(1, &this->colliderJntSph); - Gfx_DrawDListOpa(globalCtx, gGoronCityVaseDL); + Gfx_DrawDListOpa(play, gGoronCityVaseDL); } void BgSpot18Basket_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h index 74aaa72b9..21f4bc4f2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h @@ -6,7 +6,7 @@ struct BgSpot18Basket; -typedef void (*BgSpot18BasketActionFunc)(struct BgSpot18Basket*, GlobalContext*); +typedef void (*BgSpot18BasketActionFunc)(struct BgSpot18Basket*, PlayState*); typedef struct BgSpot18Basket { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c b/soh/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c index da278ee77..ba2f43d1f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgSpot18Futa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Futa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Futa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Futa_Init(Actor* thisx, PlayState* play); +void BgSpot18Futa_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Futa_Update(Actor* thisx, PlayState* play); +void BgSpot18Futa_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot18_Futa_InitVars = { ACTOR_BG_SPOT18_FUTA, @@ -34,24 +34,24 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgSpot18Futa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Futa_Init(Actor* thisx, PlayState* play) { BgSpot18Futa* this = (BgSpot18Futa*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gGoronCityVaseLidCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot18Futa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Futa_Destroy(Actor* thisx, PlayState* play) { BgSpot18Futa* this = (BgSpot18Futa*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Futa_Update(Actor* thisx, PlayState* play) { BgSpot18Futa* this = (BgSpot18Futa*)thisx; s32 iVar1; @@ -67,6 +67,6 @@ void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot18Futa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGoronCityVaseLidDL); +void BgSpot18Futa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGoronCityVaseLidDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 6ab3ce954..e24e39902 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -10,25 +10,25 @@ #define FLAGS 0 -void BgSpot18Obj_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Obj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Obj_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Obj_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Obj_Init(Actor* thisx, PlayState* play); +void BgSpot18Obj_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Obj_Update(Actor* thisx, PlayState* play); +void BgSpot18Obj_Draw(Actor* thisx, PlayState* play); -s32 func_808B8910(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8A5C(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8A98(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8B08(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8BB4(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8C90(BgSpot18Obj* this, GlobalContext* globalCtx); +s32 func_808B8910(BgSpot18Obj* this, PlayState* play); +s32 func_808B8A5C(BgSpot18Obj* this, PlayState* play); +s32 func_808B8A98(BgSpot18Obj* this, PlayState* play); +s32 func_808B8B08(BgSpot18Obj* this, PlayState* play); +s32 func_808B8BB4(BgSpot18Obj* this, PlayState* play); +s32 func_808B8C90(BgSpot18Obj* this, PlayState* play); void func_808B8DC0(BgSpot18Obj* this); -void func_808B8DD0(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B8DD0(BgSpot18Obj* this, PlayState* play); void func_808B8E64(BgSpot18Obj* this); -void func_808B8E7C(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B8E7C(BgSpot18Obj* this, PlayState* play); void func_808B8EE0(BgSpot18Obj* this); -void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B8F08(BgSpot18Obj* this, PlayState* play); void func_808B9030(BgSpot18Obj* this); -void func_808B9040(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B9040(BgSpot18Obj* this, PlayState* play); const ActorInit Bg_Spot18_Obj_InitVars = { ACTOR_BG_SPOT18_OBJ, @@ -89,7 +89,7 @@ static Gfx(*sDlists[]) = { gGoronCityStatueSpearDL, }; -s32 func_808B8910(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { s32 age; if (LINK_AGE_IN_YEARS == YEARS_ADULT) { @@ -120,43 +120,43 @@ s32 func_808B8910(BgSpot18Obj* this, GlobalContext* globalCtx) { return 0; } -s32 func_808B8A5C(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8A5C(BgSpot18Obj* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, D_808B90F4[this->dyna.actor.params & 0xF]); return 1; } -s32 func_808B8A98(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8A98(BgSpot18Obj* this, PlayState* play) { s32 pad[2]; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(D_808B90FC[this->dyna.actor.params & 0xF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); return 1; } -s32 func_808B8B08(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8B08(BgSpot18Obj* this, PlayState* play) { this->dyna.actor.flags |= D_808B9104[this->dyna.actor.params & 0xF]; return 1; } -s32 func_808B8B38(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8B38(BgSpot18Obj* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(D_808B910C); i++) { - if (D_808B910C[i](this, globalCtx) == 0) { + if (D_808B910C[i](this, play) == 0) { return 0; } } return 1; } -s32 func_808B8BB4(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8BB4(BgSpot18Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); if (LINK_AGE_IN_YEARS == YEARS_CHILD) { func_808B9030(this); - } else if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + } else if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_808B9030(this); this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z; @@ -166,50 +166,50 @@ s32 func_808B8BB4(BgSpot18Obj* this, GlobalContext* globalCtx) { return 1; } -s32 func_808B8C90(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8C90(BgSpot18Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); func_808B8DC0(this); return 1; } -s32 func_808B8CC8(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8CC8(BgSpot18Obj* this, PlayState* play) { if ((D_808B913C[this->dyna.actor.params & 0xF] != NULL) && - (!D_808B913C[this->dyna.actor.params & 0xF](this, globalCtx))) { + (!D_808B913C[this->dyna.actor.params & 0xF](this, play))) { return 0; } return 1; } -void BgSpot18Obj_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Obj_Init(Actor* thisx, PlayState* play) { BgSpot18Obj* this = (BgSpot18Obj*)thisx; osSyncPrintf("Spot18 Object [arg_data : 0x%04x]\n", this->dyna.actor.params); - if (!func_808B8B38(this, globalCtx)) { + if (!func_808B8B38(this, play)) { Actor_Kill(&this->dyna.actor); - } else if (!func_808B8CC8(this, globalCtx)) { + } else if (!func_808B8CC8(this, play)) { Actor_Kill(&this->dyna.actor); } } -void BgSpot18Obj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Obj_Destroy(Actor* thisx, PlayState* play) { BgSpot18Obj* this = (BgSpot18Obj*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808B8DC0(BgSpot18Obj* this) { this->actionFunc = func_808B8DD0; } -void func_808B8DD0(BgSpot18Obj* this, GlobalContext* globalCtx) { +void func_808B8DD0(BgSpot18Obj* this, PlayState* play) { } -void func_808B8DDC(BgSpot18Obj* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 46.0f, 0.0f, 28); +void func_808B8DDC(BgSpot18Obj* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 46.0f, 0.0f, 28); } -void func_808B8E20(BgSpot18Obj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B8E20(BgSpot18Obj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; @@ -222,7 +222,7 @@ void func_808B8E64(BgSpot18Obj* this) { this->actionFunc = func_808B8E7C; } -void func_808B8E7C(BgSpot18Obj* this, GlobalContext* globalCtx) { +void func_808B8E7C(BgSpot18Obj* this, PlayState* play) { if (this->dyna.unk_150 < -0.001f) { if (this->unk_168 <= 0) { func_808B8EE0(this); @@ -230,7 +230,7 @@ void func_808B8E7C(BgSpot18Obj* this, GlobalContext* globalCtx) { } else { this->unk_168 = 20; } - func_808B8E20(this, globalCtx); + func_808B8E20(this, play); } void func_808B8EE0(BgSpot18Obj* this) { @@ -242,13 +242,13 @@ void func_808B8EE0(BgSpot18Obj* this) { this->dyna.actor.velocity.x = 0.0f; } -void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx) { +void func_808B8F08(BgSpot18Obj* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_StepToF(&this->dyna.actor.speedXZ, 1.2f, 0.1f); Actor_MoveForward(&this->dyna.actor); - func_808B8DDC(this, globalCtx); + func_808B8DDC(this, play); if (Math3D_Dist2DSq(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.z) >= 6400.0f) { @@ -257,7 +257,7 @@ void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z; this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~0x10; - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); func_80078884(NA_SE_SY_CORRECT_CHIME); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } else { @@ -269,19 +269,19 @@ void func_808B9030(BgSpot18Obj* this) { this->actionFunc = func_808B9040; } -void func_808B9040(BgSpot18Obj* this, GlobalContext* globalCtx) { - func_808B8E20(this, globalCtx); +void func_808B9040(BgSpot18Obj* this, PlayState* play) { + func_808B8E20(this, play); } -void BgSpot18Obj_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Obj_Update(Actor* thisx, PlayState* play) { BgSpot18Obj* this = (BgSpot18Obj*)thisx; if (this->unk_168 > 0) { this->unk_168 -= 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot18Obj_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDlists[thisx->params & 0xF]); +void BgSpot18Obj_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDlists[thisx->params & 0xF]); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h b/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h index ee257022e..5e000f646 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h @@ -6,8 +6,8 @@ struct BgSpot18Obj; -typedef void (*BgSpot18ObjActionFunc)(struct BgSpot18Obj*, GlobalContext*); -typedef s32 (*BgSpot18ObjInitFunc)(struct BgSpot18Obj*, GlobalContext*); +typedef void (*BgSpot18ObjActionFunc)(struct BgSpot18Obj*, PlayState*); +typedef s32 (*BgSpot18ObjInitFunc)(struct BgSpot18Obj*, PlayState*); typedef struct BgSpot18Obj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index 77fd4b730..9f2955b09 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -9,16 +9,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Shutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Shutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Shutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Shutter_Init(Actor* thisx, PlayState* play); +void BgSpot18Shutter_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Shutter_Update(Actor* thisx, PlayState* play); +void BgSpot18Shutter_Draw(Actor* thisx, PlayState* play); -void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx); +void func_808B95AC(BgSpot18Shutter* this, PlayState* play); +void func_808B95B8(BgSpot18Shutter* this, PlayState* play); +void func_808B9618(BgSpot18Shutter* this, PlayState* play); +void func_808B9698(BgSpot18Shutter* this, PlayState* play); +void func_808B971C(BgSpot18Shutter* this, PlayState* play); const ActorInit Bg_Spot18_Shutter_InitVars = { ACTOR_BG_SPOT18_SHUTTER, @@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Shutter_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot18Shutter* this = (BgSpot18Shutter*)thisx; s32 param = (this->dyna.actor.params >> 8) & 1; @@ -55,7 +55,7 @@ void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808B9618; } } else { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { this->actionFunc = func_808B95AC; this->dyna.actor.world.pos.y += 180.0f; } else { @@ -73,39 +73,39 @@ void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) { } CollisionHeader_GetVirtual(&gGoronCityDoorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgSpot18Shutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Shutter_Destroy(Actor* thisx, PlayState* play) { BgSpot18Shutter* this = (BgSpot18Shutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B95AC(BgSpot18Shutter* this, PlayState* play) { } -void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_808B95B8(BgSpot18Shutter* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_SetFocus(&this->dyna.actor, 70.0f); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808B9698; } } -void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B9618(BgSpot18Shutter* this, PlayState* play) { if (gSaveContext.infTable[16] & 0x200) { Actor_SetFocus(&this->dyna.actor, 70.0f); if (((this->dyna.actor.params >> 8) & 1) == 0) { this->actionFunc = func_808B9698; } else { this->actionFunc = func_808B971C; - OnePointCutscene_Init(globalCtx, 4221, 140, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 4221, 140, &this->dyna.actor, MAIN_CAM); } } } -void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B9698(BgSpot18Shutter* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 180.0f, 1.44f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); this->actionFunc = func_808B95AC; @@ -114,7 +114,7 @@ void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx) { } } -void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B971C(BgSpot18Shutter* this, PlayState* play) { f32 sin = Math_SinS(this->dyna.actor.world.rot.y); f32 cos = Math_CosS(this->dyna.actor.world.rot.y); s32 flag = true; @@ -130,12 +130,12 @@ void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx) { } } -void BgSpot18Shutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Shutter_Update(Actor* thisx, PlayState* play) { BgSpot18Shutter* this = (BgSpot18Shutter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot18Shutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGoronCityDoorDL); +void BgSpot18Shutter_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGoronCityDoorDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h b/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h index b24857b97..161fa9bc9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h @@ -6,7 +6,7 @@ struct BgSpot18Shutter; -typedef void (*BgSpot18ShutterActionFunc)(struct BgSpot18Shutter*, GlobalContext*); +typedef void (*BgSpot18ShutterActionFunc)(struct BgSpot18Shutter*, PlayState*); typedef struct BgSpot18Shutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index 968770d74..847960a5d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSstFloor_Init(BgSstFloor* this, GlobalContext* globalCtx); -void BgSstFloor_Destroy(BgSstFloor* this, GlobalContext* globalCtx); -void BgSstFloor_Update(BgSstFloor* this, GlobalContext* globalCtx); -void BgSstFloor_Draw(BgSstFloor* this, GlobalContext* globalCtx); +void BgSstFloor_Init(BgSstFloor* this, PlayState* play); +void BgSstFloor_Destroy(BgSstFloor* this, PlayState* play); +void BgSstFloor_Update(BgSstFloor* this, PlayState* play); +void BgSstFloor_Draw(BgSstFloor* this, PlayState* play); static s32 sUnkValues[] = { 0, 0, 0 }; // Unused, probably a zero vector @@ -33,7 +33,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale.x, 100, ICHAIN_STOP), }; -void BgSstFloor_Init(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Init(BgSstFloor* thisx, PlayState* play) { s32 pad; BgSstFloor* this = (BgSstFloor*)thisx; CollisionHeader* colHeader = NULL; @@ -41,20 +41,20 @@ void BgSstFloor_Init(BgSstFloor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gBongoDrumCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgSstFloor_Destroy(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Destroy(BgSstFloor* thisx, PlayState* play) { s32 pad; BgSstFloor* this = (BgSstFloor*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Update(BgSstFloor* thisx, PlayState* play) { s32 pad; BgSstFloor* this = (BgSstFloor*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(&gBongoDrumCol); colHeader = ResourceMgr_LoadColByName(colHeader); @@ -62,9 +62,9 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList); if (func_80043590(&this->dyna) && (this->dyna.actor.yDistToPlayer < 1000.0f)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BOSS_BONGO); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_BOSS_BONGO); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); } if (func_8004356C(&this->dyna) && (player->fallDistance > 1000.0f)) { @@ -73,7 +73,7 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { } if (this->dyna.actor.params == BONGOFLOOR_HIT) { - Actor* item00 = globalCtx->actorCtx.actorLists[ACTORCAT_MISC].head; + Actor* item00 = play->actorCtx.actorLists[ACTORCAT_MISC].head; f32 distFromRim; f32 xzDist; @@ -117,20 +117,20 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { if (this->drumPhase != 0) { this->drumPhase--; } - func_8003EE6C(globalCtx, &globalCtx->colCtx.dyna); + func_8003EE6C(play, &play->colCtx.dyna); } -void BgSstFloor_Draw(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Draw(BgSstFloor* thisx, PlayState* play) { BgSstFloor* this = (BgSstFloor*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Scale(1.0f, this->drumHeight * -0.0025f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBongoDrumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c b/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c index fb320c898..063496bf5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c +++ b/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_5 -void BgTokiHikari_Init(Actor* thisx, GlobalContext* globalCtx); -void BgTokiHikari_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgTokiHikari_Update(Actor* thisx, GlobalContext* globalCtx); -void BgTokiHikari_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgTokiHikari_Init(Actor* thisx, PlayState* play); +void BgTokiHikari_Destroy(Actor* thisx, PlayState* play); +void BgTokiHikari_Update(Actor* thisx, PlayState* play); +void BgTokiHikari_Draw(Actor* thisx, PlayState* play); -void BgTokiHikari_DoNothing(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA018(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA204(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA22C(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA274(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx); +void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play); +void func_808BA018(BgTokiHikari* this, PlayState* play); +void func_808BA204(BgTokiHikari* this, PlayState* play); +void func_808BA22C(BgTokiHikari* this, PlayState* play); +void func_808BA274(BgTokiHikari* this, PlayState* play); +void func_808BA2CC(BgTokiHikari* this, PlayState* play); const ActorInit Bg_Toki_Hikari_InitVars = { ACTOR_BG_TOKI_HIKARI, @@ -38,7 +38,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgTokiHikari_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Init(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; switch (this->actor.params) { @@ -57,65 +57,65 @@ void BgTokiHikari_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgTokiHikari_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Destroy(Actor* thisx, PlayState* play) { } -void BgTokiHikari_DoNothing(BgTokiHikari* this, GlobalContext* globalCtx) { +void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play) { } -void BgTokiHikari_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Update(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgTokiHikari_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Draw(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; switch (this->actor.params) { case 0: - func_808BA018(this, globalCtx); + func_808BA018(this, play); break; case 1: - func_808BA2CC(this, globalCtx); + func_808BA2CC(this, play); break; } } -void func_808BA018(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA018(BgTokiHikari* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (LINK_IS_ADULT) { gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_008190); } else { gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_007E20); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 64, 32)); + Gfx_TexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 64, 32)); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 64, 32)); + Gfx_TexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 64, 32)); - 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_toki_objects_DL_007EE0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808BA204(BgTokiHikari* this, GlobalContext* globalCtx) { - if (globalCtx->roomCtx.unk_74[1] != 0) { +void func_808BA204(BgTokiHikari* this, PlayState* play) { + if (play->roomCtx.unk_74[1] != 0) { this->actionFunc = func_808BA22C; } } -void func_808BA22C(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA22C(BgTokiHikari* this, PlayState* play) { if (this->unk_14C < 1.0f) { this->unk_14C += 0.05f; } else { @@ -124,7 +124,7 @@ void func_808BA22C(BgTokiHikari* this, GlobalContext* globalCtx) { } } -void func_808BA274(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA274(BgTokiHikari* this, PlayState* play) { if (this->unk_14C > 0.2f) { this->unk_14C -= 0.025f; } else { @@ -133,14 +133,14 @@ void func_808BA274(BgTokiHikari* this, GlobalContext* globalCtx) { } } -void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA2CC(BgTokiHikari* this, PlayState* play) { s32 pad[2]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, 276.0f, 1122.0f, MTXMODE_NEW); Matrix_Scale(0.32f, 0.32f, this->unk_14C * 7.0f, MTXMODE_APPLY); Matrix_RotateZ(M_PI, MTXMODE_APPLY); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->unk_14C * 255.0f, (u8)(155.0f * this->unk_14C) + 100, @@ -148,12 +148,12 @@ void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk_14C * 155.0f) + 100, (u8)(255.0f * this->unk_14C), 0, 128); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, -2 * (globalCtx->gameplayFrames & 0x7F), 0, 0x20, 0x40, 1, - (globalCtx->gameplayFrames & 0x7F) * 4, 0, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -2 * (play->gameplayFrames & 0x7F), 0, 0x20, 0x40, 1, + (play->gameplayFrames & 0x7F) * 4, 0, 0x20, 0x40)); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_000880); Matrix_Pop(); @@ -164,7 +164,7 @@ void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk_14C * 255.0f), (u8)(this->unk_14C * 255.0f), (u8)(this->unk_14C * 255.0f), (u8)(200.0f * this->unk_14C)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_0009C0); @@ -176,10 +176,10 @@ void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk_14C * 255.0f), (u8)(this->unk_14C * 255.0f), (u8)(this->unk_14C * 255.0f), (u8)(200.0f * this->unk_14C)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayListOffset(POLY_XLU_DISP++, object_toki_objects_DL_0009C0, 10); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h b/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h index 865068b12..d55aacc60 100644 --- a/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h +++ b/soh/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h @@ -6,7 +6,7 @@ struct BgTokiHikari; -typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, GlobalContext*); +typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, PlayState*); typedef struct BgTokiHikari { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index d4ce3b2a2..242e667ea 100644 --- a/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx); -void BgTokiSwd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgTokiSwd_Update(Actor* thisx, GlobalContext* globalCtx); -void BgTokiSwd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgTokiSwd_Init(Actor* thisx, PlayState* play); +void BgTokiSwd_Destroy(Actor* thisx, PlayState* play); +void BgTokiSwd_Update(Actor* thisx, PlayState* play); +void BgTokiSwd_Draw(Actor* thisx, PlayState* play); -void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx); -void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx); -void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx); +void func_808BAF40(BgTokiSwd* this, PlayState* play); +void func_808BB0AC(BgTokiSwd* this, PlayState* play); +void func_808BB128(BgTokiSwd* this, PlayState* play); extern CutsceneData D_808BB2F0[]; extern CutsceneData D_808BB7A0[]; @@ -65,7 +65,7 @@ void BgTokiSwd_SetupAction(BgTokiSwd* this, BgTokiSwdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiSwd_Init(Actor* thisx, PlayState* play) { s32 pad; BgTokiSwd* this = (BgTokiSwd*)thisx; @@ -88,7 +88,7 @@ void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) { // don't give child link a kokiri sword if we don't have one uint32_t kokiriSwordBitMask = 1 << 0; if (!(gSaveContext.inventory.equipment & kokiriSwordBitMask)) { - Player* player = GET_PLAYER(gGlobalCtx); + Player* player = GET_PLAYER(gPlayState); player->currentSwordItem = ITEM_NONE; gSaveContext.equips.buttonItems[0] = ITEM_NONE; Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE); @@ -96,36 +96,36 @@ void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) { } if (gSaveContext.sceneSetupIndex == 5) { - globalCtx->roomCtx.unk_74[0] = 0xFF; + play->roomCtx.unk_74[0] = 0xFF; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); } -void BgTokiSwd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiSwd_Destroy(Actor* thisx, PlayState* play) { BgTokiSwd* this = (BgTokiSwd*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) { +void func_808BAF40(BgTokiSwd* this, PlayState* play) { if (((gSaveContext.eventChkInf[4] & 0x8000) == 0) && (gSaveContext.sceneSetupIndex < 4) && - Actor_IsFacingAndNearPlayer(&this->actor, 800.0f, 0x7530) && !Gameplay_InCsMode(globalCtx)) { + Actor_IsFacingAndNearPlayer(&this->actor, 800.0f, 0x7530) && !Play_InCsMode(play)) { gSaveContext.eventChkInf[4] |= 0x8000; - globalCtx->csCtx.segment = D_808BBD90; + play->csCtx.segment = D_808BBD90; gSaveContext.cutsceneTrigger = 1; } if (!LINK_IS_ADULT || (gSaveContext.eventChkInf[5] & 0x20 && !gSaveContext.n64ddFlag) || gSaveContext.n64ddFlag) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { if (!LINK_IS_ADULT) { - Item_Give(globalCtx, ITEM_SWORD_MASTER); - globalCtx->csCtx.segment = D_808BB2F0; + Item_Give(play, ITEM_SWORD_MASTER); + play->csCtx.segment = D_808BB2F0; } else { - globalCtx->csCtx.segment = D_808BB7A0; + play->csCtx.segment = D_808BB7A0; } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_MASTER_SWORD); @@ -133,27 +133,27 @@ void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) { this->actor.parent = NULL; BgTokiSwd_SetupAction(this, func_808BB0AC); } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (Actor_IsFacingPlayer(&this->actor, 0x2000) && (!gSaveContext.n64ddFlag || (gSaveContext.n64ddFlag && player->getItemId == GI_NONE))) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } if (gSaveContext.sceneSetupIndex == 5) { - if (globalCtx->roomCtx.unk_74[0] > 0) { - globalCtx->roomCtx.unk_74[0]--; + if (play->roomCtx.unk_74[0] > 0) { + play->roomCtx.unk_74[0]--; } else { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; } } } -void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx) { +void func_808BB0AC(BgTokiSwd* this, PlayState* play) { Player* player; // if sword has a parent it has been pulled/placed from the pedestal - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { if (!LINK_IS_ADULT) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_PUTAWAY_STN); this->actor.draw = NULL; // sword has been pulled, dont draw sword @@ -162,40 +162,40 @@ void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx) { } BgTokiSwd_SetupAction(this, func_808BB128); } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->interactRangeActor = &this->actor; } } -void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 1) && (globalCtx->roomCtx.unk_74[0] < 0xFF)) { - globalCtx->roomCtx.unk_74[0] += 5; +void func_808BB128(BgTokiSwd* this, PlayState* play) { + if (Flags_GetEnv(play, 1) && (play->roomCtx.unk_74[0] < 0xFF)) { + play->roomCtx.unk_74[0] += 5; } } -void BgTokiSwd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiSwd_Update(Actor* thisx, PlayState* play) { BgTokiSwd* this = (BgTokiSwd*)thisx; - this->actionFunc(this, globalCtx); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + this->actionFunc(this, play); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void BgTokiSwd_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgTokiSwd_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgTokiSwd* this = (BgTokiSwd*)thisx; s32 pad[3]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, -(globalCtx->gameplayFrames % 0x80), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TexScroll(play->state.gfxCtx, 0, -(play->gameplayFrames % 0x80), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_001BD0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h b/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h index 1891110e7..0a16201e6 100644 --- a/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h +++ b/soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h @@ -6,7 +6,7 @@ struct BgTokiSwd; -typedef void (*BgTokiSwdActionFunc)(struct BgTokiSwd*, GlobalContext*); +typedef void (*BgTokiSwdActionFunc)(struct BgTokiSwd*, PlayState*); typedef struct BgTokiSwd { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index 233b018c7..dbd4bc9f8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -10,19 +10,19 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx); -void BgTreemouth_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgTreemouth_Update(Actor* thisx, GlobalContext* globalCtx); -void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgTreemouth_Init(Actor* thisx, PlayState* play); +void BgTreemouth_Destroy(Actor* thisx, PlayState* play); +void BgTreemouth_Update(Actor* thisx, PlayState* play); +void BgTreemouth_Draw(Actor* thisx, PlayState* play); -void func_808BC65C(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC6F8(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC80C(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC864(BgTreemouth* this, GlobalContext* globalCtx); -void BgTreemouth_DoNothing(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC9EC(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BCAF0(BgTreemouth* this, GlobalContext* globalCtx); +void func_808BC65C(BgTreemouth* this, PlayState* play); +void func_808BC6F8(BgTreemouth* this, PlayState* play); +void func_808BC80C(BgTreemouth* this, PlayState* play); +void func_808BC864(BgTreemouth* this, PlayState* play); +void BgTreemouth_DoNothing(BgTreemouth* this, PlayState* play); +void func_808BC8B8(BgTreemouth* this, PlayState* play); +void func_808BC9EC(BgTreemouth* this, PlayState* play); +void func_808BCAF0(BgTreemouth* this, PlayState* play); extern CutsceneData D_808BCE20[]; extern CutsceneData D_808BD2A0[]; @@ -59,7 +59,7 @@ void BgTreemouth_SetupAction(BgTreemouth* this, BgTreemouthActionFunc actionFunc this->actionFunc = actionFunc; } -void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Init(Actor* thisx, PlayState* play) { s32 pad; BgTreemouth* this = (BgTreemouth*)thisx; CollisionHeader* colHeader = NULL; @@ -67,7 +67,7 @@ void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDekuTreeMouthCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); Actor_SetFocus(thisx, 50.0f); @@ -84,17 +84,17 @@ void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->textId = 0x905; } -void BgTreemouth_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Destroy(Actor* thisx, PlayState* play) { BgTreemouth* this = (BgTreemouth*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808BC65C(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC65C(BgTreemouth* this, PlayState* play) { CsCmdActorAction* npcAction; - if ((globalCtx->csCtx.state != CS_STATE_IDLE)) { - npcAction = globalCtx->csCtx.npcActions[0]; + if ((play->csCtx.state != CS_STATE_IDLE)) { + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { if (npcAction->action == 2) { BgTreemouth_SetupAction(this, func_808BC80C); @@ -106,7 +106,7 @@ void func_808BC65C(BgTreemouth* this, GlobalContext* globalCtx) { } } -void func_808BC6F8(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC6F8(BgTreemouth* this, PlayState* play) { Vec3f sp34; if (this->unk_168 < 1.0f) { @@ -115,30 +115,30 @@ void func_808BC6F8(BgTreemouth* this, GlobalContext* globalCtx) { this->unk_168 = 1.0f; } - if ((gSaveContext.sceneSetupIndex == 6) && (globalCtx->csCtx.frames >= 0x2BD) && - (globalCtx->state.frames % 8 == 0)) { + if ((gSaveContext.sceneSetupIndex == 6) && (play->csCtx.frames >= 0x2BD) && + (play->state.frames % 8 == 0)) { sp34.x = (Rand_ZeroOne() * 1158.0f) + 3407.0f; sp34.y = 970.0f; sp34.z = (Rand_ZeroOne() * 2026.0f) + -2163.0f; - EffectSsHahen_SpawnBurst(globalCtx, &sp34, 0.8f, 0, 50, 30, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &sp34, 0.8f, 0, 50, 30, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } } -void func_808BC80C(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC80C(BgTreemouth* this, PlayState* play) { this->unk_168 += 0.05f; if (this->unk_168 >= 0.8f) { BgTreemouth_SetupAction(this, func_808BC864); } } -void func_808BC864(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC864(BgTreemouth* this, PlayState* play) { this->unk_168 -= 0.03f; if (this->unk_168 <= 0.0f) { BgTreemouth_SetupAction(this, func_808BC65C); } } -void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC8B8(BgTreemouth* this, PlayState* play) { if ((!(Flags_GetEventChkInf(5))) || LINK_IS_ADULT) { if (!LINK_IS_ADULT) { if (Flags_GetEventChkInf(0xC)) { @@ -146,14 +146,14 @@ void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx) { this->dyna.actor.flags |= ACTOR_FLAG_0; if (this->dyna.actor.isTargeted) { this->dyna.actor.flags &= ~ACTOR_FLAG_0; - globalCtx->csCtx.segment = D_808BD2A0; + play->csCtx.segment = D_808BD2A0; gSaveContext.cutsceneTrigger = 1; BgTreemouth_SetupAction(this, func_808BC9EC); } } } else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 1658.0f, 0x4E20)) { Flags_SetEventChkInf(0xC); - globalCtx->csCtx.segment = D_808BCE20; + play->csCtx.segment = D_808BCE20; gSaveContext.cutsceneTrigger = 1; BgTreemouth_SetupAction(this, func_808BC9EC); } @@ -163,42 +163,42 @@ void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx) { } } -void func_808BC9EC(BgTreemouth* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808BC9EC(BgTreemouth* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { + if (play->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 350.0f, 0x7530)) { player->actor.world.pos.x = 3827.0f; player->actor.world.pos.y = -161.0f; player->actor.world.pos.z = -1142.0f; } - globalCtx->csCtx.frames = 0; - globalCtx->csCtx.unk_18 = 0xFFFF; + play->csCtx.frames = 0; + play->csCtx.unk_18 = 0xFFFF; D_8015FCC0 = 0xFFFF; D_8015FCC2 = 0xFFFF; D_8015FCC4 = 0xFFFF; - globalCtx->csCtx.unk_1A = 0; - globalCtx->csCtx.unk_1B = 0; - globalCtx->csCtx.state = CS_STATE_SKIPPABLE_EXEC; + play->csCtx.unk_1A = 0; + play->csCtx.unk_1B = 0; + play->csCtx.state = CS_STATE_SKIPPABLE_EXEC; - if (globalCtx->msgCtx.choiceIndex == 0) { - globalCtx->csCtx.segment = D_808BD520; + if (play->msgCtx.choiceIndex == 0) { + play->csCtx.segment = D_808BD520; Flags_SetEventChkInf(5); BgTreemouth_SetupAction(this, func_808BCAF0); } else { - globalCtx->csCtx.segment = D_808BD790; - globalCtx->csCtx.frames = 0; + play->csCtx.segment = D_808BD790; + play->csCtx.frames = 0; BgTreemouth_SetupAction(this, func_808BC8B8); } } } -void func_808BCAF0(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BCAF0(BgTreemouth* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[0]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { if (npcAction->action == 2) { BgTreemouth_SetupAction(this, func_808BC80C); @@ -210,27 +210,27 @@ void func_808BCAF0(BgTreemouth* this, GlobalContext* globalCtx) { } } -void BgTreemouth_DoNothing(BgTreemouth* this, GlobalContext* globalCtx) { +void BgTreemouth_DoNothing(BgTreemouth* this, PlayState* play) { } -void BgTreemouth_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Update(Actor* thisx, PlayState* play) { BgTreemouth* this = (BgTreemouth*)thisx; f32 unk_168; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); unk_168 = this->unk_168; thisx->world.pos.x = (unk_168 * -160.0f) + 4029.0f; thisx->world.pos.y = (unk_168 * -399.0f) + 136.0f; thisx->world.pos.z = (unk_168 * 92.0f) + -1255.0f; } -void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Draw(Actor* thisx, PlayState* play) { s32 pad; u16 alpha = 500; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) { if (gSaveContext.eventChkInf[0] & 0x80) { @@ -240,13 +240,13 @@ void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (gSaveContext.sceneSetupIndex == 6) { - alpha = (globalCtx->roomCtx.unk_74[0] + 0x1F4); + alpha = (play->roomCtx.unk_74[0] + 0x1F4); } gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, alpha * 0.1f); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuTreeMouthDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h b/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h index 7c704067e..dc5a5f545 100644 --- a/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h +++ b/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h @@ -6,7 +6,7 @@ struct BgTreemouth; -typedef void (*BgTreemouthActionFunc)(struct BgTreemouth*, GlobalContext*); +typedef void (*BgTreemouthActionFunc)(struct BgTreemouth*, PlayState*); typedef struct BgTreemouth { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/soh/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index d5be5da71..f70d8c416 100644 --- a/soh/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/soh/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx); -void BgUmaJump_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgUmaJump_Update(Actor* thisx, GlobalContext* globalCtx); -void BgUmaJump_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgUmaJump_Init(Actor* thisx, PlayState* play); +void BgUmaJump_Destroy(Actor* thisx, PlayState* play); +void BgUmaJump_Update(Actor* thisx, PlayState* play); +void BgUmaJump_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Umajump_InitVars = { ACTOR_BG_UMAJUMP, @@ -31,7 +31,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgUmaJump_Init(Actor* thisx, PlayState* play) { s32 pad; BgUmaJump* this = (BgUmaJump*)thisx; CollisionHeader* colHeader = NULL; @@ -39,7 +39,7 @@ void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gJumpableHorseFenceCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == 1) { if (!Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) { @@ -50,15 +50,15 @@ void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgUmaJump_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgUmaJump_Destroy(Actor* thisx, PlayState* play) { BgUmaJump* this = (BgUmaJump*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgUmaJump_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgUmaJump_Update(Actor* thisx, PlayState* play) { } -void BgUmaJump_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gJumpableHorseFenceDL); +void BgUmaJump_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gJumpableHorseFenceDL); } diff --git a/soh/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c b/soh/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c index 8da5bcc0d..70a58df6e 100644 --- a/soh/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c +++ b/soh/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c @@ -10,10 +10,10 @@ #define FLAGS 0 -void BgVbSima_Init(Actor* thisx, GlobalContext* globalCtx); -void BgVbSima_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx); -void BgVbSima_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgVbSima_Init(Actor* thisx, PlayState* play); +void BgVbSima_Destroy(Actor* thisx, PlayState* play); +void BgVbSima_Update(Actor* thisx, PlayState* play); +void BgVbSima_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Vb_Sima_InitVars = { ACTOR_BG_VB_SIMA, @@ -32,7 +32,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgVbSima_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgVbSima_Init(Actor* thisx, PlayState* play) { s32 pad; BgVbSima* this = (BgVbSima*)thisx; CollisionHeader* colHeader = NULL; @@ -40,14 +40,14 @@ void BgVbSima_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gVolvagiaPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgVbSima_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgVbSima_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgVbSima* this = (BgVbSima*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgVbSima_SpawnEmber(BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { @@ -67,7 +67,7 @@ void BgVbSima_SpawnEmber(BossFdEffect* effect, Vec3f* position, Vec3f* velocity, } } -void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgVbSima_Update(Actor* thisx, PlayState* play) { static Color_RGBA8 colorYellow = { 255, 255, 0, 255 }; static Color_RGBA8 colorRed = { 255, 10, 0, 255 }; s32 pad; @@ -76,7 +76,7 @@ void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { f32 minus1 = -1.0f; this->shakeTimer++; - if (!Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (!Flags_GetClear(play, play->roomCtx.curRoom.num)) { s32 signal = bossFd->platformSignal; if (signal == VBSIMA_COLLAPSE) { @@ -125,7 +125,7 @@ void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { splashPos.y = -80.0f; splashPos.z = this->dyna.actor.world.pos.z + edgeZ; - func_8002836C(globalCtx, &splashPos, &splashVel, &splashAcc, &colorYellow, &colorRed, + func_8002836C(play, &splashPos, &splashVel, &splashAcc, &colorYellow, &colorRed, (s16)Rand_ZeroFloat(100.0f) + 500, 10, 20); for (i2 = 0; i2 < 3; i2++) { @@ -149,11 +149,11 @@ void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgVbSima_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), +void BgVbSima_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(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++, gVolvagiaPlatformDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index 5971c3c18..f74bdecc9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx); -void BgYdanHasi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgYdanHasi_Update(Actor* thisx, GlobalContext* globalCtx); -void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgYdanHasi_Init(Actor* thisx, PlayState* play); +void BgYdanHasi_Destroy(Actor* thisx, PlayState* play); +void BgYdanHasi_Update(Actor* thisx, PlayState* play); +void BgYdanHasi_Draw(Actor* thisx, PlayState* play); -void BgYdanHasi_InitWater(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_MoveWater(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx); +void BgYdanHasi_InitWater(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_MoveWater(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, PlayState* play); const ActorInit Bg_Ydan_Hasi_InitVars = { ACTOR_BG_YDAN_HASI, @@ -38,7 +38,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Init(Actor* thisx, PlayState* play) { s32 pad; BgYdanHasi* this = (BgYdanHasi*)thisx; CollisionHeader* colHeader = NULL; @@ -47,7 +47,7 @@ void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); this->type = ((thisx->params >> 8) & 0x3F); thisx->params = thisx->params & 0xFF; - waterBox = &globalCtx->colCtx.colHeader->waterBoxes[1]; + waterBox = &play->colCtx.colHeader->waterBoxes[1]; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); if (thisx->params == HASI_WATER) { // Water the moving platform floats on in B1. Never runs in Master Quest @@ -68,27 +68,27 @@ void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgYdanHasi_SetupThreeBlocks; Actor_SetFocus(&this->dyna.actor, 40.0f); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } this->timer = 0; } -void BgYdanHasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Destroy(Actor* thisx, PlayState* play) { BgYdanHasi* this = (BgYdanHasi*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, PlayState* play) { WaterBox* waterBox; f32 framesAfterMath; - framesAfterMath = sinf((globalCtx->gameplayFrames & 0xFF) * (M_PI / 128)) * 165.0f; + framesAfterMath = sinf((play->gameplayFrames & 0xFF) * (M_PI / 128)) * 165.0f; this->dyna.actor.world.pos.x = ((Math_SinS(this->dyna.actor.world.rot.y) * framesAfterMath) + this->dyna.actor.home.pos.x); this->dyna.actor.world.pos.z = ((Math_CosS(this->dyna.actor.world.rot.y) * framesAfterMath) + this->dyna.actor.home.pos.z); - waterBox = &globalCtx->colCtx.colHeader->waterBoxes[1]; + waterBox = &play->colCtx.colHeader->waterBoxes[1]; this->dyna.actor.world.pos.y = waterBox->ySurface + 20.0f; if (this->timer != 0) { this->timer--; @@ -99,19 +99,19 @@ void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, GlobalContext* globalCtx) this->dyna.actor.world.pos.y += 2.0f * sinf(this->timer * (M_PI / 25)); } -void BgYdanHasi_InitWater(BgYdanHasi* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->type)) { +void BgYdanHasi_InitWater(BgYdanHasi* this, PlayState* play) { + if (Flags_GetSwitch(play, this->type)) { this->timer = 600; this->actionFunc = BgYdanHasi_MoveWater; } } -void BgYdanHasi_MoveWater(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_MoveWater(BgYdanHasi* this, PlayState* play) { WaterBox* waterBox; if (this->timer == 0) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f) != 0) { - Flags_UnsetSwitch(globalCtx, this->type); + Flags_UnsetSwitch(play, this->type); this->actionFunc = BgYdanHasi_InitWater; } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); @@ -121,11 +121,11 @@ void BgYdanHasi_MoveWater(BgYdanHasi* this, GlobalContext* globalCtx) { } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } - waterBox = &globalCtx->colCtx.colHeader->waterBoxes[1]; + waterBox = &play->colCtx.colHeader->waterBoxes[1]; waterBox->ySurface = this->dyna.actor.world.pos.y; } -void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -135,22 +135,22 @@ void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, GlobalContext* globalCtx) { } } -void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->type)) { +void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, PlayState* play) { + if (Flags_GetSwitch(play, this->type)) { this->timer = 260; this->dyna.actor.draw = BgYdanHasi_Draw; this->actionFunc = BgYdanHasi_UpdateThreeBlocks; - OnePointCutscene_Init(globalCtx, 3040, 30, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3040, 30, &this->dyna.actor, MAIN_CAM); } } -void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.0f) != 0) { - Flags_UnsetSwitch(globalCtx, this->type); + Flags_UnsetSwitch(play, this->type); this->dyna.actor.draw = NULL; this->actionFunc = BgYdanHasi_SetupThreeBlocks; } else { @@ -164,30 +164,30 @@ void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) { } } -void BgYdanHasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Update(Actor* thisx, PlayState* play) { BgYdanHasi* this = (BgYdanHasi*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gDTSlidingPlatformDL, gDTWaterPlaneDL, gDTRisingPlatformsDL }; BgYdanHasi* this = (BgYdanHasi*)thisx; if (this->dyna.actor.params == HASI_WATER_BLOCK || this->dyna.actor.params == HASI_THREE_BLOCKS) { - Gfx_DrawDListOpa(globalCtx, dLists[this->dyna.actor.params]); + Gfx_DrawDListOpa(play, dLists[this->dyna.actor.params]); } else { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->gameplayFrames % 128, - globalCtx->gameplayFrames % 128, 0x20, 0x20, 1, globalCtx->gameplayFrames % 128, - globalCtx->gameplayFrames % 128, 0x20, 0x20)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->gameplayFrames % 128, + play->gameplayFrames % 128, 0x20, 0x20, 1, play->gameplayFrames % 128, + play->gameplayFrames % 128, 0x20, 0x20)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTWaterPlaneDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h b/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h index 4ffe1fad4..63105ab48 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h @@ -6,7 +6,7 @@ struct BgYdanHasi; -typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, GlobalContext*); +typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, PlayState*); typedef struct BgYdanHasi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 945c053ae..9a38cfa5e 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx); -void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgYdanMaruta_Update(Actor* thisx, GlobalContext* globalCtx); -void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgYdanMaruta_Init(Actor* thisx, PlayState* play); +void BgYdanMaruta_Destroy(Actor* thisx, PlayState* play); +void BgYdanMaruta_Update(Actor* thisx, PlayState* play); +void BgYdanMaruta_Draw(Actor* thisx, PlayState* play); -void func_808BEFF4(BgYdanMaruta* this, GlobalContext* globalCtx); -void BgYdanMaruta_DoNothing(BgYdanMaruta* this, GlobalContext* globalCtx); -void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx); -void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx); -void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx); +void func_808BEFF4(BgYdanMaruta* this, PlayState* play); +void BgYdanMaruta_DoNothing(BgYdanMaruta* this, PlayState* play); +void func_808BF078(BgYdanMaruta* this, PlayState* play); +void func_808BF108(BgYdanMaruta* this, PlayState* play); +void func_808BF1EC(BgYdanMaruta* this, PlayState* play); const ActorInit Bg_Ydan_Maruta_InitVars = { ACTOR_BG_YDAN_MARUTA, @@ -75,7 +75,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Init(Actor* thisx, PlayState* play) { s32 pad; BgYdanMaruta* this = (BgYdanMaruta*)thisx; Vec3f sp4C[3]; @@ -86,8 +86,8 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { ColliderTrisElementInit* triInit; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->elements); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->elements); this->switchFlag = this->dyna.actor.params & 0xFFFF; thisx->params = (thisx->params >> 8) & 0xFF; // thisx is required to match here @@ -99,9 +99,9 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { triInit = &sTrisElementsInit[1]; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDTFallingLadderCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); thisx->home.pos.y += -280.0f; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { thisx->world.pos.y = thisx->home.pos.y; this->actionFunc = BgYdanMaruta_DoNothing; } else { @@ -127,37 +127,37 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetTrisVertices(&this->collider, 1, &sp4C[0], &sp4C[2], &sp4C[1]); } -void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Destroy(Actor* thisx, PlayState* play) { BgYdanMaruta* this = (BgYdanMaruta*)thisx; - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); if (this->dyna.actor.params == 1) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void func_808BEFF4(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BEFF4(BgYdanMaruta* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { - func_8002F71C(globalCtx, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f); + func_8002F71C(play, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f); } this->dyna.actor.shape.rot.x += 0x360; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_TOGE_STICK_ROLLING - SFX_FLAG); } -void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BF078(BgYdanMaruta* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->unk_16A = 20; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_808BF108; - OnePointCutscene_Init(globalCtx, 3010, 50, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3010, 50, &this->dyna.actor, MAIN_CAM); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BF108(BgYdanMaruta* this, PlayState* play) { s16 temp; if (this->unk_16A != 0) { @@ -180,7 +180,7 @@ void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG); } -void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BF1EC(BgYdanMaruta* this, PlayState* play) { this->dyna.actor.velocity.y += 1.0f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_LADDER_DOUND); @@ -188,21 +188,21 @@ void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx) { } } -void BgYdanMaruta_DoNothing(BgYdanMaruta* this, GlobalContext* globalCtx) { +void BgYdanMaruta_DoNothing(BgYdanMaruta* this, PlayState* play) { } -void BgYdanMaruta_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Update(Actor* thisx, PlayState* play) { BgYdanMaruta* this = (BgYdanMaruta*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Draw(Actor* thisx, PlayState* play) { BgYdanMaruta* this = (BgYdanMaruta*)thisx; if (this->dyna.actor.params == 0) { - Gfx_DrawDListOpa(globalCtx, gDTRollingSpikeTrapDL); + Gfx_DrawDListOpa(play, gDTRollingSpikeTrapDL); } else { - Gfx_DrawDListOpa(globalCtx, gDTFallingLadderDL); + Gfx_DrawDListOpa(play, gDTFallingLadderDL); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h b/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h index 48aeb5df8..72b753b83 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h @@ -6,7 +6,7 @@ struct BgYdanMaruta; -typedef void (*BgYdanMarutaActionFunc)(struct BgYdanMaruta*, GlobalContext*); +typedef void (*BgYdanMarutaActionFunc)(struct BgYdanMaruta*, PlayState*); typedef struct BgYdanMaruta { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index a375ea7d3..a261b39b5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx); -void BgYdanSp_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgYdanSp_Update(Actor* thisx, GlobalContext* globalCtx); -void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgYdanSp_Init(Actor* thisx, PlayState* play); +void BgYdanSp_Destroy(Actor* thisx, PlayState* play); +void BgYdanSp_Update(Actor* thisx, PlayState* play); +void BgYdanSp_Draw(Actor* thisx, PlayState* play); -void BgYdanSp_BurnFloorWeb(BgYdanSp* this, GlobalContext* globalCtx); -void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx); -void BgYdanSp_BurnWallWeb(BgYdanSp* this, GlobalContext* globalCtx); -void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx); +void BgYdanSp_BurnFloorWeb(BgYdanSp* this, PlayState* play); +void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play); +void BgYdanSp_BurnWallWeb(BgYdanSp* this, PlayState* play); +void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play); //extern CollisionHeader gDTWebWallCol; @@ -81,7 +81,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Init(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; ColliderTrisElementInit* ti0 = &sTrisItemsInit[0]; Vec3f tri[3]; @@ -98,8 +98,8 @@ void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) { this->burnSwitchFlag = (thisx->params >> 6) & 0x3F; this->dyna.actor.params = (thisx->params >> 0xC) & 0xF; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); - Collider_InitTris(globalCtx, &this->trisCollider); - Collider_SetTris(globalCtx, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems); + Collider_InitTris(play, &this->trisCollider); + Collider_SetTris(play, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems); if (this->dyna.actor.params == WEB_FLOOR) { CollisionHeader_GetVirtual(&gDTWebFloorCol, &colHeader); this->actionFunc = BgYdanSp_FloorWebIdle; @@ -139,17 +139,17 @@ void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) { tri[1].z = this->dyna.actor.world.pos.z - (sinsY * ti1->dim.vtx[0].x) + (ti1->dim.vtx[2].y * cossY * nSinsX); Collider_SetTrisVertices(&this->trisCollider, 1, &tri[0], &tri[2], &tri[1]); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->timer = 0; - if (Flags_GetSwitch(globalCtx, this->isDestroyedSwitchFlag)) { + if (Flags_GetSwitch(play, this->isDestroyedSwitchFlag)) { Actor_Kill(&this->dyna.actor); } } -void BgYdanSp_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Destroy(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->trisCollider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->trisCollider); } void BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) { @@ -169,11 +169,11 @@ void BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) { colHeader->vtxList[0].y = newY; } -void BgYdanSp_BurnWeb(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_BurnWeb(BgYdanSp* this, PlayState* play) { this->timer = 30; this = this; func_80078884(NA_SE_SY_CORRECT_CHIME); - Flags_SetSwitch(globalCtx, this->isDestroyedSwitchFlag); + Flags_SetSwitch(play, this->isDestroyedSwitchFlag); if (this->dyna.actor.params == WEB_FLOOR) { this->actionFunc = BgYdanSp_BurnFloorWeb; } else { @@ -181,7 +181,7 @@ void BgYdanSp_BurnWeb(BgYdanSp* this, GlobalContext* globalCtx) { } } -void BgYdanSp_BurnFloorWeb(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_BurnFloorWeb(BgYdanSp* this, PlayState* play) { static Vec3f accel = { 0 }; Vec3f velocity; Vec3f pos2; @@ -222,14 +222,14 @@ void BgYdanSp_BurnFloorWeb(BgYdanSp* this, GlobalContext* globalCtx) { velocity.x = (7.0f * sins) * distXZ; velocity.y = 0.0f; velocity.z = (7.0f * coss) * distXZ; - EffectSsDeadDb_Spawn(globalCtx, &this->dyna.actor.home.pos, &velocity, &accel, 60, 6, 255, 255, 150, 170, + EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &velocity, &accel, 60, 6, 255, 255, 150, 170, 255, 0, 0, 1, 0xE, 1); rot2 += 0x2AAA; } } } -void BgYdanSp_FloorWebBroken(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_FloorWebBroken(BgYdanSp* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -239,7 +239,7 @@ void BgYdanSp_FloorWebBroken(BgYdanSp* this, GlobalContext* globalCtx) { } } -void BgYdanSp_FloorWebBreaking(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_FloorWebBreaking(BgYdanSp* this, PlayState* play) { static Color_RGBA8 primColor = { 250, 250, 250, 255 }; static Color_RGBA8 envColor = { 180, 180, 180, 255 }; static Vec3f zeroVec = { 0 }; @@ -253,17 +253,17 @@ void BgYdanSp_FloorWebBreaking(BgYdanSp* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = (sinf((f32)this->timer * (M_PI / 20)) * this->unk_16C) + this->dyna.actor.home.pos.y; if (this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 190.0f) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->timer = 40; func_80078884(NA_SE_SY_CORRECT_CHIME); - Flags_SetSwitch(globalCtx, this->isDestroyedSwitchFlag); + Flags_SetSwitch(play, this->isDestroyedSwitchFlag); this->actionFunc = BgYdanSp_FloorWebBroken; pos.y = this->dyna.actor.world.pos.y - 60.0f; rot = 0; for (i = 0; i < 6; i++) { pos.x = Math_SinS(rot) * 60.0f + this->dyna.actor.world.pos.x; pos.z = Math_CosS(rot) * 60.0f + this->dyna.actor.world.pos.z; - func_8002829C(globalCtx, &pos, &zeroVec, &zeroVec, &primColor, &envColor, 1000, 10); + func_8002829C(play, &pos, &zeroVec, &zeroVec, &primColor, &envColor, 1000, 10); rot += 0x2AAA; } @@ -271,24 +271,24 @@ void BgYdanSp_FloorWebBreaking(BgYdanSp* this, GlobalContext* globalCtx) { BgYdanSp_UpdateFloorWebCollision(this); } -void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) { Player* player; Vec3f webPos; f32 sqrtFallDistance; f32 unk; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); webPos.x = this->dyna.actor.world.pos.x; webPos.y = this->dyna.actor.world.pos.y - 50.0f; webPos.z = this->dyna.actor.world.pos.z; - if (Player_IsBurningStickInRange(globalCtx, &webPos, 70.0f, 50.0f) != 0) { + if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f) != 0) { this->dyna.actor.home.pos.x = player->swordInfo[0].tip.x; this->dyna.actor.home.pos.z = player->swordInfo[0].tip.z; - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); return; } if ((this->trisCollider.base.acFlags & 2) != 0) { - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); return; } if (func_8004356C(&this->dyna)) { @@ -338,10 +338,10 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { } } BgYdanSp_UpdateFloorWebCollision(this); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->trisCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->trisCollider.base); } -void BgYdanSp_BurnWallWeb(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_BurnWallWeb(BgYdanSp* this, PlayState* play) { static Vec3f accel = { 0 }; Vec3f velocity; Vec3f spC8; @@ -387,47 +387,47 @@ void BgYdanSp_BurnWallWeb(BgYdanSp* this, GlobalContext* globalCtx) { velocity.x = 6.5f * coss2 * distXYZ; velocity.y = 6.5f * coss * distXYZ; velocity.z = -6.5f * sins * distXYZ; - EffectSsDeadDb_Spawn(globalCtx, &this->dyna.actor.home.pos, &velocity, &accel, 80, 6, 255, 255, 150, 170, + EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &velocity, &accel, 80, 6, 255, 255, 150, 170, 255, 0, 0, 1, 0xE, 1); rot2 += 0x2AAA; } } } -void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) { Player* player; Vec3f sp30; - player = GET_PLAYER(globalCtx); - if (Flags_GetSwitch(globalCtx, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & 2)) { + player = GET_PLAYER(play); + if (Flags_GetSwitch(play, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & 2)) { this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f; - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); } else if (player->heldItemActionParam == PLAYER_AP_STICK && player->unk_860 != 0) { func_8002DBD0(&this->dyna.actor, &sp30, &player->swordInfo[0].tip); if (fabsf(sp30.x) < 100.0f && sp30.z < 1.0f && sp30.y < 200.0f) { - OnePointCutscene_Init(globalCtx, 3020, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 3020, 40, &this->dyna.actor, MAIN_CAM); Math_Vec3f_Copy(&this->dyna.actor.home.pos, &player->swordInfo[0].tip); - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); } } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->trisCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->trisCollider.base); } -void BgYdanSp_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Update(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Draw(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; s32 i; MtxF mtxF; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (thisx->params == WEB_WALL) { - 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++, gDTWebWallDL); } else if (this->actionFunc == BgYdanSp_FloorWebBroken) { @@ -435,7 +435,7 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->timer == 40) { Matrix_Translate(0.0f, (thisx->home.pos.y - thisx->world.pos.y) * 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(1.0f, ((thisx->home.pos.y - thisx->world.pos.y) + 10.0f) * 0.1f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTWebFloorDL); } @@ -444,17 +444,17 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZYX(-0x5A0, i * 0x2000, 0, MTXMODE_APPLY); Matrix_Translate(0.0f, 700.0f, -900.0f, MTXMODE_APPLY); Matrix_Scale(3.5f, 5.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTUnknownWebDL); } } else { Matrix_Translate(0.0f, (thisx->home.pos.y - thisx->world.pos.y) * 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(1.0f, ((thisx->home.pos.y - thisx->world.pos.y) + 10.0f) * 0.1f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTWebFloorDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h index 9d0a000a0..e134ac6f2 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h @@ -6,7 +6,7 @@ struct BgYdanSp; -typedef void (*BgYdanSpActionFunc)(struct BgYdanSp*, GlobalContext*); +typedef void (*BgYdanSpActionFunc)(struct BgYdanSp*, PlayState*); typedef struct BgYdanSp { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 4f16517de..0703debd9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -10,17 +10,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgZg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgZg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgZg_Update(Actor* thisx, GlobalContext* globalCtx); -void BgZg_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgZg_Init(Actor* thisx, PlayState* play); +void BgZg_Destroy(Actor* thisx, PlayState* play); +void BgZg_Update(Actor* thisx, PlayState* play); +void BgZg_Draw(Actor* thisx, PlayState* play); void func_808C0C50(BgZg* this); -s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx); +s32 func_808C0C98(BgZg* this, PlayState* play); s32 func_808C0CC8(BgZg* this); -void func_808C0CD4(BgZg* this, GlobalContext* globalCtx); -void func_808C0D08(BgZg* this, GlobalContext* globalCtx); -void func_808C0EEC(BgZg* this, GlobalContext* globalCtx); +void func_808C0CD4(BgZg* this, PlayState* play); +void func_808C0D08(BgZg* this, PlayState* play); +void func_808C0EEC(BgZg* this, PlayState* play); static BgZgActionFunc sActionFuncs[] = { func_808C0CD4, @@ -48,10 +48,10 @@ const ActorInit Bg_Zg_InitVars = { NULL, }; -void BgZg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Destroy(Actor* thisx, PlayState* play) { BgZg* this = (BgZg*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808C0C50(BgZg* this) { @@ -59,10 +59,10 @@ void func_808C0C50(BgZg* this) { &D_801333E8); } -s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx) { +s32 func_808C0C98(BgZg* this, PlayState* play) { s32 flag = (this->dyna.actor.params >> 8) & 0xFF; - return Flags_GetSwitch(globalCtx, flag); + return Flags_GetSwitch(play, flag); } s32 func_808C0CC8(BgZg* this) { @@ -71,21 +71,21 @@ s32 func_808C0CC8(BgZg* this) { return flag; } -void func_808C0CD4(BgZg* this, GlobalContext* globalCtx) { - if (func_808C0C98(this, globalCtx) != 0) { +void func_808C0CD4(BgZg* this, PlayState* play) { + if (func_808C0C98(this, play) != 0) { this->action = 1; func_808C0C50(this); } } -void func_808C0D08(BgZg* this, GlobalContext* globalCtx) { +void func_808C0D08(BgZg* this, PlayState* play) { this->dyna.actor.world.pos.y += (kREG(16) + 20.0f) * 1.2f; if ((((kREG(17) + 200.0f) * 1.2f) + this->dyna.actor.home.pos.y) <= this->dyna.actor.world.pos.y) { Actor_Kill(&this->dyna.actor); } } -void BgZg_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Update(Actor* thisx, PlayState* play) { BgZg* this = (BgZg*)thisx; s32 action = this->action; @@ -93,11 +93,11 @@ void BgZg_Update(Actor* thisx, GlobalContext* globalCtx) { // "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[action](this, globalCtx); + sActionFuncs[action](this, play); } } -void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Init(Actor* thisx, PlayState* play) { s32 pad[2]; BgZg* this = (BgZg*)thisx; CollisionHeader* colHeader; @@ -106,7 +106,7 @@ void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); colHeader = NULL; CollisionHeader_GetVirtual(&gTowerCollapseBarsCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) { this->dyna.actor.scale.x = this->dyna.actor.scale.x * 1.3f; this->dyna.actor.scale.z = this->dyna.actor.scale.z * 1.3f; @@ -115,13 +115,13 @@ void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { this->action = 0; this->drawConfig = 0; - if (func_808C0C98(this, globalCtx)) { + if (func_808C0C98(this, play)) { Actor_Kill(&this->dyna.actor); } } -void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) { - GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; +void func_808C0EEC(BgZg* this, PlayState* play) { + GraphicsContext* localGfxCtx = play->state.gfxCtx; OPEN_DISPS(localGfxCtx); @@ -133,7 +133,7 @@ void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) { CLOSE_DISPS(localGfxCtx); } -void BgZg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Draw(Actor* thisx, PlayState* play) { BgZg* this = (BgZg*)thisx; s32 drawConfig = this->drawConfig; @@ -141,6 +141,6 @@ void BgZg_Draw(Actor* thisx, GlobalContext* globalCtx) { // "Drawing mode is wrong !!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sDrawFuncs[drawConfig](this, globalCtx); + sDrawFuncs[drawConfig](this, play); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h b/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h index 63cf24ea5..a5355defd 100644 --- a/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h +++ b/soh/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h @@ -6,8 +6,8 @@ struct BgZg; -typedef void (*BgZgActionFunc)(struct BgZg*, GlobalContext*); -typedef void (*BgZgDrawFunc)(struct BgZg*, GlobalContext*); +typedef void (*BgZgActionFunc)(struct BgZg*, PlayState*); +typedef void (*BgZgDrawFunc)(struct BgZg*, PlayState*); typedef struct BgZg { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 70b338fea..74ae077e3 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -6,33 +6,33 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BossDodongo_Init(Actor* thisx, GlobalContext* globalCtx); -void BossDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx); -void BossDodongo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossDodongo_Init(Actor* thisx, PlayState* play); +void BossDodongo_Destroy(Actor* thisx, PlayState* play); +void BossDodongo_Update(Actor* thisx, PlayState* play); +void BossDodongo_Draw(Actor* thisx, PlayState* play); -void BossDodongo_SetupIntroCutscene(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Inhale(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_SpawnFire(BossDodongo* this, GlobalContext* globalCtx, s16 arg2); -void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_LayDown(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Vulnerable(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_GetUp(BossDodongo* this, GlobalContext* globalCtx); +void BossDodongo_SetupIntroCutscene(BossDodongo* this, PlayState* play); +void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play); +void BossDodongo_Walk(BossDodongo* this, PlayState* play); +void BossDodongo_Inhale(BossDodongo* this, PlayState* play); +void BossDodongo_BlowFire(BossDodongo* this, PlayState* play); +void BossDodongo_Roll(BossDodongo* this, PlayState* play); +void BossDodongo_SpawnFire(BossDodongo* this, PlayState* play, s16 arg2); +void BossDodongo_Explode(BossDodongo* this, PlayState* play); +void BossDodongo_LayDown(BossDodongo* this, PlayState* play); +void BossDodongo_Vulnerable(BossDodongo* this, PlayState* play); +void BossDodongo_GetUp(BossDodongo* this, PlayState* play); void BossDodongo_SetupWalk(BossDodongo* this); -void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx); +void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play); void BossDodongo_SetupDeathCutscene(BossDodongo* this); -void BossDodongo_Damaged(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_UpdateDamage(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_PlayerPosCheck(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_PlayerYawCheck(BossDodongo* this, GlobalContext* globalCtx); -f32 func_808C4F6C(BossDodongo* this, GlobalContext* globalCtx); -f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_DrawEffects(GlobalContext* globalCtx); -void BossDodongo_UpdateEffects(GlobalContext* globalCtx); +void BossDodongo_Damaged(BossDodongo* this, PlayState* play); +void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play); +void BossDodongo_PlayerPosCheck(BossDodongo* this, PlayState* play); +void BossDodongo_PlayerYawCheck(BossDodongo* this, PlayState* play); +f32 func_808C4F6C(BossDodongo* this, PlayState* play); +f32 func_808C50A8(BossDodongo* this, PlayState* play); +void BossDodongo_DrawEffects(PlayState* play); +void BossDodongo_UpdateEffects(PlayState* play); const ActorInit Boss_Dodongo_InitVars = { ACTOR_EN_DODONGO, @@ -145,9 +145,9 @@ void func_808C1554(void* arg0, void* floorTex, s32 arg2, f32 arg3) { } } -void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5) { +void func_808C17C8(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5) { s16 i; - BossDodongoEffect* eff = (BossDodongoEffect*)globalCtx->specialEffects; + BossDodongoEffect* eff = (BossDodongoEffect*)play->specialEffects; for (i = 0; i < arg5; i++, eff++) { if (eff->unk_24 == 0) { @@ -164,11 +164,11 @@ void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar } } -s32 BossDodongo_AteExplosive(BossDodongo* this, GlobalContext* globalCtx) { +s32 BossDodongo_AteExplosive(BossDodongo* this, PlayState* play) { f32 dx; f32 dy; f32 dz; - Actor* currentExplosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + Actor* currentExplosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; Actor* thisx = &this->actor; while (currentExplosive != NULL) { @@ -192,41 +192,41 @@ s32 BossDodongo_AteExplosive(BossDodongo* this, GlobalContext* globalCtx) { return false; } -void BossDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossDodongo_Init(Actor* thisx, PlayState* play) { BossDodongo* this = (BossDodongo*)thisx; s16 i; u16* temp_s1_3; u16* temp_s2; u32 temp_v0; - globalCtx->specialEffects = &this->effects; + play->specialEffects = &this->effects; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 9200.0f, ActorShadow_DrawCircle, 250.0f); Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_kingdodongo_Skel_01B310, &object_kingdodongo_Anim_00F0D8, NULL, + SkelAnime_Init(play, &this->skelAnime, &object_kingdodongo_Skel_01B310, &object_kingdodongo_Anim_00F0D8, NULL, NULL, 0); Animation_PlayLoop(&this->skelAnime, &object_kingdodongo_Anim_00F0D8); this->unk_1F8 = 1.0f; - BossDodongo_SetupIntroCutscene(this, globalCtx); + BossDodongo_SetupIntroCutscene(this, play); this->health = 12; this->colorFilterMin = 995.0f; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->colorFilterMax = 1000.0f; this->unk_224 = 2.0f; this->unk_228 = 9200.0f; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->items); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->items); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { // KD is dead + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // KD is dead u16* LavaFloorTex = ResourceMgr_LoadTexByName(gDodongosCavernBossLavaFloorTex); u16* LavaFloorRockTex = ResourceMgr_LoadTexByName(sLavaFloorRockTex); temp_s1_3 = SEGMENTED_TO_VIRTUAL(LavaFloorTex); temp_s2 = SEGMENTED_TO_VIRTUAL(LavaFloorRockTex); Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, WARP_DUNGEON_CHILD); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, 0x6000); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -690.0f, -1523.76f, -3304.0f, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, 0x6000); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -690.0f, -1523.76f, -3304.0f, 0, 0, 0, 0); for (i = 0; i < 2048; i++) { temp_v0 = i; @@ -237,14 +237,14 @@ void BossDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; } -void BossDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossDodongo_Destroy(Actor* thisx, PlayState* play) { BossDodongo* this = (BossDodongo*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->collider); } -void BossDodongo_SetupIntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_SetupIntroCutscene(BossDodongo* this, PlayState* play) { s16 frames = Animation_GetLastFrame(&object_kingdodongo_Anim_00F0D8); Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_00F0D8, 1.0f, 0.0f, frames, ANIMMODE_LOOP, -10.0f); @@ -253,7 +253,7 @@ void BossDodongo_SetupIntroCutscene(BossDodongo* this, GlobalContext* globalCtx) this->unk_1BC = 1; } -void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play) { f32 phi_f0; Camera* camera; Player* player; @@ -261,8 +261,8 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { Vec3f sp54; Vec3f sp48; - player = GET_PLAYER(globalCtx); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + player = GET_PLAYER(play); + camera = Play_GetCamera(play, MAIN_CAM); if (this->unk_196 != 0) { this->unk_196--; @@ -286,12 +286,12 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } break; case 1: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - Gameplay_ClearAllSubCameras(globalCtx); - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, 1); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, 7); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + Play_ClearAllSubCameras(play); + this->cutsceneCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, 0, 1); + Play_ChangeCameraStatus(play, this->cutsceneCamera, 7); this->csState = 2; this->unk_196 = 0x3C; this->unk_198 = 160; @@ -314,11 +314,11 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } if (this->unk_198 == 110) { - func_8002DF54(globalCtx, &this->actor, 9); + func_8002DF54(play, &this->actor, 9); } if (this->unk_198 == 5) { - func_8002DF54(globalCtx, &this->actor, 12); + func_8002DF54(play, &this->actor, 12); } if (this->unk_198 < 6) { @@ -333,7 +333,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { this->unk_1BC = 2; } - BossDodongo_Walk(this, globalCtx); + BossDodongo_Walk(this, play); if (this->unk_196 == 1) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); @@ -372,7 +372,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } break; case 3: - BossDodongo_Walk(this, globalCtx); + BossDodongo_Walk(this, play); Math_SmoothStepToF(&this->unk_20C, sinf(this->unk_19E * 0.05f) * 0.1f, 1.0f, 0.01f, 0.0f); Math_SmoothStepToF(&this->cameraEye.x, this->vec.x + 90.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); Math_SmoothStepToF(&this->cameraEye.y, this->vec.y + 50.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); @@ -420,7 +420,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { if (this->unk_198 == 0x5A) { if (!(gSaveContext.eventChkInf[7] & 2)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gKingDodongoTitleCardTex), 160, 180, 128, 40, true); } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS); @@ -430,10 +430,10 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { camera->eye = this->cameraEye; camera->eyeNext = this->cameraEye; camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->cutsceneCamera, 0); + func_800C08AC(play, this->cutsceneCamera, 0); this->cutsceneCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); BossDodongo_SetupWalk(this); this->unk_1DA = 50; this->unk_1BC = 0; @@ -462,7 +462,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { sp48.y = 1.0f; sp48.z = this->unk_20C; - Gameplay_CameraSetAtEyeUp(globalCtx, this->cutsceneCamera, &sp54, &sp60, &sp48); + Play_CameraSetAtEyeUp(play, this->cutsceneCamera, &sp54, &sp60, &sp48); } } @@ -524,7 +524,7 @@ void BossDodongo_SetupInhale(BossDodongo* this) { this->unk_1E2 = 1; } -void BossDodongo_Damaged(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Damaged(BossDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->unk_1F8, 1.0f, 0.5f, 0.02f, 0.001f); Math_SmoothStepToF(&this->unk_208, 0.05f, 1.0f, 0.005f, 0.0f); @@ -534,7 +534,7 @@ void BossDodongo_Damaged(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Explode(BossDodongo* this, PlayState* play) { static Color_RGBA8 dustPrimColor = { 255, 255, 0, 255 }; static Color_RGBA8 dustEnvColor = { 255, 10, 0, 255 }; s16 pad; @@ -560,7 +560,7 @@ void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { dustPos.y = this->actor.world.pos.y + 90.0f + (dustVel.y * 3.0f); dustPos.z = this->actor.world.pos.z + (dustVel.z * 3.0f); - func_8002836C(globalCtx, &dustPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 500, 10, 10); + func_8002836C(play, &dustPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 500, 10, 10); } Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_004E0C, 1.0f, 0.0f, @@ -568,7 +568,7 @@ void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { this->actionFunc = BossDodongo_LayDown; Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DAMAGE); - func_80033E88(&this->actor, globalCtx, 4, 10); + func_80033E88(&this->actor, play, 4, 10); this->health -= 2; // make sure not to die from the bomb explosion @@ -578,7 +578,7 @@ void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_LayDown(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_LayDown(BossDodongo* this, PlayState* play) { this->unk_1BE = 10; Math_SmoothStepToF(&this->unk_1F8, 1.3f, 1.0f, 0.1f, 0.001f); SkelAnime_Update(&this->skelAnime); @@ -591,7 +591,7 @@ void BossDodongo_LayDown(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Vulnerable(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Vulnerable(BossDodongo* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DOWN - SFX_FLAG); this->unk_1BE = 10; Math_SmoothStepToF(&this->unk_1F8, 1.0f, 0.5f, 0.02f, 0.001f); @@ -605,7 +605,7 @@ void BossDodongo_Vulnerable(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_GetUp(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_GetUp(BossDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, Animation_GetLastFrame(&object_kingdodongo_Anim_009D10))) { @@ -613,7 +613,7 @@ void BossDodongo_GetUp(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_BlowFire(BossDodongo* this, PlayState* play) { s32 pad; Vec3f unusedZeroVec1 = { 0.0f, 0.0f, 0.0f }; Vec3f unusedZeroVec2 = { 0.0f, 0.0f, 0.0f }; @@ -629,7 +629,7 @@ void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx) { } if ((this->skelAnime.curFrame > 17.0f) && (this->skelAnime.curFrame < 35.0f)) { - BossDodongo_SpawnFire(this, globalCtx, this->unk_1AE); + BossDodongo_SpawnFire(this, play, this->unk_1AE); this->unk_1AE++; Math_SmoothStepToF(&this->unk_244, 0.0f, 1.0f, 8.0f, 0.0f); } @@ -639,7 +639,7 @@ void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Inhale(BossDodongo* this, GlobalContext* GlobalContext) { +void BossDodongo_Inhale(BossDodongo* this, PlayState* PlayState) { this->unk_1E2 = 1; if (this->unk_1AC > 20) { @@ -654,7 +654,7 @@ void BossDodongo_Inhale(BossDodongo* this, GlobalContext* GlobalContext) { } else { this->unk_1AC++; - if ((this->unk_1AC > 20) && (this->unk_1AC < 82) && BossDodongo_AteExplosive(this, GlobalContext)) { + if ((this->unk_1AC > 20) && (this->unk_1AC < 82) && BossDodongo_AteExplosive(this, PlayState)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DRINK); BossDodongo_SetupExplode(this); } @@ -668,7 +668,7 @@ static Vec3f sCornerPositions[] = { { -390.0f, 0.0f, -3804.0f }, }; -void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Walk(BossDodongo* this, PlayState* play) { Vec3f* sp4C; f32 sp48; f32 sp44; @@ -681,9 +681,9 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { } else if (this->unk_1BC != 2) { if (((s32)this->skelAnime.curFrame == 1) || ((s32)this->skelAnime.curFrame == 31)) { if ((s32)this->skelAnime.curFrame == 1) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_410, 25.0f, 10, 8.0f, 500, 10, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_410, 25.0f, 10, 8.0f, 500, 10, false); } else { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_404, 25.0f, 10, 8.0f, 500, 10, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_404, 25.0f, 10, 8.0f, 500, 10, false); } if (this->unk_1BC != 0) { @@ -693,7 +693,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { } if (this->cutsceneCamera == 0) { - func_80033E88(&this->actor, globalCtx, 4, 10); + func_80033E88(&this->actor, play, 4, 10); } else { this->unk_1B6 = 10; func_800A9F6C(0.0f, 180, 20, 100); @@ -733,7 +733,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { if ((this->unk_1DA == 0) && (this->unk_1BC == 0)) { if ((this->actor.xzDistToPlayer < 500.0f) && (this->unk_1A4 != 0) && !this->playerPosInRange) { BossDodongo_SetupInhale(this); - BossDodongo_SpawnFire(this, globalCtx, -1); + BossDodongo_SpawnFire(this, play, -1); } if (!this->playerPosInRange && !this->playerYawInRange) { @@ -742,7 +742,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Roll(BossDodongo* this, PlayState* play) { Vec3f* sp5C; Vec3f sp50; f32 sp4C; @@ -774,11 +774,11 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); if ((this->unk_19E & 7) == 0) { - Camera_AddQuake(&globalCtx->mainCamera, 2, 1, 8); + Camera_AddQuake(&play->mainCamera, 2, 1, 8); } if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, false); } } @@ -804,12 +804,12 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { this->unk_228 = 9200.0f; this->actor.velocity.y = 20.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_COLI); - Camera_AddQuake(&globalCtx->mainCamera, 2, 6, 8); + Camera_AddQuake(&play->mainCamera, 2, 6, 8); sp50.x = this->actor.world.pos.x; sp50.y = this->actor.world.pos.y + 60.0f; sp50.z = this->actor.world.pos.z; - func_80033480(globalCtx, &sp50, 250.0f, 40, 800, 10, 0); - func_80033E88(&this->actor, globalCtx, 6, 15); + func_80033480(play, &sp50, 250.0f, 40, 800, 10, 0); + func_80033E88(&this->actor, play, 6, 15); } else { this->actor.velocity.y = 15.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_COLI2); @@ -829,13 +829,13 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossDodongo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossDodongo* this = (BossDodongo*)thisx; f32 temp_f0; s16 i; - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); s32 pad; this->unk_1E2 = 0; @@ -861,7 +861,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1C8--; } - temp_f0 = func_808C4F6C(this, globalCtx); + temp_f0 = func_808C4F6C(this, play); if (temp_f0 > 0.0f) { this->unk_1A4 = temp_f0; @@ -869,7 +869,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1A4 = 0; } - temp_f0 = func_808C50A8(this, globalCtx); + temp_f0 = func_808C50A8(this, play); if (temp_f0 > 0.0f) { this->unk_1A6 = temp_f0; @@ -877,17 +877,17 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1A6 = 0; } - BossDodongo_PlayerYawCheck(this, globalCtx); - BossDodongo_PlayerPosCheck(this, globalCtx); + BossDodongo_PlayerYawCheck(this, play); + BossDodongo_PlayerPosCheck(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); thisx->shape.rot.y = thisx->world.rot.y; Math_SmoothStepToF(&thisx->shape.yOffset, this->unk_228, 1.0f, 100.0f, 0.0f); Actor_MoveForward(thisx); - BossDodongo_UpdateDamage(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 10.0f, 10.0f, 20.0f, 4); + BossDodongo_UpdateDamage(this, play); + Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 10.0f, 20.0f, 4); Math_SmoothStepToF(&this->unk_208, 0, 1, 0.001f, 0.0); Math_SmoothStepToF(&this->unk_20C, 0, 1, 0.001f, 0.0); @@ -908,11 +908,11 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToF(&this->unk_240, 0.0f, 1, 10.0f, 0.0); } - if ((globalCtx->envCtx.adjLight1Color[2] == 0) && (globalCtx->envCtx.adjAmbientColor[2] == 0)) { - globalCtx->envCtx.adjLight1Color[0] = (u8)this->unk_240; - globalCtx->envCtx.adjLight1Color[1] = (u8)(this->unk_240 * 0.1f); - globalCtx->envCtx.adjAmbientColor[0] = (u8)this->unk_240; - globalCtx->envCtx.adjAmbientColor[1] = (u8)(this->unk_240 * 0.1f); + if ((play->envCtx.adjLight1Color[2] == 0) && (play->envCtx.adjAmbientColor[2] == 0)) { + play->envCtx.adjLight1Color[0] = (u8)this->unk_240; + play->envCtx.adjLight1Color[1] = (u8)(this->unk_240 * 0.1f); + play->envCtx.adjAmbientColor[0] = (u8)this->unk_240; + play->envCtx.adjAmbientColor[1] = (u8)(this->unk_240 * 0.1f); } } @@ -930,10 +930,10 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToF(&this->colorFilterMin, 900.0f, 1, 10.0f, 0.0); Math_SmoothStepToF(&this->colorFilterMax, 1099.0f, 1, 10.0f, 0.0); } else { - Math_SmoothStepToF(&this->colorFilterR, globalCtx->lightCtx.fogColor[0], 1, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterG, globalCtx->lightCtx.fogColor[1], 1.0f, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterB, globalCtx->lightCtx.fogColor[2], 1.0f, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterMin, globalCtx->lightCtx.fogNear, 1.0, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterR, play->lightCtx.fogColor[0], 1, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterG, play->lightCtx.fogColor[1], 1.0f, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterB, play->lightCtx.fogColor[2], 1.0f, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterMin, play->lightCtx.fogNear, 1.0, 5.0f, 0.0); Math_SmoothStepToF(&this->colorFilterMax, 1000.0f, 1, 5.0f, 0.0); } @@ -950,7 +950,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { } else if (this->unk_224 > 1.7f) { phi_s0_3 = 3; sp90 = 1; - if (globalCtx) {} + if (play) {} magma2DrawMode = 0; } else if (this->unk_224 > 1.4f) { phi_s0_3 = 7; @@ -983,7 +983,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { sp84.x = (sinf(temp_f10) * temp_f12) + (-890.0f); sp84.y = -1523.76f; sp84.z = (cosf(temp_f10) * temp_f12) + (-3304.0f); - EffectSsGMagma2_Spawn(globalCtx, &sp84, &magmaPrimColor[magma2DrawMode], &magmaEnvColor[magma2DrawMode], + EffectSsGMagma2_Spawn(play, &sp84, &magmaPrimColor[magma2DrawMode], &magmaEnvColor[magma2DrawMode], 10 - (magma2DrawMode * 5), magma2DrawMode, magmaScale + 100); } @@ -997,7 +997,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { sp54.x = sinf(sp4C) * sp50 + (-890.0f); sp54.y = -1523.76f; sp54.z = cosf(sp4C) * sp50 + (-3304.0f); - EffectSsGMagma_Spawn(globalCtx, &sp54); + EffectSsGMagma_Spawn(play, &sp54); for (i = 0; i < 4; i++) { sp60.y = 0.4f; sp60.x = Rand_CenteredFloat(0.5f); @@ -1007,7 +1007,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { sp54.x = sinf(sp4C) * sp50 + (-890.0f); sp54.y = -1513.76f; sp54.z = cosf(sp4C) * sp50 + (-3304.0f); - func_808C17C8(globalCtx, &sp54, &sp6C, &sp60, ((s16)Rand_ZeroFloat(2.0f)) + 6, 0x50); + func_808C17C8(play, &sp54, &sp6C, &sp60, ((s16)Rand_ZeroFloat(2.0f)) + 6, 0x50); } } @@ -1030,13 +1030,13 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_1BC == 0) { if (this->actionFunc != BossDodongo_DeathCutscene) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc == BossDodongo_Roll) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -1059,10 +1059,10 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { } Math_SmoothStepToF(&this->unk_244, 0.0f, 1.0f, 2.0f, 0.0f); - BossDodongo_UpdateEffects(globalCtx); + BossDodongo_UpdateEffects(play); } -s32 BossDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { f32 mtxScaleY; f32 mtxScaleZ; @@ -1077,7 +1077,7 @@ block_1: Matrix_TranslateRotateZYX(pos, rot); if (*dList != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); mtxScaleZ = 1.0f; mtxScaleY = 1.0f; @@ -1099,18 +1099,18 @@ block_1: Matrix_RotateX(-(this->unk_25C[limbIndex] * 0.115f), 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++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } { s32 pad; } // Required to match return 1; } -void BossDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_808CA450 = { 5000.0f, -2500.0f, 0.0f }; static Vec3f D_808CA45C = { 0.0f, 0.0f, 0.0f }; static Vec3f D_808CA468 = { 11500.0f, -3000.0f, 0.0f }; @@ -1132,12 +1132,12 @@ void BossDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Collider_UpdateSpheres(limbIndex, &this->collider); } -void BossDodongo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossDodongo_Draw(Actor* thisx, PlayState* play) { BossDodongo* this = (BossDodongo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((this->unk_1C0 >= 2) && (this->unk_1C0 & 1)) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 255, 255, 0, 900, 1099); @@ -1149,24 +1149,24 @@ void BossDodongo_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(this->unk_23C, MTXMODE_APPLY); Matrix_RotateX((this->unk_1C4 / 32768.0f) * 3.14159f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, BossDodongo_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossDodongo_OverrideLimbDraw, BossDodongo_PostLimbDraw, this); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - BossDodongo_DrawEffects(globalCtx); + BossDodongo_DrawEffects(play); } -f32 func_808C4F6C(BossDodongo* this, GlobalContext* globalCtx) { +f32 func_808C4F6C(BossDodongo* this, PlayState* play) { f32 xDiff; f32 zDiff; f32 sp2C; s32 pad; f32 temp_f2; f32 rotation; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); xDiff = player->actor.world.pos.x - this->actor.world.pos.x; zDiff = player->actor.world.pos.z - this->actor.world.pos.z; @@ -1182,14 +1182,14 @@ f32 func_808C4F6C(BossDodongo* this, GlobalContext* globalCtx) { return -1.0f; } -f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx) { +f32 func_808C50A8(BossDodongo* this, PlayState* play) { f32 xDiff; f32 zDiff; f32 sp2C; s32 pad; f32 temp_f2; f32 rotation; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); xDiff = player->actor.world.pos.x - this->actor.world.pos.x; zDiff = player->actor.world.pos.z - this->actor.world.pos.z; @@ -1206,8 +1206,8 @@ f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx) { return -1.0f; } -void BossDodongo_PlayerYawCheck(BossDodongo* this, GlobalContext* globalCtx) { - s16 yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; +void BossDodongo_PlayerYawCheck(BossDodongo* this, PlayState* play) { + s16 yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((yawDiff < 0x38E3) && (-0x38E3 < yawDiff)) { this->playerYawInRange = true; @@ -1216,7 +1216,7 @@ void BossDodongo_PlayerYawCheck(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_PlayerPosCheck(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_PlayerPosCheck(BossDodongo* this, PlayState* play) { Vec3f* temp_v1; s16 i; @@ -1233,12 +1233,12 @@ void BossDodongo_PlayerPosCheck(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_SpawnFire(BossDodongo* this, GlobalContext* globalCtx, s16 params) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BDFIRE, this->vec.x, this->vec.y - 20.0f, +void BossDodongo_SpawnFire(BossDodongo* this, PlayState* play, s16 params) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BDFIRE, this->vec.x, this->vec.y - 20.0f, this->vec.z, 0, this->actor.shape.rot.y, 0, params); } -void BossDodongo_UpdateDamage(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play) { s32 pad; ColliderInfo* item1; u8 swordDamage; @@ -1248,7 +1248,7 @@ void BossDodongo_UpdateDamage(BossDodongo* this, GlobalContext* globalCtx) { if ((this->health <= 0) && (this->actionFunc != BossDodongo_DeathCutscene)) { BossDodongo_SetupDeathCutscene(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return; } @@ -1301,7 +1301,7 @@ void BossDodongo_SetupDeathCutscene(BossDodongo* this) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); } -void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) { Vec3f* cornerPos; Vec3f sp198; Vec3f sp184; @@ -1311,19 +1311,19 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { s16 i; Vec3f effectPos; Camera* camera; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); switch (this->csState) { case 0: this->csState = 5; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_UNK3); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, CAM_STAT_ACTIVE); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->cutsceneCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, this->cutsceneCamera, CAM_STAT_ACTIVE); + camera = Play_GetCamera(play, MAIN_CAM); this->cameraEye.x = camera->eye.x; this->cameraEye.y = camera->eye.y; this->cameraEye.z = camera->eye.z; @@ -1349,7 +1349,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_003CF8, 1.0f, 0.0f, Animation_GetLastFrame(&object_kingdodongo_Anim_003CF8), ANIMMODE_ONCE, -1.0f); this->csState = 6; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, 0x6000); } break; @@ -1410,10 +1410,10 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.z, cornerPos->z + sp184.z, 1.0f, this->unk_1E4, 0.0f); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); if ((this->unk_19E & 7) == 0) { - Camera_AddQuake(&globalCtx->mainCamera, 2, 1, 8); + Camera_AddQuake(&play->mainCamera, 2, 1, 8); } if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, false); } tempSin = cornerPos->x - this->actor.world.pos.x; @@ -1442,7 +1442,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { dustPos.x = this->actor.world.pos.x; dustPos.y = this->actor.world.pos.y + 60.0f; dustPos.z = this->actor.world.pos.z; - func_80033480(globalCtx, &dustPos, 250.0f, 0x28, 0x320, 0xA, 0); + func_80033480(play, &dustPos, 250.0f, 0x28, 0x320, 0xA, 0); } } break; @@ -1524,13 +1524,13 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { effectPos.x = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.x; effectPos.y = Rand_ZeroFloat(50.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.z; - func_8002836C(globalCtx, &effectPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 0x1F4, + func_8002836C(play, &effectPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 0x1F4, 0xA, 0xA); effectPos.x = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.x; effectPos.y = -1498.76f; effectPos.z = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.z; colorIndex = (Rand_ZeroOne() * 1.9f); - EffectSsGMagma2_Spawn(globalCtx, &effectPos, &magmaPrimColor2[colorIndex], + EffectSsGMagma2_Spawn(play, &effectPos, &magmaPrimColor2[colorIndex], &magmaEnvColor2[colorIndex], 10 - (colorIndex * 5), colorIndex, (s16)(Rand_ZeroOne() * 100.0f) + 100); } @@ -1538,7 +1538,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, false); } } @@ -1614,27 +1614,27 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { if (this->unk_1DA == 820) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, Math_SinS(this->actor.shape.rot.y) * -50.0f + this->actor.world.pos.x, this->actor.world.pos.y, Math_CosS(this->actor.shape.rot.y) * -50.0f + this->actor.world.pos.z, 0, 0, 0, 0); } if (this->unk_1DA == 600) { - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + camera = Play_GetCamera(play, MAIN_CAM); camera->eye = this->cameraEye; camera->eyeNext = this->cameraEye; camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->cutsceneCamera, 0); + func_800C08AC(play, this->cutsceneCamera, 0); this->unk_1BC = 0; this->cutsceneCamera = MAIN_CAM; this->csState = 100; - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, WARP_DUNGEON_CHILD); this->skelAnime.playSpeed = 0.0f; - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } case 100: if ((this->unk_1DA < 0x2C6) && (Rand_ZeroOne() < 0.5f)) { @@ -1645,18 +1645,18 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { sp68.x = Rand_CenteredFloat(60.0f) + this->actor.focus.pos.x; sp68.y = (Rand_ZeroOne() * 50.0f) + -1498.76f; sp68.z = Rand_CenteredFloat(60.0f) + this->actor.focus.pos.z; - EffectSsGMagma2_Spawn(globalCtx, &sp68, &D_808CA568, &D_808CA56C, 5, 1, + EffectSsGMagma2_Spawn(play, &sp68, &D_808CA568, &D_808CA56C, 5, 1, (s16)(Rand_ZeroOne() * 50.0f) + 50); } break; } if (this->cutsceneCamera != MAIN_CAM) { - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &this->cameraAt, &this->cameraEye); + Play_CameraSetAtEye(play, this->cutsceneCamera, &this->cameraAt, &this->cameraEye); } } -void BossDodongo_UpdateEffects(GlobalContext* globalCtx) { - BossDodongoEffect* eff = (BossDodongoEffect*)globalCtx->specialEffects; +void BossDodongo_UpdateEffects(PlayState* play) { + BossDodongoEffect* eff = (BossDodongoEffect*)play->specialEffects; Color_RGB8 effectColors[] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 } }; s16 colorIndex; s16 i; @@ -1685,19 +1685,19 @@ void BossDodongo_UpdateEffects(GlobalContext* globalCtx) { } } -void BossDodongo_DrawEffects(GlobalContext* globalCtx) { +void BossDodongo_DrawEffects(PlayState* play) { MtxF* unkMtx; s16 i; u8 phi_s3 = 0; BossDodongoEffect* eff; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - eff = (BossDodongoEffect*)globalCtx->specialEffects; + eff = (BossDodongoEffect*)play->specialEffects; OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - unkMtx = &globalCtx->billboardMtxF; + func_80093D84(play->state.gfxCtx); + unkMtx = &play->billboardMtxF; // OTRTODO: This call causes the whole texture cache to be cleaned up, which causes an important slowdown on switch so we need to find a way to avoid it. #ifndef __SWITCH__ diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h index ddc76960c..e38cd2339 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h @@ -6,7 +6,7 @@ struct BossDodongo; -typedef void (*BossDodongoActionFunc)(struct BossDodongo*, GlobalContext*); +typedef void (*BossDodongoActionFunc)(struct BossDodongo*, PlayState*); typedef struct { /* 0x00 */ Vec3f unk_00; diff --git a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 4a13a7e89..22cdd76fa 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -35,16 +35,16 @@ typedef enum { /* 2 */ EYE_CLOSED } BossFdEyeState; -void BossFd_Init(Actor* thisx, GlobalContext* globalCtx); -void BossFd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossFd_Update(Actor* thisx, GlobalContext* globalCtx); -void BossFd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossFd_Init(Actor* thisx, PlayState* play); +void BossFd_Destroy(Actor* thisx, PlayState* play); +void BossFd_Update(Actor* thisx, PlayState* play); +void BossFd_Draw(Actor* thisx, PlayState* play); -void BossFd_SetupFly(BossFd* this, GlobalContext* globalCtx); -void BossFd_Fly(BossFd* this, GlobalContext* globalCtx); -void BossFd_Wait(BossFd* this, GlobalContext* globalCtx); -void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx); -void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this); +void BossFd_SetupFly(BossFd* this, PlayState* play); +void BossFd_Fly(BossFd* this, PlayState* play); +void BossFd_Wait(BossFd* this, PlayState* play); +void BossFd_UpdateEffects(BossFd* this, PlayState* play); +void BossFd_DrawBody(PlayState* play, BossFd* this); const ActorInit Boss_Fd_InitVars = { ACTOR_BOSS_FD, @@ -156,7 +156,7 @@ void BossFd_SetCameraSpeed(BossFd* this, f32 speedMod) { this->camData.atVel.z = fabsf(this->camData.at.z - this->camData.nextAt.z) * speedMod; } -void BossFd_UpdateCamera(BossFd* this, GlobalContext* globalCtx) { +void BossFd_UpdateCamera(BossFd* this, PlayState* play) { if (this->introCamera != SUBCAM_FREE) { Math_ApproachF(&this->camData.eye.x, this->camData.nextEye.x, this->camData.eyeMaxVel.x, this->camData.eyeVel.x * this->camData.speedMod); @@ -172,26 +172,26 @@ void BossFd_UpdateCamera(BossFd* this, GlobalContext* globalCtx) { this->camData.atVel.z * this->camData.speedMod); Math_ApproachF(&this->camData.speedMod, 1.0f, 1.0f, this->camData.accel); this->camData.at.y += this->camData.yMod; - Gameplay_CameraSetAtEye(globalCtx, this->introCamera, &this->camData.at, &this->camData.eye); + Play_CameraSetAtEye(play, this->introCamera, &this->camData.at, &this->camData.eye); Math_ApproachZeroF(&this->camData.yMod, 1.0f, 0.1f); } } -void BossFd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Init(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; s16 i; - Flags_SetSwitch(globalCtx, 0x14); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BG_VB_SIMA, 680.0f, -100.0f, 0.0f, 0, 0, 0, + Flags_SetSwitch(play, 0x14); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BG_VB_SIMA, 680.0f, -100.0f, 0.0f, 0, 0, 0, 100); Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); Actor_SetScale(&this->actor, 0.05f); - SkelAnime_Init(globalCtx, &this->skelAnimeHead, &gVolvagiaHeadSkel, &gVolvagiaHeadEmergeAnim, NULL, NULL, 0); - SkelAnime_Init(globalCtx, &this->skelAnimeRightArm, &gVolvagiaRightArmSkel, &gVolvagiaRightArmEmergeAnim, NULL, + SkelAnime_Init(play, &this->skelAnimeHead, &gVolvagiaHeadSkel, &gVolvagiaHeadEmergeAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnimeRightArm, &gVolvagiaRightArmSkel, &gVolvagiaRightArmEmergeAnim, NULL, NULL, 0); - SkelAnime_Init(globalCtx, &this->skelAnimeLeftArm, &gVolvagiaLeftArmSkel, &gVolvagiaLeftArmEmergeAnim, NULL, NULL, + SkelAnime_Init(play, &this->skelAnimeLeftArm, &gVolvagiaLeftArmSkel, &gVolvagiaLeftArmEmergeAnim, NULL, NULL, 0); this->introState = BFD_CS_WAIT; if (this->introState == BFD_CS_NONE) { @@ -200,8 +200,8 @@ void BossFd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.x = this->actor.world.pos.z = 0.0f; this->actor.world.pos.y = -200.0f; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->elements); for (i = 0; i < 100; i++) { this->bodySegsPos[i].x = this->actor.world.pos.x; @@ -219,35 +219,35 @@ void BossFd_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->introState == BFD_CS_NONE) { this->actionFunc = BossFd_Wait; } else { - BossFd_SetupFly(this, globalCtx); + BossFd_SetupFly(this, play); } - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 100.0f, 200.0f, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 100.0f, 200.0f, 0, 0, 0, 0); } else { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_FD2, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_FD2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->introState); } } -void BossFd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; - SkelAnime_Free(&this->skelAnimeHead, globalCtx); - SkelAnime_Free(&this->skelAnimeRightArm, globalCtx); - SkelAnime_Free(&this->skelAnimeLeftArm, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnimeHead, play); + SkelAnime_Free(&this->skelAnimeRightArm, play); + SkelAnime_Free(&this->skelAnimeLeftArm, play); + Collider_DestroyJntSph(play, &this->collider); } s32 BossFd_IsFacingLink(BossFd* this) { return ABS((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y)) < 0x2000; } -void BossFd_SetupFly(BossFd* this, GlobalContext* globalCtx) { +void BossFd_SetupFly(BossFd* this, PlayState* play) { Animation_PlayOnce(&this->skelAnimeHead, &gVolvagiaHeadEmergeAnim); Animation_PlayOnce(&this->skelAnimeRightArm, &gVolvagiaRightArmEmergeAnim); Animation_PlayOnce(&this->skelAnimeLeftArm, &gVolvagiaLeftArmEmergeAnim); @@ -266,7 +266,7 @@ static Vec3f sCeilingTargets[] = { { 0.0f, 900.0f, 243.0f }, { -243.0f, 900.0f, 100.0f }, { -243.0, 900.0f, -100.0f }, }; -void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { +void BossFd_Fly(BossFd* this, PlayState* play) { u8 sp1CF = false; u8 temp_rand; s16 i1; @@ -275,7 +275,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { f32 dx; f32 dy; f32 dz; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 angleToTarget; f32 pitchToTarget; Vec3f* holePosition1; @@ -306,8 +306,8 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { // Boss Intro Cutscene if (this->introState != BFD_CS_NONE) { - Player* player2 = GET_PLAYER(globalCtx); - Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Player* player2 = GET_PLAYER(play); + Camera* mainCam = Play_GetCamera(play, MAIN_CAM); switch (this->introState) { case BFD_CS_WAIT: @@ -321,11 +321,11 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { (fabsf(player2->actor.world.pos.x - 340.0f) < 60.0f)) { this->introState = BFD_CS_START; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->introCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->introCamera, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->introCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->introCamera, CAM_STAT_ACTIVE); player2->actor.world.pos.x = 380.0f; player2->actor.world.pos.y = 100.0f; player2->actor.world.pos.z = 0.0f; @@ -398,7 +398,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Math_ApproachF(&this->camData.shake, 2.0f, 1.0f, 0.8 * 0.01f); } if (this->timers[0] == 40) { - func_8002DF54(globalCtx, &this->actor, 0x13); + func_8002DF54(play, &this->actor, 0x13); } if (this->timers[0] == 0) { this->introState = BFD_CS_LOOK_GROUND; @@ -427,7 +427,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->timers[0] = 170; this->camData.speedMod = 0.0f; this->camData.accel = 0.0f; - func_8002DF54(globalCtx, &this->actor, 0x14); + func_8002DF54(play, &this->actor, 0x14); } break; case BFD_CS_COLLAPSE: @@ -477,7 +477,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { if (this->timers[3] == 190) { this->camData.atMaxVel.x = this->camData.atMaxVel.y = this->camData.atMaxVel.z = 0.05f; this->platformSignal = VBSIMA_KILL; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); } if (this->actor.world.pos.y > 120.0f) { this->camData.nextAt = this->actor.world.pos; @@ -498,7 +498,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS); } if ((this->timers[3] == 130) && !(gSaveContext.eventChkInf[7] & 8)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gVolvagiaBossTitleCardTex), 160, 180, 128, 40, true); } if (this->timers[3] <= 100) { @@ -542,17 +542,17 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { mainCam->eye = this->camData.eye; mainCam->eyeNext = this->camData.eye; mainCam->at = this->camData.at; - func_800C08AC(globalCtx, this->introCamera, 0); + func_800C08AC(play, this->introCamera, 0); this->introState = this->introFlyState = this->introCamera = BFD_CS_NONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->actionFunc = BossFd_Wait; this->handoffSignal = FD2_SIGNAL_GROUND; gSaveContext.eventChkInf[7] |= 8; } break; } - BossFd_UpdateCamera(this, globalCtx); + BossFd_UpdateCamera(this, play); } else { this->fwork[BFD_FLY_SPEED] = 5.0f; } @@ -636,7 +636,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->holePosition.x = this->targetPosition.x; this->holePosition.z = this->targetPosition.z; - func_80033E1C(globalCtx, 1, 0x50, 0x5000); + func_80033E1C(play, 1, 0x50, 0x5000); if (this->introState != BFD_CS_NONE) { this->timers[0] = 50; } else { @@ -672,7 +672,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->work[BFD_CEILING_TARGET] = 0; } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 2); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 2); if (this->timers[1] == 0) { osSyncPrintf("BGCHECKKKKKKKKKKKKKKKKKKKKKKK\n"); if (this->actor.bgCheckFlags & 0x10) { @@ -680,7 +680,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->timers[1] = 10; Audio_PlaySoundGeneral(NA_SE_EV_EXPLOSION, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); - func_80033E1C(globalCtx, 3, 0xA, 0x7530); + func_80033E1C(play, 3, 0xA, 0x7530); this->work[BFD_ROCK_TIMER] = 300; } } else { @@ -772,7 +772,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { s16 sp150; if (this->fogMode == 0) { - globalCtx->envCtx.unk_D8 = 0; + play->envCtx.unk_D8 = 0; } this->fogMode = 0xA; @@ -791,7 +791,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { sp164.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &sp188, &sp17C, &sp164, (s16)Rand_ZeroFloat(20.0f) + 40, 0x64); + EffectSsKFire_Spawn(play, &sp188, &sp17C, &sp164, (s16)Rand_ZeroFloat(20.0f) + 40, 0x64); for (i2 = 0; i2 < 15; i2++) { sp170.x = Rand_CenteredFloat(20.0f); @@ -853,7 +853,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->work[BFD_CAM_SHAKE_TIMER] = 20; Audio_PlaySoundGeneral(NA_SE_EN_VALVAISA_LAND2, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); - func_8002DF54(globalCtx, &this->actor, 5); + func_8002DF54(play, &this->actor, 5); for (i1 = 0; i1 < 15; i1++) { Vec3f sp144 = { 0.0f, 0.0f, 0.0f }; Vec3f sp138 = { 0.0f, 0.0f, 0.0f }; @@ -902,7 +902,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { sp108.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &sp120, &sp114, &sp108, (s16)Rand_ZeroFloat(15.0f) + 30, 0); + EffectSsKFire_Spawn(play, &sp120, &sp114, &sp108, (s16)Rand_ZeroFloat(15.0f) + 30, 0); } if (this->timers[0] < 20) { Math_ApproachZeroF(&this->actor.scale.x, 1.0f, 0.0025f); @@ -913,7 +913,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->actor.world.pos.y -= 1000.0f; } if (this->timers[0] == 7) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } break; @@ -985,14 +985,14 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { if (this->work[BFD_ACTION_STATE] < BOSSFD_SKULL_FALL) { if ((this->actor.prevPos.y < 90.0f) && (90.0f <= this->actor.world.pos.y)) { this->timers[4] = 80; - func_80033E1C(globalCtx, 1, 80, 0x5000); + func_80033E1C(play, 1, 80, 0x5000); this->work[BFD_ROAR_TIMER] = 40; this->work[BFD_MANE_EMBERS_TIMER] = 30; this->work[BFD_SPLASH_TIMER] = 10; } if ((this->actor.prevPos.y > 90.0f) && (90.0f >= this->actor.world.pos.y)) { this->timers[4] = 80; - func_80033E1C(globalCtx, 1, 80, 0x5000); + func_80033E1C(play, 1, 80, 0x5000); this->work[BFD_MANE_EMBERS_TIMER] = 30; this->work[BFD_SPLASH_TIMER] = 10; } @@ -1031,12 +1031,12 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_Wait(BossFd* this, GlobalContext* globalCtx) { +void BossFd_Wait(BossFd* this, PlayState* play) { if (this->handoffSignal == FD2_SIGNAL_FLY) { // Set by BossFd2 u8 temp_rand; this->handoffSignal = FD2_SIGNAL_NONE; - BossFd_SetupFly(this, globalCtx); + BossFd_SetupFly(this, play); do { temp_rand = Rand_ZeroFloat(8.9f); } while (temp_rand == this->holeIndex); @@ -1052,7 +1052,7 @@ void BossFd_Wait(BossFd* this, GlobalContext* globalCtx) { } if (this->handoffSignal == FD2_SIGNAL_DEATH) { this->handoffSignal = FD2_SIGNAL_NONE; - BossFd_SetupFly(this, globalCtx); + BossFd_SetupFly(this, play); this->holeIndex = 1; this->targetPosition.x = sHoleLocations[1].x; this->targetPosition.y = sHoleLocations[1].y - 200.0f; @@ -1065,7 +1065,7 @@ void BossFd_Wait(BossFd* this, GlobalContext* globalCtx) { static Vec3f sFireAudioVec = { 0.0f, 0.0f, 50.0f }; -void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { +void BossFd_Effects(BossFd* this, PlayState* play) { static Color_RGBA8 colorYellow = { 255, 255, 0, 255 }; static Color_RGBA8 colorRed = { 255, 10, 0, 255 }; s16 breathOpacity = 0; @@ -1079,36 +1079,36 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { s16 i; if (this->fogMode == 0) { - globalCtx->envCtx.unk_BF = 0; - globalCtx->envCtx.unk_D8 = 0.5f + 0.5f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x500); - globalCtx->envCtx.unk_DC = 2; - globalCtx->envCtx.unk_BD = 1; - globalCtx->envCtx.unk_BE = 0; + play->envCtx.unk_BF = 0; + play->envCtx.unk_D8 = 0.5f + 0.5f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x500); + play->envCtx.unk_DC = 2; + play->envCtx.unk_BD = 1; + play->envCtx.unk_BE = 0; } else if (this->fogMode == 3) { - globalCtx->envCtx.unk_BF = 0; - globalCtx->envCtx.unk_DC = 2; - globalCtx->envCtx.unk_BD = 2; - globalCtx->envCtx.unk_BE = 0; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); + play->envCtx.unk_BF = 0; + play->envCtx.unk_DC = 2; + play->envCtx.unk_BD = 2; + play->envCtx.unk_BE = 0; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); } else if (this->fogMode == 2) { this->fogMode--; - globalCtx->envCtx.unk_BF = 0; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 0.55f + 0.05f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x3E00), 1.0f, + play->envCtx.unk_BF = 0; + Math_ApproachF(&play->envCtx.unk_D8, 0.55f + 0.05f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x3E00), 1.0f, 0.15f); - globalCtx->envCtx.unk_DC = 2; - globalCtx->envCtx.unk_BD = 3; - globalCtx->envCtx.unk_BE = 0; + play->envCtx.unk_DC = 2; + play->envCtx.unk_BD = 3; + play->envCtx.unk_BE = 0; } else if (this->fogMode == 10) { this->fogMode = 1; - globalCtx->envCtx.unk_BF = 0; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 0.21f + 0.07f * Math_SinS(this->work[BFD_VAR_TIMER] * 0xC00), 1.0f, + play->envCtx.unk_BF = 0; + Math_ApproachF(&play->envCtx.unk_D8, 0.21f + 0.07f * Math_SinS(this->work[BFD_VAR_TIMER] * 0xC00), 1.0f, 0.05f); - globalCtx->envCtx.unk_DC = 2; - globalCtx->envCtx.unk_BD = 3; - globalCtx->envCtx.unk_BE = 0; + play->envCtx.unk_DC = 2; + play->envCtx.unk_BD = 3; + play->envCtx.unk_BE = 0; } else if (this->fogMode == 1) { - Math_ApproachF(&globalCtx->envCtx.unk_D8, 0.0f, 1.0f, 0.03f); - if (globalCtx->envCtx.unk_D8 <= 0.01f) { + Math_ApproachF(&play->envCtx.unk_D8, 0.0f, 1.0f, 0.03f); + if (play->envCtx.unk_D8 <= 0.01f) { this->fogMode = 0; } } @@ -1162,7 +1162,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.health == 0) || ((this->introState == BFD_CS_EMERGE) && (this->actor.world.rot.x > 0x3000))) { if ((u8)this->fogMode == 0) { - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } this->fogMode = 2; } @@ -1180,7 +1180,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { spawnPos1.y = 100.0f; spawnPos1.z = temp_z + this->holePosition.z; - func_8002836C(globalCtx, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, + func_8002836C(play, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, (s16)Rand_ZeroFloat(150.0f) + 800, 10, (s16)Rand_ZeroFloat(5.0f) + 17); } } else { @@ -1198,7 +1198,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { spawnPos1.y = 100.0f; spawnPos1.z = temp_z + this->holePosition.z; - func_8002836C(globalCtx, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, 500, 10, 20); + func_8002836C(play, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, 500, 10, 20); } } @@ -1280,7 +1280,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_CollisionCheck(BossFd* this, GlobalContext* globalCtx) { +void BossFd_CollisionCheck(BossFd* this, PlayState* play) { ColliderJntSphElement* headCollider = &this->collider.elements[0]; ColliderInfo* hurtbox; @@ -1301,7 +1301,7 @@ void BossFd_CollisionCheck(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Update(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; f32 headGlow; @@ -1312,7 +1312,7 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("FD MOVE START \n"); this->work[BFD_VAR_TIMER]++; this->work[BFD_MOVE_TIMER]++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { @@ -1330,13 +1330,13 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->work[BFD_ACTION_STATE] < BOSSFD_DEATH_START) { if (this->work[BFD_INVINC_TIMER] == 0) { - BossFd_CollisionCheck(this, globalCtx); + BossFd_CollisionCheck(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - BossFd_Effects(this, globalCtx); + BossFd_Effects(this, play); this->fwork[BFD_TEX1_SCROLL_X] += 4.0f; this->fwork[BFD_TEX1_SCROLL_Y] = 120.0f; this->fwork[BFD_TEX2_SCROLL_X] += 3.0f; @@ -1362,7 +1362,7 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { this->work[BFD_ROCK_TIMER]--; if ((this->work[BFD_ROCK_TIMER] % 16) == 0) { EnVbBall* bossFdRock = (EnVbBall*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f, + &play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f, this->actor.world.pos.z, 0, 0, (s16)Rand_ZeroFloat(50.0f) + 130, 100); if (bossFdRock != NULL) { @@ -1425,13 +1425,13 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { } } osSyncPrintf("FD MOVE END 1\n"); - BossFd_UpdateEffects(this, globalCtx); + BossFd_UpdateEffects(this, play); osSyncPrintf("FD MOVE END 2\n"); } -void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) { +void BossFd_UpdateEffects(BossFd* this, PlayState* play) { BossFdEffect* effect = this->effects; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Color_RGB8 colors[4] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 } }; Vec3f diff; s16 i1; @@ -1478,7 +1478,7 @@ void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) { diff.z = player->actor.world.pos.z - effect->pos.z; if ((this->timers[3] == 0) && (sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z)) < 20.0f)) { this->timers[3] = 50; - func_8002F6D4(globalCtx, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); + func_8002F6D4(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); if (player->isBurning == false) { for (i2 = 0; i2 < ARRAY_COUNT(player->flameTimers); i2++) { player->flameTimers[i2] = Rand_S16Offset(0, 200); @@ -1512,12 +1512,12 @@ void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { +void BossFd_DrawEffects(BossFdEffect* effect, PlayState* play) { static void* dustTex[] = { gDust1Tex, gDust1Tex, gDust2Tex, gDust3Tex, gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, }; u8 flag = false; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; BossFdEffect* firstEffect = effect; @@ -1527,14 +1527,14 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { if (effect->type == BFD_FX_EMBER) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaEmberMaterialDL); flag++; } gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->color.r, effect->color.g, effect->color.b, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -1550,7 +1550,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { if (effect->type == BFD_FX_DEBRIS) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gVolvagiaDebrisMaterialDL); flag++; } @@ -1582,7 +1582,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1607,7 +1607,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1623,7 +1623,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { if (effect->type == BFD_FX_SKULL_PIECE) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaSkullPieceMaterialDL); flag++; } @@ -1643,29 +1643,29 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void BossFd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Draw(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; osSyncPrintf("FD DRAW START\n"); if (this->actionFunc != BossFd_Wait) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->work[BFD_DAMAGE_FLASH_TIMER] & 2) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 255, 255, 0, 900, 1099); } - BossFd_DrawBody(globalCtx, this); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + BossFd_DrawBody(play, this); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + CLOSE_DISPS(play->state.gfxCtx); } osSyncPrintf("FD DRAW END\n"); - BossFd_DrawEffects(this->effects, globalCtx); + BossFd_DrawEffects(this->effects, play); osSyncPrintf("FD DRAW END2\n"); } -s32 BossFd_OverrideRightArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossFd_OverrideRightArmDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd* this = (BossFd*)thisx; @@ -1688,7 +1688,7 @@ s32 BossFd_OverrideRightArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -s32 BossFd_OverrideLeftArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossFd_OverrideLeftArmDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd* this = (BossFd*)thisx; @@ -1714,7 +1714,7 @@ s32 BossFd_OverrideLeftArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL static s16 sBodyIndex[] = { 0, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5 }; static s16 sManeIndex[] = { 0, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10 }; // Unused -void BossFd_DrawMane(GlobalContext* globalCtx, BossFd* this, Vec3f* manePos, Vec3f* maneRot, f32* maneScale, u8 mode) { +void BossFd_DrawMane(PlayState* play, BossFd* this, Vec3f* manePos, Vec3f* maneRot, f32* maneScale, u8 mode) { f32 sp140[] = { 0.0f, 10.0f, 17.0f, 20.0f, 19.5f, 18.0f, 17.0f, 15.0f, 15.0f, 15.0f }; f32 sp118[] = { 0.0f, 10.0f, 17.0f, 20.0f, 21.0f, 21.0f, 21.0f, 21.0f, 21.0f, 21.0f }; f32 spF0[] = { 0.4636457f, 0.3366129f, 0.14879614f, 0.04995025f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; @@ -1730,7 +1730,7 @@ void BossFd_DrawMane(GlobalContext* globalCtx, BossFd* this, Vec3f* manePos, Vec f32 phi_f20; f32 phi_f22; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); maneLength = this->skinSegments; maneLength = CLAMP_MAX(maneLength, 10); @@ -1771,15 +1771,15 @@ void BossFd_DrawMane(GlobalContext* globalCtx, BossFd* this, Vec3f* manePos, Vec Matrix_Scale(maneScale[maneIndex] * (0.01f - (i * 0.0008f)), maneScale[maneIndex] * (0.01f - (i * 0.0008f)), 0.01f, MTXMODE_APPLY); Matrix_RotateX(-M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaManeModelDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 BossFd_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 BossFd_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd* this = (BossFd*)thisx; switch (limbIndex) { @@ -1806,7 +1806,7 @@ s32 BossFd_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void BossFd_PostHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossFd_PostHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f targetMod = { 4500.0f, 0.0f, 0.0f }; static Vec3f headMod = { 4000.0f, 0.0f, 0.0f }; BossFd* this = (BossFd*)thisx; @@ -1830,18 +1830,18 @@ static Gfx* sBodyDLists[] = { gVolvagiaBodySeg16DL, gVolvagiaBodySeg17DL, gVolvagiaBodySeg18DL, }; -void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { +void BossFd_DrawBody(PlayState* play, BossFd* this) { s16 segIndex; s16 i; f32 temp_float; - Mtx* tempMat = Graph_Alloc(globalCtx->state.gfxCtx, 18 * sizeof(Mtx)); + Mtx* tempMat = Graph_Alloc(play->state.gfxCtx, 18 * sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->skinSegments != 0) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState])); } gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->fwork[BFD_TEX1_SCROLL_X], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->fwork[BFD_TEX1_SCROLL_X], (s16)this->fwork[BFD_TEX1_SCROLL_Y], 0x20, 0x20, 1, (s16)this->fwork[BFD_TEX2_SCROLL_X], (s16)this->fwork[BFD_TEX2_SCROLL_Y], 0x20, 0x20)); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -1856,7 +1856,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_RotateX(-this->bodySegsRot[segIndex].x, MTXMODE_APPLY); Matrix_Translate(-13.0f, -5.0f, 13.0f, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x * 0.1f, this->actor.scale.y * 0.1f, this->actor.scale.z * 0.1f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeRightArm.skeleton, this->skelAnimeRightArm.jointTable, + SkelAnime_DrawOpa(play, this->skelAnimeRightArm.skeleton, this->skelAnimeRightArm.jointTable, BossFd_OverrideRightArmDraw, NULL, this); Matrix_Pop(); osSyncPrintf("RH\n"); @@ -1868,7 +1868,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_RotateX(-this->bodySegsRot[segIndex].x, MTXMODE_APPLY); Matrix_Translate(13.0f, -5.0f, 13.0f, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x * 0.1f, this->actor.scale.y * 0.1f, this->actor.scale.z * 0.1f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeLeftArm.skeleton, this->skelAnimeLeftArm.jointTable, + SkelAnime_DrawOpa(play, this->skelAnimeLeftArm.skeleton, this->skelAnimeLeftArm.jointTable, BossFd_OverrideLeftArmDraw, NULL, this); Matrix_Pop(); osSyncPrintf("BD\n"); @@ -1916,7 +1916,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { temp_float = 0.1f * sp84; } Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gVolvagiaRibsDL); @@ -1928,7 +1928,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_Get(&spFC); Matrix_MtxFToYXZRotS(&spFC, &spDC, 0); bones = - (EnVbBall*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_VB_BALL, + (EnVbBall*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, spE4.x, spE4.y, spE4.z, spDC.x, spDC.y, spDC.z, i + 200); bones->actor.scale.x = this->actor.scale.x * temp_float; @@ -1965,34 +1965,34 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_Pop(); osSyncPrintf("BHCE\n"); Matrix_Scale(this->actor.scale.x * 0.1f, this->actor.scale.y * 0.1f, this->actor.scale.z * 0.1f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeHead.skeleton, this->skelAnimeHead.jointTable, BossFd_OverrideHeadDraw, + SkelAnime_DrawOpa(play, this->skelAnimeHead.skeleton, this->skelAnimeHead.jointTable, BossFd_OverrideHeadDraw, BossFd_PostHeadDraw, &this->actor); osSyncPrintf("SK\n"); { Vec3f spB0 = { 0.0f, 1700.0f, 7000.0f }; Vec3f spA4 = { -1000.0f, 700.0f, 7000.0f }; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaManeMaterialDL); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, this->fwork[BFD_MANE_COLOR_CENTER], 0, 255); Matrix_Push(); Matrix_MultVec3f(&spB0, &this->centerMane.head); - BossFd_DrawMane(globalCtx, this, this->centerMane.pos, this->fireManeRot, this->centerMane.scale, MANE_CENTER); + BossFd_DrawMane(play, this, this->centerMane.pos, this->fireManeRot, this->centerMane.scale, MANE_CENTER); Matrix_Pop(); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, this->fwork[BFD_MANE_COLOR_RIGHT], 0, 255); Matrix_Push(); Matrix_MultVec3f(&spA4, &this->rightMane.head); - BossFd_DrawMane(globalCtx, this, this->rightMane.pos, this->fireManeRot, this->rightMane.scale, MANE_RIGHT); + BossFd_DrawMane(play, this, this->rightMane.pos, this->fireManeRot, this->rightMane.scale, MANE_RIGHT); Matrix_Pop(); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, this->fwork[BFD_MANE_COLOR_LEFT], 0, 255); Matrix_Push(); spA4.x *= -1.0f; Matrix_MultVec3f(&spA4, &this->leftMane.head); - BossFd_DrawMane(globalCtx, this, this->leftMane.pos, this->fireManeRot, this->leftMane.scale, MANE_LEFT); + BossFd_DrawMane(play, this, this->leftMane.pos, this->fireManeRot, this->leftMane.scale, MANE_LEFT); Matrix_Pop(); } Matrix_Pop(); osSyncPrintf("END\n"); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h index d9580fc28..890b846dd 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h +++ b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h @@ -6,7 +6,7 @@ struct BossFd; -typedef void (*BossFdActionFunc)(struct BossFd*, GlobalContext*); +typedef void (*BossFdActionFunc)(struct BossFd*, PlayState*); typedef enum { /* -1 */ BOSSFD_WAIT_INTRO = -1, diff --git a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 8915c068f..b17081425 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -28,24 +28,24 @@ typedef enum { /* 2 */ EYE_CLOSED } BossFd2EyeState; -void BossFd2_Init(Actor* thisx, GlobalContext* globalCtx); -void BossFd2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx); -void BossFd2_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossFd2_Init(Actor* thisx, PlayState* play); +void BossFd2_Destroy(Actor* thisx, PlayState* play); +void BossFd2_Update(Actor* thisx, PlayState* play); +void BossFd2_Draw(Actor* thisx, PlayState* play); -void BossFd2_SetupEmerge(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_SetupIdle(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Idle(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Burrow(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_SetupBreatheFire(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_SetupClawSwipe(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_ClawSwipe(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Vulnerable(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Damaged(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Wait(BossFd2* this, GlobalContext* globalCtx); +void BossFd2_SetupEmerge(BossFd2* this, PlayState* play); +void BossFd2_Emerge(BossFd2* this, PlayState* play); +void BossFd2_SetupIdle(BossFd2* this, PlayState* play); +void BossFd2_Idle(BossFd2* this, PlayState* play); +void BossFd2_Burrow(BossFd2* this, PlayState* play); +void BossFd2_SetupBreatheFire(BossFd2* this, PlayState* play); +void BossFd2_BreatheFire(BossFd2* this, PlayState* play); +void BossFd2_SetupClawSwipe(BossFd2* this, PlayState* play); +void BossFd2_ClawSwipe(BossFd2* this, PlayState* play); +void BossFd2_Vulnerable(BossFd2* this, PlayState* play); +void BossFd2_Damaged(BossFd2* this, PlayState* play); +void BossFd2_Death(BossFd2* this, PlayState* play); +void BossFd2_Wait(BossFd2* this, PlayState* play); const ActorInit Boss_Fd2_InitVars = { ACTOR_BOSS_FD2, @@ -75,7 +75,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void BossFd2_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void BossFd2_SpawnDebris(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { s16 i; @@ -94,7 +94,7 @@ void BossFd2_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* } } -void BossFd2_SpawnFireBreath(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void BossFd2_SpawnFireBreath(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, s16 alpha, s16 kbAngle) { s16 i; @@ -120,7 +120,7 @@ void BossFd2_SpawnFireBreath(GlobalContext* globalCtx, BossFdEffect* effect, Vec } } -void BossFd2_SpawnEmber(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void BossFd2_SpawnEmber(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { s16 i; @@ -139,7 +139,7 @@ void BossFd2_SpawnEmber(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* p } } -void BossFd2_SpawnSkullPiece(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void BossFd2_SpawnSkullPiece(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { s16 i; @@ -175,7 +175,7 @@ void BossFd2_SpawnDust(BossFdEffect* effect, Vec3f* position, Vec3f* velocity, V } } -void BossFd2_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossFd2_Init(Actor* thisx, PlayState* play) { s32 pad; BossFd2* this = (BossFd2*)thisx; @@ -183,25 +183,25 @@ void BossFd2_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0069999993f); this->actor.world.pos.y = -850.0f; ActorShape_Init(&this->actor.shape, -580.0f / this->actor.scale.y, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gHoleVolvagiaSkel, &gHoleVolvagiaIdleAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gHoleVolvagiaSkel, &gHoleVolvagiaIdleAnim, NULL, NULL, 0); if (this->actor.params == BFD_CS_NONE) { - BossFd2_SetupEmerge(this, globalCtx); + BossFd2_SetupEmerge(this, play); } else { this->actionFunc = BossFd2_Wait; } - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->elements); } -void BossFd2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossFd2_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossFd2* this = (BossFd2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->collider); } -void BossFd2_SetupEmerge(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupEmerge(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; s16 temp_rand; s8 health; @@ -230,10 +230,10 @@ void BossFd2_SetupEmerge(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Emerge(BossFd2* this, PlayState* play) { s8 health; BossFd* bossFd = (BossFd*)this->actor.parent; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; s16 holeTime; @@ -250,7 +250,7 @@ void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx) { bossFd->faceExposed = 0; bossFd->holePosition.x = this->actor.world.pos.x; bossFd->holePosition.z = this->actor.world.pos.z; - func_80033E1C(globalCtx, 1, 0x32, 0x5000); + func_80033E1C(play, 1, 0x32, 0x5000); this->work[FD2_ACTION_STATE] = 1; this->work[FD2_HOLE_COUNTER]++; this->actor.world.pos.y = -200.0f; @@ -301,18 +301,18 @@ void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx) { case 2: Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0); if ((this->timers[0] == 1) && (this->actor.xzDistToPlayer < 120.0f)) { - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20); + func_8002F6D4(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) { - BossFd2_SetupIdle(this, globalCtx); + BossFd2_SetupIdle(this, play); } break; } osSyncPrintf("UP 2\n"); } -void BossFd2_SetupIdle(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupIdle(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; s8 health; s16 idleTime; @@ -335,7 +335,7 @@ void BossFd2_SetupIdle(BossFd2* this, GlobalContext* globalCtx) { this->timers[0] = idleTime; } -void BossFd2_Idle(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Idle(BossFd2* this, PlayState* play) { s16 prevToLink; SkelAnime_Update(&this->skelAnime); @@ -352,14 +352,14 @@ void BossFd2_Idle(BossFd2* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { if (this->actor.xzDistToPlayer < 200.0f) { - BossFd2_SetupClawSwipe(this, globalCtx); + BossFd2_SetupClawSwipe(this, play); } else { - BossFd2_SetupBreatheFire(this, globalCtx); + BossFd2_SetupBreatheFire(this, play); } } } -void BossFd2_SetupBurrow(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupBurrow(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; Animation_MorphToPlayOnce(&this->skelAnime, &gHoleVolvagiaBurrowAnim, -5.0f); @@ -369,7 +369,7 @@ void BossFd2_SetupBurrow(BossFd2* this, GlobalContext* globalCtx) { this->work[FD2_ACTION_STATE] = 0; } -void BossFd2_Burrow(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Burrow(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; if (this->work[FD2_ACTION_STATE] == 0) { @@ -386,13 +386,13 @@ void BossFd2_Burrow(BossFd2* this, GlobalContext* globalCtx) { this->actionFunc = BossFd2_Wait; bossFd->handoffSignal = FD2_SIGNAL_FLY; } else { - BossFd2_SetupEmerge(this, globalCtx); + BossFd2_SetupEmerge(this, play); } } } } -void BossFd2_SetupBreatheFire(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupBreatheFire(BossFd2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gHoleVolvagiaBreatheFireAnim, -5.0f); this->actionFunc = BossFd2_BreatheFire; this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaBreatheFireAnim); @@ -401,24 +401,24 @@ void BossFd2_SetupBreatheFire(BossFd2* this, GlobalContext* globalCtx) { static Vec3f sUnkVec = { 0.0f, 0.0f, 50.0f }; // Unused? BossFd uses a similar array for its fire breath sfx. -void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_BreatheFire(BossFd2* this, PlayState* play) { s16 i; Vec3f toLink; s16 angleX; s16 angleY; s16 breathOpacity = 0; BossFd* bossFd = (BossFd*)this->actor.parent; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 tempX; f32 tempY; SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) { - BossFd2_SetupBurrow(this, globalCtx); + BossFd2_SetupBurrow(this, play); } if ((25.0f <= this->skelAnime.curFrame) && (this->skelAnime.curFrame < 70.0f)) { if (this->skelAnime.curFrame == 25.0f) { - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_FIRE - SFX_FLAG); if (this->skelAnime.curFrame > 50) { @@ -469,7 +469,7 @@ void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&spawnSpeed, &spawnVel); breathScale = 300.0f + 50.0f * Math_SinS(this->work[FD2_VAR_TIMER] * 0x2000); - BossFd2_SpawnFireBreath(globalCtx, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, + BossFd2_SpawnFireBreath(play, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, breathOpacity, this->actor.shape.rot.y + this->headRot.y); spawnPos.x += spawnVel.x * 0.5f; @@ -477,7 +477,7 @@ void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { spawnPos.z += spawnVel.z * 0.5f; breathScale = 300.0f + 50.0f * Math_SinS(this->work[FD2_VAR_TIMER] * 0x2000); - BossFd2_SpawnFireBreath(globalCtx, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, + BossFd2_SpawnFireBreath(play, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, breathOpacity, this->actor.shape.rot.y + this->headRot.y); spawnSpeed.x = 0.0f; @@ -495,37 +495,37 @@ void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { spawnAccel.y = (spawnVel.y * -10.0f) / 100.0f; spawnAccel.z = (spawnVel.z * -10.0f) / 100.0f; - BossFd2_SpawnEmber(globalCtx, bossFd->effects, &this->headPos, &spawnVel, &spawnAccel, + BossFd2_SpawnEmber(play, bossFd->effects, &this->headPos, &spawnVel, &spawnAccel, (s16)Rand_ZeroFloat(2.0f) + 8); } } } -void BossFd2_SetupClawSwipe(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupClawSwipe(BossFd2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gHoleVolvagiaClawSwipeAnim, -5.0f); this->actionFunc = BossFd2_ClawSwipe; this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaClawSwipeAnim); } -void BossFd2_ClawSwipe(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_ClawSwipe(BossFd2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 5.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_ROAR); Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_SW_NAIL); } if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) { - BossFd2_SetupBurrow(this, globalCtx); + BossFd2_SetupBurrow(this, play); } } -void BossFd2_SetupVulnerable(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupVulnerable(BossFd2* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gHoleVolvagiaKnockoutAnim); this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaKnockoutAnim); this->actionFunc = BossFd2_Vulnerable; this->work[FD2_ACTION_STATE] = 0; } -void BossFd2_Vulnerable(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Vulnerable(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; s16 i; @@ -569,20 +569,20 @@ void BossFd2_Vulnerable(BossFd2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_KNOCKOUT); } if (this->timers[0] == 0) { - BossFd2_SetupBurrow(this, globalCtx); + BossFd2_SetupBurrow(this, play); } break; } } -void BossFd2_SetupDamaged(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupDamaged(BossFd2* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gHoleVolvagiaHitAnim); this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaHitAnim); this->actionFunc = BossFd2_Damaged; this->work[FD2_ACTION_STATE] = 0; } -void BossFd2_Damaged(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Damaged(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; SkelAnime_Update(&this->skelAnime); @@ -613,7 +613,7 @@ void BossFd2_Damaged(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_SetupDeath(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupDeath(BossFd2* this, PlayState* play) { this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaDamagedAnim); Animation_Change(&this->skelAnime, &gHoleVolvagiaDamagedAnim, 1.0f, 0.0f, this->fwork[FD2_END_FRAME], ANIMMODE_ONCE_INTERP, -3.0f); @@ -622,7 +622,7 @@ void BossFd2_SetupDeath(BossFd2* this, GlobalContext* globalCtx) { this->deathState = DEATH_START; } -void BossFd2_UpdateCamera(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_UpdateCamera(BossFd2* this, PlayState* play) { if (this->deathCamera != SUBCAM_FREE) { Math_ApproachF(&this->camData.eye.x, this->camData.nextEye.x, this->camData.eyeMaxVel.x, this->camData.eyeVel.x * this->camData.speedMod); @@ -638,17 +638,17 @@ void BossFd2_UpdateCamera(BossFd2* this, GlobalContext* globalCtx) { this->camData.atVel.z * this->camData.speedMod); Math_ApproachF(&this->camData.speedMod, 1.0f, 1.0f, this->camData.accel); this->camData.at.y += this->camData.yMod; - Gameplay_CameraSetAtEye(globalCtx, this->deathCamera, &this->camData.at, &this->camData.eye); + Play_CameraSetAtEye(play, this->deathCamera, &this->camData.at, &this->camData.eye); Math_ApproachF(&this->camData.yMod, 0.0f, 1.0f, 0.1f); } } -void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Death(BossFd2* this, PlayState* play) { f32 retreatSpeed; Vec3f sp70; Vec3f sp64; BossFd* bossFd = (BossFd*)this->actor.parent; - Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Play_GetCamera(play, MAIN_CAM); f32 pad3; f32 pad2; f32 pad1; @@ -659,11 +659,11 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { switch (this->deathState) { case DEATH_START: this->deathState = DEATH_RETREAT; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->deathCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->deathCamera, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->deathCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->deathCamera, CAM_STAT_ACTIVE); this->camData.eye = mainCam->eye; this->camData.at = mainCam->at; this->camData.eyeVel.x = 100.0f; @@ -753,7 +753,7 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { this->work[FD2_ACTION_STATE]++; this->camData.speedMod = 0.0f; this->camData.accel = 0.02f; - func_8002DF54(globalCtx, &bossFd->actor, 1); + func_8002DF54(play, &bossFd->actor, 1); } } if ((bossFd->work[BFD_ACTION_STATE] == BOSSFD_BONES_FALL) && (bossFd->timers[0] == 5)) { @@ -784,39 +784,39 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { mainCam->eye = this->camData.eye; mainCam->eyeNext = this->camData.eye; mainCam->at = this->camData.at; - func_800C08AC(globalCtx, this->deathCamera, 0); + func_800C08AC(play, this->deathCamera, 0); this->deathCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } break; case DEATH_FINISH: break; } - BossFd2_UpdateCamera(this, globalCtx); + BossFd2_UpdateCamera(this, play); } -void BossFd2_Wait(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Wait(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; if (bossFd->handoffSignal == FD2_SIGNAL_GROUND) { bossFd->handoffSignal = FD2_SIGNAL_NONE; - BossFd2_SetupEmerge(this, globalCtx); + BossFd2_SetupEmerge(this, play); this->timers[0] = 20; this->work[FD2_HOLE_COUNTER] = 0; } } -void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_CollisionCheck(BossFd2* this, PlayState* play) { s16 i; ColliderInfo* hurtbox; BossFd* bossFd = (BossFd*)this->actor.parent; if (this->actionFunc == BossFd2_ClawSwipe) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); for (i = 0; i < ARRAY_COUNT(this->elements); i++) { if (this->collider.elements[i].info.toucherFlags & TOUCH_HIT) { @@ -844,7 +844,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { bossFd->actor.colChkInfo.health = 1; } bossFd->faceExposed = true; - BossFd2_SetupVulnerable(this, globalCtx); + BossFd2_SetupVulnerable(this, play); this->work[FD2_INVINC_TIMER] = 30; this->work[FD2_DAMAGE_FLASH_TIMER] = 5; Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_MAHI1); @@ -861,7 +861,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { debrisPos.y = this->actor.focus.pos.y; debrisPos.z = this->actor.focus.pos.z; - BossFd2_SpawnDebris(globalCtx, bossFd->effects, &debrisPos, &debrisVel, &debrisAccel, + BossFd2_SpawnDebris(play, bossFd->effects, &debrisPos, &debrisVel, &debrisAccel, (s16)Rand_ZeroFloat(10.0) + 10); } } @@ -887,14 +887,14 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { if ((s8)bossFd->actor.colChkInfo.health <= 0) { bossFd->actor.colChkInfo.health = 0; - BossFd2_SetupDeath(this, globalCtx); + BossFd2_SetupDeath(this, play); this->work[FD2_DAMAGE_FLASH_TIMER] = 10; this->work[FD2_INVINC_TIMER] = 30000; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (damage) { - BossFd2_SetupDamaged(this, globalCtx); + BossFd2_SetupDamaged(this, play); this->work[FD2_DAMAGE_FLASH_TIMER] = 10; this->work[FD2_INVINC_TIMER] = 100; Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_DAMAGE1); @@ -913,7 +913,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { piecePos.y = this->actor.focus.pos.y; piecePos.z = this->actor.focus.pos.z; - BossFd2_SpawnSkullPiece(globalCtx, bossFd->effects, &piecePos, &pieceVel, &pieceAccel, + BossFd2_SpawnSkullPiece(play, bossFd->effects, &piecePos, &pieceVel, &pieceAccel, (s16)Rand_ZeroFloat(6.0f) + 10); } } @@ -921,7 +921,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_UpdateFace(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_UpdateFace(BossFd2* this, PlayState* play) { f32 maxOpen; f32 openRate; s16 eyeStates[5] = { EYE_OPEN, EYE_HALF, EYE_CLOSED, EYE_CLOSED, EYE_HALF }; @@ -957,8 +957,8 @@ void BossFd2_UpdateFace(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossFd2_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossFd2* this = (BossFd2*)thisx; s16 i; @@ -968,7 +968,7 @@ void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->work[FD2_VAR_TIMER]++; this->work[FD2_UNK_TIMER]++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { @@ -984,16 +984,16 @@ void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->deathState == DEATH_START) { if (this->work[FD2_INVINC_TIMER] == 0) { - BossFd2_CollisionCheck(this, globalCtx); + BossFd2_CollisionCheck(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (!this->disableAT) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } - BossFd2_UpdateFace(this, globalCtx); + BossFd2_UpdateFace(this, play); this->fwork[FD2_TEX1_SCROLL_X] += 4.0f; this->fwork[FD2_TEX1_SCROLL_Y] = 120.0f; this->fwork[FD2_TEX2_SCROLL_X] += 3.0f; @@ -1005,7 +1005,7 @@ void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 BossFd2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossFd2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd2* this = (BossFd2*)thisx; BossFd* bossFd = (BossFd*)this->actor.parent; @@ -1028,15 +1028,15 @@ s32 BossFd2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } if ((limbIndex == 32) || (limbIndex == 35) || (limbIndex == 36)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, (s8)bossFd->fwork[BFD_HEAD_TEX2_ALPHA]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, (s8)bossFd->fwork[BFD_BODY_TEX2_ALPHA]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if ((0 < limbIndex) && (limbIndex < 16)) { *dList = NULL; @@ -1044,7 +1044,7 @@ s32 BossFd2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void BossFd2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossFd2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f targetMod = { 4500.0f, 0.0f, 0.0f }; static Vec3f headMod = { 4000.0f, 0.0f, 0.0f }; static Vec3f centerManeMod = { 4000.0f, -2900.0, 2000.0f }; @@ -1062,7 +1062,7 @@ void BossFd2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->collider); } -void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Vec3f* pos, Vec3f* rot, Vec3f* pull, +void BossFd2_UpdateMane(BossFd2* this, PlayState* play, Vec3f* head, Vec3f* pos, Vec3f* rot, Vec3f* pull, f32* scale) { f32 sp138[10] = { 0.0f, 100.0f, 50.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; f32 sp110[10] = { 0.0f, 5.0f, -10.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f }; @@ -1077,7 +1077,7 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve Vec3f spB0; f32 xyScale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); gDPPipeSync(POLY_OPA_DISP++); @@ -1155,73 +1155,73 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve xyScale = (0.01f - (i * 0.0009f)) * spE8[i] * scale[i]; Matrix_Scale(xyScale, xyScale, 0.01f * spE8[i], MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHoleVolvagiaManeModelDL); FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossFd2_DrawMane(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_DrawMane(BossFd2* this, PlayState* play) { s32 pad; BossFd* bossFd = (BossFd*)this->actor.parent; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < 10; i++) { this->centerMane.scale[i] = 1.5f + 0.3f * Math_SinS(5596.0f * this->work[FD2_VAR_TIMER] + i * 0x3200); this->rightMane.scale[i] = 1.5f + 0.3f * Math_SinS(5496.0f * this->work[FD2_VAR_TIMER] + i * 0x3200); this->leftMane.scale[i] = 1.5f + 0.3f * Math_CosS(5696.0f * this->work[FD2_VAR_TIMER] + i * 0x3200); } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gHoleVolvagiaManeMaterialDL); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, bossFd->fwork[BFD_MANE_COLOR_CENTER], 0, 255); - BossFd2_UpdateMane(this, globalCtx, &this->centerMane.head, this->centerMane.pos, this->centerMane.rot, + BossFd2_UpdateMane(this, play, &this->centerMane.head, this->centerMane.pos, this->centerMane.rot, this->centerMane.pull, this->centerMane.scale); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, bossFd->fwork[BFD_MANE_COLOR_RIGHT], 0, 255); - BossFd2_UpdateMane(this, globalCtx, &this->rightMane.head, this->rightMane.pos, this->rightMane.rot, + BossFd2_UpdateMane(this, play, &this->rightMane.head, this->rightMane.pos, this->rightMane.rot, this->rightMane.pull, this->rightMane.scale); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, bossFd->fwork[BFD_MANE_COLOR_LEFT], 0, 255); - BossFd2_UpdateMane(this, globalCtx, &this->leftMane.head, this->leftMane.pos, this->leftMane.rot, + BossFd2_UpdateMane(this, play, &this->leftMane.head, this->leftMane.pos, this->leftMane.rot, this->leftMane.pull, this->leftMane.scale); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossFd2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossFd2_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gHoleVolvagiaEyeOpenTex, gHoleVolvagiaEyeHalfTex, gHoleVolvagiaEyeClosedTex }; s32 pad; BossFd2* this = (BossFd2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); osSyncPrintf("FD2 draw start \n"); if (this->actionFunc != BossFd2_Wait) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->work[FD2_DAMAGE_FLASH_TIMER] & 2) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 255, 255, 0, 900, 1099); } gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeState])); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->fwork[FD2_TEX1_SCROLL_X], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->fwork[FD2_TEX1_SCROLL_X], (s16)this->fwork[FD2_TEX1_SCROLL_Y], 0x20, 0x20, 1, (s16)this->fwork[FD2_TEX2_SCROLL_X], (s16)this->fwork[FD2_TEX2_SCROLL_Y], 0x20, 0x20)); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 128); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossFd2_OverrideLimbDraw, BossFd2_PostLimbDraw, &this->actor); - BossFd2_DrawMane(this, globalCtx); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + BossFd2_DrawMane(this, play); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h index 7133b78a6..cd7f82998 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h +++ b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h @@ -6,7 +6,7 @@ struct BossFd2; -typedef void (*BossFd2ActionFunc)(struct BossFd2*, GlobalContext*); +typedef void (*BossFd2ActionFunc)(struct BossFd2*, PlayState*); typedef enum { /* 0 */ FD2_SIGNAL_NONE, diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 3c8ac37e8..e2e54d1a2 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -15,41 +15,41 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGanon_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx); // update -void func_808E2544(Actor* thisx, GlobalContext* globalCtx); // update -void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx); -void func_808E229C(Actor* thisx, GlobalContext* globalCtx); // draw -void func_808E324C(Actor* thisx, GlobalContext* globalCtx); // draw -void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGanon_Init(Actor* thisx, PlayState* play); +void BossGanon_Destroy(Actor* thisx, PlayState* play); +void BossGanon_Update(Actor* thisx, PlayState* play); +void BossGanon_Draw(Actor* thisx, PlayState* play); +void func_808E1EB4(Actor* thisx, PlayState* play); // update +void func_808E2544(Actor* thisx, PlayState* play); // update +void BossGanon_LightBall_Update(Actor* thisx, PlayState* play); +void func_808E229C(Actor* thisx, PlayState* play); // draw +void func_808E324C(Actor* thisx, PlayState* play); // draw +void BossGanon_LightBall_Draw(Actor* thisx, PlayState* play); void BossGanon_Reset(void); -void BossGanon_SetupIntroCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_SetupTowerCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Damaged(BossGanon* this, GlobalContext* globalCtx); +void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play); +void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play); +void BossGanon_IntroCutscene(BossGanon* this, PlayState* play); +void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play); +void BossGanon_Wait(BossGanon* this, PlayState* play); +void BossGanon_ChargeLightBall(BossGanon* this, PlayState* play); +void BossGanon_PlayTennis(BossGanon* this, PlayState* play); +void BossGanon_PoundFloor(BossGanon* this, PlayState* play); +void BossGanon_ChargeBigMagic(BossGanon* this, PlayState* play); +void BossGanon_Block(BossGanon* this, PlayState* play); +void BossGanon_HitByLightBall(BossGanon* this, PlayState* play); +void BossGanon_Vulnerable(BossGanon* this, PlayState* play); +void BossGanon_Damaged(BossGanon* this, PlayState* play); -void BossGanon_SetupWait(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_SetupChargeLightBall(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_SetupPlayTennis(BossGanon* this, GlobalContext* globalCtx); +void BossGanon_SetupWait(BossGanon* this, PlayState* play); +void BossGanon_SetupChargeLightBall(BossGanon* this, PlayState* play); +void BossGanon_SetupPlayTennis(BossGanon* this, PlayState* play); -void BossGanon_DrawEffects(GlobalContext* globalCtx); -void BossGanon_UpdateEffects(GlobalContext* globalCtx); +void BossGanon_DrawEffects(PlayState* play); +void BossGanon_UpdateEffects(PlayState* play); -s32 BossGanon_CheckFallingPlatforms(BossGanon* this, GlobalContext* globalCtx, Vec3f* checkPos); +s32 BossGanon_CheckFallingPlatforms(BossGanon* this, PlayState* play, Vec3f* checkPos); const ActorInit Boss_Ganon_InitVars = { ACTOR_BOSS_GANON, @@ -119,10 +119,10 @@ EnZl3* sBossGanonZelda; GanondorfEffect sBossGanonEffectBuf[200]; -void BossGanonEff_SpawnWindowShard(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, f32 scale) { +void BossGanonEff_SpawnWindowShard(PlayState* play, Vec3f* pos, Vec3f* velocity, f32 scale) { static Color_RGB8 shardColors[] = { { 255, 175, 85 }, { 155, 205, 155 }, { 155, 125, 55 } }; s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; Color_RGB8* color; for (i = 0; i < 200; i++, eff++) { @@ -146,10 +146,10 @@ void BossGanonEff_SpawnWindowShard(GlobalContext* globalCtx, Vec3f* pos, Vec3f* } } -void BossGanonEff_SpawnSparkle(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, +void BossGanonEff_SpawnSparkle(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 arg6) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -167,10 +167,10 @@ void BossGanonEff_SpawnSparkle(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velo } } -void BossGanonEff_SpawnLightRay(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, +void BossGanonEff_SpawnLightRay(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, f32 arg5, s16 arg6) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -192,9 +192,9 @@ void BossGanonEff_SpawnLightRay(GlobalContext* globalCtx, Vec3f* pos, Vec3f* vel } } -void BossGanonEff_SpawnShock(GlobalContext* globalCtx, f32 scale, s16 shockType) { +void BossGanonEff_SpawnShock(PlayState* play, f32 scale, s16 shockType) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 75; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -212,9 +212,9 @@ void BossGanonEff_SpawnShock(GlobalContext* globalCtx, f32 scale, s16 shockType) } } -void BossGanonEff_SpawnLightning(GlobalContext* globalCtx, f32 scale, f32 arg2, f32 arg3) { +void BossGanonEff_SpawnLightning(PlayState* play, f32 scale, f32 arg2, f32 arg3) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -232,9 +232,9 @@ void BossGanonEff_SpawnLightning(GlobalContext* globalCtx, f32 scale, f32 arg2, } } -void BossGanonEff_SpawnDustDark(GlobalContext* globalCtx, Vec3f* pos, f32 scale, f32 arg3) { +void BossGanonEff_SpawnDustDark(PlayState* play, Vec3f* pos, f32 scale, f32 arg3) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -253,8 +253,8 @@ void BossGanonEff_SpawnDustDark(GlobalContext* globalCtx, Vec3f* pos, f32 scale, } } -void BossGanonEff_SpawnDustLight(GlobalContext* globalCtx, Vec3f* pos, f32 scale, f32 arg3, s16 bufIndex) { - GanondorfEffect* effArr = globalCtx->specialEffects; +void BossGanonEff_SpawnDustLight(PlayState* play, Vec3f* pos, f32 scale, f32 arg3, s16 bufIndex) { + GanondorfEffect* effArr = play->specialEffects; effArr[bufIndex].type = GDF_EFF_IMPACT_DUST_LIGHT; effArr[bufIndex].pos = *pos; @@ -268,9 +268,9 @@ void BossGanonEff_SpawnDustLight(GlobalContext* globalCtx, Vec3f* pos, f32 scale effArr[bufIndex].epoch++; } -void BossGanonEff_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, f32 scale, f32 arg3) { +void BossGanonEff_SpawnShockwave(PlayState* play, Vec3f* pos, f32 scale, f32 arg3) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -290,9 +290,9 @@ void BossGanonEff_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, f32 scale } } -void BossGanonEff_SpawnBlackDot(GlobalContext* globalCtx, Vec3f* pos, f32 scale) { +void BossGanonEff_SpawnBlackDot(PlayState* play, Vec3f* pos, f32 scale) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -317,9 +317,9 @@ void BossGanon_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) { collider->dim.pos.z = pos->z; } -void BossGanon_SetAnimationObject(BossGanon* this, GlobalContext* globalCtx, s32 objectId) { - this->animBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); +void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId) { + this->animBankIndex = Object_GetIndex(&play->objectCtx, objectId); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); } static InitChainEntry sInitChain[] = { @@ -329,19 +329,19 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { +void BossGanon_Init(Actor* thisx, PlayState* play2) { s16 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossGanon* this = (BossGanon*)thisx; s32 cond; f32 xDistFromPlayer; f32 yDistFromPlayer; f32 zDistFromPlayer; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (thisx->params < 0x64) { - Flags_SetSwitch(globalCtx, 0x14); - globalCtx->specialEffects = sBossGanonEffectBuf; + Flags_SetSwitch(play, 0x14); + play->specialEffects = sBossGanonEffectBuf; for (i = 0; i < ARRAY_COUNT(sBossGanonEffectBuf); i++) { sBossGanonEffectBuf[i].type = GDF_EFF_NONE; @@ -352,31 +352,31 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0, NULL, 0); Actor_SetScale(thisx, 0.01f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGanondorfSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sDorfCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGanondorfSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sDorfCylinderInit); if (thisx->params != 1) { - BossGanon_SetupIntroCutscene(this, globalCtx); + BossGanon_SetupIntroCutscene(this, play); this->organAlpha = 255; } else { - cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); + cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (!cond) { - BossGanon_SetupTowerCutscene(this, globalCtx); + BossGanon_SetupTowerCutscene(this, play); } else { Actor_Kill(thisx); return; } - BossGanon_SetupTowerCutscene(this, globalCtx); + BossGanon_SetupTowerCutscene(this, play); } - sBossGanonCape = (EnGanonMant*)Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_GANON_MANT, 0.0f, + sBossGanonCape = (EnGanonMant*)Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_GANON_MANT, 0.0f, 0.0f, 0.0f, 0, 0, 0, 1); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BOSS); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BOSS); } else { thisx->flags &= ~ACTOR_FLAG_0; this->fwork[GDF_FWORK_1] = 255.0f; @@ -402,8 +402,8 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->timers[1] = 3; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sLightBallCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sLightBallCylinderInit); } else if (thisx->params >= 0xFA) { // big magic light ball charge thisx->update = func_808E2544; @@ -449,38 +449,38 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->timers[1] = 3; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sLightBallCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sLightBallCylinderInit); } } } -void BossGanon_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon_Destroy(Actor* thisx, PlayState* play) { BossGanon* this = (BossGanon*)thisx; if ((this->actor.params < 0xC8) || (this->actor.params >= 0x104)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } if (this->actor.params < 0x64) { - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } } -void BossGanon_SetupIntroCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME2); + s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); if (animBankIndex < 0) { Actor_Kill(&this->actor); return; } - if (Object_IsLoaded(&globalCtx->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { this->actionFunc = BossGanon_IntroCutscene; this->unk_198 = 1; this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); Animation_MorphToLoop(&this->skelAnime, &gGanondorfPlayOrganAnim, 0.0f); } else { this->actionFunc = BossGanon_SetupIntroCutscene; @@ -520,15 +520,15 @@ void BossGanon_SetIntroCsCamera(BossGanon* this, u8 camPosIndex) { this->csCamAt.z = camPos->at.z; } -void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { u8 moveCam = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; f32 sin; f32 cos; Camera* mainCam; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); sBossGanonCape->backPush = -2.0f; sBossGanonCape->backSwayMagnitude = 0.25f; @@ -552,11 +552,11 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = -7000.0f; this->actor.shape.rot.y = 0; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamIndex = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamIndex = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); this->csCamFov = 60.0f; if (gSaveContext.eventChkInf[7] & 0x100 || gSaveContext.n64ddFlag) { @@ -576,11 +576,11 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->useOpenHand = true; BossGanon_SetIntroCsCamera(this, 0); this->csState = 1; - sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f, + sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f, 220.0f, -150.0f, 0, 0, 0, 0x2000); } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GANON_ORGAN, 0.0f, 0.0f, 0.0f, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GANON_ORGAN, 0.0f, 0.0f, 0.0f, 0, 0, 0, 1); sBossGanonCape->minY = 57.0f; // fallthrough @@ -596,7 +596,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { BossGanon_SetIntroCsCamera(this, 1); if (this->csTimer == 10) { - func_8002DF54(globalCtx, &this->actor, 5); + func_8002DF54(play, &this->actor, 5); } if (this->csTimer == 13) { @@ -619,7 +619,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { // fallthrough case 3: this->envLightMode = 0; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; this->csCamAt.y = (sinf(this->unk_704) * 300.0f) + this->csCamEye.y; this->csCamAt.z = (cosf(this->unk_704) * -300.0f) + this->csCamEye.z; Math_ApproachF(&this->unk_704, 0.25f, 0.05f, this->csCamAtMaxStep.y); @@ -629,7 +629,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { break; } - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); this->csState = 4; BossGanon_SetIntroCsCamera(this, 2); this->csTimer = 0; @@ -657,11 +657,11 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->envLightMode = 5; if (this->csTimer < 50) { - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } if (this->csTimer == 10) { - func_8002DF54(globalCtx, &this->actor, 0x4B); + func_8002DF54(play, &this->actor, 0x4B); } if (this->csTimer == 70) { @@ -688,7 +688,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_TRIFORCE_PRIM_B] = 255.0f; this->fwork[GDF_TRIFORCE_ENV_G] = 100.0f; func_80078884(NA_SE_EV_TRIFORCE_MARK); - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; // fallthrough case 7: this->envLightMode = 6; @@ -703,7 +703,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 30) { - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } BossGanon_SetIntroCsCamera(this, 4); @@ -727,7 +727,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csState = 9; this->csTimer = 0; - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); sBossGanonZelda->unk_3C8 = 0; this->triforceType = GDF_TRIFORCE_ZELDA; this->fwork[GDF_TRIFORCE_SCALE] = 10.0f; @@ -735,7 +735,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_TRIFORCE_PRIM_B] = 255.0f; this->fwork[GDF_TRIFORCE_ENV_G] = 100.0f; func_80078884(NA_SE_EV_TRIFORCE_MARK); - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; // fallthrough case 9: this->envLightMode = 7; @@ -755,7 +755,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 32) { - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } if (this->csTimer == 50) { @@ -781,7 +781,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { player->actor.world.pos.z = 20.0f; if (this->csTimer == 20) { - func_8002DF54(globalCtx, &this->actor, 0x17); + func_8002DF54(play, &this->actor, 0x17); Interface_ChangeAlpha(11); // show hearts only } @@ -815,10 +815,10 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 80) { - Message_StartTextbox(globalCtx, 0x70C8, NULL); + Message_StartTextbox(play, 0x70C8, NULL); } - if ((this->csTimer > 180) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 180) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 15; this->csTimer = 0; this->useOpenHand = false; @@ -827,14 +827,14 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { case 15: // side view of all 3 of them this->envLightMode = 0; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; BossGanon_SetIntroCsCamera(this, 10); if (this->csTimer == 30) { - Message_StartTextbox(globalCtx, 0x70C9, NULL); + Message_StartTextbox(play, 0x70C9, NULL); } - if ((this->csTimer > 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 16; this->csTimer = 0; BossGanon_SetIntroCsCamera(this, 11); @@ -854,12 +854,12 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfStandUpFromOrganAnim); } } else if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - Message_StartTextbox(globalCtx, 0x70CA, NULL); + Message_StartTextbox(play, 0x70CA, NULL); Animation_MorphToLoop(&this->skelAnime, &gGanondorfStandBackwardsAnim, -5.0f); this->fwork[GDF_FWORK_1] = 1000.0f; } - if ((this->csTimer > 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 17; this->csTimer = 0; } @@ -892,7 +892,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csCamFov = 60.0f; BossGanon_SetIntroCsCamera(this, 12); if (!gSaveContext.n64ddFlag) { - Message_StartTextbox(globalCtx, 0x70CB, NULL); + Message_StartTextbox(play, 0x70CB, NULL); } } } @@ -909,20 +909,20 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_FWORK_1] = 1000.0f; } - if ((this->csTimer <= 50) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((this->csTimer <= 50) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { break; } this->csState = 19; this->csTimer = 0; - Message_StartTextbox(globalCtx, 0x70CC, NULL); + Message_StartTextbox(play, 0x70CC, NULL); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfRaiseHandStartAnim, -5.0f); this->triforceType = GDF_TRIFORCE_DORF; this->fwork[GDF_TRIFORCE_SCALE] = 10.0f; this->fwork[GDF_TRIFORCE_PRIM_A] = 0.0f; this->fwork[GDF_TRIFORCE_PRIM_B] = 255.0f; this->fwork[GDF_TRIFORCE_ENV_G] = 100.0f; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; // fallthrough case 19: // show triforce this->envLightMode = 8; @@ -931,7 +931,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->envLightMode = 9; if (this->csTimer == 60) { - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } } @@ -955,7 +955,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { Animation_MorphToLoop(&this->skelAnime, &gGanondorfRaiseHandLoopAnim, -5.0f); } - if ((this->csTimer > 80) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 80) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 20; this->csTimer = 0; @@ -998,12 +998,12 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer > 20) { - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); } if (this->csTimer == 30) { - func_8002DF54(globalCtx, &this->actor, 0x4A); + func_8002DF54(play, &this->actor, 0x4A); } if (this->csTimer <= 50) { @@ -1019,8 +1019,8 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { case 21: // purple vortex this->envLightMode = 11; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DARKWAVE_M - SFX_FLAG); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); skip_sound_and_fx: this->csCamEye.x = -30.0f; @@ -1032,10 +1032,10 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csCamAt.z = 0.0f; if (this->csTimer == 13) { - Message_StartTextbox(globalCtx, 0x70CD, NULL); + Message_StartTextbox(play, 0x70CD, NULL); } - if ((this->csTimer <= 120) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((this->csTimer <= 120) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { break; } @@ -1066,7 +1066,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachF(&this->csCamAt.x, this->unk_1FC.x - 10.0f, 0.1f, 5.0f); if (this->csTimer == 20) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfGetUp3Anim, 0.0f); SkelAnime_Update(&this->skelAnime); this->actor.shape.yOffset = 0.0f; @@ -1078,10 +1078,10 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { if (this->csTimer == 50) { gSegments[6] = VIRTUAL_TO_PHYSICAL( - globalCtx->objectCtx.status[Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON)].segment); + play->objectCtx.status[Object_GetIndex(&play->objectCtx, OBJECT_GANON)].segment); if (!(gSaveContext.eventChkInf[7] & 0x100)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGanondorfTitleCardTex), 160, 180, 128, 40, false); } @@ -1119,15 +1119,15 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 120) { - mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam = Play_GetCamera(play, MAIN_CAM); mainCam->eye = this->csCamEye; mainCam->eyeNext = this->csCamEye; mainCam->at = this->csCamAt; - func_800C08AC(globalCtx, this->csCamIndex, 0); + func_800C08AC(play, this->csCamIndex, 0); this->csState = this->csCamIndex = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - BossGanon_SetupWait(this, globalCtx); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + BossGanon_SetupWait(this, play); } if (sBossGanonZelda != NULL) { @@ -1154,34 +1154,34 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csCamAtMaxStep.z * this->csCamMaxStepScale); } - Gameplay_CameraSetAtEye(globalCtx, this->csCamIndex, &this->csCamAt, &this->csCamEye); - Gameplay_CameraSetFov(globalCtx, this->csCamIndex, this->csCamFov); + Play_CameraSetAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); + Play_CameraSetFov(play, this->csCamIndex, this->csCamFov); } } -void BossGanon_SetupDeathCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME2); + s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); - if (Object_IsLoaded(&globalCtx->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { this->actionFunc = BossGanon_DeathAndTowerCutscene; this->csTimer = this->csState = 0; this->unk_198 = 1; this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->unk_508 = 0.0f; } } -void BossGanon_SetupTowerCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME2); + s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); - if (Object_IsLoaded(&globalCtx->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->actionFunc = BossGanon_DeathAndTowerCutscene; @@ -1210,7 +1210,7 @@ void BossGanon_ShatterWindows(u8 windowShatterState) { } } -void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { static Color_RGBA8 bloodPrimColor = { 0, 120, 0, 255 }; static Color_RGBA8 bloodEnvColor = { 0, 120, 0, 255 }; @@ -1224,7 +1224,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) s16 i; u8 moveCam = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 pad; Vec3f sp98; Vec3f sp8C; @@ -1233,18 +1233,18 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) Camera* mainCam; Vec3f sp64; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); this->csTimer++; SkelAnime_Update(&this->skelAnime); switch (this->csState) { case 0: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamIndex = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamIndex = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); this->actor.world.pos.x = 0.0f; this->actor.world.pos.y = 70.0f; @@ -1267,11 +1267,11 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->envLightMode = 13; if (this->csTimer < 30) { - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } if (this->csTimer >= 2) { - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; } this->csCamEye.x = -50.0f; @@ -1303,7 +1303,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) if (this->csTimer >= 30) { this->csState = 3; this->csTimer = 0; - Message_StartTextbox(globalCtx, 0x70CE, NULL); + Message_StartTextbox(play, 0x70CE, NULL); this->fwork[GDF_FWORK_1] = 1000.0f; } @@ -1328,7 +1328,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = this->unk_1FC.z; if ((this->fwork[GDF_FWORK_1] > 100.0f) && (this->csTimer > 100) && - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfVomitStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfVomitStartAnim); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_TOKETU); @@ -1347,7 +1347,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) sp80.y = this->unk_208.y - 10.0f; sp80.z = this->unk_208.z; - func_8002836C(globalCtx, &sp80, &sp98, &sp8C, &bloodPrimColor, &bloodEnvColor, + func_8002836C(play, &sp80, &sp98, &sp8C, &bloodPrimColor, &bloodEnvColor, (s16)Rand_ZeroFloat(50.0f) + 50, 0, 17); } } @@ -1364,7 +1364,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->envLightMode = 14; if (this->csTimer == 30) { - Message_StartTextbox(globalCtx, 0x70CF, NULL); + Message_StartTextbox(play, 0x70CF, NULL); this->csState = 5; this->csTimer = 0; } @@ -1373,7 +1373,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) case 5: this->envLightMode = 14; - if ((this->csTimer > 70) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 70) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 6; this->csTimer = 0; Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfYellStartAnim, 0.0f); @@ -1415,13 +1415,13 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->envLightMode = 15; this->unk_508 = 0.0f; this->fwork[GDF_FWORK_1] = 1000.0f; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } break; case 7: if (this->csTimer < 10) { - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } if (this->csTimer == 30) { @@ -1476,7 +1476,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BODY_SPARK - SFX_FLAG); if (this->csTimer == 2) { - func_8002DF54(globalCtx, &this->actor, 0x39); + func_8002DF54(play, &this->actor, 0x39); } if (this->csTimer > 50) { @@ -1504,29 +1504,29 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) } if (this->csTimer == 180) { - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SKIP_TOWER_ESCAPE)) { Flags_SetEventChkInf(0xC7); - globalCtx->nextEntranceIndex = 0x517; + play->nextEntranceIndex = 0x517; } else { - globalCtx->nextEntranceIndex = 0x43F; + play->nextEntranceIndex = 0x43F; } - globalCtx->fadeTransition = 5; + play->fadeTransition = 5; } break; case 100: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamIndex = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamIndex = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfCollapseAnim, 0.0f); this->fwork[1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->csState = 101; this->skelAnime.playSpeed = 0.0f; - sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f, + sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f, 6000.0f, 0.0f, 0, 0, 0, 0x2000); player->actor.world.pos.x = -472.0f; @@ -1556,7 +1556,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) sBossGanonCape->tearTimer = 20; this->whiteFillAlpha = 255.0f; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; // fallthrough case 101: player->actor.world.pos.y = 4102.0f; @@ -1585,7 +1585,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) if (this->csTimer == 190) { sp74 = this->actor.world.pos; sp74.y = 4102.0f; - BossGanonEff_SpawnDustDark(globalCtx, &sp74, 0.2f, 0.7f); + BossGanonEff_SpawnDustDark(play, &sp74, 0.2f, 0.7f); } if (this->csTimer == 230) { @@ -1607,11 +1607,11 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = -135.0f; if (this->csTimer == 5) { - func_8002DF54(globalCtx, &this->actor, 0x4C); + func_8002DF54(play, &this->actor, 0x4C); } if (this->csTimer == 70) { - func_8002DF54(globalCtx, &this->actor, 0x4D); + func_8002DF54(play, &this->actor, 0x4D); } if (this->csTimer == 90) { @@ -1654,7 +1654,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = sBossGanonZelda->actor.world.pos.z; if (this->csTimer >= 10) { - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f); } if (this->csTimer == 10) { @@ -1681,10 +1681,10 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = sBossGanonZelda->actor.world.pos.z - 25.0f; if (this->csTimer == 10) { - Message_StartTextbox(globalCtx, 0x70D0, NULL); + Message_StartTextbox(play, 0x70D0, NULL); } - if ((this->csTimer > 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 1055; this->csTimer = 0; } @@ -1696,7 +1696,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) if (this->csTimer == 20) { sBossGanonZelda->unk_3C8 = 5; - func_8002DF54(globalCtx, &this->actor, 0x39); + func_8002DF54(play, &this->actor, 0x39); } if (this->csTimer == 40) { @@ -1756,14 +1756,14 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) } if (this->csTimer == 90) { - Message_StartTextbox(globalCtx, 0x70D1, NULL); + Message_StartTextbox(play, 0x70D1, NULL); } - if ((this->csTimer > 150) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 150) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 107; this->csTimer = 0; - Message_StartTextbox(globalCtx, 0x70D2, NULL); - func_8002DF54(globalCtx, &this->actor, 0x39); + Message_StartTextbox(play, 0x70D2, NULL); + func_8002DF54(play, &this->actor, 0x39); } break; @@ -1779,7 +1779,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.y = (sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f; this->csCamAt.z = (sBossGanonZelda->actor.world.pos.z - 25.0f) + 80.0f; - if ((this->csTimer > 50) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 50) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { sBossGanonZelda->unk_3C8 = 7; this->csState = 108; this->csTimer = 0; @@ -1795,18 +1795,18 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = (sBossGanonZelda->actor.world.pos.z - 25.0f) + 80.0f; if (this->csTimer > 50) { - mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam = Play_GetCamera(play, MAIN_CAM); mainCam->eye = this->csCamEye; mainCam->eyeNext = this->csCamEye; mainCam->at = this->csCamAt; - func_800C08AC(globalCtx, this->csCamIndex, 0); + func_800C08AC(play, this->csCamIndex, 0); this->csState = 109; this->csCamIndex = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Flags_SetSwitch(globalCtx, 0x37); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Flags_SetSwitch(play, 0x37); } break; @@ -1837,11 +1837,11 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) sp64 = this->csCamAt; sp64.y += this->unk_70C; - Gameplay_CameraSetAtEye(globalCtx, this->csCamIndex, &sp64, &this->csCamEye); + Play_CameraSetAtEye(play, this->csCamIndex, &sp64, &this->csCamEye); } } -void BossGanon_SetupPoundFloor(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupPoundFloor(BossGanon* this, PlayState* play) { this->unk_1C2 = 0; this->timers[0] = 40; this->actionFunc = BossGanon_PoundFloor; @@ -1850,7 +1850,7 @@ void BossGanon_SetupPoundFloor(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_CENTER_POS] = 100.0f; } -void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_PoundFloor(BossGanon* this, PlayState* play) { s16 i; f32 heightTarget; f32 targetPosX; @@ -1911,7 +1911,7 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y = 60.0f; this->unk_1C2 = 2; this->timers[0] = 10; - func_80033E88(&this->actor, globalCtx, 0xA, 0x14); // rumble + func_80033E88(&this->actor, play, 0xA, 0x14); // rumble this->unk_19C = 35; this->unk_19E = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_HIT_GND_IMP); @@ -1923,7 +1923,7 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { sp6C.x = Rand_CenteredFloat(25.0f); sp6C.y = Rand_ZeroFloat(17.0f); sp6C.z = Rand_CenteredFloat(25.0f); - BossGanonEff_SpawnLightRay(globalCtx, &sp60, &sp6C, &sZeroVec, Rand_ZeroFloat(300.0f) + 500.0f, + BossGanonEff_SpawnLightRay(play, &sp60, &sp6C, &sZeroVec, Rand_ZeroFloat(300.0f) + 500.0f, 13.0f, 0x1E); } } @@ -1960,7 +1960,7 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.velocity.y, 20.0f, 1.0f, 1.0f); if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } break; } @@ -1968,17 +1968,17 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { if ((this->unk_19C == 35) || (this->unk_19C == 30) || (this->unk_19C == 25)) { sp54 = this->actor.world.pos; sp54.y = 0.0f; - BossGanonEff_SpawnDustLight(globalCtx, &sp54, 0, 3.0f, this->unk_19C - 25); + BossGanonEff_SpawnDustLight(play, &sp54, 0, 3.0f, this->unk_19C - 25); } if (this->unk_19C == 35) { sp48 = this->actor.world.pos; sp48.y = 0.0f; - BossGanonEff_SpawnShockwave(globalCtx, &sp48, 0, 3.0f); + BossGanonEff_SpawnShockwave(play, &sp48, 0, 3.0f); } } -void BossGanon_SetupChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupChargeBigMagic(BossGanon* this, PlayState* play) { this->unk_1C2 = 0; this->timers[0] = 30; this->actor.velocity.x = 0.0f; @@ -1989,7 +1989,7 @@ void BossGanon_SetupChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { this->actionFunc = BossGanon_ChargeBigMagic; } -void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_ChargeBigMagic(BossGanon* this, PlayState* play) { s32 pad; f32 targetPosX; f32 targetPosZ; @@ -2121,7 +2121,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { sp80.y = this->unk_278.y + sp68.y; sp80.z = this->unk_278.z + sp68.z; - BossGanonEff_SpawnBlackDot(globalCtx, &sp80, 20.0f); + BossGanonEff_SpawnBlackDot(play, &sp80, 20.0f); } break; @@ -2162,7 +2162,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 5.0f)) { for (i = 0; i < 5; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_1FC.x, this->unk_1FC.y, this->unk_1FC.z, 0, this->actor.yawTowardsPlayer, 0, 0x104 + i); } @@ -2186,14 +2186,14 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { this->envLightMode = 2; if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } break; } } -void BossGanon_SetupWait(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupWait(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); Animation_MorphToLoop(&this->skelAnime, &gGanondorfFloatAnim, -10.0f); this->actionFunc = BossGanon_Wait; this->fwork[GDF_FWORK_0] = 0.0f; @@ -2202,11 +2202,11 @@ void BossGanon_SetupWait(BossGanon* this, GlobalContext* globalCtx) { sBossGanonCape->minY = 2.0f; } -void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Wait(BossGanon* this, PlayState* play) { f32 sin; s32 pad; f32 cos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->legSwayEnabled = true; @@ -2220,20 +2220,20 @@ void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) { if ((this->unk_1C2 == 0) && !(player->actor.world.pos.y < 0.0f)) { if (!(player->stateFlags1 & 0x2000) && (fabsf(player->actor.world.pos.x) < 110.0f) && (fabsf(player->actor.world.pos.z) < 110.0f)) { - BossGanon_SetupPoundFloor(this, globalCtx); + BossGanon_SetupPoundFloor(this, play); } else if ((this->timers[0] == 0) && !(player->stateFlags1 & 0x2000)) { this->timers[0] = (s16)Rand_ZeroFloat(30.0f) + 30; if ((s8)this->actor.colChkInfo.health >= 20) { - BossGanon_SetupChargeLightBall(this, globalCtx); + BossGanon_SetupChargeLightBall(this, play); } else if (Rand_ZeroOne() >= 0.5f) { if ((Rand_ZeroOne() >= 0.5f) || (this->actor.xzDistToPlayer > 350.0f)) { - BossGanon_SetupChargeBigMagic(this, globalCtx); + BossGanon_SetupChargeBigMagic(this, play); } else { - BossGanon_SetupPoundFloor(this, globalCtx); + BossGanon_SetupPoundFloor(this, play); } } else { - BossGanon_SetupChargeLightBall(this, globalCtx); + BossGanon_SetupChargeLightBall(this, play); } } } @@ -2257,15 +2257,15 @@ void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) { func_80078914(&this->actor.projectedPos, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG); } -void BossGanon_SetupChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupChargeLightBall(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfChargeLightBallAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfChargeLightBallAnim, -3.0f); this->actionFunc = BossGanon_ChargeLightBall; this->timers[0] = 25; } -void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_ChargeLightBall(BossGanon* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); sBossGanonCape->backPush = -3.0f; @@ -2288,7 +2288,7 @@ void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachF(&this->handLightBallScale, 10.0f, 0.5f, 1.25f); if (this->timers[0] == 0) { - BossGanon_SetupPlayTennis(this, globalCtx); + BossGanon_SetupPlayTennis(this, play); } } @@ -2304,14 +2304,14 @@ void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; } -void BossGanon_SetupPlayTennis(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupPlayTennis(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfThrowAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfThrowAnim, 0.0f); this->actionFunc = BossGanon_PlayTennis; } -void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_PlayTennis(BossGanon* this, PlayState* play) { static AnimationHeader* volleyAnims[] = { &gGanondorfVolleyLeftAnim, &gGanondorfVolleyRightAnim }; static s16 capeRightArmDurations[] = { 26, 20 }; s16 rand; @@ -2342,7 +2342,7 @@ void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx) { this->unk_25C = 1; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_THROW); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_THROW_MASIC); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_260.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_260.x, this->unk_260.y, this->unk_260.z, 0, 0, 0, 0x64); } break; @@ -2371,9 +2371,9 @@ void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; } -void BossGanon_SetupBlock(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupBlock(BossGanon* this, PlayState* play) { if ((this->actionFunc != BossGanon_Block) || (this->unk_1C2 != 0)) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfBlockAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfBlockAnim, 0.0f); this->actionFunc = BossGanon_Block; @@ -2385,7 +2385,7 @@ void BossGanon_SetupBlock(BossGanon* this, GlobalContext* globalCtx) { this->handLightBallScale = 0.0f; } -void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Block(BossGanon* this, PlayState* play) { this->collider.base.colType = 9; SkelAnime_Update(&this->skelAnime); sBossGanonCape->backPush = -9.0f; @@ -2406,7 +2406,7 @@ void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) { sBossGanonCape->sideSwayMagnitude = -13.0f; if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } } @@ -2419,10 +2419,10 @@ void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.velocity.z, 1.0f, 0.5f); } -void BossGanon_SetupHitByLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupHitByLightBall(BossGanon* this, PlayState* play) { s16 i; - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfBigMagicHitAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfBigMagicHitAnim, 0); this->timers[0] = 70; @@ -2441,14 +2441,14 @@ void BossGanon_SetupHitByLightBall(BossGanon* this, GlobalContext* globalCtx) { this->unk_508 = 6.0f; } -void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_HitByLightBall(BossGanon* this, PlayState* play) { s16 i; Vec3f sp50; SkelAnime_Update(&this->skelAnime); if (this->unk_1C2 == 0) { - BossGanonEff_SpawnShock(globalCtx, 1500.0f, GDF_SHOCK_DORF_YELLOW); + BossGanonEff_SpawnShock(play, 1500.0f, GDF_SHOCK_DORF_YELLOW); if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfLightArrowWaitAnim); @@ -2456,7 +2456,7 @@ void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { this->unk_1C2 = 1; } } else if (this->unk_1C2 == 1) { - BossGanonEff_SpawnShock(globalCtx, 1000.0f, GDF_SHOCK_DORF_YELLOW); + BossGanonEff_SpawnShock(play, 1000.0f, GDF_SHOCK_DORF_YELLOW); if (this->timers[0] == 0) { this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfGetUp3Anim); @@ -2475,14 +2475,14 @@ void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { sp50.y = Rand_CenteredFloat(25.0f); sp50.z = Rand_CenteredFloat(25.0f); - BossGanonEff_SpawnSparkle(globalCtx, &this->unk_1FC, &sp50, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, + BossGanonEff_SpawnSparkle(play, &this->unk_1FC, &sp50, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, 0x14); } Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_WATER2); } if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } } @@ -2490,11 +2490,11 @@ void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; } -void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupVulnerable(BossGanon* this, PlayState* play) { s16 i; if (this->actionFunc != BossGanon_Vulnerable) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfLightArrowHitAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfLightArrowHitAnim, 0.0f); sBossGanonCape->attachRightArmTimer = sBossGanonCape->attachLeftArmTimer = 0; @@ -2511,7 +2511,7 @@ void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) { sBossGanonCape->minDist = 20.0f; for (i = 0; i < 10; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_1FC.x, this->unk_1FC.y, this->unk_1FC.z, Rand_CenteredFloat(0x8000), (s16)Rand_CenteredFloat(0x8000) + this->actor.yawTowardsPlayer, 0, 0xC8 + i); } @@ -2524,7 +2524,7 @@ void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) { } } -void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Vulnerable(BossGanon* this, PlayState* play) { s16 i; Vec3f sp40; @@ -2616,7 +2616,7 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { break; case 5: - BossGanonEff_SpawnShock(globalCtx, 1000.0f, GDF_SHOCK_DORF_YELLOW); + BossGanonEff_SpawnShock(play, 1000.0f, GDF_SHOCK_DORF_YELLOW); if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { this->unk_1C2 = 6; @@ -2656,7 +2656,7 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { sp40.x = Rand_CenteredFloat(25.0f); sp40.y = Rand_CenteredFloat(25.0f); sp40.z = Rand_CenteredFloat(25.0f); - BossGanonEff_SpawnSparkle(globalCtx, &this->unk_1FC, &sp40, &sZeroVec, + BossGanonEff_SpawnSparkle(play, &this->unk_1FC, &sp40, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, 0x14); } @@ -2665,20 +2665,20 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } break; } } -void BossGanon_SetupDamaged(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupDamaged(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDamageAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDamageAnim, 0.0f); this->actionFunc = BossGanon_Damaged; } -void BossGanon_Damaged(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Damaged(BossGanon* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0; SkelAnime_Update(&this->skelAnime); @@ -2696,7 +2696,7 @@ void BossGanon_Damaged(BossGanon* this, GlobalContext* globalCtx) { } } -void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) { s16 i; s16 j; ColliderInfo* acHitInfo; @@ -2708,7 +2708,7 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { if ((this->actionFunc == BossGanon_HitByLightBall) || (this->actionFunc == BossGanon_ChargeBigMagic)) { if (acHitInfo->toucher.dmgFlags & 0x2000) { - BossGanon_SetupVulnerable(this, globalCtx); + BossGanon_SetupVulnerable(this, play); this->timers[2] = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DAMAGE1); this->unk_1A6 = 15; @@ -2724,7 +2724,7 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { sp50.x = Rand_CenteredFloat(20.0f); sp50.y = Rand_CenteredFloat(20.0f); sp50.z = Rand_CenteredFloat(20.0f); - BossGanonEff_SpawnSparkle(globalCtx, &this->unk_1FC, &sp50, &sZeroVec, + BossGanonEff_SpawnSparkle(play, &this->unk_1FC, &sp50, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, 0x1E); } @@ -2748,7 +2748,7 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { } if ((s8)this->actor.colChkInfo.health <= 0) { - BossGanon_SetupDeathCutscene(this, globalCtx); + BossGanon_SetupDeathCutscene(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DEAD); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DD_THUNDER); func_80078914(&sZeroVec, NA_SE_EN_LAST_DAMAGE); @@ -2757,7 +2757,7 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DAMAGE2); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_CUTBODY); - BossGanon_SetupDamaged(this, globalCtx); + BossGanon_SetupDamaged(this, play); this->unk_1A6 = 15; sBossGanonCape->tearTimer = 1; } @@ -2779,13 +2779,13 @@ static f32 D_808E4D44[] = { 1.0f, 3.0f, 0.0f, 7.0f, 13.0f, 4.0f, 6.0f, 11.0f, 5.0f, 2.0f, 8.0f, 14.0f, 10.0f, 12.0f, 9.0f, }; -void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BossGanon_Update(Actor* thisx, PlayState* play2) { BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 legRotX; f32 legRotY; f32 legRotZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; f32 sin; f32 cos; @@ -2807,9 +2807,9 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { f32 zOffset; if ((this->actionFunc != BossGanon_IntroCutscene) && (this->actionFunc != BossGanon_DeathAndTowerCutscene)) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); } else { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); } if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) { @@ -2833,7 +2833,7 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { shardVel.x = Rand_ZeroFloat(1.0f); } - BossGanonEff_SpawnWindowShard(globalCtx, &shardPos, &shardVel, Rand_ZeroFloat(0.075f) + 0.08f); + BossGanonEff_SpawnWindowShard(play, &shardPos, &shardVel, Rand_ZeroFloat(0.075f) + 0.08f); } } @@ -2847,11 +2847,11 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { // block players attack if hes shooting something if ((this->actionFunc == BossGanon_Wait) || (this->actionFunc == BossGanon_Block)) { if (player->unk_A73 != 0) { - BossGanon_SetupBlock(this, globalCtx); + BossGanon_SetupBlock(this, play); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { @@ -2880,16 +2880,16 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { } if (this->csState == 0) { - BossGanon_UpdateDamage(this, globalCtx); + BossGanon_UpdateDamage(this, play); BossGanon_SetColliderPos(&this->unk_1FC, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->unk_2D4 == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if ((this->actionFunc != BossGanon_HitByLightBall) && (this->actionFunc != BossGanon_Vulnerable) && (this->actionFunc != BossGanon_Damaged)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } @@ -2933,7 +2933,7 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { // player hit, spawn shock and play sound if (this->unk_2E8 != 0) { func_80078914(&player->actor.projectedPos, NA_SE_PL_SPARK - SFX_FLAG); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_YELLOW); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_YELLOW); } } @@ -2941,18 +2941,18 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_19F = 0; spE8 = this->actor.world.pos; spE8.y = 0.0f; - BossGanonEff_SpawnDustDark(globalCtx, &spE8, 0.2, 0.7f); - BossGanonEff_SpawnDustDark(globalCtx, &spE8, 0.3f, 0.8f); + BossGanonEff_SpawnDustDark(play, &spE8, 0.2, 0.7f); + BossGanonEff_SpawnDustDark(play, &spE8, 0.3f, 0.8f); } if (this->unk_26C != 0) { this->unk_26C--; if (this->unk_26C == 0) { - BossGanonEff_SpawnLightning(globalCtx, 1.0f, 0.0f, 0.0f); + BossGanonEff_SpawnLightning(play, 1.0f, 0.0f, 0.0f); } - BossGanonEff_SpawnLightning(globalCtx, 1.0f, D_808E4D44[this->unk_26C] * (M_PI / 5) + this->unk_270, + BossGanonEff_SpawnLightning(play, 1.0f, D_808E4D44[this->unk_26C] * (M_PI / 5) + this->unk_270, Rand_CenteredFloat(M_PI / 5) + (M_PI / 2)); } @@ -2965,7 +2965,7 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { for (i2 = 0; i2 < 4; i2++) { for (j = 0, platformCheckPos.z = -180.0f; j < 4; j++) { - BossGanon_CheckFallingPlatforms(this, globalCtx, &platformCheckPos); + BossGanon_CheckFallingPlatforms(this, play, &platformCheckPos); platformCheckPos.z += 120.0f; } @@ -2979,12 +2979,12 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { Matrix_RotateY(Rand_ZeroFloat(6.2831855f), MTXMODE_NEW); Matrix_MultVec3f(&spD8, &platformCheckPos); - this->unk_19E += BossGanon_CheckFallingPlatforms(this, globalCtx, &platformCheckPos); + this->unk_19E += BossGanon_CheckFallingPlatforms(this, play, &platformCheckPos); } } // see if a bomb exploded near a group of platforms and if they should fall - explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (explosive != NULL) { if (explosive->params != BOMB_EXPLOSION) { @@ -3002,16 +3002,16 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { platCheckPosBomb.y = explosive->world.pos.y; platCheckPosBomb.z = explosive->world.pos.z + spB0.z; - BossGanon_CheckFallingPlatforms(this, globalCtx, &platCheckPosBomb); + BossGanon_CheckFallingPlatforms(this, play, &platCheckPosBomb); } explosive = explosive->next; } } - BossGanon_UpdateEffects(globalCtx); + BossGanon_UpdateEffects(play); - prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; // if a platform is lit up, change the room lighting while (prop != NULL) { @@ -3029,106 +3029,106 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - globalCtx->envCtx.unk_BF = 0; - globalCtx->envCtx.unk_BE = 0; - globalCtx->envCtx.unk_DC = 2; + play->envCtx.unk_BF = 0; + play->envCtx.unk_BE = 0; + play->envCtx.unk_DC = 2; switch (this->envLightMode) { case -1: break; case 0: - Math_ApproachF(&globalCtx->envCtx.unk_D8, 0.0f, 1.0f, 0.02f); + Math_ApproachF(&play->envCtx.unk_D8, 0.0f, 1.0f, 0.02f); break; case 1: - globalCtx->envCtx.unk_BD = 1; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); + play->envCtx.unk_BD = 1; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); break; case 2: - globalCtx->envCtx.unk_BD = 1; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.02f); + play->envCtx.unk_BD = 1; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.02f); break; case 3: - globalCtx->envCtx.unk_BD = 3; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BD = 3; + play->envCtx.unk_D8 = 1.0f; break; case 35: - globalCtx->envCtx.unk_BD = 0; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BD = 0; + play->envCtx.unk_D8 = 1.0f; break; case 4: - globalCtx->envCtx.unk_BD = 4; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BD = 4; + play->envCtx.unk_D8 = 1.0f; break; case 5: - globalCtx->envCtx.unk_BE = 5; - globalCtx->envCtx.unk_BD = 3; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.075f); + play->envCtx.unk_BE = 5; + play->envCtx.unk_BD = 3; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.075f); break; case 6: - globalCtx->envCtx.unk_BE = 5; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_BE = 5; + play->envCtx.unk_D8 = 0.0f; break; case 65: - globalCtx->envCtx.unk_BE = 3; - globalCtx->envCtx.unk_BD = 6; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); + play->envCtx.unk_BE = 3; + play->envCtx.unk_BD = 6; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f); break; case 7: - globalCtx->envCtx.unk_BE = 7; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_BE = 7; + play->envCtx.unk_D8 = 0.0f; break; case 75: - globalCtx->envCtx.unk_BE = 4; - globalCtx->envCtx.unk_BD = 8; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); + play->envCtx.unk_BE = 4; + play->envCtx.unk_BD = 8; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f); break; case 8: - globalCtx->envCtx.unk_BE = 3; - globalCtx->envCtx.unk_BD = 9; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); + play->envCtx.unk_BE = 3; + play->envCtx.unk_BD = 9; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); break; case 9: - globalCtx->envCtx.unk_BE = 3; - globalCtx->envCtx.unk_BD = 0xA; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); + play->envCtx.unk_BE = 3; + play->envCtx.unk_BD = 0xA; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f); break; case 10: - globalCtx->envCtx.unk_BE = 3; - globalCtx->envCtx.unk_BD = 0xB; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); + play->envCtx.unk_BE = 3; + play->envCtx.unk_BD = 0xB; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); this->unk_1A4 = 0; break; case 11: - globalCtx->envCtx.unk_BE = 0xC; - globalCtx->envCtx.unk_BD = 0xB; - Math_ApproachF(&globalCtx->envCtx.unk_D8, (Math_CosS(this->unk_1A4 * 0x1800) * 0.5f) + 0.5f, 1.0f, 1.0f); + play->envCtx.unk_BE = 0xC; + play->envCtx.unk_BD = 0xB; + Math_ApproachF(&play->envCtx.unk_D8, (Math_CosS(this->unk_1A4 * 0x1800) * 0.5f) + 0.5f, 1.0f, 1.0f); break; case 12: - globalCtx->envCtx.unk_BE = 0xC; - globalCtx->envCtx.unk_BD = 3; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); + play->envCtx.unk_BE = 0xC; + play->envCtx.unk_BD = 3; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); break; case 13: - globalCtx->envCtx.unk_BD = 0xD; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.025f); + play->envCtx.unk_BD = 0xD; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.025f); break; case 14: - globalCtx->envCtx.unk_BD = 0xE; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BD = 0xE; + play->envCtx.unk_D8 = 1.0f; break; case 15: - globalCtx->envCtx.unk_BE = 0xE; - globalCtx->envCtx.unk_BD = 0xF; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.01f); + play->envCtx.unk_BE = 0xE; + play->envCtx.unk_BD = 0xF; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.01f); break; case 16: - globalCtx->envCtx.unk_BE = 0x10; - globalCtx->envCtx.unk_BD = 0xF; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); + play->envCtx.unk_BE = 0x10; + play->envCtx.unk_BD = 0xF; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f); break; case 20: - globalCtx->envCtx.unk_BE = 2; - globalCtx->envCtx.unk_BD = 1; + play->envCtx.unk_BE = 2; + play->envCtx.unk_BD = 1; break; default: break; @@ -3137,20 +3137,20 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { this->envLightMode = 0; if (this->whiteFillAlpha != 0) { - globalCtx->envCtx.screenFillColor[3] = (s8)(u8)this->whiteFillAlpha; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.fillScreen = true; + play->envCtx.screenFillColor[3] = (s8)(u8)this->whiteFillAlpha; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = + play->envCtx.screenFillColor[2] = 255; + play->envCtx.fillScreen = true; } else if (this->screenFlashTimer != 0) { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = + play->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.screenFillColor[3] = ((this->screenFlashTimer % 2) != 0) ? 100 : 0; + play->envCtx.screenFillColor[3] = ((this->screenFlashTimer % 2) != 0) ? 100 : 0; this->screenFlashTimer--; } else { - globalCtx->envCtx.fillScreen = globalCtx->envCtx.screenFillColor[3] = 0; + play->envCtx.fillScreen = play->envCtx.screenFillColor[3] = 0; } if (this->lensFlareTimer != 0) { @@ -3198,13 +3198,13 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { zOffset = (cosf(i * 1.2566371f) * 600.0f); // 5 or 6 light balls that go into the charge. not the same as the ones that he throws - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x + xOffset, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_1FC.x + xOffset, this->unk_1FC.y, this->unk_1FC.z + zOffset, 0, (s16)(i * 13107.2f) + 0x6000, 0, 0xFA + i); this->unk_274 = 0; } } -s32 BossGanon_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossGanon_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossGanon* this = (BossGanon*)thisx; @@ -3254,7 +3254,7 @@ s32 BossGanon_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return 0; } -void BossGanon_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanon_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static s8 bodyPartLimbMap[] = { -1, -1, 1, -1, 3, 4, 5, -1, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, 2, 12, 13, 14, 9, 10, 11, -1, -1, -1, -1, }; @@ -3278,14 +3278,14 @@ void BossGanon_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } else if (limbIndex == 19) { Matrix_MultVec3f(&D_808E4DB8, &this->actor.focus.pos); } else if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&D_808E4DB8, &this->unk_208); - 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++, SEGMENTED_TO_VIRTUAL(gGanondorfEyesDL)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 6) { Matrix_MultVec3f(&D_808E4DC4, &this->unk_238); } else if (limbIndex == 10) { @@ -3353,28 +3353,28 @@ f32 BossGanon_RandZeroOne(void) { return fabsf(randFloat); } -void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawShock(BossGanon* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; OPEN_DISPS(gfxCtx); if ((this->unk_2E8 != 0) || (this->unk_2E6 != 0)) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightBallMaterialDL); if (this->unk_2E8 != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); for (i = 0; i < ARRAY_COUNT(player->bodyPartsPos); i++) { FrameInterpolation_RecordOpenChild("Ganondorf Shock 0", i); Matrix_Translate(player->bodyPartsPos[i].x, player->bodyPartsPos[i].y, player->bodyPartsPos[i].z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -3388,7 +3388,7 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild("Ganondorf Shock 1", i); Matrix_Translate(this->unk_2EC[i].x, this->unk_2EC[i].y, this->unk_2EC[i].z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); if (!this->shockGlow) { @@ -3400,7 +3400,7 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { if (this->shockGlow) { 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, (this->unk_1A2 + i) * -15, 32, 64)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); @@ -3417,15 +3417,15 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 alpha; OPEN_DISPS(gfxCtx); if (this->handLightBallScale > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); if ((this->unk_1A2 % 2) != 0) { @@ -3437,7 +3437,7 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightBallMaterialDL); Matrix_Translate(this->unk_260.x, this->unk_260.y, this->unk_260.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->handLightBallScale, this->handLightBallScale, this->handLightBallScale, MTXMODE_APPLY); Matrix_RotateZ(this->unk_258, 1); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -3449,7 +3449,7 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 155, alpha); Matrix_Translate(this->unk_260.x, 0.0f, this->unk_260.z, MTXMODE_NEW); Matrix_Scale(this->handLightBallScale * 0.75f, 1.0f, this->handLightBallScale * 0.75f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightCoreDL); } @@ -3457,25 +3457,25 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) { s32 pad; f32 yRot; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; OPEN_DISPS(gfxCtx); if (this->unk_284 > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); // light flecks gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s8)this->unk_290); gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0, this->unk_1A2 * 0xA, 0x40, 0x40)); Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_28C, this->unk_28C, this->unk_28C, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -3483,20 +3483,20 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { // background circle texture Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_284, this->unk_284, this->unk_284, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 100, (s8)this->unk_288); gSPSegment( POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gGanondorfBigMagicBGCircleDL); // yellow background dot gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 170, 0, (s8)this->unk_288); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2, this->unk_1A2 * -0x14, 0x40, 0x40)); gSPDisplayList(POLY_XLU_DISP++, gGanondorfDotDL); @@ -3507,7 +3507,7 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { // light ball geometry Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_2D0, this->unk_2D0, this->unk_2D0, MTXMODE_APPLY); Matrix_RotateZ((this->unk_1A2 * 10.0f) / 1000.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -3546,11 +3546,11 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawTriforce(BossGanon* this, PlayState* play) { s32 pad; if (this->fwork[GDF_TRIFORCE_PRIM_A] > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -3560,7 +3560,7 @@ void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, (u8)this->fwork[GDF_TRIFORCE_ENV_G], 0, 128); if (this->triforceType == GDF_TRIFORCE_PLAYER) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->triforcePos = player->bodyPartsPos[12]; @@ -3584,30 +3584,30 @@ void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { Matrix_RotateX(1.1f, 1); Matrix_RotateZ(-0.99999994f, MTXMODE_APPLY); } else { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); } Matrix_Scale(this->fwork[GDF_TRIFORCE_SCALE], this->fwork[GDF_TRIFORCE_SCALE], 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanondorfTriforceDL)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void BossGanon_DrawDarkVortex(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawDarkVortex(BossGanon* this, PlayState* play) { s32 pad; if (this->fwork[GDF_VORTEX_ALPHA] > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_1A2 * -8, 0, 0x20, 0x40, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_1A2 * -8, 0, 0x20, 0x40, 1, this->unk_1A2 * -4, this->unk_1A2 * -8, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 0, 200, (s8)this->fwork[GDF_VORTEX_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 130, 0, 0, 128); @@ -3623,13 +3623,13 @@ void BossGanon_DrawDarkVortex(BossGanon* this, GlobalContext* globalCtx) { Matrix_Scale(this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanondorfVortexDL)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -3718,7 +3718,7 @@ void func_808E0254(BossGanon* this, u8* tex, f32 arg2) { } } -void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, PlayState* play) { s16 addY; s16 baseX; s16 baseY; @@ -3778,14 +3778,14 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, GlobalContext* globalC } } -void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, PlayState* play) { s32 pad; f32 zOffset; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 50); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); @@ -3797,7 +3797,7 @@ void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, GlobalContext* glob } Matrix_Scale(0.95000005f, 1.0f, 0.95000005f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGanondorfShadowSetupDL); gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, @@ -3808,14 +3808,14 @@ void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, GlobalContext* glob CLOSE_DISPS(gfxCtx); } -void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon_Draw(Actor* thisx, PlayState* play) { s32 i; BossGanon* this = (BossGanon*)thisx; void* shadowTex; - shadowTex = Graph_Alloc(globalCtx->state.gfxCtx, 64 * 64); + shadowTex = Graph_Alloc(play->state.gfxCtx, 64 * 64); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // Invalidate textures if they have changed if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) { @@ -3823,8 +3823,8 @@ void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPInvalidateTexCache(POLY_OPA_DISP++, ganon_boss_sceneTex_007418); } - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if ((this->unk_1A6 & 2) != 0) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099); @@ -3832,16 +3832,16 @@ void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGanondorfNormalEyeTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossGanon_OverrideLimbDraw, BossGanon_PostLimbDraw, &this->actor); this->unk_2EC[0].x = this->unk_2EC[1].x; this->unk_2EC[0].y = this->unk_2EC[1].y + 30.0f; this->unk_2EC[0].z = this->unk_2EC[1].z; - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - BossGanon_DrawEffects(globalCtx); + BossGanon_DrawEffects(play); sBossGanonCape->actor.world.pos = this->actor.world.pos; @@ -3851,20 +3851,20 @@ void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { sBossGanonCape->rightShoulderPos = this->unk_22C; sBossGanonCape->leftShoulderPos = this->unk_238; - BossGanon_DrawShock(this, globalCtx); - BossGanon_DrawHandLightBall(this, globalCtx); - BossGanon_DrawBigMagicCharge(this, globalCtx); - BossGanon_DrawTriforce(this, globalCtx); - BossGanon_DrawDarkVortex(this, globalCtx); + BossGanon_DrawShock(this, play); + BossGanon_DrawHandLightBall(this, play); + BossGanon_DrawBigMagicCharge(this, play); + BossGanon_DrawTriforce(this, play); + BossGanon_DrawDarkVortex(this, play); - BossGanon_GenShadowTexture(shadowTex, this, globalCtx); - BossGanon_DrawShadowTexture(shadowTex, this, globalCtx); + BossGanon_GenShadowTexture(shadowTex, this, play); + BossGanon_DrawShadowTexture(shadowTex, this, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 BossGanon_CheckFallingPlatforms(BossGanon* this, GlobalContext* globalCtx, Vec3f* checkPos) { - Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +s32 BossGanon_CheckFallingPlatforms(BossGanon* this, PlayState* play, Vec3f* checkPos) { + Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if (((BossGanon*)prop == this) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { @@ -3889,7 +3889,7 @@ s32 BossGanon_CheckFallingPlatforms(BossGanon* this, GlobalContext* globalCtx, V return 0; } -void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { u8 hitWithBottle; s16 i; s16 spBA = 0; @@ -3897,7 +3897,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { Vec3f spA0; Vec3f sp94; BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 xDistFromLink; f32 yDistFromLink; f32 zDistFromLink; @@ -3905,7 +3905,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { f32 xDistFromGanondorf; f32 yDistFromGanondorf; f32 zDistFromGanondorf; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; BossGanon* ganondorf = (BossGanon*)this->actor.parent; s32 pad1; @@ -4017,8 +4017,8 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { if (sqrtf(SQ(xDistFromLink) + SQ(yDistFromLink) + SQ(zDistFromLink)) <= 25.0f) { spBA = 5; - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, + func_8002F6D4(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); ganondorf->timers[2] = 20; @@ -4061,8 +4061,8 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { case 4: if (sqrtf(SQ(xDistFromGanondorf) + SQ(yDistFromGanondorf) + SQ(zDistFromGanondorf)) < 30.0f) { spBA = 3; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_GANON_DAMAGE1); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_DAMAGE1); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); } break; @@ -4078,7 +4078,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->timers[1] == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } for (i = 0; i < 2; i++) { @@ -4091,11 +4091,11 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { sp94.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; sp94.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - BossGanonEff_SpawnSparkle(globalCtx, &sp94, &spAC, &spA0, Rand_ZeroFloat(500.0f) + 700.0f, 0x1E); + BossGanonEff_SpawnSparkle(play, &sp94, &spAC, &spA0, Rand_ZeroFloat(500.0f) + 700.0f, 0x1E); } if (this->actor.world.pos.y < 10.0f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 20.0f, 20.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 20.0f, 20.0f, 4); } if ((fabsf(this->actor.world.pos.x) > 465.0f) || (this->actor.world.pos.y > 500.0f) || @@ -4119,7 +4119,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { sp54 = 15.0f; phi_f20 = 30.0f; sp4E = 70; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EN_GANON_HIT_THUNDER); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_GANON_HIT_THUNDER); } for (i = 0; i < sp4E; i++) { @@ -4133,20 +4133,20 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { spAC.z = Rand_CenteredFloat(phi_f20); } - BossGanonEff_SpawnLightRay(globalCtx, &this->actor.world.pos, &spAC, &sZeroVec, sp58, sp54, 0x1E); + BossGanonEff_SpawnLightRay(play, &this->actor.world.pos, &spAC, &sZeroVec, sp58, sp54, 0x1E); } if (spBA != 1) { this->unk_1A8 = 1; if (spBA == 0) { - BossGanon_CheckFallingPlatforms(this, globalCtx, &this->actor.world.pos); + BossGanon_CheckFallingPlatforms(this, play, &this->actor.world.pos); } if (spBA == 3) { - BossGanon_SetupHitByLightBall(ganondorf, globalCtx); + BossGanon_SetupHitByLightBall(ganondorf, play); } else if (ganondorf->actionFunc == BossGanon_PlayTennis) { - BossGanon_SetupWait(ganondorf, globalCtx); + BossGanon_SetupWait(ganondorf, play); if (spBA == 5) { ganondorf->timers[0] = 125; @@ -4157,15 +4157,15 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon_LightBall_Draw(Actor* thisx, PlayState* play) { BossGanon* this = (BossGanon*)thisx; s16 i; f32 alpha; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); alpha = ((this->unk_1A2 % 2) != 0) ? this->fwork[GDF_FWORK_1] * 0.4f : this->fwork[GDF_FWORK_1] * 0.35f; @@ -4173,7 +4173,7 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x * 0.75f, 1.0f, this->actor.scale.z * 0.75f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightCoreDL); @@ -4191,7 +4191,7 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); Matrix_RotateY(i * (M_PI / 8), MTXMODE_APPLY); Matrix_RotateZ(this->fwork[GDF_FWORK_0], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGanondorfSquareDL); @@ -4200,20 +4200,20 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } } else if (this->unk_1A8 == 0) { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((this->actor.shape.rot.z / 32768.0f) * 3.1416f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGanondorfSquareDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { +void func_808E1EB4(Actor* thisx, PlayState* play2) { s16 i; BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossGanon* dorf = (BossGanon*)this->actor.parent; f32 xDiff; f32 yDiff; @@ -4281,7 +4281,7 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { accel.y = vel.y * -0.03f; accel.z = vel.z * -0.03f; - BossGanonEff_SpawnLightRay(globalCtx, &dorf->unk_1FC, &vel, &accel, + BossGanonEff_SpawnLightRay(play, &dorf->unk_1FC, &vel, &accel, Rand_ZeroFloat(500.0f) + 1000.0f, 15.0f, 0x14); } @@ -4296,7 +4296,7 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { dorf->lensFlareMode = 1; dorf->unk_508 = 10.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &dorf->actor, globalCtx, ACTOR_BOSS_GANON, dorf->unk_1FC.x, + Actor_SpawnAsChild(&play->actorCtx, &dorf->actor, play, ACTOR_BOSS_GANON, dorf->unk_1FC.x, dorf->unk_1FC.y, dorf->unk_1FC.z, 0, 0, 0, 0x12C); } @@ -4307,14 +4307,14 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_808E229C(Actor* thisx, GlobalContext* globalCtx2) { +void func_808E229C(Actor* thisx, PlayState* play2) { BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 i; s32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightBallMaterialDL); @@ -4324,17 +4324,17 @@ void func_808E229C(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(this->unk_2EC[temp].x, this->unk_2EC[temp].y, this->unk_2EC[temp].z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x * (1.0f - (i * 0.07000001f)), this->actor.scale.y * (1.0f - (i * 0.07000001f)), this->actor.scale.z * (1.0f - (i * 0.07000001f)), MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ(((2.0f * (i * M_PI)) / 10.0f) + BINANG_TO_RAD(this->actor.shape.rot.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++, gGanondorfSquareDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { +void func_808E2544(Actor* thisx, PlayState* play) { u8 numEffects = 0; s16 xRot; f32 xDiff; @@ -4348,7 +4348,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { BossGanon* this = (BossGanon*)thisx; BossGanon* dorf = (BossGanon*)this->actor.parent; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); ColliderInfo* acHitInfo; Vec3f sp60; @@ -4461,7 +4461,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~2; - if (!(acHitInfo->toucher.dmgFlags & 0x100000) || Player_HasMirrorShieldEquipped(globalCtx)) { + if (!(acHitInfo->toucher.dmgFlags & 0x100000) || Player_HasMirrorShieldEquipped(play)) { func_800AA000(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); this->unk_1C2 = 0xC; this->actor.speedXZ = -30.0f; @@ -4485,7 +4485,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->timers[1] == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } xDiff = player->actor.world.pos.x - this->actor.world.pos.x; @@ -4497,8 +4497,8 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; if (dorf->timers[2] == 0) { - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, + func_8002F6D4(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); dorf->timers[2] = 20; @@ -4542,7 +4542,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { zDiff = dorf->unk_1FC.z - this->actor.world.pos.z; if (sqrtf(SQ(xDiff) + SQ(zDiff) + SQ(yDiff)) < 45.0f) { - BossGanon_SetupHitByLightBall(dorf, globalCtx); + BossGanon_SetupHitByLightBall(dorf, play); this->timers[0] = 150; numEffects = 40; this->unk_1C2 = 1; @@ -4560,21 +4560,21 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { this->unk_1C2 = 1; this->actor.speedXZ = 0.0f; numEffects = 10; - BossGanon_CheckFallingPlatforms(this, globalCtx, &this->actor.world.pos); - Actor_SpawnAsChild(&globalCtx->actorCtx, &dorf->actor, globalCtx, ACTOR_BOSS_GANON, this->actor.world.pos.x, + BossGanon_CheckFallingPlatforms(this, play, &this->actor.world.pos); + Actor_SpawnAsChild(&play->actorCtx, &dorf->actor, play, ACTOR_BOSS_GANON, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x190); } } if (numEffects) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EN_FANTOM_THUNDER); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_FANTOM_THUNDER); for (i = 0; i < numEffects; i++) { sp60.x = Rand_CenteredFloat(30.0f); sp60.y = Rand_CenteredFloat(30.0f); sp60.z = Rand_CenteredFloat(30.0); - BossGanonEff_SpawnLightRay(globalCtx, &this->actor.world.pos, &sp60, &sZeroVec, + BossGanonEff_SpawnLightRay(play, &this->actor.world.pos, &sp60, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, 15.0f, 0x1E); } } @@ -4586,17 +4586,17 @@ static Gfx* sBigMagicLightStreakDLists[] = { gGanondorfLightStreak4DL, gGanondorfLightStreak3DL, gGanondorfLightStreak2DL, gGanondorfLightStreak1DL, }; -void func_808E324C(Actor* thisx, GlobalContext* globalCtx) { +void func_808E324C(Actor* thisx, PlayState* play) { BossGanon* this = (BossGanon*)thisx; Mtx* mtx; s16 i; s32 temp; - mtx = Graph_Alloc(globalCtx->state.gfxCtx, 12 * sizeof(Mtx)); + mtx = Graph_Alloc(play->state.gfxCtx, 12 * sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, (s8)this->fwork[GDF_FWORK_1]); gDPSetEnvColor(POLY_XLU_DISP++, 150, 255, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x0D, mtx); @@ -4615,21 +4615,21 @@ void func_808E324C(Actor* thisx, GlobalContext* globalCtx) { }; Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightBallMaterialDL); gSPDisplayList(POLY_XLU_DISP++, gGanondorfSquareDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossGanon_UpdateEffects(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - GanondorfEffect* eff = globalCtx->specialEffects; +void BossGanon_UpdateEffects(PlayState* play) { + Player* player = GET_PLAYER(play); + GanondorfEffect* eff = play->specialEffects; s16 i; s32 pad; f32 xDiff; @@ -4740,7 +4740,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) { } } else if (eff->type == GDF_EFF_LIGHTNING) { if (eff->unk_3C == 0.0f) { - eff->unk_44 = BINANG_TO_RAD(Camera_GetInputDirYaw(Gameplay_GetCamera(globalCtx, MAIN_CAM))); + eff->unk_44 = BINANG_TO_RAD(Camera_GetInputDirYaw(Play_GetCamera(play, MAIN_CAM))); } else { eff->unk_44 = M_PI / 2; } @@ -4817,7 +4817,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) { if (((eff->scale * 150.0f) < distToPlayer) && (distToPlayer < (eff->scale * 300.0f))) { eff->timer = 150; - func_8002F6D4(globalCtx, &sBossGanonGanondorf->actor, 7.0f, sBossGanonGanondorf->actor.yawTowardsPlayer, 0.0f, + func_8002F6D4(play, &sBossGanonGanondorf->actor, 7.0f, sBossGanonGanondorf->actor.yawTowardsPlayer, 0.0f, 0x20); } } @@ -4843,16 +4843,16 @@ static u8 sLightningEnvColors[] = { 100, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -void BossGanon_DrawEffects(GlobalContext* globalCtx) { +void BossGanon_DrawEffects(PlayState* play) { u8 flag = 0; s16 i; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - GanondorfEffect* eff = globalCtx->specialEffects; + GraphicsContext* gfxCtx = play->state.gfxCtx; + GanondorfEffect* eff = play->specialEffects; GanondorfEffect* effFirst = eff; OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < 200; i++, eff++) { if (eff->type == GDF_EFF_WINDOW_SHARD) { @@ -4892,7 +4892,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { } gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, eff->alpha); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -4989,7 +4989,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 100, 70, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, eff->timer * -20, 32, 32)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); Matrix_Scale(eff->scale, eff->unk_40 * eff->scale, eff->scale, MTXMODE_APPLY); @@ -5009,7 +5009,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 200, 100, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, eff->timer * -20, 32, 32)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); Matrix_Scale(eff->scale, eff->unk_40 * eff->scale, eff->scale, MTXMODE_APPLY); @@ -5029,7 +5029,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 150, 255, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (eff->timer * 100), 0, 64, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (eff->timer * 100), 0, 64, 32, 1, (eff->timer * 100), 0, 64, 32)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); Matrix_Scale((eff->scale * 200.0f) / 1500.0f, (eff->unk_40 * 200.0f) / 1500.0f, @@ -5050,10 +5050,10 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 170, 0, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, eff->timer * 2, eff->timer * -20, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, eff->timer * 2, eff->timer * -20, 64, 64)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h index 7a797ad74..0e4b3e447 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h @@ -6,7 +6,7 @@ struct BossGanon; -typedef void (*BossGanonActionFunc)(struct BossGanon*, GlobalContext*); +typedef void (*BossGanonActionFunc)(struct BossGanon*, PlayState*); typedef enum { /* 0 */ GDF_FWORK_0, diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 46436893d..c5d2b23fc 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -11,29 +11,29 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGanon2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGanon2_Init(Actor* thisx, PlayState* play); +void BossGanon2_Destroy(Actor* thisx, PlayState* play); +void BossGanon2_Update(Actor* thisx, PlayState* play); +void BossGanon2_Draw(Actor* thisx, PlayState* play); void BossGanon2_Reset(void); -void func_808FD5C4(BossGanon2* this, GlobalContext* globalCtx); -void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx); -void func_808FFDB0(BossGanon2* this, GlobalContext* globalCtx); -void func_808FFEBC(BossGanon2* this, GlobalContext* globalCtx); -void func_808FFFE0(BossGanon2* this, GlobalContext* globalCtx); -void func_80900104(BossGanon2* this, GlobalContext* globalCtx); -void func_8090026C(BossGanon2* this, GlobalContext* globalCtx); -void func_809002CC(BossGanon2* this, GlobalContext* globalCtx); -void func_80900344(BossGanon2* this, GlobalContext* globalCtx); -void func_80900580(BossGanon2* this, GlobalContext* globalCtx); -void func_80900650(BossGanon2* this, GlobalContext* globalCtx); -void func_80900890(BossGanon2* this, GlobalContext* globalCtx); -void func_8090120C(BossGanon2* this, GlobalContext* globalCtx); -void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx); -void func_809060E8(GlobalContext* globalCtx); -void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx); -void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx); +void func_808FD5C4(BossGanon2* this, PlayState* play); +void func_808FD5F4(BossGanon2* this, PlayState* play); +void func_808FFDB0(BossGanon2* this, PlayState* play); +void func_808FFEBC(BossGanon2* this, PlayState* play); +void func_808FFFE0(BossGanon2* this, PlayState* play); +void func_80900104(BossGanon2* this, PlayState* play); +void func_8090026C(BossGanon2* this, PlayState* play); +void func_809002CC(BossGanon2* this, PlayState* play); +void func_80900344(BossGanon2* this, PlayState* play); +void func_80900580(BossGanon2* this, PlayState* play); +void func_80900650(BossGanon2* this, PlayState* play); +void func_80900890(BossGanon2* this, PlayState* play); +void func_8090120C(BossGanon2* this, PlayState* play); +void func_80905DA8(BossGanon2* this, PlayState* play); +void func_809060E8(PlayState* play); +void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play); +void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play); const ActorInit Boss_Ganon2_InitVars = { ACTOR_BOSS_GANON2, @@ -99,24 +99,24 @@ void func_808FD080(s32 idx, ColliderJntSph* collider, Vec3f* arg2) { collider->elements[idx].dim.modelSphere.radius * collider->elements[idx].dim.scale; } -void BossGanon2_SetObjectSegment(BossGanon2* this, GlobalContext* globalCtx, s32 objectId, u8 setRSPSegment) { +void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId, u8 setRSPSegment) { s32 pad; - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, objectId); + s32 objectIdx = Object_GetIndex(&play->objectCtx, objectId); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objectIdx].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIdx].segment); if (setRSPSegment) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIdx].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[objectIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_808FD210(GlobalContext* globalCtx, Vec3f* arg1) { - BossGanon2Effect* effect = globalCtx->specialEffects; +void func_808FD210(PlayState* play, Vec3f* arg1) { + BossGanon2Effect* effect = play->specialEffects; effect->type = 1; effect->position = *arg1; @@ -130,8 +130,8 @@ void func_808FD210(GlobalContext* globalCtx, Vec3f* arg1) { effect->accel.z = 0.0f; } -void func_808FD27C(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, f32 scale) { - BossGanon2Effect* effect = globalCtx->specialEffects; +void func_808FD27C(PlayState* play, Vec3f* position, Vec3f* velocity, f32 scale) { + BossGanon2Effect* effect = play->specialEffects; s16 i; for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) { @@ -151,12 +151,12 @@ void func_808FD27C(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, f } } -void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon2_Init(Actor* thisx, PlayState* play) { BossGanon2* this = (BossGanon2*)thisx; s32 pad; s16 i; - globalCtx->specialEffects = sBossGanon2Particles; + play->specialEffects = sBossGanon2Particles; for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++) { sBossGanon2Particles[i].type = 0; @@ -164,45 +164,45 @@ void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.health = 30; - Collider_InitJntSph(globalCtx, &this->unk_424); - Collider_SetJntSph(globalCtx, &this->unk_424, &this->actor, &sJntSphInit1, this->unk_464); - Collider_InitJntSph(globalCtx, &this->unk_444); - Collider_SetJntSph(globalCtx, &this->unk_444, &this->actor, &sJntSphInit2, this->unk_864); - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON, false); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGanondorfSkel, NULL, NULL, NULL, 0); - func_808FD5C4(this, globalCtx); + Collider_InitJntSph(play, &this->unk_424); + Collider_SetJntSph(play, &this->unk_424, &this->actor, &sJntSphInit1, this->unk_464); + Collider_InitJntSph(play, &this->unk_444); + Collider_SetJntSph(play, &this->unk_444, &this->actor, &sJntSphInit2, this->unk_864); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON, false); + SkelAnime_InitFlex(play, &this->skelAnime, &gGanondorfSkel, NULL, NULL, NULL, 0); + func_808FD5C4(this, play); this->actor.naviEnemyId = 0x3E; this->actor.gravity = 0.0f; } -void BossGanon2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon2_Destroy(Actor* thisx, PlayState* play) { BossGanon2* this = (BossGanon2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->unk_424); - Collider_DestroyJntSph(globalCtx, &this->unk_444); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->unk_424); + Collider_DestroyJntSph(play, &this->unk_444); } -void func_808FD4D4(BossGanon2* this, GlobalContext* globalCtx, s16 arg2, s16 arg3) { +void func_808FD4D4(BossGanon2* this, PlayState* play, s16 arg2, s16 arg3) { if ((arg2 == 0) || (arg2 == 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1D0, 25.0f, arg3, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_1D0, 25.0f, arg3, 8.0f, 500, 10, true); } if ((arg2 == 0) || (arg2 == 2)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1DC, 25.0f, arg3, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_1DC, 25.0f, arg3, 8.0f, 500, 10, true); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_WALK); - func_80033E88(&this->actor, globalCtx, 2, 0xA); + func_80033E88(&this->actor, play, 2, 0xA); } -void func_808FD5C4(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FD5C4(BossGanon2* this, PlayState* play) { this->actionFunc = func_808FD5F4; this->actor.flags &= ~ACTOR_FLAG_0; this->actor.world.pos.y = -3000.0f; } -void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FD5F4(BossGanon2* this, PlayState* play) { s16 pad; u8 sp8D; Player* player; @@ -211,20 +211,20 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { s32 pad2; sp8D = false; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_398++; switch (this->unk_39C) { case 0: - objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME3); - if (Object_IsLoaded(&globalCtx->objectCtx, objectIdx)) { - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME3); + if (Object_IsLoaded(&play->objectCtx, objectIdx)) { + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->unk_39E = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_39E, CAM_STAT_ACTIVE); this->unk_39C = 1; - sBossGanon2Zelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 970.0f, + sBossGanon2Zelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 970.0f, 1086.0f, -200.0f, 0, 0, 0, 1); sBossGanon2Zelda->unk_3C8 = 0; sBossGanon2Zelda->actor.world.pos.x = 970.0f; @@ -243,7 +243,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { player->actor.world.pos.z = -186.0f; player->actor.shape.rot.y = -0x5000; Animation_MorphToLoop(&this->skelAnime, &gGanondorfBurstOutAnim, 0.0f); - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; // fake, tricks the compiler into allocating more stack if (zero) { this->unk_3A4.x *= 2.0; @@ -253,7 +253,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } case 1: if (this->unk_398 < 70) { - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } this->unk_339 = 3; Math_ApproachF(&this->unk_3A4.x, 1500.0f, 0.1f, this->unk_410.x * 1500.0f); @@ -263,13 +263,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = 1086.0f; this->unk_3B0.z = -200.0f; if (this->unk_398 == 150) { - Message_StartTextbox(globalCtx, 0x70D3, NULL); + Message_StartTextbox(play, 0x70D3, NULL); } - if (this->unk_398 > 250 && Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (this->unk_398 > 250 && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->unk_39C = 2; this->unk_398 = 0; this->unk_410.x = 0.0f; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } else { break; } @@ -284,15 +284,15 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { player->actor.shape.rot.y = -0x5000; sBossGanon2Zelda->actor.shape.rot.y = -0x5000; if (this->unk_398 == 60) { - Message_StartTextbox(globalCtx, 0x70D4, NULL); + Message_StartTextbox(play, 0x70D4, NULL); } if (this->unk_398 == 40) { sBossGanon2Zelda->unk_3C8 = 1; - func_8002DF54(globalCtx, &this->actor, 0x4E); + func_8002DF54(play, &this->actor, 0x4E); } if (this->unk_398 == 85) { sBossGanon2Zelda->unk_3C8 = 2; - func_8002DF54(globalCtx, &this->actor, 0x4F); + func_8002DF54(play, &this->actor, 0x4F); } this->unk_3A4.x = 930.0f; this->unk_3A4.y = 1129.0f; @@ -306,7 +306,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } else { this->unk_3B0.y = player->actor.world.pos.y + 47.0f + 7.0f; } - if ((this->unk_398 > 170) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->unk_398 > 170) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 3; this->unk_398 = 0; this->unk_410.x = 0.0f; @@ -321,14 +321,14 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } if (this->unk_398 == 20) { sBossGanon2Zelda->unk_3C8 = 3; - func_8002DF54(globalCtx, &this->actor, 0x50); + func_8002DF54(play, &this->actor, 0x50); } if (this->unk_398 == 55) { this->unk_39C = 4; this->unk_398 = 0; this->unk_410.x = 0.0f; sBossGanon2Zelda->unk_3C8 = 4; - func_8002DF54(globalCtx, &this->actor, 0x50); + func_8002DF54(play, &this->actor, 0x50); } break; case 4: @@ -337,15 +337,15 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_3A4.z, -20.0f, 0.1f, this->unk_410.x * 170.0f); Math_ApproachF(&this->unk_410.x, 0.04f, 1.0f, 0.0005f); if (this->unk_398 == 100) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(play, MAIN_CAM); camera->eye = this->unk_3A4; camera->eyeNext = this->unk_3A4; camera->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); + func_800C08AC(play, this->unk_39E, 0); this->unk_39E = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 5; this->unk_398 = 0; } @@ -353,13 +353,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { case 5: this->unk_339 = 4; if (this->actor.xzDistToPlayer < 500.0f) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->unk_39C = 10; this->unk_398 = 0; - func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->unk_39E = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_39E, CAM_STAT_ACTIVE); } else { break; } @@ -384,14 +384,14 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_339 = 5; if (this->unk_398 == 20) { this->unk_33C = 0.0f; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } } else { this->unk_339 = 4; } if (this->unk_398 == 30) { sBossGanon2Zelda->unk_3C8 = 5; - func_8002DF54(globalCtx, &this->actor, 0x51); + func_8002DF54(play, &this->actor, 0x51); } if (this->unk_398 == 50) { this->unk_398 = 0; @@ -422,7 +422,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { func_80078884(NA_SE_EV_STONE_BOUND); } if (this->unk_398 == 30) { - func_8002DF54(globalCtx, &this->actor, 0x52); + func_8002DF54(play, &this->actor, 0x52); } if (this->unk_398 == 50) { this->unk_398 = 0; @@ -438,8 +438,8 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3A4.z = -200.0f; this->unk_3B0.x = this->unk_3B0.z = -200.0f; this->unk_3B0.y = this->actor.world.pos.y + 70.0f; - globalCtx->envCtx.unk_D8 = 0.0f; - globalCtx->envCtx.unk_BE = globalCtx->envCtx.unk_BD = 0; + play->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_BE = play->envCtx.unk_BD = 0; this->unk_339 = 0; } else { break; @@ -487,7 +487,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = player->actor.world.pos.y; this->unk_3B0.z = player->actor.world.pos.z - 200.0f; if (this->unk_398 == 20) { - func_8002DF54(globalCtx, &this->actor, 0x1E); + func_8002DF54(play, &this->actor, 0x1E); } if (this->unk_398 == 60) { this->unk_3A4.x = (this->actor.world.pos.x + 200.0f) - 154.0f; @@ -500,12 +500,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.z = this->actor.world.pos.z + 5.0f; this->unk_3B0.x = this->actor.world.pos.x; } - if ((globalCtx->gameplayFrames % 32) == 0) { + if ((play->gameplayFrames % 32) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BREATH); } break; case 15: - if (((globalCtx->gameplayFrames % 32) == 0) && (this->unk_398 < 100)) { + if (((play->gameplayFrames % 32) == 0) && (this->unk_398 < 100)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BREATH); } SkelAnime_Update(&this->skelAnime); @@ -530,7 +530,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfTransformStartAnim, 0.0f); this->unk_194 = Animation_GetLastFrame(&gGanondorfTransformStartAnim); this->unk_339 = 55; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_CASBREAK); } else { break; @@ -563,7 +563,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sp8D = true; } if (this->unk_398 >= 60) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(play, MAIN_CAM); camera->eye = this->unk_3A4; camera->eyeNext = this->unk_3A4; @@ -571,11 +571,11 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_39C = 17; this->unk_398 = 0; this->unk_337 = 2; - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, false); - SkelAnime_Free(&this->skelAnime, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGanonSkel, NULL, NULL, NULL, 0); - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON_ANIME3, false); - func_8002DF54(globalCtx, &this->actor, 0x54); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, false); + SkelAnime_Free(&this->skelAnime, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gGanonSkel, NULL, NULL, NULL, 0); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON_ANIME3, false); + func_8002DF54(play, &this->actor, 0x54); this->unk_314 = 3; // At this point, the actor has Ganon's skeleton but is still playing an animation for Ganondorf. This @@ -639,7 +639,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->actor.world.pos.x += 250; this->actor.world.pos.y = 1886.0f; this->unk_394 = 0.0f; - func_8002DF54(globalCtx, &this->actor, 0x53); + func_8002DF54(play, &this->actor, 0x53); this->unk_30C = 5.0f; this->unk_228 = 1.0f; } @@ -667,14 +667,14 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_420 = 10.0f; this->actor.velocity.y = 0.0f; Animation_MorphToPlayOnce(&this->skelAnime, &gGanonUncurlAndFlailAnim, 0.0f); - func_808FD4D4(this, globalCtx, 0, 3); + func_808FD4D4(this, play, 0, 3); func_800A9F6C(0.0f, 0xC8, 0x14, 0x14); } break; case 21: this->unk_339 = 6; SkelAnime_Update(&this->skelAnime); - this->unk_41C = Math_CosS(globalCtx->gameplayFrames * 0x8000) * this->unk_420; + this->unk_41C = Math_CosS(play->gameplayFrames * 0x8000) * this->unk_420; Math_ApproachZeroF(&this->unk_420, 1.0f, 0.75f); if (this->unk_398 == 30) { this->unk_39C = 22; @@ -697,8 +697,8 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_336 = 2; } if (this->unk_398 == 80) { - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, false); - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, false); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGanonTitleCardTex), 160, 180, 128, 40, true); //It has translation but they are all the same. they all say "GANON" only } @@ -724,7 +724,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_398 == 215) { this->unk_39C = 23; this->unk_224 = 0.0f; - func_8002DF54(globalCtx, &this->actor, 0x55); + func_8002DF54(play, &this->actor, 0x55); } break; case 23: @@ -744,25 +744,25 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.z = player->actor.world.pos.z; if (this->unk_398 == 228) { func_80078884(NA_SE_IT_SHIELD_REFLECT_SW); - func_8002DF54(globalCtx, &this->actor, 0x56); + func_8002DF54(play, &this->actor, 0x56); func_800A9F6C(0.0f, 0xFF, 0xA, 0x32); } if (this->unk_398 >= 229) { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.screenFillColor[3] = 100; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = + play->envCtx.screenFillColor[2] = 255; + play->envCtx.screenFillColor[3] = 100; if (this->unk_398 == 234) { Vec3f sp68; - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; this->unk_39C = 24; this->unk_398 = 0; sp68 = player->actor.world.pos; sp68.y += 60.0f; - func_808FD210(globalCtx, &sp68); - globalCtx->envCtx.unk_D8 = 0.0f; - globalCtx->envCtx.unk_BE = 0; + func_808FD210(play, &sp68); + play->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_BE = 0; this->unk_339 = 0; } } @@ -770,7 +770,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { case 24: SkelAnime_Update(&this->skelAnime); if (1) { - BossGanon2Effect* effect = globalCtx->specialEffects; + BossGanon2Effect* effect = play->specialEffects; this->unk_3B0 = effect->position; this->unk_3A4.x = effect->position.x + 70.0f; @@ -781,7 +781,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { func_80078884(NA_SE_IT_SWORD_SWING); } if (this->unk_398 == 25) { - func_8002DF54(globalCtx, &this->actor, 0x57); + func_8002DF54(play, &this->actor, 0x57); this->unk_39C = 25; this->unk_398 = 0; } @@ -795,7 +795,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) - 3.0f; this->unk_3B0.z = (player->actor.world.pos.z - 40.0f) - 10.0f; if (this->unk_398 == 10) { - BossGanon2Effect* effect = globalCtx->specialEffects; + BossGanon2Effect* effect = play->specialEffects; effect->unk_2E = 1; effect->position.x = sBossGanon2Zelda->actor.world.pos.x + 50.0f + 10.0f; @@ -828,7 +828,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { case 27: this->unk_3BC.z = 0.0f; if (this->unk_398 == 4) { - func_8002DF54(globalCtx, &this->actor, 0x58); + func_8002DF54(play, &this->actor, 0x58); } this->unk_3A4.x = player->actor.world.pos.x - 20.0f; this->unk_3A4.y = player->actor.world.pos.y + 50.0f; @@ -837,7 +837,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = player->actor.world.pos.y + 50.0f; this->unk_3B0.z = player->actor.world.pos.z; if (this->unk_398 == 26) { - D_8090EB30 = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + D_8090EB30 = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (D_8090EB30 != NULL) { if (D_8090EB30->id == ACTOR_EN_ELF) { this->unk_3A4.x = D_8090EB30->world.pos.x - 30.0f; @@ -856,7 +856,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { break; case 28: if (this->unk_398 == 5) { - Message_StartTextbox(globalCtx, 0x70D6, NULL); + Message_StartTextbox(play, 0x70D6, NULL); } if (D_8090EB30 != NULL) { this->unk_3A4.x = D_8090EB30->world.pos.x - 20.0f; @@ -865,7 +865,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_3B0.x, D_8090EB30->world.pos.x, 0.2f, 50.0f); Math_ApproachF(&this->unk_3B0.y, D_8090EB30->world.pos.y, 0.2f, 50.0f); Math_ApproachF(&this->unk_3B0.z, D_8090EB30->world.pos.z, 0.2f, 50.0f); - if ((this->unk_398 > 40) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->unk_398 > 40) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 29; this->unk_398 = 0; Animation_MorphToPlayOnce(&this->skelAnime, &gGanonRoarAnim, 0.0f); @@ -893,18 +893,18 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_ROAR); } if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(play, MAIN_CAM); camera->eye = this->unk_3A4; camera->eyeNext = this->unk_3A4; camera->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); + func_800C08AC(play, this->unk_39E, 0); this->unk_39E = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 0; this->unk_337 = 1; - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); this->unk_1A2[1] = 50; this->actor.flags |= ACTOR_FLAG_0; sBossGanon2Zelda->unk_3C8 = 7; @@ -922,13 +922,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { osSyncPrintf(NULL, 0, 0); } this->unk_3B0.y += this->unk_41C; - Gameplay_CameraSetAtEyeUp(globalCtx, this->unk_39E, &this->unk_3B0, &this->unk_3A4, &this->unk_3BC); + Play_CameraSetAtEyeUp(play, this->unk_39E, &this->unk_3B0, &this->unk_3A4, &this->unk_3BC); } } -void func_808FF898(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FF898(BossGanon2* this, PlayState* play) { if ((this->unk_312 != 0) && (this->unk_39E == 0)) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + Actor* actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_DEMO_GJ) { DemoGj* gj = (DemoGj*)actor; @@ -967,8 +967,8 @@ void func_808FF898(BossGanon2* this, GlobalContext* globalCtx) { } } -s32 func_808FFA24(BossGanon2* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +s32 func_808FFA24(BossGanon2* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_DEMO_GJ) { @@ -990,7 +990,7 @@ s32 func_808FFA24(BossGanon2* this, GlobalContext* globalCtx) { return false; } -void func_808FFAC8(BossGanon2* this, GlobalContext* globalCtx, u8 arg2) { +void func_808FFAC8(BossGanon2* this, PlayState* play, u8 arg2) { s16 temp_v1; s16 phi_a1; @@ -1017,7 +1017,7 @@ void func_808FFAC8(BossGanon2* this, GlobalContext* globalCtx, u8 arg2) { Math_ApproachS(&this->unk_31C, temp_v1, 5, 0x7D0); } -void func_808FFBBC(BossGanon2* this, GlobalContext* globalCtx, u8 arg2) { +void func_808FFBBC(BossGanon2* this, PlayState* play, u8 arg2) { if (arg2 != 0 || this->unk_313) { f32 phi_f0; f32 phi_f2; @@ -1048,25 +1048,25 @@ void func_808FFC84(BossGanon2* this) { } } -void func_808FFCFC(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFCFC(BossGanon2* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f && ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x2800) { this->unk_311 = false; - func_80900580(this, globalCtx); + func_80900580(this, play); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); - } else if ((this->actor.bgCheckFlags & 8) && func_808FFA24(this, globalCtx)) { + } else if ((this->actor.bgCheckFlags & 8) && func_808FFA24(this, play)) { this->unk_311 = false; - func_80900580(this, globalCtx); + func_80900580(this, play); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); } } -void func_808FFDB0(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFDB0(BossGanon2* this, PlayState* play) { s32 sp28; - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON2); + s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON2); - if (Object_IsLoaded(&globalCtx->objectCtx, objectIdx)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objectIdx].segment); + if (Object_IsLoaded(&play->objectCtx, objectIdx)) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIdx].segment); Animation_MorphToLoop(&this->skelAnime, &gGanonGuardIdleAnim, -10.0f); this->actionFunc = func_808FFEBC; @@ -1085,7 +1085,7 @@ void func_808FFDB0(BossGanon2* this, GlobalContext* globalCtx) { } } -void func_808FFEBC(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFEBC(BossGanon2* this, PlayState* play) { if (this->unk_390 == 0) { this->unk_390 = (s16)Rand_ZeroFloat(50.0f) + 30; Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_UNARI); @@ -1095,29 +1095,29 @@ void func_808FFEBC(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); if (this->unk_1A2[0] == 0) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } else if (this->unk_1A2[1] == 0) { - func_808FFCFC(this, globalCtx); + func_808FFCFC(this, play); } - func_808FFAC8(this, globalCtx, 0); - func_808FFBBC(this, globalCtx, 0); + func_808FFAC8(this, play, 0); + func_808FFBBC(this, play, 0); } -void func_808FFF90(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFF90(BossGanon2* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gGanonGuardIdleAnim, -10.0f); this->actionFunc = func_808FFFE0; this->unk_1A2[0] = 40; } -void func_808FFFE0(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFFE0(BossGanon2* this, PlayState* play) { s16 target; SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); if (this->unk_1A2[0] == 0) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } if (this->unk_1A2[0] < 30 && this->unk_1A2[0] >= 10) { @@ -1129,14 +1129,14 @@ void func_808FFFE0(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachS(&this->unk_31A, target, 2, 0x4000); } -void func_809000A0(BossGanon2* this, GlobalContext* globalCtx) { +void func_809000A0(BossGanon2* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gGanonStunStartAnim, -2.0f); this->unk_194 = Animation_GetLastFrame(&gGanonStunStartAnim); this->unk_1AC = 0; this->actionFunc = func_80900104; } -void func_80900104(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900104(BossGanon2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); @@ -1157,28 +1157,28 @@ void func_80900104(BossGanon2* this, GlobalContext* globalCtx) { break; case 2: if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } break; } } -void func_80900210(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900210(BossGanon2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonDamageAnim, -3.0f); this->unk_194 = Animation_GetLastFrame(&gGanonDamageAnim); this->actionFunc = func_8090026C; } -void func_8090026C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090026C(BossGanon2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } } -void func_809002CC(BossGanon2* this, GlobalContext* globalCtx) { +void func_809002CC(BossGanon2* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gGanonGuardWalkAnim, -10.0f); this->actionFunc = func_80900344; this->unk_338 = 0; @@ -1186,7 +1186,7 @@ void func_809002CC(BossGanon2* this, GlobalContext* globalCtx) { this->unk_390 = (s16)Rand_ZeroFloat(50.0f) + 50; } -void func_80900344(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900344(BossGanon2* this, PlayState* play) { f32 phi_f0; if (this->unk_390 == 0) { @@ -1198,9 +1198,9 @@ void func_80900344(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_338 != 0) { if (Animation_OnFrame(&this->skelAnime, 13.0f)) { - func_808FD4D4(this, globalCtx, 1, 3); + func_808FD4D4(this, play, 1, 3); } else if (Animation_OnFrame(&this->skelAnime, 28.0f)) { - func_808FD4D4(this, globalCtx, 2, 3); + func_808FD4D4(this, play, 2, 3); } if (this->actor.xzDistToPlayer < 200.0f) { this->unk_338 = 0; @@ -1227,16 +1227,16 @@ void func_80900344(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, phi_f0, 0.5f, 1.0f); if (this->unk_1A2[0] == 0) { - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); } else { - func_808FFCFC(this, globalCtx); + func_808FFCFC(this, play); } - func_808FFAC8(this, globalCtx, 1); - func_808FFBBC(this, globalCtx, 1); + func_808FFAC8(this, play, 1); + func_808FFBBC(this, play, 1); } -void func_80900580(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900580(BossGanon2* this, PlayState* play) { if (this->unk_311 == 0) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonLeftSwordSwingAnim, -5.0f); this->unk_194 = Animation_GetLastFrame(&gGanonLeftSwordSwingAnim); @@ -1250,7 +1250,7 @@ void func_80900580(BossGanon2* this, GlobalContext* globalCtx) { this->actionFunc = func_80900650; } -void func_80900650(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900650(BossGanon2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, this->unk_198)) { @@ -1274,22 +1274,22 @@ void func_80900650(BossGanon2* this, GlobalContext* globalCtx) { this->unk_311 = 1 - this->unk_311; if ((this->unk_311 == 1) && (this->actor.xzDistToPlayer < 250.0f) && this->unk_313) { - func_80900580(this, globalCtx); + func_80900580(this, play); } else { - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); } } - func_808FFAC8(this, globalCtx, 0); + func_808FFAC8(this, play, 0); if ((this->unk_334 == 0) && (this->unk_311 == 0)) { this->unk_320 = 0.0f; } else { - func_808FFBBC(this, globalCtx, 0); + func_808FFBBC(this, play, 0); } } -void func_80900818(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900818(BossGanon2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonDownedStartAnim, -5.0f); this->unk_194 = Animation_GetLastFrame(&gGanonDownedStartAnim); this->actionFunc = func_80900890; @@ -1299,7 +1299,7 @@ void func_80900818(BossGanon2* this, GlobalContext* globalCtx) { this->unk_336 = 0; } -void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900890(BossGanon2* this, PlayState* play) { Vec3f sp5C; Vec3f sp50; Camera* sp4C; @@ -1310,25 +1310,25 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { f32 temp_f12; f32 temp_f2; - sp4C = Gameplay_GetCamera(globalCtx, MAIN_CAM); - player = GET_PLAYER(globalCtx); + sp4C = Play_GetCamera(play, MAIN_CAM); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); this->unk_398++; this->unk_339 = 20; switch (this->unk_39C) { case 0: - func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 8); + func_80064520(play, &play->csCtx); + this->unk_39E = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_39E, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 8); this->unk_39C = 1; this->unk_3A4 = sp4C->eye; this->unk_3B0 = sp4C->at; this->unk_1A2[0] = 300; this->unk_1A2[1] = 100; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; case 1: if (this->unk_1A2[1] == 50) { func_80078884(NA_SE_EN_MGANON_WALK); @@ -1358,30 +1358,30 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = sBossGanon2Zelda->actor.world.pos.y + 30.0f; this->unk_3B0.z = sBossGanon2Zelda->actor.world.pos.z - 10.0f; Math_ApproachZeroF(&this->unk_324, 1.0f, 5.0f); - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 1.0f / 51); + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 1.0f / 51); if (this->unk_1A2[1] == 80) { - Message_StartTextbox(globalCtx, 0x70D7, NULL); + Message_StartTextbox(play, 0x70D7, NULL); } - if ((this->unk_1A2[1] < 30) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - temp_v0 = Gameplay_GetCamera(globalCtx, MAIN_CAM); + if ((this->unk_1A2[1] < 30) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + temp_v0 = Play_GetCamera(play, MAIN_CAM); temp_v0->eye = this->unk_3A4; temp_v0->eyeNext = this->unk_3A4; temp_v0->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); + func_800C08AC(play, this->unk_39E, 0); this->unk_39E = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 3; } break; case 10: - func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->unk_39E = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_39E, CAM_STAT_ACTIVE); this->unk_39C = 11; this->unk_334 = 1; - func_8002DF54(globalCtx, &this->actor, 0x60); + func_8002DF54(play, &this->actor, 0x60); this->unk_398 = 0; case 11: player->actor.world.pos.x = sBossGanon2Zelda->actor.world.pos.x + 50.0f + 10.0f; @@ -1394,21 +1394,21 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = (player->actor.world.pos.y + 60.0f) - 25.0f; this->unk_3B0.z = player->actor.world.pos.z; if (this->unk_398 == 80) { - temp_v0_2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); + temp_v0_2 = Play_GetCamera(play, MAIN_CAM); temp_v0_2->eye = this->unk_3A4; temp_v0_2->eyeNext = this->unk_3A4; temp_v0_2->at = this->unk_3B0; this->unk_39C = 3; - func_800C08AC(globalCtx, this->unk_39E, 0); + func_800C08AC(play, this->unk_39E, 0); this->unk_39E = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); } break; } if (this->unk_39E != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->unk_39E, &this->unk_3B0, &this->unk_3A4); + Play_CameraSetAtEye(play, this->unk_39E, &this->unk_3B0, &this->unk_3A4); } switch (this->unk_1AC) { @@ -1419,7 +1419,7 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { } break; case 1: - if ((globalCtx->gameplayFrames % 32) == 0) { + if ((play->gameplayFrames % 32) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_BREATH); } @@ -1438,9 +1438,9 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { break; case 2: Math_ApproachF(&this->unk_324, 255.0f, 1.0f, 10.0f); - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 2.0f / 51.0f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 2.0f / 51.0f); if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); if (this->unk_334 == 0) { this->actor.colChkInfo.health = 25; } @@ -1452,7 +1452,7 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); } -void func_80901020(BossGanon2* this, GlobalContext* globalCtx) { +void func_80901020(BossGanon2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonDownedStartAnim, -5.0f); this->unk_194 = Animation_GetLastFrame(&gGanonDownedStartAnim); this->actionFunc = func_8090120C; @@ -1462,7 +1462,7 @@ void func_80901020(BossGanon2* this, GlobalContext* globalCtx) { this->unk_314 = 4; } -void func_8090109C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090109C(BossGanon2* this, PlayState* play) { u8 i; static Color_RGBA8 sPrimColor = { 0, 120, 0, 255 }; @@ -1490,12 +1490,12 @@ void func_8090109C(BossGanon2* this, GlobalContext* globalCtx) { pos.x = this->unk_1B8.x; pos.y = this->unk_1B8.y; pos.z = this->unk_1B8.z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, (s16)Rand_ZeroFloat(50.0f) + 50, 0, + func_8002836C(play, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, (s16)Rand_ZeroFloat(50.0f) + 50, 0, 17); } } -void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090120C(BossGanon2* this, PlayState* play) { Player* player; f32 temp_f14; f32 temp_f12; @@ -1504,7 +1504,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { f32 phi_f0; s32 phi_a1; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_398++; SkelAnime_Update(&this->skelAnime); @@ -1514,11 +1514,11 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { switch (this->unk_39C) { case 0: - func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 8); + func_80064520(play, &play->csCtx); + this->unk_39E = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_39E, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 8); this->unk_39C = 1; this->unk_398 = 0; sBossGanon2Zelda->unk_3C8 = 9; @@ -1528,14 +1528,14 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_324 = 0.0f; this->actor.speedXZ = 0.0f; this->unk_31A = this->unk_31C; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; case 1: if (this->unk_398 < 90) { this->unk_339 = 20; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); } else if (this->unk_398 >= 90) { this->unk_339 = 21; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.08f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.08f); } if (this->unk_398 == 50) { func_80078884(NA_SE_EN_MGANON_WALK); @@ -1554,7 +1554,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 3.0f; } if (this->unk_398 == 120) { - func_8002DF54(globalCtx, &this->actor, 0x63); + func_8002DF54(play, &this->actor, 0x63); } this->actor.world.rot.y = 0x4000; this->actor.world.pos.x = this->actor.world.pos.z = 0.0f; @@ -1577,7 +1577,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { break; case 2: this->unk_339 = 22; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); func_80078884(NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); this->unk_3A4.x = 250; this->unk_3A4.y = 1150.0f; @@ -1600,9 +1600,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = sBossGanon2Zelda->actor.world.pos.y + 40.0f; this->unk_3B0.z = sBossGanon2Zelda->actor.world.pos.z; if (this->unk_398 == 10) { - Message_StartTextbox(globalCtx, 0x70D8, NULL); + Message_StartTextbox(play, 0x70D8, NULL); } - if ((this->unk_398 > 80) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->unk_398 > 80) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 4; this->unk_398 = 0; } @@ -1614,7 +1614,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { sBossGanon2Zelda->unk_3C8 = 10; } this->unk_339 = 23; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f); } else { this->unk_339 = 22; } @@ -1622,7 +1622,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_39C = 5; this->unk_398 = 40; this->skelAnime.playSpeed = 1.0f; - func_8002DF54(globalCtx, &this->actor, 0x64); + func_8002DF54(play, &this->actor, 0x64); } break; case 5: @@ -1636,10 +1636,10 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->unk_38C, 1.0f, 8.0f); } if (this->unk_398 == 70) { - func_8002DF54(globalCtx, &this->actor, 0x65); + func_8002DF54(play, &this->actor, 0x65); } if (this->unk_398 == 150) { - func_8002DF54(globalCtx, &this->actor, 0x66); + func_8002DF54(play, &this->actor, 0x66); } this->unk_30C = 10.0f; player->actor.world.pos.x = 250.0f; @@ -1651,14 +1651,14 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_3B0.y = player->actor.world.pos.y + 40.0f; this->unk_3B0.z = player->actor.world.pos.z; if (this->unk_398 == 166) { - temp_v0_2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); + temp_v0_2 = Play_GetCamera(play, MAIN_CAM); temp_v0_2->eye = this->unk_3A4; temp_v0_2->eyeNext = this->unk_3A4; temp_v0_2->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); + func_800C08AC(play, this->unk_39E, 0); this->unk_39E = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 6; } break; @@ -1669,21 +1669,21 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { temp_a0_2 = Math_Atan2S(temp_f12, temp_f14) - player->actor.shape.rot.y; if ((ABS(temp_a0_2) < 0x2000) && (sqrtf(SQ(temp_f14) + SQ(temp_f12)) < 70.0f) && (player->swordState != 0) && (player->heldItemActionParam == PLAYER_AP_SWORD_MASTER)) { - func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->unk_39E = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_39E, CAM_STAT_ACTIVE); this->unk_39C = 7; this->unk_398 = 0; Animation_MorphToPlayOnce(&this->skelAnime, &gGanonFinalBlowAnim, 0.0f); this->unk_194 = Animation_GetLastFrame(&gGanonFinalBlowAnim); - globalCtx->startPlayerCutscene(globalCtx, &this->actor, 0x61); + play->startPlayerCutscene(play, &this->actor, 0x61); } else { break; } case 7: this->unk_339 = 23; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.2f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.2f); player->actor.world.pos.x = 250.0f; player->actor.shape.rot.y = -0x4000; player->actor.world.pos.z = 30.0f; @@ -1694,10 +1694,10 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { if ((this->unk_398 == 22) || (this->unk_398 == 35) || (this->unk_398 == 72) || (this->unk_398 == 45)) { func_80078884(NA_SE_EN_MGANON_DAMAGE); func_80078884(NA_SE_IT_SHIELD_BOUND); - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } if ((this->unk_398 == 22) || (this->unk_398 == 35) || (this->unk_398 == 72) || (this->unk_398 == 45)) { - func_8090109C(this, globalCtx); + func_8090109C(this, play); } if ((this->unk_398 >= 34) && (this->unk_398 < 40)) { this->unk_3A4.x = 269.0f; @@ -1743,7 +1743,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_398 == 55) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonDeadStartAnim, 0.0f); this->unk_194 = Animation_GetLastFrame(&gGanonDeadStartAnim); - func_8002DF54(globalCtx, &this->actor, 0x62); + func_8002DF54(play, &this->actor, 0x62); this->unk_39C = 8; this->unk_398 = 1000; } @@ -1755,15 +1755,15 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_398 >= 1000) { if (this->unk_398 < 1040) { this->unk_339 = 23; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.2f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.2f); } } if (this->unk_398 == 1040) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_DEAD2); this->unk_336 = 2; this->unk_339 = 0; - globalCtx->envCtx.unk_BE = 0; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_BE = 0; + play->envCtx.unk_D8 = 0.0f; } if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonDeadLoopAnim, 0.0f); @@ -1783,9 +1783,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_39C = 9; this->unk_398 = 0; sBossGanon2Zelda->unk_3C8 = 11; - Message_StartTextbox(globalCtx, 0x70D9, NULL); + Message_StartTextbox(play, 0x70D9, NULL); this->unk_336 = 0; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } break; case 9: @@ -1808,7 +1808,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_3A4.y, 1130.0f, 0.05f, this->unk_410.x * 0.25f); Math_ApproachF(&this->unk_3A4.z, -260.0f, 0.05f, this->unk_410.x * 1.25f); if ((this->unk_398 >= 40) && (this->unk_398 <= 110)) { - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.02f); + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.02f); Math_ApproachF(&this->unk_384, 10.0f, 0.1f, 0.2f); Audio_PlayActorSound2(&sBossGanon2Zelda->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG); } else { @@ -1835,16 +1835,16 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { break; } case 20: - globalCtx->nextEntranceIndex = 0x6B; + play->nextEntranceIndex = 0x6B; gSaveContext.nextCutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; - globalCtx->linkAgeOnLoad = 1; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; + play->linkAgeOnLoad = 1; break; } if (this->unk_39E != 0) { - Gameplay_CameraSetAtEyeUp(globalCtx, this->unk_39E, &this->unk_3B0, &this->unk_3A4, &this->unk_3BC); + Play_CameraSetAtEyeUp(play, this->unk_39E, &this->unk_3B0, &this->unk_3A4, &this->unk_3BC); } switch (this->unk_1AC) { @@ -1855,14 +1855,14 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { } break; case 1: - if ((this->unk_39C < 7) && ((globalCtx->gameplayFrames % 32) == 0)) { + if ((this->unk_39C < 7) && ((play->gameplayFrames % 32) == 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_BREATH); } break; } } -void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { +void func_80902348(BossGanon2* this, PlayState* play) { Player* player; f32 temp_f2; f32 temp_f12; @@ -1883,7 +1883,7 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { phi_v0_2 = 0; } - func_8002F6D4(globalCtx, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, 0); + func_8002F6D4(play, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, 0); sBossGanon2Zelda->unk_3C8 = 8; this->unk_316 = 10; break; @@ -1892,7 +1892,7 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { } if (this->unk_324 > 0.0f) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); temp_f2 = -200.0f - player->actor.world.pos.x; temp_f12 = -200.0f - player->actor.world.pos.z; @@ -1902,13 +1902,13 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { } player->isBurning = true; - func_8002F6D4(globalCtx, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); + func_8002F6D4(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); sBossGanon2Zelda->unk_3C8 = 8; } } } -void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { +void func_80902524(BossGanon2* this, PlayState* play) { s8 temp_v0_4; ColliderInfo* acHitInfo; s16 i; @@ -1928,7 +1928,7 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { this->unk_424.elements[0].info.bumperFlags &= ~2; acHitInfo = this->unk_424.elements[0].info.acHitInfo; if ((acHitInfo->toucher.dmgFlags & 0x2000) && (this->actionFunc != func_80900890)) { - func_809000A0(this, globalCtx); + func_809000A0(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_HIT_THUNDER); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_DAMAGE); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); @@ -1940,16 +1940,16 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { this->actor.colChkInfo.health -= 2; temp_v0_4 = this->actor.colChkInfo.health; if (temp_v0_4 < 0x15 && this->unk_334 == 0) { - func_80900818(this, globalCtx); + func_80900818(this, play); } else { if (temp_v0_4 <= 0) { - func_80901020(this, globalCtx); + func_80901020(this, play); } else { - func_80900210(this, globalCtx); + func_80900210(this, play); } } } else if (this->actionFunc != func_80900890) { - func_808FFF90(this, globalCtx); + func_808FFF90(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_IT_HOOKSHOT_REFLECT); } } @@ -1974,20 +1974,20 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { this->actor.colChkInfo.health -= phi_v1_2; temp_v0_4 = this->actor.colChkInfo.health; if ((temp_v0_4 < 0x15) && (this->unk_334 == 0)) { - func_80900818(this, globalCtx); + func_80900818(this, play); } else if ((temp_v0_4 <= 0) && (phi_v1_2 >= 2)) { - func_80901020(this, globalCtx); + func_80901020(this, play); } else { if (temp_v0_4 <= 0) { this->actor.colChkInfo.health = 1; } - func_80900210(this, globalCtx); + func_80900210(this, play); } } } } -void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon2_Update(Actor* thisx, PlayState* play) { BossGanon2* this = (BossGanon2*)thisx; s32 pad; s16 i; @@ -1999,16 +1999,16 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { f32 sp44; if ((this->unk_337 == 0) || (this->unk_337 == 2)) { - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON_ANIME3, false); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON_ANIME3, false); } else { - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, false); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, false); Math_ApproachZeroF(&this->unk_30C, 1.0f, 0.5f); } func_808FFC84(this); this->unk_312 = 0; this->unk_19C++; Actor_SetScale(&this->actor, 0.01f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->unk_1A2); i++) { if (this->unk_1A2[i] != 0) { this->unk_1A2[i]--; @@ -2029,10 +2029,10 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); this->actor.shape.rot = this->actor.world.rot; if (this->unk_335 != 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 60.0f, 60.0f, 100.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 60.0f, 60.0f, 100.0f, 5); if (this->actor.bgCheckFlags & 1) { if (this->actor.velocity.y < -5.0f) { - func_80033E88(&this->actor, globalCtx, 5, 20); + func_80033E88(&this->actor, play, 5, 20); func_80078884(NA_SE_IT_BOMB_EXPLOSION); } this->actor.velocity.y = 0.0f; @@ -2091,16 +2091,16 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_352[i] = Math_SinS(((s16)this->unk_36C + (i * (s16)this->unk_370.y))) * phi_f2 * this->unk_370.z; } - func_808FF898(this, globalCtx); - func_80902348(this, globalCtx); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_424.base); + func_808FF898(this, play); + func_80902348(this, play); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_424.base); if (this->actionFunc != func_8090120C) { - func_80902524(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_424.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); + func_80902524(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_424.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_444.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_444.base); if (this->unk_39E == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_444.base); } } if ((this->unk_332 == 0) && (this->unk_336 != 0)) { @@ -2110,9 +2110,9 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_332 = (s16)Rand_ZeroFloat(60.0f) + 0xA; } this->unk_339 = 0; - globalCtx->envCtx.unk_BE = 0; - globalCtx->envCtx.unk_BD = (s8)Rand_ZeroFloat(1.9f) + 1; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BE = 0; + play->envCtx.unk_BD = (s8)Rand_ZeroFloat(1.9f) + 1; + play->envCtx.unk_D8 = 1.0f; D_8090EB20.y = 0.0f; D_8090EB20.x = D_8090EB20.y; D_8090EB20.z = D_8090EB20.x; @@ -2127,75 +2127,75 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { } else if (this->unk_332 != 0) { this->unk_332--; } - if ((globalCtx->envCtx.unk_D8 > 0.0f) && (this->unk_336 != 0)) { - globalCtx->envCtx.customSkyboxFilter = 1; - globalCtx->envCtx.skyboxFilterColor[0] = 255; - globalCtx->envCtx.skyboxFilterColor[1] = 255; - globalCtx->envCtx.skyboxFilterColor[2] = 255; - globalCtx->envCtx.skyboxFilterColor[3] = (s16)(globalCtx->envCtx.unk_D8 * 200.0f); + if ((play->envCtx.unk_D8 > 0.0f) && (this->unk_336 != 0)) { + play->envCtx.customSkyboxFilter = 1; + play->envCtx.skyboxFilterColor[0] = 255; + play->envCtx.skyboxFilterColor[1] = 255; + play->envCtx.skyboxFilterColor[2] = 255; + play->envCtx.skyboxFilterColor[3] = (s16)(play->envCtx.unk_D8 * 200.0f); } else { - globalCtx->envCtx.customSkyboxFilter = 0; + play->envCtx.customSkyboxFilter = 0; } - globalCtx->envCtx.unk_BF = 0; - globalCtx->envCtx.unk_DC = 2; + play->envCtx.unk_BF = 0; + play->envCtx.unk_DC = 2; switch (this->unk_339) { case 0: - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.1f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.1f); break; case 3: - globalCtx->envCtx.unk_BE = 3; - globalCtx->envCtx.unk_BD = 4; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.0125f); + play->envCtx.unk_BE = 3; + play->envCtx.unk_BD = 4; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.0125f); break; case 4: - globalCtx->envCtx.unk_BE = 5; - globalCtx->envCtx.unk_BD = 6; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.0125f); + play->envCtx.unk_BE = 5; + play->envCtx.unk_BD = 6; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.0125f); break; case 5: - globalCtx->envCtx.unk_BE = 6; - globalCtx->envCtx.unk_BD = 7; + play->envCtx.unk_BE = 6; + play->envCtx.unk_BD = 7; Math_ApproachF(&this->unk_33C, 0.69f, 1.0f, 0.05f); - globalCtx->envCtx.unk_D8 = - (Math_SinS(globalCtx->gameplayFrames * 0x5000) * 0.15f) + (0.15f + this->unk_33C); + play->envCtx.unk_D8 = + (Math_SinS(play->gameplayFrames * 0x5000) * 0.15f) + (0.15f + this->unk_33C); break; case 55: - globalCtx->envCtx.unk_BE = 2; - globalCtx->envCtx.unk_BD = 0; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); + play->envCtx.unk_BE = 2; + play->envCtx.unk_BD = 0; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f); break; case 6: - globalCtx->envCtx.unk_BE = 2; - globalCtx->envCtx.unk_BD = 8; + play->envCtx.unk_BE = 2; + play->envCtx.unk_BD = 8; Math_ApproachF(&this->unk_33C, 0.69f, 1.0f, 0.05f); - globalCtx->envCtx.unk_D8 = - (Math_SinS(globalCtx->gameplayFrames * 0x7000) * 0.15f) + (0.15f + this->unk_33C); + play->envCtx.unk_D8 = + (Math_SinS(play->gameplayFrames * 0x7000) * 0.15f) + (0.15f + this->unk_33C); break; case 7: - globalCtx->envCtx.unk_BE = 0; - globalCtx->envCtx.unk_BD = 8; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.02f); + play->envCtx.unk_BE = 0; + play->envCtx.unk_BD = 8; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.02f); break; case 20: - globalCtx->envCtx.unk_BE = 0; - globalCtx->envCtx.unk_BD = 9; + play->envCtx.unk_BE = 0; + play->envCtx.unk_BD = 9; break; case 21: - globalCtx->envCtx.unk_BE = 0xA; - globalCtx->envCtx.unk_BD = 9; + play->envCtx.unk_BE = 0xA; + play->envCtx.unk_BD = 9; break; case 22: - globalCtx->envCtx.unk_BE = 0xA; - globalCtx->envCtx.unk_BD = 0xB; + play->envCtx.unk_BE = 0xA; + play->envCtx.unk_BD = 0xB; break; case 23: - globalCtx->envCtx.unk_BE = 9; - globalCtx->envCtx.unk_BD = 0xB; + play->envCtx.unk_BE = 9; + play->envCtx.unk_BD = 0xB; break; case 24: - globalCtx->envCtx.unk_BE = 0; - globalCtx->envCtx.unk_BD = 0xC; + play->envCtx.unk_BE = 0; + play->envCtx.unk_BD = 0xC; break; case -1: break; @@ -2217,11 +2217,11 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { sp4C.y = Rand_ZeroFloat(15.0f) + 15.0f; sp58.x += sp4C.x * 10.0f * 0.1f; sp58.z += sp4C.z * 10.0f * 0.1f; - func_808FD27C(globalCtx, &sp58, &sp4C, Rand_ZeroFloat(0.3f) + 0.2f); + func_808FD27C(play, &sp58, &sp4C, Rand_ZeroFloat(0.3f) + 0.2f); } } this->unk_388 += 0.15f; - func_80905DA8(this, globalCtx); + func_80905DA8(this, play); } void func_809034E4(Vec3f* arg0, Vec3f* arg1) { @@ -2419,8 +2419,8 @@ void func_809034E4(Vec3f* arg0, Vec3f* arg1) { } } -void func_80903F38(BossGanon2* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_80903F38(BossGanon2* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); if (this->unk_312 != 0) { func_809034E4(&this->unk_200, &this->unk_20C); @@ -2430,50 +2430,50 @@ void func_80903F38(BossGanon2* this, GlobalContext* globalCtx) { if (D_80910638 >= 4) { gSPSegment( POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, globalCtx->gameplayFrames * 18, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, play->gameplayFrames * 18, 0, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, D_80907080); Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00BB80); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80904108(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904108(BossGanon2* this, PlayState* play) { s32 pad; if (this->unk_324 > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s32)globalCtx->gameplayFrames, 0, 32, 64, 1, - -globalCtx->gameplayFrames * 2, -globalCtx->gameplayFrames * 8, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s32)play->gameplayFrames, 0, 32, 64, 1, + -play->gameplayFrames * 2, -play->gameplayFrames * 8, 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 200, 0, (s8)this->unk_324); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); Matrix_Translate(-200.0f, 1086.0f, -200.0f, MTXMODE_NEW); Matrix_Scale(0.098000005f, 0.1f, 0.098000005f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00E1C0)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904340(BossGanon2* this, PlayState* play) { s16 i; f32 rand; f32 angle; f32 sin; f32 cos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); if ((this->unk_330 != 0) || (this->unk_328 != 0)) { @@ -2507,7 +2507,7 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { Matrix_RotateY(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++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00D798)); FrameInterpolation_RecordCloseChild(); @@ -2515,38 +2515,38 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8090464C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090464C(BossGanon2* this, PlayState* play) { s32 pad; if (this->unk_1B4 > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_1B4); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128); Matrix_Translate(this->unk_1B8.x, this->unk_1B8.y, this->unk_1B8.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ(-0.2f, MTXMODE_APPLY); Matrix_Scale(0.6f, 0.6f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00CCD8)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -s32 BossGanon2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossGanon2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 pad; BossGanon2* this = (BossGanon2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 15) { rot->y += this->unk_31A; @@ -2568,17 +2568,17 @@ s32 BossGanon2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d *dList = NULL; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return 0; } -void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanon2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s8 pad; s8 temp_v0; BossGanon2* this = (BossGanon2*)thisx; Vec3f sp4C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); D_80907120.z = 17000.0f; D_8090712C.z = 3000.0f; @@ -2610,14 +2610,14 @@ void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis if ((limbIndex == 7) || (limbIndex == 13)) { Matrix_Push(); Matrix_Scale(this->unk_224, this->unk_224, this->unk_224, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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(); } else if ((limbIndex == 33) || (limbIndex == 34)) { Matrix_Push(); Matrix_Scale(this->unk_228, this->unk_228, this->unk_228, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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(); @@ -2637,17 +2637,17 @@ void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904D88(BossGanon2* this, PlayState* play) { s32 pad; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_30C > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->unk_380 > 0.0f) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0); @@ -2661,10 +2661,10 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild("Ganon 80904D88", i); Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_30C, this->unk_30C, this->unk_30C, MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B378); @@ -2672,47 +2672,47 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80904FC8(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904FC8(BossGanon2* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_384 > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 200); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); Matrix_Translate(sBossGanon2Zelda->actor.world.pos.x, sBossGanon2Zelda->actor.world.pos.y + 80.0f, sBossGanon2Zelda->actor.world.pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_384, this->unk_384, this->unk_384, MTXMODE_APPLY); Matrix_RotateZ(this->unk_388, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); Matrix_RotateZ(this->unk_388 * -2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090523C(BossGanon2* this, PlayState* play) { Player* player; f32 phi_f20; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_38C > 0.0f) { s8 i; - player = GET_PLAYER(globalCtx); - func_80093D84(globalCtx->state.gfxCtx); + player = GET_PLAYER(play); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->unk_38C); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 0); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); @@ -2729,10 +2729,10 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { phi_f20 = 1.0f - ((i - 7) * 0.2333333f); // 7 / 30 } - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(200.0f * phi_f20, 200.0f * phi_f20, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(Rand_ZeroFloat(2.0f * M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); @@ -2740,10 +2740,10 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossGanon2_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanon2_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s8 temp_v1 = D_80907144[limbIndex]; BossGanon2* this = (BossGanon2*)thisx; @@ -2751,28 +2751,28 @@ void BossGanon2_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Matrix_MultVec3f(&D_80906D60, &this->unk_234[temp_v1]); } if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - 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++, SEGMENTED_TO_VIRTUAL(gGanondorfEyesDL)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 10) { Matrix_MultVec3f(&D_80907164, &this->unk_1B8); } } -void func_80905674(BossGanon2* this, GlobalContext* globalCtx) { +void func_80905674(BossGanon2* this, PlayState* play) { s32 pad; if (this->unk_380 > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_19C * -8, 0, 32, 64, 1, this->unk_19C * -4, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_19C * -8, 0, 32, 64, 1, this->unk_19C * -4, this->unk_19C * -8, 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_37C); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128); @@ -2781,36 +2781,36 @@ void func_80905674(BossGanon2* this, GlobalContext* globalCtx) { Matrix_RotateY(-M_PI / 4.0f, MTXMODE_APPLY); Matrix_Scale(0.040000003f, 0.040000003f, this->unk_380, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00EC40)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) { - void* shadowTexture = Graph_Alloc(globalCtx->state.gfxCtx, 4096); +void BossGanon2_Draw(Actor* thisx, PlayState* play) { + void* shadowTexture = Graph_Alloc(play->state.gfxCtx, 4096); BossGanon2* this = (BossGanon2*)thisx; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->unk_337) { case 0: - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON, true); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON, true); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGanondorfEmptyEyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGanondorfEmptyEyeTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, BossGanon2_PostLimbDraw2, this); break; case 1: case 2: - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, true); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, true); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->unk_310])); func_808FD080(0, &this->unk_444, &D_8090717C); func_808FD080(1, &this->unk_444, &D_8090717C); @@ -2821,28 +2821,28 @@ void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, -4000.0f, 4000.0f, MTXMODE_APPLY); Matrix_RotateX(this->unk_394, MTXMODE_APPLY); Matrix_Translate(0.0f, 4000.0f, -4000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossGanon2_OverrideLimbDraw, BossGanon2_PostLimbDraw, this); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); - BossGanon2_GenShadowTexture(shadowTexture, this, globalCtx); - BossGanon2_DrawShadowTexture(shadowTexture, this, globalCtx); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + BossGanon2_GenShadowTexture(shadowTexture, this, play); + BossGanon2_DrawShadowTexture(shadowTexture, this, play); break; } - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, true); - func_80904340(this, globalCtx); - func_80904108(this, globalCtx); - func_80904D88(this, globalCtx); - func_8090464C(this, globalCtx); - func_80905674(this, globalCtx); - func_80904FC8(this, globalCtx); - func_8090523C(this, globalCtx); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, true); + func_80904340(this, play); + func_80904108(this, play); + func_80904D88(this, play); + func_8090464C(this, play); + func_80905674(this, play); + func_80904FC8(this, play); + func_8090523C(this, play); if ((this->unk_312 != 0) || (D_80907080 != 0)) { - func_80903F38(this, globalCtx); + func_80903F38(this, play); if (this->unk_312 == 0) { s32 pad; @@ -2862,15 +2862,15 @@ void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) { D_80910638 = 0; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - func_809060E8(globalCtx); + func_809060E8(play); } -void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx) { +void func_80905DA8(BossGanon2* this, PlayState* play) { s32 pad[5]; - Player* player = GET_PLAYER(globalCtx); - BossGanon2Effect* effect = globalCtx->specialEffects; + Player* player = GET_PLAYER(play); + BossGanon2Effect* effect = play->specialEffects; Vec3f sp78; s16 i; @@ -2896,7 +2896,7 @@ void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx) { sp78 = effect->position; sp78.y = 1086.0f; func_80078884(NA_SE_IT_SHIELD_REFLECT_SW); - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sp78); + CollisionCheck_SpawnShieldParticlesMetal(play, &sp78); } effect->velocity.y = 0.0f; } @@ -2929,18 +2929,18 @@ void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx) { } } -void func_809060E8(GlobalContext* globalCtx) { +void func_809060E8(PlayState* play) { s16 alpha; u8 usingObjectGEff = false; BossGanon2Effect* effect; s16 i; BossGanon2Effect* effects; - effects = effect = globalCtx->specialEffects; + effects = effect = play->specialEffects; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); for (i = 0; i < 1; i++) { if (effect->type == 1) { @@ -2950,22 +2950,22 @@ void func_809060E8(GlobalContext* globalCtx) { f32 temp_f0; f32 angle; - func_80093D84(globalCtx->state.gfxCtx); - spA0.x = globalCtx->envCtx.dirLight1.params.dir.x; - spA0.y = globalCtx->envCtx.dirLight1.params.dir.y; - spA0.z = globalCtx->envCtx.dirLight1.params.dir.z; - func_8002EABC(&effect->position, &globalCtx->view.eye, &spA0, globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + spA0.x = play->envCtx.dirLight1.params.dir.x; + spA0.y = play->envCtx.dirLight1.params.dir.y; + spA0.z = play->envCtx.dirLight1.params.dir.z; + func_8002EABC(&effect->position, &play->view.eye, &spA0, play->state.gfxCtx); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); Matrix_RotateY(effect->unk_38.z, MTXMODE_APPLY); Matrix_RotateX(effect->unk_38.y, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 0 - (globalCtx->gameplayFrames & 0x7F), 32, 32)); + Gfx_TexScroll(play->state.gfxCtx, 0, 0 - (play->gameplayFrames & 0x7F), 32, 32)); gSPDisplayList(POLY_OPA_DISP++, ovl_Boss_Ganon2_DL_0103A8); - if ((globalCtx->envCtx.unk_BD == 1) || (globalCtx->envCtx.unk_BD == 2)) { - alpha = (s16)(globalCtx->envCtx.unk_D8 * 150.0f) + 50; + if ((play->envCtx.unk_BD == 1) || (play->envCtx.unk_BD == 2)) { + alpha = (s16)(play->envCtx.unk_D8 * 150.0f) + 50; angle = M_PI / 5.0f; } else { alpha = 100; @@ -2976,7 +2976,7 @@ void func_809060E8(GlobalContext* globalCtx) { Matrix_Translate(effect->position.x + temp_f0, 1086.0f, (effect->position.z - 1.0f) + temp_f0, MTXMODE_NEW); Matrix_RotateY(angle, MTXMODE_APPLY); Matrix_Scale(1.0f, 0.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00F188); @@ -2991,7 +2991,7 @@ void func_809060E8(GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild("Ganon 809060E8 1", i); if (!usingObjectGEff) { - BossGanon2_SetObjectSegment(NULL, globalCtx, OBJECT_GEFF, true); + BossGanon2_SetObjectSegment(NULL, play, OBJECT_GEFF, true); usingObjectGEff++; } Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); @@ -2999,7 +2999,7 @@ void func_809060E8(GlobalContext* globalCtx) { Matrix_RotateY(effect->unk_38.z, MTXMODE_APPLY); Matrix_RotateX(effect->unk_38.y, MTXMODE_APPLY); Matrix_RotateZ(effect->unk_38.x, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGanonRubbleDL); @@ -3007,7 +3007,7 @@ void func_809060E8(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80906538(BossGanon2* this, u8* shadowTexture, f32 arg2) { @@ -3087,7 +3087,7 @@ void func_80906538(BossGanon2* this, u8* shadowTexture, f32 arg2) { } } -void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx) { +void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play) { s16 i; u32* p = shadowTexture; @@ -3102,17 +3102,17 @@ void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, GlobalCo } } -void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx) { +void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 alpha; OPEN_DISPS(gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - if ((globalCtx->envCtx.unk_BD == 1) || (globalCtx->envCtx.unk_BD == 2)) { - alpha = (s16)(globalCtx->envCtx.unk_D8 * 180.0f) + 30; + if ((play->envCtx.unk_BD == 1) || (play->envCtx.unk_BD == 2)) { + alpha = (s16)(play->envCtx.unk_D8 * 180.0f) + 30; } else { alpha = 120; } @@ -3121,7 +3121,7 @@ void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalC gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z - 20.0f, MTXMODE_NEW); Matrix_Scale(1.65f, 1.0f, 1.65f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_Boss_Ganon2_DL_00B3D0); gDPLoadTextureBlock(POLY_OPA_DISP++, shadowTexture, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h index 6271f5c14..667bb3712 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h @@ -20,7 +20,7 @@ typedef struct { struct BossGanon2; -typedef void (*BossGanon2ActionFunc)(struct BossGanon2*, GlobalContext*); +typedef void (*BossGanon2ActionFunc)(struct BossGanon2*, PlayState*); typedef struct BossGanon2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index bc860e523..71889cdc7 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -47,27 +47,27 @@ typedef enum { /* 2 */ DEATH_HUNCHED } BossGanondrofDeathAction; -void BossGanondrof_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGanondrof_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGanondrof_Init(Actor* thisx, PlayState* play); +void BossGanondrof_Destroy(Actor* thisx, PlayState* play); +void BossGanondrof_Update(Actor* thisx, PlayState* play); +void BossGanondrof_Draw(Actor* thisx, PlayState* play); -void BossGanondrof_SetupIntro(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx); +void BossGanondrof_SetupIntro(BossGanondrof* this, PlayState* play); +void BossGanondrof_Intro(BossGanondrof* this, PlayState* play); void BossGanondrof_SetupPaintings(BossGanondrof* this); -void BossGanondrof_Paintings(BossGanondrof* this, GlobalContext* globalCtx); +void BossGanondrof_Paintings(BossGanondrof* this, PlayState* play); void BossGanondrof_SetupNeutral(BossGanondrof* this, f32 arg1); -void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupThrow(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupBlock(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Block(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupReturn(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Return(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupCharge(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Stunned(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx); +void BossGanondrof_Neutral(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupThrow(BossGanondrof* this, PlayState* play); +void BossGanondrof_Throw(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupBlock(BossGanondrof* this, PlayState* play); +void BossGanondrof_Block(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupReturn(BossGanondrof* this, PlayState* play); +void BossGanondrof_Return(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupCharge(BossGanondrof* this, PlayState* play); +void BossGanondrof_Charge(BossGanondrof* this, PlayState* play); +void BossGanondrof_Stunned(BossGanondrof* this, PlayState* play); +void BossGanondrof_Death(BossGanondrof* this, PlayState* play); const ActorInit Boss_Ganondrof_InitVars = { ACTOR_BOSS_GANONDROF, @@ -277,64 +277,64 @@ void BossGanondrof_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) { collider->dim.pos.z = pos->z; } -void BossGanondrof_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Init(Actor* thisx, PlayState* play) { s32 pad; BossGanondrof* this = (BossGanondrof*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPhantomGanonSkel, &gPhantomGanonRideAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gPhantomGanonSkel, &gPhantomGanonRideAnim, NULL, NULL, 0); if (this->actor.params < GND_FAKE_BOSS) { this->actor.params = GND_REAL_BOSS; this->actor.colChkInfo.health = 30; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 255); - BossGanondrof_SetupIntro(this, globalCtx); + BossGanondrof_SetupIntro(this, play); } else { BossGanondrof_SetupPaintings(this); } - Collider_InitCylinder(globalCtx, &this->colliderBody); - Collider_InitCylinder(globalCtx, &this->colliderSpear); - Collider_SetCylinder(globalCtx, &this->colliderBody, &this->actor, &sCylinderInitBody); - Collider_SetCylinder(globalCtx, &this->colliderSpear, &this->actor, &sCylinderInitSpear); + Collider_InitCylinder(play, &this->colliderBody); + Collider_InitCylinder(play, &this->colliderSpear); + Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInitBody); + Collider_SetCylinder(play, &this->colliderSpear, &this->actor, &sCylinderInitSpear); this->actor.flags &= ~ACTOR_FLAG_0; - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 200.0f + GND_BOSSROOM_CENTER_X, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 200.0f + GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z, 0, 0, 0, 0); } else { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->actor.params); } } -void BossGanondrof_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossGanondrof* this = (BossGanondrof*)thisx; osSyncPrintf("DT1\n"); - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->colliderBody); - Collider_DestroyCylinder(globalCtx, &this->colliderSpear); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->colliderBody); + Collider_DestroyCylinder(play, &this->colliderSpear); if (this->actor.params == GND_REAL_BOSS) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } osSyncPrintf("DT2\n"); } -void BossGanondrof_SetupIntro(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupIntro(BossGanondrof* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &gPhantomGanonRidePoseAnim); this->actionFunc = BossGanondrof_Intro; this->work[GND_MASK_OFF] = true; } -void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Intro(BossGanondrof* this, PlayState* play) { s16 i; s32 pad; EnfHG* horse = (EnfHG*)this->actor.child; @@ -354,7 +354,7 @@ void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx) { pos.y = this->bodyPartsPos[14].y + Rand_ZeroFloat(-5.0f); pos.z = this->bodyPartsPos[14].z + Rand_CenteredFloat(10.0f) + 5.0f; accel.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &pos, &vel, &accel, (s16)Rand_ZeroFloat(10.0f) + 5, 0); + EffectSsKFire_Spawn(play, &pos, &vel, &accel, (s16)Rand_ZeroFloat(10.0f) + 5, 0); } if (this->timers[1] == 20) { @@ -384,7 +384,7 @@ void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &gPhantomGanonRideSpearRaiseAnim, -7.0f); horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, this->spearTip.z, 50, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); this->actor.child = &horseTemp->actor; } @@ -431,7 +431,7 @@ void BossGanondrof_SetupPaintings(BossGanondrof* this) { this->actionFunc = BossGanondrof_Paintings; } -void BossGanondrof_Paintings(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Paintings(BossGanondrof* this, PlayState* play) { EnfHG* horse = (EnfHG*)this->actor.child; osSyncPrintf("RUN 1\n"); @@ -444,7 +444,7 @@ void BossGanondrof_Paintings(BossGanondrof* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &gPhantomGanonRideSpearRaiseAnim, -2.0f); this->actor.flags |= ACTOR_FLAG_0; horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, this->spearTip.z, 30, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); this->actor.child = &horseTemp->actor; } else if (horse->bossGndSignal == FHG_LIGHTNING) { @@ -485,11 +485,11 @@ void BossGanondrof_SetupNeutral(BossGanondrof* this, f32 arg1) { this->timers[0] = (s16)(Rand_ZeroOne() * 64.0f) + 30; } -void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Neutral(BossGanondrof* this, PlayState* play) { f32 targetX; f32 targetY; f32 targetZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* playerx = &player->actor; Actor* thisx = &this->actor; f32 rand01; @@ -503,7 +503,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { rand01 = Rand_ZeroOne(); if (thisx->colChkInfo.health < 5) { if (rand01 < 0.25f) { - BossGanondrof_SetupThrow(this, globalCtx); + BossGanondrof_SetupThrow(this, play); } else if (rand01 >= 0.8f) { this->flyMode = GND_FLY_CHARGE; this->timers[0] = 60; @@ -516,7 +516,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(thisx, NA_SE_EN_FANTOM_LAUGH); } } else if ((rand01 < 0.5f) || (this->work[GND_THROW_COUNT] < 5)) { - BossGanondrof_SetupThrow(this, globalCtx); + BossGanondrof_SetupThrow(this, play); } else { this->flyMode = GND_FLY_VOLLEY; this->timers[0] = 60; @@ -551,7 +551,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { if (this->timers[0] == 0) { this->flyMode = GND_FLY_RETURN; this->returnSuccess = false; - BossGanondrof_SetupThrow(this, globalCtx); + BossGanondrof_SetupThrow(this, play); this->timers[0] = 80; } break; @@ -564,7 +564,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { targetZ += Math_CosS(this->work[GND_VARIANCE_TIMER] * 0x700) * 50.0f; if (this->returnSuccess) { this->returnSuccess = false; - BossGanondrof_SetupReturn(this, globalCtx); + BossGanondrof_SetupReturn(this, play); this->timers[0] = 80; } @@ -580,7 +580,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { targetX += Math_SinS(this->work[GND_VARIANCE_TIMER] * 0x500) * 100.0f; targetZ += Math_CosS(this->work[GND_VARIANCE_TIMER] * 0x700) * 100.0f; if (this->timers[0] == 0) { - BossGanondrof_SetupCharge(this, globalCtx); + BossGanondrof_SetupCharge(this, play); } break; } @@ -608,19 +608,19 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { pos.y = Rand_CenteredFloat(20.0f) + this->spearTip.y; pos.z = Rand_CenteredFloat(20.0f) + this->spearTip.z; accel.y = -0.08f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &pos, &vel, &accel, (s16)(Rand_ZeroOne() * 80.0f) + 150, + EffectSsFhgFlash_SpawnLightBall(play, &pos, &vel, &accel, (s16)(Rand_ZeroOne() * 80.0f) + 150, FHGFLASH_LIGHTBALL_GREEN); } } if (player->unk_A73 != 0) { - BossGanondrof_SetupBlock(this, globalCtx); + BossGanondrof_SetupBlock(this, play); } Audio_PlayActorSound2(thisx, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG); } -void BossGanondrof_SetupThrow(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupThrow(BossGanondrof* this, PlayState* play) { EnfHG* horseTemp; s16 lightTime; @@ -638,14 +638,14 @@ void BossGanondrof_SetupThrow(BossGanondrof* this, GlobalContext* globalCtx) { } horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, this->spearTip.z, lightTime, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); this->actor.child = &horseTemp->actor; this->work[GND_THROW_COUNT]++; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_STICK); } -void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Throw(BossGanondrof* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); osSyncPrintf("this->fwork[GND_END_FRAME] = %d\n", (s16)this->fwork[GND_END_FRAME]); osSyncPrintf("this->work[GND_SHOT_FRAME] = %d\n", this->work[GND_THROW_FRAME]); @@ -672,7 +672,7 @@ void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->work[GND_THROW_FRAME])) { EnfHG* horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, this->spearTip.z, this->work[GND_ACTION_STATE], 0, 0, FHGFIRE_ENERGY_BALL); this->actor.child = &horseTemp->actor; } @@ -685,7 +685,7 @@ void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 2.0f * Math_SinS(this->work[GND_VARIANCE_TIMER] * 1500); } -void BossGanondrof_SetupReturn(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupReturn(BossGanondrof* this, PlayState* play) { static AnimationHeader* returnAnim[] = { &gPhantomGanonReturn1Anim, &gPhantomGanonReturn2Anim }; s16 rand = Rand_ZeroOne() * 1.99f; @@ -694,7 +694,7 @@ void BossGanondrof_SetupReturn(BossGanondrof* this, GlobalContext* globalCtx) { this->actionFunc = BossGanondrof_Return; } -void BossGanondrof_Return(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Return(BossGanondrof* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 5.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_VOICE); @@ -713,12 +713,12 @@ void BossGanondrof_Return(BossGanondrof* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 2.0f * Math_SinS(this->work[GND_VARIANCE_TIMER] * 1500); if (this->returnSuccess) { this->returnSuccess = false; - BossGanondrof_SetupReturn(this, globalCtx); + BossGanondrof_SetupReturn(this, play); this->timers[0] = 80; } } -void BossGanondrof_SetupStunned(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupStunned(BossGanondrof* this, PlayState* play) { if (this->actionFunc != BossGanondrof_Stunned) { this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonAirDamageAnim); Animation_MorphToLoop(&this->skelAnime, &gPhantomGanonAirDamageAnim, 0.0f); @@ -735,7 +735,7 @@ void BossGanondrof_SetupStunned(BossGanondrof* this, GlobalContext* globalCtx) { this->actor.velocity.z = 0.0f; } -void BossGanondrof_Stunned(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Stunned(BossGanondrof* this, PlayState* play) { osSyncPrintf("DAMAGE .................................\n"); SkelAnime_Update(&this->skelAnime); this->actor.gravity = -0.2f; @@ -768,7 +768,7 @@ void BossGanondrof_Stunned(BossGanondrof* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } -void BossGanondrof_SetupBlock(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupBlock(BossGanondrof* this, PlayState* play) { this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonBlockAnim); Animation_MorphToLoop(&this->skelAnime, &gPhantomGanonBlockAnim, -3.0f); this->actionFunc = BossGanondrof_Block; @@ -776,7 +776,7 @@ void BossGanondrof_SetupBlock(BossGanondrof* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_STICK); } -void BossGanondrof_Block(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Block(BossGanondrof* this, PlayState* play) { this->colliderBody.base.colType = COLTYPE_METAL; SkelAnime_Update(&this->skelAnime); this->actor.world.pos.x += this->actor.velocity.x; @@ -791,7 +791,7 @@ void BossGanondrof_Block(BossGanondrof* this, GlobalContext* globalCtx) { } } -void BossGanondrof_SetupCharge(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupCharge(BossGanondrof* this, PlayState* play) { this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonChargeWindupAnim); Animation_MorphToLoop(&this->skelAnime, &gPhantomGanonChargeWindupAnim, -3.0f); this->actionFunc = BossGanondrof_Charge; @@ -799,8 +799,8 @@ void BossGanondrof_SetupCharge(BossGanondrof* this, GlobalContext* globalCtx) { this->work[GND_ACTION_STATE] = CHARGE_WINDUP; } -void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossGanondrof_Charge(BossGanondrof* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* playerx = &player->actor; Actor* thisx = &this->actor; f32 dxCenter = thisx->world.pos.x - GND_BOSSROOM_CENTER_X; @@ -914,7 +914,7 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) { accel.x = (offset.x * -50.0f) / 1000.0f; accel.y = (offset.y * -50.0f) / 1000.0f; accel.z = (offset.z * -50.0f) / 1000.0f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &pos, &vel, &accel, 150, i % 7); + EffectSsFhgFlash_SpawnLightBall(play, &pos, &vel, &accel, 150, i % 7); this->work[GND_PARTICLE_ANGLE] += 0x1A5C; } } @@ -922,13 +922,13 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) { if (!(this->work[GND_VARIANCE_TIMER] & 7)) { EnfHG* horse = (EnfHG*)thisx->child; - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, this->spearTip.z, 8, FHGFIRE_LIGHT_BLUE, 0, FHGFIRE_SPEAR_LIGHT); thisx->child = &horse->actor; } } -void BossGanondrof_SetupDeath(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupDeath(BossGanondrof* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gPhantomGanonDeathBlowAnim); this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonDeathBlowAnim); this->actionFunc = BossGanondrof_Death; @@ -940,14 +940,14 @@ void BossGanondrof_SetupDeath(BossGanondrof* this, GlobalContext* globalCtx) { this->shockTimer = 50; } -void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Death(BossGanondrof* this, PlayState* play) { u8 holdCamera = false; u8 bodyDecayLevel = 0; f32 camX; f32 camZ; f32 pad; - Player* player = GET_PLAYER(globalCtx); - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Player* player = GET_PLAYER(play); + Camera* camera = Play_GetCamera(play, 0); osSyncPrintf("PYP %f\n", player->actor.floorHeight); SkelAnime_Update(&this->skelAnime); @@ -959,12 +959,12 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { switch (this->deathState) { case DEATH_START: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->deathCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->deathCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); osSyncPrintf("7\n"); - Gameplay_ChangeCameraStatus(globalCtx, this->deathCamera, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, this->deathCamera, CAM_STAT_ACTIVE); osSyncPrintf("8\n"); this->deathState = DEATH_THROES; player->actor.speedXZ = 0.0f; @@ -1051,11 +1051,11 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { if (this->timers[1] == 1) { EnfHG* horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y + 3.0f, GND_BOSSROOM_CENTER_Z, 0x4000, 0, 0, FHGFIRE_WARP_DEATH); this->actor.child = &horseTemp->actor; - Message_StartTextbox(globalCtx, 0x108E, NULL); + Message_StartTextbox(play, 0x108E, NULL); } this->actor.shape.rot.y -= 0xC8; @@ -1122,7 +1122,7 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { bodyDecayLevel = 10; if (this->timers[0] == 150) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT); } @@ -1135,17 +1135,17 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { camera->eye = this->cameraEye; camera->eyeNext = this->cameraEye; camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->deathCamera, 0); + func_800C08AC(play, this->deathCamera, 0); this->deathCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, GND_BOSSROOM_CENTER_X, + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z + 200.0f, 0, 0, 0, 0); this->actor.child = &horse->actor; this->killActor = true; horse->killActor = true; - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); - Flags_SetSwitch(globalCtx, 0x22); + Flags_SetClear(play, play->roomCtx.curRoom.num); + Flags_SetSwitch(play, 0x22); } break; } @@ -1162,14 +1162,14 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { vel.z = this->actor.world.pos.z - this->actor.prevPos.z; if (bodyDecayLevel < 10) { if (this->work[GND_DEATH_ENV_TIMER] == 0) { - if (globalCtx->envCtx.unk_BF == 0) { - globalCtx->envCtx.unk_BF = 3; + if (play->envCtx.unk_BF == 0) { + play->envCtx.unk_BF = 3; this->work[GND_DEATH_ENV_TIMER] = (s16)Rand_ZeroFloat(5.0f) + 4.0f; - globalCtx->envCtx.unk_D6 = 0x28; + play->envCtx.unk_D6 = 0x28; } else { - globalCtx->envCtx.unk_BF = 0; + play->envCtx.unk_BF = 0; this->work[GND_DEATH_ENV_TIMER] = (s16)Rand_ZeroFloat(2.0f) + 2.0f; - globalCtx->envCtx.unk_D6 = 0x14; + play->envCtx.unk_D6 = 0x14; } } else { this->work[GND_DEATH_ENV_TIMER]--; @@ -1193,16 +1193,16 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { accelHahen.z = (GND_BOSSROOM_CENTER_Z - pos.z) * 0.001f; } - EffectSsKFire_Spawn(globalCtx, &pos, &vel, &accelKFire, (s16)Rand_ZeroFloat(20.0f) + 15, + EffectSsKFire_Spawn(play, &pos, &vel, &accelKFire, (s16)Rand_ZeroFloat(20.0f) + 15, bodyDecayLevel); if ((Rand_ZeroOne() < 0.5f) || (bodyDecayLevel == 3)) { - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accelHahen, 0, (s16)Rand_ZeroFloat(4.0f) + 7, + EffectSsHahen_Spawn(play, &pos, &vel, &accelHahen, 0, (s16)Rand_ZeroFloat(4.0f) + 7, HAHEN_OBJECT_DEFAULT, 10, NULL); } } } else { - globalCtx->envCtx.unk_BF = 0; - globalCtx->envCtx.unk_D6 = 0x14; + play->envCtx.unk_BF = 0; + play->envCtx.unk_D6 = 0x14; } this->work[GND_BODY_DECAY_FLAG] = true; @@ -1238,11 +1238,11 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, this->cameraAccel); } - Gameplay_CameraSetAtEye(globalCtx, this->deathCamera, &this->cameraAt, &this->cameraEye); + Play_CameraSetAtEye(play, this->deathCamera, &this->cameraAt, &this->cameraEye); } } -void BossGanondrof_CollisionCheck(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_CollisionCheck(BossGanondrof* this, PlayState* play) { s32 acHit; EnfHG* horse = (EnfHG*)this->actor.child; ColliderInfo* hurtbox; @@ -1278,12 +1278,12 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, GlobalContext* globalCtx) } if ((s8)this->actor.colChkInfo.health <= 0) { - BossGanondrof_SetupDeath(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossGanondrof_SetupDeath(this, play); + Enemy_StartFinishingBlow(play, &this->actor); return; } } - BossGanondrof_SetupStunned(this, globalCtx); + BossGanondrof_SetupStunned(this, play); if (this->returnCount >= 2) { this->timers[0] = 120; } @@ -1304,7 +1304,7 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, GlobalContext* globalCtx) } } -void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Update(Actor* thisx, PlayState* play) { f32 cs; f32 sn; f32 legRotTargetY; @@ -1327,7 +1327,7 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { horse = (EnfHG*)this->actor.child; osSyncPrintf("MOVE START EEEEEEEEEEEEEEEEEEEEEE%d\n", this->actor.params); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i]) { @@ -1342,24 +1342,24 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != BossGanondrof_Death) { - BossGanondrof_CollisionCheck(this, globalCtx); + BossGanondrof_CollisionCheck(this, play); } osSyncPrintf("MOVE END\n"); BossGanondrof_SetColliderPos(&this->targetPos, &this->colliderBody); BossGanondrof_SetColliderPos(&this->spearTip, &this->colliderSpear); if ((this->flyMode == GND_FLY_PAINTING) && !horse->bossGndInPainting) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } if ((this->actionFunc == BossGanondrof_Stunned) && (this->timers[0] > 1)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); } else if (this->actionFunc == BossGanondrof_Block) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } else if (this->actionFunc == BossGanondrof_Charge) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSpear.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSpear.base); } this->actor.focus.pos = this->targetPos; @@ -1385,7 +1385,7 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("F 1\n"); for (j = 0; j < 7; j++) { osSyncPrintf("F 15\n"); - EffectSsFhgFlash_SpawnShock(globalCtx, &this->actor, &this->actor.world.pos, 45, FHGFLASH_SHOCK_PG); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &this->actor.world.pos, 45, FHGFLASH_SHOCK_PG); } osSyncPrintf("F 2\n"); } @@ -1396,7 +1396,7 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 BossGanondrof_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossGanondrof_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossGanondrof* this = (BossGanondrof*)thisx; @@ -1466,7 +1466,7 @@ s32 BossGanondrof_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return 0; } -void BossGanondrof_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanondrof_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Vec3f spearVec = { 0.0f, 0.0f, 6000.0f }; @@ -1503,12 +1503,12 @@ Gfx* BossGanondrof_GetNullDList(GraphicsContext* gfxCtx) { return dList; } -void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Draw(Actor* thisx, PlayState* play) { s32 pad; BossGanondrof* this = (BossGanondrof*)thisx; EnfHG* horse; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->work[GND_BODY_DECAY_FLAG]) { for (int i = 0; i < 5; i++) { @@ -1536,7 +1536,7 @@ void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { } osSyncPrintf("YP %f\n", this->actor.world.pos.y); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->work[GND_INVINC_TIMER] & 4) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099); } else { @@ -1550,15 +1550,15 @@ void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->fwork[GND_EYE_BRIGHTNESS], (s16)this->fwork[GND_EYE_BRIGHTNESS], (s16)this->fwork[GND_EYE_BRIGHTNESS], (s16)this->fwork[GND_EYE_ALPHA]); if (this->work[GND_BODY_DECAY_FLAG]) { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetClearPixelDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetClearPixelDList(play->state.gfxCtx)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetNullDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetNullDList(play->state.gfxCtx)); } - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, BossGanondrof_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossGanondrof_OverrideLimbDraw, BossGanondrof_PostLimbDraw, this); osSyncPrintf("DRAW 22\n"); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + CLOSE_DISPS(play->state.gfxCtx); osSyncPrintf("DRAW END %d\n", this->actor.params); } diff --git a/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h b/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h index 8b0616bac..2dad6b343 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h +++ b/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h @@ -6,7 +6,7 @@ struct BossGanondrof; -typedef void (*BossGanondrofActionFunc)(struct BossGanondrof*, GlobalContext*); +typedef void (*BossGanondrofActionFunc)(struct BossGanondrof*, PlayState*); #define GND_REAL_BOSS 1 #define GND_FAKE_BOSS 10 diff --git a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 35467edd2..5bafed742 100644 --- a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -23,31 +23,31 @@ typedef enum { VISUALSTATE_HIT // main: greenish cyan, alternates with red; eye: greenish cyan } GohmaVisualState; -void BossGoma_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGoma_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGoma_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGoma_Init(Actor* thisx, PlayState* play); +void BossGoma_Destroy(Actor* thisx, PlayState* play); +void BossGoma_Update(Actor* thisx, PlayState* play); +void BossGoma_Draw(Actor* thisx, PlayState* play); -void BossGoma_SetupEncounter(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorAttackPosture(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorPrepareAttack(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorDamaged(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorLandStruckDown(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorLand(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FallJump(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorIdle(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingIdle(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_WallClimb(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingMoveToCenter(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_SpawnChildGohma(BossGoma* this, GlobalContext* globalCtx, s16 i); +void BossGoma_SetupEncounter(BossGoma* this, PlayState* play); +void BossGoma_Encounter(BossGoma* this, PlayState* play); +void BossGoma_Defeated(BossGoma* this, PlayState* play); +void BossGoma_FloorAttackPosture(BossGoma* this, PlayState* play); +void BossGoma_FloorPrepareAttack(BossGoma* this, PlayState* play); +void BossGoma_FloorAttack(BossGoma* this, PlayState* play); +void BossGoma_FloorDamaged(BossGoma* this, PlayState* play); +void BossGoma_FloorLandStruckDown(BossGoma* this, PlayState* play); +void BossGoma_FloorLand(BossGoma* this, PlayState* play); +void BossGoma_FloorStunned(BossGoma* this, PlayState* play); +void BossGoma_FallJump(BossGoma* this, PlayState* play); +void BossGoma_FallStruckDown(BossGoma* this, PlayState* play); +void BossGoma_CeilingSpawnGohmas(BossGoma* this, PlayState* play); +void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, PlayState* play); +void BossGoma_FloorIdle(BossGoma* this, PlayState* play); +void BossGoma_CeilingIdle(BossGoma* this, PlayState* play); +void BossGoma_FloorMain(BossGoma* this, PlayState* play); +void BossGoma_WallClimb(BossGoma* this, PlayState* play); +void BossGoma_CeilingMoveToCenter(BossGoma* this, PlayState* play); +void BossGoma_SpawnChildGohma(BossGoma* this, PlayState* play, s16 i); const ActorInit Boss_Goma_InitVars = { ACTOR_BOSS_GOMA, @@ -338,13 +338,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -void BossGoma_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Init(Actor* thisx, PlayState* play) { s32 pad; BossGoma* this = (BossGoma*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 4000.0f, ActorShadow_DrawCircle, 150.0f); - SkelAnime_Init(globalCtx, &this->skelanime, &gGohmaSkel, &gGohmaIdleCrouchedAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelanime, &gGohmaSkel, &gGohmaIdleCrouchedAnim, NULL, NULL, 0); Animation_PlayLoop(&this->skelanime, &gGohmaIdleCrouchedAnim); this->actor.shape.rot.x = -0x8000; // upside-down this->eyeIrisScaleX = 1.0f; @@ -353,28 +353,28 @@ void BossGoma_Init(Actor* thisx, GlobalContext* globalCtx) { this->unusedInitZ = this->actor.world.pos.z; this->actor.world.pos.y = -300.0f; // ceiling this->actor.gravity = 0.0f; - BossGoma_SetupEncounter(this, globalCtx); + BossGoma_SetupEncounter(this, play); this->actor.colChkInfo.health = 10; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, -640.0f, 0.0f, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, -640.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_CHILD); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 141.0f, -640.0f, -84.0f, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 141.0f, -640.0f, -84.0f, 0, 0, 0, 0); } } -void BossGoma_PlayEffectsAndSfx(BossGoma* this, GlobalContext* globalCtx, s16 arg2, s16 amountMinus1) { +void BossGoma_PlayEffectsAndSfx(BossGoma* this, PlayState* play, s16 arg2, s16 amountMinus1) { if (arg2 == 0 || arg2 == 1 || arg2 == 3) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, 500, 10, true); } if (arg2 == 0 || arg2 == 2 || arg2 == 3) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, 500, 10, true); } @@ -385,17 +385,17 @@ void BossGoma_PlayEffectsAndSfx(BossGoma* this, GlobalContext* globalCtx, s16 ar } } -void BossGoma_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Destroy(Actor* thisx, PlayState* play) { BossGoma* this = (BossGoma*)thisx; - SkelAnime_Free(&this->skelanime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelanime, play); + Collider_DestroyJntSph(play, &this->collider); } /** * When Gohma is hit and its health drops to 0 */ -void BossGoma_SetupDefeated(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_SetupDefeated(BossGoma* this, PlayState* play) { Animation_Change(&this->skelanime, &gGohmaDeathAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGohmaDeathAnim), ANIMMODE_ONCE, -2.0f); this->actionFunc = BossGoma_Defeated; @@ -414,15 +414,15 @@ void BossGoma_SetupDefeated(BossGoma* this, GlobalContext* globalCtx) { /** * Initial action setup, with Gohma waiting on the ceiling for the fight to start. */ -void BossGoma_SetupEncounter(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_SetupEncounter(BossGoma* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gGohmaWalkAnim); Animation_Change(&this->skelanime, &gGohmaWalkAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP, -15.0f); this->actionFunc = BossGoma_Encounter; this->actionState = 0; this->disableGameplayLogic = true; - globalCtx->envCtx.unk_BF = 4; - globalCtx->envCtx.unk_D6 = 0xFF; + play->envCtx.unk_BF = 4; + play->envCtx.unk_D6 = 0xFF; } /** @@ -582,7 +582,7 @@ void BossGoma_SetupFloorDamaged(BossGoma* this) { this->actionFunc = BossGoma_FloorDamaged; } -void BossGoma_UpdateCeilingMovement(BossGoma* this, GlobalContext* globalCtx, f32 dz, f32 targetSpeedXZ, +void BossGoma_UpdateCeilingMovement(BossGoma* this, PlayState* play, f32 dz, f32 targetSpeedXZ, s16 rotateTowardsCenter) { static Vec3f velInit = { 0.0f, 0.0f, 0.0f }; static Vec3f accelInit = { 0.0f, -0.5f, 0.0f }; @@ -615,25 +615,25 @@ void BossGoma_UpdateCeilingMovement(BossGoma* this, GlobalContext* globalCtx, f3 pos.x = Rand_CenteredFloat(70.0f) + basePos->x; pos.y = Rand_ZeroFloat(30.0f) + basePos->y; pos.z = Rand_CenteredFloat(70.0f) + basePos->z; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, NULL); + EffectSsHahen_Spawn(play, &pos, &vel, &accel, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, NULL); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_HIGH); } } -void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_SetupEncounterState4(BossGoma* this, PlayState* play) { Player* player; Camera* camera; - camera = Gameplay_GetCamera(globalCtx, 0); - player = GET_PLAYER(globalCtx); + camera = Play_GetCamera(play, 0); + player = GET_PLAYER(play); this->actionState = 4; this->actor.flags |= ACTOR_FLAG_0; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->subCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); - Gameplay_ChangeCameraStatus(globalCtx, this->subCameraId, 7); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->subCameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, 0, 3); + Play_ChangeCameraStatus(play, this->subCameraId, 7); Animation_Change(&this->skelanime, &gGohmaEyeRollAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGohmaEyeRollAnim), ANIMMODE_ONCE, 0.0f); this->currentAnimFrameCount = Animation_GetLastFrame(&gGohmaEyeRollAnim); @@ -647,7 +647,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { player->actor.world.pos.z = 300.0f; player->actor.world.rot.y = player->actor.shape.rot.y = -0x705C; - this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000; + this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) + 0x8000; // room entrance, closer to room center this->subCameraEye.x = 90.0f; @@ -670,9 +670,9 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { * * Skips the door and look-at-Gohma puzzle if the player already reached the boss card part before */ -void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_Encounter(BossGoma* this, PlayState* play) { Camera* cam; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad[2]; Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); @@ -683,22 +683,22 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { if (fabsf(player->actor.world.pos.x - 150.0f) < 60.0f && fabsf(player->actor.world.pos.z - 350.0f) < 60.0f) { if (gSaveContext.eventChkInf[7] & 1) { - BossGoma_SetupEncounterState4(this, globalCtx); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, 164.72f, + BossGoma_SetupEncounterState4(this, play); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, 397.68002f, 0, -0x705C, 0, 0x180); } else { - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); this->actionState = 1; } } break; case 1: // player entered the room - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCameraId = Gameplay_CreateSubCamera(globalCtx); + func_80064520(play, &play->csCtx); + this->subCameraId = Play_CreateSubCamera(play); osSyncPrintf("MAKE CAMERA !!! 1 !!!!!!!!!!!!!!!!!!!!!!!!!!\n"); - Gameplay_ChangeCameraStatus(globalCtx, 0, 1); - Gameplay_ChangeCameraStatus(globalCtx, this->subCameraId, 7); + Play_ChangeCameraStatus(play, 0, 1); + Play_ChangeCameraStatus(play, this->subCameraId, 7); this->actionState = 2; // ceiling center this->actor.world.pos.x = -150.0f; @@ -745,31 +745,31 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->subCameraAt.z = player->actor.world.pos.z; } - Gameplay_CameraSetAtEye(globalCtx, 0, &this->subCameraAt, &this->subCameraEye); + Play_CameraSetAtEye(play, 0, &this->subCameraAt, &this->subCameraEye); if (this->frameCount == 176) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, 397.68002f, 0, -0x705C, 0, SHUTTER_GOHMA_BLOCK << 6); } if (this->frameCount == 176) { - globalCtx->envCtx.unk_BF = 3; - globalCtx->envCtx.unk_D6 = 0xFFFF; + play->envCtx.unk_BF = 3; + play->envCtx.unk_D6 = 0xFFFF; } if (this->frameCount == 190) { - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); } if (this->frameCount >= 228) { - cam = Gameplay_GetCamera(globalCtx, 0); + cam = Play_GetCamera(play, 0); cam->eye = this->subCameraEye; cam->eyeNext = this->subCameraEye; cam->at = this->subCameraAt; - func_800C08AC(globalCtx, this->subCameraId, 0); + func_800C08AC(play, this->subCameraId, 0); this->subCameraId = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->actionState = 3; } break; @@ -780,16 +780,16 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->lookedAtFrames++; Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000, 2, + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) + 0x8000, 2, 0xBB8); this->eyeLidBottomRotX = this->eyeLidTopRotX = this->eyeIrisRotX = this->eyeIrisRotY = 0; } else { this->lookedAtFrames = 0; - BossGoma_UpdateCeilingMovement(this, globalCtx, 0.0f, -5.0f, true); + BossGoma_UpdateCeilingMovement(this, play, 0.0f, -5.0f, true); } if (this->lookedAtFrames > 15) { - BossGoma_SetupEncounterState4(this, globalCtx); + BossGoma_SetupEncounterState4(this, play); } break; @@ -808,7 +808,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCameraAt.z, this->actor.world.pos.z, 0.2f, 100.0f); if (this->framesUntilNextAction == 30) { - globalCtx->envCtx.unk_BF = 4; + play->envCtx.unk_BF = 4; } if (this->framesUntilNextAction < 20) { @@ -849,7 +849,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 2.0f); } else { - BossGoma_UpdateCeilingMovement(this, globalCtx, 0.0f, -7.5f, false); + BossGoma_UpdateCeilingMovement(this, play, 0.0f, -7.5f, false); } if (this->framesUntilNextAction == 0) { @@ -882,7 +882,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 2, 0x7D0); if (this->actor.bgCheckFlags & 1) { this->actionState = 130; @@ -890,7 +890,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Animation_Change(&this->skelanime, &gGohmaInitialLandingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGohmaInitialLandingAnim), ANIMMODE_ONCE, -2.0f); this->currentAnimFrameCount = Animation_GetLastFrame(&gGohmaInitialLandingAnim); - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 5); + BossGoma_PlayEffectsAndSfx(this, play, 0, 5); this->framesUntilNextAction = 15; func_800A9F6C(0.0f, 0xC8, 0x14, 0x14); } @@ -905,7 +905,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->subCameraFollowSpeed * 30.0f); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 2, 0x7D0); SkelAnime_Update(&this->skelanime); this->subCameraAt.x = this->actor.world.pos.x; this->subCameraAt.z = this->actor.world.pos.z; @@ -922,7 +922,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_CRY1); if (!(gSaveContext.eventChkInf[7] & 1)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGohmaTitleCardTex), 160, 180, 128, 40, true); } @@ -945,7 +945,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { if (this->framesUntilNextAction == 0) { this->framesUntilNextAction = 30; this->actionState = 150; - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); + Play_ChangeCameraStatus(play, 0, 3); } break; @@ -956,23 +956,23 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->subCameraEye.z, this->actor.world.pos.z + 220.0f, 0.2f, 100.0f, 0.1f); if (this->framesUntilNextAction == 0) { - cam = Gameplay_GetCamera(globalCtx, 0); + cam = Play_GetCamera(play, 0); cam->eye = this->subCameraEye; cam->eyeNext = this->subCameraEye; cam->at = this->subCameraAt; - func_800C08AC(globalCtx, this->subCameraId, 0); + func_800C08AC(play, this->subCameraId, 0); this->subCameraId = 0; BossGoma_SetupFloorMain(this); this->disableGameplayLogic = false; this->patienceTimer = 200; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); } break; } if (this->subCameraId != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->subCameraId, &this->subCameraAt, &this->subCameraEye); + Play_CameraSetAtEye(play, this->subCameraId, &this->subCameraAt, &this->subCameraEye); } } @@ -980,7 +980,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { * Handles the "Gohma defeated" cutscene and effects * Spawns the heart container and blue warp actors */ -void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_Defeated(BossGoma* this, PlayState* play) { static Vec3f roomCenter = { -150.0f, 0.0f, -350.0f }; f32 dx; f32 dz; @@ -993,7 +993,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { Vec3f accel2 = { 0.0f, -0.5f, 0.0f }; Vec3f pos; Camera* camera; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f childPos; s16 i; @@ -1001,7 +1001,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); if (Animation_OnFrame(&this->skelanime, 107.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); + BossGoma_PlayEffectsAndSfx(this, play, 0, 8); func_800A9F6C(0.0f, 0x96, 0x14, 0x14); } @@ -1018,7 +1018,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->framesUntilNextAction < 1200 && this->framesUntilNextAction > 1100 && this->framesUntilNextAction % 8 == 0) { - EffectSsSibuki_SpawnBurst(globalCtx, &this->actor.focus.pos); + EffectSsSibuki_SpawnBurst(play, &this->actor.focus.pos); } if (this->framesUntilNextAction < 1080 && this->actionState < 3) { @@ -1035,7 +1035,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].x; pos.y = Rand_CenteredFloat(10.0f) + this->defeatedLimbPositions[j].y; pos.z = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].z; - func_8002836C(globalCtx, &pos, &vel1, &accel1, &color1, &color2, 500, 10, 10); + func_8002836C(play, &pos, &vel1, &accel1, &color1, &color2, 500, 10, 10); } } @@ -1046,7 +1046,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].x; pos.y = Rand_CenteredFloat(10.0f) + this->defeatedLimbPositions[j].y; pos.z = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].z; - EffectSsHahen_Spawn(globalCtx, &pos, &vel2, &accel2, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, + EffectSsHahen_Spawn(play, &pos, &vel2, &accel2, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, NULL); } } @@ -1055,12 +1055,12 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { switch (this->actionState) { case 0: this->actionState = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->subCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); - Gameplay_ChangeCameraStatus(globalCtx, this->subCameraId, 7); - camera = Gameplay_GetCamera(globalCtx, 0); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->subCameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, 0, 3); + Play_ChangeCameraStatus(play, this->subCameraId, 7); + camera = Play_GetCamera(play, 0); this->subCameraEye.x = camera->eye.x; this->subCameraEye.y = camera->eye.y; this->subCameraEye.z = camera->eye.z; @@ -1116,17 +1116,17 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->actionState = 2; - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); + Play_ChangeCameraStatus(play, 0, 3); this->timer = 70; this->decayingProgress = 0; this->subCameraFollowSpeed = 0.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } break; case 2: - camera = Gameplay_GetCamera(globalCtx, 0); + camera = Play_GetCamera(play, 0); Math_SmoothStepToF(&this->subCameraEye.x, camera->eye.x, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); Math_SmoothStepToF(&this->subCameraEye.y, camera->eye.y, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); Math_SmoothStepToF(&this->subCameraEye.z, camera->eye.z, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); @@ -1152,9 +1152,9 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { } } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, childPos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, childPos.x, this->actor.world.pos.y, childPos.z, 0, 0, 0, WARP_DUNGEON_CHILD); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } for (i = 0; i < 4; i++) { @@ -1177,14 +1177,14 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->timer == 0) { if (Math_SmoothStepToF(&this->actor.scale.y, 0, 1.0f, 0.00075f, 0.0f) <= 0.001f) { - camera = Gameplay_GetCamera(globalCtx, 0); + camera = Play_GetCamera(play, 0); camera->eye = this->subCameraEye; camera->eyeNext = this->subCameraEye; camera->at = this->subCameraAt; - func_800C08AC(globalCtx, this->subCameraId, 0); + func_800C08AC(play, this->subCameraId, 0); this->subCameraId = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); Actor_Kill(&this->actor); } @@ -1194,74 +1194,74 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { } if (this->subCameraId != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->subCameraId, &this->subCameraAt, &this->subCameraEye); + Play_CameraSetAtEye(play, this->subCameraId, &this->subCameraAt, &this->subCameraEye); } if (this->blinkTimer != 0) { this->blinkTimer--; - globalCtx->envCtx.adjAmbientColor[0] += 40; - globalCtx->envCtx.adjAmbientColor[1] += 40; - globalCtx->envCtx.adjAmbientColor[2] += 80; - globalCtx->envCtx.adjFogColor[0] += 10; - globalCtx->envCtx.adjFogColor[1] += 10; - globalCtx->envCtx.adjFogColor[2] += 20; + play->envCtx.adjAmbientColor[0] += 40; + play->envCtx.adjAmbientColor[1] += 40; + play->envCtx.adjAmbientColor[2] += 80; + play->envCtx.adjFogColor[0] += 10; + play->envCtx.adjFogColor[1] += 10; + play->envCtx.adjFogColor[2] += 20; } else { - globalCtx->envCtx.adjAmbientColor[0] -= 20; - globalCtx->envCtx.adjAmbientColor[1] -= 20; - globalCtx->envCtx.adjAmbientColor[2] -= 40; - globalCtx->envCtx.adjFogColor[0] -= 5; - globalCtx->envCtx.adjFogColor[1] -= 5; - globalCtx->envCtx.adjFogColor[2] -= 10; + play->envCtx.adjAmbientColor[0] -= 20; + play->envCtx.adjAmbientColor[1] -= 20; + play->envCtx.adjAmbientColor[2] -= 40; + play->envCtx.adjFogColor[0] -= 5; + play->envCtx.adjFogColor[1] -= 5; + play->envCtx.adjFogColor[2] -= 10; } - if (globalCtx->envCtx.adjAmbientColor[0] > 200) { - globalCtx->envCtx.adjAmbientColor[0] = 200; + if (play->envCtx.adjAmbientColor[0] > 200) { + play->envCtx.adjAmbientColor[0] = 200; } - if (globalCtx->envCtx.adjAmbientColor[1] > 200) { - globalCtx->envCtx.adjAmbientColor[1] = 200; + if (play->envCtx.adjAmbientColor[1] > 200) { + play->envCtx.adjAmbientColor[1] = 200; } - if (globalCtx->envCtx.adjAmbientColor[2] > 200) { - globalCtx->envCtx.adjAmbientColor[2] = 200; + if (play->envCtx.adjAmbientColor[2] > 200) { + play->envCtx.adjAmbientColor[2] = 200; } - if (globalCtx->envCtx.adjFogColor[0] > 70) { - globalCtx->envCtx.adjFogColor[0] = 70; + if (play->envCtx.adjFogColor[0] > 70) { + play->envCtx.adjFogColor[0] = 70; } - if (globalCtx->envCtx.adjFogColor[1] > 70) { - globalCtx->envCtx.adjFogColor[1] = 70; + if (play->envCtx.adjFogColor[1] > 70) { + play->envCtx.adjFogColor[1] = 70; } - if (globalCtx->envCtx.adjFogColor[2] > 140) { - globalCtx->envCtx.adjFogColor[2] = 140; + if (play->envCtx.adjFogColor[2] > 140) { + play->envCtx.adjFogColor[2] = 140; } - if (globalCtx->envCtx.adjAmbientColor[0] < 0) { - globalCtx->envCtx.adjAmbientColor[0] = 0; + if (play->envCtx.adjAmbientColor[0] < 0) { + play->envCtx.adjAmbientColor[0] = 0; } - if (globalCtx->envCtx.adjAmbientColor[1] < 0) { - globalCtx->envCtx.adjAmbientColor[1] = 0; + if (play->envCtx.adjAmbientColor[1] < 0) { + play->envCtx.adjAmbientColor[1] = 0; } - if (globalCtx->envCtx.adjAmbientColor[2] < 0) { - globalCtx->envCtx.adjAmbientColor[2] = 0; + if (play->envCtx.adjAmbientColor[2] < 0) { + play->envCtx.adjAmbientColor[2] = 0; } - if (globalCtx->envCtx.adjFogColor[0] < 0) { - globalCtx->envCtx.adjFogColor[0] = 0; + if (play->envCtx.adjFogColor[0] < 0) { + play->envCtx.adjFogColor[0] = 0; } - if (globalCtx->envCtx.adjFogColor[1] < 0) { - globalCtx->envCtx.adjFogColor[1] = 0; + if (play->envCtx.adjFogColor[1] < 0) { + play->envCtx.adjFogColor[1] = 0; } - if (globalCtx->envCtx.adjFogColor[2] < 0) { - globalCtx->envCtx.adjFogColor[2] = 0; + if (play->envCtx.adjFogColor[2] < 0) { + play->envCtx.adjFogColor[2] = 0; } } /** * If the player backs off, cancel the attack, or attack. */ -void BossGoma_FloorAttackPosture(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorAttackPosture(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); if (this->skelanime.curFrame >= (19.0f + 1.0f / 3.0f) && this->skelanime.curFrame <= 30.0f) { - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 3, 0xBB8); } @@ -1280,7 +1280,7 @@ void BossGoma_FloorAttackPosture(BossGoma* this, GlobalContext* globalCtx) { /** * Only lasts 1 frame. Plays a sound. */ -void BossGoma_FloorPrepareAttack(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorPrepareAttack(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->framesUntilNextAction == 0) { @@ -1295,7 +1295,7 @@ void BossGoma_FloorPrepareAttack(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma attacks, then the action eventually goes back to BossGoma_FloorMain */ -void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorAttack(BossGoma* this, PlayState* play) { s16 i; this->actor.flags |= ACTOR_FLAG_24; @@ -1311,8 +1311,8 @@ void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelanime, 10.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 3, 5); - func_80033E88(&this->actor, globalCtx, 5, 15); + BossGoma_PlayEffectsAndSfx(this, play, 3, 5); + func_80033E88(&this->actor, play, 5, 15); } if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaAttackAnim))) { @@ -1352,7 +1352,7 @@ void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx) { /** * Plays the animation to its end, then goes back to BossGoma_FloorStunned */ -void BossGoma_FloorDamaged(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorDamaged(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaDamageAnim))) { @@ -1370,7 +1370,7 @@ void BossGoma_FloorDamaged(BossGoma* this, GlobalContext* globalCtx) { * Sets patience to 0 * Gohma is then stunned (BossGoma_FloorStunned) */ -void BossGoma_FloorLandStruckDown(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorLandStruckDown(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, this->currentAnimFrameCount)) { @@ -1380,14 +1380,14 @@ void BossGoma_FloorLandStruckDown(BossGoma* this, GlobalContext* globalCtx) { this->framesUntilNextAction = 150; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); } /** * Gohma is back on the floor after the player has killed its children Gohmas. * Plays an animation then goes to usual floor behavior, with refilled patience. */ -void BossGoma_FloorLand(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorLand(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, this->currentAnimFrameCount)) { @@ -1399,14 +1399,14 @@ void BossGoma_FloorLand(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma is stunned and vulnerable. It can only be damaged during this action. */ -void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorStunned(BossGoma* this, PlayState* play) { if (this->sfxFaintTimer <= 90) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_FAINT - 0x800); } SkelAnime_Update(&this->skelanime); if (this->timer == 1) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); } Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); @@ -1427,34 +1427,34 @@ void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma goes back to the floor after the player killed the three gohmas it spawned */ -void BossGoma_FallJump(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FallJump(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 2, 0x7D0); if (this->actor.bgCheckFlags & 1) { BossGoma_SetupFloorLand(this); this->actor.velocity.y = 0.0f; - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); - func_80033E88(&this->actor, globalCtx, 5, 0xF); + BossGoma_PlayEffectsAndSfx(this, play, 0, 8); + func_80033E88(&this->actor, play, 5, 0xF); } } /** * Gohma falls to the floor after the player hit it */ -void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FallStruckDown(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 3, + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 3, 0x7D0); if (this->actor.bgCheckFlags & 1) { BossGoma_SetupFloorLandStruckDown(this); this->actor.velocity.y = 0.0f; - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); - func_80033E88(&this->actor, globalCtx, 0xA, 0xF); + BossGoma_PlayEffectsAndSfx(this, play, 0, 8); + func_80033E88(&this->actor, play, 0xA, 0xF); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_DAM1); } } @@ -1462,7 +1462,7 @@ void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx) { /** * Spawn three gohmas, one after the other. Cannot be interrupted */ -void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingSpawnGohmas(BossGoma* this, PlayState* play) { s16 i; SkelAnime_Update(&this->skelanime); @@ -1496,7 +1496,7 @@ void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { if (this->tailLimbsScaleTimers[0] == 2) { for (i = 0; i < ARRAY_COUNT(this->childrenGohmaState); i++) { if (this->childrenGohmaState[i] == 0) { - BossGoma_SpawnChildGohma(this, globalCtx, i); + BossGoma_SpawnChildGohma(this, play, i); break; } } @@ -1517,7 +1517,7 @@ void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { * Prepare to spawn children gohmas, red eye for 70 frames * During this time, the player can interrupt by hitting Gohma and make it fall from the ceiling */ -void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->framesUntilNextAction == 0) { @@ -1531,7 +1531,7 @@ void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, GlobalContext* globalCtx /** * On the floor, not doing anything special. */ -void BossGoma_FloorIdle(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorIdle(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); @@ -1546,7 +1546,7 @@ void BossGoma_FloorIdle(BossGoma* this, GlobalContext* globalCtx) { * Eventually spawns children gohmas, jumping down to the floor when they are killed, or staying on the ceiling as long * as any is still alive. */ -void BossGoma_CeilingIdle(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingIdle(BossGoma* this, PlayState* play) { s16 i; SkelAnime_Update(&this->skelanime); @@ -1581,7 +1581,7 @@ void BossGoma_CeilingIdle(BossGoma* this, GlobalContext* globalCtx) { * Gohma climbs any wall it collides with * Uses the "walk cautiously" animation */ -void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorMain(BossGoma* this, PlayState* play) { s16 rot; SkelAnime_Update(&this->skelanime); @@ -1597,9 +1597,9 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelanime, 15.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 1, 3); + BossGoma_PlayEffectsAndSfx(this, play, 1, 3); } else if (Animation_OnFrame(&this->skelanime, 30.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 2, 3); + BossGoma_PlayEffectsAndSfx(this, play, 2, 3); } if (this->frameCount % 64 == 0) { @@ -1607,7 +1607,7 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { } if (!this->doNotMoveThisFrame) { - rot = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + rot = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); if (this->patienceTimer != 0) { this->patienceTimer--; @@ -1653,7 +1653,7 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma moves up until it reaches the ceiling */ -void BossGoma_WallClimb(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_WallClimb(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->frameCount % 8 == 0) { @@ -1675,11 +1675,11 @@ void BossGoma_WallClimb(BossGoma* this, GlobalContext* globalCtx) { /** * Goes to BossGoma_CeilingIdle after enough time and after being close enough to the center of the ceiling. */ -void BossGoma_CeilingMoveToCenter(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingMoveToCenter(BossGoma* this, PlayState* play) { s16 angle; s16 absDiff; - BossGoma_UpdateCeilingMovement(this, globalCtx, 0.0f, -5.0f, true); + BossGoma_UpdateCeilingMovement(this, play, 0.0f, -5.0f, true); if (this->frameCount % 64 == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_CRY2); @@ -1716,12 +1716,12 @@ void BossGoma_CeilingMoveToCenter(BossGoma* this, GlobalContext* globalCtx) { * - look at the player (iris rotation) * - iris scale, when menacing or damaged */ -void BossGoma_UpdateEye(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_UpdateEye(BossGoma* this, PlayState* play) { s16 targetEyeIrisRotX; s16 targetEyeIrisRotY; if (!this->disableGameplayLogic) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->eyeState == EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES) { // player + 0xA73 seems to be related to "throwing something" @@ -1752,9 +1752,9 @@ void BossGoma_UpdateEye(BossGoma* this, GlobalContext* globalCtx) { if (this->eyeState != EYESTATE_IRIS_NO_FOLLOW_NO_IFRAMES) { targetEyeIrisRotY = - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.y; + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.y; targetEyeIrisRotX = - Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.x; + Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.x; if (this->actor.shape.rot.x > 0x4000 || this->actor.shape.rot.x < -0x4000) { targetEyeIrisRotY = -(s16)(targetEyeIrisRotY + 0x8000); @@ -1806,7 +1806,7 @@ void BossGoma_UpdateTailLimbsScale(BossGoma* this) { } } -void BossGoma_UpdateHit(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_UpdateHit(BossGoma* this, PlayState* play) { if (this->invincibilityFrames != 0) { this->invincibilityFrames--; } else { @@ -1828,10 +1828,10 @@ void BossGoma_UpdateHit(BossGoma* this, GlobalContext* globalCtx) { if ((s8)this->actor.colChkInfo.health > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_DAM1); BossGoma_SetupFloorDamaged(this); - EffectSsSibuki_SpawnBurst(globalCtx, &this->actor.focus.pos); + EffectSsSibuki_SpawnBurst(play, &this->actor.focus.pos); } else { - BossGoma_SetupDefeated(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossGoma_SetupDefeated(this, play); + Enemy_StartFinishingBlow(play, &this->actor); } this->invincibilityFrames = 10; @@ -1850,7 +1850,7 @@ void BossGoma_UpdateHit(BossGoma* this, GlobalContext* globalCtx) { } this->timer = 4; - func_80033E88(&this->actor, globalCtx, 4, 0xC); + func_80033E88(&this->actor, play, 4, 0xC); } } } @@ -1898,7 +1898,7 @@ void BossGoma_UpdateEyeEnvColor(BossGoma* this) { Math_ApproachF(&this->eyeEnvColor[2], targetEyeEnvColors[this->visualState][2], 0.5f, 20.0f); } -void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Update(Actor* thisx, PlayState* play) { BossGoma* this = (BossGoma*)thisx; s32 pad; @@ -1918,7 +1918,7 @@ void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx) { } this->eyeState = EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; if (!this->doNotMoveThisFrame) { @@ -1928,34 +1928,34 @@ void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.world.pos.y < -400.0f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 80.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 80.0f, 5); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 30.0f, 80.0f, 1); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 80.0f, 1); } - BossGoma_UpdateEye(this, globalCtx); + BossGoma_UpdateEye(this, play); BossGoma_UpdateMainEnvColor(this); BossGoma_UpdateEyeEnvColor(this); BossGoma_UpdateTailLimbsScale(this); if (!this->disableGameplayLogic) { - BossGoma_UpdateHit(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + BossGoma_UpdateHit(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc != BossGoma_FloorStunned && this->actionFunc != BossGoma_FloorDamaged && (this->actionFunc != BossGoma_FloorMain || this->timer == 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossGoma_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossGoma* this = (BossGoma*)thisx; s32 doNotDrawLimb = false; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->mainEnvColor[0], (s16)this->mainEnvColor[1], (s16)this->mainEnvColor[2], @@ -2006,7 +2006,7 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi if (*dList != NULL) { Matrix_Push(); Matrix_Scale(this->eyeIrisScaleX, this->eyeIrisScaleY, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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(); @@ -2027,7 +2027,7 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Matrix_Scale(this->tailLimbsScale[limbIndex - BOSSGOMA_LIMB_TAIL4], this->tailLimbsScale[limbIndex - BOSSGOMA_LIMB_TAIL4], this->tailLimbsScale[limbIndex - BOSSGOMA_LIMB_TAIL4], MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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(); @@ -2037,12 +2037,12 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return doNotDrawLimb; } -void BossGoma_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f tailZero = { 0.0f, 0.0f, 0.0f }; static Vec3f clawBackLocalPos = { 0.0f, 0.0f, 0.0f }; static Vec3f focusEyeLocalPos = { 0.0f, 300.0f, 2650.0f }; // in the center of the surface of the lens @@ -2080,7 +2080,7 @@ void BossGoma_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Matrix_Get(&mtx); Matrix_MtxFToYXZRotS(&mtx, &childRot, 0); // These are the pieces of Gohma as it falls apart. It appears to use the same actor as the baby gohmas. - babyGohma = (EnGoma*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GOMA, + babyGohma = (EnGoma*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GOMA, childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, childRot.z, sDeadLimbLifetime[limbIndex] + 100); if (babyGohma != NULL) { @@ -2117,12 +2117,12 @@ Gfx* BossGoma_NoBackfaceCullingDlist(GraphicsContext* gfxCtx) { return dList; } -void BossGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Draw(Actor* thisx, PlayState* play) { BossGoma* this = (BossGoma*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(0.0f, -4000.0f, 0.0f, MTXMODE_APPLY); // Invalidate Texture Cache since Goma modifies her own texture @@ -2136,19 +2136,19 @@ void BossGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (this->noBackfaceCulling) { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_NoBackfaceCullingDlist(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_NoBackfaceCullingDlist(play->state.gfxCtx)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_EmptyDlist(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_EmptyDlist(play->state.gfxCtx)); } - SkelAnime_DrawOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, BossGoma_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, BossGoma_OverrideLimbDraw, BossGoma_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossGoma_SpawnChildGohma(BossGoma* this, GlobalContext* globalCtx, s16 i) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GOMA, this->lastTailLimbWorldPos.x, +void BossGoma_SpawnChildGohma(BossGoma* this, PlayState* play, s16 i) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GOMA, this->lastTailLimbWorldPos.x, this->lastTailLimbWorldPos.y - 50.0f, this->lastTailLimbWorldPos.z, 0, i * (0x10000 / 3), 0, i); this->childrenGohmaState[i] = 1; diff --git a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h index 22143f1c6..d3a28858c 100644 --- a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h +++ b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h @@ -6,7 +6,7 @@ struct BossGoma; -typedef void (*BossGomaActionFunc)(struct BossGoma*, GlobalContext*); +typedef void (*BossGomaActionFunc)(struct BossGoma*, PlayState*); typedef enum { /* 0 */ BOSSGOMA_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index a182d7efa..3df60d385 100644 --- a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -16,7 +16,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -#define MO_WATER_LEVEL(globalCtx) globalCtx->colCtx.colHeader->waterBoxes[0].ySurface +#define MO_WATER_LEVEL(play) play->colCtx.colHeader->waterBoxes[0].ySurface #define HAS_LINK(tent) \ ((tent != NULL) && \ @@ -47,19 +47,19 @@ typedef struct { #define MO_FX_STRETCH 1 #define MO_FX_MAX_SCALE 1 -void BossMo_Init(Actor* thisx, GlobalContext* globalCtx); -void BossMo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossMo_UpdateCore(Actor* thisx, GlobalContext* globalCtx); -void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx); -void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx); -void BossMo_DrawTent(Actor* thisx, GlobalContext* globalCtx); +void BossMo_Init(Actor* thisx, PlayState* play); +void BossMo_Destroy(Actor* thisx, PlayState* play); +void BossMo_UpdateCore(Actor* thisx, PlayState* play); +void BossMo_UpdateTent(Actor* thisx, PlayState* play); +void BossMo_DrawCore(Actor* thisx, PlayState* play); +void BossMo_DrawTent(Actor* thisx, PlayState* play); void BossMo_Reset(void); -void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx); -void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx); +void BossMo_UpdateEffects(BossMo* this, PlayState* play); +void BossMo_DrawEffects(BossMoEffect* effect, PlayState* play); -void BossMo_SetupTentacle(BossMo* this, GlobalContext* globalCtx); -void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx); +void BossMo_SetupTentacle(BossMo* this, PlayState* play); +void BossMo_Tentacle(BossMo* this, PlayState* play); void BossMo_Unknown(void); @@ -333,40 +333,40 @@ static f32 sDropletWidth[41] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }; // These are sqrt(9^2 - (i/2 - 9)^2), a sphere of radius 9. -void BossMo_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossMo_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossMo* this = (BossMo*)thisx; u16 i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); if (this->actor.params != BOSSMO_TENTACLE) { - Flags_SetSwitch(globalCtx, 0x14); + Flags_SetSwitch(play, 0x14); sMorphaCore = this; - MO_WATER_LEVEL(globalCtx) = this->waterLevel = MO_WATER_LEVEL(globalCtx); - globalCtx->roomCtx.unk_74[0] = 0xA0; - globalCtx->specialEffects = sEffects; + MO_WATER_LEVEL(play) = this->waterLevel = MO_WATER_LEVEL(play); + play->roomCtx.unk_74[0] = 0xA0; + play->specialEffects = sEffects; for (i = 0; i < ARRAY_COUNT(sEffects); i++) { sEffects[i].type = MO_FX_NONE; sEffects[i].epoch++; } this->actor.world.pos.x = 200.0f; - this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx) + 50.0f; + this->actor.world.pos.y = MO_WATER_LEVEL(play) + 50.0f; this->fwork[MO_TENT_SWING_SIZE_X] = 5.0f; this->drawActor = true; this->actor.colChkInfo.health = 20; this->actor.colChkInfo.mass = 0; this->actor.params = 0; Actor_SetScale(&this->actor, 0.01f); - Collider_InitCylinder(globalCtx, &this->coreCollider); - Collider_SetCylinder(globalCtx, &this->coreCollider, &this->actor, &sCylinderInit); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + Collider_InitCylinder(play, &this->coreCollider); + Collider_SetCylinder(play, &this->coreCollider, &this->actor, &sCylinderInit); + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, -280.0f, 0.0f, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, -280.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -200.0f, -280.0f, 0.0f, 0, 0, 0, 0); - globalCtx->roomCtx.unk_74[0] = 0xFF; - MO_WATER_LEVEL(globalCtx) = -500; + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -200.0f, -280.0f, 0.0f, 0, 0, 0, 0); + play->roomCtx.unk_74[0] = 0xFF; + MO_WATER_LEVEL(play) = -500; return; } if (gSaveContext.eventChkInf[7] & 0x10) { @@ -379,48 +379,48 @@ void BossMo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.x = 1000.0f; this->timers[0] = 60; } - sMorphaTent1 = (BossMo*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_MO, + sMorphaTent1 = (BossMo*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_MO, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOSSMO_TENTACLE); this->actor.draw = BossMo_DrawCore; this->actor.update = BossMo_UpdateCore; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); } else { Actor_SetScale(&this->actor, 0.01f); - BossMo_SetupTentacle(this, globalCtx); + BossMo_SetupTentacle(this, play); this->actor.colChkInfo.mass = 0xFF; - MO_WATER_LEVEL(globalCtx) = -50; + MO_WATER_LEVEL(play) = -50; this->waterTexAlpha = 90.0f; - this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx); + this->actor.world.pos.y = MO_WATER_LEVEL(play); this->actor.prevPos = this->targetPos = this->actor.world.pos; - Collider_InitJntSph(globalCtx, &this->tentCollider); - Collider_SetJntSph(globalCtx, &this->tentCollider, &this->actor, &sJntSphInit, this->tentElements); + Collider_InitJntSph(play, &this->tentCollider); + Collider_SetJntSph(play, &this->tentCollider, &this->actor, &sJntSphInit, this->tentElements); this->tentMaxAngle = 1.0f; } } -void BossMo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; if (this->actor.params >= BOSSMO_TENTACLE) { - Collider_DestroyJntSph(globalCtx, &this->tentCollider); + Collider_DestroyJntSph(play, &this->tentCollider); } else { - Collider_DestroyCylinder(globalCtx, &this->coreCollider); + Collider_DestroyCylinder(play, &this->coreCollider); } } -void BossMo_SetupTentacle(BossMo* this, GlobalContext* globalCtx) { +void BossMo_SetupTentacle(BossMo* this, PlayState* play) { this->actionFunc = BossMo_Tentacle; this->work[MO_TENT_ACTION_STATE] = MO_TENT_WAIT; this->timers[0] = 50 + (s16)Rand_ZeroFloat(20.0f); } -void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { +void BossMo_Tentacle(BossMo* this, PlayState* play) { s16 tentXrot; s16 sp1B4 = 0; s32 buttons; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 indS0; s16 indS1; Camera* camera1; @@ -464,7 +464,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Vec3f spC8; if (this->work[MO_TENT_ACTION_STATE] <= MO_TENT_DEATH_3) { - this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx); + this->actor.world.pos.y = MO_WATER_LEVEL(play); } if ((this->work[MO_TENT_ACTION_STATE] == MO_TENT_READY) || (this->work[MO_TENT_ACTION_STATE] >= MO_TENT_DEATH_START) || @@ -599,8 +599,8 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { ripplePos = this->actor.world.pos; ripplePos.x += sinf(randAngle) * randFloat; ripplePos.z += cosf(randAngle) * randFloat; - ripplePos.y = MO_WATER_LEVEL(globalCtx); - BossMo_SpawnRipple(globalCtx->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); + ripplePos.y = MO_WATER_LEVEL(play); + BossMo_SpawnRipple(play->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); } break; case MO_TENT_READY: @@ -696,7 +696,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { this->fwork[MO_TENT_SWING_SIZE_Z] = 0; this->timers[0] = 30; if ((fabsf(player->actor.world.pos.x - this->actor.world.pos.x) > 300.0f) || - (player->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) || HAS_LINK(otherTent) || + (player->actor.world.pos.y < MO_WATER_LEVEL(play)) || HAS_LINK(otherTent) || (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) > 300.0f)) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT; @@ -738,7 +738,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { } if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_CURL) { if ((this->timers[0] >= 5) && (this->linkHitTimer != 0) && (player->actor.parent == NULL)) { - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; this->work[MO_TENT_ACTION_STATE] = MO_TENT_GRAB; func_80078914(&this->tentTipPos, NA_SE_EN_MOFER_CATCH); @@ -776,7 +776,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Math_ApproachS(&player->actor.shape.rot.y, this->grabPosRot.rot.y, 2, 0x7D0); Math_ApproachS(&player->actor.shape.rot.z, this->grabPosRot.rot.z, 2, 0x7D0); if (this->timers[0] == 0) { - camera1 = Gameplay_GetCamera(globalCtx, MAIN_CAM); + camera1 = Play_GetCamera(play, MAIN_CAM); this->work[MO_TENT_ACTION_STATE] = MO_TENT_SHAKE; this->tentMaxAngle = .001f; this->fwork[MO_TENT_SWING_RATE_X] = this->fwork[MO_TENT_SWING_RATE_Z] = @@ -785,10 +785,10 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { this->mashCounter = 0; this->sfxTimer = 30; Audio_ResetIncreasingTranspose(); - func_80064520(globalCtx, &globalCtx->csCtx); - this->csCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamera, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->csCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamera, CAM_STAT_ACTIVE); this->cameraEye = camera1->eye; this->cameraAt = camera1->at; this->cameraYaw = Math_FAtan2F(this->cameraEye.x - this->actor.world.pos.x, @@ -805,11 +805,11 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Interface_ChangeAlpha(0xB); } if ((this->timers[0] % 8) == 0) { - globalCtx->damagePlayer(globalCtx, -1); + play->damagePlayer(play, -1); } Math_ApproachF(&this->waterLevelMod, -5.0f, 0.1f, 0.4f); sp1B4 = this->tentRot[15].x; - buttons = globalCtx->state.input[0].press.button; + buttons = play->state.input[0].press.button; if (CHECK_BTN_ALL(buttons, BTN_A) || CHECK_BTN_ALL(buttons, BTN_B)) { this->mashCounter++; } @@ -848,7 +848,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { player->actor.parent = NULL; player->csMode = 0; if (this->timers[0] == 0) { - func_8002F6D4(globalCtx, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, 10.0f, 0); + func_8002F6D4(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, 10.0f, 0); } } this->timers[0] = 75; @@ -868,7 +868,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->cameraAt.x, player->actor.world.pos.x, 0.5f, 50.0f); Math_ApproachF(&this->cameraAt.y, player->actor.world.pos.y, 0.5f, 50.0f); Math_ApproachF(&this->cameraAt.z, player->actor.world.pos.z, 0.5f, 50.0f); - Gameplay_CameraSetAtEye(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye); + Play_CameraSetAtEye(play, this->csCamera, &this->cameraAt, &this->cameraEye); } break; case MO_TENT_CUT: @@ -885,7 +885,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { sp120.x += Rand_CenteredFloat(30.0f); sp120.y += Rand_CenteredFloat(30.0f); sp120.z += Rand_CenteredFloat(30.0f); - BossMo_SpawnStillDroplet(globalCtx->specialEffects, &sp120, Rand_ZeroFloat(0.1f) + .2f); + BossMo_SpawnStillDroplet(play->specialEffects, &sp120, Rand_ZeroFloat(0.1f) + .2f); } this->meltIndex++; } @@ -904,15 +904,15 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->cameraAt.x, player->actor.world.pos.x, 0.5f, 50.0f); Math_ApproachF(&this->cameraAt.y, player->actor.world.pos.y, 0.5f, 50.0f); Math_ApproachF(&this->cameraAt.z, player->actor.world.pos.z, 0.5f, 50.0f); - Gameplay_CameraSetAtEye(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye); + Play_CameraSetAtEye(play, this->csCamera, &this->cameraAt, &this->cameraEye); if (player->actor.world.pos.y <= 42.0f) { - camera2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); + camera2 = Play_GetCamera(play, MAIN_CAM); camera2->eye = this->cameraEye; camera2->eyeNext = this->cameraEye; camera2->at = this->cameraAt; - func_800C08AC(globalCtx, this->csCamera, 0); + func_800C08AC(play, this->csCamera, 0); this->csCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); + func_80064534(play, &play->csCtx); } } for (indS1 = 0; indS1 < 41; indS1++) { @@ -955,7 +955,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { } if ((this == sMorphaTent1) && (sMorphaCore->hitCount >= 3) && (sMorphaTent2 == NULL)) { sMorphaTent2 = - (BossMo*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_MO, this->actor.world.pos.x, + (BossMo*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_MO, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOSSMO_TENTACLE); sMorphaTent2->tentSpawnPos = this->tentSpawnPos; @@ -1105,16 +1105,16 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { spD4.y = -280.0f; } spD4.z += spE0.z * 3.0f; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &spD4, &spE0, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &spD4, &spE0, ((300 - indS1) * .0015f) + 0.13f); } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, this->actor.world.pos.x, -280.0f, this->actor.world.pos.z, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 200.0f, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 200.0f, -280.0f, this->actor.world.pos.z, 0, 0, 0, 0); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } } break; @@ -1143,11 +1143,11 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { temp = (this->actor.scale.x * 100.0f) * 20.0f; pos.x = this->tentPos[indS1].x + Rand_CenteredFloat(temp); pos.z = this->tentPos[indS1].z + Rand_CenteredFloat(temp); - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, scale); + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, scale); } } -void BossMo_TentCollisionCheck(BossMo* this, GlobalContext* globalCtx) { +void BossMo_TentCollisionCheck(BossMo* this, PlayState* play) { s16 i1; for (i1 = 0; i1 < ARRAY_COUNT(this->tentElements); i1++) { @@ -1182,7 +1182,7 @@ void BossMo_TentCollisionCheck(BossMo* this, GlobalContext* globalCtx) { pos = this->tentPos[2 * i1]; pos.x += velocity.x * 3.0f; pos.z += velocity.z * 3.0f; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, Rand_ZeroFloat(0.08f) + 0.13f); } break; @@ -1194,7 +1194,7 @@ void BossMo_TentCollisionCheck(BossMo* this, GlobalContext* globalCtx) { } } -void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { +void BossMo_IntroCs(BossMo* this, PlayState* play) { static Vec3f cutsceneTargets[6] = { { -360.0f, -190.0f, 0.0f }, { 250.0f, -190.0f, 0.0f }, { 300.0f, -120.0f, -278.0f }, { 180.0f, -80.0f, -340.0f }, { 180.0f, 0.0f, -340.0f }, { 180.0f, 60.0f, -230.0f }, @@ -1209,8 +1209,8 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { f32 sp80; f32 sp7C; f32 sp78; - Player* player = GET_PLAYER(globalCtx); - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Player* player = GET_PLAYER(play); + Camera* camera = Play_GetCamera(play, MAIN_CAM); Vec3f bubblePos; Vec3f bubblePos2; Camera* camera2; @@ -1224,7 +1224,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { switch (this->csState) { case MO_INTRO_WAIT: if (this->timers[0] == 1) { - Message_StartTextbox(globalCtx, 0x403F, NULL); + Message_StartTextbox(play, 0x403F, NULL); } if (((fabsf(player->actor.world.pos.z - 180.0f) < 40.0f) && (fabsf(player->actor.world.pos.x - 180.0f) < 40.0f)) || @@ -1235,11 +1235,11 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { ((fabsf(player->actor.world.pos.z - -180.0f) < 40.0f) && (fabsf(player->actor.world.pos.x - -180.0f) < 40.0f))) { // checks if Link is on one of the four platforms - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamera, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamera, CAM_STAT_ACTIVE); this->actor.speedXZ = 0.0f; this->csState = MO_INTRO_START; this->timers[2] = 50; @@ -1248,7 +1248,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { sMorphaTent1->work[MO_TENT_ACTION_STATE] = MO_TENT_READY; sMorphaTent1->timers[0] = 30000; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x3200FF); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else { break; } @@ -1270,7 +1270,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { bubblePos.x = (this->cameraEye.x + 20.0f) + 10.0f; bubblePos.y = -250.0f; bubblePos.z = this->cameraEye.z; - EffectSsBubble_Spawn(globalCtx, &bubblePos, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); + EffectSsBubble_Spawn(play, &bubblePos, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); } if (this->timers[2] == 40) { func_80078914(&sAudioZeroVec, NA_SE_EN_MOFER_BUBLE_DEMO); @@ -1312,7 +1312,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { bubblePos2.x = (this->cameraEye.x + 20.0f) + 10.0f; bubblePos2.y = -250.0f; bubblePos2.z = this->cameraEye.z; - EffectSsBubble_Spawn(globalCtx, &bubblePos2, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); + EffectSsBubble_Spawn(play, &bubblePos2, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); } sp7C = (f32)0x1000; sp78 = 0.1f; @@ -1344,11 +1344,11 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, sp80, 1.0f, sp78); Math_ApproachF(&this->cameraYawRate, sp7C, 1.0f, 128.0f); if (this->work[MO_TENT_MOVE_TIMER] == 525) { - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); } if (this->work[MO_TENT_MOVE_TIMER] > 540) { this->csState = MO_INTRO_REVEAL; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); sMorphaTent1->drawActor = true; player->actor.world.pos.x = 180.0f; player->actor.world.pos.z = -210.0f; @@ -1430,7 +1430,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } if (this->timers[2] == 130) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gMorphaTitleCardTex), 160, 180, 128, 40, true); gSaveContext.eventChkInf[7] |= 0x10; } @@ -1448,14 +1448,14 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { sMorphaTent1->timers[0] = 50; } if (this->timers[2] == 20) { - camera2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); + camera2 = Play_GetCamera(play, MAIN_CAM); camera2->eye = this->cameraEye; camera2->eyeNext = this->cameraEye; camera2->at = this->cameraAt; - func_800C08AC(globalCtx, this->csCamera, 0); + func_800C08AC(play, this->csCamera, 0); this->csState = this->csCamera = MO_BATTLE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); } break; } @@ -1490,11 +1490,11 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { this->cameraUp.x = this->cameraUp.z = sinf(this->work[MO_TENT_VAR_TIMER] * 0.03f) * this->cameraYawShake * (-2.0f); this->cameraUp.y = 1.0f; - Gameplay_CameraSetAtEyeUp(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye, &this->cameraUp); + Play_CameraSetAtEyeUp(play, this->csCamera, &this->cameraAt, &this->cameraEye, &this->cameraUp); camera->eye = this->cameraEye; camera->eyeNext = this->cameraEye; camera->at = this->cameraAt; - Gameplay_CameraSetFov(globalCtx, this->csCamera, this->cameraZoom); + Play_CameraSetFov(play, this->csCamera, this->cameraZoom); } if ((this->csState > MO_INTRO_START) && (this->work[MO_TENT_MOVE_TIMER] > 540)) { @@ -1504,7 +1504,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { } } -void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { +void BossMo_DeathCs(BossMo* this, PlayState* play) { s16 i; s16 one; f32 dx; @@ -1513,17 +1513,17 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { f32 sp7C; Vec3f sp70; Vec3f sp64; - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(play, MAIN_CAM); Vec3f velocity; Vec3f pos; switch (this->csState) { case MO_DEATH_START: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamera, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamera, CAM_STAT_ACTIVE); this->csState = MO_DEATH_MO_CORE_BURST; this->cameraEye = camera->eye; this->timers[0] = 90; @@ -1565,13 +1565,13 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { pos.x += 2.0f * velocity.x; pos.y += 2.0f * velocity.y; pos.z += 2.0f * velocity.z; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, Rand_ZeroFloat(0.08f) + 0.13f); } this->drawActor = false; this->actor.flags &= ~ACTOR_FLAG_0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_MOFER_CORE_JUMP); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 70, NA_SE_EN_MOFER_LASTVOICE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 70, NA_SE_EN_MOFER_LASTVOICE); } if (this->timers[0] == 0) { this->csState = MO_DEATH_DRAIN_WATER_1; @@ -1684,10 +1684,10 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { camera->eye = this->cameraEye; camera->eyeNext = this->cameraEye; camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->csCamera, 0); + func_800C08AC(play, this->csCamera, 0); this->csCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); sMorphaTent1->actor.world.pos.y = -1000.0f; } } else { @@ -1709,9 +1709,9 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { } } if (sMorphaCore->waterLevel < -200.0f) { - globalCtx->roomCtx.unk_74[0]++; - if (globalCtx->roomCtx.unk_74[0] >= 0xFF) { - globalCtx->roomCtx.unk_74[0] = 0xFF; + play->roomCtx.unk_74[0]++; + if (play->roomCtx.unk_74[0] >= 0xFF) { + play->roomCtx.unk_74[0] = 0xFF; } } if (sMorphaCore->waterLevel < -250.0f) { @@ -1733,13 +1733,13 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { this->cameraAtVel.y * this->cameraSpeedMod); Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, this->cameraAccel); } - Gameplay_CameraSetAtEye(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye); + Play_CameraSetAtEye(play, this->csCamera, &this->cameraAt, &this->cameraEye); } } -void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { +void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("Core_Damage_check START\n"); @@ -1779,7 +1779,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { if ((s8)this->actor.colChkInfo.health <= 0) { if (((sMorphaTent1->csCamera == 0) && (sMorphaTent2 == NULL)) || ((sMorphaTent1->csCamera == 0) && (sMorphaTent2 != NULL) && (sMorphaTent2->csCamera == 0))) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); this->csState = MO_DEATH_START; sMorphaTent1->drawActor = false; @@ -1828,7 +1828,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { pos = this->actor.world.pos; pos.x += (velocity.x * 3.0f); pos.z += (velocity.z * 3.0f); - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, Rand_ZeroFloat(0.08f) + 0.13f); } } @@ -1838,13 +1838,13 @@ void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { osSyncPrintf(VT_RST); } -void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { +void BossMo_Core(BossMo* this, PlayState* play) { static f32 coreBulge[11] = { 0.1f, 0.15f, 0.2f, 0.3f, 0.4f, 0.43f, 0.4f, 0.3f, 0.2f, 0.15f, 0.1f, }; u8 nearLand; s16 i; // not on stack - Player* player = GET_PLAYER(globalCtx); // not on stack + Player* player = GET_PLAYER(play); // not on stack f32 spDC; f32 spD8; f32 spD4; @@ -1878,17 +1878,17 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->baseAlpha, 255.0f, 1.0f, 10.0f); if ((this->csState != MO_BATTLE) && (this->csState < MO_DEATH_START)) { - BossMo_IntroCs(this, globalCtx); + BossMo_IntroCs(this, play); if (this->work[MO_TENT_ACTION_STATE] == MO_CORE_INTRO_WAIT) { this->actor.flags &= ~ACTOR_FLAG_0; return; } } else if (this->csState >= MO_DEATH_START) { - BossMo_DeathCs(this, globalCtx); + BossMo_DeathCs(this, play); return; } if ((this->work[MO_TENT_ACTION_STATE] < MO_CORE_ATTACK) && (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_MOVE) && - (this->actor.world.pos.y > MO_WATER_LEVEL(globalCtx))) { + (this->actor.world.pos.y > MO_WATER_LEVEL(play))) { if (this->actor.velocity.y > 0.0f) { xScaleTarget = 0.005f; yScaleTarget = 0.015f; @@ -1904,7 +1904,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.scale.y, yScaleTarget, 0.2f, 0.001f); this->work[MO_CORE_DRAW_SHADOW] = BossMo_NearLand(&this->actor.world.pos, 15.0f); nearLand = BossMo_NearLand(&this->actor.world.pos, 0.0f); - if ((player->actor.world.pos.y < (MO_WATER_LEVEL(globalCtx) - 50.0f)) && + if ((player->actor.world.pos.y < (MO_WATER_LEVEL(play) - 50.0f)) && ((this->work[MO_TENT_ACTION_STATE] == MO_CORE_MOVE) || (this->work[MO_TENT_ACTION_STATE] == MO_CORE_MAKE_TENT))) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_UNDERWATER; @@ -1917,7 +1917,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { if ((this->timers[0] == 0) && ((sMorphaTent1->work[MO_TENT_ACTION_STATE] == MO_TENT_WAIT) || (sMorphaTent1->work[MO_TENT_ACTION_STATE] == MO_TENT_READY)) && - (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx))) { + (this->actor.world.pos.y < MO_WATER_LEVEL(play))) { this->actor.speedXZ = 0.0f; this->work[MO_TENT_ACTION_STATE] = MO_CORE_MAKE_TENT; if (sMorphaTent1->work[MO_TENT_ACTION_STATE] == MO_TENT_WAIT) { @@ -1946,7 +1946,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { } break; case MO_CORE_UNDERWATER: - if (player->actor.world.pos.y >= MO_WATER_LEVEL(globalCtx)) { + if (player->actor.world.pos.y >= MO_WATER_LEVEL(play)) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_MOVE; this->actor.speedXZ = 0.0f; } @@ -1957,7 +1957,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_MOVE; this->timers[0] = 30; } - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_MAKE_TENT; this->timers[0] = 50; this->actor.speedXZ = 0.0f; @@ -2052,13 +2052,13 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { (this->work[MO_TENT_ACTION_STATE] == MO_CORE_STUNNED)) { this->actor.world.pos.y += this->actor.velocity.y; this->actor.velocity.y -= 1.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 20.0f, 100.0f, 1); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 20.0f, 100.0f, 1); effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; for (i = 0; i < 1; i++) { effectPos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; effectPos.y = Rand_CenteredFloat(20.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &effectPos, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, Rand_ZeroFloat(0.02f) + 0.05f); }; @@ -2080,24 +2080,24 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { effectPos = this->actor.world.pos; effectPos.x += effectVelocity.x; effectPos.z += effectVelocity.z; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &effectPos, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, Rand_ZeroFloat(0.08f) + 0.13f); } effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; effectPos = this->actor.world.pos; effectPos.y = 0.0f; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &effectPos, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, 0.4f); } } - } else if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + } else if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { this->actor.velocity.y = BossMo_NearLand(&this->actor.world.pos, 40.0f) ? 15.0f : 6.0f; - if ((this->actor.world.pos.y + 15.0f) >= MO_WATER_LEVEL(globalCtx)) { + if ((this->actor.world.pos.y + 15.0f) >= MO_WATER_LEVEL(play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MOFER_CORE_JUMP); } } } else if (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_MOVE) { - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { if (this->work[MO_TENT_ACTION_STATE] == MO_CORE_MAKE_TENT) { this->targetPos.x = sMorphaTent1->targetPos.x; this->targetPos.y = sMorphaTent1->actor.world.pos.y - 40.0f; @@ -2152,11 +2152,11 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); temp = (this->actor.world.pos.y < -200.0f) ? 5 : 1; this->actor.world.pos.y -= 20.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 20.0f, 100.0f, temp); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 20.0f, 100.0f, temp); this->actor.world.pos.y += 20.0f; } } - if ((this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) && (MO_WATER_LEVEL(globalCtx) <= this->actor.prevPos.y)) { + if ((this->actor.world.pos.y < MO_WATER_LEVEL(play)) && (MO_WATER_LEVEL(play) <= this->actor.prevPos.y)) { if (this->actor.velocity.y < -5.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MOFER_CORE_JUMP); } else { @@ -2177,19 +2177,19 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { effectPos = this->actor.world.pos; effectPos.x += effectVelocity.x * 3.0f; - effectPos.y = MO_WATER_LEVEL(globalCtx); + effectPos.y = MO_WATER_LEVEL(play); effectPos.z += effectVelocity.z * 3.0f; - BossMo_SpawnDroplet(MO_FX_SPLASH, (BossMoEffect*)globalCtx->specialEffects, &effectPos, &effectVelocity, + BossMo_SpawnDroplet(MO_FX_SPLASH, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, Rand_ZeroFloat(0.075f) + 0.15f); } effectPos = this->actor.world.pos; - effectPos.y = MO_WATER_LEVEL(globalCtx); - BossMo_SpawnRipple(globalCtx->specialEffects, &effectPos, 100.0f, 800.0f, 100, 290, MO_FX_SMALL_RIPPLE); - BossMo_SpawnRipple(globalCtx->specialEffects, &effectPos, 50.0f, 600.0f, 70, 290, MO_FX_SMALL_RIPPLE); - BossMo_SpawnRipple(globalCtx->specialEffects, &effectPos, 0, 400.0f, 50, 290, MO_FX_SMALL_RIPPLE); + effectPos.y = MO_WATER_LEVEL(play); + BossMo_SpawnRipple(play->specialEffects, &effectPos, 100.0f, 800.0f, 100, 290, MO_FX_SMALL_RIPPLE); + BossMo_SpawnRipple(play->specialEffects, &effectPos, 50.0f, 600.0f, 70, 290, MO_FX_SMALL_RIPPLE); + BossMo_SpawnRipple(play->specialEffects, &effectPos, 0, 400.0f, 50, 290, MO_FX_SMALL_RIPPLE); } } - if ((this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) || (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK)) { + if ((this->actor.world.pos.y < MO_WATER_LEVEL(play)) || (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK)) { for (i = 0; i < 3; i++) { effectAccel.x = effectAccel.z = 0.0f; effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; @@ -2203,24 +2203,24 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { effectPos.x = Rand_CenteredFloat(sp58) + this->actor.world.pos.x; effectPos.y = Rand_CenteredFloat(sp58) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(sp58) + this->actor.world.pos.z; - BossMo_SpawnBubble(globalCtx->specialEffects, &effectPos, &effectVelocity, &effectAccel, + BossMo_SpawnBubble(play->specialEffects, &effectPos, &effectVelocity, &effectAccel, Rand_ZeroFloat(0.05f) + 0.1f, NULL); } } - BossMo_CoreCollisionCheck(this, globalCtx); + BossMo_CoreCollisionCheck(this, play); } -void BossMo_UpdateCore(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_UpdateCore(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); osSyncPrintf("CORE mode = <%d>\n", this->work[MO_TENT_ACTION_STATE]); if (sMorphaTent2 == NULL) { - MO_WATER_LEVEL(globalCtx) = sMorphaTent1->waterLevelMod + (s16)this->waterLevel; + MO_WATER_LEVEL(play) = sMorphaTent1->waterLevelMod + (s16)this->waterLevel; } else { - MO_WATER_LEVEL(globalCtx) = sMorphaTent2->waterLevelMod + ((s16)this->waterLevel + sMorphaTent1->waterLevelMod); + MO_WATER_LEVEL(play) = sMorphaTent2->waterLevelMod + ((s16)this->waterLevel + sMorphaTent1->waterLevelMod); } this->actor.flags |= ACTOR_FLAG_9; this->actor.focus.pos = this->actor.world.pos; @@ -2240,28 +2240,28 @@ void BossMo_UpdateCore(Actor* thisx, GlobalContext* globalCtx) { } } - BossMo_Core(this, globalCtx); + BossMo_Core(this, play); Collider_UpdateCylinder(&this->actor, &this->coreCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->coreCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->coreCollider.base); if ((this->work[MO_TENT_ACTION_STATE] != MO_CORE_STUNNED) || - (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx))) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->coreCollider.base); + (this->actor.world.pos.y < MO_WATER_LEVEL(play))) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->coreCollider.base); } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->coreCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->coreCollider.base); } - BossMo_UpdateEffects(this, globalCtx); + BossMo_UpdateEffects(this, play); if (player->actor.parent != NULL) { this->actor.flags &= ~ACTOR_FLAG_0; } BossMo_Unknown(); } -void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_UpdateTent(Actor* thisx, PlayState* play) { s16 i; s16 index; s32 pad; BossMo* this = (BossMo*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 phi_f0; if ((this == sMorphaTent2) && (this->tent2KillTimer != 0)) { @@ -2275,7 +2275,7 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { return; } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->tentPos[40], &this->tentTipPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->tentPos[40], &this->tentTipPos, &this->actor.projectedW); osSyncPrintf("MO : Move mode = <%d>\n", this->work[MO_TENT_ACTION_STATE]); Math_ApproachS(&player->actor.shape.rot.x, 0, 5, 0x3E8); @@ -2319,7 +2319,7 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { Math_ApproachF(&this->tentRippleSize, 0.0f, 0.1f, 0.005f); Math_ApproachF(&this->tentPulse, 0.2f, 0.5f, 0.01f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { this->timers[i]--; @@ -2344,7 +2344,7 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { pos = this->tentPos[38]; } } - BossMo_SpawnRipple(globalCtx->specialEffects, &pos, rippleScale, rippleScale * 3.0f, this->baseAlpha * 0.6666f, + BossMo_SpawnRipple(play->specialEffects, &pos, rippleScale, rippleScale * 3.0f, this->baseAlpha * 0.6666f, 300, MO_FX_BIG_RIPPLE); } if (this->baseBubblesTimer != 0) { @@ -2370,9 +2370,9 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { } } bubblePos.x = this->tentPos[i].x + sp7C.x; - bubblePos.y = (MO_WATER_LEVEL(globalCtx) - 40.0f) + Rand_ZeroFloat(20.0f); + bubblePos.y = (MO_WATER_LEVEL(play) - 40.0f) + Rand_ZeroFloat(20.0f); bubblePos.z = this->tentPos[i].z + sp7C.z; - BossMo_SpawnBubble(globalCtx->specialEffects, &bubblePos, &zeroVec, &zeroVec, Rand_ZeroFloat(0.05f) + 0.2f, + BossMo_SpawnBubble(play->specialEffects, &bubblePos, &zeroVec, &zeroVec, Rand_ZeroFloat(0.05f) + 0.2f, &this->tentPos[i]); } @@ -2387,18 +2387,18 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { } if (this->drawActor) { - BossMo_TentCollisionCheck(this, globalCtx); + BossMo_TentCollisionCheck(this, play); if ((this->work[MO_TENT_INVINC_TIMER] == 0) && (this->work[MO_TENT_ACTION_STATE] != MO_TENT_GRAB) && (this->work[MO_TENT_ACTION_STATE] != MO_TENT_SHAKE)) { BossMo* otherTent = (BossMo*)this->otherTent; if (!HAS_LINK(otherTent) && (this->cutIndex == 0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->tentCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->tentCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->tentCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->tentCollider.base); } } if (this->cutIndex == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->tentCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tentCollider.base); } } this->work[MO_TENT_BASE_TEX1_X]++; @@ -2434,21 +2434,21 @@ static Gfx* sTentDLists[41] = { gMorphaTentaclePart40DL, }; -void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { +void BossMo_DrawTentacle(BossMo* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s16 i; s16 notCut; s16 index; - Mtx* matrix = Graph_Alloc(globalCtx->state.gfxCtx, 41 * sizeof(Mtx)); + Mtx* matrix = Graph_Alloc(play->state.gfxCtx, 41 * sizeof(Mtx)); f32 phi_f20; f32 phi_f22; Vec3f sp110; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - sp110.x = globalCtx->envCtx.dirLight1.params.dir.x; - sp110.y = globalCtx->envCtx.dirLight1.params.dir.y; - sp110.z = globalCtx->envCtx.dirLight1.params.dir.z; + sp110.x = play->envCtx.dirLight1.params.dir.x; + sp110.y = play->envCtx.dirLight1.params.dir.y; + sp110.z = play->envCtx.dirLight1.params.dir.z; Matrix_Push(); @@ -2501,7 +2501,7 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, matrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (i == 0) { - func_8002EB44(&this->tentPos[i], &globalCtx->view.eye, &sp110, globalCtx->state.gfxCtx); + func_8002EB44(&this->tentPos[i], &play->view.eye, &sp110, play->state.gfxCtx); } if (i == 0) { @@ -2526,10 +2526,10 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { Matrix_Translate(((BossMo_RandZeroOne() - 0.5f) * 10.0f) * this->tentScale[i - 2].x, ((BossMo_RandZeroOne() - 0.5f) * 3.0f) + phi_f20, ((BossMo_RandZeroOne() - 0.5f) * 10.0f) * this->tentScale[i - 2].z, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(phi_f22, phi_f22, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMorphaBubbleDL); @@ -2567,20 +2567,20 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossMo_DrawWater(BossMo* this, GlobalContext* globalCtx) { +void BossMo_DrawWater(BossMo* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Translate(0.0f, MO_WATER_LEVEL(globalCtx), 0.0f, MTXMODE_NEW); + func_80093D84(play->state.gfxCtx); + Matrix_Translate(0.0f, MO_WATER_LEVEL(play), 0.0f, MTXMODE_NEW); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->waterTex1x, (s16)this->waterTex1y, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->waterTex1x, (s16)this->waterTex1y, 32, 32, 1, (s16)this->waterTex2x, (s16)this->waterTex2y, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); @@ -2590,43 +2590,43 @@ void BossMo_DrawWater(BossMo* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 80); Matrix_Scale(0.5f, 1.0f, 0.5f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gMorphaWaterDL); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_DrawCore(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - if (this->actor.world.pos.y > MO_WATER_LEVEL(globalCtx)) { - BossMo_DrawWater(this, globalCtx); + OPEN_DISPS(play->state.gfxCtx); + if (this->actor.world.pos.y > MO_WATER_LEVEL(play)) { + BossMo_DrawWater(this, play); } if (this->drawActor) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 3, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 3, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 3, 32, 32, 1, sMorphaTent1->work[MO_TENT_VAR_TIMER] * -3, sMorphaTent1->work[MO_TENT_VAR_TIMER] * -3, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 5, 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 5, 0, 32, 32, 1, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * -10, 32, 32)); Matrix_RotateX(this->work[MO_TENT_MOVE_TIMER] * 0.5f, MTXMODE_APPLY); Matrix_RotateZ(this->work[MO_TENT_MOVE_TIMER] * 0.8f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, (s8)this->baseAlpha); - func_8002ED80(&this->actor, globalCtx, 0); + func_8002ED80(&this->actor, play, 0); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gMorphaCoreMembraneDL)); @@ -2641,11 +2641,11 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gMorphaCoreNucleusDL)); if ((this->work[MO_CORE_DRAW_SHADOW] && (this->actor.world.pos.y >= 0.0f)) || - (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx))) { + (this->actor.world.pos.y < MO_WATER_LEVEL(play))) { f32 groundLevel; s16 shadowAlpha; - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { groundLevel = -280.0f; shadowAlpha = 100; } else { @@ -2653,21 +2653,21 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { shadowAlpha = 160; } - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, shadowAlpha); Matrix_Translate(this->actor.world.pos.x, groundLevel, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(0.23f, 1.0f, 0.23f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gCircleShadowDL)); } } - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { - BossMo_DrawWater(this, globalCtx); + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { + BossMo_DrawWater(this, play); } if ((this->csCamera != 0) && (this->csState < MO_INTRO_REVEAL)) { @@ -2680,13 +2680,13 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp6C; Vec3f sp60; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0xFF, 200, 255, 255, (s8)this->fwork[MO_CORE_INTRO_WATER_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, (s8)this->fwork[MO_CORE_INTRO_WATER_ALPHA]); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)sMorphaTent1->waterTex1x, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)sMorphaTent1->waterTex1x, (s16)sMorphaTent1->waterTex1y, 32, 32, 1, (s16)sMorphaTent1->waterTex2x, (s16)sMorphaTent1->waterTex2y, 32, 32)); @@ -2717,29 +2717,29 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); Matrix_Scale(0.05f, 1.0f, 0.05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gMorphaWaterDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - BossMo_DrawEffects(globalCtx->specialEffects, globalCtx); + BossMo_DrawEffects(play->specialEffects, play); } -void BossMo_DrawTent(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_DrawTent(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; u16 scroll; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, (s8)(this->baseAlpha * 1.5f)); gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->work[MO_TENT_BASE_TEX1_X], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->work[MO_TENT_BASE_TEX1_X], this->work[MO_TENT_BASE_TEX1_Y], 32, 32, 1, this->work[MO_TENT_BASE_TEX2_X], this->work[MO_TENT_BASE_TEX2_Y], 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0xFF, 200, 255, 255, (s8)((this->baseAlpha * 12.0f) / 10.0f)); @@ -2748,13 +2748,13 @@ void BossMo_DrawTent(Actor* thisx, GlobalContext* globalCtx) { gSPTexture(POLY_XLU_DISP++, scroll, scroll, 0, G_TX_RENDERTILE, G_ON); if (this->drawActor) { - BossMo_DrawTentacle(this, globalCtx); + BossMo_DrawTentacle(this, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { - BossMoEffect* effect = globalCtx->specialEffects; +void BossMo_UpdateEffects(BossMo* this, PlayState* play) { + BossMoEffect* effect = play->specialEffects; s16 i; Vec3f* targetPos; f32 dx; @@ -2777,7 +2777,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { } if (effect->type <= MO_FX_BIG_RIPPLE) { if (this->csState >= MO_DEATH_START) { - effect->pos.y = MO_WATER_LEVEL(globalCtx); + effect->pos.y = MO_WATER_LEVEL(play); } Math_ApproachF(&effect->scale, effect->fwork[MO_FX_MAX_SIZE], 0.2f, effect->fwork[MO_FX_SPREAD_RATE]); if (effect->rippleMode == 0) { @@ -2795,7 +2795,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { } } else if (effect->type == MO_FX_BUBBLE) { if (effect->targetPos == NULL) { - if ((effect->accel.y > 0.0f) && (effect->pos.y >= MO_WATER_LEVEL(globalCtx))) { + if ((effect->accel.y > 0.0f) && (effect->pos.y >= MO_WATER_LEVEL(play))) { effect->type = MO_FX_NONE; } else { if (effect->vel.y > 2.0f) { @@ -2822,7 +2822,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { if (effect->timer > 20) { effect->alpha -= 30; effect->accel.y = 1.5f; - if ((effect->alpha <= 0) || (effect->pos.y >= MO_WATER_LEVEL(globalCtx))) { + if ((effect->alpha <= 0) || (effect->pos.y >= MO_WATER_LEVEL(play))) { effect->alpha = 0; effect->type = MO_FX_NONE; } @@ -2856,7 +2856,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { if (effect->type == MO_FX_SPLASH) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - BossMo_SpawnDroplet(MO_FX_SPLASH_TRAIL, (BossMoEffect*)globalCtx->specialEffects, + BossMo_SpawnDroplet(MO_FX_SPLASH_TRAIL, (BossMoEffect*)play->specialEffects, &effect->pos, &velocity, effect->scale); } if (effect->vel.y < -20.0f) { @@ -2886,15 +2886,15 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { effect->type = MO_FX_WET_SPOT; effect->alpha = 150; effect->fwork[MO_FX_STRETCH] = (effect->scale * 15.0f) * 0.15f; - } else if (effect->pos.y <= MO_WATER_LEVEL(globalCtx)) { + } else if (effect->pos.y <= MO_WATER_LEVEL(play)) { Vec3f pos = effect->pos; - pos.y = MO_WATER_LEVEL(globalCtx); + pos.y = MO_WATER_LEVEL(play); if (effect->type == MO_FX_SPLASH) { - BossMo_SpawnRipple(globalCtx->specialEffects, &pos, 60.0f, 160.0f, 80, 290, + BossMo_SpawnRipple(play->specialEffects, &pos, 60.0f, 160.0f, 80, 290, MO_FX_SMALL_RIPPLE); } else { - BossMo_SpawnRipple(globalCtx->specialEffects, &pos, 40.0f, 110.0f, 80, 290, + BossMo_SpawnRipple(play->specialEffects, &pos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); } effect->type = MO_FX_NONE; @@ -2906,11 +2906,11 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { } } -void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { +void BossMo_DrawEffects(BossMoEffect* effect, PlayState* play) { u8 flag = 0; s16 i; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; BossMoEffect* effectHead = effect; OPEN_DISPS(gfxCtx); @@ -2945,7 +2945,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { if (effect->type == MO_FX_SMALL_RIPPLE) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (flag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 255, 0); @@ -2984,7 +2984,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { 255, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale / effect->fwork[MO_FX_STRETCH], effect->fwork[MO_FX_STRETCH] * effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -3029,7 +3029,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { if (effect->type == MO_FX_BUBBLE) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (flag == 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0); @@ -3039,7 +3039,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h index 881dbe222..ae0c2c8e1 100644 --- a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h +++ b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h @@ -6,7 +6,7 @@ struct BossMo; -typedef void (*BossMoActionFunc)(struct BossMo*, GlobalContext*); +typedef void (*BossMoActionFunc)(struct BossMo*, PlayState*); typedef enum { /* 0 */ MO_TENT_ACTION_STATE, diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 84cbeddaf..a3d35b1d0 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -47,140 +47,140 @@ typedef enum { /* 3 */ BONGO_SHADOW } BossSstEffectMode; -void BossSst_Init(Actor* thisx, GlobalContext* globalCtx); -void BossSst_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx); -void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx); -void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx); -void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx); -void BossSst_UpdateEffect(Actor* thisx, GlobalContext* globalCtx); -void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx); +void BossSst_Init(Actor* thisx, PlayState* play); +void BossSst_Destroy(Actor* thisx, PlayState* play); +void BossSst_UpdateHand(Actor* thisx, PlayState* play); +void BossSst_UpdateHead(Actor* thisx, PlayState* play); +void BossSst_DrawHand(Actor* thisx, PlayState* play); +void BossSst_DrawHead(Actor* thisx, PlayState* play); +void BossSst_UpdateEffect(Actor* thisx, PlayState* play); +void BossSst_DrawEffect(Actor* thisx, PlayState* play); void BossSst_Reset(void); void BossSst_HeadSfx(BossSst* this, u16 sfxId); void BossSst_HeadSetupLurk(BossSst* this); -void BossSst_HeadLurk(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadLurk(BossSst* this, PlayState* play); +void BossSst_HeadSetupIntro(BossSst* this, PlayState* play); +void BossSst_HeadIntro(BossSst* this, PlayState* play); void BossSst_HeadSetupNeutral(BossSst* this); -void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadWait(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadNeutral(BossSst* this, PlayState* play); +void BossSst_HeadWait(BossSst* this, PlayState* play); void BossSst_HeadSetupDamagedHand(BossSst* this, s32 bothHands); -void BossSst_HeadDamagedHand(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadDamagedHand(BossSst* this, PlayState* play); void BossSst_HeadSetupReadyCharge(BossSst* this); -void BossSst_HeadReadyCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadReadyCharge(BossSst* this, PlayState* play); void BossSst_HeadSetupCharge(BossSst* this); -void BossSst_HeadCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadCharge(BossSst* this, PlayState* play); void BossSst_HeadSetupEndCharge(BossSst* this); -void BossSst_HeadEndCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadEndCharge(BossSst* this, PlayState* play); void BossSst_HeadSetupFrozenHand(BossSst* this); -void BossSst_HeadFrozenHand(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadFrozenHand(BossSst* this, PlayState* play); void BossSst_HeadSetupUnfreezeHand(BossSst* this); -void BossSst_HeadUnfreezeHand(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadUnfreezeHand(BossSst* this, PlayState* play); -void BossSst_HeadStunned(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadStunned(BossSst* this, PlayState* play); void BossSst_HeadSetupVulnerable(BossSst* this); -void BossSst_HeadVulnerable(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadDamage(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadVulnerable(BossSst* this, PlayState* play); +void BossSst_HeadDamage(BossSst* this, PlayState* play); void BossSst_HeadSetupRecover(BossSst* this); -void BossSst_HeadRecover(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadRecover(BossSst* this, PlayState* play); -void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadDeath(BossSst* this, PlayState* play); void BossSst_HeadSetupThrash(BossSst* this); -void BossSst_HeadThrash(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadThrash(BossSst* this, PlayState* play); void BossSst_HeadSetupDarken(BossSst* this); -void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadDarken(BossSst* this, PlayState* play); void BossSst_HeadSetupFall(BossSst* this); -void BossSst_HeadFall(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadFall(BossSst* this, PlayState* play); void BossSst_HeadSetupMelt(BossSst* this); -void BossSst_HeadMelt(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadMelt(BossSst* this, PlayState* play); void BossSst_HeadSetupFinish(BossSst* this); -void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadFinish(BossSst* this, PlayState* play); -void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx); -void BossSst_HandReleasePlayer(BossSst* this, GlobalContext* globalCtx, s32 dropPlayer); +void BossSst_HandGrabPlayer(BossSst* this, PlayState* play); +void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer); void BossSst_HandSelectAttack(BossSst* this); void BossSst_HandSetDamage(BossSst* this, s32 damage); void BossSst_HandSetInvulnerable(BossSst* this, s32 isInv); void BossSst_HandSetupWait(BossSst* this); -void BossSst_HandWait(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandWait(BossSst* this, PlayState* play); void BossSst_HandSetupDownbeat(BossSst* this); -void BossSst_HandDownbeat(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandDownbeat(BossSst* this, PlayState* play); void BossSst_HandSetupOffbeat(BossSst* this); -void BossSst_HandOffbeat(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandOffbeat(BossSst* this, PlayState* play); void BossSst_HandSetupDownbeatEnd(BossSst* this); -void BossSst_HandDownbeatEnd(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandDownbeatEnd(BossSst* this, PlayState* play); void BossSst_HandSetupOffbeatEnd(BossSst* this); -void BossSst_HandOffbeatEnd(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandOffbeatEnd(BossSst* this, PlayState* play); -void BossSst_HandReadySlam(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadySlam(BossSst* this, PlayState* play); void BossSst_HandSetupSlam(BossSst* this); -void BossSst_HandSlam(BossSst* this, GlobalContext* globalCtx); -void BossSst_HandEndSlam(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandSlam(BossSst* this, PlayState* play); +void BossSst_HandEndSlam(BossSst* this, PlayState* play); -void BossSst_HandReadySweep(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadySweep(BossSst* this, PlayState* play); void BossSst_HandSetupSweep(BossSst* this); -void BossSst_HandSweep(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandSweep(BossSst* this, PlayState* play); -void BossSst_HandReadyPunch(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyPunch(BossSst* this, PlayState* play); void BossSst_HandSetupPunch(BossSst* this); -void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandPunch(BossSst* this, PlayState* play); -void BossSst_HandReadyClap(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyClap(BossSst* this, PlayState* play); void BossSst_HandSetupClap(BossSst* this); -void BossSst_HandClap(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandClap(BossSst* this, PlayState* play); void BossSst_HandSetupEndClap(BossSst* this); -void BossSst_HandEndClap(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandEndClap(BossSst* this, PlayState* play); -void BossSst_HandReadyGrab(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyGrab(BossSst* this, PlayState* play); void BossSst_HandSetupGrab(BossSst* this); -void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandGrab(BossSst* this, PlayState* play); void BossSst_HandSetupCrush(BossSst* this); -void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandCrush(BossSst* this, PlayState* play); void BossSst_HandSetupEndCrush(BossSst* this); -void BossSst_HandEndCrush(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandEndCrush(BossSst* this, PlayState* play); void BossSst_HandSetupSwing(BossSst* this); -void BossSst_HandSwing(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandSwing(BossSst* this, PlayState* play); void BossSst_HandSetupRetreat(BossSst* this); -void BossSst_HandRetreat(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandRetreat(BossSst* this, PlayState* play); void BossSst_HandSetupReel(BossSst* this); -void BossSst_HandReel(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReel(BossSst* this, PlayState* play); void BossSst_HandSetupReadyShake(BossSst* this); -void BossSst_HandReadyShake(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyShake(BossSst* this, PlayState* play); void BossSst_HandSetupShake(BossSst* this); -void BossSst_HandShake(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandShake(BossSst* this, PlayState* play); void BossSst_HandSetupReadyCharge(BossSst* this); -void BossSst_HandReadyCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyCharge(BossSst* this, PlayState* play); void BossSst_HandSetupFrozen(BossSst* this); -void BossSst_HandFrozen(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandFrozen(BossSst* this, PlayState* play); void BossSst_HandSetupReadyBreakIce(BossSst* this); -void BossSst_HandReadyBreakIce(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyBreakIce(BossSst* this, PlayState* play); void BossSst_HandSetupBreakIce(BossSst* this); -void BossSst_HandBreakIce(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandBreakIce(BossSst* this, PlayState* play); -void BossSst_HandStunned(BossSst* this, GlobalContext* globalCtx); -void BossSst_HandDamage(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandStunned(BossSst* this, PlayState* play); +void BossSst_HandDamage(BossSst* this, PlayState* play); void BossSst_HandSetupRecover(BossSst* this); -void BossSst_HandRecover(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandRecover(BossSst* this, PlayState* play); void BossSst_HandSetupThrash(BossSst* this); -void BossSst_HandThrash(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandThrash(BossSst* this, PlayState* play); void BossSst_HandSetupDarken(BossSst* this); -void BossSst_HandDarken(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandDarken(BossSst* this, PlayState* play); void BossSst_HandSetupFall(BossSst* this); -void BossSst_HandFall(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandFall(BossSst* this, PlayState* play); void BossSst_HandSetupMelt(BossSst* this); -void BossSst_HandMelt(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandMelt(BossSst* this, PlayState* play); void BossSst_HandSetupFinish(BossSst* this); -void BossSst_HandFinish(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandFinish(BossSst* this, PlayState* play); void BossSst_SpawnHeadShadow(BossSst* this); void BossSst_SpawnHandShadow(BossSst* this); @@ -267,41 +267,41 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP), }; -void BossSst_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossSst_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossSst* this = (BossSst*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->colliderCyl); - Collider_InitJntSph(globalCtx, &this->colliderJntSph); + Collider_InitCylinder(play, &this->colliderCyl); + Collider_InitJntSph(play, &this->colliderJntSph); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Flags_SetSwitch(globalCtx, 0x14); + Flags_SetSwitch(play, 0x14); if (this->actor.params == BONGO_HEAD) { - sFloor = (BgSstFloor*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SST_FLOOR, sRoomCenter.x, + sFloor = (BgSstFloor*)Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SST_FLOOR, sRoomCenter.x, sRoomCenter.y, sRoomCenter.z, 0, 0, 0, BONGOFLOOR_REST); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBongoHeadSkel, &gBongoHeadEyeOpenIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBongoHeadSkel, &gBongoHeadEyeOpenIdleAnim, this->jointTable, this->morphTable, 45); ActorShape_Init(&this->actor.shape, 70000.0f, ActorShadow_DrawCircle, 95.0f); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInitHead, this->colliderItems); - Collider_SetCylinder(globalCtx, &this->colliderCyl, &this->actor, &sCylinderInitHead); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHead, this->colliderItems); + Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInitHead); sHead = this; this->actor.world.pos.x = ROOM_CENTER_X + 50.0f; this->actor.world.pos.y = ROOM_CENTER_Y + 0.0f; this->actor.world.pos.z = ROOM_CENTER_Z - 650.0f; this->actor.home.pos = this->actor.world.pos; this->actor.shape.rot.y = 0; - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z + 400.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, ROOM_CENTER_X, ROOM_CENTER_Y, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z - 200.0f, 0, 0, 0, 0); Actor_Kill(&this->actor); } else { sHands[LEFT] = - (BossSst*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_SST, this->actor.world.pos.x + 200.0f, + (BossSst*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_SST, this->actor.world.pos.x + 200.0f, this->actor.world.pos.y, this->actor.world.pos.z + 400.0f, 0, this->actor.shape.rot.y, 0, BONGO_LEFT_HAND); - sHands[RIGHT] = (BossSst*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_SST, + sHands[RIGHT] = (BossSst*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_SST, this->actor.world.pos.x + (-200.0f), this->actor.world.pos.y, this->actor.world.pos.z + 400.0f, 0, this->actor.shape.rot.y, 0, BONGO_RIGHT_HAND); @@ -314,18 +314,18 @@ void BossSst_Init(Actor* thisx, GlobalContext* globalCtx2) { this->radius = -650.0f; this->actor.targetArrowOffset = 4000.0f; BossSst_HeadSetupLurk(this); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); } } else { - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInitHand, this->colliderItems); - Collider_SetCylinder(globalCtx, &this->colliderCyl, &this->actor, &sCylinderInitHand); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHand, this->colliderItems); + Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInitHand); if (this->actor.params == BONGO_LEFT_HAND) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBongoLeftHandSkel, &gBongoLeftHandIdleAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gBongoLeftHandSkel, &gBongoLeftHandIdleAnim, this->jointTable, this->morphTable, 27); this->vParity = -1; this->colliderJntSph.elements[0].dim.modelSphere.center.z *= -1; } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBongoRightHandSkel, &gBongoRightHandIdleAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gBongoRightHandSkel, &gBongoRightHandIdleAnim, this->jointTable, this->morphTable, 27); this->vParity = 1; } @@ -338,12 +338,12 @@ void BossSst_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void BossSst_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); - Collider_DestroyCylinder(globalCtx, &this->colliderCyl); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCyl); Audio_StopSfxByPos(&this->center); } @@ -355,14 +355,14 @@ void BossSst_HeadSetupLurk(BossSst* this) { this->actionFunc = BossSst_HeadLurk; } -void BossSst_HeadLurk(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadLurk(BossSst* this, PlayState* play) { if (this->actor.yDistToPlayer < 1000.0f) { - BossSst_HeadSetupIntro(this, globalCtx); + BossSst_HeadSetupIntro(this, play); } } -void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->timer = 611; this->ready = false; @@ -376,23 +376,23 @@ void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx) { player->fallStartHeight = 0; player->stateFlags1 |= 0x20; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - sCutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + sCutsceneCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_ACTIVE); Math_Vec3f_Copy(&sCameraAt, &player->actor.world.pos); if (gSaveContext.eventChkInf[7] & 0x80) { sCameraEye.z = ROOM_CENTER_Z - 100.0f; } - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &sCameraAt, &sCameraEye); + Play_CameraSetAtEye(play, sCutsceneCamera, &sCameraAt, &sCameraEye); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); this->actionFunc = BossSst_HeadIntro; } -void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HeadIntro(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 tempo; s32 introStateTimer; s32 revealStateTimer; @@ -409,15 +409,15 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { sHands[RIGHT]->actor.flags |= ACTOR_FLAG_0; sHands[LEFT]->actor.flags |= ACTOR_FLAG_0; player->stateFlags1 &= ~0x20; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); sCameraAt.y += 30.0f; sCameraAt.z += 300.0f; - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &sCameraAt, &sCameraEye); - Gameplay_CopyCamera(globalCtx, MAIN_CAM, sCutsceneCamera); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, sCutsceneCamera); + Play_CameraSetAtEye(play, sCutsceneCamera, &sCameraAt, &sCameraEye); + Play_CopyCamera(play, MAIN_CAM, sCutsceneCamera); + Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + Play_ClearCamera(play, sCutsceneCamera); gSaveContext.eventChkInf[7] |= 0x80; BossSst_HeadSetupNeutral(this); this->colliderJntSph.base.ocFlags1 |= OC1_ON; @@ -598,7 +598,7 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { sCameraEye.z -= 350.0f * 0.01f; } else if (revealStateTimer == 85) { if (!(gSaveContext.eventChkInf[7] & 0x80)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gBongoTitleCardTex), 160, 180, 128, 40, true); } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); @@ -616,7 +616,7 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { } if (this->actionFunc != BossSst_HeadNeutral) { - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &sCameraAt, &sCameraEye); + Play_CameraSetAtEye(play, sCutsceneCamera, &sCameraAt, &sCameraEye); } } @@ -627,7 +627,7 @@ void BossSst_HeadSetupWait(BossSst* this) { this->actionFunc = BossSst_HeadWait; } -void BossSst_HeadWait(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadWait(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((HAND_STATE(sHands[LEFT]) == HAND_WAIT) && (HAND_STATE(sHands[RIGHT]) == HAND_WAIT)) { BossSst_HeadSetupNeutral(this); @@ -640,7 +640,7 @@ void BossSst_HeadSetupNeutral(BossSst* this) { this->actionFunc = BossSst_HeadNeutral; } -void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadNeutral(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (!this->ready && ((HAND_STATE(sHands[LEFT]) == HAND_BEAT) || (HAND_STATE(sHands[LEFT]) == HAND_WAIT)) && ((HAND_STATE(sHands[RIGHT]) == HAND_BEAT) || (HAND_STATE(sHands[RIGHT]) == HAND_WAIT))) { @@ -654,7 +654,7 @@ void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - if ((GET_PLAYER(globalCtx)->actor.world.pos.y > -50.0f) && !(GET_PLAYER(globalCtx)->stateFlags1 & 0x6080)) { + if ((GET_PLAYER(play)->actor.world.pos.y > -50.0f) && !(GET_PLAYER(play)->stateFlags1 & 0x6080)) { sHands[Rand_ZeroOne() <= 0.5f]->ready = true; BossSst_HeadSetupWait(this); } else { @@ -662,7 +662,7 @@ void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx) { } } else { Math_ApproachS(&this->actor.shape.rot.y, - Actor_WorldYawTowardPoint(&GET_PLAYER(globalCtx)->actor, &sRoomCenter) + 0x8000, 4, 0x400); + Actor_WorldYawTowardPoint(&GET_PLAYER(play)->actor, &sRoomCenter) + 0x8000, 4, 0x400); if ((this->timer == 28) || (this->timer == 84)) { BossSst_HeadSfx(this, NA_SE_EN_SHADEST_PRAY); } @@ -678,7 +678,7 @@ void BossSst_HeadSetupDamagedHand(BossSst* this, s32 bothHands) { this->actionFunc = BossSst_HeadDamagedHand; } -void BossSst_HeadDamagedHand(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDamagedHand(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((HAND_STATE(sHands[LEFT]) == HAND_DAMAGED) && (HAND_STATE(sHands[RIGHT]) == HAND_DAMAGED)) { BossSst_HeadSetupReadyCharge(this); @@ -699,7 +699,7 @@ void BossSst_HeadSetupReadyCharge(BossSst* this) { this->actionFunc = BossSst_HeadReadyCharge; } -void BossSst_HeadReadyCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadReadyCharge(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (sHands[LEFT]->ready && (sHands[LEFT]->actionFunc == BossSst_HandReadyCharge) && sHands[RIGHT]->ready && (sHands[RIGHT]->actionFunc == BossSst_HandReadyCharge)) { @@ -721,7 +721,7 @@ void BossSst_HeadSetupCharge(BossSst* this) { this->actionFunc = BossSst_HeadCharge; } -void BossSst_HeadCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadCharge(BossSst* this, PlayState* play) { f32 chargeDist; s32 animFinish = SkelAnime_Update(&this->skelAnime); @@ -762,8 +762,8 @@ void BossSst_HeadCharge(BossSst* this, GlobalContext* globalCtx) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHands[LEFT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHands[RIGHT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); } } @@ -776,7 +776,7 @@ void BossSst_HeadSetupEndCharge(BossSst* this) { this->actionFunc = BossSst_HeadEndCharge; } -void BossSst_HeadEndCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadEndCharge(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->targetYaw, 4, 0x800, 0x100) == 0) { BossSst_HandSetupRetreat(sHands[LEFT]); @@ -792,7 +792,7 @@ void BossSst_HeadSetupFrozenHand(BossSst* this) { this->actionFunc = BossSst_HeadFrozenHand; } -void BossSst_HeadFrozenHand(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadFrozenHand(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->ready) { BossSst_HeadSetupUnfreezeHand(this); @@ -805,7 +805,7 @@ void BossSst_HeadSetupUnfreezeHand(BossSst* this) { this->actionFunc = BossSst_HeadUnfreezeHand; } -void BossSst_HeadUnfreezeHand(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadUnfreezeHand(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { BossSst_HeadSetupWait(this); } @@ -822,7 +822,7 @@ void BossSst_HeadSetupStunned(BossSst* this) { this->actionFunc = BossSst_HeadStunned; } -void BossSst_HeadStunned(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadStunned(BossSst* this, PlayState* play) { f32 bounce; s32 animFinish; f32 currentFrame; @@ -879,7 +879,7 @@ void BossSst_HeadSetupVulnerable(BossSst* this) { this->actionFunc = BossSst_HeadVulnerable; } -void BossSst_HeadVulnerable(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadVulnerable(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&sHandOffsets[LEFT].z, 600.0f, 20.0f); Math_StepToF(&sHandOffsets[RIGHT].z, 600.0f, 20.0f); @@ -911,7 +911,7 @@ void BossSst_HeadSetupDamage(BossSst* this) { this->actionFunc = BossSst_HeadDamage; } -void BossSst_HeadDamage(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDamage(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -932,7 +932,7 @@ void BossSst_HeadSetupRecover(BossSst* this) { this->actionFunc = BossSst_HeadRecover; } -void BossSst_HeadRecover(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadRecover(BossSst* this, PlayState* play) { s32 animFinish; f32 currentFrame; f32 diff; @@ -977,7 +977,7 @@ void BossSst_SetCameraTargets(f32 cameraSpeedMod, s32 targetIndex) { sCameraEyeVel.z = (nextEye->z - sCameraEye.z) * cameraSpeedMod; } -void BossSst_UpdateDeathCamera(BossSst* this, GlobalContext* globalCtx) { +void BossSst_UpdateDeathCamera(BossSst* this, PlayState* play) { Vec3f cameraAt; Vec3f cameraEye; f32 sn; @@ -998,11 +998,11 @@ void BossSst_UpdateDeathCamera(BossSst* this, GlobalContext* globalCtx) { cameraEye.x = this->actor.world.pos.x + (sCameraEye.z * sn) + (sCameraEye.x * cs); cameraEye.y = this->actor.home.pos.y - 140.0f + sCameraEye.y; cameraEye.z = this->actor.world.pos.z + (sCameraEye.z * cs) - (sCameraEye.x * sn); - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &cameraAt, &cameraEye); + Play_CameraSetAtEye(play, sCutsceneCamera, &cameraAt, &cameraEye); } -void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HeadSetupDeath(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); Animation_MorphToLoop(&this->skelAnime, &gBongoHeadEyeOpenIdleAnim, -5.0f); BossSst_HeadSfx(this, NA_SE_EN_SHADEST_DEAD); @@ -1015,17 +1015,17 @@ void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { sHands[LEFT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; sHands[RIGHT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); - sCutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_ACTIVE); - Gameplay_CopyCamera(globalCtx, sCutsceneCamera, MAIN_CAM); - func_8002DF54(globalCtx, &player->actor, 8); - func_80064520(globalCtx, &globalCtx->csCtx); - Math_Vec3f_Copy(&sCameraEye, &GET_ACTIVE_CAM(globalCtx)->eye); + sCutsceneCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_ACTIVE); + Play_CopyCamera(play, sCutsceneCamera, MAIN_CAM); + func_8002DF54(play, &player->actor, 8); + func_80064520(play, &play->csCtx); + Math_Vec3f_Copy(&sCameraEye, &GET_ACTIVE_CAM(play)->eye); this->actionFunc = BossSst_HeadDeath; } -void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDeath(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -1037,25 +1037,25 @@ void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupThrash(sHands[RIGHT]); BossSst_HeadSetupThrash(this); } else if (this->timer > 48) { - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &this->actor.focus.pos, &sCameraEye); + Play_CameraSetAtEye(play, sCutsceneCamera, &this->actor.focus.pos, &sCameraEye); Math_StepToF(&this->radius, -350.0f, 10.0f); } else if (this->timer == 48) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->actor.world.pos.x = sRoomCenter.x + (400.0f * Math_SinS(this->actor.shape.rot.y)) + (Math_CosS(this->actor.shape.rot.y) * -120.0f); player->actor.world.pos.z = sRoomCenter.z + (400.0f * Math_CosS(this->actor.shape.rot.y)) - (Math_SinS(this->actor.shape.rot.y) * -120.0f); player->actor.shape.rot.y = Actor_WorldYawTowardPoint(&player->actor, &sRoomCenter); - func_8002DBD0(&this->actor, &sCameraEye, &GET_ACTIVE_CAM(globalCtx)->eye); - func_8002DBD0(&this->actor, &sCameraAt, &GET_ACTIVE_CAM(globalCtx)->at); + func_8002DBD0(&this->actor, &sCameraEye, &GET_ACTIVE_CAM(play)->eye); + func_8002DBD0(&this->actor, &sCameraAt, &GET_ACTIVE_CAM(play)->at); this->radius = -350.0f; this->actor.world.pos.x = sRoomCenter.x - (Math_SinS(this->actor.shape.rot.y) * 350.0f); this->actor.world.pos.z = sRoomCenter.z - (Math_CosS(this->actor.shape.rot.y) * 350.0f); BossSst_SetCameraTargets(1.0 / 48, 0); - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } else { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1067,7 +1067,7 @@ void BossSst_HeadSetupThrash(BossSst* this) { this->actionFunc = BossSst_HeadThrash; } -void BossSst_HeadThrash(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadThrash(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -1076,7 +1076,7 @@ void BossSst_HeadThrash(BossSst* this, GlobalContext* globalCtx) { if ((this->timer == 0) && (this->actor.shape.rot.y == this->targetYaw)) { BossSst_HeadSetupDarken(this); } else if (this->timer >= 80) { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1086,7 +1086,7 @@ void BossSst_HeadSetupDarken(BossSst* this) { this->actionFunc = BossSst_HeadDarken; } -void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDarken(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -1095,7 +1095,7 @@ void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx) { if (this->timer == 80) { sBodyStatic = true; } - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); sBodyColor.r = sBodyColor.g = sBodyColor.b = (this->timer * 3) - 240; if (this->timer == 80) { BossSst_SetCameraTargets(1.0 / 80, 3); @@ -1103,7 +1103,7 @@ void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx) { } else { sBodyColor.b = (80 - this->timer) / 1.0f; sBodyColor.r = sBodyColor.g = sStaticColor.r = sStaticColor.g = sStaticColor.b = (80 - this->timer) / 8.0f; - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); if (this->timer == 0) { BossSst_HeadSetupFall(this); } @@ -1121,14 +1121,14 @@ void BossSst_HeadSetupFall(BossSst* this) { this->actionFunc = BossSst_HeadFall; } -void BossSst_HeadFall(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadFall(BossSst* this, PlayState* play) { this->actor.speedXZ *= 1.5f; if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 230.0f, this->actor.speedXZ)) { BossSst_HeadSetupMelt(this); } if (sCameraAt.y > 200.0f) { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1139,7 +1139,7 @@ void BossSst_HeadSetupMelt(BossSst* this) { this->actionFunc = BossSst_HeadMelt; } -void BossSst_HeadMelt(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadMelt(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -1151,7 +1151,7 @@ void BossSst_HeadMelt(BossSst* this, GlobalContext* globalCtx) { if (this->timer == 0) { BossSst_HeadSetupFinish(this); } else if (this->timer >= 20.0f) { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1163,7 +1163,7 @@ void BossSst_HeadSetupFinish(BossSst* this) { this->actionFunc = BossSst_HeadFinish; } -void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadFinish(BossSst* this, PlayState* play) { static Color_RGBA8 colorIndigo = { 80, 80, 150, 255 }; static Color_RGBA8 colorDarkIndigo = { 40, 40, 80, 255 }; static Color_RGBA8 colorUnused[2] = { @@ -1176,22 +1176,22 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { this->timer--; if (this->effectMode == BONGO_NULL) { if (this->timer < -170) { - BossSst_UpdateDeathCamera(this, globalCtx); - Gameplay_CopyCamera(globalCtx, MAIN_CAM, sCutsceneCamera); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, sCutsceneCamera); - func_8002DF54(globalCtx, &GET_PLAYER(globalCtx)->actor, 7); - func_80064534(globalCtx, &globalCtx->csCtx); + BossSst_UpdateDeathCamera(this, play); + Play_CopyCamera(play, MAIN_CAM, sCutsceneCamera); + Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + Play_ClearCamera(play, sCutsceneCamera); + func_8002DF54(play, &GET_PLAYER(play)->actor, 7); + func_80064534(play, &play->csCtx); Actor_Kill(&this->actor); Actor_Kill(&sHands[LEFT]->actor); Actor_Kill(&sHands[RIGHT]->actor); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } } else if (this->effects[0].alpha == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, (Math_SinS(this->actor.shape.rot.y) * 200.0f) + ROOM_CENTER_X, ROOM_CENTER_Y, Math_CosS(this->actor.shape.rot.y) * 200.0f + ROOM_CENTER_Z, 0, 0, 0, 0); BossSst_SetCameraTargets(1.0f, 7); @@ -1202,7 +1202,7 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { this->effects[2].status = -1; } else if (this->timer > 0) { this->effects[0].status += 5; - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } colorIndigo.a = this->effects[0].alpha; @@ -1212,7 +1212,7 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { spawnPos.x = sRoomCenter.x + 0.0f + Rand_CenteredFloat(800.0f); spawnPos.y = sRoomCenter.y + (-28.0f) + (Rand_ZeroOne() * 5.0f); spawnPos.z = sRoomCenter.z + 0.0f + Rand_CenteredFloat(800.0f); - EffectSsGSplash_Spawn(globalCtx, &spawnPos, &colorIndigo, &colorDarkIndigo, 0, 0x3E8); + EffectSsGSplash_Spawn(play, &spawnPos, &colorIndigo, &colorDarkIndigo, 0, 0x3E8); } } @@ -1225,13 +1225,13 @@ void BossSst_HandSetupWait(BossSst* this) { this->actionFunc = BossSst_HandWait; } -void BossSst_HandWait(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandWait(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, 20.0f); Math_StepToF(&this->actor.world.pos.x, this->actor.home.pos.x, 1.0f); Math_StepToF(&this->actor.world.pos.z, this->actor.home.pos.z, 1.0f); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; @@ -1257,7 +1257,7 @@ void BossSst_HandSetupDownbeat(BossSst* this) { this->actionFunc = BossSst_HandDownbeat; } -void BossSst_HandDownbeat(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDownbeat(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1297,7 +1297,7 @@ void BossSst_HandSetupDownbeatEnd(BossSst* this) { this->actionFunc = BossSst_HandDownbeatEnd; } -void BossSst_HandDownbeatEnd(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDownbeatEnd(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1320,7 +1320,7 @@ void BossSst_HandSetupOffbeat(BossSst* this) { this->actionFunc = BossSst_HandOffbeat; } -void BossSst_HandOffbeat(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandOffbeat(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1349,7 +1349,7 @@ void BossSst_HandSetupOffbeatEnd(BossSst* this) { this->actionFunc = BossSst_HandOffbeatEnd; } -void BossSst_HandOffbeatEnd(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandOffbeatEnd(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1378,7 +1378,7 @@ void BossSst_HandSetupEndSlam(BossSst* this) { this->actionFunc = BossSst_HandEndSlam; } -void BossSst_HandEndSlam(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandEndSlam(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { BossSst_HandSetupRetreat(this); } @@ -1396,7 +1396,7 @@ void BossSst_HandSetupRetreat(BossSst* this) { this->actor.speedXZ = 3.0f; } -void BossSst_HandRetreat(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandRetreat(BossSst* this, PlayState* play) { f32 diff; s32 inPosition; @@ -1436,7 +1436,7 @@ void BossSst_HandSetupReadySlam(BossSst* this) { this->actionFunc = BossSst_HandReadySlam; } -void BossSst_HandReadySlam(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadySlam(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { if (this->timer != 0) { @@ -1447,7 +1447,7 @@ void BossSst_HandReadySlam(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupSlam(this); } } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (Math_StepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 300.0f, 30.0f) && (this->actor.xzDistToPlayer < 140.0f)) { @@ -1470,7 +1470,7 @@ void BossSst_HandSetupSlam(BossSst* this) { this->actionFunc = BossSst_HandSlam; } -void BossSst_HandSlam(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandSlam(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToS(&this->handZPosMod, -0xDAC, 0x1F4); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x1000); @@ -1505,13 +1505,13 @@ void BossSst_HandSlam(BossSst* this, GlobalContext* globalCtx) { } if (this->colliderJntSph.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->actor.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 100.0f) + this->actor.world.pos.x; player->actor.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 100.0f) + this->actor.world.pos.z; this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200); @@ -1527,7 +1527,7 @@ void BossSst_HandSetupReadySweep(BossSst* this) { this->actionFunc = BossSst_HandReadySweep; } -void BossSst_HandReadySweep(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadySweep(BossSst* this, PlayState* play) { s32 inPosition; SkelAnime_Update(&this->skelAnime); @@ -1556,8 +1556,8 @@ void BossSst_HandSetupSweep(BossSst* this) { this->actionFunc = BossSst_HandSweep; } -void BossSst_HandSweep(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandSweep(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 newTargetYaw; SkelAnime_Update(&this->skelAnime); @@ -1570,7 +1570,7 @@ void BossSst_HandSweep(BossSst* this, GlobalContext* globalCtx) { } else if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->ready = true; - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); func_8002F7DC(&player->actor, NA_SE_PL_BODY_HIT); newTargetYaw = this->actor.shape.rot.y - (this->vParity * 0x1400); if (((s16)(newTargetYaw - this->targetYaw) * this->vParity) > 0) { @@ -1596,7 +1596,7 @@ void BossSst_HandSetupReadyPunch(BossSst* this) { this->actionFunc = BossSst_HandReadyPunch; } -void BossSst_HandReadyPunch(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyPunch(BossSst* this, PlayState* play) { s32 inPosition = Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x400); if (SkelAnime_Update(&this->skelAnime) && inPosition) { @@ -1613,7 +1613,7 @@ void BossSst_HandSetupPunch(BossSst* this) { this->actionFunc = BossSst_HandPunch; } -void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandPunch(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 80.0f, 20.0f); if (Math_ScaledStepToS(&this->actor.shape.rot.z, this->targetRoll, 0x400)) { @@ -1628,8 +1628,8 @@ void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 8) { BossSst_HandSetupRetreat(this); } else if (this->colliderJntSph.base.atFlags & AT_HIT) { - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); + func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); BossSst_HandSetupRetreat(this); } @@ -1653,7 +1653,7 @@ void BossSst_HandSetupReadyClap(BossSst* this) { this->actionFunc = BossSst_HandReadyClap; } -void BossSst_HandReadyClap(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyClap(BossSst* this, PlayState* play) { if (this->timer != 0) { if (this->timer != 0) { this->timer--; @@ -1690,9 +1690,9 @@ void BossSst_HandSetupClap(BossSst* this) { this->actionFunc = BossSst_HandClap; } -void BossSst_HandClap(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandClap(BossSst* this, PlayState* play) { static s32 dropFlag = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -1702,19 +1702,19 @@ void BossSst_HandClap(BossSst* this, GlobalContext* globalCtx) { if (this->timer == 0) { if (dropFlag) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, (Rand_ZeroOne() < 0.5f) ? ITEM00_ARROWS_SMALL : ITEM00_MAGIC_SMALL); dropFlag = false; } - BossSst_HandReleasePlayer(this, globalCtx, true); + BossSst_HandReleasePlayer(this, play, true); BossSst_HandSetupEndClap(this); } } else { if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); OTHER_HAND(this)->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - BossSst_HandGrabPlayer(this, globalCtx); + BossSst_HandGrabPlayer(this, play); } if (this->ready) { @@ -1754,7 +1754,7 @@ void BossSst_HandSetupEndClap(BossSst* this) { this->actionFunc = BossSst_HandEndClap; } -void BossSst_HandEndClap(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandEndClap(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.z, 0, 0x200); if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 0x100)) { @@ -1772,7 +1772,7 @@ void BossSst_HandSetupReadyGrab(BossSst* this) { this->actionFunc = BossSst_HandReadyGrab; } -void BossSst_HandReadyGrab(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyGrab(BossSst* this, PlayState* play) { s32 inPosition; SkelAnime_Update(&this->skelAnime); @@ -1794,8 +1794,8 @@ void BossSst_HandSetupGrab(BossSst* this) { this->actionFunc = BossSst_HandGrab; } -void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandGrab(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; @@ -1816,7 +1816,7 @@ void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupSwing(this); } } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, (Rand_ZeroOne() < 0.5f) ? ITEM00_ARROWS_SMALL : ITEM00_MAGIC_SMALL); BossSst_HandSetupRetreat(this); } @@ -1830,7 +1830,7 @@ void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx) { if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); Audio_PlayActorSound2(&this->actor, NA_SE_EN_SHADEST_CATCH); - BossSst_HandGrabPlayer(this, globalCtx); + BossSst_HandGrabPlayer(this, play); this->timer = CLAMP_MAX(this->timer, 5); } @@ -1849,8 +1849,8 @@ void BossSst_HandSetupCrush(BossSst* this) { this->actionFunc = BossSst_HandCrush; } -void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandCrush(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -1858,7 +1858,7 @@ void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx) { } if (!(player->stateFlags2 & 0x80)) { - BossSst_HandReleasePlayer(this, globalCtx, true); + BossSst_HandReleasePlayer(this, play, true); BossSst_HandSetupEndCrush(this); } else { player->actor.world.pos = this->actor.world.pos; @@ -1870,7 +1870,7 @@ void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx) { func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S); } - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_SHADEST_CATCH); @@ -1883,7 +1883,7 @@ void BossSst_HandSetupEndCrush(BossSst* this) { this->actionFunc = BossSst_HandEndCrush; } -void BossSst_HandEndCrush(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandEndCrush(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { BossSst_HandSetupRetreat(this); } @@ -1898,8 +1898,8 @@ void BossSst_HandSetupSwing(BossSst* this) { this->actionFunc = BossSst_HandSwing; } -void BossSst_HandSwing(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandSwing(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 offXZ; if (Math_ScaledStepToS(&this->actor.shape.rot.x, this->amplitude, this->timer * 0xE4 + 0x1C8)) { @@ -1944,10 +1944,10 @@ void BossSst_HandSwing(BossSst* this, GlobalContext* globalCtx) { if ((this->timer == 4) && (this->amplitude == 0) && SkelAnime_Update(&this->skelAnime) && (player->stateFlags2 & 0x80)) { - BossSst_HandReleasePlayer(this, globalCtx, false); + BossSst_HandReleasePlayer(this, play, false); player->actor.world.pos.x += 70.0f * Math_SinS(this->actor.shape.rot.y); player->actor.world.pos.z += 70.0f * Math_CosS(this->actor.shape.rot.y); - func_8002F71C(globalCtx, &this->actor, 15.0f, this->actor.shape.rot.y, 2.0f); + func_8002F71C(play, &this->actor, 15.0f, this->actor.shape.rot.y, 2.0f); func_8002F7DC(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1963,7 +1963,7 @@ void BossSst_HandSetupReel(BossSst* this) { this->actionFunc = BossSst_HandReel; } -void BossSst_HandReel(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReel(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -1996,7 +1996,7 @@ void BossSst_HandSetupReadyShake(BossSst* this) { this->actionFunc = BossSst_HandReadyShake; } -void BossSst_HandReadyShake(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyShake(BossSst* this, PlayState* play) { f32 diff; s32 inPosition; @@ -2021,7 +2021,7 @@ void BossSst_HandSetupShake(BossSst* this) { this->actionFunc = BossSst_HandShake; } -void BossSst_HandShake(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandShake(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -2053,7 +2053,7 @@ void BossSst_HandSetupReadyCharge(BossSst* this) { this->actionFunc = BossSst_HandReadyCharge; } -void BossSst_HandReadyCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyCharge(BossSst* this, PlayState* play) { if (!this->ready) { this->ready = SkelAnime_Update(&this->skelAnime); this->ready &= Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800); @@ -2069,8 +2069,8 @@ void BossSst_HandReadyCharge(BossSst* this, GlobalContext* globalCtx) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); OTHER_HAND(this)->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHead->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); } } @@ -2087,7 +2087,7 @@ void BossSst_HandSetupStunned(BossSst* hand) { hand->actionFunc = BossSst_HandStunned; } -void BossSst_HandStunned(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandStunned(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.z, (Math_CosS(sHead->actor.shape.rot.y) * 200.0f) + this->actor.home.pos.z, 0.5f, 25.0f); @@ -2115,7 +2115,7 @@ void BossSst_HandSetupDamage(BossSst* hand) { hand->actionFunc = BossSst_HandDamage; } -void BossSst_HandDamage(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDamage(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2153,7 +2153,7 @@ void BossSst_HandSetupThrash(BossSst* this) { this->actionFunc = BossSst_HandThrash; } -void BossSst_HandThrash(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandThrash(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2191,7 +2191,7 @@ void BossSst_HandSetupDarken(BossSst* this) { this->actionFunc = BossSst_HandDarken; } -void BossSst_HandDarken(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDarken(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x800, this->handAngSpeed); Math_StepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 90.0f, 5.0f); @@ -2205,7 +2205,7 @@ void BossSst_HandSetupFall(BossSst* this) { this->actionFunc = BossSst_HandFall; } -void BossSst_HandFall(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandFall(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x400); this->actor.world.pos.y = sHead->actor.world.pos.y + 230.0f; @@ -2221,7 +2221,7 @@ void BossSst_HandSetupMelt(BossSst* this) { this->actionFunc = BossSst_HandMelt; } -void BossSst_HandMelt(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandMelt(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2242,7 +2242,7 @@ void BossSst_HandSetupFinish(BossSst* this) { this->actionFunc = BossSst_HandFinish; } -void BossSst_HandFinish(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandFinish(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2258,7 +2258,7 @@ void BossSst_HandSetupRecover(BossSst* this) { this->actionFunc = BossSst_HandRecover; } -void BossSst_HandRecover(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandRecover(BossSst* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 250.0f, 0.5f, 70.0f, 5.0f); if (SkelAnime_Update(&this->skelAnime)) { if (!this->ready) { @@ -2288,7 +2288,7 @@ void BossSst_HandSetupFrozen(BossSst* this) { this->actionFunc = BossSst_HandFrozen; } -void BossSst_HandFrozen(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandFrozen(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2335,7 +2335,7 @@ void BossSst_HandSetupReadyBreakIce(BossSst* this) { this->actionFunc = BossSst_HandReadyBreakIce; } -void BossSst_HandReadyBreakIce(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyBreakIce(BossSst* this, PlayState* play) { s32 inPosition; inPosition = Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 0x400); @@ -2357,7 +2357,7 @@ void BossSst_HandSetupBreakIce(BossSst* this) { this->actor.speedXZ = 0.5f; } -void BossSst_HandBreakIce(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandBreakIce(BossSst* this, PlayState* play) { if ((this->timer % 2) != 0) { this->actor.speedXZ *= 1.5f; this->actor.speedXZ = CLAMP_MAX(this->actor.speedXZ, 60.0f); @@ -2395,10 +2395,10 @@ void BossSst_HandBreakIce(BossSst* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_SHADEST_HAND_FLY - SFX_FLAG); } -void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandGrabPlayer(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; if (player->actor.colChkInfo.health > 0) { this->colliderJntSph.base.ocFlags1 &= ~OC1_ON; @@ -2409,8 +2409,8 @@ void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx) { } } -void BossSst_HandReleasePlayer(BossSst* this, GlobalContext* globalCtx, s32 dropPlayer) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer) { + Player* player = GET_PLAYER(play); if (player->actor.parent == &this->actor) { player->actor.parent = NULL; @@ -2418,7 +2418,7 @@ void BossSst_HandReleasePlayer(BossSst* this, GlobalContext* globalCtx, s32 drop this->colliderJntSph.base.ocFlags1 |= OC1_ON; OTHER_HAND(this)->colliderJntSph.base.ocFlags1 |= OC1_ON; if (dropPlayer) { - func_8002F71C(globalCtx, &this->actor, 0.0f, this->actor.shape.rot.y, 0.0f); + func_8002F71C(play, &this->actor, 0.0f, this->actor.shape.rot.y, 0.0f); } } } @@ -2507,7 +2507,7 @@ void BossSst_HeadSfx(BossSst* this, u16 sfxId) { func_80078914(&this->center, sfxId); } -void BossSst_HandCollisionCheck(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandCollisionCheck(BossSst* this, PlayState* play) { if ((this->colliderJntSph.base.acFlags & AC_HIT) && (this->colliderJntSph.base.colType != COLTYPE_HARD)) { s32 bothHands = true; @@ -2516,9 +2516,9 @@ void BossSst_HandCollisionCheck(BossSst* this, GlobalContext* globalCtx) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->colliderJntSph.base.acFlags &= ~AC_ON; this->colliderJntSph.base.ocFlags1 &= ~OC1_NO_PUSH; - BossSst_HandReleasePlayer(this, globalCtx, true); + BossSst_HandReleasePlayer(this, play, true); if (HAND_STATE(OTHER_HAND(this)) == HAND_CLAP) { - BossSst_HandReleasePlayer(OTHER_HAND(this), globalCtx, true); + BossSst_HandReleasePlayer(OTHER_HAND(this), play, true); BossSst_HandSetupRetreat(OTHER_HAND(this)); } @@ -2533,21 +2533,21 @@ void BossSst_HandCollisionCheck(BossSst* this, GlobalContext* globalCtx) { } BossSst_HeadSetupDamagedHand(sHead, bothHands); - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, (Rand_ZeroOne() < 0.5f) ? ITEM00_ARROWS_SMALL : ITEM00_MAGIC_SMALL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_SHADEST_DAMAGE_HAND); } } } -void BossSst_HeadCollisionCheck(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadCollisionCheck(BossSst* this, PlayState* play) { if (this->colliderCyl.base.acFlags & AC_HIT) { this->colliderCyl.base.acFlags &= ~AC_HIT; if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (this->actionFunc == BossSst_HeadVulnerable) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); - BossSst_HeadSetupDeath(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + BossSst_HeadSetupDeath(this, play); } else { BossSst_HeadSetupDamage(this); } @@ -2569,7 +2569,7 @@ void BossSst_HeadCollisionCheck(BossSst* this, GlobalContext* globalCtx) { } } -void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_UpdateHand(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; BossSstHandTrail* trail; @@ -2584,25 +2584,25 @@ void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx) { } } - BossSst_HandCollisionCheck(this, globalCtx); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 130.0f, 0.0f, 5); + BossSst_HandCollisionCheck(this, play); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 130.0f, 0.0f, 5); Actor_SetFocus(&this->actor, 0.0f); if (this->colliderJntSph.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } if ((sHead->actionFunc != BossSst_HeadLurk) && (sHead->actionFunc != BossSst_HeadIntro) && (this->colliderJntSph.base.acFlags & AC_ON)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->colliderJntSph.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->colliderCyl.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCyl.base); } if ((HAND_STATE(this) != HAND_DEATH) && (HAND_STATE(this) != HAND_WAIT) && (HAND_STATE(this) != HAND_BEAT) && @@ -2621,10 +2621,10 @@ void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx) { trail->yRotMod = this->handYRotMod; this->trailIndex = (this->trailIndex + 1) % 7; - BossSst_UpdateEffect(&this->actor, globalCtx); + BossSst_UpdateEffect(&this->actor, play); } -void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_UpdateHead(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; @@ -2634,10 +2634,10 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { sHandYawOffsets[LEFT] = sHands[LEFT]->actor.shape.rot.y - thisx->shape.rot.y; sHandYawOffsets[RIGHT] = sHands[RIGHT]->actor.shape.rot.y - thisx->shape.rot.y; - BossSst_HeadCollisionCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + BossSst_HeadCollisionCheck(this, play); + this->actionFunc(this, play); if (this->vVanish) { - if (!globalCtx->actorCtx.lensActive || (thisx->colorFilterTimer != 0)) { + if (!play->actorCtx.lensActive || (thisx->colorFilterTimer != 0)) { this->actor.flags &= ~ACTOR_FLAG_7; } else { this->actor.flags |= ACTOR_FLAG_7; @@ -2645,18 +2645,18 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { } if (this->colliderJntSph.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } if ((this->actionFunc != BossSst_HeadLurk) && (this->actionFunc != BossSst_HeadIntro)) { if (this->colliderCyl.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->colliderJntSph.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } BossSst_MoveAround(this); @@ -2673,10 +2673,10 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { BossSst_HeadSfx(this, NA_SE_EN_SHADEST_MOVE - SFX_FLAG); } - BossSst_UpdateEffect(&this->actor, globalCtx); + BossSst_UpdateEffect(&this->actor, play); } -s32 BossSst_OverrideHandDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossSst_OverrideHandDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossSst* this = (BossSst*)thisx; @@ -2687,13 +2687,13 @@ s32 BossSst_OverrideHandDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void BossSst_PostHandDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossSst_PostHandDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossSst* this = (BossSst*)thisx; Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); } -s32 BossSst_OverrideHandTrailDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossSst_OverrideHandTrailDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data, Gfx** gfx) { BossSstHandTrail* trail = (BossSstHandTrail*)data; @@ -2704,12 +2704,12 @@ s32 BossSst_OverrideHandTrailDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_DrawHand(Actor* thisx, PlayState* play) { BossSst* this = (BossSst*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x80, sBodyColor.r, sBodyColor.g, sBodyColor.b, 255); @@ -2720,7 +2720,7 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, sBodyStaticDList); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHandDraw, BossSst_PostHandDraw, this); if (this->trailCount >= 2) { BossSstHandTrail* trail; @@ -2730,7 +2730,7 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { s32 end; s32 pad; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); end = this->trailCount >> 1; idx = (this->trailIndex + 4) % 7; @@ -2749,7 +2749,7 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, ((3 - i) * 10) + 20, 0, ((3 - i) * 20) + 50, ((3 - i) * 30) + 70); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHandTrailDraw, NULL, trail, POLY_XLU_DISP); @@ -2761,12 +2761,12 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - BossSst_DrawEffect(&this->actor, globalCtx); + BossSst_DrawEffect(&this->actor, play); } -s32 BossSst_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 BossSst_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { BossSst* this = (BossSst*)thisx; s32 shakeAmp; @@ -2842,7 +2842,7 @@ s32 BossSst_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void BossSst_PostHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void BossSst_PostHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Vec3f headVec = { 1000.0f, 0.0f, 0.0f }; BossSst* this = (BossSst*)thisx; @@ -2859,14 +2859,14 @@ void BossSst_PostHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); } -void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_DrawHead(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x80, sBodyColor.r, sBodyColor.g, sBodyColor.b, 255); if (!sBodyStatic) { gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); @@ -2875,7 +2875,7 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, sBodyStaticDList); } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 255, 255, 255, 255); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[2]); } @@ -2893,11 +2893,11 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { } if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, this, POLY_OPA_DISP); } else { - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, this, POLY_XLU_DISP); } @@ -2907,7 +2907,7 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { Vec3f vanishMaskPos; Vec3f vanishMaskOffset; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 0, 0, 18, 255); yOffset = 113 * 8 - this->timer * 8; @@ -2918,20 +2918,20 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { vanishMaskPos.y = 450.0f; } - Matrix_MultVec3fExt(&vanishMaskPos, &vanishMaskOffset, &globalCtx->billboardMtxF); + Matrix_MultVec3fExt(&vanishMaskPos, &vanishMaskOffset, &play->billboardMtxF); Matrix_Translate(this->actor.world.pos.x + vanishMaskOffset.x, this->actor.world.pos.y + vanishMaskOffset.y, this->actor.world.pos.z + vanishMaskOffset.z, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sIntroVanishDList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &this->center); - BossSst_DrawEffect(&this->actor, globalCtx); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->actor.focus.pos, &this->center); + BossSst_DrawEffect(&this->actor, play); } void BossSst_SpawnHeadShadow(BossSst* this) { @@ -3097,7 +3097,7 @@ void BossSst_IceShatter(BossSst* this) { } } -void BossSst_UpdateEffect(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_UpdateEffect(Actor* thisx, PlayState* play) { BossSst* this = (BossSst*)thisx; BossSstEffect* effect; s32 i; @@ -3141,7 +3141,7 @@ void BossSst_UpdateEffect(Actor* thisx, GlobalContext* globalCtx) { effect = &this->effects[0]; if (this->actor.params == BONGO_HEAD) { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &this->center); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->actor.focus.pos, &this->center); BossSst_HeadSfx(this, NA_SE_EN_SHADEST_LAST - SFX_FLAG); } while (effect->status != -1) { @@ -3158,20 +3158,20 @@ void BossSst_UpdateEffect(Actor* thisx, GlobalContext* globalCtx) { } } -void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_DrawEffect(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; s32 i; BossSstEffect* effect; if (this->effectMode != BONGO_NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->effectMode == BONGO_ICE) { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->gameplayFrames % 256, 0x20, 0x10, 1, - 0, (globalCtx->gameplayFrames * 2) % 256, 0x40, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 256, 0x20, 0x10, 1, + 0, (play->gameplayFrames * 2) % 256, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->effects[0].alpha); gSPDisplayList(POLY_XLU_DISP++, gBongoIceCrystalDL); @@ -3180,7 +3180,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (effect->move) { - func_8003435C(&effect->pos, globalCtx); + func_8003435C(&effect->pos, play); if (this->effects[0].status != 0) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); } else { @@ -3192,7 +3192,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZYX(effect->rot.x, effect->rot.y, effect->rot.z, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.001f, effect->scale * 0.001f, effect->scale * 0.001f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBongoIceShardDL); } @@ -3204,8 +3204,8 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 0, 0x20, 0x40, 1, - 0, (globalCtx->gameplayFrames * -15) % 256, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 0, 0x20, 0x40, 1, + 0, (play->gameplayFrames * -15) % 256, 0x20, 0x40)); for (i = 0; i < 3; i++, scaleY -= 0.001f) { effect = &this->effects[i]; @@ -3218,7 +3218,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 30, 0, 30, effect->alpha * effect->move); gDPSetEnvColor(POLY_XLU_DISP++, 30, 0, 30, 0); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); } @@ -3236,7 +3236,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale * 0.001f, 1.0f, effect->scale * 0.001f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sShadowDList); @@ -3245,7 +3245,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h index ea287fb1b..71a53c9f7 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h @@ -6,7 +6,7 @@ struct BossSst; -typedef void (*BossSstActionFunc)(struct BossSst*, GlobalContext*); +typedef void (*BossSstActionFunc)(struct BossSst*, PlayState*); typedef struct { diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index e36ad0c9a..c09dd9fb5 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -20,62 +20,62 @@ typedef enum { /* 0x69 */ TW_DEATHBALL_KOUME } TwinrovaType; -void BossTw_Init(Actor* thisx, GlobalContext* globalCtx); -void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossTw_Update(Actor* thisx, GlobalContext* globalCtx); -void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossTw_Init(Actor* thisx, PlayState* play); +void BossTw_Destroy(Actor* thisx, PlayState* play); +void BossTw_Update(Actor* thisx, PlayState* play); +void BossTw_Draw(Actor* thisx, PlayState* play); void BossTw_Reset(void); -void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 arg2); -void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx); -void BossTw_DrawEffects(GlobalContext* globalCtx); -void BossTw_TwinrovaLaugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaGetUp(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupGetUp(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupLaugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaDoneBlastShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupShootBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupChargeBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaArriveAtTarget(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_CSWait(BossTw* this, GlobalContext* globalCtx); -void BossTw_DeathCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupMergeCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_MergeCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_Spin(BossTw* this, GlobalContext* globalCtx); -void BossTw_Laugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupLaugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_FinishBeamShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupFinishBeamShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupHitByBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_Wait(BossTw* this, GlobalContext* globalCtx); -void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupShootBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_TurnToPlayer(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx); -void BossTw_TwinrovaDraw(Actor* thisx, GlobalContext* globalCtx); -void BossTw_SetupWait(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupIntroCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupFlyTo(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupCSWait(BossTw* this, GlobalContext* globalCtx); -void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx); -void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx); -void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx); -void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx); -void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx); -void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx); -void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSpin(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaChargeBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupSpin(BossTw* this, GlobalContext* globalCtx); -void BossTw_UpdateEffects(GlobalContext* globalCtx); +void BossTw_TwinrovaDamage(BossTw* this, PlayState* play, u8 arg2); +void BossTw_TwinrovaSetupFly(BossTw* this, PlayState* play); +void BossTw_DrawEffects(PlayState* play); +void BossTw_TwinrovaLaugh(BossTw* this, PlayState* play); +void BossTw_TwinrovaFly(BossTw* this, PlayState* play); +void BossTw_TwinrovaGetUp(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupGetUp(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupLaugh(BossTw* this, PlayState* play); +void BossTw_TwinrovaDoneBlastShoot(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupShootBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupChargeBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaArriveAtTarget(BossTw* this, PlayState* play); +void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play); +void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play); +void BossTw_CSWait(BossTw* this, PlayState* play); +void BossTw_DeathCS(BossTw* this, PlayState* play); +void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupMergeCS(BossTw* this, PlayState* play); +void BossTw_MergeCS(BossTw* this, PlayState* play); +void BossTw_Spin(BossTw* this, PlayState* play); +void BossTw_Laugh(BossTw* this, PlayState* play); +void BossTw_SetupLaugh(BossTw* this, PlayState* play); +void BossTw_FinishBeamShoot(BossTw* this, PlayState* play); +void BossTw_SetupFinishBeamShoot(BossTw* this, PlayState* play); +void BossTw_SetupHitByBeam(BossTw* this, PlayState* play); +void BossTw_HitByBeam(BossTw* this, PlayState* play); +void BossTw_Wait(BossTw* this, PlayState* play); +void BossTw_ShootBeam(BossTw* this, PlayState* play); +void BossTw_FlyTo(BossTw* this, PlayState* play); +void BossTw_SetupShootBeam(BossTw* this, PlayState* play); +void BossTw_TurnToPlayer(BossTw* this, PlayState* play); +void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play); +void BossTw_TwinrovaDraw(Actor* thisx, PlayState* play); +void BossTw_SetupWait(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupIntroCS(BossTw* this, PlayState* play); +void BossTw_SetupFlyTo(BossTw* this, PlayState* play); +void BossTw_SetupCSWait(BossTw* this, PlayState* play); +void BossTw_BlastUpdate(Actor* thisx, PlayState* play); +void BossTw_BlastDraw(Actor* thisx, PlayState* play); +void BossTw_BlastFire(BossTw* this, PlayState* play); +void BossTw_BlastIce(BossTw* this, PlayState* play); +void BossTw_DeathBall(BossTw* this, PlayState* play); +void BossTw_DrawDeathBall(Actor* thisx, PlayState* play); +void BossTw_TwinrovaStun(BossTw* this, PlayState* play); +void BossTw_TwinrovaSpin(BossTw* this, PlayState* play); +void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaChargeBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupSpin(BossTw* this, PlayState* play); +void BossTw_UpdateEffects(PlayState* play); const ActorInit Boss_Tw_InitVars = { ACTOR_BOSS_TW, @@ -195,12 +195,12 @@ static s16 D_8094C87C; static u8 D_8094C87E; BossTwEffect sTwEffects[150]; -void BossTw_AddDotEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, +void BossTw_AddDotEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, s16 args, s16 countLimit) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < countLimit; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < countLimit; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_DOT; eff->pos = *initalPos; @@ -215,12 +215,12 @@ void BossTw_AddDotEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* init } } -void BossTw_AddDmgCloud(GlobalContext* globalCtx, s16 type, Vec3f* initialPos, Vec3f* initalSpeed, Vec3f* accel, +void BossTw_AddDmgCloud(PlayState* play, s16 type, Vec3f* initialPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, s16 alpha, s16 args, s16 countLimit) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < countLimit; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < countLimit; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = type; eff->pos = *initialPos; @@ -235,12 +235,12 @@ void BossTw_AddDmgCloud(GlobalContext* globalCtx, s16 type, Vec3f* initialPos, V } } -void BossTw_AddRingEffect(GlobalContext* globalCtx, Vec3f* initalPos, f32 scale, f32 arg3, s16 alpha, s16 args, +void BossTw_AddRingEffect(PlayState* play, Vec3f* initalPos, f32 scale, f32 arg3, s16 alpha, s16 args, s16 arg6, s16 arg7) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < arg7; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < arg7; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_RING; eff->pos = *initalPos; @@ -258,11 +258,11 @@ void BossTw_AddRingEffect(GlobalContext* globalCtx, Vec3f* initalPos, f32 scale, } } -void BossTw_AddPlayerFreezeEffect(GlobalContext* globalCtx, Actor* target) { +void BossTw_AddPlayerFreezeEffect(PlayState* play, Actor* target) { BossTwEffect* eff; s16 i; - for (eff = globalCtx->specialEffects, i = 0; i < ARRAY_COUNT(sTwEffects); i++, eff++) { + for (eff = play->specialEffects, i = 0; i < ARRAY_COUNT(sTwEffects); i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_PLYR_FRZ; eff->curSpeed = sZeroVector; @@ -282,12 +282,12 @@ void BossTw_AddPlayerFreezeEffect(GlobalContext* globalCtx, Actor* target) { } } -void BossTw_AddFlameEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, +void BossTw_AddFlameEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, s16 args) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) { + for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_FLAME; eff->pos = *initalPos; @@ -303,11 +303,11 @@ void BossTw_AddFlameEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* in } } -void BossTw_AddMergeFlameEffect(GlobalContext* globalCtx, Vec3f* initialPos, f32 scale, f32 dist, s16 args) { +void BossTw_AddMergeFlameEffect(PlayState* play, Vec3f* initialPos, f32 scale, f32 dist, s16 args) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) { + for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_MERGEFLAME; eff->pos = *initialPos; @@ -325,12 +325,12 @@ void BossTw_AddMergeFlameEffect(GlobalContext* globalCtx, Vec3f* initialPos, f32 } } -void BossTw_AddShieldBlastEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, +void BossTw_AddShieldBlastEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, f32 arg5, s16 alpha, s16 args) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) { + for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_SHLD_BLST; eff->pos = *initalPos; @@ -347,17 +347,17 @@ void BossTw_AddShieldBlastEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec } } -void BossTw_AddShieldDeflectEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) { +void BossTw_AddShieldDeflectEffect(PlayState* play, f32 arg1, s16 arg2) { s16 i; s16 j; BossTwEffect* eff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sShieldHitPos = player->bodyPartsPos[15]; sShieldHitYaw = player->actor.shape.rot.y; for (i = 0; i < 8; i++) { - for (eff = globalCtx->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) { + for (eff = play->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_SHLD_DEFL; eff->pos = sShieldHitPos; @@ -377,17 +377,17 @@ void BossTw_AddShieldDeflectEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) } } -void BossTw_AddShieldHitEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) { +void BossTw_AddShieldHitEffect(PlayState* play, f32 arg1, s16 arg2) { s16 i; s16 j; BossTwEffect* eff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sShieldHitPos = player->bodyPartsPos[15]; sShieldHitYaw = player->actor.shape.rot.y; for (i = 0; i < 8; i++) { - for (eff = globalCtx->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) { + for (eff = play->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_SHLD_HIT; eff->pos = sShieldHitPos; @@ -407,8 +407,8 @@ void BossTw_AddShieldHitEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) { } } -void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossTw_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossTw* this = (BossTw*)thisx; s16 i; @@ -422,8 +422,8 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.draw = BossTw_BlastDraw; this->actor.flags &= ~ACTOR_FLAG_0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitBlasts); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitBlasts); if (this->actor.params == TW_FIRE_BLAST || this->actor.params == TW_FIRE_BLAST_GROUND) { this->actionFunc = BossTw_BlastFire; @@ -449,14 +449,14 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->actor, 2.5 * 0.01f); this->actor.colChkInfo.mass = 255; this->actor.colChkInfo.health = 0; - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); if (!sTwInitalized) { sTwInitalized = true; - globalCtx->envCtx.unk_BF = 1; - globalCtx->envCtx.unk_BE = 1; - globalCtx->envCtx.unk_BD = 1; - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_BF = 1; + play->envCtx.unk_BE = 1; + play->envCtx.unk_BD = 1; + play->envCtx.unk_D8 = 0.0f; D_8094C874 = D_8094C876 = D_8094C878 = D_8094C87A = D_8094C87C = D_8094C87E = D_8094C870 = D_8094C86F = D_8094C872 = sBeamDivertTimer = sEnvType = sGroundBlastType = sFreezeState = sTwinrovaBlastType = @@ -464,7 +464,7 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { D_8094C858 = D_8094C854 = 0.0f; sFixedBlastType = Rand_ZeroFloat(1.99f); - globalCtx->specialEffects = sTwEffects; + play->specialEffects = sTwEffects; for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { sTwEffects[i].type = TWEFF_NONE; @@ -473,55 +473,55 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { } if (this->actor.params == TW_KOTAKE) { - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitKoumeKotake); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitKoumeKotake); this->actor.naviEnemyId = 0x33; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tw_Skel_0070E0, &object_tw_Anim_006F28, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tw_Skel_0070E0, &object_tw_Anim_006F28, NULL, NULL, 0); if (gSaveContext.eventChkInf[7] & 0x20) { // began twinrova battle - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); this->actor.world.pos.x = -600.0f; this->actor.world.pos.y = 400.0f; this->actor.world.pos.z = 0.0f; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } else { - BossTw_SetupCSWait(this, globalCtx); + BossTw_SetupCSWait(this, play); } Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_006F28, -3.0f); this->visible = true; } else if (this->actor.params == TW_KOUME) { - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitKoumeKotake); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitKoumeKotake); this->actor.naviEnemyId = 0x32; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tw_Skel_01F888, &object_tw_Anim_006F28, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tw_Skel_01F888, &object_tw_Anim_006F28, NULL, NULL, 0); if (gSaveContext.eventChkInf[7] & 0x20) { // began twinrova battle - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); this->actor.world.pos.x = 600.0f; this->actor.world.pos.y = 400.0f; this->actor.world.pos.z = 0.0f; } else { - BossTw_SetupCSWait(this, globalCtx); + BossTw_SetupCSWait(this, play); } Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_006F28, -3.0f); this->visible = true; } else { // Twinrova - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitTwinrova); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitTwinrova); this->actor.naviEnemyId = 0x5B; this->actor.colChkInfo.health = 24; this->actor.update = BossTw_TwinrovaUpdate; this->actor.draw = BossTw_TwinrovaDraw; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tw_Skel_032020, &object_tw_Anim_0244B4, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tw_Skel_032020, &object_tw_Anim_0244B4, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_0244B4, -3.0f); if (gSaveContext.eventChkInf[7] & 0x20) { // began twinrova battle - BossTw_SetupWait(this, globalCtx); + BossTw_SetupWait(this, play); } else { - BossTw_TwinrovaSetupIntroCS(this, globalCtx); + BossTw_TwinrovaSetupIntroCS(this, play); this->actor.world.pos.x = 0.0f; this->actor.world.pos.y = 1000.0f; this->actor.world.pos.z = 0.0f; @@ -530,17 +530,17 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.params = TW_TWINROVA; sTwinrovaPtr = this; - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // twinrova has been defeated. Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -600.0f, 230.0f, 0.0f, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -600.0f, 230.0f, 0.0f, 0, 0, 0, 0); } else { - sKotakePtr = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, + sKotakePtr = (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_KOTAKE); - sKoumePtr = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, + sKoumePtr = (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_KOUME); sKotakePtr->actor.parent = &sKoumePtr->actor; @@ -548,19 +548,19 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - this->fogR = globalCtx->lightCtx.fogColor[0]; - this->fogG = globalCtx->lightCtx.fogColor[1]; - this->fogB = globalCtx->lightCtx.fogColor[2]; - this->fogNear = globalCtx->lightCtx.fogNear; + this->fogR = play->lightCtx.fogColor[0]; + this->fogG = play->lightCtx.fogColor[1]; + this->fogB = play->lightCtx.fogColor[2]; + this->fogNear = play->lightCtx.fogNear; this->fogFar = 1000.0f; } -void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossTw_Destroy(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (thisx->params < TW_FIRE_BLAST) { - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } if (thisx->params == TW_TWINROVA) { @@ -568,7 +568,7 @@ void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void BossTw_SetupTurnToPlayer(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupTurnToPlayer(BossTw* this, PlayState* play) { BossTw* otherTw = (BossTw*)this->actor.parent; this->actionFunc = BossTw_TurnToPlayer; @@ -582,7 +582,7 @@ void BossTw_SetupTurnToPlayer(BossTw* this, GlobalContext* globalCtx) { this->rotateSpeed = 0.0f; } -void BossTw_TurnToPlayer(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TurnToPlayer(BossTw* this, PlayState* play) { BossTw* otherTw = (BossTw*)this->actor.parent; SkelAnime_Update(&this->skelAnime); @@ -595,15 +595,15 @@ void BossTw_TurnToPlayer(BossTw* this, GlobalContext* globalCtx) { if (this->timers[0] == 0) { if ((otherTw->actionFunc != BossTw_ShootBeam) && this->work[CAN_SHOOT]) { this->work[CAN_SHOOT] = false; - BossTw_SetupShootBeam(this, globalCtx); + BossTw_SetupShootBeam(this, play); this->actor.speedXZ = 0.0f; } else { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } } -void BossTw_SetupFlyTo(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupFlyTo(BossTw* this, PlayState* play) { static Vec3f sPillarPositions[] = { { 600.0f, 400.0f, 0.0f }, { 0.0f, 400.0f, 600.0f }, { -600.0f, 400.0f, 0.0f }, { 0.0f, 400.0f, -600.0f } }; @@ -636,7 +636,7 @@ void BossTw_SetupFlyTo(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx) { +void BossTw_FlyTo(BossTw* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -666,12 +666,12 @@ void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); if ((this->timers[0] == 0) || (xzDist < 70.0f)) { - BossTw_SetupTurnToPlayer(this, globalCtx); + BossTw_SetupTurnToPlayer(this, play); } } -void BossTw_SetupShootBeam(BossTw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossTw_SetupShootBeam(BossTw* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actionFunc = BossTw_ShootBeam; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_007688, -5.0f); @@ -692,7 +692,7 @@ void BossTw_SetupShootBeam(BossTw* this, GlobalContext* globalCtx) { this->updateRate2 = 0.0f; } -void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastType) { +void BossTw_SpawnGroundBlast(BossTw* this, PlayState* play, s16 blastType) { BossTw* groundBlast; s16 i; Vec3f pos; @@ -707,12 +707,12 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy accel.x = Rand_CenteredFloat(0.25f); accel.z = Rand_CenteredFloat(0.25f); pos = this->groundBlastPos; - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, blastType, 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, blastType, 75); } if (blastType == 1) { sGroundBlastType = 1; - groundBlast = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, + groundBlast = (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->groundBlastPos.x, this->groundBlastPos.y, this->groundBlastPos.z, 0, 0, 0, TW_FIRE_BLAST_GROUND); if (groundBlast != NULL) { @@ -729,7 +729,7 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy } } else { sGroundBlastType = 2; - groundBlast = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, + groundBlast = (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->groundBlastPos.x, this->groundBlastPos.y, this->groundBlastPos.z, 0, 0, 0, TW_ICE_BLAST_GROUND); if (groundBlast != NULL) { @@ -750,10 +750,10 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy } } -s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { +s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { Vec3f offset; Vec3f beamDistFromPlayer; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; offset.x = player->actor.world.pos.x - this->beamOrigin.x; @@ -769,7 +769,7 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { if (sTwinrovaPtr->timers[2] == 0) { sTwinrovaPtr->timers[2] = 150; this->beamDist = sqrtf(SQ(offset.x) + SQ(offset.y) + SQ(offset.z)); - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.shape.rot.y, 0.0f, 0x20); + func_8002F6D4(play, &this->actor, 3.0f, this->actor.shape.rot.y, 0.0f, 0x20); if (this->actor.params == 0) { if (sFreezeState == 0) { @@ -796,10 +796,10 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { * returns 1 if the beam will be reflected, * and returns 2 if the beam will be diverted backwards */ -s32 BossTw_CheckBeamReflection(BossTw* this, GlobalContext* globalCtx) { +s32 BossTw_CheckBeamReflection(BossTw* this, PlayState* play) { Vec3f offset; Vec3f vec; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x400000 && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) < 0x2000 && @@ -829,7 +829,7 @@ s32 BossTw_CheckBeamReflection(BossTw* this, GlobalContext* globalCtx) { // and the distance from the beams origin to 10 units in front of link is less than the beams // current distance (the distance of the beam is equal to or longer than the distance to 10 units // in front of link) - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { // player has mirror shield equipped this->beamDist = sqrtf(SQ(offset.x) + SQ(offset.y) + SQ(offset.z)); return 1; @@ -842,8 +842,8 @@ s32 BossTw_CheckBeamReflection(BossTw* this, GlobalContext* globalCtx) { if (sBeamDivertTimer == 0) { // beam hit the shield, normal shield equipped, // divert the beam backwards from link's Y rotation - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, this->actor.params); - globalCtx->envCtx.unk_D8 = 1.0f; + BossTw_AddShieldDeflectEffect(play, 10.0f, this->actor.params); + play->envCtx.unk_D8 = 1.0f; this->timers[0] = 10; func_80078884(NA_SE_IT_SHIELD_REFLECT_MG2); } @@ -924,7 +924,7 @@ f32 BossTw_GetFloorY(Vec3f* pos) { return -100.0f; } -void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { +void BossTw_ShootBeam(BossTw* this, PlayState* play) { s16 i; f32 xDiff; f32 yDiff; @@ -932,9 +932,9 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { f32 floorY; Vec3f sp130; Vec3s sp128; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); BossTw* otherTw = (BossTw*)this->actor.parent; - Input* input = &globalCtx->state.input[0]; + Input* input = &play->state.input[0]; Math_ApproachF(&this->actor.world.pos.y, 400.0f, 0.05f, this->actor.speedXZ); Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 0.25f); @@ -964,8 +964,8 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { if (this->timers[1] < 50) { if (this->timers[1] < 10) { if (this->timers[1] == 9) { - globalCtx->envCtx.unk_D8 = 0.5f; - globalCtx->envCtx.unk_BD = 3 - this->actor.params; + play->envCtx.unk_D8 = 0.5f; + play->envCtx.unk_BD = 3 - this->actor.params; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_MASIC_SET); } @@ -990,7 +990,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->actor.params); } } @@ -1055,7 +1055,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { break; case 0: if (this->timers[0] != 0) { - s32 beamReflection = BossTw_CheckBeamReflection(this, globalCtx); + s32 beamReflection = BossTw_CheckBeamReflection(this, play); if (beamReflection == 1) { Vec3f pos; @@ -1067,7 +1067,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { velocity.y = Rand_CenteredFloat(15.0f); velocity.z = Rand_CenteredFloat(15.0f); pos = player->bodyPartsPos[15]; - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 5, + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 5, this->actor.params, 150); } @@ -1081,10 +1081,10 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->groundBlastPos.x = 0.0f; this->groundBlastPos.y = 0.0f; this->groundBlastPos.z = 0.0f; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; func_800AA000(0.0f, 0x64, 5, 4); } else if (beamReflection == 0) { - BossTw_BeamHitPlayerCheck(this, globalCtx); + BossTw_BeamHitPlayerCheck(this, play); if (this->csState1 == 0) { Math_ApproachF(&this->beamDist, 2.0f * sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff)), 1.0f, @@ -1093,7 +1093,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->beamReflectionOrigin, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->beamReflectionOrigin, &this->unk_54C, &this->actor.projectedW); if (this->actor.params == 1) { @@ -1107,7 +1107,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { case 1: if (CHECK_BTN_ALL(input->cur.button, BTN_R)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->beamDist = sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff)); Math_ApproachF(&this->beamReflectionDist, 2000.0f, 1.0f, 40.0f); @@ -1115,7 +1115,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->targetPos.y, player->bodyPartsPos[15].y, 1.0f, 400.0f); Math_ApproachF(&this->targetPos.z, player->bodyPartsPos[15].z, 1.0f, 400.0f); if ((this->work[CS_TIMER_1] % 4) == 0) { - BossTw_AddRingEffect(globalCtx, &player->bodyPartsPos[15], 0.5f, 3.0f, 0xFF, this->actor.params, + BossTw_AddRingEffect(play, &player->bodyPartsPos[15], 0.5f, 3.0f, 0xFF, this->actor.params, 1, 150); } } else { @@ -1123,7 +1123,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->beamReflectionDist = 0.0f; } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->unk_530, &this->unk_558, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->unk_530, &this->unk_558, &this->actor.projectedW); if (this->actor.params == 1) { @@ -1148,7 +1148,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->beamScale, 0.0f, 1.0f, 0.0005f); if (this->beamScale == 0.0f) { - BossTw_SetupFinishBeamShoot(this, globalCtx); + BossTw_SetupFinishBeamShoot(this, play); this->beamReflectionDist = 0.0f; this->beamDist = 0.0f; } @@ -1172,7 +1172,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->csState1 = 1; this->groundBlastPos.x = this->beamReflectionOrigin.x; this->groundBlastPos.z = this->beamReflectionOrigin.z; - BossTw_SpawnGroundBlast(this, globalCtx, this->actor.params); + BossTw_SpawnGroundBlast(this, play, this->actor.params); this->timers[0] = 20; } } @@ -1215,7 +1215,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->csState1 = 1; this->groundBlastPos.x = spBC.x; this->groundBlastPos.z = spBC.z; - BossTw_SpawnGroundBlast(this, globalCtx, this->actor.params); + BossTw_SpawnGroundBlast(this, play, this->actor.params); this->timers[0] = 20; } else { for (i = 0; i < 5; i++) { @@ -1230,12 +1230,12 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &this->unk_530, &velocity, &accel, + BossTw_AddFlameEffect(play, &this->unk_530, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->actor.params); } this->beamReflectionDist = sp130.z; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 0.8f, 1.0f, 0.2f); + Math_ApproachF(&play->envCtx.unk_D8, 0.8f, 1.0f, 0.2f); } break; } @@ -1249,7 +1249,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { } if (BossTw_BeamReflHitCheck(this, &this->actor.world.pos) && (this->work[CS_TIMER_1] % 4) == 0) { - BossTw_AddRingEffect(globalCtx, &this->unk_530, 0.5f, 3.0f, 255, this->actor.params, 1, 150); + BossTw_AddRingEffect(play, &this->unk_530, 0.5f, 3.0f, 255, this->actor.params, 1, 150); } if (BossTw_BeamReflHitCheck(this, &otherTw->actor.world.pos) && otherTw->actionFunc != BossTw_HitByBeam) { @@ -1270,40 +1270,40 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->actor.params); } - BossTw_SetupHitByBeam(otherTw, globalCtx); + BossTw_SetupHitByBeam(otherTw, play); Audio_PlayActorSound2(&otherTw->actor, NA_SE_EN_TWINROBA_DAMAGE_VOICE); - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; otherTw->actor.colChkInfo.health++; } } } -void BossTw_SetupFinishBeamShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupFinishBeamShoot(BossTw* this, PlayState* play) { this->actionFunc = BossTw_FinishBeamShoot; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_004548, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_004548); } -void BossTw_FinishBeamShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_FinishBeamShoot(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->scepterAlpha, 0.0f, 1.0f, 10.0f); if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { if (sTwinrovaPtr->timers[2] == 0) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } else { - BossTw_SetupLaugh(this, globalCtx); + BossTw_SetupLaugh(this, play); } this->scepterAlpha = 0.0f; } } -void BossTw_SetupHitByBeam(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupHitByBeam(BossTw* this, PlayState* play) { this->actionFunc = BossTw_HitByBeam; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_00578C, 0.0f); this->timers[0] = 53; @@ -1314,7 +1314,7 @@ void BossTw_SetupHitByBeam(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { +void BossTw_HitByBeam(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->work[CS_TIMER_1] % 4) == 0) { @@ -1334,7 +1334,7 @@ void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.1f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, this->actor.params + 2, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 15.0f, 0, + BossTw_AddDmgCloud(play, this->actor.params + 2, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 15.0f, 0, 0, 150); } @@ -1351,7 +1351,7 @@ void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 1.0f); this->actor.world.pos.y -= 50.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 4); this->actor.world.pos.y += 50.0f; if (this->actor.bgCheckFlags & 1) { @@ -1364,18 +1364,18 @@ void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { } if ((this->timers[0] == 0) && Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } -void BossTw_SetupLaugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupLaugh(BossTw* this, PlayState* play) { this->actionFunc = BossTw_Laugh; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_0088C8, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_0088C8); this->actor.speedXZ = 0.0f; } -void BossTw_Laugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_Laugh(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -1387,11 +1387,11 @@ void BossTw_Laugh(BossTw* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } -void BossTw_SetupSpin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupSpin(BossTw* this, PlayState* play) { this->actionFunc = BossTw_Spin; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_007CA8, -3.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_007CA8); @@ -1400,7 +1400,7 @@ void BossTw_SetupSpin(BossTw* this, GlobalContext* globalCtx) { this->timers[0] = 20; } -void BossTw_Spin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_Spin(BossTw* this, PlayState* play) { if (this->timers[0] != 0) { this->collider.base.colType = COLTYPE_METAL; this->actor.shape.rot.y -= 0x3000; @@ -1413,61 +1413,61 @@ void BossTw_Spin(BossTw* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2000); if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } } -void BossTw_SetupMergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupMergeCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_MergeCS; this->rotateSpeed = 0.0f; this->actor.speedXZ = 0.0f; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_006F28, -10.0f); } -void BossTw_MergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_MergeCS(BossTw* this, PlayState* play) { Math_ApproachF(&this->scepterAlpha, 0.0f, 1.0f, 10.0f); SkelAnime_Update(&this->skelAnime); } -void BossTw_SetupWait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupWait(BossTw* this, PlayState* play) { this->actionFunc = BossTw_Wait; this->visible = false; this->actor.world.pos.y = -2000.0f; this->actor.flags &= ~ACTOR_FLAG_0; } -void BossTw_Wait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_Wait(BossTw* this, PlayState* play) { if ((this->actor.params == TW_TWINROVA) && (sKoumePtr->actionFunc == BossTw_FlyTo) && (sKotakePtr->actionFunc == BossTw_FlyTo) && ((sKoumePtr->actor.colChkInfo.health + sKotakePtr->actor.colChkInfo.health) >= 4)) { - BossTw_TwinrovaSetupMergeCS(this, globalCtx); - BossTw_SetupMergeCS(sKotakePtr, globalCtx); - BossTw_SetupMergeCS(sKoumePtr, globalCtx); + BossTw_TwinrovaSetupMergeCS(this, play); + BossTw_SetupMergeCS(sKotakePtr, play); + BossTw_SetupMergeCS(sKoumePtr, play); } } -void BossTw_TwinrovaSetupMergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupMergeCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaMergeCS; this->csState2 = 0; this->csState1 = 0; } -void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) { s16 i; Vec3f spB0; Vec3f spA4; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); switch (this->csState2) { case 0: this->csState2 = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 0x39); - this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 0x39); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, 0, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamDist = 800.0f; this->subCamYaw = M_PI; sKoumePtr->actor.world.rot.x = 0; @@ -1482,11 +1482,11 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { // fallthrough case 1: if (this->work[CS_TIMER_2] == 20) { - Message_StartTextbox(globalCtx, 0x6059, NULL); + Message_StartTextbox(play, 0x6059, NULL); } if (this->work[CS_TIMER_2] == 80) { - Message_StartTextbox(globalCtx, 0x605A, NULL); + Message_StartTextbox(play, 0x605A, NULL); } this->subCamAt.x = 0.0f; @@ -1526,9 +1526,9 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { if (this->subCamId != 0) { if (this->unk_5F9 == 0) { - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } else { - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt2, &this->subCamEye2); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt2, &this->subCamEye2); } } @@ -1570,7 +1570,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { pos.x = 3000.0f; pos.y = 400.0f + yOffset; pos.z = 0.0f; - BossTw_AddMergeFlameEffect(globalCtx, &pos, Rand_ZeroFloat(5.0f) + 10.0f, + BossTw_AddMergeFlameEffect(play, &pos, Rand_ZeroFloat(5.0f) + 10.0f, sqrtf(SQ(xScale) - SQ(yOffset)), Rand_ZeroFloat(1.99f)); } @@ -1590,7 +1590,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { pos.y += velocity.y; pos.z += velocity.z; accel.z = accel.y = accel.x = 0.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, velocity.x < 0.0f); } @@ -1598,13 +1598,13 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { this->visible = true; this->actor.flags |= ACTOR_FLAG_0; this->actor.shape.rot.y = 0; - BossTw_SetupWait(sKotakePtr, globalCtx); - BossTw_SetupWait(sKoumePtr, globalCtx); + BossTw_SetupWait(sKotakePtr, play); + BossTw_SetupWait(sKoumePtr, play); Actor_SetScale(&this->actor, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_038E2C, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_038E2C); this->timers[0] = 50; - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } @@ -1620,8 +1620,8 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { } sEnvType = -1; - globalCtx->envCtx.unk_BD = 4; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1, 1, 0.1f); + play->envCtx.unk_BD = 4; + Math_ApproachF(&play->envCtx.unk_D8, 1, 1, 0.1f); // fallthrough case 2: SkelAnime_Update(&this->skelAnime); @@ -1647,7 +1647,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[3] == 19) { - func_8002DF54(globalCtx, &this->actor, 5); + func_8002DF54(play, &this->actor, 5); } if (this->timers[3] == 16) { @@ -1667,36 +1667,36 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[2] == 4) { sEnvType = 0; - globalCtx->envCtx.unk_BE = 5; + play->envCtx.unk_BE = 5; } if (this->timers[2] == 1) { - Camera* cam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* cam = Play_GetCamera(play, MAIN_CAM); cam->eye = this->subCamEye; cam->eyeNext = this->subCamEye; cam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = 0; this->csState2 = this->subCamId; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->work[TW_PLLR_IDX] = 0; this->targetPos = sTwinrovaPillarPos[0]; - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } break; } } -void BossTw_SetupDeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupDeathCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_DeathCS; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_0004A4, -3.0f); this->unk_5F8 = 0; this->work[CS_TIMER_2] = Rand_ZeroFloat(20.0f); } -void BossTw_DeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_DeathCS(BossTw* this, PlayState* play) { if (this->timers[0] == 0) { SkelAnime_Update(&this->skelAnime); } @@ -1713,7 +1713,7 @@ void BossTw_DeathCS(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_SetupCSWait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupCSWait(BossTw* this, PlayState* play) { this->actionFunc = BossTw_CSWait; this->visible = false; this->actor.world.pos.y = -2000.0f; @@ -1723,22 +1723,22 @@ void BossTw_SetupCSWait(BossTw* this, GlobalContext* globalCtx) { /** * Do nothing while waiting for the inital cutscene to start */ -void BossTw_CSWait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_CSWait(BossTw* this, PlayState* play) { } -void BossTw_TwinrovaSetupIntroCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupIntroCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaIntroCS; this->visible = false; this->actor.world.pos.y = -2000.0f; this->actor.flags &= ~ACTOR_FLAG_0; } -void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) { u8 updateCam = 0; s16 i; Vec3f sp90; Vec3f sp84; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->csSfxTimer > 220 && this->csSfxTimer < 630) { func_80078884(NA_SE_EN_TWINROBA_UNARI - SFX_FLAG); @@ -1759,11 +1759,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (SQ(player->actor.world.pos.x) + SQ(player->actor.world.pos.z) < SQ(150.0f)) { player->actor.world.pos.x = player->actor.world.pos.z = .0f; this->csState2 = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 0x39); - this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 0x39); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, 0, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye.x = 0.0f; this->subCamEye.y = 350; this->subCamEye.z = 200; @@ -1796,14 +1796,14 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { updateCam = 1; if (this->work[CS_TIMER_1] == 30) { - Message_StartTextbox(globalCtx, 0x6048, NULL); + Message_StartTextbox(play, 0x6048, NULL); } Math_ApproachF(&this->subCamUpdateRate, 0.01f, 1.0f, 0.0001f); if (this->work[CS_TIMER_1] > 100) { - globalCtx->envCtx.unk_BD = 0; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.03f); + play->envCtx.unk_BD = 0; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.03f); } if (this->work[CS_TIMER_1] == 180) { @@ -1874,7 +1874,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); if (this->work[CS_TIMER_1] == 30) { - Message_StartTextbox(globalCtx, 0x6049, NULL); + Message_StartTextbox(play, 0x6049, NULL); } if (this->work[CS_TIMER_1] > 80) { @@ -1913,11 +1913,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 30) { if (this->work[CS_TIMER_1] < 45) { - globalCtx->envCtx.unk_BE = 0; - globalCtx->envCtx.unk_BD = 2; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BE = 0; + play->envCtx.unk_BD = 2; + play->envCtx.unk_D8 = 1.0f; } else { - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.1f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.1f); } if (this->work[CS_TIMER_1] == 30) { @@ -1931,12 +1931,12 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { velocity.x = Rand_CenteredFloat(20.0f); velocity.y = Rand_CenteredFloat(20.0f); velocity.z = Rand_CenteredFloat(20.0f); - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.0f) + 25.0f, 1); } Audio_PlayActorSound2(&sKoumePtr->actor, NA_SE_EN_TWINROBA_TRANSFORM); - globalCtx->envCtx.unk_D8 = 0; + play->envCtx.unk_D8 = 0; } if (this->work[CS_TIMER_1] >= 35) { @@ -2038,7 +2038,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); if (this->work[CS_TIMER_1] == 30) { - Message_StartTextbox(globalCtx, 0x604A, NULL); + Message_StartTextbox(play, 0x604A, NULL); } if (this->work[CS_TIMER_1] > 80) { @@ -2077,10 +2077,10 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 30) { if (this->work[CS_TIMER_1] < 45) { - globalCtx->envCtx.unk_BD = 3; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_BD = 3; + play->envCtx.unk_D8 = 1.0f; } else { - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.1f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.1f); } if (this->work[CS_TIMER_1] == 30) { @@ -2093,12 +2093,12 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { velocity.x = Rand_CenteredFloat(20.0f); velocity.y = Rand_CenteredFloat(20.0f); velocity.z = Rand_CenteredFloat(20.0f); - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.f) + 25.0f, + BossTw_AddFlameEffect(play, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.f) + 25.0f, 0); } Audio_PlayActorSound2(&sKotakePtr->actor, NA_SE_EN_TWINROBA_TRANSFORM); - globalCtx->envCtx.unk_D8 = 0.0f; + play->envCtx.unk_D8 = 0.0f; } if (this->work[CS_TIMER_1] >= 35) { @@ -2168,8 +2168,8 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { case 20: if (this->work[CS_TIMER_1] > 20 && this->work[CS_TIMER_1] < 120) { - globalCtx->envCtx.unk_BD = 1; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.015f); + play->envCtx.unk_BD = 1; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.015f); } if (this->work[CS_TIMER_1] == 90) { @@ -2178,10 +2178,10 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] == 120) { sEnvType = 0; - globalCtx->envCtx.unk_BE = 1; - globalCtx->envCtx.unk_BD = 1; - globalCtx->envCtx.unk_D8 = 0.0f; - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gTwinrovaTitleCardTex), 160, 180, 128, 40, true); + play->envCtx.unk_BE = 1; + play->envCtx.unk_BD = 1; + play->envCtx.unk_D8 = 0.0f; + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gTwinrovaTitleCardTex), 160, 180, 128, 40, true); gSaveContext.eventChkInf[7] |= 0x20; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } @@ -2234,17 +2234,17 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { } if (this->work[CS_TIMER_1] == 260) { - Camera* cam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* cam = Play_GetCamera(play, MAIN_CAM); cam->eye = this->subCamEye; cam->eyeNext = this->subCamEye; cam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = 0; this->csState2 = this->subCamId; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - BossTw_SetupWait(this, globalCtx); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + BossTw_SetupWait(this, play); } break; } @@ -2265,11 +2265,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { this->subCamAtStep.z * this->subCamUpdateRate); } - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } -void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx) { +void BossTw_DeathBall(BossTw* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -2332,7 +2332,7 @@ void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } -void BossTw_TwinrovaSetupDeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupDeathCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaDeathCS; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_024374, -3.0f); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -2340,13 +2340,13 @@ void BossTw_TwinrovaSetupDeathCS(BossTw* this, GlobalContext* globalCtx) { this->csState2 = this->csState1 = 0; this->work[CS_TIMER_1] = this->work[CS_TIMER_2] = 0; this->work[INVINC_TIMER] = 10000; - BossTw_SetupDeathCS(sKoumePtr, globalCtx); - BossTw_SetupDeathCS(sKotakePtr, globalCtx); + BossTw_SetupDeathCS(sKoumePtr, play); + BossTw_SetupDeathCS(sKotakePtr, play); sKotakePtr->timers[0] = 8; this->workf[UNK_F19] = 1.0f; } -void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { +void BossTw_DeathCSMsgSfx(BossTw* this, PlayState* play) { s32 pad; s32 pad2; s32 pad3; @@ -2499,7 +2499,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { } if (msgId2 != 0) { - Message_StartTextbox(globalCtx, msgId2, NULL); + Message_StartTextbox(play, msgId2, NULL); if (sp35) { D_8094C876 = 10; @@ -2509,7 +2509,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { } if (msgId1 != 0) { - Message_StartTextbox(globalCtx, msgId1, NULL); + Message_StartTextbox(play, msgId1, NULL); } switch (kotakeAnim) { @@ -2583,11 +2583,11 @@ void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) { s16 i; Vec3f spD0; - Player* player = GET_PLAYER(globalCtx); - Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Player* player = GET_PLAYER(play); + Camera* mainCam = Play_GetCamera(play, MAIN_CAM); SkelAnime_Update(&this->skelAnime); this->work[UNK_S8] += 20; @@ -2611,13 +2611,13 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 55) { if (this->work[CS_TIMER_1] == 55) { - globalCtx->envCtx.unk_D8 = 0; + play->envCtx.unk_D8 = 0; } sEnvType = -1; - globalCtx->envCtx.unk_BE = 5; - globalCtx->envCtx.unk_BD = 0; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.015f); + play->envCtx.unk_BE = 5; + play->envCtx.unk_BD = 0; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.015f); Math_ApproachF(&this->actor.scale.x, 0.00024999998f, 0.1f, 0.00005f); this->actor.shape.rot.y += (s16)this->actor.speedXZ; this->workf[UNK_F13] += this->actor.speedXZ; @@ -2639,16 +2639,16 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { spBC.x += spB0.x; spBC.y += spB0.y; spBC.z += spB0.z; - BossTw_AddFlameEffect(globalCtx, &spBC, &spB0, &spA4, Rand_ZeroFloat(2.0f) + 5, + BossTw_AddFlameEffect(play, &spBC, &spB0, &spA4, Rand_ZeroFloat(2.0f) + 5, Rand_ZeroFloat(1.99f)); } this->csState1 = 1; this->visible = false; this->actor.scale.x = 0.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_DEATHBALL_KOUME); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_DEATHBALL_KOTAKE); this->actor.flags &= ~ACTOR_FLAG_0; @@ -2663,11 +2663,11 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { switch (this->csState2) { case 0: this->csState2 = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, 0, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye = mainCam->eye; this->subCamAt = mainCam->at; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); @@ -2703,7 +2703,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { sKoumePtr->actor.world.pos.z = sKotakePtr->actor.world.pos.z; sKoumePtr->work[YAW_TGT] = sKotakePtr->work[YAW_TGT] = sKoumePtr->actor.shape.rot.x = sKotakePtr->actor.shape.rot.x = sKoumePtr->actor.shape.rot.y = sKotakePtr->actor.shape.rot.y = 0; - func_8002DF54(globalCtx, &sKoumePtr->actor, 1); + func_8002DF54(play, &sKoumePtr->actor, 1); sKoumePtr->actor.flags |= ACTOR_FLAG_0; } break; @@ -2722,7 +2722,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { pos.x += velocity.x * 2.0f; pos.y += velocity.y * 2.0f; pos.z += velocity.z * 2.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 1); + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 1); // fake code needed to match, tricks the compiler into allocating more stack if (zero) { @@ -2736,7 +2736,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { pos.x += velocity.x * 2.0f; pos.y += velocity.y * 2.0f; pos.z += velocity.z * 2.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 0); + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 0); } Actor_SetScale(&sKoumePtr->actor, 0.0f); @@ -2751,15 +2751,15 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { } break; case 3: - BossTw_DeathCSMsgSfx(this, globalCtx); + BossTw_DeathCSMsgSfx(this, play); if (this->work[CS_TIMER_2] < 150) { - globalCtx->envCtx.unk_BE = 1; - globalCtx->envCtx.unk_BD = 0; - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.1f); + play->envCtx.unk_BE = 1; + play->envCtx.unk_BD = 0; + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.1f); } else { - globalCtx->envCtx.unk_BE = 1; - globalCtx->envCtx.unk_BD = 6; - Math_ApproachF(&globalCtx->envCtx.unk_D8, (Math_SinS(this->work[CS_TIMER_2] * 4096) / 4.0f) + 0.75f, + play->envCtx.unk_BE = 1; + play->envCtx.unk_BD = 6; + Math_ApproachF(&play->envCtx.unk_D8, (Math_SinS(this->work[CS_TIMER_2] * 4096) / 4.0f) + 0.75f, 1.0f, 0.1f); } @@ -2783,24 +2783,24 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { Actor_SetScale(&sKoumePtr->actor, sKoumePtr->actor.scale.x); Actor_SetScale(&sKotakePtr->actor, sKoumePtr->actor.scale.x); if (this->work[CS_TIMER_2] >= 1020) { - mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam = Play_GetCamera(play, MAIN_CAM); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->csState2 = 4; this->subCamId = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 600.0f, 230.0f, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -600.0f, 230.f, 0.0f, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -600.0f, 230.f, 0.0f, 0, 0, 0, 0); this->actor.world.pos.y = -2000.0f; this->workf[UNK_F18] = 0.0f; sKoumePtr->visible = sKotakePtr->visible = false; if (&this->subCamEye) {} // fixes regalloc, may be fake - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } break; case 4: @@ -2809,7 +2809,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { } if (this->subCamId) { - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -2821,17 +2821,17 @@ static s16 D_8094A90C[] = { 0, 1, 2, 2, 2, 2, 2, 2, 1, }; -void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossTw_Update(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; s32 pad; this->collider.base.colType = COLTYPE_HIT3; - Math_ApproachF(&this->fogR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->fogG, globalCtx->lightCtx.fogColor[1], 1.0f, 10.0f); - Math_ApproachF(&this->fogB, globalCtx->lightCtx.fogColor[2], 1.0f, 10.0f); - Math_ApproachF(&this->fogNear, globalCtx->lightCtx.fogNear, 1.0f, 10.0f); + Math_ApproachF(&this->fogR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->fogG, play->lightCtx.fogColor[1], 1.0f, 10.0f); + Math_ApproachF(&this->fogB, play->lightCtx.fogColor[2], 1.0f, 10.0f); + Math_ApproachF(&this->fogNear, play->lightCtx.fogNear, 1.0f, 10.0f); Math_ApproachF(&this->fogFar, 1000.0f, 1.0f, 10.0f); this->work[CS_TIMER_1]++; this->work[CS_TIMER_2]++; @@ -2861,11 +2861,11 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc == BossTw_TurnToPlayer) { if ((s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) < 0x1000 && (s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) > -0x1000 && player->unk_A73) { - BossTw_SetupSpin(this, globalCtx); + BossTw_SetupSpin(this, play); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != BossTw_Wait) { this->collider.dim.radius = 45; @@ -2883,8 +2883,8 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actor.params == 0) { @@ -2922,7 +2922,7 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params, 37); } } @@ -2935,27 +2935,27 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params, 37); } } } } -void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { +void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) { s16 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossTw* this = (BossTw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->actor.flags &= ~ACTOR_FLAG_10; this->unk_5F8 = 0; this->collider.base.colType = COLTYPE_HIT3; - Math_ApproachF(&this->fogR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->fogG, globalCtx->lightCtx.fogColor[1], 1.0f, 10.0f); - Math_ApproachF(&this->fogB, globalCtx->lightCtx.fogColor[2], 1.0f, 10.0f); - Math_ApproachF(&this->fogNear, globalCtx->lightCtx.fogNear, 1.0f, 10.0f); + Math_ApproachF(&this->fogR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->fogG, play->lightCtx.fogColor[1], 1.0f, 10.0f); + Math_ApproachF(&this->fogB, play->lightCtx.fogColor[2], 1.0f, 10.0f); + Math_ApproachF(&this->fogNear, play->lightCtx.fogNear, 1.0f, 10.0f); Math_ApproachF(&this->fogFar, 1000.0f, 1.0f, 10.0f); this->work[CS_TIMER_1]++; @@ -2975,13 +2975,13 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { this->work[FOG_TIMER]--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != BossTw_TwinrovaShootBlast && this->actionFunc != BossTw_TwinrovaChargeBlast && this->visible && this->unk_5F8 == 0 && (s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) < 0x1000 && (s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) > -0x1000 && player->unk_A73 != 0) { - BossTw_TwinrovaSetupSpin(this, globalCtx); + BossTw_TwinrovaSetupSpin(this, play); } this->eyeTexIdx = D_8094A900[this->work[BLINK_IDX]]; @@ -3036,7 +3036,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { pos.z += Rand_CenteredFloat(30.0f); accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 0, 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 0, 75); } for (i = 0; i < 2; i++) { @@ -3046,7 +3046,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { pos.z += Rand_CenteredFloat(30.0f); accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 1, 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 1, 75); } } @@ -3065,7 +3065,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { if (this->twinrovaStun != 0) { this->twinrovaStun = 0; this->work[FOG_TIMER] = 10; - BossTw_TwinrovaDamage(this, globalCtx, 0); + BossTw_TwinrovaDamage(this, play, 0); Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_YOUNG_DAMAGE); } else if (this->collider.base.acFlags & AC_HIT) { ColliderInfo* info = this->collider.info.acHitInfo; @@ -3093,52 +3093,52 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { damage = 0; } - BossTw_TwinrovaDamage(this, globalCtx, damage); + BossTw_TwinrovaDamage(this, play, damage); } } } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); osSyncPrintf("OooooooooooooooooooooooooooooooooCC\n"); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - globalCtx->envCtx.unk_DC = 2; + play->envCtx.unk_DC = 2; switch (sEnvType) { case 0: - Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.02f); + Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.02f); break; case 1: - globalCtx->envCtx.unk_BD = 3; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 0.5f, 1.0f, 0.05f); + play->envCtx.unk_BD = 3; + Math_ApproachF(&play->envCtx.unk_D8, 0.5f, 1.0f, 0.05f); break; case 2: - globalCtx->envCtx.unk_BD = 2; - Math_ApproachF(&globalCtx->envCtx.unk_D8, (Math_SinS(this->work[CS_TIMER_1] * 0x3000) * 0.03f) + 0.5f, 1.0f, + play->envCtx.unk_BD = 2; + Math_ApproachF(&play->envCtx.unk_D8, (Math_SinS(this->work[CS_TIMER_1] * 0x3000) * 0.03f) + 0.5f, 1.0f, 0.05f); break; case 3: - globalCtx->envCtx.unk_BD = 3; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); + play->envCtx.unk_BD = 3; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); break; case 4: - globalCtx->envCtx.unk_BD = 2; - Math_ApproachF(&globalCtx->envCtx.unk_D8, (Math_SinS(this->work[CS_TIMER_1] * 0x3E00) * 0.05f) + 0.95f, + play->envCtx.unk_BD = 2; + Math_ApproachF(&play->envCtx.unk_D8, (Math_SinS(this->work[CS_TIMER_1] * 0x3E00) * 0.05f) + 0.95f, 1.0f, 0.1f); break; case 5: - globalCtx->envCtx.unk_BD = 0; - Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); + play->envCtx.unk_BD = 0; + Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.05f); break; case -1: break; } - BossTw_UpdateEffects(globalCtx); + BossTw_UpdateEffects(play); if (sFreezeState == 1) { sFreezeState = 2; - BossTw_AddPlayerFreezeEffect(globalCtx, NULL); + BossTw_AddPlayerFreezeEffect(play, NULL); func_80078914(&player->actor.projectedPos, NA_SE_VO_LI_FREEZE); func_80078914(&player->actor.projectedPos, NA_SE_PL_FREEZE); @@ -3152,7 +3152,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 BossTw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 BossTw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossTw* this = (BossTw*)thisx; if (limbIndex == 21) { @@ -3180,7 +3180,7 @@ s32 BossTw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossTw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_8094A944 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_8094A950 = { 0.0f, 2000.0f, -2000.0f }; static Vec3f D_8094A95C[] = { @@ -3189,7 +3189,7 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V }; BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (limbIndex) { case 21: @@ -3197,7 +3197,7 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_8094A950, &this->crownPos); if (this->unk_5F8 != 0) { - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (this->actor.params == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_013AE8)); @@ -3214,7 +3214,7 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_8094A95C[4], &this->scepterFlamePos[4]); if (this->scepterAlpha > 0.0f) { - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (this->actor.params == 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 225, 255, (s16)this->scepterAlpha); @@ -3231,19 +3231,19 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80941BC0(BossTw* this, GlobalContext* globalCtx) { +void func_80941BC0(BossTw* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->groundBlastPos2.x, this->groundBlastPos2.y, this->groundBlastPos2.z, MTXMODE_NEW); Matrix_Scale(this->workf[UNK_F12], this->workf[UNK_F12], this->workf[UNK_F12], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->workf[UNK_F11]); gDPSetEnvColor(POLY_XLU_DISP++, 0, 40, 30, 80); @@ -3251,18 +3251,18 @@ void func_80941BC0(BossTw* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 215, 215, 215, (s16)this->workf[UNK_F11] * this->workf[UNK_F14]); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, (u32)this->workf[UNK_F16] & 0x3F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, (u32)this->workf[UNK_F16] & 0x3F, (this->work[CS_TIMER_2] * 4) & 0x3F, 0x10, 0x10)); Matrix_Push(); Matrix_RotateY(this->workf[UNK_F15], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01C1C0)); Matrix_Pop(); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPSegment(POLY_XLU_DISP++, 0xD, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->work[CS_TIMER_2] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->work[CS_TIMER_2] & 0x7F, (this->work[CS_TIMER_2] * 8) & 0xFF, 0x20, 0x40, 1, (-this->work[CS_TIMER_2] * 2) & 0x3F, 0, 0x10, 0x10)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s16)this->workf[UNK_F9]); @@ -3275,34 +3275,34 @@ void func_80941BC0(BossTw* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A790)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80942180(BossTw* this, GlobalContext* globalCtx) { +void func_80942180(BossTw* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->groundBlastPos2.x, this->groundBlastPos2.y, this->groundBlastPos2.z, MTXMODE_NEW); Matrix_Scale(this->workf[KM_GD_CRTR_SCL], this->workf[KM_GD_CRTR_SCL], this->workf[KM_GD_CRTR_SCL], MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (-this->work[CS_TIMER_1]) & 0x7F, 0, 0x20, 0x20, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (-this->work[CS_TIMER_1]) & 0x7F, 0, 0x20, 0x20, 1, (this->work[CS_TIMER_1] * 2) & 0x7F, 0, 0x20, 0x20)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 40, 00, (s16)this->workf[KM_GRND_CRTR_A]); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, 128); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_019D40)); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->work[CS_TIMER_1] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->work[CS_TIMER_1] & 0x7F, (-this->work[CS_TIMER_1] * 6) & 0xFF, 0x20, 0x40, 1, (this->work[CS_TIMER_1] * 2) & 0x7F, (-this->work[CS_TIMER_1] * 6) & 0xFF, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 80, 0, 0, (s16)this->workf[KM_GD_SMOKE_A]); @@ -3311,36 +3311,36 @@ void func_80942180(BossTw* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_018FC0)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (-this->work[CS_TIMER_1] * 3) & 0x7F, 0, 0x20, 0x20, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (-this->work[CS_TIMER_1] * 3) & 0x7F, 0, 0x20, 0x20, 1, 0, (-this->work[CS_TIMER_1] * 10) & 0xFF, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 50, 0, (s16)(this->workf[KM_GD_FLM_A] * 0.7f)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 200, 235, 240, 128); Matrix_Scale(this->workf[KM_GD_FLM_SCL], this->workf[KM_GD_FLM_SCL], this->workf[KM_GD_FLM_SCL], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_019938)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_809426F0(BossTw* this, GlobalContext* globalCtx) { +void func_809426F0(BossTw* this, PlayState* play) { s32 pad; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (u8)(-this->work[CS_TIMER_2] * 15), 0x20, 0x40, 1, 0, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (u8)(-this->work[CS_TIMER_2] * 15), 0x20, 0x40, 1, 0, 0, 0x40, 0x40)); Matrix_Push(); Matrix_Translate(0.0f, 0.0f, 5000.0f, MTXMODE_APPLY); Matrix_Scale(this->spawnPortalScale / 2000.0f, this->spawnPortalScale / 2000.0f, this->spawnPortalScale / 2000.0f, MTXMODE_APPLY); Matrix_RotateZ(this->portalRotation, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (this->actor.params == 0) { @@ -3369,11 +3369,11 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { Matrix_RotateZ(((i * M_PI) * 2.0f * 0.125f) + this->flameRotation, MTXMODE_APPLY); Matrix_Translate(0.0f, this->spawnPortalScale * 1.5f, 0.0f, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_2] * 3) + (i * 10)) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((this->work[CS_TIMER_2] * 3) + (i * 10)) & 0x7F, (u8)((-this->work[CS_TIMER_2] * 15) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); Matrix_Pop(); @@ -3381,19 +3381,19 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { +void func_80942C70(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; s16 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->beamDist != 0.0f) { Matrix_Push(); gSPSegment(POLY_XLU_DISP++, 0xC, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (u8)(this->work[CS_TIMER_1] * -0xF), 0x20, 0x40)); + Gfx_TexScroll(play->state.gfxCtx, 0, (u8)(this->work[CS_TIMER_1] * -0xF), 0x20, 0x40)); alpha = this->beamScale * 100.0f * 255.0f; if (this->actor.params == 1) { @@ -3409,7 +3409,7 @@ void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(this->beamPitch, MTXMODE_APPLY); Matrix_RotateZ(this->beamRoll, MTXMODE_APPLY); Matrix_Scale(this->beamScale, this->beamScale, (this->beamDist * 0.01f * 98.0f) / 20000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DDF0)); @@ -3421,7 +3421,7 @@ void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(this->beamRoll, MTXMODE_APPLY); Matrix_Scale(this->beamScale, this->beamScale, (this->beamReflectionDist * 0.01f * 100.0f) / 20000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DDF0)); } @@ -3429,32 +3429,32 @@ void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80943028(Actor* thisx, GlobalContext* globalCtx) { +void func_80943028(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + 57.0f, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->workf[UNK_F17], this->workf[UNK_F17], this->workf[UNK_F17], MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F608)); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 200); Matrix_Translate(this->actor.world.pos.x, 240.0f, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale((this->actor.scale.x * 4000.0f) / 100.0f, 1.0f, (this->actor.scale.x * 4000.0f) / 100.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gCircleShadowDL)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static void* sEyeTextures[] = { @@ -3463,37 +3463,37 @@ static void* sEyeTextures[] = { object_tw_Tex_00B638, }; -void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void BossTw_Draw(Actor* thisx, PlayState* play2) { static Vec3f D_8094A9A4 = { 0.0f, 200.0f, 2000.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossTw* this = (BossTw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->visible) { gSPSegment(POLY_OPA_DISP++, 10, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIdx])); gSPSegment(POLY_XLU_DISP++, 10, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIdx])); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->workf[OUTR_CRWN_TX_X1] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->workf[OUTR_CRWN_TX_X1] & 0x7F, (s16)this->workf[OUTR_CRWN_TX_Y1] & 0x7F, 0x20, 0x20, 1, (s16)this->workf[OUTR_CRWN_TX_X2] & 0x7F, (s16)this->workf[OUTR_CRWN_TX_Y2] & 0xFF, 0x20, 0x40)); if (this->actor.params == TW_KOTAKE) { gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TexScroll(globalCtx->state.gfxCtx, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, + Gfx_TexScroll(play->state.gfxCtx, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, (s16)this->workf[INNR_CRWN_TX_Y1] & 0xFF, 0x20, 0x40)); } else { gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, (s16)this->workf[INNR_CRWN_TX_Y1] & 0x7F, 0x20, 0x20, 1, (s16)this->workf[INNR_CRWN_TX_X2] & 0x7F, (s16)this->workf[INNR_CRWN_TX_Y2] & 0xFF, 0x20, 0x40)); } - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->work[FOG_TIMER] & 2) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099); @@ -3503,10 +3503,10 @@ void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { } Matrix_Push(); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossTw_OverrideLimbDraw, BossTw_PostLimbDraw, this); Matrix_Pop(); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); } if (this->actor.params == TW_KOTAKE) { @@ -3525,23 +3525,23 @@ void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { } } - func_80941BC0(this, globalCtx); + func_80941BC0(this, play); } } else { - func_80942180(this, globalCtx); + func_80942180(this, play); } if (this->visible) { if (this->actionFunc == BossTw_DeathCS) { - func_80943028(&this->actor, globalCtx); + func_80943028(&this->actor, play); } else { - func_809426F0(this, globalCtx); + func_809426F0(this, play); Matrix_MultVec3f(&D_8094A9A4, &this->beamOrigin); - func_80942C70(&this->actor, globalCtx); + func_80942C70(&this->actor, play); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void* D_8094A9B0[] = { @@ -3550,16 +3550,16 @@ void* D_8094A9B0[] = { object_tw_Tex_02A470, }; -s32 BossTw_TwinrovaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossTw_TwinrovaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (limbIndex) { case 21: gSPSegment(POLY_OPA_DISP++, 0xC, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (s16)(f32)this->work[CS_TIMER_1], 8, 8)); + Gfx_TexScroll(play->state.gfxCtx, 0, (s16)(f32)this->work[CS_TIMER_1], 8, 8)); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_8094A9B0[this->eyeTexIdx])); gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(D_8094A9B0[this->leftEyeTexIdx])); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, this->work[UNK_S8]); @@ -3568,28 +3568,28 @@ s32 BossTw_TwinrovaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx case 41: *dList = NULL; gSPSegment(POLY_XLU_DISP++, 0xA, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, -this->work[CS_TIMER_1] * 0xF, 0x20, 0x40)); break; case 18: case 42: *dList = NULL; gSPSegment(POLY_XLU_DISP++, 0xB, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, -this->work[CS_TIMER_1] * 0xA, 0x20, 0x40)); break; case 16: case 32: *dList = NULL; gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->work[CS_TIMER_1], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->work[CS_TIMER_1], -this->work[CS_TIMER_1] * 7, 0x20, 0x40)); break; case 15: case 31: *dList = NULL; gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, this->work[CS_TIMER_1], 0x20, 0x40)); + Gfx_TexScroll(play->state.gfxCtx, 0, this->work[CS_TIMER_1], 0x20, 0x40)); break; case 19: if (this->unk_5F8 != 0) { @@ -3608,12 +3608,12 @@ s32 BossTw_TwinrovaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx *dList = NULL; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return false; } -void BossTw_TwinrovaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossTw_TwinrovaPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_8094A9BC = { 0.0f, 0.0f, 0.0f }; static Vec3f D_8094A9C8 = { 0.0f, 2000.0f, -2000.0f }; static Vec3f D_8094A9D4 = { 13000.0f, 0.0f, 0.0f }; @@ -3621,7 +3621,7 @@ void BossTw_TwinrovaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (limbIndex) { case 34: @@ -3644,23 +3644,23 @@ void BossTw_TwinrovaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** case 42: Matrix_Push(); Matrix_Scale(this->workf[UNK_F12], this->workf[UNK_F12], this->workf[UNK_F12], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); Matrix_Pop(); gSPDisplayList(POLY_XLU_DISP++, *dList); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { +void BossTw_ShieldChargeDraw(BossTw* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_t0; s16 temp_a0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -3691,18 +3691,18 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { temp_t0 = 1; } - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { if (temp_t0 != 0) { Matrix_Mult(&player->shieldMf, MTXMODE_NEW); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); temp_a0 = (Math_SinS(this->work[CS_TIMER_1] * 2730 * temp_t0) * D_8094C854 * 0.5f) + (D_8094C854 * 0.5f); if (sShieldFireCharge != 0) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, temp_a0); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E0E0)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (this->work[CS_TIMER_1] * 2) * temp_t0, 0, 0x20, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (this->work[CS_TIMER_1] * 2) * temp_t0, 0, 0x20, 0x20, 1, (-this->work[CS_TIMER_1] * 2) * temp_t0, 0, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 20, 0, (s16)D_8094C854); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E020)); @@ -3710,7 +3710,7 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 225, 255, 255, temp_a0); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E3A0)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (-this->work[CS_TIMER_1] * 5) * temp_t0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (-this->work[CS_TIMER_1] * 5) * temp_t0, 0x20, 0x40, 1, (this->work[CS_TIMER_1] * 4) * temp_t0, 0, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 175, 205, 195, (s16)D_8094C854); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E2C0)); @@ -3729,13 +3729,13 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&D_8094C858, 0.0f, 1.0f, step); } - if (Player_HasMirrorShieldEquipped(globalCtx) && D_8094C858 > 0.0f) { + if (Player_HasMirrorShieldEquipped(play) && D_8094C858 > 0.0f) { f32 scale = D_8094C872 > 0 ? 1.3f : 1.0f; Matrix_Mult(&player->shieldMf, MTXMODE_NEW); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (sShieldFireCharge != 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 220, 20, (s16)D_8094C858); @@ -3746,87 +3746,87 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x40, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x40, 1, 0, this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E9F0)); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossTw_SpawnPortalDraw(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SpawnPortalDraw(BossTw* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment( POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -this->work[CS_TIMER_1] * 15, 0x20, 0x40, 1, 0, 0, 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -this->work[CS_TIMER_1] * 15, 0x20, 0x40, 1, 0, 0, 0x40, 0x40)); Matrix_Push(); Matrix_Translate(0.0f, 232.0f, -600.0f, MTXMODE_NEW); Matrix_Scale(this->spawnPortalScale, this->spawnPortalScale, this->spawnPortalScale, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s16)this->spawnPortalAlpha); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EC68)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 135, 175, 165, (s16)this->spawnPortalAlpha); Matrix_Translate(0.0f, 2.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01CEE0)); Matrix_Translate(0.0f, 232.0f, 600.0f, MTXMODE_NEW); Matrix_Scale(this->spawnPortalScale, this->spawnPortalScale, this->spawnPortalScale, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s16)this->spawnPortalAlpha); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EC68)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (s16)this->spawnPortalAlpha); Matrix_Translate(0.0f, 2.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DBE8)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80944C50(BossTw* this, GlobalContext* globalCtx) { +void func_80944C50(BossTw* this, PlayState* play) { s32 pad; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(0.0f, 750.0f, 0.0f, MTXMODE_NEW); Matrix_Scale(0.35f, 0.35f, 0.35f, MTXMODE_APPLY); Matrix_Push(); Matrix_Scale(this->workf[UNK_F19], this->workf[UNK_F19], this->workf[UNK_F19], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F390)); Matrix_Pop(); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 2, 0, 0x20, 0x20, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 2, 0, 0x20, 0x20, 1, -sKoumePtr->work[CS_TIMER_1] * 2, 0, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->workf[UNK_F18] / 2); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F238)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 5, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 5, -sKoumePtr->work[CS_TIMER_1] * 2, 0x20, 0x40, 1, 0, -sKoumePtr->work[CS_TIMER_1] * 2, 0x10, 0x10)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)(this->workf[UNK_F18] * 0.3f)); @@ -3835,61 +3835,61 @@ void func_80944C50(BossTw* this, GlobalContext* globalCtx) { scale = CLAMP_MAX(scale, 1.0f); Matrix_Scale(scale, 1.0f, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EEB0)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossTw_TwinrovaDraw(Actor* thisx, GlobalContext* globalCtx2) { +void BossTw_TwinrovaDraw(Actor* thisx, PlayState* play2) { static Vec3f D_8094A9EC = { 0.0f, 200.0f, 2000.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->visible) { - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); POLY_OPA_DISP = (this->work[FOG_TIMER] & 2) ? Gfx_SetFog2(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099) : Gfx_SetFog2(POLY_OPA_DISP, (u32)this->fogR, (u32)this->fogG, (u32)this->fogB, 0, this->fogNear, this->fogFar); Matrix_Push(); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossTw_TwinrovaOverrideLimbDraw, BossTw_TwinrovaPostLimbDraw, thisx); Matrix_Pop(); Matrix_MultVec3f(&D_8094A9EC, &this->beamOrigin); - POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, globalCtx->lightCtx.fogColor[0], globalCtx->lightCtx.fogColor[1], - globalCtx->lightCtx.fogColor[2], 0, globalCtx->lightCtx.fogNear, 1000); + POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, play->lightCtx.fogColor[0], play->lightCtx.fogColor[1], + play->lightCtx.fogColor[2], 0, play->lightCtx.fogNear, 1000); } - BossTw_DrawEffects(globalCtx); - BossTw_ShieldChargeDraw(this, globalCtx); + BossTw_DrawEffects(play); + BossTw_ShieldChargeDraw(this, play); if (this->spawnPortalAlpha > 0.0f) { - BossTw_SpawnPortalDraw(this, globalCtx); + BossTw_SpawnPortalDraw(this, play); } if (this->workf[UNK_F18] > 0.0f) { - func_80944C50(this, globalCtx); + func_80944C50(this, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { +void BossTw_BlastFire(BossTw* this, PlayState* play) { s16 i; f32 xDiff; f32 yDiff; f32 zDiff; f32 distXZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Player* player2 = player; switch (this->actor.params) { @@ -3937,7 +3937,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { if (this->timers[0] == 50) { D_8094C86F = 10; D_8094C872 = 7; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } if (this->timers[0] <= 50) { @@ -3952,7 +3952,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { alpha = this->timers[0] * 10; alpha = CLAMP_MAX(alpha, 255); - BossTw_AddShieldBlastEffect(globalCtx, &player2->bodyPartsPos[15], &velocity, &sZeroVector, + BossTw_AddShieldBlastEffect(play, &player2->bodyPartsPos[15], &velocity, &sZeroVector, 10.0f, 80.0f, alpha, 1); } @@ -3971,7 +3971,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { if (this->groundBlastPos.y != 35.0f) { this->groundBlastPos.x = this->actor.world.pos.x; this->groundBlastPos.z = this->actor.world.pos.z; - BossTw_SpawnGroundBlast(this, globalCtx, 1); + BossTw_SpawnGroundBlast(this, play, 1); } else { Vec3f velocity; Vec3f accel; @@ -3983,11 +3983,11 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &this->actor.world.pos, &velocity, &accel, + BossTw_AddFlameEffect(play, &this->actor.world.pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->blastType); } - globalCtx->envCtx.unk_D8 = 0.5f; + play->envCtx.unk_D8 = 0.5f; } this->csState1 = 2; @@ -4005,7 +4005,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, 1, + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, 1, 75); } } @@ -4074,13 +4074,13 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { +void BossTw_BlastIce(BossTw* this, PlayState* play) { s16 i; f32 xDiff; f32 yDiff; f32 zDiff; f32 xzDist; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Player* player2 = player; switch (this->actor.params) { @@ -4127,7 +4127,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { if (this->timers[0] == 50) { D_8094C86F = 10; D_8094C872 = 7; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; } if (this->timers[0] <= 50) { @@ -4142,7 +4142,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { alpha = this->timers[0] * 10; alpha = CLAMP_MAX(alpha, 255); - BossTw_AddShieldBlastEffect(globalCtx, &player2->bodyPartsPos[15], &velocity, &sZeroVector, + BossTw_AddShieldBlastEffect(play, &player2->bodyPartsPos[15], &velocity, &sZeroVector, 10.0f, 80.0f, alpha, 0); } @@ -4161,7 +4161,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { if (this->groundBlastPos.y != 35.0f) { this->groundBlastPos.x = this->actor.world.pos.x; this->groundBlastPos.z = this->actor.world.pos.z; - BossTw_SpawnGroundBlast(this, globalCtx, 0); + BossTw_SpawnGroundBlast(this, play, 0); } else { for (i = 0; i < 50; i++) { Vec3f velocity; @@ -4173,11 +4173,11 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &this->actor.world.pos, &velocity, &accel, + BossTw_AddFlameEffect(play, &this->actor.world.pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->blastType); } - globalCtx->envCtx.unk_D8 = 0.5f; + play->envCtx.unk_D8 = 0.5f; } this->csState1 = 2; @@ -4195,7 +4195,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, ((s16)Rand_ZeroFloat(2.0f) + 8), 0, + BossTw_AddDotEffect(play, &pos, &velocity, &accel, ((s16)Rand_ZeroFloat(2.0f) + 8), 0, 75); } } @@ -4237,13 +4237,13 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.13f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20.0f, 0, 0, 80); + BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20.0f, 0, 0, 80); velocity.x = Rand_CenteredFloat(10.0f); velocity.z = Rand_CenteredFloat(10.0f); velocity.y = Rand_ZeroFloat(3.0f) + 3.0f; pos.x = sKotakePtr->groundBlastPos2.x + (velocity.x * 0.5f); pos.z = sKotakePtr->groundBlastPos2.z + (velocity.z * 0.5f); - BossTw_AddDmgCloud(globalCtx, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 15.0f, 255, 2, + BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 15.0f, 255, 2, 130); } @@ -4277,7 +4277,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.13f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20, 0, 0, + BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20, 0, 0, 80); } } @@ -4298,8 +4298,8 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { } } -s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 BossTw_BlastShieldCheck(BossTw* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; ColliderInfo* info; @@ -4311,16 +4311,16 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { if (info->toucher.dmgFlags & DMG_SHIELD) { this->work[INVINC_TIMER] = 7; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; func_800AA000(0.0f, 100, 5, 4); - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { if (this->blastType == 1) { if (sShieldIceCharge != 0) { sShieldIceCharge = 0; - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, 1); + BossTw_AddShieldDeflectEffect(play, 10.0f, 1); } else { - BossTw_AddShieldHitEffect(globalCtx, 10.0f, 1); + BossTw_AddShieldHitEffect(play, 10.0f, 1); sShieldFireCharge++; D_8094C86F = (sShieldFireCharge * 2) + 8; D_8094C872 = -7; @@ -4328,9 +4328,9 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { } else { if (sShieldFireCharge != 0) { sShieldFireCharge = 0; - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, 0); + BossTw_AddShieldDeflectEffect(play, 10.0f, 0); } else { - BossTw_AddShieldHitEffect(globalCtx, 10.0f, 0); + BossTw_AddShieldHitEffect(play, 10.0f, 0); sShieldIceCharge++; D_8094C86F = (sShieldIceCharge * 2) + 8; D_8094C872 = -7; @@ -4350,7 +4350,7 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { sEnvType = 0; } } else { - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, this->blastType); + BossTw_AddShieldDeflectEffect(play, 10.0f, this->blastType); this->csState1 = 2; this->timers[0] = 20; sEnvType = 0; @@ -4367,7 +4367,7 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { return ret; } -void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx) { +void BossTw_BlastUpdate(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; ColliderCylinder* collider; s16 i; @@ -4382,7 +4382,7 @@ void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx) { this->blastTailPos[this->work[TAIL_IDX]] = this->actor.world.pos; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < 5; i++) { if (this->timers[i] != 0) { @@ -4402,24 +4402,24 @@ void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx) { collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - if (this->blastActive && this->work[INVINC_TIMER] == 0 && !BossTw_BlastShieldCheck(this, globalCtx)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base); + if (this->blastActive && this->work[INVINC_TIMER] == 0 && !BossTw_BlastShieldCheck(this, play)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base); + CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } this->blastActive = false; } -void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossTw_BlastDraw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossTw* this = (BossTw*)thisx; f32 scaleFactor; s16 tailIdx; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->actor.params) { case TW_FIRE_BLAST: @@ -4430,7 +4430,7 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll( - globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 10)) & 0x7F, + play->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 10)) & 0x7F, ((-this->work[CS_TIMER_1] * 15) + (i * 50)) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; Matrix_Translate(this->blastTailPos[tailIdx].x, this->blastTailPos[tailIdx].y, @@ -4438,8 +4438,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = 1.0f - (i * 0.09f); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); @@ -4458,7 +4458,7 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll( - globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 0xA)) & 0x7F, + play->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 0xA)) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; Matrix_Translate(this->blastTailPos[tailIdx].x, this->blastTailPos[tailIdx].y, @@ -4466,8 +4466,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = 1.0f - (i * 0.09f); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); @@ -4479,19 +4479,19 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossTw_DrawDeathBall(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossTw* this = (BossTw*)thisx; f32 scaleFactor; s16 tailIdx; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->actor.params == TW_DEATHBALL_KOUME) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s8)this->workf[TAIL_ALPHA]); @@ -4501,7 +4501,7 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { FrameInterpolation_RecordOpenChild("Twinrova Death Ball 0", i); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; @@ -4510,8 +4510,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = (1.0f - (i * 0.09f)); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); @@ -4525,7 +4525,7 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { FrameInterpolation_RecordOpenChild("Twinrova Death Ball 1", i); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; @@ -4534,8 +4534,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = (1.0f - (i * 0.09f)); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); @@ -4543,17 +4543,17 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossTw_UpdateEffects(GlobalContext* globalCtx) { +void BossTw_UpdateEffects(PlayState* play) { static Color_RGB8 sDotColors[] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 }, { 100, 100, 100 }, { 255, 255, 255 }, { 150, 150, 150 }, { 255, 255, 255 }, }; Vec3f sp11C; - BossTwEffect* eff = globalCtx->specialEffects; - Player* player = GET_PLAYER(globalCtx); + BossTwEffect* eff = play->specialEffects; + Player* player = GET_PLAYER(play); u8 sp113 = 0; s16 i; s16 j; @@ -4659,12 +4659,12 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { spDC.x = 0.0f; spDC.y = 0.0f; spDC.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &spF4, &spE8, &spDC, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &spF4, &spE8, &spDC, Rand_ZeroFloat(10.0f) + 25.0f, eff->work[EFF_ARGS]); } sTwinrovaPtr->twinrovaStun = 1; - globalCtx->envCtx.unk_D8 = 1.0f; + play->envCtx.unk_D8 = 1.0f; eff->type = TWEFF_NONE; } } @@ -4721,7 +4721,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { if (sTwinrovaPtr->groundBlastPos.y != 35.0f) { sTwinrovaPtr->groundBlastPos.x = eff->pos.x; sTwinrovaPtr->groundBlastPos.z = eff->pos.z; - BossTw_SpawnGroundBlast(sTwinrovaPtr, globalCtx, eff->work[EFF_ARGS]); + BossTw_SpawnGroundBlast(sTwinrovaPtr, play, eff->work[EFF_ARGS]); } } } @@ -4733,7 +4733,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { } } - BossTw_AddFlameEffect(globalCtx, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); + BossTw_AddFlameEffect(play, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); } else if (eff->type == TWEFF_SHLD_HIT) { eff->work[EFF_UNKS1]++; sp11C.x = 0.0f; @@ -4761,7 +4761,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { } } - BossTw_AddFlameEffect(globalCtx, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); + BossTw_AddFlameEffect(play, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); } else if (eff->type == 4) { if (eff->work[EFF_UNKS1] == 0) { Math_ApproachF(&eff->workf[EFF_SCALE], eff->workf[EFF_DIST], 0.05f, 1.0f); @@ -4820,8 +4820,8 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { eff->frame = 100; } - if (!(globalCtx->gameplayFrames & 1)) { - globalCtx->damagePlayer(globalCtx, -1); + if (!(play->gameplayFrames & 1)) { + play->damagePlayer(play, -1); } } else { Math_ApproachF(&eff->workf[EFF_SCALE], 0.042f, 1.0f, 0.002f); @@ -4850,7 +4850,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { spA8.y = 0.1f; spA8.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, 3, &spC0, &spB4, &spA8, phi_f22 + Rand_ZeroFloat(phi_f22 * 0.5f), + BossTw_AddDmgCloud(play, 3, &spC0, &spB4, &spA8, phi_f22 + Rand_ZeroFloat(phi_f22 * 0.5f), 0, 0, 150); } } @@ -4886,22 +4886,22 @@ f32 BossTw_RandZeroOne(void) { return fabsf(rand); } -void BossTw_DrawEffects(GlobalContext* globalCtx) { +void BossTw_DrawEffects(PlayState* play) { u8 sp18F = 0; s16 i; s16 j; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 phi_s4; - BossTwEffect* currentEffect = globalCtx->specialEffects; + BossTwEffect* currentEffect = play->specialEffects; BossTwEffect* effectHead; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; effectHead = currentEffect; OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 1) { @@ -4915,7 +4915,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, currentEffect->color.r, currentEffect->color.g, currentEffect->color.b, currentEffect->alpha); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4940,10 +4940,10 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, currentEffect->alpha); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4969,10 +4969,10 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, currentEffect->alpha); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4996,7 +4996,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 0xD, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, currentEffect->frame & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, currentEffect->frame & 0x7F, (currentEffect->frame * 8) & 0xFF, 0x20, 0x40, 1, (currentEffect->frame * -2) & 0x7F, 0, 0x10, 0x10)); @@ -5010,7 +5010,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if (currentEffect->work[EFF_UNKS1] == 0) { Matrix_Translate(0.0f, 0.0f, 60.0f, MTXMODE_APPLY); @@ -5047,7 +5047,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AA50)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); sp18F++; BossTw_InitRand(1, 0x71AC, 0x263A); } @@ -5100,10 +5100,10 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (-currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -5123,7 +5123,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void BossTw_TwinrovaSetupArriveAtTarget(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupArriveAtTarget(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaArriveAtTarget; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -3.0f); this->work[CS_TIMER_1] = Rand_ZeroFloat(100.0f); @@ -5131,7 +5131,7 @@ void BossTw_TwinrovaSetupArriveAtTarget(BossTw* this, GlobalContext* globalCtx) this->rotateSpeed = 0.0f; } -void BossTw_TwinrovaArriveAtTarget(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaArriveAtTarget(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.1f, fabsf(this->actor.velocity.x) * 1.5f); Math_ApproachF(&this->actor.world.pos.y, this->targetPos.y, 0.1f, fabsf(this->actor.velocity.y) * 1.5f); @@ -5139,21 +5139,21 @@ void BossTw_TwinrovaArriveAtTarget(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.1f, fabsf(this->actor.velocity.z) * 1.5f); if (this->timers[1] == 1) { - BossTw_TwinrovaSetupChargeBlast(this, globalCtx); + BossTw_TwinrovaSetupChargeBlast(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->rotateSpeed); Math_ApproachF(&this->rotateSpeed, 4096.0f, 1.0f, 350.0f); } -void BossTw_TwinrovaSetupChargeBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupChargeBlast(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaChargeBlast; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_036FBC, -5.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_036FBC); this->csState1 = 0; } -void BossTw_TwinrovaChargeBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaChargeBlast(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.03f, fabsf(this->actor.velocity.x) * 1.5f); @@ -5173,11 +5173,11 @@ void BossTw_TwinrovaChargeBlast(BossTw* this, GlobalContext* globalCtx) { sTwinrovaBlastType = sFixedBlastType; } - BossTw_TwinrovaSetupShootBlast(this, globalCtx); + BossTw_TwinrovaSetupShootBlast(this, play); } } -void BossTw_TwinrovaSetupShootBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupShootBlast(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaShootBlast; if (sTwinrovaBlastType == 0) { @@ -5189,7 +5189,7 @@ void BossTw_TwinrovaSetupShootBlast(BossTw* this, GlobalContext* globalCtx) { this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_023750); } -void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play) { BossTw* twMagic; Vec3f* magicSpawnPos; s32 magicParams; @@ -5212,7 +5212,7 @@ void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx) { } twMagic = - (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, magicSpawnPos->x, + (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, magicSpawnPos->x, magicSpawnPos->y, magicSpawnPos->z, 0, 0, 0, magicParams); if (twMagic != NULL) { @@ -5229,33 +5229,33 @@ void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx) { velocity.x = Rand_CenteredFloat(30.0f); velocity.y = Rand_CenteredFloat(30.0f); velocity.z = Rand_CenteredFloat(30.0f); - BossTw_AddDotEffect(globalCtx, magicSpawnPos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 11, + BossTw_AddDotEffect(play, magicSpawnPos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 11, twMagic->blastType, 75); } } } if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_TwinrovaSetupDoneBlastShoot(this, globalCtx); + BossTw_TwinrovaSetupDoneBlastShoot(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); } -void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaDoneBlastShoot; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f); this->timers[1] = 60; } -void BossTw_TwinrovaDoneBlastShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaDoneBlastShoot(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timers[1] == 0 && D_8094C870 == 0) { if (sTwinrovaPtr->timers[2] == 0) { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } else { - BossTw_TwinrovaSetupLaugh(this, globalCtx); + BossTw_TwinrovaSetupLaugh(this, play); } } @@ -5263,7 +5263,7 @@ void BossTw_TwinrovaDoneBlastShoot(BossTw* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); } -void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 damage) { +void BossTw_TwinrovaDamage(BossTw* this, PlayState* play, u8 damage) { if (this->actionFunc != BossTw_TwinrovaStun) { Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_0338F0, -15.0f); this->timers[0] = 150; @@ -5282,8 +5282,8 @@ void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 damage) { } if ((s8)this->actor.colChkInfo.health <= 0) { - BossTw_TwinrovaSetupDeathCS(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossTw_TwinrovaSetupDeathCS(this, play); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_YOUNG_DEAD); return; } @@ -5295,7 +5295,7 @@ void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 damage) { this->actionFunc = BossTw_TwinrovaStun; } -void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaStun(BossTw* this, PlayState* play) { s16 cloudType; this->unk_5F8 = 1; @@ -5316,7 +5316,7 @@ void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.1f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, cloudType, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 10.0f, 0, 0, 150); + BossTw_AddDmgCloud(play, cloudType, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 10.0f, 0, 0, 150); } SkelAnime_Update(&this->skelAnime); @@ -5330,7 +5330,7 @@ void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; Math_ApproachF(&this->actor.velocity.y, -5.0f, 1.0f, 0.5f); this->actor.world.pos.y -= 30.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 4); this->actor.world.pos.y += 30.0f; if (this->csState1 == 0) { @@ -5349,18 +5349,18 @@ void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { - BossTw_TwinrovaSetupGetUp(this, globalCtx); + BossTw_TwinrovaSetupGetUp(this, play); } } -void BossTw_TwinrovaSetupGetUp(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupGetUp(BossTw* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_035988, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_035988); this->actionFunc = BossTw_TwinrovaGetUp; this->timers[0] = 50; } -void BossTw_TwinrovaGetUp(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaGetUp(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.y, this->targetPos.y, 0.05f, 5.0f); @@ -5370,16 +5370,16 @@ void BossTw_TwinrovaGetUp(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } } -void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupFly(BossTw* this, PlayState* play) { f32 xDiff; f32 zDiff; f32 yDiff; f32 xzDist; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); do { this->work[TW_PLLR_IDX] += (s16)(((s16)Rand_ZeroFloat(2.99f)) + 1); @@ -5403,7 +5403,7 @@ void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx) { Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f); } -void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaFly(BossTw* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -5433,18 +5433,18 @@ void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.1f, fabsf(this->actor.velocity.z) * 1.5f); if (xzDist < 200.0f) { - BossTw_TwinrovaSetupArriveAtTarget(this, globalCtx); + BossTw_TwinrovaSetupArriveAtTarget(this, play); } } -void BossTw_TwinrovaSetupSpin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupSpin(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaSpin; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, 0.0f); this->timers[0] = 20; this->actor.speedXZ = 0.0f; } -void BossTw_TwinrovaSpin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSpin(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timers[0] != 0) { this->collider.base.colType = COLTYPE_METAL; @@ -5454,18 +5454,18 @@ void BossTw_TwinrovaSpin(BossTw* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_ROLL); } } else { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } } -void BossTw_TwinrovaSetupLaugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupLaugh(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaLaugh; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_03A2D0, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_03A2D0); this->actor.speedXZ = 0.0f; } -void BossTw_TwinrovaLaugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaLaugh(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -5473,7 +5473,7 @@ void BossTw_TwinrovaLaugh(BossTw* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h index 5560f58d7..df604bfb2 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h @@ -95,7 +95,7 @@ typedef enum { struct BossTw; -typedef void (*BossTwActionFunc)(struct BossTw*, GlobalContext* globalCtx); +typedef void (*BossTwActionFunc)(struct BossTw*, PlayState* play); typedef struct BossTw { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index c30ec81e1..d351632a6 100644 --- a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -117,82 +117,82 @@ typedef enum { /* 24 */ DEATH_FINISH } BossVaCutscene; -void BossVa_Init(Actor* thisx, GlobalContext* globalCtx); -void BossVa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossVa_Update(Actor* thisx, GlobalContext* globalCtx); -void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossVa_Init(Actor* thisx, PlayState* play); +void BossVa_Destroy(Actor* thisx, PlayState* play); +void BossVa_Update(Actor* thisx, PlayState* play); +void BossVa_Draw(Actor* thisx, PlayState* play); void BossVa_Reset(void); -void BossVa_UpdateEffects(GlobalContext* globalCtx); -void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx); -void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale); +void BossVa_UpdateEffects(PlayState* play); +void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play); +void BossVa_DrawDoor(PlayState* play, s16 scale); void BossVa_SetupIntro(BossVa* this); void BossVa_SetupBodyPhase1(BossVa* this); -void BossVa_SetupBodyPhase2(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupBodyPhase2(BossVa* this, PlayState* play); void BossVa_SetupBodyPhase3(BossVa* this); -void BossVa_SetupBodyPhase4(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBodyDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupBodyPhase4(BossVa* this, PlayState* play); +void BossVa_SetupBodyDeath(BossVa* this, PlayState* play); -void BossVa_SetupSupportIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupSupportAttached(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupSupportCut(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupSupportIntro(BossVa* this, PlayState* play); +void BossVa_SetupSupportAttached(BossVa* this, PlayState* play); +void BossVa_SetupSupportCut(BossVa* this, PlayState* play); -void BossVa_SetupZapperIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperAttack(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperEnraged(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperDamaged(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperHold(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupZapperIntro(BossVa* this, PlayState* play); +void BossVa_SetupZapperAttack(BossVa* this, PlayState* play); +void BossVa_SetupZapperEnraged(BossVa* this, PlayState* play); +void BossVa_SetupZapperDamaged(BossVa* this, PlayState* play); +void BossVa_SetupZapperHold(BossVa* this, PlayState* play); -void BossVa_SetupStump(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupStump(BossVa* this, PlayState* play); -void BossVa_SetupDoor(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupDoor(BossVa* this, PlayState* play); -void BossVa_SetupBariIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBariPhase2Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBariPhase3Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBariPhase3Stunned(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupBariIntro(BossVa* this, PlayState* play); +void BossVa_SetupBariPhase2Attack(BossVa* this, PlayState* play); +void BossVa_SetupBariPhase3Attack(BossVa* this, PlayState* play); +void BossVa_SetupBariPhase3Stunned(BossVa* this, PlayState* play); void BossVa_SetupBariDeath(BossVa* this); -void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_BodyIntro(BossVa* this, PlayState* play); +void BossVa_BodyPhase1(BossVa* this, PlayState* play); +void BossVa_BodyPhase2(BossVa* this, PlayState* play); +void BossVa_BodyPhase3(BossVa* this, PlayState* play); +void BossVa_BodyPhase4(BossVa* this, PlayState* play); +void BossVa_BodyDeath(BossVa* this, PlayState* play); -void BossVa_SupportIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SupportAttached(BossVa* this, GlobalContext* globalCtx); -void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx); +void BossVa_SupportIntro(BossVa* this, PlayState* play); +void BossVa_SupportAttached(BossVa* this, PlayState* play); +void BossVa_SupportCut(BossVa* this, PlayState* play); -void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperDamaged(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperHold(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_ZapperIntro(BossVa* this, PlayState* play); +void BossVa_ZapperAttack(BossVa* this, PlayState* play); +void BossVa_ZapperEnraged(BossVa* this, PlayState* play); +void BossVa_ZapperDamaged(BossVa* this, PlayState* play); +void BossVa_ZapperHold(BossVa* this, PlayState* play); +void BossVa_ZapperDeath(BossVa* this, PlayState* play); -void BossVa_Stump(BossVa* this, GlobalContext* globalCtx); +void BossVa_Stump(BossVa* this, PlayState* play); -void BossVa_Door(BossVa* this, GlobalContext* globalCtx); +void BossVa_Door(BossVa* this, PlayState* play); -void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariPhase3Stunned(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_BariIntro(BossVa* this, PlayState* play); +void BossVa_BariPhase3Attack(BossVa* this, PlayState* play); +void BossVa_BariPhase2Attack(BossVa* this, PlayState* play); +void BossVa_BariPhase3Stunned(BossVa* this, PlayState* play); +void BossVa_BariDeath(BossVa* this, PlayState* play); -void BossVa_SpawnBloodSplatter(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); -void BossVa_SpawnGore(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); -void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); -void BossVa_SpawnZapperCharge(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, +void BossVa_SpawnBloodSplatter(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); +void BossVa_SpawnGore(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); +void BossVa_SpawnSpark(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); +void BossVa_SpawnZapperCharge(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, s16 scale, u8 mode); -void BossVa_SpawnTumor(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); -void BossVa_SpawnSparkBall(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, +void BossVa_SpawnTumor(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); +void BossVa_SpawnSparkBall(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); -void BossVa_SpawnBloodDroplets(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, +void BossVa_SpawnBloodDroplets(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, s16 yaw); -void BossVa_Tumor(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, +void BossVa_Tumor(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, f32 range, u8 fixed); const ActorInit Boss_Va_InitVars = { @@ -439,7 +439,7 @@ void BossVa_AttachToBody(BossVa* this) { this->actor.shape.yOffset = GET_BODY(this)->actor.shape.yOffset; } -void BossVa_BloodDroplets(GlobalContext* globalCtx, Vec3f* pos, s16 phase, s16 yaw) { +void BossVa_BloodDroplets(PlayState* play, Vec3f* pos, s16 phase, s16 yaw) { s32 i; Vec3f spawnPos; @@ -447,11 +447,11 @@ void BossVa_BloodDroplets(GlobalContext* globalCtx, Vec3f* pos, s16 phase, s16 y spawnPos.x = Rand_CenteredFloat(10.0f) + pos->x; spawnPos.y = pos->y - (Rand_ZeroOne() * 15.0f); spawnPos.z = Rand_CenteredFloat(10.0f) + pos->z; - BossVa_SpawnBloodDroplets(globalCtx, sVaEffects, &spawnPos, 65, phase, yaw); + BossVa_SpawnBloodDroplets(play, sVaEffects, &spawnPos, 65, phase, yaw); } } -void BossVa_BloodSplatter(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, s16 scale, s32 count) { +void BossVa_BloodSplatter(PlayState* play, BossVaEffect* src, s16 yaw, s16 scale, s32 count) { s32 i; Vec3f pos; @@ -459,11 +459,11 @@ void BossVa_BloodSplatter(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, pos.x = Rand_CenteredFloat(10.0f) + src->pos.x; pos.y = src->pos.y - (Rand_ZeroOne() * 15.0f); pos.z = Rand_CenteredFloat(10.0f) + src->pos.z; - BossVa_SpawnBloodSplatter(globalCtx, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); + BossVa_SpawnBloodSplatter(play, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); } } -void BossVa_Gore(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, s16 scale) { +void BossVa_Gore(PlayState* play, BossVaEffect* src, s16 yaw, s16 scale) { s32 i; Vec3f pos; @@ -471,11 +471,11 @@ void BossVa_Gore(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, s16 scale pos.x = Rand_CenteredFloat(10.0f) + src->pos.x; pos.y = Rand_CenteredFloat(10.0f) + src->pos.y; pos.z = Rand_CenteredFloat(10.0f) + src->pos.z; - BossVa_SpawnGore(globalCtx, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); + BossVa_SpawnGore(play, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); } } -void BossVa_Spark(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, +void BossVa_Spark(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, f32 range, u8 fixed) { s32 i; s16 index; @@ -490,11 +490,11 @@ void BossVa_Spark(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x; offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y; offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z; - BossVa_SpawnSpark(globalCtx, sVaEffects, this, &offset, scale, mode); + BossVa_SpawnSpark(play, sVaEffects, this, &offset, scale, mode); } } -void BossVa_Tumor(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, +void BossVa_Tumor(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, f32 range, u8 fixed) { s16 index; s32 i; @@ -510,42 +510,42 @@ void BossVa_Tumor(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x; offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y; offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z; - BossVa_SpawnTumor(globalCtx, sVaEffects, this, &offset, scale, mode); + BossVa_SpawnTumor(play, sVaEffects, this, &offset, scale, mode); } } -void BossVa_SetSparkEnv(GlobalContext* globalCtx) { - globalCtx->envCtx.adjAmbientColor[0] = 0xA; - globalCtx->envCtx.adjAmbientColor[1] = 0xA; - globalCtx->envCtx.adjAmbientColor[2] = 0xA; - globalCtx->envCtx.adjLight1Color[0] = 0x73; - globalCtx->envCtx.adjLight1Color[1] = 0x41; - globalCtx->envCtx.adjLight1Color[2] = 0x64; - globalCtx->envCtx.adjFogColor[0] = 0x78; - globalCtx->envCtx.adjFogColor[1] = 0x78; - globalCtx->envCtx.adjFogColor[2] = 0x46; +void BossVa_SetSparkEnv(PlayState* play) { + play->envCtx.adjAmbientColor[0] = 0xA; + play->envCtx.adjAmbientColor[1] = 0xA; + play->envCtx.adjAmbientColor[2] = 0xA; + play->envCtx.adjLight1Color[0] = 0x73; + play->envCtx.adjLight1Color[1] = 0x41; + play->envCtx.adjLight1Color[2] = 0x64; + play->envCtx.adjFogColor[0] = 0x78; + play->envCtx.adjFogColor[1] = 0x78; + play->envCtx.adjFogColor[2] = 0x46; } -void BossVa_SetDeathEnv(GlobalContext* globalCtx) { - globalCtx->envCtx.adjFogColor[0] = 0xDC; - globalCtx->envCtx.adjFogColor[1] = 0xDC; - globalCtx->envCtx.adjFogColor[2] = 0x96; - globalCtx->envCtx.adjFogNear = -0x3E8; - globalCtx->envCtx.adjFogFar = -0x384; - globalCtx->envCtx.adjAmbientColor[0] = 0xC8; - globalCtx->envCtx.adjAmbientColor[1] = 0xC8; - globalCtx->envCtx.adjAmbientColor[2] = 0xC8; - globalCtx->envCtx.adjLight1Color[0] = 0xD7; - globalCtx->envCtx.adjLight1Color[1] = 0xA5; - globalCtx->envCtx.adjLight1Color[2] = 0xC8; - globalCtx->envCtx.screenFillColor[0] = 0xDC; - globalCtx->envCtx.screenFillColor[1] = 0xDC; - globalCtx->envCtx.screenFillColor[2] = 0x96; - globalCtx->envCtx.screenFillColor[3] = 0x64; +void BossVa_SetDeathEnv(PlayState* play) { + play->envCtx.adjFogColor[0] = 0xDC; + play->envCtx.adjFogColor[1] = 0xDC; + play->envCtx.adjFogColor[2] = 0x96; + play->envCtx.adjFogNear = -0x3E8; + play->envCtx.adjFogFar = -0x384; + play->envCtx.adjAmbientColor[0] = 0xC8; + play->envCtx.adjAmbientColor[1] = 0xC8; + play->envCtx.adjAmbientColor[2] = 0xC8; + play->envCtx.adjLight1Color[0] = 0xD7; + play->envCtx.adjLight1Color[1] = 0xA5; + play->envCtx.adjLight1Color[2] = 0xC8; + play->envCtx.screenFillColor[0] = 0xDC; + play->envCtx.screenFillColor[1] = 0xDC; + play->envCtx.screenFillColor[2] = 0x96; + play->envCtx.screenFillColor[3] = 0x64; } -EnBoom* BossVa_FindBoomerang(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_MISC].head; +EnBoom* BossVa_FindBoomerang(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_MISC].head; while (actorIt != NULL) { if (actorIt->id != ACTOR_EN_BOOM) { @@ -557,7 +557,7 @@ EnBoom* BossVa_FindBoomerang(GlobalContext* globalCtx) { return NULL; } -void BossVa_KillBari(BossVa* this, GlobalContext* globalCtx) { +void BossVa_KillBari(BossVa* this, PlayState* play) { s32 i; s16 scale; Vec3f pos; @@ -572,9 +572,9 @@ void BossVa_KillBari(BossVa* this, GlobalContext* globalCtx) { velocity.y = Rand_ZeroOne() + 1.0f; scale = Rand_S16Offset(80, 100); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 0, 1); } } @@ -582,8 +582,8 @@ void BossVa_KillBari(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupBariDeath(this); } -void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossVa_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossVa* this = (BossVa*)thisx; s32 i; s16 warpId; @@ -596,29 +596,29 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { case BOSSVA_BODY: //sFightPhase = 0; //sBodyState = 1; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBarinadeBodySkel, &gBarinadeBodyAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gBarinadeBodySkel, &gBarinadeBodyAnim, NULL, NULL, 0); this->actor.flags |= ACTOR_FLAG_24; break; case BOSSVA_SUPPORT_1: case BOSSVA_SUPPORT_2: case BOSSVA_SUPPORT_3: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeSupportSkel, &gBarinadeSupportAttachedAnim, NULL, + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeSupportSkel, &gBarinadeSupportAttachedAnim, NULL, NULL, 0); break; case BOSSVA_ZAPPER_1: case BOSSVA_ZAPPER_2: case BOSSVA_ZAPPER_3: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeZapperSkel, &gBarinadeZapperIdleAnim, NULL, NULL, + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeZapperSkel, &gBarinadeZapperIdleAnim, NULL, NULL, 0); break; case BOSSVA_STUMP_1: case BOSSVA_STUMP_2: case BOSSVA_STUMP_3: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeStumpSkel, &gBarinadeStumpAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeStumpSkel, &gBarinadeStumpAnim, NULL, NULL, 0); break; default: this->actor.flags |= ACTOR_FLAG_24; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBarinadeBariSkel, &gBarinadeBariAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gBarinadeBariSkel, &gBarinadeBariAnim, NULL, NULL, 0); this->actor.shape.yOffset = 400.0f; break; case BOSSVA_DOOR: @@ -631,17 +631,17 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { switch (this->actor.params) { case BOSSVA_BODY: - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, 0.0f, 80.0f, 400.0f, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, 0.0f, 80.0f, 400.0f, 0, 0, 0, BOSSVA_DOOR); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { warpId = ACTOR_EN_RU1; if (gSaveContext.eventChkInf[3] & 0x80) { warpId = ACTOR_DOOR_WARP1; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, warpId, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, warpId, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); //! params could be WARP_DUNGEON_CHILD however this can also spawn Ru1 - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 160.0f, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 160.0f, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); sDoorState = 100; Actor_Kill(&this->actor); @@ -651,27 +651,27 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { if (gSaveContext.eventChkInf[7] & 0x40) { sCsState = INTRO_CALL_BARI; sDoorState = 100; - func_8002DF54(globalCtx, &this->actor, 1); - globalCtx->envCtx.screenFillColor[0] = 0xDC; - globalCtx->envCtx.screenFillColor[1] = 0xDC; - globalCtx->envCtx.screenFillColor[2] = 0xBE; - globalCtx->envCtx.screenFillColor[3] = 0xD2; - func_80064520(globalCtx, &globalCtx->csCtx); - sCsCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 1); + play->envCtx.screenFillColor[0] = 0xDC; + play->envCtx.screenFillColor[1] = 0xDC; + play->envCtx.screenFillColor[2] = 0xBE; + play->envCtx.screenFillColor[3] = 0xD2; + func_80064520(play, &play->csCtx); + sCsCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE); sCameraNextEye.x = sCameraEye.x = 140.0f; sCameraNextEye.y = sCameraEye.y = 205.0f; sCameraNextEye.z = sCameraEye.z = -20.0f; sCameraNextAt.x = sCameraAt.x = 10.0f; sCameraNextAt.y = sCameraAt.y = 50.0f; sCameraNextAt.z = sCameraAt.z = -220.0f; - Gameplay_CameraSetAtEye(globalCtx, sCsCamera, &sCameraAt, &sCameraEye); + Play_CameraSetAtEye(play, sCsCamera, &sCameraAt, &sCameraEye); this->timer = 20; for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, @@ -686,12 +686,12 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->zapHeadPos.x = 1.0f; - Collider_InitCylinder(globalCtx, &this->colliderBody); - Collider_SetCylinder(globalCtx, &this->colliderBody, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderBody); + Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInit); for (i = BOSSVA_ZAPPER_3; i >= BOSSVA_SUPPORT_1; i--) { Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i); @@ -708,58 +708,58 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { case BOSSVA_SUPPORT_1: case BOSSVA_SUPPORT_2: case BOSSVA_SUPPORT_3: - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInitSupport, this->elements); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInitSupport, this->elements); if (sCsState < BOSSVA_BATTLE) { - BossVa_SetupSupportIntro(this, globalCtx); + BossVa_SetupSupportIntro(this, play); } else { - BossVa_SetupSupportAttached(this, globalCtx); + BossVa_SetupSupportAttached(this, play); } this->onCeiling++; break; case BOSSVA_ZAPPER_1: case BOSSVA_ZAPPER_2: case BOSSVA_ZAPPER_3: - Collider_InitQuad(globalCtx, &this->colliderLightning); - Collider_SetQuad(globalCtx, &this->colliderLightning, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->colliderLightning); + Collider_SetQuad(play, &this->colliderLightning, &this->actor, &sQuadInit); if (sCsState < BOSSVA_BATTLE) { - BossVa_SetupZapperIntro(this, globalCtx); + BossVa_SetupZapperIntro(this, play); } else { - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); } break; case BOSSVA_STUMP_1: case BOSSVA_STUMP_2: case BOSSVA_STUMP_3: - BossVa_SetupStump(this, globalCtx); + BossVa_SetupStump(this, play); break; case BOSSVA_DOOR: - BossVa_SetupDoor(this, globalCtx); + BossVa_SetupDoor(this, play); break; default: - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInitBari, this->elements); - Collider_InitQuad(globalCtx, &this->colliderLightning); - Collider_SetQuad(globalCtx, &this->colliderLightning, &this->actor, &sQuadInit); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInitBari, this->elements); + Collider_InitQuad(play, &this->colliderLightning); + Collider_SetQuad(play, &this->colliderLightning, &this->actor, &sQuadInit); this->unk_1D8.x = 1.0f; this->unk_1D8.y = 1.0f; if (sCsState < BOSSVA_BATTLE) { - BossVa_SetupBariIntro(this, globalCtx); + BossVa_SetupBariIntro(this, play); } else if (sFightPhase >= PHASE_3) { - BossVa_SetupBariPhase3Attack(this, globalCtx); + BossVa_SetupBariPhase3Attack(this, play); } else { - BossVa_SetupBariPhase2Attack(this, globalCtx); + BossVa_SetupBariPhase2Attack(this, play); } break; } } -void BossVa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossVa_Destroy(Actor* thisx, PlayState* play) { BossVa* this = (BossVa*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->colliderSph); - Collider_DestroyCylinder(globalCtx, &this->colliderBody); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->colliderSph); + Collider_DestroyCylinder(play, &this->colliderBody); } void BossVa_SetupIntro(BossVa* this) { @@ -771,9 +771,9 @@ void BossVa_SetupIntro(BossVa* this) { BossVa_SetupAction(this, BossVa_BodyIntro); } -void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BodyIntro(BossVa* this, PlayState* play) { s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; @@ -788,21 +788,21 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_START: - globalCtx->envCtx.screenFillColor[0] = 0xDC; - globalCtx->envCtx.screenFillColor[1] = 0xDC; - globalCtx->envCtx.screenFillColor[2] = 0xBE; - globalCtx->envCtx.screenFillColor[3] = 0xD2; - func_8002DF54(globalCtx, &this->actor, 8); + play->envCtx.screenFillColor[0] = 0xDC; + play->envCtx.screenFillColor[1] = 0xDC; + play->envCtx.screenFillColor[2] = 0xBE; + play->envCtx.screenFillColor[3] = 0xD2; + func_8002DF54(play, &this->actor, 8); player->actor.world.rot.y = player->actor.shape.rot.y = 0x7FFF; sCsState++; break; case INTRO_LOOK_DOOR: - func_80064520(globalCtx, &globalCtx->csCtx); + func_80064520(play, &play->csCtx); if (sCsCamera == SUBCAM_FREE) { - sCsCamera = Gameplay_CreateSubCamera(globalCtx); + sCsCamera = Play_CreateSubCamera(play); } - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE); sCameraNextEye.x = sCameraEye.x = 13.0f; sCameraNextEye.y = sCameraEye.y = 124.0f; @@ -820,7 +820,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { case INTRO_CLOSE_DOOR: this->timer--; if (this->timer == 0) { - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); sCsState++; this->timer = 30; } @@ -835,16 +835,16 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_CRACKLE: - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); sCsState++; break; case INTRO_SPAWN_BARI: - func_80064520(globalCtx, &globalCtx->csCtx); + func_80064520(play, &play->csCtx); if (sCsCamera == SUBCAM_FREE) { - sCsCamera = Gameplay_CreateSubCamera(globalCtx); + sCsCamera = Play_CreateSubCamera(play); } - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE); sCameraNextEye.x = sCameraEye.x = 13.0f; sCameraNextEye.y = sCameraEye.y = 124.0f; @@ -858,7 +858,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i); @@ -947,12 +947,12 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { if (sBodyBari[i - 1]) { if (sBodyBari[i - 1] == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_STICK); - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); if (this->onCeiling == 0) { this->onCeiling = 2; // Not used by body } } else if (sBodyBari[i - 1] == 2) { - BossVa_Spark(globalCtx, this, 6, 140, 50.0f, 30.0f, SPARK_BARI, i, true); + BossVa_Spark(play, this, 6, 140, 50.0f, 30.0f, SPARK_BARI, i, true); } if (sBodyBari[i - 1] <= 2) { @@ -965,8 +965,8 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { sCameraEyeMaxVel.z = sCameraEyeMaxVel.x; sCameraAtMaxVel = sCameraEyeMaxVel; if (this->timer >= 45000) { - globalCtx->envCtx.unk_BF = 1; - func_8002DF54(globalCtx, &this->actor, 8); + play->envCtx.unk_BF = 1; + func_8002DF54(play, &this->actor, 8); } else if (this->timer >= 35000) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } @@ -984,7 +984,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { sCameraNextAt.z = -200.0f; if (!(gSaveContext.eventChkInf[7] & 0x40)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gBarinadeTitleCardTex), 160, 180, 128, 40, true); } @@ -1001,7 +1001,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_TITLE: - BossVa_Spark(globalCtx, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); + BossVa_Spark(play, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); this->timer--; if (this->timer == 0) { sCsState++; @@ -1009,7 +1009,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_BRIGHTEN: - BossVa_Spark(globalCtx, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); + BossVa_Spark(play, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); this->timer--; if (this->timer == 0) { sCsState++; @@ -1019,11 +1019,11 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { case INTRO_FINISH: this->timer--; if (this->timer == 0) { - Gameplay_ClearCamera(globalCtx, sCsCamera); + Play_ClearCamera(play, sCsCamera); sCsCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 7); sCsState++; gSaveContext.eventChkInf[7] |= 0x40; player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; @@ -1036,8 +1036,8 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { if (sCsState >= INTRO_BODY_SOUND) { func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f); - if ((sCsState >= INTRO_CALL_BARI) && ((globalCtx->gameplayFrames % 4) == 0)) { - BossVa_Spark(globalCtx, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); + if ((sCsState >= INTRO_CALL_BARI) && ((play->gameplayFrames % 4) == 0)) { + BossVa_Spark(play, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); } } @@ -1050,7 +1050,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&sCameraAt.x, sCameraNextAt.x, 0.3f, sCameraAtMaxVel.x, 0.075f); Math_SmoothStepToF(&sCameraAt.y, sCameraNextAt.y, 0.3f, sCameraAtMaxVel.y, 0.075f); Math_SmoothStepToF(&sCameraAt.z, sCameraNextAt.z, 0.3f, sCameraAtMaxVel.z, 0.075f); - Gameplay_CameraSetAtEye(globalCtx, sCsCamera, &sCameraAt, &sCameraEye); + Play_CameraSetAtEye(play, sCsCamera, &sCameraAt, &sCameraEye); } } @@ -1065,8 +1065,8 @@ void BossVa_SetupBodyPhase1(BossVa* this) { BossVa_SetupAction(this, BossVa_BodyPhase1); } -void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BodyPhase1(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_1B0 += 0xCE4; this->bodyGlow = (s16)(Math_SinS(this->unk_1B0) * 50.0f) + 150; @@ -1080,7 +1080,7 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } @@ -1091,7 +1091,7 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime) && (sFightPhase >= PHASE_2)) { - BossVa_SetupBodyPhase2(this, globalCtx); + BossVa_SetupBodyPhase2(this, play); } Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x, 1, 0xC8, 0); @@ -1099,8 +1099,8 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 1, 100, 50.0f, 10.0f, SPARK_BARI, 10.0f, false); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 1, 100, 50.0f, 10.0f, SPARK_BARI, 10.0f, false); } if (Rand_ZeroOne() < 0.1f) { @@ -1108,17 +1108,17 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f); } -void BossVa_SetupBodyPhase2(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBodyPhase2(BossVa* this, PlayState* play) { s32 i; sFightPhase++; for (i = BOSSVA_BARI_UPPER_5; i >= BOSSVA_BARI_UPPER_1; i--) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, @@ -1130,8 +1130,8 @@ void BossVa_SetupBodyPhase2(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BodyPhase2); } -void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BodyPhase2(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp48; if (this->actor.colorFilterTimer == 0) { @@ -1171,7 +1171,7 @@ void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { sPhase2Timer = (sPhase2Timer + 0x18) & 0xFFF0; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } } @@ -1181,7 +1181,7 @@ void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { sp48.y += 310.0f + (this->actor.shape.yOffset * this->actor.scale.y); sp48.x += -10.0f; sp48.z += 220.0f; - BossVa_SpawnSparkBall(globalCtx, sVaEffects, this, &sp48, 4, 0); + BossVa_SpawnSparkBall(play, sVaEffects, this, &sp48, 4, 0); } if (Rand_ZeroOne() < 0.1f) { @@ -1206,21 +1206,21 @@ void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); } this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 45.0f; Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); } if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, @@ -1234,9 +1234,9 @@ void BossVa_SetupBodyPhase3(BossVa* this) { BossVa_SetupAction(this, BossVa_BodyPhase3); } -void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BodyPhase3(BossVa* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; s16 sp62; @@ -1246,7 +1246,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1284,7 +1284,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, sp62, 1, 0x3E8, 0); } else if (player->invincibilityTimer != 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 0x12C, 0); - } else if ((globalCtx->gameplayFrames & 0x80) == 0) { + } else if ((play->gameplayFrames & 0x80) == 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x12C, 0); } else { Math_SmoothStepToS(&this->actor.world.rot.y, sp62, 1, 0x258, 0); @@ -1296,7 +1296,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (SkelAnime_Update(&this->skelAnime) && (sFightPhase >= PHASE_4)) { - BossVa_SetupBodyPhase4(this, globalCtx); + BossVa_SetupBodyPhase4(this, play); } this->actor.shape.rot.y += this->vaBodySpinRate; @@ -1308,7 +1308,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { if ((this->actor.shape.yOffset >= -500.0f) && (sFightPhase == PHASE_3)) { for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_LOWER_1; i--) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, @@ -1320,8 +1320,8 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 1, 0x64, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 1, 0x64, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); } this->actor.focus.pos = this->actor.world.pos; @@ -1331,17 +1331,17 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); if (this->timer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, (this->vaBodySpinRate * 0.00025f) + 1.0f); } -void BossVa_SetupBodyPhase4(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBodyPhase4(BossVa* this, PlayState* play) { this->unk_1AC = 0; this->actor.flags |= ACTOR_FLAG_0; this->vaBodySpinRate = this->unk_1AC; @@ -1357,8 +1357,8 @@ void BossVa_SetupBodyPhase4(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BodyPhase4); } -void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BodyPhase4(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 tmpf1; EnBoom* boomerang; @@ -1367,7 +1367,7 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1392,8 +1392,8 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { sFightPhase++; sPhase4HP += 3; if (sFightPhase >= PHASE_DEATH) { - BossVa_SetupBodyDeath(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossVa_SetupBodyDeath(this, play); + Enemy_StartFinishingBlow(play, &this->actor); return; } this->actor.speedXZ = -10.0f; @@ -1446,8 +1446,8 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { if ((player->stateFlags1 & 0x4000000) && (this->timer < -60)) { this->timer = -59; } - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 2, 0x64, 220.0f, 5.0f, SPARK_BODY, 12.0f, true); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 2, 0x64, 220.0f, 5.0f, SPARK_BODY, 12.0f, true); } if (this->timer < -30) { if (this->actor.speedXZ > 0.0f) { @@ -1487,7 +1487,7 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { 1, 0x5DC, 0); } else if (player->invincibilityTimer != 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 0x12C, 0); - } else if ((globalCtx->gameplayFrames & 0x80) == 0) { + } else if ((play->gameplayFrames & 0x80) == 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, (s16)((sFightPhase - PHASE_4 + 1) * 100.0f) + 0x64, 0); } @@ -1496,19 +1496,19 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 60.0f; - if (((globalCtx->gameplayFrames % 2) == 0) && (this->timer == 0)) { - BossVa_Spark(globalCtx, this, 2, 125, 40.0f, 10.0f, SPARK_BODY, 10.0f, false); - BossVa_Spark(globalCtx, this, 1, 100, 15.0f, 10.0f, SPARK_BARI, 11.0f, true); + if (((play->gameplayFrames % 2) == 0) && (this->timer == 0)) { + BossVa_Spark(play, this, 2, 125, 40.0f, 10.0f, SPARK_BODY, 10.0f, false); + BossVa_Spark(play, this, 1, 100, 15.0f, 10.0f, SPARK_BARI, 11.0f, true); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 70.0f, 0.0f, 1); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 70.0f, 0.0f, 1); Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); if (this->invincibilityTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } if ((this->vaBodySpinRate > 0x3E8) || (this->actor.shape.yOffset < -1200.0f)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, (this->vaBodySpinRate * 0.00025f) + 1.0f); @@ -1520,7 +1520,7 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupBodyDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBodyDeath(BossVa* this, PlayState* play) { func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); @@ -1528,24 +1528,24 @@ void BossVa_SetupBodyDeath(BossVa* this, GlobalContext* globalCtx) { sCsState = DEATH_START; this->actor.speedXZ = 0.0f; this->unk_1A8 = 0.0f; - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); BossVa_SetupAction(this, BossVa_BodyDeath); } -void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BodyDeath(BossVa* this, PlayState* play) { s32 i; - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* camera = Play_GetCamera(play, 0); s32 sp7C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 tmp16; switch (sCsState) { case DEATH_START: - func_8002DF54(globalCtx, &this->actor, 1); - func_80064520(globalCtx, &globalCtx->csCtx); - sCsCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 1); + func_80064520(play, &play->csCtx); + sCsCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE); sCameraNextAt.x = this->actor.world.pos.x; sCameraNextAt.y = this->actor.world.pos.y; @@ -1562,10 +1562,10 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC = Math_Vec3f_Yaw(&sCameraEye, &sCameraNextAt) - 0x100; this->unk_1B0 = 15; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 0xFF; - globalCtx->envCtx.screenFillColor[3] = 0; - globalCtx->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = + play->envCtx.screenFillColor[2] = 0xFF; + play->envCtx.screenFillColor[3] = 0; + play->envCtx.fillScreen = true; sCsState++; case DEATH_BODY_TUMORS: this->unk_1AC += 0x100; @@ -1576,12 +1576,12 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { sCameraEyeMaxVel.y = sCameraEyeMaxVel.x * 0.5f; sCameraAtMaxVel = sCameraEyeMaxVel; tmp16 = Rand_CenteredFloat(0.5f) + ((sCameraEyeMaxVel.x * 0.5f) + 0.6f); - if (((globalCtx->gameplayFrames % 4) == 0) && (this->unk_1B0 != 0)) { + if (((play->gameplayFrames % 4) == 0) && (this->unk_1B0 != 0)) { for (i = 6; i > 1; i--) { - BossVa_Tumor(globalCtx, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, i, true); + BossVa_Tumor(play, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, i, true); } - BossVa_Tumor(globalCtx, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, 11.0f, true); + BossVa_Tumor(play, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, 11.0f, true); this->unk_1B0--; } @@ -1600,11 +1600,11 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->isDead++; this->timer = 30; sCsState++; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BALINADE_DEAD, 1, 1, + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_BALINADE_DEAD, 1, 1, 0x28); this->onCeiling = 2; // Not used by body - BossVa_SetDeathEnv(globalCtx); - func_8002DF54(globalCtx, &this->actor, 8); + BossVa_SetDeathEnv(play); + func_8002DF54(play, &this->actor, 8); } break; case DEATH_CORE_BURST: @@ -1636,19 +1636,19 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->timer--; if (this->timer == 0) { - Gameplay_ClearCamera(globalCtx, sCsCamera); + Play_ClearCamera(play, sCsCamera); sCsCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + func_80064534(play, &play->csCtx); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); camera->eyeNext = camera->eye = sCameraEye; camera->at = sCameraAt; - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); sCsState++; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); for (i = 2, sp7C = 2; i > 0; i--) { @@ -1658,12 +1658,12 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { } } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_RU1, sWarpPos[sp7C].x, sWarpPos[sp7C].y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RU1, sWarpPos[sp7C].x, sWarpPos[sp7C].y, sWarpPos[sp7C].z, 0, 0, 0, 0); } case DEATH_FINISH: Rand_CenteredFloat(0.5f); - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; break; } @@ -1674,7 +1674,7 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&sCameraAt.x, sCameraNextAt.x, 0.3f, sCameraAtMaxVel.x, 0.15f); Math_SmoothStepToF(&sCameraAt.y, sCameraNextAt.y, 0.3f, sCameraAtMaxVel.y, 0.15f); Math_SmoothStepToF(&sCameraAt.z, sCameraNextAt.z, 0.3f, sCameraAtMaxVel.z, 0.15f); - Gameplay_CameraSetAtEye(globalCtx, sCsCamera, &sCameraAt, &sCameraEye); + Play_CameraSetAtEye(play, sCsCamera, &sCameraAt, &sCameraEye); } SkelAnime_Update(&this->skelAnime); @@ -1682,8 +1682,8 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->vaBodySpinRate, 0, 1, 0xC8, 0); Math_SmoothStepToS(&this->vaCamRotMod, 0, 1, 0xC8, 0); Math_SmoothStepToS(&this->bodyGlow, 200, 1, 10, 0); - if (globalCtx->envCtx.screenFillColor[3] != 0) { - globalCtx->envCtx.screenFillColor[3] -= 50; + if (play->envCtx.screenFillColor[3] != 0) { + play->envCtx.screenFillColor[3] -= 50; } Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -1694,21 +1694,21 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; } -void BossVa_SetupSupportIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupSupportIntro(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeSupportAttachedAnim, 0.0f, 0.0f, Animation_GetLastFrame(&gBarinadeSupportAttachedAnim), ANIMMODE_LOOP_INTERP, 0.0f); this->timer = 0; BossVa_SetupAction(this, BossVa_SupportIntro); } -void BossVa_SupportIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SupportIntro(BossVa* this, PlayState* play) { BossVa_AttachToBody(this); if (sCsState == BOSSVA_BATTLE) { - BossVa_SetupSupportAttached(this, globalCtx); + BossVa_SetupSupportAttached(this, play); } else if (sCsState >= INTRO_REVERSE_CAMERA) { this->timer++; if ((this->timer % 2) == 0) { - BossVa_Spark(globalCtx, this, 2, 90, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); + BossVa_Spark(play, this, 2, 90, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); } SkelAnime_Update(&this->skelAnime); @@ -1719,14 +1719,14 @@ void BossVa_SupportIntro(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupSupportAttached(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupSupportAttached(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeSupportAttachedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeSupportAttachedAnim), ANIMMODE_LOOP, 0.0f); this->timer = this->actor.params * 10; BossVa_SetupAction(this, BossVa_SupportAttached); } -void BossVa_SupportAttached(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SupportAttached(BossVa* this, PlayState* play) { this->timer++; if (sBodyState & 0x7F) { Actor_SetColorFilter(&this->actor, 0, 255, 0, 12); @@ -1750,32 +1750,32 @@ void BossVa_SupportAttached(BossVa* this, GlobalContext* globalCtx) { } if (this->colliderSph.base.acFlags & AC_HIT) { - BossVa_SetupSupportCut(this, globalCtx); + BossVa_SetupSupportCut(this, play); } else { if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); } if ((this->timer % 2) == 0) { - BossVa_Spark(globalCtx, this, 1, 100, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); + BossVa_Spark(play, this, 1, 100, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); } } } -void BossVa_SetupSupportCut(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupSupportCut(BossVa* this, PlayState* play) { s32 stumpParams = this->actor.params + BOSSVA_STUMP_1; sBodyState++; sFightPhase++; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_VA, this->armTip.x, this->armTip.y + 20.0f, this->armTip.z, + Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_VA, this->armTip.x, this->armTip.y + 20.0f, this->armTip.z, 0, this->actor.shape.rot.y, 0, stumpParams); - Camera_AddQuake(&globalCtx->mainCamera, 2, 11, 8); + Camera_AddQuake(&play->mainCamera, 2, 11, 8); this->burst = false; this->timer2 = 0; BossVa_SetupAction(this, BossVa_SupportCut); } -void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SupportCut(BossVa* this, PlayState* play) { BossVa* vaBody = GET_BODY(this); f32 lastFrame; @@ -1785,8 +1785,8 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { lastFrame = Animation_GetLastFrame(&gBarinadeSupportCutAnim); this->onCeiling = false; this->timer = (s32)(Rand_ZeroOne() * 10.0f) + 5; - SkelAnime_Free(&this->skelAnime, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeCutSupportSkel, &gBarinadeSupportCutAnim, NULL, NULL, + SkelAnime_Free(&this->skelAnime, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeCutSupportSkel, &gBarinadeSupportCutAnim, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gBarinadeSupportCutAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); sBodyState = 0; @@ -1817,7 +1817,7 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { if ((this->timer == 0) && (sCsState < DEATH_START)) { this->timer = (s32)(Rand_ZeroOne() * 10.0f) + 10; - BossVa_BloodDroplets(globalCtx, &this->armTip, this->headRot.x, this->actor.shape.rot.y); + BossVa_BloodDroplets(play, &this->armTip, this->headRot.x, this->actor.shape.rot.y); } if (sCsState >= DEATH_START) { @@ -1837,8 +1837,8 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { case DEATH_CORE_DEAD: case DEATH_CORE_BURST: if (!this->burst) { - if ((globalCtx->gameplayFrames % 2) != 0) { - BossVa_Tumor(globalCtx, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 7.0f, 5.0f, TUMOR_ARM, + if ((play->gameplayFrames % 2) != 0) { + BossVa_Tumor(play, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 7.0f, 5.0f, TUMOR_ARM, (this->timer2 >> 3) + 1, true); } @@ -1863,14 +1863,14 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { this->timer--; } -void BossVa_SetupStump(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupStump(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeStumpAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeStumpAnim), ANIMMODE_ONCE, 0.0f); this->actor.flags &= ~ACTOR_FLAG_0; BossVa_SetupAction(this, BossVa_Stump); } -void BossVa_Stump(BossVa* this, GlobalContext* globalCtx) { +void BossVa_Stump(BossVa* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && (Rand_ZeroOne() < 0.3f)) { this->skelAnime.curFrame -= Rand_ZeroOne() * 3.0f; } @@ -1880,7 +1880,7 @@ void BossVa_Stump(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperIntro(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, 1.0f, lastFrame - 1.0f, lastFrame, @@ -1889,7 +1889,7 @@ void BossVa_SetupZapperIntro(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperIntro); } -void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperIntro(BossVa* this, PlayState* play) { BossVa_AttachToBody(this); switch (sCsState) { @@ -1899,7 +1899,7 @@ void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); break; case BOSSVA_BATTLE: - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); break; } @@ -1907,7 +1907,7 @@ void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_1F0, this->skelAnime.jointTable[7].z, 1, 0x2EE, 0); } -void BossVa_SetupZapperAttack(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperAttack(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, 1.0f, lastFrame - 1.0f, lastFrame, @@ -1916,8 +1916,8 @@ void BossVa_SetupZapperAttack(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperAttack); } -void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_ZapperAttack(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnBoom* boomerang; Actor* boomTarget; s16 yaw; @@ -1944,7 +1944,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { s16 sp54; f32 sp50; - boomerang = BossVa_FindBoomerang(globalCtx); + boomerang = BossVa_FindBoomerang(play); if ((boomerang == NULL) || (boomerang->moveTo == NULL) || (boomerang->moveTo == &player->actor)) { sp7C = player->actor.world.pos; @@ -1995,17 +1995,17 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); BossVa_AttachToBody(this); if (sFightPhase >= PHASE_4) { - BossVa_SetupZapperEnraged(this, globalCtx); + BossVa_SetupZapperEnraged(this, play); return; } if (sBodyState & 0x7F) { - BossVa_SetupZapperDamaged(this, globalCtx); + BossVa_SetupZapperDamaged(this, play); return; } if ((sFightPhase < PHASE_4) && (GET_BODY(this)->actor.speedXZ != 0.0f)) { - BossVa_SetupZapperHold(this, globalCtx); + BossVa_SetupZapperHold(this, play); return; } @@ -2066,7 +2066,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { if (this->colliderLightning.base.atFlags & AT_HIT) { if (this->timer2 > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HIT_RINK); - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); this->timer2 = -1; GET_BODY(this)->onCeiling = 6; // not used by body } @@ -2075,7 +2075,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { } if ((this->timer2 < 0) && (player->stateFlags1 & 0x4000000)) { - BossVa_Spark(globalCtx, this, 1, 30, 0.0f, 0.0f, SPARK_LINK, 0.0f, true); + BossVa_Spark(play, this, 1, 30, 0.0f, 0.0f, SPARK_LINK, 0.0f, true); } } @@ -2093,20 +2093,20 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { if (this->timer2 == 32) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_THUNDER); } - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderLightning.base); } else { - BossVa_Spark(globalCtx, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); + BossVa_Spark(play, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); if (this->timer2 == 30) { - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); } if (this->timer2 == 20) { Vec3f sp44 = this->zapHeadPos; - BossVa_SpawnZapperCharge(globalCtx, sVaEffects, this, &sp44, &this->headRot, 100, 0); + BossVa_SpawnZapperCharge(play, sVaEffects, this, &sp44, &this->headRot, 100, 0); } } @@ -2117,7 +2117,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperDamaged(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperDamaged(BossVa* this, PlayState* play) { if (Rand_ZeroOne() > 0.5f) { Animation_Change(&this->skelAnime, &gBarinadeZapperDamage1Anim, 0.5f, 0.0f, Animation_GetLastFrame(&gBarinadeZapperDamage1Anim), ANIMMODE_ONCE_INTERP, 4.0f); @@ -2131,7 +2131,7 @@ void BossVa_SetupZapperDamaged(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperDamaged); } -void BossVa_ZapperDamaged(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperDamaged(BossVa* this, PlayState* play) { BossVa_AttachToBody(this); Math_SmoothStepToS(&this->unk_1E6, 0, 1, 0xFA0, 0); Math_SmoothStepToS(&this->unk_1E4, 0, 1, 0xFA0, 0); @@ -2141,14 +2141,14 @@ void BossVa_ZapperDamaged(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_1F0, this->skelAnime.jointTable[7].z, 1, 0x2EE, 0); if (SkelAnime_Update(&this->skelAnime)) { if (sFightPhase >= PHASE_4) { - BossVa_SetupZapperEnraged(this, globalCtx); + BossVa_SetupZapperEnraged(this, play); } else { - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); } } } -void BossVa_SetupZapperDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperDeath(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, Rand_ZeroOne() + 0.25f, Rand_ZeroOne() * 3.0f, @@ -2159,13 +2159,13 @@ void BossVa_SetupZapperDeath(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperDeath); } -void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperDeath(BossVa* this, PlayState* play) { f32 sp3C = 55.0f; f32 tmpf1; f32 tmpf2; BossVa_AttachToBody(this); - if (((globalCtx->gameplayFrames % 32) == 0) && (sCsState <= DEATH_BODY_TUMORS)) { + if (((play->gameplayFrames % 32) == 0) && (sCsState <= DEATH_BODY_TUMORS)) { this->unk_1E8 = Rand_CenteredFloat(0x4000); this->unk_1EE = Rand_CenteredFloat(0x4000); this->unk_1F4 = (s16)Rand_CenteredFloat(0x4000) + this->actor.shape.rot.y - this->actor.shape.rot.x; @@ -2192,21 +2192,21 @@ void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx) { if ((this->timer2 % 2) == 0 && (this->timer2 >= 0)) { if (this->timer2 < 8) { - BossVa_Tumor(globalCtx, this, 1, (s16)Rand_CenteredFloat(5.0f) + 0xD, 0.0f, 0.0f, TUMOR_ARM, + BossVa_Tumor(play, this, 1, (s16)Rand_CenteredFloat(5.0f) + 0xD, 0.0f, 0.0f, TUMOR_ARM, 0.6f, true); } else { - BossVa_Tumor(globalCtx, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 0.0f, 7.0f, TUMOR_ARM, + BossVa_Tumor(play, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 0.0f, 7.0f, TUMOR_ARM, (this->timer2 >> 3) + 1, true); } - BossVa_Spark(globalCtx, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); + BossVa_Spark(play, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); } this->timer2++; if (this->timer2 >= 32) { this->burst++; this->isDead = true; - BossVa_SetDeathEnv(globalCtx); + BossVa_SetDeathEnv(play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_BREAK2); } } else { @@ -2237,7 +2237,7 @@ void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperEnraged(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperEnraged(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, 1.0f, lastFrame - 1.0f, lastFrame, @@ -2246,8 +2246,8 @@ void BossVa_SetupZapperEnraged(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperEnraged); } -void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_ZapperEnraged(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 tmp16; s16 sp6C; @@ -2261,12 +2261,12 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); BossVa_AttachToBody(this); if (sFightPhase >= PHASE_DEATH) { - BossVa_SetupZapperDeath(this, globalCtx); + BossVa_SetupZapperDeath(this, play); return; } if (sBodyState & 0x7E) { - BossVa_SetupZapperDamaged(this, globalCtx); + BossVa_SetupZapperDamaged(this, play); return; } @@ -2324,7 +2324,7 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { if (this->colliderLightning.base.atFlags & AT_HIT) { if (this->timer2 > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HIT_RINK); - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); this->timer2 = -1; GET_BODY(this)->onCeiling = 6; // not used by body } @@ -2333,7 +2333,7 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { } if ((this->timer2 < 0) && (player->stateFlags1 & 0x4000000)) { - BossVa_Spark(globalCtx, this, 1, 30, 0.0f, 0, SPARK_LINK, 0.0f, true); + BossVa_Spark(play, this, 1, 30, 0.0f, 0, SPARK_LINK, 0.0f, true); } } @@ -2352,20 +2352,20 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_THUNDER); } - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderLightning.base); } else { - BossVa_Spark(globalCtx, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 1) + 1, true); + BossVa_Spark(play, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 1) + 1, true); if (this->timer2 == 14) { - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); } if (this->timer2 == 4) { Vec3f sp48 = this->zapHeadPos; - BossVa_SpawnZapperCharge(globalCtx, sVaEffects, this, &sp48, &this->headRot, 100, 0); + BossVa_SpawnZapperCharge(play, sVaEffects, this, &sp48, &this->headRot, 100, 0); } } @@ -2376,14 +2376,14 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperHold(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperHold(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeZapperDamage2Anim, 0.0f, 0.0f, Animation_GetLastFrame(&gBarinadeZapperDamage2Anim), ANIMMODE_ONCE_INTERP, -6.0f); this->burst = false; BossVa_SetupAction(this, BossVa_ZapperHold); } -void BossVa_ZapperHold(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperHold(BossVa* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); BossVa_AttachToBody(this); Math_SmoothStepToS(&this->unk_1E6, 0, 1, 0x1770, 0); @@ -2393,11 +2393,11 @@ void BossVa_ZapperHold(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_1F2, this->actor.shape.rot.y - 0x4000, 1, 0x2710, 0); Math_SmoothStepToS(&this->unk_1F0, this->skelAnime.jointTable[7].z - 0x1388, 1, 0x1770, 0); if (GET_BODY(this)->actor.speedXZ == 0.0f) { - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); } } -void BossVa_SetupBariIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariIntro(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeBariAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeBariAnim), ANIMMODE_LOOP, 0.0f); this->unk_1A0 = 60.0f; @@ -2413,7 +2413,7 @@ void BossVa_SetupBariIntro(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BariIntro); } -void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BariIntro(BossVa* this, PlayState* play) { Vec3f sp54 = this->actor.home.pos; f32 sp50 = 40.0f; s16 sp4E; @@ -2428,7 +2428,7 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { switch (sCsState) { case INTRO_LOOK_BARI: if (this->actor.params == BOSSVA_BARI_UPPER_1) { - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); if (Math_SmoothStepToF(&this->actor.world.pos.y, 60.0f, 0.3f, 1.0f, 0.15f) == 0.0f) { this->timer--; if (this->timer == 0) { @@ -2498,7 +2498,7 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { func_80035844(&GET_BODY(this)->actor.world.pos, &this->actor.world.pos, &this->actor.world.rot, false); this->unk_1A0 = Math_Vec3f_DistXYZ(&GET_BODY(this)->actor.world.pos, &this->actor.world.pos); if (sp50 > 30.0f) { - BossVa_Spark(globalCtx, this, 1, 80, 15.0f, 0.0f, SPARK_BARI, 1.0f, true); + BossVa_Spark(play, this, 1, 80, 15.0f, 0.0f, SPARK_BARI, 1.0f, true); } } break; @@ -2514,8 +2514,8 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { break; } - if (((globalCtx->gameplayFrames % 4) == 0) && (sCsState < INTRO_ATTACH_BARI)) { - BossVa_Spark(globalCtx, this, 1, 70, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); + if (((play->gameplayFrames % 4) == 0) && (sCsState < INTRO_ATTACH_BARI)) { + BossVa_Spark(play, this, 1, 70, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); } if (Rand_ZeroOne() < 0.1f) { @@ -2523,7 +2523,7 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupBariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariPhase3Attack(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeBariAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeBariAnim), ANIMMODE_LOOP, 0.0f); this->timer2 = 0x80; @@ -2534,8 +2534,8 @@ void BossVa_SetupBariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BariPhase3Attack); } -void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BariPhase3Attack(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnBoom* boomerang; Vec3f sp54 = GET_BODY(this)->unk_1D8; s16 sp52; @@ -2544,7 +2544,7 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { this->unk_1A4 += Rand_ZeroOne() * 0.5f; sp52 = this->timer2 & 0x1FF; - if ((globalCtx->gameplayFrames % 128) == 0) { + if ((play->gameplayFrames % 128) == 0) { this->vaBariUnused.x = (s16)(Rand_ZeroOne() * 100.0f) + 100; } @@ -2552,7 +2552,7 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { this->vaBariUnused.y += this->vaBariUnused.z; if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { - func_8002F71C(globalCtx, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); this->colliderSph.base.at = NULL; this->colliderLightning.base.at = NULL; @@ -2587,16 +2587,16 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { } if (sp52 >= 128) { - BossVa_Spark(globalCtx, this, 1, 75, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + BossVa_Spark(play, this, 1, 75, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); sPhase3StopMoving = false; } else { sPhase3StopMoving = true; } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); - if ((globalCtx->gameplayFrames % 4) == 0) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x78, 1, 0xA, 0); } @@ -2606,11 +2606,11 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { this->actor.world.rot.y += this->unk_1AC; if (sBodyState & 0x7F) { - BossVa_SetupBariPhase3Stunned(this, globalCtx); + BossVa_SetupBariPhase3Stunned(this, play); } } -void BossVa_SetupBariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariPhase2Attack(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeBariAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeBariAnim), ANIMMODE_LOOP, 0.0f); this->timer2 = 0x40; @@ -2621,8 +2621,8 @@ void BossVa_SetupBariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BariPhase2Attack); } -void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnBoom* boomerang; Vec3f sp54 = GET_BODY(this)->unk_1D8; s16 sp52; @@ -2632,7 +2632,7 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { this->unk_1A4 += Rand_ZeroOne() * 0.5f; sp52 = this->timer2 & 0x1FF; - if ((globalCtx->gameplayFrames % 128) == 0) { + if ((play->gameplayFrames % 128) == 0) { this->vaBariUnused.x = (s16)(Rand_ZeroOne() * 100.0f) + 100; } @@ -2641,13 +2641,13 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { this->vaBariUnused.y += this->vaBariUnused.z; if (sKillBari != 0) { sKillBari--; - BossVa_KillBari(this, globalCtx); + BossVa_KillBari(this, play); return; } if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { - func_8002F71C(globalCtx, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); this->colliderSph.base.at = NULL; this->colliderLightning.base.at = NULL; @@ -2659,14 +2659,14 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.y, 4.0f, 1.0f, 2.0f, 0.0f); this->actor.world.rot.x = Math_Vec3f_Pitch(&sp54, &this->actor.world.pos); - if ((globalCtx->gameplayFrames % 8) == 0) { + if ((play->gameplayFrames % 8) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x28, 1, 0xA, 0); - BossVa_Spark(globalCtx, this, 1, this->unk_1F0, 25.0f, 20.0f, 2, 2.0f, true); + BossVa_Spark(play, this, 1, this->unk_1F0, 25.0f, 20.0f, 2, 2.0f, true); } if (!(sPhase2Timer & 0x100) && (GET_BODY(this)->actor.colorFilterTimer == 0)) { sp4C = 200.0f; - BossVa_Spark(globalCtx, this, 1, 125, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); + BossVa_Spark(play, this, 1, 125, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.params & 1) { sp4C = -200.0f; @@ -2687,8 +2687,8 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } else { this->actor.flags |= ACTOR_FLAG_0; Math_SmoothStepToS(&this->unk_1AC, sp50 + 150, 1, 0x3C, 0); @@ -2703,13 +2703,13 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { this->actor.world.pos.y += Math_SinF(this->unk_1A4) * 4.0f; if (this->colliderSph.base.acFlags & AC_HIT) { - BossVa_KillBari(this, globalCtx); + BossVa_KillBari(this, play); } } Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x5DC, 0); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); - if ((globalCtx->gameplayFrames % 4) == 0) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x78, 1, 0xA, 0); } @@ -2729,30 +2729,30 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupBariPhase3Stunned(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariPhase3Stunned(BossVa* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0; this->timer = GET_BODY(this)->timer; Actor_SetColorFilter(&this->actor, 0, 255, 0x2000, this->timer); BossVa_SetupAction(this, BossVa_BariPhase3Stunned); } -void BossVa_BariPhase3Stunned(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BariPhase3Stunned(BossVa* this, PlayState* play) { s32 sp44_pad; Vec3f sp40 = GET_BODY(this)->unk_1D8; this->actor.world.rot.x = Math_Vec3f_Pitch(&GET_BODY(this)->actor.world.pos, &this->actor.world.pos); if (this->colliderSph.base.acFlags & AC_HIT) { - BossVa_KillBari(this, globalCtx); + BossVa_KillBari(this, play); return; } this->unk_1A4 += Rand_ZeroOne() * 0.5f; Math_SmoothStepToF(&this->actor.world.pos.y, 4.0f, 1.0f, 2.0f, 0.0f); this->actor.world.pos.y += Math_SinF(this->unk_1A4) * 3.0f; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); - if ((globalCtx->gameplayFrames % 4) == 0) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x28, 1, 0xA, 0); - BossVa_Spark(globalCtx, this, 1, this->unk_1F0, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); + BossVa_Spark(play, this, 1, this->unk_1F0, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); } this->timer--; @@ -2761,7 +2761,7 @@ void BossVa_BariPhase3Stunned(BossVa* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->timer2 = 0; } else { - BossVa_Spark(globalCtx, this, 1, 85, 15.0f, 0.0f, SPARK_TETHER, 1.0f, true); + BossVa_Spark(play, this, 1, 85, 15.0f, 0.0f, SPARK_TETHER, 1.0f, true); if (this->timer2 >= 0x10) { this->actor.flags &= ~ACTOR_FLAG_0; this->timer2 = 0x80; @@ -2779,14 +2779,14 @@ void BossVa_SetupBariDeath(BossVa* this) { BossVa_SetupAction(this, BossVa_BariDeath); } -void BossVa_BariDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BariDeath(BossVa* this, PlayState* play) { this->timer--; if (this->timer == 0) { Actor_Kill(&this->actor); } } -void BossVa_SetupDoor(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupDoor(BossVa* this, PlayState* play) { if (sCsState >= INTRO_SPAWN_BARI) { sDoorState = 100; } @@ -2794,7 +2794,7 @@ void BossVa_SetupDoor(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_Door); } -void BossVa_Door(BossVa* this, GlobalContext* globalCtx) { +void BossVa_Door(BossVa* this, PlayState* play) { if (sDoorState == 29) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUYODOOR_CLOSE); } @@ -2808,13 +2808,13 @@ void BossVa_Door(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossVa_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossVa* this = (BossVa*)thisx; EnBoom* boomerang; s32 i; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch (this->actor.params) { case BOSSVA_BODY: @@ -2826,25 +2826,25 @@ void BossVa_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - BossVa_UpdateEffects(globalCtx); + BossVa_UpdateEffects(play); for (i = 2; i >= 0; i--) { - if ((globalCtx->envCtx.adjAmbientColor[i] - 1) > 0) { - globalCtx->envCtx.adjAmbientColor[i] -= 1; + if ((play->envCtx.adjAmbientColor[i] - 1) > 0) { + play->envCtx.adjAmbientColor[i] -= 1; } else { - globalCtx->envCtx.adjAmbientColor[i] = 0; + play->envCtx.adjAmbientColor[i] = 0; } - if ((globalCtx->envCtx.adjLight1Color[i] - 10) > 0) { - globalCtx->envCtx.adjLight1Color[i] -= 10; + if ((play->envCtx.adjLight1Color[i] - 10) > 0) { + play->envCtx.adjLight1Color[i] -= 10; } else { - globalCtx->envCtx.adjLight1Color[i] = 0; + play->envCtx.adjLight1Color[i] = 0; } - if ((globalCtx->envCtx.adjFogColor[i] - 10) > 0) { - globalCtx->envCtx.adjFogColor[i] -= 10; + if ((play->envCtx.adjFogColor[i] - 10) > 0) { + play->envCtx.adjFogColor[i] -= 10; } else { - globalCtx->envCtx.adjFogColor[i] = 0; + play->envCtx.adjFogColor[i] = 0; } } @@ -2872,18 +2872,18 @@ void BossVa_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 BossVa_BodyOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossVa_BodyOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 20) { gDPPipeSync(POLY_OPA_DISP++); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, - (globalCtx->gameplayFrames * -2) % 64, 16, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, + (play->gameplayFrames * -2) % 64, 16, 16)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->bodyGlow); Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); } else if ((limbIndex >= 10) && (limbIndex < 20)) { @@ -2897,16 +2897,16 @@ s32 BossVa_BodyOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d rot->x -= 0xCCC; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return false; } -void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_BodyPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; Vec3f sp78 = { 0.0f, 0.0f, 0.0f }; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 6) { if (sFightPhase < PHASE_3) { @@ -2917,11 +2917,11 @@ void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_MultVec3f(&sp78, &this->unk_1D8); } else if ((limbIndex >= 10) && (limbIndex < 20) && (sBodyBari[limbIndex - 10] != 0)) { if (((limbIndex >= 16) || (limbIndex == 10)) && (sFightPhase <= PHASE_3)) { - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008BB8); } else if ((limbIndex >= 11) && (sFightPhase <= PHASE_2)) { - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008BB8); } @@ -2934,13 +2934,13 @@ void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_MultVec3f(&sp78, &this->effectPos[limbIndex - 10]); } else if (limbIndex == 25) { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames * 10) % 128, 16, 32, 1, 0, - (globalCtx->gameplayFrames * 5) % 128, 16, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (play->gameplayFrames * 10) % 128, 16, 32, 1, 0, + (play->gameplayFrames * 5) % 128, 16, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008D70); } else if ((*dList != NULL) && (limbIndex >= 29) && (limbIndex < 56)) { - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, *dList); } else if ((limbIndex == 24) && (sCsState < DEATH_START)) { @@ -2969,10 +2969,10 @@ void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_MultVec3f(&sp78, &this->unk_274); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 BossVa_SupportOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossVa_SupportOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; @@ -2982,7 +2982,7 @@ s32 BossVa_SupportOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return false; } -void BossVa_SupportPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_SupportPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; Vec3f sp20 = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -3026,7 +3026,7 @@ void BossVa_SupportPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d } } -s32 BossVa_ZapperOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossVa_ZapperOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; MtxF zapperMtx; @@ -3056,7 +3056,7 @@ s32 BossVa_ZapperOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void BossVa_ZapperPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_ZapperPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; Vec3f sp70 = { 0.0f, 0.0f, 0.0f }; Vec3f sp64 = { 15.0f, 0.0f, 0.0f }; @@ -3139,7 +3139,7 @@ void BossVa_ZapperPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } } -s32 BossVa_BariOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 BossVa_BariOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; @@ -3157,29 +3157,29 @@ s32 BossVa_BariOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void BossVa_BariPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_BariPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 2) { gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames * 10) % 32, 16, 32, 1, 0, - (globalCtx->gameplayFrames * -5) % 32, 16, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (play->gameplayFrames * 10) % 32, 16, 32, 1, 0, + (play->gameplayFrames * -5) % 32, 16, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_000FA0); } else if ((limbIndex == 3) || (limbIndex == 4)) { - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, *dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { - s16* paramsPtr; // This stack slot is almost certainly actually globalCtx2, but can't make it match +void BossVa_Draw(Actor* thisx, PlayState* play) { + s16* paramsPtr; // This stack slot is almost certainly actually play2, but can't make it match BossVa* this = (BossVa*)thisx; Vec3f spBC; Vec3f spB0 = { 0.0f, 45.0f, 0.0f }; @@ -3190,36 +3190,36 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp74 = { -15.0f, 40.0f, 0.0f }; Color_RGBA8 unused = { 250, 250, 230, 200 }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); paramsPtr = &this->actor.params; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->actor.params) { case BOSSVA_BODY: - if (globalCtx->envCtx.adjFogNear != 0) { - globalCtx->envCtx.adjFogNear += 0x15E; - if (globalCtx->envCtx.adjFogNear > 0) { - globalCtx->envCtx.adjFogNear = 0; + if (play->envCtx.adjFogNear != 0) { + play->envCtx.adjFogNear += 0x15E; + if (play->envCtx.adjFogNear > 0) { + play->envCtx.adjFogNear = 0; } } - if (globalCtx->envCtx.adjFogFar != 0) { - globalCtx->envCtx.adjFogFar += 0x15E; - if (globalCtx->envCtx.adjFogFar > 0) { - globalCtx->envCtx.adjFogFar = 0; + if (play->envCtx.adjFogFar != 0) { + play->envCtx.adjFogFar += 0x15E; + if (play->envCtx.adjFogFar > 0) { + play->envCtx.adjFogFar = 0; } } if (!this->isDead) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, - (globalCtx->gameplayFrames * -10) % 16, 16, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, + (play->gameplayFrames * -10) % 16, 16, 16)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames * -10) % 32, 16, - 0x20, 1, 0, (globalCtx->gameplayFrames * -5) % 32, 16, 32)); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (play->gameplayFrames * -10) % 32, 16, + 0x20, 1, 0, (play->gameplayFrames * -5) % 32, 16, 32)); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossVa_BodyOverrideLimbDraw, BossVa_BodyPostLimbDraw, this); } break; @@ -3227,7 +3227,7 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { case BOSSVA_SUPPORT_2: case BOSSVA_SUPPORT_3: if (!this->isDead) { - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossVa_SupportOverrideLimbDraw, BossVa_SupportPostLimbDraw, this); } @@ -3236,7 +3236,7 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { case BOSSVA_ZAPPER_2: case BOSSVA_ZAPPER_3: if (!this->isDead) { - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossVa_ZapperOverrideLimbDraw, BossVa_ZapperPostLimbDraw, this); } @@ -3244,12 +3244,12 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { case BOSSVA_STUMP_1: case BOSSVA_STUMP_2: case BOSSVA_STUMP_3: - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, NULL); break; default: if (!this->isDead) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossVa_BariOverrideLimbDraw, BossVa_BariPostLimbDraw, this); Collider_UpdateSpheres(0, &this->colliderSph); if (sCsState < BOSSVA_BATTLE) { @@ -3275,13 +3275,13 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { spBC = this->actor.world.pos; spBC.y += 9.0f; if (this->actor.colorFilterTimer != 0) { - func_80026A6C(globalCtx); + func_80026A6C(play); } - func_80033C30(&spBC, &spA4, 0xFF, globalCtx); + func_80033C30(&spBC, &spA4, 0xFF, play); if (this->actor.colorFilterTimer != 0) { Color_RGBA8 blue = { 0, 0, 255, 255 }; - func_80026860(globalCtx, &blue, this->actor.colorFilterTimer, this->actor.colorFilterParams & 0xFF); + func_80026860(play, &blue, this->actor.colorFilterTimer, this->actor.colorFilterParams & 0xFF); } } break; @@ -3290,19 +3290,19 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (*paramsPtr == BOSSVA_BODY) { - BossVa_DrawEffects(sVaEffects, globalCtx); + BossVa_DrawEffects(sVaEffects, play); } else if (*paramsPtr == BOSSVA_DOOR) { - BossVa_DrawDoor(globalCtx, sDoorState); + BossVa_DrawDoor(play, sDoorState); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static s32 sUnkValue = 0x009B0000; // Unreferenced? Possibly a color -void BossVa_UpdateEffects(GlobalContext* globalCtx) { +void BossVa_UpdateEffects(PlayState* play) { BossVaEffect* effect = sVaEffects; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 spB6; s16 i; f32 floorY; @@ -3412,7 +3412,7 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { if (effect->mode < BLOOD_SPOT) { sp94 = effect->pos; sp94.y -= effect->velocity.y + 4.0f; - floorY = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp90, &sp94); + floorY = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp90, &sp94); if ((sp90 != NULL) && (effect->pos.y <= floorY)) { effect->mode = BLOOD_SPOT; effect->pos.y = floorY + 1.0f; @@ -3446,7 +3446,7 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { sp80 = effect->pos; sp80.y -= effect->velocity.y + 4.0f; effect->rot.x += 0x1770; - floorY = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp7C, &sp80); + floorY = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp7C, &sp80); if ((sp7C != NULL) && (effect->pos.y <= floorY)) { effect->mode = GORE_FLOOR; effect->timer = 30; @@ -3467,7 +3467,7 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { } else { Math_SmoothStepToF(&effect->scaleMod, 0.075f, 1.0f, 0.005f, 0.0f); Math_SmoothStepToF(&effect->vaGorePulseRate, 0.0f, 0.6f, 0.005f, 0.0013f); - if ((globalCtx->gameplayFrames % 4) == 0) { + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&effect->primColor[0], 95, 1, 1, 0); } } @@ -3489,8 +3489,8 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { if (effect->timer == 0) { yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); effect->type = VA_NONE; - BossVa_BloodSplatter(globalCtx, effect, yaw, effect->scale * 4500.0f, 1); - BossVa_Gore(globalCtx, effect, yaw, effect->scale * 1.2f); + BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); + BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); } break; case TUMOR_BODY: @@ -3498,8 +3498,8 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { if (refActor->burst) { effect->type = VA_NONE; yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); - BossVa_BloodSplatter(globalCtx, effect, yaw, effect->scale * 4500.0f, 1); - BossVa_Gore(globalCtx, effect, yaw, effect->scale * 1.2f); + BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); + BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); } break; } @@ -3508,16 +3508,16 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { } } -void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { +void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) { static void* sSparkBallTex[] = { gBarinadeSparkBall1Tex, gBarinadeSparkBall2Tex, gBarinadeSparkBall3Tex, gBarinadeSparkBall4Tex, gBarinadeSparkBall5Tex, gBarinadeSparkBall6Tex, gBarinadeSparkBall7Tex, gBarinadeSparkBall8Tex, }; s16 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 flag = 0; BossVaEffect* effectHead = effect; - Camera* camera = Gameplay_GetCamera(globalCtx, sCsCamera); + Camera* camera = Play_GetCamera(play, sCsCamera); OPEN_DISPS(gfxCtx); @@ -3525,7 +3525,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->type == VA_LARGE_SPARK) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 130, 130, 30, 0); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0156A0); flag++; @@ -3533,7 +3533,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.0185f, effect->scale * 0.0185f, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -3548,12 +3548,12 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->type == VA_SPARK_BALL) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_011738); flag++; } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); @@ -3576,7 +3576,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->type == VA_BLOOD) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_009430); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gEffBubble1Tex)); flag++; @@ -3590,7 +3590,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->mode == BLOOD_SPOT) { Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); } else { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); } Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); @@ -3610,7 +3610,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, effect->envColor[3]); gSPDisplayList(POLY_OPA_DISP++, gBarinadeDL_0128B8); flag++; @@ -3634,7 +3634,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->type == VA_GORE) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gBarinadeDL_012BA0); flag++; } @@ -3667,7 +3667,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->type == VA_ZAP_CHARGE) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0135B0); flag++; } @@ -3692,7 +3692,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->type == VA_BLAST_SPARK) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093C14(globalCtx->state.gfxCtx); + func_80093C14(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 130, 130, 30, 0); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0156A0); flag++; @@ -3700,7 +3700,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.02f, effect->scale * 0.02f, 1.0f, MTXMODE_APPLY); @@ -3716,7 +3716,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->type == VA_SMALL_SPARK) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (!flag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 100, 0); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008F08); flag++; @@ -3738,9 +3738,9 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, +void BossVa_SpawnSpark(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 index; Vec3f pos = { 0.0f, -1000.0f, 0.0f }; Vec3f tempVec; @@ -3799,7 +3799,7 @@ void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* t } } -void BossVa_SpawnSparkBall(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, +void BossVa_SpawnSparkBall(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode) { Vec3f pos = { 0.0f, -1000.0f, 0.0f }; s16 i; @@ -3830,7 +3830,7 @@ void BossVa_SpawnSparkBall(GlobalContext* globalCtx, BossVaEffect* effect, BossV } } -void BossVa_SpawnBloodDroplets(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, +void BossVa_SpawnBloodDroplets(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, s16 yaw) { s32 i; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -3861,7 +3861,7 @@ void BossVa_SpawnBloodDroplets(GlobalContext* globalCtx, BossVaEffect* effect, V } } -void BossVa_SpawnBloodSplatter(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { +void BossVa_SpawnBloodSplatter(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { s32 i; f32 xzVel; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -3896,7 +3896,7 @@ void BossVa_SpawnBloodSplatter(GlobalContext* globalCtx, BossVaEffect* effect, V } } -void BossVa_SpawnTumor(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, +void BossVa_SpawnTumor(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode) { Vec3f pos = { 0.0f, -1000.0f, 0.0f }; s16 i; @@ -3929,7 +3929,7 @@ void BossVa_SpawnTumor(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* t } } -void BossVa_SpawnGore(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { +void BossVa_SpawnGore(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { s32 i; f32 xzVel; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -3972,7 +3972,7 @@ void BossVa_SpawnGore(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos } } -void BossVa_SpawnZapperCharge(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, +void BossVa_SpawnZapperCharge(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, s16 scale, u8 mode) { Vec3f unused = { 0.0f, -1000.0f, 0.0f }; s16 i; @@ -3996,7 +3996,7 @@ void BossVa_SpawnZapperCharge(GlobalContext* globalCtx, BossVaEffect* effect, Bo } } -void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { +void BossVa_DrawDoor(PlayState* play, s16 scale) { static Gfx* doorPieceDispList[] = { gBarinadeDoorPiece1DL, gBarinadeDoorPiece2DL, gBarinadeDoorPiece3DL, gBarinadeDoorPiece4DL, gBarinadeDoorPiece5DL, gBarinadeDoorPiece6DL, gBarinadeDoorPiece7DL, gBarinadeDoorPiece8DL, @@ -4007,7 +4007,7 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { f32 segAngle = 0.0f; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, 80.0f, 400.0f, MTXMODE_NEW); Matrix_RotateY(M_PI, MTXMODE_APPLY); @@ -4029,14 +4029,14 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { Matrix_RotateZ(segAngle, MTXMODE_APPLY); Matrix_Translate(0.0f, doorPieceLength[i] * yScale, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, doorPieceDispList[i]); FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) diff --git a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.h b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.h index 5d5b1b433..3b5a1ab82 100644 --- a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.h +++ b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.h @@ -6,7 +6,7 @@ struct BossVa; -typedef void (*BossVaActionFunc)(struct BossVa*, GlobalContext*); +typedef void (*BossVaActionFunc)(struct BossVa*, PlayState*); typedef struct BossVa { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index dfd767b9f..debdad31d 100644 --- a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -14,31 +14,31 @@ #define FLAGS ACTOR_FLAG_4 -void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx); -void Demo6K_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Demo6K_Update(Actor* thisx, GlobalContext* globalCtx); +void Demo6K_Init(Actor* thisx, PlayState* play); +void Demo6K_Destroy(Actor* thisx, PlayState* play); +void Demo6K_Update(Actor* thisx, PlayState* play); void Demo6K_Reset(void); -void func_80966DB0(Demo6K* this, GlobalContext* globalCtx); -void func_80966E04(Demo6K* this, GlobalContext* globalCtx); -void func_80966E98(Demo6K* this, GlobalContext* globalCtx); -void func_80966F84(Demo6K* this, GlobalContext* globalCtx); -void func_8096712C(Demo6K* this, GlobalContext* globalCtx); -void func_80967410(Demo6K* this, GlobalContext* globalCtx); -void func_809674E0(Demo6K* this, GlobalContext* globalCtx); -void func_8096784C(Demo6K* this, GlobalContext* globalCtx); +void func_80966DB0(Demo6K* this, PlayState* play); +void func_80966E04(Demo6K* this, PlayState* play); +void func_80966E98(Demo6K* this, PlayState* play); +void func_80966F84(Demo6K* this, PlayState* play); +void func_8096712C(Demo6K* this, PlayState* play); +void func_80967410(Demo6K* this, PlayState* play); +void func_809674E0(Demo6K* this, PlayState* play); +void func_8096784C(Demo6K* this, PlayState* play); void func_80967A04(Demo6K* this, s32 i); -void func_80967AD0(Demo6K* this, GlobalContext* globalCtx); -void func_80967DBC(Demo6K* this, GlobalContext* globalCtx); -void func_80967F10(Demo6K* this, GlobalContext* globalCtx); -void func_80967FFC(Actor* thisx, GlobalContext* globalCtx); -void func_80968298(Actor* thisx, GlobalContext* globalCtx); -void func_8096865C(Actor* thisx, GlobalContext* globalCtx); -void func_809688C4(Actor* thisx, GlobalContext* globalCtx); -void func_80968B70(Actor* thisx, GlobalContext* globalCtx); -void func_80968FB0(Actor* thisx, GlobalContext* globalCtx); -void func_809691BC(Demo6K* this, GlobalContext* globalCtx, s32 params); +void func_80967AD0(Demo6K* this, PlayState* play); +void func_80967DBC(Demo6K* this, PlayState* play); +void func_80967F10(Demo6K* this, PlayState* play); +void func_80967FFC(Actor* thisx, PlayState* play); +void func_80968298(Actor* thisx, PlayState* play); +void func_8096865C(Actor* thisx, PlayState* play); +void func_809688C4(Actor* thisx, PlayState* play); +void func_80968B70(Actor* thisx, PlayState* play); +void func_80968FB0(Actor* thisx, PlayState* play); +void func_809691BC(Demo6K* this, PlayState* play, s32 params); const ActorInit Demo_6K_InitVars = { ACTOR_DEMO_6K, @@ -69,7 +69,7 @@ void Demo6K_SetupAction(Demo6K* this, Demo6KActionFunc actionFunc) { this->actionFunc = actionFunc; } -void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { +void Demo6K_Init(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; s32 pad; s32 params = this->actor.params; @@ -79,7 +79,7 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("no = %d\n", params); if (sObjectIds[params] != OBJECT_GAMEPLAY_KEEP) { - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[params]); + objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]); } else { objBankIndex = 0; } @@ -152,7 +152,7 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0f); this->initActionFunc = func_80967F10; this->drawFunc = func_80968B70; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); break; case 13: Actor_SetScale(&this->actor, 0.14f); @@ -192,51 +192,51 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 100); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } -void Demo6K_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Demo6K_Destroy(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void func_80966DB0(Demo6K* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void func_80966DB0(Demo6K* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; this->actor.draw = this->drawFunc; this->actionFunc = this->initActionFunc; } } -void func_80966E04(Demo6K* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames > 214) { +void func_80966E04(Demo6K* this, PlayState* play) { + if (play->csCtx.frames > 214) { func_8002F948(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } - if (globalCtx->csCtx.frames > 264) { + if (play->csCtx.frames > 264) { func_8002F948(&this->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG); } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[6] != NULL) && - (globalCtx->csCtx.npcActions[6]->action == 2)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[6] != NULL) && + (play->csCtx.npcActions[6]->action == 2)) { Demo6K_SetupAction(this, func_80966E98); } } -void func_80966E98(Demo6K* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames < 353) { +void func_80966E98(Demo6K* this, PlayState* play) { + if (play->csCtx.frames < 353) { func_8002F948(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); func_8002F948(&this->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG); } - if (globalCtx->csCtx.frames == 342) { + if (play->csCtx.frames == 342) { func_800F3F3C(2); } if (this->timer1 == 39) { func_800788CC(NA_SE_EV_CONSENTRATION); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y + 10.0f, this->actor.world.pos.z, 0, 0, 0, 2); } @@ -247,7 +247,7 @@ void func_80966E98(Demo6K* this, GlobalContext* globalCtx) { this->timer1++; } -void func_80966F84(Demo6K* this, GlobalContext* globalCtx) { +void func_80966F84(Demo6K* this, PlayState* play) { if (this->timer1 < 5) { this->unk_168 = D_8096930C[this->timer1 & 3]; } else if (this->timer1 < 15) { @@ -257,7 +257,7 @@ void func_80966F84(Demo6K* this, GlobalContext* globalCtx) { this->unk_168 = 1.0f; } else { if (this->timer1 == 15) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EFF_DUST, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_DUST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, EFF_DUST_TYPE_1); } Math_StepToF(&this->unk_16C, 1.0f, 0.02f); @@ -267,7 +267,7 @@ void func_80966F84(Demo6K* this, GlobalContext* globalCtx) { this->timer1++; } -void func_809670AC(Demo6K* this, GlobalContext* globalCtx) { +void func_809670AC(Demo6K* this, PlayState* play) { this->timer2++; if (this->timer1 < 10) { @@ -280,9 +280,9 @@ void func_809670AC(Demo6K* this, GlobalContext* globalCtx) { } } -void func_8096712C(Demo6K* this, GlobalContext* globalCtx) { +void func_8096712C(Demo6K* this, PlayState* play) { static u16 D_8096932C[] = { 275, 275, 275, 275, 275, 275 }; - u32 frames = globalCtx->state.frames; + u32 frames = play->state.frames; if (this->actor.scale.x < 0.1f) { this->actor.scale.x += 0.0017f; @@ -292,8 +292,8 @@ void func_8096712C(Demo6K* this, GlobalContext* globalCtx) { this->actor.scale.x = 0.1f; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[6] != NULL) && - (globalCtx->csCtx.npcActions[6]->action == 2)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[6] != NULL) && + (play->csCtx.npcActions[6]->action == 2)) { Demo6K_SetupAction(this, func_809670AC); this->timer1 = 0; this->actor.scale.x = 0.1f; @@ -303,13 +303,13 @@ void func_8096712C(Demo6K* this, GlobalContext* globalCtx) { this->timer2++; - if ((globalCtx->sceneNum == SCENE_GANONTIKA) && (globalCtx->csCtx.frames < D_8096932C[this->actor.params - 3])) { + if ((play->sceneNum == SCENE_GANONTIKA) && (play->csCtx.frames < D_8096932C[this->actor.params - 3])) { func_8002F974(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } } Vec3f sDemo6kVelocity = { 0.0f, 0.0f, 0.0f }; -void func_80967244(Demo6K* this, GlobalContext* globalCtx) { +void func_80967244(Demo6K* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; static Color_RGBA8 envColor = { 255, 150, 0, 0 }; @@ -335,30 +335,30 @@ void func_80967244(Demo6K* this, GlobalContext* globalCtx) { envColor.g = sEnvColors[this->unk_293].g; envColor.b = sEnvColors[this->unk_293].b; - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { scale = 6000; - } else if (globalCtx->csCtx.frames < 419) { + } else if (play->csCtx.frames < 419) { scale = 6000; } else { scale = 18000; } - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &sDemo6kVelocity, &accel, &primColor, &envColor, scale, 20); + EffectSsKiraKira_SpawnFocused(play, &pos, &sDemo6kVelocity, &accel, &primColor, &envColor, scale, 20); } -void func_80967410(Demo6K* this, GlobalContext* globalCtx) { +void func_80967410(Demo6K* this, PlayState* play) { s32 params = this->actor.params - 14; this->timer2++; Actor_SetScale(&this->actor, 0.2f); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[params] != NULL)) { - func_809691BC(this, globalCtx, params); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[params] != NULL)) { + func_809691BC(this, play, params); - if (globalCtx->csCtx.npcActions[params]->action == 3) { + if (play->csCtx.npcActions[params]->action == 3) { this->flags &= ~1; - func_80967244(this, globalCtx); + func_80967244(this, play); } else { this->flags |= 1; } @@ -367,8 +367,8 @@ void func_80967410(Demo6K* this, GlobalContext* globalCtx) { } } -void func_809674E0(Demo6K* this, GlobalContext* globalCtx) { - u32 frames = globalCtx->state.frames; +void func_809674E0(Demo6K* this, PlayState* play) { + u32 frames = play->state.frames; if (this->actor.scale.x < 0.05f) { this->actor.scale.x += 0.005f; @@ -400,7 +400,7 @@ void func_809674E0(Demo6K* this, GlobalContext* globalCtx) { sEnvColors[this->unk_293].b, this->actor.scale.x * 4000.0f); } -void func_809676A4(Demo6K* this, GlobalContext* globalCtx) { +void func_809676A4(Demo6K* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; @@ -420,12 +420,12 @@ void func_809676A4(Demo6K* this, GlobalContext* globalCtx) { accel.y = 0.0f; - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 500, 20); + EffectSsKiraKira_SpawnFocused(play, &pos, &velocity, &accel, &primColor, &envColor, 500, 20); } } -void func_8096784C(Demo6K* this, GlobalContext* globalCtx) { - u32 frames = globalCtx->state.frames; +void func_8096784C(Demo6K* this, PlayState* play) { + u32 frames = play->state.frames; this->timer2++; @@ -442,7 +442,7 @@ void func_8096784C(Demo6K* this, GlobalContext* globalCtx) { this->actor.scale.x -= 0.0015f; - func_809676A4(this, globalCtx); + func_809676A4(this, play); } else if (frames & 1) { this->actor.scale.x = 0.033f; } else { @@ -463,16 +463,16 @@ void func_80967A04(Demo6K* this, s32 i) { this->unk_234[i] = Rand_ZeroFloat(0.02f) + 0.01f; } -void func_80967AD0(Demo6K* this, GlobalContext* globalCtx) { +void func_80967AD0(Demo6K* this, PlayState* play) { s32 i; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) { - if (globalCtx->csCtx.npcActions[1]->action == 2) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[1] != NULL)) { + if (play->csCtx.npcActions[1]->action == 2) { this->unk_170++; func_8002F948(&this->actor, NA_SE_EV_RAINBOW_SHOWER - SFX_FLAG); } - func_809691BC(this, globalCtx, 1); + func_809691BC(this, play, 1); } for (i = 0; (i < (s32)this->unk_170) && (i < 16); i++) { @@ -485,7 +485,7 @@ void func_80967AD0(Demo6K* this, GlobalContext* globalCtx) { this->timer1++; } -void func_80967BF8(Player* player, GlobalContext* globalCtx) { +void func_80967BF8(Player* player, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; @@ -504,12 +504,12 @@ void func_80967BF8(Player* player, GlobalContext* globalCtx) { accel.y = 0.0f; - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, + EffectSsKiraKira_SpawnFocused(play, &pos, &velocity, &accel, &primColor, &envColor, 1000, (s32)Rand_ZeroFloat(60.0f) + 60); } } -void func_80967DBC(Demo6K* this, GlobalContext* globalCtx) { +void func_80967DBC(Demo6K* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_ATTACK_DEMO - SFX_FLAG); this->timer2++; @@ -522,9 +522,9 @@ void func_80967DBC(Demo6K* this, GlobalContext* globalCtx) { } if (this->timer2 > 104) { - func_80967BF8(GET_PLAYER(globalCtx), globalCtx); + func_80967BF8(GET_PLAYER(play), play); Actor_Kill(&this->actor); - Audio_PlayActorSound2(&GET_PLAYER(globalCtx)->actor, NA_SE_EN_FANTOM_HIT_THUNDER); + Audio_PlayActorSound2(&GET_PLAYER(play)->actor, NA_SE_EN_FANTOM_HIT_THUNDER); } else if (this->timer2 > 94) { Actor_SetScale(&this->actor, this->actor.scale.x + 0.03f); @@ -539,9 +539,9 @@ void func_80967DBC(Demo6K* this, GlobalContext* globalCtx) { } } -void func_80967F10(Demo6K* this, GlobalContext* globalCtx) { +void func_80967F10(Demo6K* this, PlayState* play) { if (this->timer2 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 13); } @@ -554,22 +554,22 @@ void func_80967F10(Demo6K* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.05f - (this->timer2 * 0.00075f)); } -void Demo6K_Update(Actor* thisx, GlobalContext* globalCtx) { +void Demo6K_Update(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { +void func_80967FFC(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; s32 pad; u16 timer1 = this->timer1; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0x7FFF - ((timer1 * 8) & 0x7FFF), 16, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0x7FFF - ((timer1 * 8) & 0x7FFF), 16, 512, 1, 0, 0x7FFF - ((timer1 * 8) & 0x7FFF), 16, 32)); { @@ -587,7 +587,7 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild("Demo6K 80967FFC", i); Matrix_RotateZ(M_PI / 3, 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, 0x80, colors[i][0].r, colors[i][0].g, colors[i][0].b, 255); @@ -601,10 +601,10 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { if ((s16)i) {} } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80968298(Actor* thisx, GlobalContext* globalCtx) { +void func_80968298(Actor* thisx, PlayState* play) { static u8 skipIndices[] = { 6, 7, 11, 16, 20, 24, 28, 33, 35, 41, 45, 50, 57, 58, 62, 255 }; Demo6K* this = (Demo6K*)thisx; s32 pad; @@ -615,7 +615,7 @@ void func_80968298(Actor* thisx, GlobalContext* globalCtx) { s32 i2; u8 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); alpha = (s32)(this->unk_170 * 255.0f); POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); @@ -623,7 +623,7 @@ void func_80968298(Actor* thisx, GlobalContext* globalCtx) { gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); alpha = (s32)(this->unk_16C * 255.0f); for (i2 = 0, i = 0; i < 63; i++) { @@ -635,31 +635,31 @@ void func_80968298(Actor* thisx, GlobalContext* globalCtx) { } Matrix_RotateX(-M_PI / 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); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 210, 210, 210, 255); gDPSetEnvColor(POLY_XLU_DISP++, 100, 100, 100, 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (0xFFF - (timer1 * 6)) & 0xFFF, (timer1 * 12) & 0xFFF, 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (0xFFF - (timer1 * 6)) & 0xFFF, (timer1 * 12) & 0xFFF, 128, 64, 1, (0xFFF - (timer1 * 6)) & 0xFFF, (timer1 * 12) & 0xFFF, 64, 32)); gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_0039D0); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 50, 50, 50, 255); gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_001040); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8096865C(Actor* thisx, GlobalContext* globalCtx) { +void func_8096865C(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; s32 pad; Gfx* displayList; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (!(this->flags & 1)) { if (this->actor.params > 8) { @@ -668,39 +668,39 @@ void func_8096865C(Actor* thisx, GlobalContext* globalCtx) { displayList = gEffFlash2DL; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[this->unk_293].r, sEnvColors[this->unk_293].g, sEnvColors[this->unk_293].b, 255); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); Matrix_RotateZ((f32)(this->timer2 * 6) * (M_PI / 180.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++, displayList); Matrix_Pop(); Matrix_RotateZ(-(f32)(this->timer2 * 6) * (M_PI / 180.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++, displayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { +void func_809688C4(Actor* thisx, PlayState* play2) { Demo6K* this = (Demo6K*)thisx; - GlobalContext* globalCtx = globalCtx2; - u32 frames = globalCtx->state.frames; + PlayState* play = play2; + u32 frames = play->state.frames; s32 i; - if ((i = (globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) && - (globalCtx->csCtx.npcActions[1]->action != 1)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + if ((i = (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[1] != NULL)) && + (play->csCtx.npcActions[1]->action != 1)) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); for (i = 0; i < 16; i++) { FrameInterpolation_RecordOpenChild("Demo6K 809688C4", i); @@ -713,8 +713,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(this->unk_234[i] * D_8096931C[(frames + i) & 3], this->unk_234[i] * D_8096931C[(frames + i) & 3], this->unk_234[i] * D_8096931C[(frames + i) & 3], MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, gEffFlash1DL); Matrix_Pop(); @@ -724,26 +724,26 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80968B70(Actor* thisx, GlobalContext* globalCtx) { +void func_80968B70(Actor* thisx, PlayState* play) { s32 pad; Demo6K* this = (Demo6K*)thisx; u32 timer2 = this->timer2; u8 primColor[4]; u8 envColor[3]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 0xFF - ((timer2 * 2) & 0xFF), 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0xFF - ((timer2 * 2) & 0xFF), 0, 32, 32, 1, 0xFF - ((timer2 * 2) & 0xFF), (timer2 * 15) & 0x3FF, 16, 64)); if (this->timer2 < 40) { @@ -772,24 +772,24 @@ void func_80968B70(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, envColor[0], envColor[1], envColor[2], 128); gSPDisplayList(POLY_XLU_DISP++, object_gnd_magic_DL_001190); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80968FB0(Actor* thisx, GlobalContext* globalCtx) { +void func_80968FB0(Actor* thisx, PlayState* play) { static u8 D_809693CC[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1 }; Demo6K* this = (Demo6K*)thisx; - Gfx* displayList = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Gfx)); - u16 frames = globalCtx->gameplayFrames; + Gfx* displayList = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Gfx)); + u16 frames = play->gameplayFrames; f32 scaleFactor; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); scaleFactor = ((s16)D_809693CC[(frames * 4) & 0xF] * 0.01f) + 1.0f; Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, displayList); gDPPipeSync(displayList++); @@ -799,14 +799,14 @@ void func_80968FB0(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 255); gSPDisplayList(POLY_XLU_DISP++, gGlowCircleSmallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_809691BC(Demo6K* this, GlobalContext* globalCtx, s32 params) { +void func_809691BC(Demo6K* this, PlayState* play, s32 params) { Vec3f startPos; Vec3f endPos; f32 temp; - CsCmdActorAction* csAction = globalCtx->csCtx.npcActions[params]; + CsCmdActorAction* csAction = play->csCtx.npcActions[params]; startPos.x = csAction->startPos.x; startPos.y = csAction->startPos.y; @@ -816,7 +816,7 @@ void func_809691BC(Demo6K* this, GlobalContext* globalCtx, s32 params) { endPos.y = csAction->endPos.y; endPos.z = csAction->endPos.z; - temp = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, globalCtx->csCtx.frames); + temp = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, play->csCtx.frames); this->actor.world.pos.x = (((endPos.x - startPos.x) * temp) + startPos.x); this->actor.world.pos.y = (((endPos.y - startPos.y) * temp) + startPos.y); diff --git a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h index f144bb9f8..5d6a5367a 100644 --- a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h +++ b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h @@ -6,7 +6,7 @@ struct Demo6K; -typedef void (*Demo6KActionFunc)(struct Demo6K*, GlobalContext*); +typedef void (*Demo6KActionFunc)(struct Demo6K*, PlayState*); typedef struct Demo6K { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index 0a1ca6ffd..556a54135 100644 --- a/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -6,13 +6,13 @@ #define FLAGS ACTOR_FLAG_4 -typedef void (*DemoDuActionFunc)(DemoDu*, GlobalContext*); -typedef void (*DemoDuDrawFunc)(Actor*, GlobalContext*); +typedef void (*DemoDuActionFunc)(DemoDu*, PlayState*); +typedef void (*DemoDuDrawFunc)(Actor*, PlayState*); -void DemoDu_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoDu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoDu_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoDu_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoDu_Init(Actor* thisx, PlayState* play); +void DemoDu_Destroy(Actor* thisx, PlayState* play); +void DemoDu_Update(Actor* thisx, PlayState* play); +void DemoDu_Draw(Actor* thisx, PlayState* play); void DemoDu_Reset(void); //static s32 sUnused = 0; @@ -39,10 +39,10 @@ static void* sMouthTextures[] = { gDaruniaMouthSeriousTex, gDaruniaMouthGrinning #define CS_CHAMBERAFTERGANON_SUBSCENE(x) (21 + (x)) // DEMO_DU_CS_CHAMBER_AFTER_GANON #define CS_CREDITS_SUBSCENE(x) (24 + (x)) // DEMO_DU_CS_CREDITS -void DemoDu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Destroy(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void DemoDu_UpdateEyes(DemoDu* this) { @@ -79,9 +79,9 @@ void DemoDu_CsAfterGanon_Reset(DemoDu* this) { } s32 D_8096CE94 = false; -void DemoDu_CsAfterGanon_CheckIfShouldReset(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsAfterGanon_CheckIfShouldReset(DemoDu* this, PlayState* play) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_8096CE94) { if (this->actor.params == DEMO_DU_CS_CHAMBER_AFTER_GANON) { DemoDu_CsAfterGanon_Reset(this); @@ -98,19 +98,19 @@ s32 DemoDu_UpdateSkelAnime(DemoDu* this) { return SkelAnime_Update(&this->skelAnime); } -void DemoDu_UpdateBgCheckInfo(DemoDu* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void DemoDu_UpdateBgCheckInfo(DemoDu* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } -CsCmdActorAction* DemoDu_GetNpcAction(GlobalContext* globalCtx, s32 idx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[idx]; +CsCmdActorAction* DemoDu_GetNpcAction(PlayState* play, s32 idx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[idx]; } return NULL; } -s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 action, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, idx); +s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, PlayState* play, u16 action, s32 idx) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); if ((npcAction != NULL) && (npcAction->action == action)) { return true; @@ -118,8 +118,8 @@ s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 acti return false; } -s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 action, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, idx); +s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, PlayState* play, u16 action, s32 idx) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); if ((npcAction != NULL) && (npcAction->action != action)) { return true; @@ -127,8 +127,8 @@ s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 a return false; } -void DemoDu_MoveToNpcPos(DemoDu* this, GlobalContext* globalCtx, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, idx); +void DemoDu_MoveToNpcPos(DemoDu* this, PlayState* play, s32 idx) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); s32 pad; if (npcAction != NULL) { @@ -158,63 +158,63 @@ void func_80969DDC(DemoDu* this, AnimationHeader* animation, u8 mode, f32 morphF Animation_Change(&this->skelAnime, animation, playSpeed, startFrame, endFrame, mode, morphFrames); } -void DemoDu_InitCs_FireMedallion(DemoDu* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, &gDaruniaIdleAnim, NULL, NULL, 0); +void DemoDu_InitCs_FireMedallion(DemoDu* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, &gDaruniaIdleAnim, NULL, NULL, 0); this->actor.shape.yOffset = -10000.0f; DemoDu_SetEyeTexIndex(this, 1); DemoDu_SetMouthTexIndex(this, 3); } // A.k.a Warp portal -void DemoDu_CsFireMedallion_SpawnDoorWarp(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsFireMedallion_SpawnDoorWarp(DemoDu* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } // Gives the Fire Medallion to Link. -void func_80969F38(DemoDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80969F38(DemoDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 80.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, DEMO_EFFECT_MEDAL_FIRE); - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); + Item_Give(play, ITEM_MEDALLION_FIRE); } -void func_80969FB4(DemoDu* this, GlobalContext* globalCtx) { +void func_80969FB4(DemoDu* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } // Gives the Fire Medallion to Link too. -void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, PlayState* play) { s32 pad[2]; if ((gSaveContext.chamberCutsceneNum == 1) && (gSaveContext.sceneSetupIndex < 4)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->updateIndex = CS_FIREMEDALLION_SUBSCENE(1); - globalCtx->csCtx.segment = D_8096C1A4; + play->csCtx.segment = D_8096C1A4; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); + Item_Give(play, ITEM_MEDALLION_FIRE); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void DemoDu_CsFireMedallion_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsFireMedallion_AdvanceTo02(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 1)) { this->updateIndex = CS_FIREMEDALLION_SUBSCENE(2); this->drawIndex = 1; - DemoDu_CsFireMedallion_SpawnDoorWarp(this, globalCtx); + DemoDu_CsFireMedallion_SpawnDoorWarp(this, play); } } } @@ -226,9 +226,9 @@ void DemoDu_CsFireMedallion_AdvanceTo03(DemoDu* this) { } } -void DemoDu_CsFireMedallion_AdvanceTo04(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsFireMedallion_AdvanceTo04(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 2)) { Animation_Change(&this->skelAnime, &gDaruniaItemGiveAnim, 1.0f, 0.0f, @@ -246,58 +246,58 @@ void DemoDu_CsFireMedallion_AdvanceTo05(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsFireMedallion_AdvanceTo06(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[6]; +void DemoDu_CsFireMedallion_AdvanceTo06(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[6]; if ((npcAction != NULL) && (npcAction->action == 2)) { this->updateIndex = CS_FIREMEDALLION_SUBSCENE(6); - func_80969F38(this, globalCtx); + func_80969F38(this, play); } } } -void DemoDu_UpdateCs_FM_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsFireMedallion_AdvanceTo01(this, globalCtx); +void DemoDu_UpdateCs_FM_00(DemoDu* this, PlayState* play) { + DemoDu_CsFireMedallion_AdvanceTo01(this, play); } -void DemoDu_UpdateCs_FM_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsFireMedallion_AdvanceTo02(this, globalCtx); +void DemoDu_UpdateCs_FM_01(DemoDu* this, PlayState* play) { + DemoDu_CsFireMedallion_AdvanceTo02(this, play); } -void DemoDu_UpdateCs_FM_02(DemoDu* this, GlobalContext* globalCtx) { - func_80969FB4(this, globalCtx); +void DemoDu_UpdateCs_FM_02(DemoDu* this, PlayState* play) { + func_80969FB4(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_CsFireMedallion_AdvanceTo03(this); } -void DemoDu_UpdateCs_FM_03(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_FM_03(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsFireMedallion_AdvanceTo04(this, globalCtx); + DemoDu_CsFireMedallion_AdvanceTo04(this, play); } -void DemoDu_UpdateCs_FM_04(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_FM_04(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_CsFireMedallion_AdvanceTo05(this, animFinished); } -void DemoDu_UpdateCs_FM_05(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_FM_05(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsFireMedallion_AdvanceTo06(this, globalCtx); + DemoDu_CsFireMedallion_AdvanceTo06(this, play); } -void DemoDu_UpdateCs_FM_06(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_FM_06(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); } -void DemoDu_InitCs_GoronsRuby(DemoDu* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); +void DemoDu_InitCs_GoronsRuby(DemoDu* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); this->updateIndex = CS_GORONSRUBY_SUBSCENE(0); } @@ -309,15 +309,15 @@ void DemoDu_CsPlaySfx_GoronLanding(DemoDu* this) { // Cutscene: Darunia gives Link the Goron's Ruby. // Sfx played when Darunia is falling at the start of the cutscene. -void DemoDu_CsPlaySfx_DaruniaFalling(GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 160) { +void DemoDu_CsPlaySfx_DaruniaFalling(PlayState* play) { + if (play->csCtx.frames == 160) { func_800788CC(NA_SE_EV_OBJECT_FALL); } } // Cutscene: Darunia gives Link the Goron's Ruby. -void DemoDu_CsPlaySfx_DaruniaHitsLink(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DemoDu_CsPlaySfx_DaruniaHitsLink(PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; func_80078914(&player->actor.projectedPos, NA_SE_EN_DARUNIA_HIT_LINK); @@ -332,9 +332,9 @@ void DemoDu_CsPlaySfx_HitBreast(DemoDu* this) { // Cutscene: Darunia gives Link the Goron's Ruby. // Sfx played when Link is escaping from the gorons at the end of the scene. -void DemoDu_CsPlaySfx_LinkEscapeFromGorons(GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 1400) { - Player* player = GET_PLAYER(globalCtx); +void DemoDu_CsPlaySfx_LinkEscapeFromGorons(PlayState* play) { + if (play->csCtx.frames == 1400) { + Player* player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_VO_LI_FALL_L_KID, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -343,17 +343,17 @@ void DemoDu_CsPlaySfx_LinkEscapeFromGorons(GlobalContext* globalCtx) { // Cutscene: Darunia gives Link the Goron's Ruby. // Sfx played when Link is surprised by Darunia falling from the sky. -void DemoDu_CsPlaySfx_LinkSurprised(GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 174) { - Player* player = GET_PLAYER(globalCtx); +void DemoDu_CsPlaySfx_LinkSurprised(PlayState* play) { + if (play->csCtx.frames == 174) { + Player* player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_VO_LI_SURPRISE_KID, &player->actor.projectedPos, 4U, &D_801333E0, &D_801333E0, &D_801333E8); } } -void DemoDu_CsGoronsRuby_UpdateFaceTextures(DemoDu* this, GlobalContext* globalCtx) { - u16* frames = &globalCtx->csCtx.frames; +void DemoDu_CsGoronsRuby_UpdateFaceTextures(DemoDu* this, PlayState* play) { + u16* frames = &play->csCtx.frames; if (*frames < 260) { DemoDu_UpdateEyes(this); @@ -376,16 +376,16 @@ void DemoDu_CsGoronsRuby_UpdateFaceTextures(DemoDu* this, GlobalContext* globalC } } -void func_8096A630(DemoDu* this, GlobalContext* globalCtx) { +void func_8096A630(DemoDu* this, PlayState* play) { s32 pad; Vec3f pos = this->actor.world.pos; pos.y += kREG(5); - func_80033480(globalCtx, &pos, kREG(1) + 100.0f, kREG(2) + 10, kREG(3) + 300, kREG(4), 0); + func_80033480(play, &pos, kREG(1) + 100.0f, kREG(2) + 10, kREG(3) + 300, kREG(4), 0); DemoDu_CsPlaySfx_GoronLanding(this); } -void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, PlayState* play) { static Vec3f dustPosOffsets[] = { { 11.0f, -11.0f, -6.0f }, { 0.0f, 14.0f, -13.0f }, { 14.0f, -2.0f, -10.0f }, { 10.0f, -6.0f, -8.0f }, { 8.0f, 6.0f, 8.0f }, { 13.0f, 8.0f, -10.0f }, { -14.0f, 1.0f, -14.0f }, { 5.0f, 12.0f, -9.0f }, @@ -395,7 +395,7 @@ void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, GlobalContext* g if (Animation_OnFrame(&this->skelAnime, 31.0f) || Animation_OnFrame(&this->skelAnime, 41.0f)) { s32 pad[2]; s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* headPos = &player->bodyPartsPos[PLAYER_LIMB_HEAD]; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.3f, 0.0f }; @@ -426,17 +426,17 @@ void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, GlobalContext* g envColor.g += colorDelta; envColor.b += colorDelta; - func_8002829C(globalCtx, &position, &velocity, &accel, &primColor, &envColor, + func_8002829C(play, &position, &velocity, &accel, &primColor, &envColor, Rand_ZeroOne() * 40.0f + 200.0f, 0); } - DemoDu_CsPlaySfx_DaruniaHitsLink(globalCtx); + DemoDu_CsPlaySfx_DaruniaHitsLink(play); } } -void DemoDu_CsGoronsRuby_DaruniaFalling(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsGoronsRuby_DaruniaFalling(DemoDu* this, PlayState* play) { s32 pad; - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != CS_STATE_IDLE) { CsCmdActorAction* npcAction = csCtx->npcActions[2]; @@ -462,40 +462,40 @@ void DemoDu_CsGoronsRuby_DaruniaFalling(DemoDu* this, GlobalContext* globalCtx) } } -void DemoDu_CsGoronsRuby_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsGoronsRuby_AdvanceTo01(DemoDu* this, PlayState* play) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(1); } -void DemoDu_CsGoronsRuby_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo02(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 1)) { Animation_Change(&this->skelAnime, &gDaruniaStandUpAfterFallingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gDaruniaStandUpAfterFallingAnim), 2, 0.0f); this->updateIndex = CS_GORONSRUBY_SUBSCENE(2); this->drawIndex = 1; - DemoDu_CsGoronsRuby_DaruniaFalling(this, globalCtx); + DemoDu_CsGoronsRuby_DaruniaFalling(this, play); } } } -void DemoDu_CsGoronsRuby_AdvanceTo03(DemoDu* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void DemoDu_CsGoronsRuby_AdvanceTo03(DemoDu* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != CS_STATE_IDLE) { CsCmdActorAction* npcAction = csCtx->npcActions[2]; if ((npcAction != NULL) && (csCtx->frames >= npcAction->endFrame)) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(3); - func_8096A630(this, globalCtx); + func_8096A630(this, play); } } } -void DemoDu_CsGoronsRuby_AdvanceTo04(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo04(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 2)) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(4); @@ -511,9 +511,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo05(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo06(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo06(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 3)) { Animation_Change(&this->skelAnime, &gDaruniaHitBreastAnim, 1.0f, 0.0f, @@ -531,9 +531,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo07(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo08(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo08(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 4)) { Animation_Change(&this->skelAnime, &gDaruniaHitLinkAnim, 1.0f, 0.0f, @@ -559,9 +559,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo10(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo11(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo11(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 5)) { Animation_Change(&this->skelAnime, &gDaruniaItemGiveAnim, 1.0f, 0.0f, @@ -579,9 +579,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo12(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo13(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo13(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 6)) { Animation_Change(&this->skelAnime, &gDaruniaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gDaruniaIdleAnim), @@ -591,119 +591,119 @@ void DemoDu_CsGoronsRuby_AdvanceTo13(DemoDu* this, GlobalContext* globalCtx) { } } -void DemoDu_UpdateCs_GR_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsPlaySfx_DaruniaFalling(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo01(this, globalCtx); +void DemoDu_UpdateCs_GR_00(DemoDu* this, PlayState* play) { + DemoDu_CsPlaySfx_DaruniaFalling(play); + DemoDu_CsGoronsRuby_AdvanceTo01(this, play); } -void DemoDu_UpdateCs_GR_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsPlaySfx_DaruniaFalling(globalCtx); - DemoDu_CsPlaySfx_LinkSurprised(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo02(this, globalCtx); +void DemoDu_UpdateCs_GR_01(DemoDu* this, PlayState* play) { + DemoDu_CsPlaySfx_DaruniaFalling(play); + DemoDu_CsPlaySfx_LinkSurprised(play); + DemoDu_CsGoronsRuby_AdvanceTo02(this, play); } -void DemoDu_UpdateCs_GR_02(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsGoronsRuby_DaruniaFalling(this, globalCtx); - DemoDu_UpdateBgCheckInfo(this, globalCtx); - DemoDu_CsPlaySfx_DaruniaFalling(globalCtx); - DemoDu_CsPlaySfx_LinkSurprised(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo03(this, globalCtx); +void DemoDu_UpdateCs_GR_02(DemoDu* this, PlayState* play) { + DemoDu_CsGoronsRuby_DaruniaFalling(this, play); + DemoDu_UpdateBgCheckInfo(this, play); + DemoDu_CsPlaySfx_DaruniaFalling(play); + DemoDu_CsPlaySfx_LinkSurprised(play); + DemoDu_CsGoronsRuby_AdvanceTo03(this, play); } -void DemoDu_UpdateCs_GR_03(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); - DemoDu_CsPlaySfx_LinkSurprised(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo04(this, globalCtx); +void DemoDu_UpdateCs_GR_03(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); + DemoDu_CsPlaySfx_LinkSurprised(play); + DemoDu_CsGoronsRuby_AdvanceTo04(this, play); } -void DemoDu_UpdateCs_GR_04(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_04(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo05(this, animFinished); } -void DemoDu_UpdateCs_GR_05(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_05(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo06(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo06(this, play); } -void DemoDu_UpdateCs_GR_06(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_06(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_CsPlaySfx_HitBreast(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo07(this, animFinished); } -void DemoDu_UpdateCs_GR_07(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_07(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo08(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo08(this, play); } -void DemoDu_UpdateCs_GR_08(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_08(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(this, play); DemoDu_CsGoronsRuby_AdvanceTo09(this, animFinished); } -void DemoDu_UpdateCs_GR_09(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_09(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_CsPlaySfx_HitBreast(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo10(this, animFinished); } -void DemoDu_UpdateCs_GR_10(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_10(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo11(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo11(this, play); } -void DemoDu_UpdateCs_GR_11(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_11(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo12(this, animFinished); } -void DemoDu_UpdateCs_GR_12(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_12(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo13(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo13(this, play); } -void DemoDu_UpdateCs_GR_13(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_13(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsPlaySfx_LinkEscapeFromGorons(globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsPlaySfx_LinkEscapeFromGorons(play); } -void DemoDu_InitCs_AfterGanon(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_InitCs_AfterGanon(DemoDu* this, PlayState* play) { s32 pad[3]; f32 lastFrame = Animation_GetLastFrame(&gDaruniaSageFormationAnim); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gDaruniaSageFormationAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(0); this->actor.shape.shadowAlpha = 0; @@ -713,13 +713,13 @@ void DemoDu_CsPlaySfx_WhiteOut() { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void DemoDu_CsAfterGanon_SpawnDemo6K(DemoDu* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void DemoDu_CsAfterGanon_SpawnDemo6K(DemoDu* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(16) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 3); } -void DemoDu_CsAfterGanon_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { - if (DemoDu_IsNpcDoingThisAction(this, globalCtx, 4, 2)) { +void DemoDu_CsAfterGanon_AdvanceTo01(DemoDu* this, PlayState* play) { + if (DemoDu_IsNpcDoingThisAction(this, play, 4, 2)) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(1); this->drawIndex = 2; this->shadowAlpha = 0; @@ -729,11 +729,11 @@ void DemoDu_CsAfterGanon_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { } } -void DemoDu_CsAfterGanon_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsAfterGanon_AdvanceTo02(DemoDu* this, PlayState* play) { f32* unk_1A4 = &this->unk_1A4; s32 shadowAlpha = 255; - if (DemoDu_IsNpcDoingThisAction(this, globalCtx, 4, 2)) { + if (DemoDu_IsNpcDoingThisAction(this, play, 4, 2)) { *unk_1A4 += 1.0f; if (*unk_1A4 >= kREG(5) + 10.0f) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(2); @@ -759,44 +759,44 @@ void DemoDu_CsAfterGanon_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = shadowAlpha; } -void DemoDu_CsAfterGanon_BackTo01(DemoDu* this, GlobalContext* globalCtx) { - if (DemoDu_IsNpcNotDoingThisAction(this, globalCtx, 4, 2)) { +void DemoDu_CsAfterGanon_BackTo01(DemoDu* this, PlayState* play) { + if (DemoDu_IsNpcNotDoingThisAction(this, play, 4, 2)) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(1); this->drawIndex = 2; this->unk_1A4 = kREG(5) + 10.0f; this->shadowAlpha = 255; if (!this->demo6KSpawned) { - DemoDu_CsAfterGanon_SpawnDemo6K(this, globalCtx); + DemoDu_CsAfterGanon_SpawnDemo6K(this, play); this->demo6KSpawned = 1; } this->actor.shape.shadowAlpha = 255; } } -void DemoDu_UpdateCs_AG_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsAfterGanon_AdvanceTo01(this, globalCtx); - DemoDu_CsAfterGanon_CheckIfShouldReset(this, globalCtx); +void DemoDu_UpdateCs_AG_00(DemoDu* this, PlayState* play) { + DemoDu_CsAfterGanon_AdvanceTo01(this, play); + DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); } -void DemoDu_UpdateCs_AG_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_AG_01(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsAfterGanon_AdvanceTo02(this, globalCtx); - DemoDu_CsAfterGanon_CheckIfShouldReset(this, globalCtx); + DemoDu_CsAfterGanon_AdvanceTo02(this, play); + DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); } -void DemoDu_UpdateCs_AG_02(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_AG_02(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsAfterGanon_BackTo01(this, globalCtx); - DemoDu_CsAfterGanon_CheckIfShouldReset(this, globalCtx); + DemoDu_CsAfterGanon_BackTo01(this, play); + DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); } // Similar to DemoDu_Draw_01, but this uses POLY_XLU_DISP. Also uses this->shadowAlpha for setting the env color. -void DemoDu_Draw_02(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoDu_Draw_02(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoDu* this = (DemoDu*)thisx; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = sEyeTextures[eyeTexIndex]; @@ -805,9 +805,9 @@ void DemoDu_Draw_02(Actor* thisx, GlobalContext* globalCtx2) { void* mouthTexture = sMouthTextures[mouthTexIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); @@ -817,14 +817,14 @@ void DemoDu_Draw_02(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, 0, 0, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoDu_InitCs_Credits(DemoDu* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, &gDaruniaCreditsIdleAnim, NULL, NULL, 0); +void DemoDu_InitCs_Credits(DemoDu* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, &gDaruniaCreditsIdleAnim, NULL, NULL, 0); this->updateIndex = CS_CREDITS_SUBSCENE(0); this->drawIndex = 0; this->actor.shape.shadowAlpha = 0; @@ -850,8 +850,8 @@ void DemoDu_CsCredits_UpdateShadowAlpha(DemoDu* this) { } } -void DemoDu_CsCredits_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_MoveToNpcPos(this, globalCtx, 2); +void DemoDu_CsCredits_AdvanceTo01(DemoDu* this, PlayState* play) { + DemoDu_MoveToNpcPos(this, play, 2); this->updateIndex = CS_CREDITS_SUBSCENE(1); this->drawIndex = 2; } @@ -880,8 +880,8 @@ void DemoDu_CsCredits_BackTo02(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, 2); +void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, 2); if (npcAction != NULL) { s32 action = npcAction->action; @@ -890,7 +890,7 @@ void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, GlobalContext* gl if (action != lastAction) { switch (action) { case 9: - DemoDu_CsCredits_AdvanceTo01(this, globalCtx); + DemoDu_CsCredits_AdvanceTo01(this, play); break; case 10: DemoDu_CsCredits_AdvanceTo03(this); @@ -908,36 +908,36 @@ void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, GlobalContext* gl } } -void DemoDu_UpdateCs_CR_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsCredits_HandleSubscenesByNpcAction(this, globalCtx); +void DemoDu_UpdateCs_CR_00(DemoDu* this, PlayState* play) { + DemoDu_CsCredits_HandleSubscenesByNpcAction(this, play); } -void DemoDu_UpdateCs_CR_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_CR_01(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsCredits_UpdateShadowAlpha(this); DemoDu_CsCredits_AdvanceTo02(this); } -void DemoDu_UpdateCs_CR_02(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_CR_02(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsCredits_HandleSubscenesByNpcAction(this, globalCtx); + DemoDu_CsCredits_HandleSubscenesByNpcAction(this, play); } -void DemoDu_UpdateCs_CR_03(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_CR_03(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsCredits_HandleSubscenesByNpcAction(this, globalCtx); + DemoDu_CsCredits_HandleSubscenesByNpcAction(this, play); } -void DemoDu_UpdateCs_CR_04(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_CR_04(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsCredits_BackTo02(this, animFinished); @@ -952,7 +952,7 @@ static DemoDuActionFunc sUpdateFuncs[] = { DemoDu_UpdateCs_CR_01, DemoDu_UpdateCs_CR_02, DemoDu_UpdateCs_CR_03, DemoDu_UpdateCs_CR_04, }; -void DemoDu_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Update(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; if (this->updateIndex < 0 || this->updateIndex >= 29 || sUpdateFuncs[this->updateIndex] == NULL) { @@ -960,38 +960,38 @@ void DemoDu_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sUpdateFuncs[this->updateIndex](this, globalCtx); + sUpdateFuncs[this->updateIndex](this, play); } -void DemoDu_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Init(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); switch (this->actor.params) { case DEMO_DU_CS_GORONS_RUBY: - DemoDu_InitCs_GoronsRuby(this, globalCtx); + DemoDu_InitCs_GoronsRuby(this, play); break; case DEMO_DU_CS_CHAMBER_AFTER_GANON: - DemoDu_InitCs_AfterGanon(this, globalCtx); + DemoDu_InitCs_AfterGanon(this, play); break; case DEMO_DU_CS_CREDITS: - DemoDu_InitCs_Credits(this, globalCtx); + DemoDu_InitCs_Credits(this, play); break; default: - DemoDu_InitCs_FireMedallion(this, globalCtx); + DemoDu_InitCs_FireMedallion(this, play); break; } } -void DemoDu_Draw_NoDraw(Actor* thisx, GlobalContext* globalCtx2) { +void DemoDu_Draw_NoDraw(Actor* thisx, PlayState* play2) { } // Similar to DemoDu_Draw_02, but this uses POLY_OPA_DISP. Sets the env color to 255. -void DemoDu_Draw_01(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoDu_Draw_01(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoDu* this = (DemoDu*)thisx; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = sEyeTextures[eyeTexIndex]; @@ -1000,9 +1000,9 @@ void DemoDu_Draw_01(Actor* thisx, GlobalContext* globalCtx2) { void* mouthTexture = sMouthTextures[mouthTexIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); @@ -1012,10 +1012,10 @@ void DemoDu_Draw_01(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static DemoDuDrawFunc sDrawFuncs[] = { @@ -1024,7 +1024,7 @@ static DemoDuDrawFunc sDrawFuncs[] = { DemoDu_Draw_02, }; -void DemoDu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Draw(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; if (this->drawIndex < 0 || this->drawIndex >= 3 || sDrawFuncs[this->drawIndex] == NULL) { @@ -1032,7 +1032,7 @@ void DemoDu_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawIndex](thisx, globalCtx); + sDrawFuncs[this->drawIndex](thisx, play); } const ActorInit Demo_Du_InitVars = { diff --git a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 2e0215108..bd21a2467 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -39,10 +39,10 @@ #define FLAGS ACTOR_FLAG_4 -void DemoEc_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoEc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoEc_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoEc_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoEc_Init(Actor* thisx, PlayState* play); +void DemoEc_Destroy(Actor* thisx, PlayState* play); +void DemoEc_Update(Actor* thisx, PlayState* play); +void DemoEc_Draw(Actor* thisx, PlayState* play); typedef enum { /* 00 */ EC_UPDATE_COMMON, @@ -148,13 +148,13 @@ static s16 sAnimationObjects[] = { OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_GM, OBJECT_MA2, }; -void DemoEc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Destroy(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } -void DemoEc_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Init(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; if ((this->actor.params < 0) || (this->actor.params > 34)) { @@ -170,25 +170,25 @@ s32 DemoEc_UpdateSkelAnime(DemoEc* this) { return SkelAnime_Update(&this->skelAnime); } -void DemoEc_UpdateBgFlags(DemoEc* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 25.0f, 30.0f, 7); +void DemoEc_UpdateBgFlags(DemoEc* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 30.0f, 7); } -void func_8096D594(DemoEc* this, GlobalContext* globalCtx) { +void func_8096D594(DemoEc* this, PlayState* play) { this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_8096D5D4(DemoEc* this, GlobalContext* globalCtx) { +void func_8096D5D4(DemoEc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_8096D64C(DemoEc* this, GlobalContext* globalCtx) { +void func_8096D64C(DemoEc* this, PlayState* play) { this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void DemoEc_UpdateEyes(DemoEc* this) { @@ -211,8 +211,8 @@ void DemoEc_SetEyeTexIndex(DemoEc* this, s16 texIndex) { this->eyeTexIndex = texIndex; } -void DemoEc_InitSkelAnime(DemoEc* this, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeader) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, SEGMENTED_TO_VIRTUAL(skeletonHeader), NULL, NULL, NULL, 0); +void DemoEc_InitSkelAnime(DemoEc* this, PlayState* play, FlexSkeletonHeader* skeletonHeader) { + SkelAnime_InitFlex(play, &this->skelAnime, SEGMENTED_TO_VIRTUAL(skeletonHeader), NULL, NULL, NULL, 0); } void DemoEc_ChangeAnimation(DemoEc* this, AnimationHeader* animation, u8 mode, f32 transitionRate, s32 reverse) { @@ -248,9 +248,9 @@ Gfx* DemoEc_AllocColorDList(GraphicsContext* gfxCtx, u8* color) { return dList; } -void DemoEc_DrawSkeleton(DemoEc* this, GlobalContext* globalCtx, void* eyeTexture, void* arg3, +void DemoEc_DrawSkeleton(DemoEc* this, PlayState* play, void* eyeTexture, void* arg3, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad; @@ -269,15 +269,15 @@ void DemoEc_DrawSkeleton(DemoEc* this, GlobalContext* globalCtx, void* eyeTextur gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, &this->actor, POLY_OPA_DISP); CLOSE_DISPS(gfxCtx); } -void DemoEc_DrawSkeletonCustomColor(DemoEc* this, GlobalContext* globalCtx, Gfx* arg2, Gfx* arg3, u8* color1, +void DemoEc_DrawSkeletonCustomColor(DemoEc* this, PlayState* play, Gfx* arg2, Gfx* arg3, u8* color1, u8* color2, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(gfxCtx); @@ -305,42 +305,42 @@ void DemoEc_DrawSkeletonCustomColor(DemoEc* this, GlobalContext* globalCtx, Gfx* gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, &this->actor, POLY_OPA_DISP); CLOSE_DISPS(gfxCtx); } -void DemoEc_UseDrawObject(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) { s32 pad[2]; s32 drawObjBankIndex = this->drawObjBankIndex; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[drawObjBankIndex].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[drawObjBankIndex].segment); - if (!globalCtx) {} + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[drawObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[drawObjBankIndex].segment); + if (!play) {} CLOSE_DISPS(gfxCtx); } -void DemoEc_UseAnimationObject(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { s32 animObjBankIndex = this->animObjBankIndex; - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[animObjBankIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[animObjBankIndex].segment); } -CsCmdActorAction* DemoEc_GetNpcAction(GlobalContext* globalCtx, s32 actionIndex) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[actionIndex]; +CsCmdActorAction* DemoEc_GetNpcAction(PlayState* play, s32 actionIndex) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[actionIndex]; } else { return NULL; } } -void DemoEc_SetNpcActionPosRot(DemoEc* this, GlobalContext* globalCtx, s32 actionIndex) { - CsCmdActorAction* npcAction = DemoEc_GetNpcAction(globalCtx, actionIndex); +void DemoEc_SetNpcActionPosRot(DemoEc* this, PlayState* play, s32 actionIndex) { + CsCmdActorAction* npcAction = DemoEc_GetNpcAction(play, actionIndex); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -351,169 +351,169 @@ void DemoEc_SetNpcActionPosRot(DemoEc* this, GlobalContext* globalCtx, s32 actio } } -void DemoEc_InitIngo(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gIngoSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitIngo(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gIngoSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcIngoAnim, 0, 0.0f, false); - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_INGO; this->drawConfig = EC_DRAW_INGO; } -void DemoEc_UpdateIngo(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateIngo(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawIngo(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gIngoEyeClosed2Tex, gIngoRedTex, 0, 0); +void DemoEc_DrawIngo(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gIngoEyeClosed2Tex, gIngoRedTex, 0, 0); } -void DemoEc_InitTalon(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gTalonSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitTalon(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gTalonSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcTalonAnim, 0, 0.0f, false); - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_TALON; this->drawConfig = EC_DRAW_TALON; } -void DemoEc_UpdateTalon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateTalon(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawTalon(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gTalonEyeClosed2Tex, gTalonRedTex, NULL, NULL); +void DemoEc_DrawTalon(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gTalonEyeClosed2Tex, gTalonRedTex, NULL, NULL); } -void DemoEc_InitWindmillMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gWindmillManSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitWindmillMan(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gWindmillManSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcWindmillManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_WINDMILL_MAN; this->drawConfig = EC_DRAW_WINDMILL_MAN; } -void DemoEc_UpdateWindmillMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateWindmillMan(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawWindmillMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gWindmillManEyeClosedTex, gWindmillManMouthAngryTex, NULL, NULL); +void DemoEc_DrawWindmillMan(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gWindmillManEyeClosedTex, gWindmillManMouthAngryTex, NULL, NULL); } -void DemoEc_InitKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKm1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitKokiriBoy(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKm1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_KOKIRI_BOY; this->drawConfig = EC_DRAW_KOKIRI_BOY; } -void DemoEc_InitDancingKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKm1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitDancingKokiriBoy(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKm1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcDancingKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_DANCING_KOKIRI_BOY; this->drawConfig = EC_DRAW_KOKIRI_BOY; } -void DemoEc_UpdateKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateKokiriBoy(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_UpdateDancingKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UpdateKokiriBoy(this, globalCtx); +void DemoEc_UpdateDancingKokiriBoy(DemoEc* this, PlayState* play) { + DemoEc_UpdateKokiriBoy(this, play); } -void DemoEc_DrawKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawKokiriBoy(DemoEc* this, PlayState* play) { static u8 color1[] = { 0, 130, 70, 255 }; static u8 color2[] = { 110, 170, 20, 255 }; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, NULL, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, NULL, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKw1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitKokiriGirl(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKw1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_KOKIRI_GIRL; this->drawConfig = EC_DRAW_KOKIRI_GIRL; } -void DemoEc_InitDancingKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKw1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitDancingKokiriGirl(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKw1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcDancingKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_DANCING_KOKIRI_GIRL; this->drawConfig = EC_DRAW_KOKIRI_GIRL; } -void DemoEc_UpdateKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateKokiriGirl(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_UpdateDancingKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UpdateKokiriGirl(this, globalCtx); +void DemoEc_UpdateDancingKokiriGirl(DemoEc* this, PlayState* play) { + DemoEc_UpdateKokiriGirl(this, play); } -void DemoEc_DrawKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawKokiriGirl(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gKw1EyeOpenTex, gKw1EyeHalfTex, gKw1EyeClosedTex }; static u8 color1[] = { 70, 190, 60, 255 }; static u8 color2[] = { 100, 30, 0, 255 }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, eyeTexture, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, eyeTexture, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitOldMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_bji_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitOldMan(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_bji_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_OLD_MAN; this->drawConfig = EC_DRAW_OLD_MAN; } -void DemoEc_UpdateOldMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateOldMan(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawOldMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawOldMan(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { object_bji_Tex_0005FC, object_bji_Tex_0009FC, @@ -524,28 +524,28 @@ void DemoEc_DrawOldMan(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, eyeTexture, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, eyeTexture, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitBeardedMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_ahg_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitBeardedMan(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_ahg_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_BEARDED_MAN; this->drawConfig = EC_DRAW_BEARDED_MAN; } -void DemoEc_UpdateBeardedMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateBeardedMan(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawBeardedMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawBeardedMan(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { object_ahg_Tex_00057C, object_ahg_Tex_00067C, @@ -556,28 +556,28 @@ void DemoEc_DrawBeardedMan(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, eyeTexture, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, eyeTexture, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitWoman(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_bob_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitWoman(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_bob_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_WOMAN; this->drawConfig = EC_DRAW_WOMAN; } -void DemoEc_UpdateWoman(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateWoman(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawWoman(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawWoman(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { object_bob_Tex_0007C8, object_bob_Tex_000FC8, @@ -586,69 +586,69 @@ void DemoEc_DrawWoman(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitOldWoman(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_bba_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitOldWoman(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_bba_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_OLD_WOMAN; this->drawConfig = EC_DRAW_OLD_WOMAN; } -void DemoEc_UpdateOldWoman(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateOldWoman(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawOldWoman(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, &object_bba_Tex_0004C8, NULL, NULL, NULL); +void DemoEc_DrawOldWoman(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, &object_bba_Tex_0004C8, NULL, NULL, NULL); } -void DemoEc_InitBossCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_toryo_Skel_007150); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitBossCarpenter(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_toryo_Skel_007150); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcCarpenterAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_BOSS_CARPENTER; this->drawConfig = EC_DRAW_BOSS_CARPENTER; } -void DemoEc_UpdateBossCarpenter(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateBossCarpenter(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawBossCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, NULL, NULL, NULL, NULL); +void DemoEc_DrawBossCarpenter(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, NULL, NULL, NULL, NULL); } -void DemoEc_InitCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_daiku_Skel_007958); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitCarpenter(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_daiku_Skel_007958); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcCarpenterAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_CARPENTER; this->drawConfig = EC_DRAW_CARPENTER; } -void DemoEc_UpdateCarpenter(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateCarpenter(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -s32 DemoEc_CarpenterOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 DemoEc_CarpenterOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; @@ -689,7 +689,7 @@ Gfx* DemoEc_GetCarpenterPostLimbDList(DemoEc* this) { } } -void DemoEc_CarpenterPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, +void DemoEc_CarpenterPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; Gfx* postLimbDList; @@ -700,26 +700,26 @@ void DemoEc_CarpenterPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** } } -void DemoEc_DrawCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, NULL, 0, DemoEc_CarpenterOverrideLimbDraw, DemoEc_CarpenterPostLimbDraw); +void DemoEc_DrawCarpenter(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, NULL, 0, DemoEc_CarpenterOverrideLimbDraw, DemoEc_CarpenterPostLimbDraw); } -void DemoEc_InitGerudo(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gGerudoWhiteSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitGerudo(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gGerudoWhiteSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcGerudoAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_GERUDO; this->drawConfig = EC_DRAW_GERUDO; } -void DemoEc_UpdateGerudo(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateGerudo(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } Gfx* DemoEc_GetGerudoPostLimbDList(DemoEc* this) { @@ -736,7 +736,7 @@ Gfx* DemoEc_GetGerudoPostLimbDList(DemoEc* this) { } } -void DemoEc_GerudoPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, +void DemoEc_GerudoPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; Gfx* postLimbDList; @@ -747,7 +747,7 @@ void DemoEc_GerudoPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } } -void DemoEc_DrawGerudo(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawGerudo(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gGerudoWhiteEyeOpenTex, gGerudoWhiteEyeHalfTex, @@ -756,41 +756,41 @@ void DemoEc_DrawGerudo(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, DemoEc_GerudoPostLimbDraw); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, DemoEc_GerudoPostLimbDraw); } -void DemoEc_InitDancingZora(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gZoraSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitDancingZora(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gZoraSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcDancingZoraAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_DANCING_ZORA; this->drawConfig = EC_DRAW_DANCING_ZORA; } -void DemoEc_UpdateDancingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateDancingZora(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawDancingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawDancingZora(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitKingZora(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKzSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitKingZora(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKzSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcKingZoraAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_KING_ZORA; this->drawConfig = EC_DRAW_KING_ZORA; @@ -807,8 +807,8 @@ void func_8096F1D4(DemoEc* this) { } } -void func_8096F224(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseAnimationObject(this, globalCtx); +void func_8096F224(DemoEc* this, PlayState* play) { + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcAnim_006930, 2, -8.0f, false); this->updateMode = EC_UPDATE_17; } @@ -820,70 +820,70 @@ void func_8096F26C(DemoEc* this, s32 arg1) { } } -void func_8096F2B0(DemoEc* this, GlobalContext* globalCtx, s32 arg2) { +void func_8096F2B0(DemoEc* this, PlayState* play, s32 arg2) { CsCmdActorAction* npcAction; s32 sp18; - npcAction = DemoEc_GetNpcAction(globalCtx, arg2); + npcAction = DemoEc_GetNpcAction(play, arg2); if (npcAction != NULL) { sp18 = npcAction->action; if ((sp18 != this->npcAction)) { if (this->npcAction) {} if (sp18 == 2) { - func_8096F224(this, globalCtx); + func_8096F224(this, play); } this->npcAction = sp18; } } } -void DemoEc_UpdateKingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateKingZora(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_SetNpcActionPosRot(this, globalCtx, 6); - DemoEc_UpdateBgFlags(this, globalCtx); - func_8096F2B0(this, globalCtx, 6); + func_8096D594(this, play); + DemoEc_SetNpcActionPosRot(this, play, 6); + DemoEc_UpdateBgFlags(this, play); + func_8096F2B0(this, play, 6); } -void func_8096F378(DemoEc* this, GlobalContext* globalCtx) { +void func_8096F378(DemoEc* this, PlayState* play) { s32 animDone = DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); func_8096F1D4(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); func_8096F26C(this, animDone); } -void func_8096F3D4(DemoEc* this, GlobalContext* globalCtx) { +void func_8096F3D4(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawKingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawKingZora(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gKzEyeOpenTex, gKzEyeHalfTex, gKzEyeClosedTex, gKzEyeOpen2Tex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitMido(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gMidoSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitMido(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gMidoSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcMidoAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_MIDO; this->drawConfig = EC_DRAW_MIDO; DemoEc_SetEyeTexIndex(this, 3); } -void func_8096F4FC(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseAnimationObject(this, globalCtx); +void func_8096F4FC(DemoEc* this, PlayState* play) { + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcAnim_008D1C, 2, -8.0f, false); this->updateMode = EC_UPDATE_20; } @@ -894,41 +894,41 @@ void func_8096F544(DemoEc* this, s32 changeAnim) { } } -void func_8096F578(DemoEc* this, GlobalContext* globalCtx, s32 arg2) { +void func_8096F578(DemoEc* this, PlayState* play, s32 arg2) { CsCmdActorAction* npcAction; s32 sp18; - npcAction = DemoEc_GetNpcAction(globalCtx, arg2); + npcAction = DemoEc_GetNpcAction(play, arg2); if (npcAction != NULL) { sp18 = npcAction->action; if ((sp18 != this->npcAction)) { if (this->npcAction) {} if (sp18 == 2) { - func_8096F4FC(this, globalCtx); + func_8096F4FC(this, play); } this->npcAction = sp18; } } } -void DemoEc_UpdateMido(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateMido(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_SetNpcActionPosRot(this, globalCtx, 7); - DemoEc_UpdateBgFlags(this, globalCtx); - func_8096F578(this, globalCtx, 7); + func_8096D594(this, play); + DemoEc_SetNpcActionPosRot(this, play, 7); + DemoEc_UpdateBgFlags(this, play); + func_8096F578(this, play, 7); } -void func_8096F640(DemoEc* this, GlobalContext* globalCtx) { +void func_8096F640(DemoEc* this, PlayState* play) { s32 animDone = DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); func_8096F544(this, animDone); } -void DemoEc_DrawMido(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawMido(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gMidoEyeOpenTex, gMidoEyeHalfTex, @@ -938,15 +938,15 @@ void DemoEc_DrawMido(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitCucco(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitCucco(DemoEc* this, PlayState* play) { AnimationHeader* animation; - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gCuccoSkel); - DemoEc_UseAnimationObject(this, globalCtx); + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gCuccoSkel); + DemoEc_UseAnimationObject(this, play); if (this->actor.params == 22) { animation = &gDemoEcJumpingCuccoAnim; @@ -957,41 +957,41 @@ void DemoEc_InitCucco(DemoEc* this, GlobalContext* globalCtx) { } DemoEc_ChangeAnimation(this, animation, 0, 0.0f, false); - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_CUCCO; this->drawConfig = EC_DRAW_CUCCO; } -void DemoEc_UpdateCucco(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateCucco(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawCucco(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, NULL, NULL, NULL, NULL); +void DemoEc_DrawCucco(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, NULL, NULL, NULL, NULL); } -void DemoEc_InitCuccoLady(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gCuccoLadySkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitCuccoLady(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gCuccoLadySkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcCuccoLadyAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_CUCCO_LADY; this->drawConfig = EC_DRAW_CUCCO_LADY; } -void DemoEc_UpdateCuccoLady(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateCuccoLady(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawCuccoLady(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawCuccoLady(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gCuccoLadyEyeOpenTex, gCuccoLadyEyeHalfTex, @@ -1000,28 +1000,28 @@ void DemoEc_DrawCuccoLady(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitPotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_ds2_Skel_004258); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitPotionShopOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_ds2_Skel_004258); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_POTION_SHOP_OWNER; this->drawConfig = EC_DRAW_POTION_SHOP_OWNER; } -void DemoEc_UpdatePotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdatePotionShopOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawPotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawPotionShopOwner(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gPotionShopkeeperEyeOpenTex, gPotionShopkeeperEyeHalfTex, @@ -1030,49 +1030,49 @@ void DemoEc_DrawPotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitMaskShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_os_Skel_004658); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitMaskShopOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_os_Skel_004658); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_MASK_SHOP_OWNER; this->drawConfig = EC_DRAW_MASK_SHOP_OWNER; } -void DemoEc_UpdateMaskShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateMaskShopOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawMaskShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gOsEyeClosedTex, NULL, NULL, NULL); +void DemoEc_DrawMaskShopOwner(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gOsEyeClosedTex, NULL, NULL, NULL); } -void DemoEc_InitFishingOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gFishingOwnerSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitFishingOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gFishingOwnerSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_FISHING_MAN; this->drawConfig = EC_DRAW_FISHING_MAN; } -void DemoEc_UpdateFishingOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateFishingOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_FishingOwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, +void DemoEc_FishingOwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; @@ -1081,7 +1081,7 @@ void DemoEc_FishingOwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gf } } -void DemoEc_DrawFishingOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawFishingOwner(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gFishingOwnerEyeOpenTex, gFishingOwnerEyeHalfTex, @@ -1090,45 +1090,45 @@ void DemoEc_DrawFishingOwner(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, DemoEc_FishingOwnerPostLimbDraw); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, DemoEc_FishingOwnerPostLimbDraw); } -void DemoEc_InitBombchuShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_rs_Skel_004868); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitBombchuShopOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_rs_Skel_004868); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_BOMBCHU_SHOP_OWNER; this->drawConfig = EC_DRAW_BOMBCHU_SHOP_OWNER; } -void DempEc_UpdateBombchuShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DempEc_UpdateBombchuShopOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawBombchuShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawBombchuShopOwner(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gBombchuShopkeeperEyeOpenTex, gBombchuShopkeeperEyeHalfTex, gBombchuShopkeeperEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitGorons(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitGorons(DemoEc* this, PlayState* play) { s32 pad[2]; AnimationHeader* animation; f32 goronScale; Vec3f* scale = &this->actor.scale; - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gGoronSkel); - DemoEc_UseAnimationObject(this, globalCtx); + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gGoronSkel); + DemoEc_UseAnimationObject(this, play); if (this->actor.params == 30) { animation = &gDemoEcGoronAnim; @@ -1150,51 +1150,51 @@ void DemoEc_InitGorons(DemoEc* this, GlobalContext* globalCtx) { scale->y *= goronScale; scale->z *= goronScale; - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_GORON; this->drawConfig = EC_DRAW_GORON; } -void DemoEc_UpdateGorons(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateGorons(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawGorons(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawGorons(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, gGoronCsMouthNeutralTex, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, gGoronCsMouthNeutralTex, NULL, NULL); } -void DemoEc_InitMalon(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gMalonAdultSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitMalon(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gMalonAdultSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gMalonAdultSingAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_MALON; this->drawConfig = EC_DRAW_MALON; } -void DemoEc_UpdateMalon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateMalon(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawMalon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawMalon(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, gMalonAdultMouthHappyTex, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, gMalonAdultMouthHappyTex, NULL, NULL); } static DemoEcInitFunc sInitFuncs[] = { @@ -1235,7 +1235,7 @@ static DemoEcInitFunc sInitFuncs[] = { /* 34 */ DemoEc_InitMalon, }; -void DemoEc_InitNpc(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitNpc(DemoEc* this, PlayState* play) { s16 type = this->actor.params; if (sInitFuncs[type] == NULL) { @@ -1245,10 +1245,10 @@ void DemoEc_InitNpc(DemoEc* this, GlobalContext* globalCtx) { return; } - sInitFuncs[type](this, globalCtx); + sInitFuncs[type](this, play); } -void DemoEc_InitCommon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitCommon(DemoEc* this, PlayState* play) { s32 pad; s16 primary; s32 type; @@ -1260,8 +1260,8 @@ void DemoEc_InitCommon(DemoEc* this, GlobalContext* globalCtx) { type = this->actor.params; primary = sDrawObjects[type]; sp28 = sAnimationObjects[type]; - primaryBankIndex = Object_GetIndex(&globalCtx->objectCtx, primary); - secondaryBankIndex = Object_GetIndex(&globalCtx->objectCtx, sp28); + primaryBankIndex = Object_GetIndex(&play->objectCtx, primary); + secondaryBankIndex = Object_GetIndex(&play->objectCtx, sp28); if ((secondaryBankIndex < 0) || (primaryBankIndex < 0)) { // "Demo_Ec_main_bank: Bank unreadable arg_data = %d!" @@ -1270,13 +1270,13 @@ void DemoEc_InitCommon(DemoEc* this, GlobalContext* globalCtx) { return; } - if (Object_IsLoaded(&globalCtx->objectCtx, primaryBankIndex) && - Object_IsLoaded(&globalCtx->objectCtx, secondaryBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, primaryBankIndex) && + Object_IsLoaded(&play->objectCtx, secondaryBankIndex)) { this->drawObjBankIndex = primaryBankIndex; this->animObjBankIndex = secondaryBankIndex; - DemoEc_InitNpc(this, globalCtx); + DemoEc_InitNpc(this, play); } } @@ -1312,7 +1312,7 @@ static DemoEcUpdateFunc sUpdateFuncs[] = { DemoEc_UpdateMalon, }; -void DemoEc_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Update(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; s32 updateMode = this->updateMode; @@ -1321,13 +1321,13 @@ void DemoEc_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { if (updateMode != EC_UPDATE_COMMON) { - DemoEc_UseAnimationObject(this, globalCtx); + DemoEc_UseAnimationObject(this, play); } - sUpdateFuncs[updateMode](this, globalCtx); + sUpdateFuncs[updateMode](this, play); } } -void DemoEc_DrawCommon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawCommon(DemoEc* this, PlayState* play) { } static DemoEcDrawFunc sDrawFuncs[] = { @@ -1345,7 +1345,7 @@ static DemoEcDrawFunc sDrawFuncs[] = { DemoEc_DrawGorons, DemoEc_DrawMalon, }; -void DemoEc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Draw(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; s32 drawConfig = this->drawConfig; @@ -1354,9 +1354,9 @@ void DemoEc_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { if (drawConfig != EC_DRAW_COMMON) { - DemoEc_UseDrawObject(this, globalCtx); + DemoEc_UseDrawObject(this, play); } - sDrawFuncs[drawConfig](this, globalCtx); + sDrawFuncs[drawConfig](this, play); } } diff --git a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h index 4ba2e2953..e39e0addc 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h +++ b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h @@ -6,9 +6,9 @@ struct DemoEc; -typedef void (*DemoEcInitFunc)(struct DemoEc*, GlobalContext*); -typedef void (*DemoEcUpdateFunc)(struct DemoEc*, GlobalContext*); -typedef void (*DemoEcDrawFunc)(struct DemoEc*, GlobalContext*); +typedef void (*DemoEcInitFunc)(struct DemoEc*, PlayState*); +typedef void (*DemoEcUpdateFunc)(struct DemoEc*, PlayState*); +typedef void (*DemoEcDrawFunc)(struct DemoEc*, PlayState*); typedef struct DemoEc { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 12c42358b..f1d9b76c2 100644 --- a/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -12,55 +12,55 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_Update(Actor* thisx, GlobalContext* globalCtx); +void DemoEffect_Init(Actor* thisx, PlayState* play); +void DemoEffect_Destroy(Actor* thisx, PlayState* play); +void DemoEffect_Update(Actor* thisx, PlayState* play); -void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawFireBall(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawBlueOrb(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawLgtShower(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawLightRing(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawTriforceSpot(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawGetItem(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawLightEffect(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawTimeWarp(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx); +void DemoEffect_DrawCrystalLight(Actor* thisx, PlayState* play); +void DemoEffect_DrawFireBall(Actor* thisx, PlayState* play); +void DemoEffect_DrawBlueOrb(Actor* thisx, PlayState* play); +void DemoEffect_DrawLgtShower(Actor* thisx, PlayState* play); +void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play); +void DemoEffect_DrawLightRing(Actor* thisx, PlayState* play); +void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play); +void DemoEffect_DrawGetItem(Actor* thisx, PlayState* play); +void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play); +void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play); +void DemoEffect_DrawJewel(Actor* thisx, PlayState* play); -void DemoEffect_Wait(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitCreationFireball(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitJewel(GlobalContext* globalCtx, DemoEffect* this); +void DemoEffect_Wait(DemoEffect* this, PlayState* play); +void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play); +void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play); +void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play); +void DemoEffect_InitJewel(PlayState* play, DemoEffect* this); void DemoEffect_InitJewelColor(DemoEffect* this); -void DemoEffect_UpdateCrystalLight(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdatePositionToParent(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLgtShower(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateJewelAdult(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx); +void DemoEffect_UpdateCrystalLight(DemoEffect* this, PlayState* play); +void DemoEffect_UpdatePositionToParent(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLgtShower(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateJewelChild(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateJewelAdult(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateDust(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateCreationFireball(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, PlayState* play); -s32 DemoEffect_CheckCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionCompareId); -void DemoEffect_InitPositionFromCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionIndex); -void DemoEffect_MoveToCsEndpoint(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, s32 shouldUpdateFacing); -void DemoEffect_MoveGetItem(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, f32 speed); +s32 DemoEffect_CheckCsAction(DemoEffect* this, PlayState* play, s32 csActionCompareId); +void DemoEffect_InitPositionFromCsAction(DemoEffect* this, PlayState* play, s32 csActionIndex); +void DemoEffect_MoveToCsEndpoint(DemoEffect* this, PlayState* play, s32 csActionId, s32 shouldUpdateFacing); +void DemoEffect_MoveGetItem(DemoEffect* this, PlayState* play, s32 csActionId, f32 speed); const ActorInit Demo_Effect_InitVars = { ACTOR_DEMO_EFFECT, @@ -126,10 +126,10 @@ void DemoEffect_SetupUpdate(DemoEffect* this, DemoEffectFunc updateFunc) { /** * Gives a number on the range of 0.0f - 1.0f representing current cutscene action completion percentage. */ -f32 DemoEffect_InterpolateCsFrames(GlobalContext* globalCtx, s32 csActionId) { +f32 DemoEffect_InterpolateCsFrames(PlayState* play, s32 csActionId) { f32 interpolated = - Environment_LerpWeight(globalCtx->csCtx.npcActions[csActionId]->endFrame, - globalCtx->csCtx.npcActions[csActionId]->startFrame, globalCtx->csCtx.frames); + Environment_LerpWeight(play->csCtx.npcActions[csActionId]->endFrame, + play->csCtx.npcActions[csActionId]->startFrame, play->csCtx.frames); if (interpolated > 1.0f) { interpolated = 1.0f; } @@ -139,9 +139,9 @@ f32 DemoEffect_InterpolateCsFrames(GlobalContext* globalCtx, s32 csActionId) { /** * Initializes information for Jewel/Spritual Stone actors. */ -void DemoEffect_InitJewel(GlobalContext* globalCtx, DemoEffect* this) { +void DemoEffect_InitJewel(PlayState* play, DemoEffect* this) { this->initDrawFunc = DemoEffect_DrawJewel; - if (gSaveContext.n64ddFlag && globalCtx->sceneNum == SCENE_BDAN) { + if (gSaveContext.n64ddFlag && play->sceneNum == SCENE_BDAN) { this->initDrawFunc = DemoEffect_DrawGetItem; } if (!LINK_IS_ADULT) { @@ -149,13 +149,13 @@ void DemoEffect_InitJewel(GlobalContext* globalCtx, DemoEffect* this) { } else { this->initUpdateFunc = DemoEffect_UpdateJewelAdult; } - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { Actor_SetScale(&this->actor, 0.35f); } else { Actor_SetScale(&this->actor, 0.10f); } this->csActionId = 1; - this->actor.shape.rot.x = (gSaveContext.n64ddFlag && globalCtx->sceneNum == SCENE_BDAN) ? 0 : 16384; + this->actor.shape.rot.x = (gSaveContext.n64ddFlag && play->sceneNum == SCENE_BDAN) ? 0 : 16384; DemoEffect_InitJewelColor(this); this->jewel.alpha = 0; this->jewelCsRotation.x = this->jewelCsRotation.y = this->jewelCsRotation.z = 0; @@ -178,8 +178,8 @@ void DemoEffect_InitGetItem(DemoEffect* this) { /** * Main Actor Init function */ -void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoEffect_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoEffect* this = (DemoEffect*)thisx; s32 effectType; s32 lightEffect; @@ -194,7 +194,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { objectIndex = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP ? 0 - : Object_GetIndex(&globalCtx->objectCtx, sEffectTypeObjects[effectType]); + : Object_GetIndex(&play->objectCtx, sEffectTypeObjects[effectType]); osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectIndex); @@ -408,7 +408,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->actor, 0.020f); crystalLight = (DemoEffect*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + &play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_CRYSTAL_LIGHT); if (crystalLight != NULL) { @@ -416,7 +416,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { } lightRing = (DemoEffect*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &crystalLight->actor, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + &play->actorCtx, &crystalLight->actor, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_LIGHTRING_TRIFORCE); if (lightRing != NULL) { @@ -477,7 +477,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->jewelHolderDisplayList = gGiKokiriEmeraldSettingDL; this->jewel.type = DEMO_EFFECT_JEWEL_KOKIRI; this->jewel.isPositionInit = 0; - DemoEffect_InitJewel(globalCtx, this); + DemoEffect_InitJewel(play, this); break; case DEMO_EFFECT_JEWEL_GORON: @@ -485,7 +485,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->jewelHolderDisplayList = gGiGoronRubySettingDL; this->jewel.type = DEMO_EFFECT_JEWEL_GORON; this->jewel.isPositionInit = 0; - DemoEffect_InitJewel(globalCtx, this); + DemoEffect_InitJewel(play, this); break; case DEMO_EFFECT_JEWEL_ZORA: @@ -493,9 +493,9 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->jewelHolderDisplayList = gGiZoraSapphireSettingDL; this->jewel.type = DEMO_EFFECT_JEWEL_ZORA; this->jewel.isPositionInit = 0; - DemoEffect_InitJewel(globalCtx, this); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTOR_EN_DOOR); - if ((globalCtx->sceneNum == SCENE_BDAN) && (gSaveContext.infTable[20] & 0x20)) { + DemoEffect_InitJewel(play, this); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTOR_EN_DOOR); + if ((play->sceneNum == SCENE_BDAN) && (gSaveContext.infTable[20] & 0x20)) { Actor_Kill(&this->actor); return; } @@ -520,13 +520,13 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { /** * Main Actor Destroy function */ -void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_Destroy(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 effectType = (this->actor.params & 0x00FF); if (effectType == DEMO_EFFECT_TIMEWARP_MASTERSWORD || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { - SkelCurve_Destroy(globalCtx, &this->skelCurve); + SkelCurve_Destroy(play, &this->skelCurve); } } @@ -536,8 +536,8 @@ void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { * They are copied to actor.draw and updateFunc. * initUpdateFunc/initDrawFunc are set during initialization and are NOT executed. */ -void DemoEffect_Wait(DemoEffect* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->initObjectBankIndex)) { +void DemoEffect_Wait(DemoEffect* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->initObjectBankIndex)) { this->actor.objBankIndex = this->initObjectBankIndex; this->actor.draw = this->initDrawFunc; this->updateFunc = this->initUpdateFunc; @@ -549,7 +549,7 @@ void DemoEffect_Wait(DemoEffect* this, GlobalContext* globalCtx) { /** * Copies the current Actor's position to the parent Actor's position. */ -void DemoEffect_UpdatePositionToParent(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdatePositionToParent(DemoEffect* this, PlayState* play) { if (this->actor.parent != NULL) { // Struct copy affects regalloc this->actor.world.pos.x = this->actor.parent->world.pos.x; @@ -564,22 +564,22 @@ void DemoEffect_UpdatePositionToParent(DemoEffect* this, GlobalContext* globalCt * The Crystal Light's position is set to the parent Actor (Triforce) each frame. * If the Crystal Light has no parent Actor, then it will raise into the sky. */ -void DemoEffect_UpdateCrystalLight(DemoEffect* this, GlobalContext* globalCtx) { - DemoEffect_UpdatePositionToParent(this, globalCtx); +void DemoEffect_UpdateCrystalLight(DemoEffect* this, PlayState* play) { + DemoEffect_UpdatePositionToParent(this, play); this->actor.world.pos.y += 14.0f; } /** * Spawns sparkle effects for Medals */ -void DemoEffect_MedalSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 isSmallSpawner) { +void DemoEffect_MedalSparkle(DemoEffect* this, PlayState* play, s32 isSmallSpawner) { Vec3f velocity; Vec3f accel; Vec3f pos; Color_RGBA8 primColor; Color_RGBA8 envColor; - if (isSmallSpawner != 1 || (globalCtx->gameplayFrames & 1) == 0) { + if (isSmallSpawner != 1 || (play->gameplayFrames & 1) == 0) { primColor.r = 255; primColor.g = 255; primColor.b = 255; @@ -606,7 +606,7 @@ void DemoEffect_MedalSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 isS pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, 16); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 1000, 16); } } @@ -615,14 +615,14 @@ void DemoEffect_MedalSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 isS * Medals and Light Arrows. * It spawns Medal Sparkle Effects and scales/moves the Actor based on the current Cutscene Action */ -void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play) { Actor* thisx = &this->actor; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { if (this->getItem.isPositionInit) { - DemoEffect_MoveGetItem(this, globalCtx, this->csActionId, 0.1f); + DemoEffect_MoveGetItem(this, play, this->csActionId, 0.1f); } else { - DemoEffect_InitPositionFromCsAction(this, globalCtx, this->csActionId); + DemoEffect_InitPositionFromCsAction(this, play, this->csActionId); this->getItem.isPositionInit = 1; } @@ -635,16 +635,16 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx) { Actor_SetScale(thisx, 0.20f); if (gSaveContext.entranceIndex == 0x0053 || (gSaveContext.n64ddFlag && gSaveContext.entranceIndex == 0x05F4)) { - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + switch (play->csCtx.npcActions[this->csActionId]->action) { case 2: - DemoEffect_MedalSparkle(this, globalCtx, 0); + DemoEffect_MedalSparkle(this, play, 0); break; case 3: - DemoEffect_MedalSparkle(this, globalCtx, 1); + DemoEffect_MedalSparkle(this, play, 1); break; } } - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + switch (play->csCtx.npcActions[this->csActionId]->action) { case 2: if (gSaveContext.entranceIndex == 0x0053 || (gSaveContext.n64ddFlag && gSaveContext.entranceIndex == 0x05F4)) { @@ -684,16 +684,16 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx) { * 2) Returns from the Chamber of Sages for the first time * 3) Timeblock is cleared with the Song of Time (Large and Small have different versions of Timewarp) */ -void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { s32 effectType = (this->actor.params & 0x00FF); - if (!SkelCurve_Init(globalCtx, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { - ASSERT(!SkelCurve_Init(globalCtx, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)); + if (!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { + ASSERT(!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)); } if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 1.0f, 1.7f); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_InitTimeWarpTimeblock; if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE) { @@ -704,12 +704,12 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx) { } else if (gSaveContext.sceneSetupIndex == 5 || gSaveContext.sceneSetupIndex == 4 || (gSaveContext.entranceIndex == 0x0324 && !((gSaveContext.eventChkInf[12] & 0x200)))) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 59.0f, 0.0f); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpReturnFromChamberOfSages; osSyncPrintf(VT_FGCOL(CYAN) " 縮むバージョン \n" VT_RST); } else { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 1.0f, 1.0f); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpPullMasterSword; osSyncPrintf(VT_FGCOL(CYAN) " 通常 バージョン \n" VT_RST); } @@ -719,14 +719,14 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx) { * Update function for the Timewarp Actor that is used when Link pulls the Mastersword * It changes the Background Music and updates its SkelCurve animation. */ -void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 1)) { +void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, PlayState* play) { + if (Flags_GetEnv(play, 1)) { if (!(this->effectFlags & 0x2)) { func_800F3F3C(0); this->effectFlags |= 0x2; } - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { + if (SkelCurve_Update(play, &this->skelCurve)) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 60.0f, 59.0f, 0.0f); } } @@ -759,7 +759,7 @@ void DemoEffect_TimewarpShrink(f32 size) { * Update function for the Timewarp Actor that is used when Link returns from the Chamber of Sages for the first time. * It shrinks the timewarp vertices and scales the Actor. */ -void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, PlayState* play) { f32 shrinkProgress; this->timeWarp.shrinkTimer++; @@ -787,7 +787,7 @@ void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, GlobalC * Update function for the Timewarp Actor that is used when a Timeblock is cleared. * It shrinks the timewarp vertices and scales the Actor. */ -void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, PlayState* play) { f32 shrinkProgress; f32 scale; @@ -816,10 +816,10 @@ void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalC * Initializes information for the Timewarp Actor used for the Timeblock clear effect. * This is an Update Func that is only ran for one frame. */ -void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play) { func_8002F948(&this->actor, NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { + if (SkelCurve_Update(play, &this->skelCurve)) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 60.0f, 59.0f, 0.0f); this->updateFunc = DemoEffect_UpdateTimeWarpTimeblock; this->timeWarp.shrinkTimer = 0; @@ -830,13 +830,13 @@ void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx * Update function for the Triforce Actor. * It rotates and updates the alpha of the Triforce and child actors. */ -void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play) { this->triforceSpot.rotation += 0x03E8; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->csCtx.npcActions[this->csActionId]->action == 2) { if (this->primXluColor[0] < 140) { this->primXluColor[0]++; } @@ -858,7 +858,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx) { } if (gSaveContext.entranceIndex == 0x00A0 && gSaveContext.sceneSetupIndex == 6 && - globalCtx->csCtx.frames == 143) { + play->csCtx.frames == 143) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } } @@ -868,7 +868,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx) { * Update function for the LightRing actor that shrinks. * This is used in the creation cutscene when Din leaves a fireball that explodes into Death Mountain. */ -void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, PlayState* play) { if (this->lightRing.timer < this->lightRing.timerIncrement) { Actor_Kill(&this->actor); this->lightRing.timer = 0; @@ -894,8 +894,8 @@ void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, GlobalContext* global * These are spawned by Nayru. * These are also used by Din in the creation cutscene when she leaves a fireball that explodes into Death Mountain. */ -void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, GlobalContext* globalCtx) { - DemoEffect_UpdatePositionToParent(this, globalCtx); +void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, PlayState* play) { + DemoEffect_UpdatePositionToParent(this, play); this->lightRing.timer += this->lightRing.timerIncrement; if (this->lightRing.timer >= 225) { @@ -913,15 +913,15 @@ void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, GlobalContext* global * This version spawns a blue orb when the cutscene action state is set to 2. * Once the Blue Orb Actor is spawned the Update Function is changed to the regular Light Ring Expanding Update Func. */ -void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, PlayState* play) { DemoEffect* blueOrb; - DemoEffect_UpdatePositionToParent(this, globalCtx); + DemoEffect_UpdatePositionToParent(this, play); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->csActionId] != NULL && - globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { - blueOrb = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->csActionId] != NULL && + play->csCtx.npcActions[this->csActionId]->action == 2) { + blueOrb = (DemoEffect*)Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_BLUE_ORB); @@ -941,7 +941,7 @@ void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, GlobalContext* globalC * It moves based on gravity and decrements a timer until zero. Once the timer is zero it will spawn other Actors: * A Blue Orb Actor, and a Light Ring Expanding Actor, and a Light Ring Shrinking Actor. */ -void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateCreationFireball(DemoEffect* this, PlayState* play) { DemoEffect* effect; Actor_MoveForward(&this->actor); @@ -952,20 +952,20 @@ void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCt return; } - effect = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + effect = (DemoEffect*)Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_BLUE_ORB); if (effect != NULL) { Actor_SetScale(&effect->actor, 0.0f); } - effect = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + effect = (DemoEffect*)Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_LIGHTRING_EXPANDING); if (effect != NULL) { Actor_SetScale(&effect->actor, 0.1f); } - effect = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + effect = (DemoEffect*)Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_LIGHTRING_SHRINKING); if (effect != NULL) { @@ -981,7 +981,7 @@ void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCt * This is a special version that is used in the creation cutscene. * It is an Update Function only executed for one frame. The Update Function is then changed to UpdateCreationFireball. */ -void DemoEffect_InitCreationFireball(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play) { Actor* parent = this->actor.parent; this->actor.world.rot.y = parent->shape.rot.y; @@ -999,7 +999,7 @@ void DemoEffect_InitCreationFireball(DemoEffect* this, GlobalContext* globalCtx) * It's spawned in the middle of the expanding Light Ring. * The Blue Orb Actor shrinks after it grows to max size. */ -void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, PlayState* play) { this->blueOrb.alpha = this->blueOrb.scale * 16; this->blueOrb.scale--; Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); @@ -1015,7 +1015,7 @@ void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, GlobalContext* globalCtx) * It's spawned in the middle of the expanding Light Ring. * When the scale timer value reaches 0 the Blue Orb's Update Function changes to UpdateBlueOrbShrink. */ -void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, PlayState* play) { if (this->actor.parent != NULL) { // s32 cast necessary to match codegen. Without the explicit cast to u32 the compiler generates complex cast of // u8 to float @@ -1038,15 +1038,15 @@ void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, GlobalContext* globalCtx) { * The Light Effect has various use cases. * This function updates the position and scale of the actor based on the current cutscene command. */ -void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { u16 action; s32 isLargeSize; isLargeSize = ((this->actor.params & 0x0F00) >> 8); - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); + switch (play->csCtx.npcActions[this->csActionId]->action) { case 2: if (this->light.rotation < 240) { if (!isLargeSize) { @@ -1074,38 +1074,38 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) { break; } - if (globalCtx->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 6 && - globalCtx->csCtx.frames == 197) { + if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 6 && + play->csCtx.frames == 197) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WHITE_OUT); } - if (globalCtx->sceneNum == SCENE_SPOT16 && gSaveContext.sceneSetupIndex == 5) { - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (play->sceneNum == SCENE_SPOT16 && gSaveContext.sceneSetupIndex == 5) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } - if (globalCtx->csCtx.frames == 640) { + if (play->csCtx.frames == 640) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WHITE_OUT); } } - if (globalCtx->sceneNum == SCENE_SPOT08 && gSaveContext.sceneSetupIndex == 4) { - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (play->sceneNum == SCENE_SPOT08 && gSaveContext.sceneSetupIndex == 4) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } - if (globalCtx->csCtx.frames == 648) { + if (play->csCtx.frames == 648) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WHITE_OUT); } } - if (globalCtx->sceneNum == SCENE_TOKINOMA && gSaveContext.sceneSetupIndex == 14) { + if (play->sceneNum == SCENE_TOKINOMA && gSaveContext.sceneSetupIndex == 14) { - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->csCtx.npcActions[this->csActionId]->action == 2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } } - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI || globalCtx->sceneNum == SCENE_YOUSEI_IZUMI_YOKO) { - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI || play->sceneNum == SCENE_YOUSEI_IZUMI_YOKO) { + if (play->csCtx.npcActions[this->csActionId]->action == 2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } } @@ -1117,7 +1117,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) { * The Lgt Shower Actor is the green light effect spawned by Farore in the Kokiri Forst creation cutscene. * This function updates the scale and alpha of the Actor. */ -void DemoEffect_UpdateLgtShower(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLgtShower(DemoEffect* this, PlayState* play) { if (this->lgtShower.alpha > 3) { this->lgtShower.alpha -= 3; this->actor.scale.x *= 1.05f; @@ -1135,14 +1135,14 @@ void DemoEffect_UpdateLgtShower(DemoEffect* this, GlobalContext* globalCtx) { * This function also spawns a Fireball Actor and sets its update function to the special InitCreationFireball. * The spawned Fireball Actor is also scaled to be smaller than regular by this function. */ -void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) { DemoEffect* fireBall; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 1); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 1); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 3) { - fireBall = (DemoEffect*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, + if (play->csCtx.npcActions[this->csActionId]->action == 3) { + fireBall = (DemoEffect*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_FIRE_BALL); @@ -1155,22 +1155,22 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == 0x00A0) { switch (gSaveContext.sceneSetupIndex) { case 4: - if (globalCtx->csCtx.frames == 288) { + if (play->csCtx.frames == 288) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } - if (globalCtx->csCtx.frames == 635) { + if (play->csCtx.frames == 635) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; case 6: - if (globalCtx->csCtx.frames == 55) { + if (play->csCtx.frames == 55) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; case 11: - if (globalCtx->csCtx.frames == 350) { + if (play->csCtx.frames == 350) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; @@ -1185,19 +1185,19 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx) { * This function moves God Lgt Nayure based on the current cutscene command. * This function also spawns expanding light rings around Nayru in the creation cutscene */ -void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { DemoEffect* lightRing; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 1); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 1); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 3) { + if (play->csCtx.npcActions[this->csActionId]->action == 3) { if (this->godLgt.lightRingSpawnTimer != 0) { this->godLgt.lightRingSpawnTimer--; } else { this->godLgt.lightRingSpawnTimer = this->godLgt.lightRingSpawnDelay; lightRing = (DemoEffect*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + &play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x + 0x4000, this->actor.world.rot.y, this->actor.world.rot.z, DEMO_EFFECT_LIGHTRING_EXPANDING); @@ -1210,19 +1210,19 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == 0x00A0) { switch (gSaveContext.sceneSetupIndex) { case 4: - if (globalCtx->csCtx.frames == 298) { + if (play->csCtx.frames == 298) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; case 6: - if (globalCtx->csCtx.frames == 105) { + if (play->csCtx.frames == 105) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; case 11: - if (globalCtx->csCtx.frames == 360) { + if (play->csCtx.frames == 360) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; @@ -1230,10 +1230,10 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { } if (gSaveContext.entranceIndex == 0x013D && gSaveContext.sceneSetupIndex == 4) { - if (globalCtx->csCtx.frames == 72) { + if (play->csCtx.frames == 72) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } - if (globalCtx->csCtx.frames == 80) { + if (play->csCtx.frames == 80) { func_800F3F3C(4); } } @@ -1246,15 +1246,15 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { * This function moves God Lgt Farore based on the current cutscene command. * This function also spawns an Lgt Shower Actor during the Kokiri creation cutscene. */ -void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play) { DemoEffect* lgtShower; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 1); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 1); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 3) { + if (play->csCtx.npcActions[this->csActionId]->action == 3) { lgtShower = (DemoEffect*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + &play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y - 150.0f, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_LGT_SHOWER); if (lgtShower != NULL) { @@ -1270,19 +1270,19 @@ void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == 0x00A0) { switch (gSaveContext.sceneSetupIndex) { case 4: - if (globalCtx->csCtx.frames == 315) { + if (play->csCtx.frames == 315) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; case 6: - if (globalCtx->csCtx.frames == 80) { + if (play->csCtx.frames == 80) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; case 11: - if (globalCtx->csCtx.frames == 370) { + if (play->csCtx.frames == 370) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; @@ -1435,7 +1435,7 @@ void DemoEffect_MoveJewelSpherical(f32 degrees, f32 frameDivisor, Vec3f startPos * This is used by the Jewel Actor during the Door of Time activation cutscene. * This is run when the Jewels merge from Link and begin orbiting him. */ -void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, PlayState* play) { Vec3f startPos; Vec3f endPos; f32 frameDivisor; @@ -1444,14 +1444,14 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo s32 csActionId; csActionId = this->csActionId; - startPos.x = globalCtx->csCtx.npcActions[csActionId]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[csActionId]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[csActionId]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[csActionId]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[csActionId]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[csActionId]->endPos.z; + startPos.x = play->csCtx.npcActions[csActionId]->startPos.x; + startPos.y = play->csCtx.npcActions[csActionId]->startPos.y; + startPos.z = play->csCtx.npcActions[csActionId]->startPos.z; + endPos.x = play->csCtx.npcActions[csActionId]->endPos.x; + endPos.y = play->csCtx.npcActions[csActionId]->endPos.y; + endPos.z = play->csCtx.npcActions[csActionId]->endPos.z; - frameDivisor = DemoEffect_InterpolateCsFrames(globalCtx, csActionId); + frameDivisor = DemoEffect_InterpolateCsFrames(play, csActionId); switch (this->jewel.type) { case DEMO_EFFECT_JEWEL_KOKIRI: @@ -1484,7 +1484,7 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo /** * Spawns Sparkle Effects for the Jewel Actor. */ -void DemoEffect_JewelSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 spawnerCount) { +void DemoEffect_JewelSparkle(DemoEffect* this, PlayState* play, s32 spawnerCount) { Vec3f velocity; Vec3f accel; Color_RGBA8 primColor; @@ -1512,7 +1512,7 @@ void DemoEffect_JewelSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 spa velocity.x = (Rand_ZeroOne() - 0.5f) * 1.5f; velocity.z = (Rand_ZeroOne() - 0.5f) * 1.5f; - EffectSsKiraKira_SpawnDispersed(globalCtx, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, + EffectSsKiraKira_SpawnDispersed(play, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, 3000, 16); } } @@ -1521,8 +1521,8 @@ void DemoEffect_JewelSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 spa * Plays Jewel sound effects. * The sSfxJewelId global variable is used to ensure only one Jewel Actor is playing SFX when all are spawned. */ -void DemoEffect_PlayJewelSfx(DemoEffect* this, GlobalContext* globalCtx) { - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { +void DemoEffect_PlayJewelSfx(DemoEffect* this, PlayState* play) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { if (this->actor.params == sSfxJewelId[0]) { func_8002F974(&this->actor, NA_SE_EV_SPIRIT_STONE - SFX_FLAG); } else if (sSfxJewelId[0] == 0) { @@ -1539,10 +1539,10 @@ void DemoEffect_PlayJewelSfx(DemoEffect* this, GlobalContext* globalCtx) { * If a value of less than 1.0f were passed to SetJewelColor, then it would appear to drain the Jewel's color. * This can be seen in preprelease screenshots. */ -void DemoEffect_UpdateJewelAdult(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateJewelAdult(DemoEffect* this, PlayState* play) { this->jewel.timer++; this->actor.shape.rot.y += 0x0400; - DemoEffect_PlayJewelSfx(this, globalCtx); + DemoEffect_PlayJewelSfx(this, play); if (gSaveContext.n64ddFlag) { switch (this->jewel.type) { @@ -1578,32 +1578,32 @@ void DemoEffect_UpdateJewelAdult(DemoEffect* this, GlobalContext* globalCtx) { * This rotates the Jewel and updates a timer that is used to scroll Jewel textures. * This also updates the Jewel's position based on different cutscenes. */ -void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateJewelChild(DemoEffect* this, PlayState* play) { s32 hasCmdAction; Actor* thisx = &this->actor; this->jewel.timer++; - if (globalCtx->csCtx.state && globalCtx->csCtx.npcActions[this->csActionId]) { - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + if (play->csCtx.state && play->csCtx.npcActions[this->csActionId]) { + switch (play->csCtx.npcActions[this->csActionId]->action) { case 3: if (gSaveContext.eventChkInf[4] & 0x800) { gSaveContext.eventChkInf[4] |= 0x800; } - DemoEffect_MoveJewelActivateDoorOfTime(this, globalCtx); - if ((globalCtx->gameplayFrames & 1) == 0) { - DemoEffect_JewelSparkle(this, globalCtx, 1); + DemoEffect_MoveJewelActivateDoorOfTime(this, play); + if ((play->gameplayFrames & 1) == 0) { + DemoEffect_JewelSparkle(this, play, 1); } break; case 4: if (this->jewel.isPositionInit) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); DemoEffect_MoveJewelSplit(&thisx->world, this); - if ((globalCtx->gameplayFrames & 1) == 0) { - DemoEffect_JewelSparkle(this, globalCtx, 1); + if ((play->gameplayFrames & 1) == 0) { + DemoEffect_JewelSparkle(this, play, 1); } } else { - DemoEffect_InitPositionFromCsAction(this, globalCtx, this->csActionId); + DemoEffect_InitPositionFromCsAction(this, play, this->csActionId); DemoEffect_MoveJewelSplit(&thisx->world, this); this->jewel.isPositionInit = 1; } @@ -1612,7 +1612,7 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { Actor_Kill(thisx); return; default: - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); if (gSaveContext.entranceIndex == 0x0053 || (gSaveContext.n64ddFlag && gSaveContext.entranceIndex == 0x05F4)) { DemoEffect_MoveJewelSplit(&thisx->world, this); @@ -1623,7 +1623,7 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == 0x0053 || (gSaveContext.n64ddFlag && gSaveContext.entranceIndex == 0x05F4)) { if (!(gSaveContext.eventChkInf[4] & 0x800)) { - hasCmdAction = globalCtx->csCtx.state && globalCtx->csCtx.npcActions[this->csActionId]; + hasCmdAction = play->csCtx.state && play->csCtx.npcActions[this->csActionId]; if (!hasCmdAction) { this->effectFlags |= 0x1; return; @@ -1632,7 +1632,7 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { } thisx->shape.rot.y += 0x0400; - DemoEffect_PlayJewelSfx(this, globalCtx); + DemoEffect_PlayJewelSfx(this, play); this->effectFlags &= ~1; if (gSaveContext.n64ddFlag) { @@ -1669,13 +1669,13 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { * This is the dust that is spawned in the Temple of Time during the Light Arrows cutscene. * This spawns the dust particles and increments a timer */ -void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateDust(DemoEffect* this, PlayState* play) { Vec3f pos; Vec3f velocity; Vec3f accel; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL && - globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL && + play->csCtx.npcActions[this->csActionId]->action == 2) { pos = this->actor.world.pos; pos.y += 600.0f; @@ -1690,7 +1690,7 @@ void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.2f; - func_8002873C(globalCtx, &pos, &velocity, &accel, 300, 0, 30); + func_8002873C(play, &pos, &velocity, &accel, 300, 0, 30); this->dust.timer++; } @@ -1699,17 +1699,17 @@ void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx) { /** * This is the main Actor Update Function. */ -void DemoEffect_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_Update(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); } /** * Check if the current cutscene action matches the passed in cutscene action ID. */ -s32 DemoEffect_CheckCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionCompareId) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL && - globalCtx->csCtx.npcActions[this->csActionId]->action == csActionCompareId) { +s32 DemoEffect_CheckCsAction(DemoEffect* this, PlayState* play, s32 csActionCompareId) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL && + play->csCtx.npcActions[this->csActionId]->action == csActionCompareId) { return 1; } @@ -1719,34 +1719,34 @@ s32 DemoEffect_CheckCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csA /** * Draw function for the Jewel Actor. */ -void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx2) { +void DemoEffect_DrawJewel(Actor* thisx, PlayState* play2) { DemoEffect* this = (DemoEffect*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames = this->jewel.timer; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { if (!(this->effectFlags & 0x1)) { switch (this->jewel.type) { case DEMO_EFFECT_JEWEL_KOKIRI: gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 256, (256 - ((frames * 2) % 256)) - 1, 64, 64, 1, (frames * 2) % 256, (256 - (frames % 256)) - 1, 16, 16)); break; case DEMO_EFFECT_JEWEL_GORON: gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 128, (256 - ((frames * 2) % 256)) - 1, 32, 64, 1, (frames * 2) % 256, (256 - (frames % 256)) - 1, 16, 8)); break; case DEMO_EFFECT_JEWEL_ZORA: gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 256, (256 - ((frames * 2) % 256)) - 1, 32, 32, 1, (frames * 2) % 256, (256 - (frames % 256)) - 1, 16, 16)); break; @@ -1754,19 +1754,19 @@ void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx2) { if (!frames) {} - gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(globalCtx->state.gfxCtx, (u8)frames, (u8)frames, 16, 16)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, (u8)frames, (u8)frames, 16, 16)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - 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); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1], this->primXluColor[2], 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); gSPDisplayList(POLY_XLU_DISP++, this->jewelDisplayList); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, this->primOpaColor[0], this->primOpaColor[1], this->primOpaColor[2], 255); gDPSetEnvColor(POLY_OPA_DISP++, this->envOpaColor[0], this->envOpaColor[1], this->envOpaColor[2], 255); @@ -1774,18 +1774,18 @@ void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx2) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Crystal Light Actor. */ -void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawCrystalLight(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; DemoEffect* parent = (DemoEffect*)this->actor.parent; - u32 frames = globalCtx->gameplayFrames & 0xFFFF; + u32 frames = play->gameplayFrames & 0xFFFF; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (parent != NULL) { gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 170, parent->triforceSpot.crystalLightOpacity); @@ -1793,16 +1793,16 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 170, 255); } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 2) % 512, 512 - (frames % 512) - 1, 128, 128, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 2) % 512, 512 - (frames % 512) - 1, 128, 128, 1, 512 - ((frames * 2) % 512) - 1, 0, 64, 64)); Matrix_Push(); Matrix_RotateY(0.0f, MTXMODE_APPLY); Matrix_RotateX((11.0 * M_PI) / 180.0, MTXMODE_APPLY); Matrix_Translate(0.0f, 150.0f, 0.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++, gCrystalLightDL); Matrix_Pop(); @@ -1810,7 +1810,7 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY((2.0f * M_PI) / 3.0f, MTXMODE_APPLY); Matrix_RotateX((11.0 * M_PI) / 180.0, MTXMODE_APPLY); Matrix_Translate(0.0f, 150.0f, 0.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++, gCrystalLightDL); Matrix_Pop(); @@ -1818,49 +1818,49 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY((4.0f * M_PI) / 3.0f, MTXMODE_APPLY); Matrix_RotateX((11.0 * M_PI) / 180.0, MTXMODE_APPLY); Matrix_Translate(0.0f, 150.0f, 0.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++, gCrystalLightDL); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Fire Ball Actor. */ -void DemoEffect_DrawFireBall(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawFireBall(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 64, 64, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_XLU_DISP++, globalCtx->billboardMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, play->billboardMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPSegment( POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 128 - ((frames * 20) % 128) - 1, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 128 - ((frames * 20) % 128) - 1, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, gCreationFireBallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the God Lgt Actors. * This draws either Din, Nayru, or Farore based on the colors set in the DemoEffect struct. */ -void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (!DemoEffect_CheckCsAction(this, globalCtx, 2)) { + if (!DemoEffect_CheckCsAction(this, play, 2)) { if (gSaveContext.entranceIndex == 0x00A0) { if (gSaveContext.sceneSetupIndex == 4) { - if (globalCtx->csCtx.frames <= 680) { + if (play->csCtx.frames <= 680) { func_80078914(&this->actor.projectedPos, NA_SE_EV_GOD_FLYING - SFX_FLAG); } } else { @@ -1871,21 +1871,21 @@ void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 512, 0, 128, 64, 1, (frames * 2) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 512, 0, 128, 64, 1, (frames * 2) % 256, 512 - ((frames * 70) % 512) - 1, 64, 32)); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 96, 1, (frames * 10) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 96, 1, (frames * 10) % 256, 256 - ((frames * 30) % 512) - 1, 8, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, this->primXluColor[0], this->primXluColor[1], this->primXluColor[2], 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Push(); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGoldenGoddessAuraDL); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); Matrix_Pop(); this->godLgt.rotation++; @@ -1897,140 +1897,140 @@ void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, -140.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoldenGoddessBodyDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Light Effect Actor. */ -void DemoEffect_DrawLightEffect(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; u8* alpha; Gfx* disp; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { if (this->light.flicker == 0) { this->light.flicker = 1; } else { disp = (uintptr_t)gEffFlash1DL; alpha = &this->light.alpha; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1], this->primXluColor[2], *alpha); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); Matrix_Scale(((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, MTXMODE_APPLY); Matrix_Push(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(this->light.rotation * (M_PI / 180.0f), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, disp); Matrix_Pop(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(-(f32)this->light.rotation * (M_PI / 180.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++, disp); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Blue Orb Actor. */ -void DemoEffect_DrawBlueOrb(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawBlueOrb(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 188, 255, 255, this->blueOrb.alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 255); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(this->blueOrb.rotation * (M_PI / 0x8000), 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); this->blueOrb.rotation += 0x01F4; gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Lgt Shower Actor. */ -void DemoEffect_DrawLgtShower(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawLgtShower(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 64, 64, 255, 255, 160, this->lgtShower.alpha); gDPSetEnvColor(POLY_XLU_DISP++, 50, 200, 0, 255); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(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++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 5) % 1024, 0, 256, 64, 1, (frames * 10) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 5) % 1024, 0, 256, 64, 1, (frames * 10) % 128, 512 - ((frames * 50) % 512), 32, 16)); gSPDisplayList(POLY_XLU_DISP++, gEnliveningLightDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Light Ring Actor. */ -void DemoEffect_DrawLightRing(Actor* thisx, GlobalContext* globalCtx2) { +void DemoEffect_DrawLightRing(Actor* thisx, PlayState* play2) { DemoEffect* this = (DemoEffect*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames = this->lightRing.timer; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 170, 255, 255, this->lightRing.alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 255); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 5) % 64, 512 - ((frames * 2) % 512) - 1, 16, 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 5) % 64, 512 - ((frames * 2) % 512) - 1, 16, 128, 1, 0, 0, 8, 1024)); gSPDisplayList(POLY_XLU_DISP++, gGoldenGoddessLightRingDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Triforce Spot Actor. */ -void DemoEffect_DrawTriforceSpot(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad; Vtx* vertices = ResourceMgr_LoadVtxByName(SEGMENTED_TO_VIRTUAL(gTriforceVtx)); - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); - if (gSaveContext.entranceIndex != 0x0400 || globalCtx->csCtx.frames < 885) { - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + if (gSaveContext.entranceIndex != 0x0400 || play->csCtx.frames < 885) { + func_80093D84(play->state.gfxCtx); if (this->triforceSpot.lightColumnOpacity > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_AURORA - SFX_FLAG); Matrix_Push(); Matrix_Scale(1.0f, 2.4f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 256 - ((frames * 4) % 256) - 1, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 256 - ((frames * 4) % 256) - 1, 64, 64, 1, 0, 256 - ((frames * 2) % 256) - 1, 64, 32)); vertices[86].n.a = vertices[87].n.a = vertices[88].n.a = vertices[89].n.a = vertices[92].n.a = vertices[93].n.a = vertices[94].n.a = vertices[95].n.a = (s8)this->triforceSpot.lightColumnOpacity; @@ -2042,80 +2042,80 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, GlobalContext* globalCtx) { if (this->triforceSpot.triforceSpotOpacity != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRIFORCE - SFX_FLAG); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->triforceSpot.triforceSpotOpacity < 250) { - func_8002ED80(&this->actor, globalCtx, 0); - func_80093D84(globalCtx->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + func_80093D84(play->state.gfxCtx); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); Matrix_RotateY(this->triforceSpot.rotation * (M_PI / 0x8000), 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); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 16, 1, 0, 0, 16, 8)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 16, 1, 0, 0, 16, 8)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 160, this->triforceSpot.triforceSpotOpacity); gDPSetEnvColor(POLY_XLU_DISP++, 170, 140, 0, 255); gSPDisplayList(POLY_XLU_DISP++, gTriforceDL); } else { - func_8002EBCC(&this->actor, globalCtx, 0); - func_80093D18(globalCtx->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); + func_80093D18(play->state.gfxCtx); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_AA_ZB_OPA_SURF2); Matrix_RotateY(this->triforceSpot.rotation * (M_PI / 0x8000), 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++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 16, 1, 0, 0, 16, 8)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 16, 1, 0, 0, 16, 8)); gDPSetPrimColor(POLY_OPA_DISP++, 128, 128, 255, 255, 160, 255); gDPSetEnvColor(POLY_OPA_DISP++, 170, 140, 0, 255); gSPDisplayList(POLY_OPA_DISP++, gTriforceDL); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draw function for the Get Item Actors. * This is either Medals or Light Arrows based on the drawId. */ -void DemoEffect_DrawGetItem(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawGetItem(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - if (!DemoEffect_CheckCsAction(this, globalCtx, 1) && !DemoEffect_CheckCsAction(this, globalCtx, 4)) { + if (!DemoEffect_CheckCsAction(this, play, 1) && !DemoEffect_CheckCsAction(this, play, 4)) { if (!this->getItem.isLoaded) { this->getItem.isLoaded = 1; return; } - if (gSaveContext.n64ddFlag && globalCtx->sceneNum == SCENE_BDAN) { + if (gSaveContext.n64ddFlag && play->sceneNum == SCENE_BDAN) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_BARINADE, RG_ZORA_SAPPHIRE); this->getItem.drawId = getItemEntry.gid; - func_8002EBCC(thisx, globalCtx, 0); - func_8002ED80(thisx, globalCtx, 0); - GetItemEntry_Draw(globalCtx, getItemEntry); + func_8002EBCC(thisx, play, 0); + func_8002ED80(thisx, play, 0); + GetItemEntry_Draw(play, getItemEntry); return; } - func_8002EBCC(thisx, globalCtx, 0); - func_8002ED80(thisx, globalCtx, 0); - GetItem_Draw(globalCtx, this->getItem.drawId); + func_8002EBCC(thisx, play, 0); + func_8002ED80(thisx, play, 0); + GetItem_Draw(play, this->getItem.drawId); } } /** * Callback for the SkelCurve system to draw the animated limbs. */ -s32 DemoEffect_DrawTimewarpLimbs(GlobalContext* globalCtx, SkelAnimeCurve* skelCuve, s32 limbIndex, void* thisx) { +s32 DemoEffect_DrawTimewarpLimbs(PlayState* play, SkelAnimeCurve* skelCuve, s32 limbIndex, void* thisx) { s32 pad; DemoEffect* this = (DemoEffect*)thisx; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, 170, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 6) % 1024, 256 - ((frames * 16) % 256) - 1, 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 6) % 1024, 256 - ((frames * 16) % 256) - 1, 256, 64, 1, (frames * 4) % 512, 128 - ((frames * 12) % 128) - 1, 128, 32)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (limbIndex == 0) { LimbTransform* transform = &skelCuve->transforms[0]; @@ -2130,17 +2130,17 @@ s32 DemoEffect_DrawTimewarpLimbs(GlobalContext* globalCtx, SkelAnimeCurve* skelC /** * Draw function for the Time Warp Actors. */ -void DemoEffect_DrawTimeWarp(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 effectType = (this->actor.params & 0x00FF); if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL || - Flags_GetEnv(globalCtx, 1) || gSaveContext.sceneSetupIndex >= 4 || gSaveContext.entranceIndex == 0x0324) { + Flags_GetEnv(play, 1) || gSaveContext.sceneSetupIndex >= 4 || gSaveContext.entranceIndex == 0x0324) { OPEN_DISPS(gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 25); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - SkelCurve_Draw(thisx, globalCtx, &this->skelCurve, DemoEffect_DrawTimewarpLimbs, NULL, 1, this); + SkelCurve_Draw(thisx, play, &this->skelCurve, DemoEffect_DrawTimewarpLimbs, NULL, 1, this); CLOSE_DISPS(gfxCtx); } } @@ -2163,19 +2163,19 @@ void DemoEffect_FaceToCsEndpoint(DemoEffect* this, Vec3f startPos, Vec3f endPos) * Will only update the Actor's facing/rotation if the shouldUpdateFacing argument is true. * The speed is based on the current progress in the cutscene action. */ -void DemoEffect_MoveToCsEndpoint(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, s32 shouldUpdateFacing) { +void DemoEffect_MoveToCsEndpoint(DemoEffect* this, PlayState* play, s32 csActionId, s32 shouldUpdateFacing) { Vec3f startPos; Vec3f endPos; f32 speed; - startPos.x = globalCtx->csCtx.npcActions[csActionId]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[csActionId]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[csActionId]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[csActionId]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[csActionId]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[csActionId]->endPos.z; + startPos.x = play->csCtx.npcActions[csActionId]->startPos.x; + startPos.y = play->csCtx.npcActions[csActionId]->startPos.y; + startPos.z = play->csCtx.npcActions[csActionId]->startPos.z; + endPos.x = play->csCtx.npcActions[csActionId]->endPos.x; + endPos.y = play->csCtx.npcActions[csActionId]->endPos.y; + endPos.z = play->csCtx.npcActions[csActionId]->endPos.z; - speed = DemoEffect_InterpolateCsFrames(globalCtx, csActionId); + speed = DemoEffect_InterpolateCsFrames(play, csActionId); this->actor.world.pos.x = ((endPos.x - startPos.x) * speed) + startPos.x; this->actor.world.pos.y = ((endPos.y - startPos.y) * speed) + startPos.y; @@ -2189,21 +2189,21 @@ void DemoEffect_MoveToCsEndpoint(DemoEffect* this, GlobalContext* globalCtx, s32 /** * Moves a GetItem actor towards the current cutscene action's endpoint. */ -void DemoEffect_MoveGetItem(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, f32 speed) { +void DemoEffect_MoveGetItem(DemoEffect* this, PlayState* play, s32 csActionId, f32 speed) { Vec3f endPos; - endPos.x = globalCtx->csCtx.npcActions[csActionId]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[csActionId]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[csActionId]->endPos.z; + endPos.x = play->csCtx.npcActions[csActionId]->endPos.x; + endPos.y = play->csCtx.npcActions[csActionId]->endPos.y; + endPos.z = play->csCtx.npcActions[csActionId]->endPos.z; DemoEffect_MoveTowardTarget(endPos, this, speed); } /** * Initializes the Actor's position to the current cutscene action's start point. */ -void DemoEffect_InitPositionFromCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionIndex) { - f32 x = globalCtx->csCtx.npcActions[csActionIndex]->startPos.x; - f32 y = globalCtx->csCtx.npcActions[csActionIndex]->startPos.y; - f32 z = globalCtx->csCtx.npcActions[csActionIndex]->startPos.z; +void DemoEffect_InitPositionFromCsAction(DemoEffect* this, PlayState* play, s32 csActionIndex) { + f32 x = play->csCtx.npcActions[csActionIndex]->startPos.x; + f32 y = play->csCtx.npcActions[csActionIndex]->startPos.y; + f32 z = play->csCtx.npcActions[csActionIndex]->startPos.z; this->actor.world.pos.x = x; this->actor.world.pos.y = y; diff --git a/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h b/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h index 5434b1d36..7e89d8132 100644 --- a/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h +++ b/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h @@ -6,7 +6,7 @@ struct DemoEffect; -typedef void (*DemoEffectFunc)(struct DemoEffect*, GlobalContext*); +typedef void (*DemoEffectFunc)(struct DemoEffect*, PlayState*); typedef struct { /* 0x00 */ u8 timer; diff --git a/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index c51f7528a..479b12c6f 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -21,15 +21,15 @@ typedef enum { /* 0x01 */ EXT_DRAW_VORTEX } DemoExtDrawMode; -void DemoExt_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoExt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoExt_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoExt_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoExt_Init(Actor* thisx, PlayState* play); +void DemoExt_Destroy(Actor* thisx, PlayState* play); +void DemoExt_Update(Actor* thisx, PlayState* play); +void DemoExt_Draw(Actor* thisx, PlayState* play); -void DemoExt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Destroy(Actor* thisx, PlayState* play) { } -void DemoExt_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Init(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; this->scrollIncr[0] = 25; @@ -50,9 +50,9 @@ void DemoExt_PlayVortexSFX(DemoExt* this) { } } -CsCmdActorAction* DemoExt_GetNpcAction(GlobalContext* globalCtx, s32 npcActionIndex) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[npcActionIndex]; +CsCmdActorAction* DemoExt_GetNpcAction(PlayState* play, s32 npcActionIndex) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[npcActionIndex]; } return NULL; } @@ -62,8 +62,8 @@ void DemoExt_SetupWait(DemoExt* this) { this->drawMode = EXT_DRAW_NOTHING; } -void DemoExt_SetupMaintainVortex(DemoExt* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoExt_GetNpcAction(globalCtx, 5); +void DemoExt_SetupMaintainVortex(DemoExt* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoExt_GetNpcAction(play, 5); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -87,8 +87,8 @@ void DemoExt_FinishClosing(DemoExt* this) { } } -void DemoExt_CheckCsMode(DemoExt* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = DemoExt_GetNpcAction(globalCtx, 5); +void DemoExt_CheckCsMode(DemoExt* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = DemoExt_GetNpcAction(play, 5); s32 csAction; s32 previousCsAction; @@ -102,7 +102,7 @@ void DemoExt_CheckCsMode(DemoExt* this, GlobalContext* globalCtx) { DemoExt_SetupWait(this); break; case 2: - DemoExt_SetupMaintainVortex(this, globalCtx); + DemoExt_SetupMaintainVortex(this, play); break; case 3: DemoExt_SetupDispellVortex(this); @@ -144,17 +144,17 @@ void DemoExt_SetColorsAndScales(DemoExt* this) { scale->z = (kREG(21) + 400.0f) * shrinkFactor; } -void DemoExt_Wait(DemoExt* this, GlobalContext* globalCtx) { - DemoExt_CheckCsMode(this, globalCtx); +void DemoExt_Wait(DemoExt* this, PlayState* play) { + DemoExt_CheckCsMode(this, play); } -void DemoExt_MaintainVortex(DemoExt* this, GlobalContext* globalCtx) { +void DemoExt_MaintainVortex(DemoExt* this, PlayState* play) { DemoExt_PlayVortexSFX(this); DemoExt_SetScrollAndRotation(this); - DemoExt_CheckCsMode(this, globalCtx); + DemoExt_CheckCsMode(this, play); } -void DemoExt_DispellVortex(DemoExt* this, GlobalContext* globalCtx) { +void DemoExt_DispellVortex(DemoExt* this, PlayState* play) { DemoExt_PlayVortexSFX(this); DemoExt_SetScrollAndRotation(this); DemoExt_SetColorsAndScales(this); @@ -167,21 +167,21 @@ static DemoExtActionFunc sActionFuncs[] = { DemoExt_DispellVortex, }; -void DemoExt_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Update(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; if ((this->action < EXT_WAIT) || (this->action > EXT_DISPELL) || sActionFuncs[this->action] == NULL) { // "Main mode is abnormal!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } } -void DemoExt_DrawNothing(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_DrawNothing(Actor* thisx, PlayState* play) { } -void DemoExt_DrawVortex(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_DrawVortex(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; Mtx* mtx; GraphicsContext* gfxCtx; @@ -189,7 +189,7 @@ void DemoExt_DrawVortex(Actor* thisx, GlobalContext* globalCtx) { Vec3f* scale; scale = &this->scale; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; mtx = Graph_Alloc(gfxCtx, sizeof(Mtx)); OPEN_DISPS(gfxCtx); @@ -221,7 +221,7 @@ static DemoExtDrawFunc sDrawFuncs[] = { DemoExt_DrawVortex, }; -void DemoExt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Draw(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; if ((this->drawMode < EXT_DRAW_NOTHING) || (this->drawMode > EXT_DRAW_VORTEX) || @@ -229,7 +229,7 @@ void DemoExt_Draw(Actor* thisx, GlobalContext* globalCtx) { // "Draw mode is abnormal!" osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sDrawFuncs[this->drawMode](thisx, globalCtx); + sDrawFuncs[this->drawMode](thisx, play); } } diff --git a/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h b/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h index 9a446b7c0..2805c474f 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h +++ b/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h @@ -6,8 +6,8 @@ struct DemoExt; -typedef void (*DemoExtActionFunc)(struct DemoExt*, GlobalContext*); -typedef void (*DemoExtDrawFunc)(Actor*, GlobalContext*); +typedef void (*DemoExtActionFunc)(struct DemoExt*, PlayState*); +typedef void (*DemoExtDrawFunc)(Actor*, PlayState*); typedef struct DemoExt { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index 300a123b9..bedbcded1 100644 --- a/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoGeff_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGeff_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGeff_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGeff_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGeff_Init(Actor* thisx, PlayState* play); +void DemoGeff_Destroy(Actor* thisx, PlayState* play); +void DemoGeff_Update(Actor* thisx, PlayState* play); +void DemoGeff_Draw(Actor* thisx, PlayState* play); -void func_80978030(DemoGeff* this, GlobalContext* globalCtx); +void func_80978030(DemoGeff* this, PlayState* play); -void func_809783D4(DemoGeff* this, GlobalContext* globalCtx); -void func_80978308(DemoGeff* this, GlobalContext* globalCtx); +void func_809783D4(DemoGeff* this, PlayState* play); +void func_80978308(DemoGeff* this, PlayState* play); -void func_809784D4(DemoGeff* this, GlobalContext* globalCtx); -void func_80978344(DemoGeff* this, GlobalContext* globalCtx); +void func_809784D4(DemoGeff* this, PlayState* play); +void func_80978344(DemoGeff* this, PlayState* play); static s16 sObjectIDs[] = { OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, @@ -55,10 +55,10 @@ const ActorInit Demo_Geff_InitVars = { NULL, }; -void DemoGeff_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Destroy(Actor* thisx, PlayState* play) { } -void DemoGeff_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Init(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; if (this->actor.params < 0 || this->actor.params >= 9) { @@ -70,8 +70,8 @@ void DemoGeff_Init(Actor* thisx, GlobalContext* globalCtx) { this->drawConfig = 0; } -void func_80977EA8(GlobalContext* globalCtx, Gfx* dlist) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80977EA8(PlayState* play, Gfx* dlist) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -85,20 +85,20 @@ void func_80977EA8(GlobalContext* globalCtx, Gfx* dlist) { CLOSE_DISPS(gfxCtx); } -void func_80977F80(DemoGeff* this, GlobalContext* globalCtx) { +void func_80977F80(DemoGeff* this, PlayState* play) { s32 pad[2]; s32 objBankIndex = this->objBankIndex; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); CLOSE_DISPS(gfxCtx); } -void func_80978030(DemoGeff* this, GlobalContext* globalCtx) { +void func_80978030(DemoGeff* this, PlayState* play) { Vec3f* thisScale = &this->actor.scale; this->action = 1; @@ -127,12 +127,12 @@ void func_80978030(DemoGeff* this, GlobalContext* globalCtx) { } } -void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) { +void func_809781FC(DemoGeff* this, PlayState* play) { s32 targetParams = 2; Actor* propIt; if (this->demoGt == NULL) { - propIt = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + propIt = play->actorCtx.actorLists[ACTORCAT_PROP].head; if ((this->actor.params != 0) && (this->actor.params != 1) && (this->actor.params != 2)) { targetParams = 2; } else { @@ -150,7 +150,7 @@ void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) { } } -void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) { +void func_809782A0(DemoGeff* this, PlayState* play) { DemoGt* demoGt = this->demoGt; s16 params = this->actor.params; @@ -161,17 +161,17 @@ void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) { } } -void func_80978308(DemoGeff* this, GlobalContext* globalCtx) { - func_809781FC(this, globalCtx); - func_809782A0(this, globalCtx); - func_80978030(this, globalCtx); +void func_80978308(DemoGeff* this, PlayState* play) { + func_809781FC(this, play); + func_809782A0(this, play); + func_80978030(this, play); } -void func_80978344(DemoGeff* this, GlobalContext* globalCtx) { - func_80977EA8(globalCtx, gGanonRubbleDL); +void func_80978344(DemoGeff* this, PlayState* play) { + func_80977EA8(play, gGanonRubbleDL); } -void func_80978370(DemoGeff* this, GlobalContext* globalCtx) { +void func_80978370(DemoGeff* this, PlayState* play) { s16 params = this->actor.params; DemoGeffInitFunc initFunc = sInitFuncs[params]; if (initFunc == NULL) { @@ -179,11 +179,11 @@ void func_80978370(DemoGeff* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - initFunc(this, globalCtx); + initFunc(this, play); } -void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) { - ObjectContext* objCtx = &globalCtx->objectCtx; +void func_809783D4(DemoGeff* this, PlayState* play) { + ObjectContext* objCtx = &play->objectCtx; Actor* thisx = &this->actor; s32 params = thisx->params; s16 objectId = sObjectIDs[params]; @@ -197,24 +197,24 @@ void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) { } if (Object_IsLoaded(objCtx, objBankIndex)) { this->objBankIndex = objBankIndex; - func_80978370(this, globalCtx); + func_80978370(this, play); } } -void DemoGeff_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Update(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; if (this->action < 0 || this->action >= 2 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void func_809784D4(DemoGeff* this, GlobalContext* globalCtx) { +void func_809784D4(DemoGeff* this, PlayState* play) { } -void DemoGeff_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Draw(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; s32 drawConfig = this->drawConfig; @@ -223,7 +223,7 @@ void DemoGeff_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } if (drawConfig != 0) { - func_80977F80(this, globalCtx); + func_80977F80(this, play); } - sDrawFuncs[drawConfig](this, globalCtx); + sDrawFuncs[drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h b/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h index a16705a83..a21eb64a2 100644 --- a/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h +++ b/soh/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h @@ -8,9 +8,9 @@ struct DemoGeff; -typedef void (*DemoGeffInitFunc)(struct DemoGeff*, GlobalContext*); -typedef void (*DemoGeffActionFunc)(struct DemoGeff*, GlobalContext*); -typedef void (*DemoGeffDrawFunc)(struct DemoGeff*, GlobalContext*); +typedef void (*DemoGeffInitFunc)(struct DemoGeff*, PlayState*); +typedef void (*DemoGeffActionFunc)(struct DemoGeff*, PlayState*); +typedef void (*DemoGeffDrawFunc)(struct DemoGeff*, PlayState*); typedef struct DemoGeff { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/soh/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 12911e81c..6159f3b20 100644 --- a/soh/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/soh/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -11,10 +11,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoGj_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGj_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGj_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGj_Init(Actor* thisx, PlayState* play); +void DemoGj_Destroy(Actor* thisx, PlayState* play); +void DemoGj_Update(Actor* thisx, PlayState* play); +void DemoGj_Draw(Actor* thisx, PlayState* play); static ColliderCylinderInitType1 sCylinderInit1 = { { @@ -73,8 +73,8 @@ static ColliderCylinderInitType1 sCylinderInit3 = { { 25, 200, 0, { 0, 0, 0 } }, }; -typedef void (*DemoGjUpdateFunc)(DemoGj*, GlobalContext*); -typedef void (*DemoGjDrawFunc)(DemoGj*, GlobalContext*); +typedef void (*DemoGjUpdateFunc)(DemoGj*, PlayState*); +typedef void (*DemoGjDrawFunc)(DemoGj*, PlayState*); // bits 11-15 s32 DemoGj_GetCollectibleType(DemoGj* this) { @@ -97,72 +97,72 @@ s32 DemoGj_GetType(DemoGj* this) { return params & 0xFF; } -void DemoGj_InitCylinder(DemoGj* this, GlobalContext* globalCtx, ColliderCylinder* cylinder, +void DemoGj_InitCylinder(DemoGj* this, PlayState* play, ColliderCylinder* cylinder, ColliderCylinderInitType1* cylinderInit) { - Collider_InitCylinder(globalCtx, cylinder); - Collider_SetCylinderType1(globalCtx, cylinder, &this->dyna.actor, cylinderInit); + Collider_InitCylinder(play, cylinder); + Collider_SetCylinderType1(play, cylinder, &this->dyna.actor, cylinderInit); } -s32 DemoGj_HitByExplosion(DemoGj* this, GlobalContext* globalCtx, ColliderCylinder* cylinder) { - if (Actor_GetCollidedExplosive(globalCtx, &cylinder->base) != NULL) { +s32 DemoGj_HitByExplosion(DemoGj* this, PlayState* play, ColliderCylinder* cylinder) { + if (Actor_GetCollidedExplosive(play, &cylinder->base) != NULL) { return true; } return false; } -void DemoGj_DestroyCylinder(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DestroyCylinder(DemoGj* this, PlayState* play) { switch (DemoGj_GetType(this)) { case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1: - Collider_DestroyCylinder(globalCtx, &this->cylinders[0]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[1]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[2]); + Collider_DestroyCylinder(play, &this->cylinders[0]); + Collider_DestroyCylinder(play, &this->cylinders[1]); + Collider_DestroyCylinder(play, &this->cylinders[2]); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2: - Collider_DestroyCylinder(globalCtx, &this->cylinders[0]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[1]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[2]); + Collider_DestroyCylinder(play, &this->cylinders[0]); + Collider_DestroyCylinder(play, &this->cylinders[1]); + Collider_DestroyCylinder(play, &this->cylinders[2]); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL: - Collider_DestroyCylinder(globalCtx, &this->cylinders[0]); + Collider_DestroyCylinder(play, &this->cylinders[0]); break; } } -void DemoGj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Destroy(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; - DemoGj_DestroyCylinder(this, globalCtx); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DemoGj_DestroyCylinder(this, play); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void DemoGj_PlayExplosionSfx(DemoGj* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 50, NA_SE_EV_GRAVE_EXPLOSION); +void DemoGj_PlayExplosionSfx(DemoGj* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 50, NA_SE_EV_GRAVE_EXPLOSION); } -void DemoGj_SpawnSmoke(GlobalContext* globalCtx, Vec3f* pos, f32 arg2) { +void DemoGj_SpawnSmoke(PlayState* play, Vec3f* pos, f32 arg2) { static Vec3f velocity = { 0.0f, 6.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 0, 0, 0, 0 }; static Color_RGBA8 envColor = { 0, 0, 0, 0 }; f32 temp = arg2 * 0.2f; - func_800283D4(globalCtx, pos, &velocity, &accel, &primColor, &envColor, temp * Rand_ZeroOne() + arg2, 15, 90); + func_800283D4(play, pos, &velocity, &accel, &primColor, &envColor, temp * Rand_ZeroOne() + arg2, 15, 90); } -void DemoGj_DropCollectible(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DropCollectible(DemoGj* this, PlayState* play) { Vec3f* pos = &this->dyna.actor.world.pos; s16 collectible = DemoGj_GetCollectibleType(this); s32 amount = DemoGj_GetCollectibleAmount(this); s32 i; for (i = 0; i < amount; i++) { - Item_DropCollectible(globalCtx, pos, collectible); + Item_DropCollectible(play, pos, collectible); } } -void DemoGj_Explode(DemoGj* this, GlobalContext* globalCtx, Vec3f* initialPos, Vec3f* direction) { +void DemoGj_Explode(DemoGj* this, PlayState* play, Vec3f* initialPos, Vec3f* direction) { Vec3f explosionPos; Vec3f velocity; s32 phi_s0; @@ -194,14 +194,14 @@ void DemoGj_Explode(DemoGj* this, GlobalContext* globalCtx, Vec3f* initialPos, V Gfx* gfx = ResourceMgr_LoadGfxByName(gGanonRubbleDL); - EffectSsKakera_Spawn(globalCtx, &explosionPos, &velocity, initialPos, -200, phi_s0, 10, 10, 0, + EffectSsKakera_Spawn(play, &explosionPos, &velocity, initialPos, -200, phi_s0, 10, 10, 0, Rand_ZeroOne() * 20.0f + 20.0f, 20, 300, (s32)(Rand_ZeroOne() * 30.0f) + 30, -1, OBJECT_GEFF, gfx); theta += 0x2AAA; } - DemoGj_PlayExplosionSfx(this, globalCtx); + DemoGj_PlayExplosionSfx(this, play); } s32 DemoGj_IsSceneInvalid(void) { @@ -211,11 +211,11 @@ s32 DemoGj_IsSceneInvalid(void) { return true; } -s32 DemoGj_FindGanon(DemoGj* this, GlobalContext* globalCtx) { +s32 DemoGj_FindGanon(DemoGj* this, PlayState* play) { Actor* actor; if (this->ganon == NULL) { - actor = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; + actor = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actor != NULL) { if (actor->id == ACTOR_BOSS_GANON2) { @@ -239,7 +239,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void DemoGj_InitCommon(DemoGj* this, GlobalContext* globalCtx, CollisionHeader* header) { +void DemoGj_InitCommon(DemoGj* this, PlayState* play, CollisionHeader* header) { s32 pad[3]; CollisionHeader* newHeader; @@ -248,26 +248,26 @@ void DemoGj_InitCommon(DemoGj* this, GlobalContext* globalCtx, CollisionHeader* DynaPolyActor_Init(&this->dyna, DPM_UNK); newHeader = NULL; CollisionHeader_GetVirtual(header, &newHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, newHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, newHeader); } } // TODO: find a better name -s32 DemoGj_InitSetIndexes(DemoGj* this, GlobalContext* globalCtx, s32 updateMode, s32 drawConfig, +s32 DemoGj_InitSetIndexes(DemoGj* this, PlayState* play, s32 updateMode, s32 drawConfig, CollisionHeader* header) { if (!DemoGj_IsSceneInvalid()) { this->updateMode = updateMode; this->drawConfig = drawConfig; - DemoGj_InitCommon(this, globalCtx, header); + DemoGj_InitCommon(this, play, header); return true; } Actor_Kill(&this->dyna.actor); return false; } -void DemoGj_DrawCommon(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList) { +void DemoGj_DrawCommon(DemoGj* this, PlayState* play, Gfx* displayList) { if (kREG(0) == 0) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -283,7 +283,7 @@ void DemoGj_DrawCommon(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList) } } -void DemoGj_DrawRotated(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList) { +void DemoGj_DrawRotated(DemoGj* this, PlayState* play, Gfx* displayList) { s32 pad; GraphicsContext* gfxCtx; s16 x = this->rotationVec.x; @@ -292,7 +292,7 @@ void DemoGj_DrawRotated(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList s32 pad2; Mtx* matrix; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); OPEN_DISPS(gfxCtx); @@ -311,7 +311,7 @@ void DemoGj_DrawRotated(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList CLOSE_DISPS(gfxCtx); } -void DemoGj_SetupRotation(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetupRotation(DemoGj* this, PlayState* play) { f32 yPosition = this->dyna.actor.world.pos.y; f32* yVelocity = &this->dyna.actor.velocity.y; f32* speedXZ = &this->dyna.actor.speedXZ; @@ -446,16 +446,16 @@ s32 func_809797E4(DemoGj* this, u8 arg1) { return false; } -s32 DemoGj_IsGanondorfRisingFromRubble(DemoGj* this, GlobalContext* globalCtx) { +s32 DemoGj_IsGanondorfRisingFromRubble(DemoGj* this, PlayState* play) { return func_809797E4(this, 1); } // Ganondorf has stopped rising into the air and is just floating. Just before he transforms. -s32 DemoGj_IsGanondorfFloatingInAir(DemoGj* this, GlobalContext* globalCtx) { +s32 DemoGj_IsGanondorfFloatingInAir(DemoGj* this, PlayState* play) { return func_809797E4(this, 2); } -void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetupMovement(DemoGj* this, PlayState* play) { Actor* actor = &this->dyna.actor; Player* player; Vec3f* pos = &actor->world.pos; @@ -547,7 +547,7 @@ void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) { } if (xDistance == 0.0f && zDistance == 0.0f) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); xDistance = player->actor.world.pos.x - pos->x; zDistance = player->actor.world.pos.z - pos->z; @@ -566,422 +566,422 @@ void DemoGj_CheckIfTransformedIntoGanon(DemoGj* this) { } } -void DemoGj_InitRubblePile1(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 1, 2, &gGanonsCastleRubble2Col); +void DemoGj_InitRubblePile1(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 1, 2, &gGanonsCastleRubble2Col); } -void func_8097A000(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A000(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(18)); this->rotationVec.y += (s16)(kREG(19) + 1000); this->rotationVec.z += (s16)(kREG(20) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void DemoGj_SpawnSmokePreBattle1(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SpawnSmokePreBattle1(DemoGj* this, PlayState* play) { static Vec3f pos = { -371.0f, 1188.0f, -303.0f }; u32 gameplayFrames; if (!this->isTransformedIntoGanon) { - gameplayFrames = globalCtx->gameplayFrames % 3; + gameplayFrames = play->gameplayFrames % 3; if (gameplayFrames == 0) { - if (!globalCtx->gameplayFrames) {} - DemoGj_SpawnSmoke(globalCtx, &pos, 300.0f); + if (!play->gameplayFrames) {} + DemoGj_SpawnSmoke(play, &pos, 300.0f); } DemoGj_CheckIfTransformedIntoGanon(this); } } -void func_8097A0E4(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A0E4(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 8; this->drawConfig = 9; } } -void func_8097A130(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A130(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A160 -void DemoGj_Update01(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A0E4(this, globalCtx); +void DemoGj_Update01(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A0E4(this, play); } // func_8097A190 -void DemoGj_Update08(DemoGj* this, GlobalContext* globalCtx) { - func_8097A000(this, globalCtx); - func_8097A130(this, globalCtx); +void DemoGj_Update08(DemoGj* this, PlayState* play) { + func_8097A000(this, play); + func_8097A130(this, play); } -void DemoGj_DrawRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble2DL); +void DemoGj_DrawRubble2(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble2DL); } -void DemoGj_DrawRotatedRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble2DL); +void DemoGj_DrawRotatedRubble2(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble2DL); } -void DemoGj_InitRubblePile2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 2, 3, &gGanonsCastleRubble3Col); +void DemoGj_InitRubblePile2(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 2, 3, &gGanonsCastleRubble3Col); } -void func_8097A238(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A238(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(31)); this->rotationVec.y += (s16)(kREG(32) + 1000); this->rotationVec.z += (s16)(kREG(33) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void DemoGj_SpawnSmokePreBattle2(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SpawnSmokePreBattle2(DemoGj* this, PlayState* play) { static Vec3f pos = { -119.0f, 1056.0f, -147.0f }; u32 gameplayFrames; if (!this->isTransformedIntoGanon) { - gameplayFrames = globalCtx->gameplayFrames % 3; + gameplayFrames = play->gameplayFrames % 3; if (gameplayFrames == 1) { - if (!globalCtx->gameplayFrames) {} - DemoGj_SpawnSmoke(globalCtx, &pos, 300.0f); + if (!play->gameplayFrames) {} + DemoGj_SpawnSmoke(play, &pos, 300.0f); } DemoGj_CheckIfTransformedIntoGanon(this); } } -void func_8097A320(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A320(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 9; this->drawConfig = 10; } } -void func_8097A36C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A36C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A39C -void DemoGj_Update02(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A320(this, globalCtx); +void DemoGj_Update02(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A320(this, play); } // func_8097A3CC -void DemoGj_Update09(DemoGj* this, GlobalContext* globalCtx) { - func_8097A238(this, globalCtx); - func_8097A36C(this, globalCtx); +void DemoGj_Update09(DemoGj* this, PlayState* play) { + func_8097A238(this, play); + func_8097A36C(this, play); } -void DemoGj_DrawRubble3(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble3DL); +void DemoGj_DrawRubble3(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble3DL); } -void DemoGj_DrawRotatedRubble3(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble3DL); +void DemoGj_DrawRotatedRubble3(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble3DL); } -void DemoGj_InitRubblePile3(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 3, 4, &gGanonsCastleRubble4Col); +void DemoGj_InitRubblePile3(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 3, 4, &gGanonsCastleRubble4Col); } -void func_8097A474(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A474(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(44)); this->rotationVec.y += (s16)(kREG(45) + 1000); this->rotationVec.z += (s16)(kREG(46) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097A4F0(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A4F0(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 10; this->drawConfig = 11; } } -void func_8097A53C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A53C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A56C -void DemoGj_Update03(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A4F0(this, globalCtx); +void DemoGj_Update03(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A4F0(this, play); } // func_8097A59C -void DemoGj_Update10(DemoGj* this, GlobalContext* globalCtx) { - func_8097A474(this, globalCtx); - func_8097A53C(this, globalCtx); +void DemoGj_Update10(DemoGj* this, PlayState* play) { + func_8097A474(this, play); + func_8097A53C(this, play); } -void DemoGj_DrawRubble4(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble4DL); +void DemoGj_DrawRubble4(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble4DL); } -void DemoGj_DrawRotatedRubble4(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble4DL); +void DemoGj_DrawRotatedRubble4(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble4DL); } -void DemoGj_InitRubblePile4(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 4, 5, &gGanonsCastleRubble5Col); +void DemoGj_InitRubblePile4(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 4, 5, &gGanonsCastleRubble5Col); } -void func_8097A644(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A644(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(57)); this->rotationVec.y += (s16)(kREG(58) + 1000); this->rotationVec.z += (s16)(kREG(59) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097A6C0(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A6C0(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 11; this->drawConfig = 12; } } -void func_8097A70C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A70C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A73C -void DemoGj_Update04(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A6C0(this, globalCtx); +void DemoGj_Update04(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A6C0(this, play); } // func_8097A76C -void DemoGj_Update11(DemoGj* this, GlobalContext* globalCtx) { - func_8097A644(this, globalCtx); - func_8097A70C(this, globalCtx); +void DemoGj_Update11(DemoGj* this, PlayState* play) { + func_8097A644(this, play); + func_8097A70C(this, play); } -void DemoGj_DrawRubble5(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble5DL); +void DemoGj_DrawRubble5(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble5DL); } -void DemoGj_DrawRotatedRubble5(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble5DL); +void DemoGj_DrawRotatedRubble5(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble5DL); } -void DemoGj_InitRubblePile5(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 5, 6, &gGanonsCastleRubble6Col); +void DemoGj_InitRubblePile5(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 5, 6, &gGanonsCastleRubble6Col); } -void func_8097A814(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A814(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(70)); this->rotationVec.y += (s16)(kREG(71) + 1000); this->rotationVec.z += (s16)(kREG(72) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097A890(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A890(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 12; this->drawConfig = 13; } } -void func_8097A8DC(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A8DC(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A90C -void DemoGj_Update05(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A890(this, globalCtx); +void DemoGj_Update05(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A890(this, play); } // func_8097A93C -void DemoGj_Update12(DemoGj* this, GlobalContext* globalCtx) { - func_8097A814(this, globalCtx); - func_8097A8DC(this, globalCtx); +void DemoGj_Update12(DemoGj* this, PlayState* play) { + func_8097A814(this, play); + func_8097A8DC(this, play); } -void DemoGj_DrawRubble6(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble6DL); +void DemoGj_DrawRubble6(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble6DL); } -void DemoGj_DrawRotatedRubble6(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble6DL); +void DemoGj_DrawRotatedRubble6(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble6DL); } -void DemoGj_InitRubblePile6(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 6, 7, &gGanonsCastleRubble7Col); +void DemoGj_InitRubblePile6(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 6, 7, &gGanonsCastleRubble7Col); } -void func_8097A9E4(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A9E4(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(83)); this->rotationVec.y += (s16)(kREG(84) + 1000); this->rotationVec.z += (s16)(kREG(85) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097AA60(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097AA60(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 13; this->drawConfig = 14; } } -void func_8097AAAC(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097AAAC(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097AADC -void DemoGj_Update06(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097AA60(this, globalCtx); +void DemoGj_Update06(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097AA60(this, play); } // func_8097AB0C -void DemoGj_Update13(DemoGj* this, GlobalContext* globalCtx) { - func_8097A9E4(this, globalCtx); - func_8097AAAC(this, globalCtx); +void DemoGj_Update13(DemoGj* this, PlayState* play) { + func_8097A9E4(this, play); + func_8097AAAC(this, play); } -void DemoGj_DrawRubble7(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble7DL); +void DemoGj_DrawRubble7(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble7DL); } -void DemoGj_DrawRotatedRubble7(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble7DL); +void DemoGj_DrawRotatedRubble7(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble7DL); } -void DemoGj_InitRubblePile7(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 7, 8, &gGanonsCastleRubbleTallCol); +void DemoGj_InitRubblePile7(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 7, 8, &gGanonsCastleRubbleTallCol); } -void func_8097ABB4(DemoGj* this, GlobalContext* globalCtx) { +void func_8097ABB4(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(15)); this->rotationVec.y += (s16)(kREG(14) + 1000); this->rotationVec.z += (s16)(kREG(13) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void DemoGj_SpawnSmokePreBattle3(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SpawnSmokePreBattle3(DemoGj* this, PlayState* play) { static Vec3f pos = { -6.0f, 1053.0f, -473.0f }; u32 gameplayFrames; if (!this->isTransformedIntoGanon) { - gameplayFrames = globalCtx->gameplayFrames % 3; + gameplayFrames = play->gameplayFrames % 3; if (gameplayFrames == 2) { - if (!globalCtx->gameplayFrames) {} - DemoGj_SpawnSmoke(globalCtx, &pos, 300.0f); + if (!play->gameplayFrames) {} + DemoGj_SpawnSmoke(play, &pos, 300.0f); } DemoGj_CheckIfTransformedIntoGanon(this); } } -void func_8097AC9C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097AC9C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 14; this->drawConfig = 15; } } -void func_8097ACE8(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097ACE8(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097AD18 -void DemoGj_Update07(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097AC9C(this, globalCtx); +void DemoGj_Update07(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097AC9C(this, play); } // func_8097AD48 -void DemoGj_Update14(DemoGj* this, GlobalContext* globalCtx) { - func_8097ABB4(this, globalCtx); - func_8097ACE8(this, globalCtx); +void DemoGj_Update14(DemoGj* this, PlayState* play) { + func_8097ABB4(this, play); + func_8097ACE8(this, play); } -void DemoGj_DrawRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubbleTallDL); +void DemoGj_DrawRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubbleTallDL); } -void DemoGj_DrawRotatedRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubbleTallDL); +void DemoGj_DrawRotatedRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubbleTallDL); } -void DemoGj_InitRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 0, 1, &gGanonsCastleRubbleAroundArenaCol); +void DemoGj_InitRubbleAroundArena(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 0, 1, &gGanonsCastleRubbleAroundArenaCol); } // func_8097ADF0 -void DemoGj_UpdateRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - DemoGj_SpawnSmokePreBattle1(this, globalCtx); - DemoGj_SpawnSmokePreBattle2(this, globalCtx); - DemoGj_SpawnSmokePreBattle3(this, globalCtx); +void DemoGj_UpdateRubbleAroundArena(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + DemoGj_SpawnSmokePreBattle1(this, play); + DemoGj_SpawnSmokePreBattle2(this, play); + DemoGj_SpawnSmokePreBattle3(this, play); } -void DemoGj_DrawRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubbleAroundArenaDL); +void DemoGj_DrawRubbleAroundArena(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubbleAroundArenaDL); } // Inits the three cylinders with `sCylinderInit1` -void DemoGj_InitDestructableRubble1(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 15, 0, NULL); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit1); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[1], &sCylinderInit1); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[2], &sCylinderInit1); +void DemoGj_InitDestructableRubble1(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 15, 0, NULL); + DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit1); + DemoGj_InitCylinder(this, play, &this->cylinders[1], &sCylinderInit1); + DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit1); } -void DemoGj_DoNothing1(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DoNothing1(DemoGj* this, PlayState* play) { } /* * Moves the ColliderCylinder's relative to the actor's position. * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1 */ -void func_8097AEE8(DemoGj* this, GlobalContext* globalCtx) { +void func_8097AEE8(DemoGj* this, PlayState* play) { ColliderCylinder* cylinder0 = &this->cylinders[0]; ColliderCylinder* cylinder1 = &this->cylinders[1]; ColliderCylinder* cylinder2 = &this->cylinders[2]; @@ -1004,33 +1004,33 @@ void func_8097AEE8(DemoGj* this, GlobalContext* globalCtx) { cylinder2->dim.pos.y = actorPos->y; } -void DemoGj_SetCylindersAsAC(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetCylindersAsAC(DemoGj* this, PlayState* play) { s32 pad[2]; Collider* cylinder0 = &this->cylinders[0].base; Collider* cylinder1 = &this->cylinders[1].base; Collider* cylinder2 = &this->cylinders[2].base; s32 pad2[3]; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder0); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder1); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder2); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder0); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder1); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder2); } -void DemoGj_DirectedExplosion(DemoGj* this, GlobalContext* globalCtx, Vec3f* direction) { +void DemoGj_DirectedExplosion(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); } -void func_8097B128(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097B128(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Vec3f* scale = &this->dyna.actor.scale; - DemoGj_InitCommon(this, globalCtx, &gGanonsCastleRubble2Col); + DemoGj_InitCommon(this, play, &gGanonsCastleRubble2Col); this->updateMode = 18; this->drawConfig = 16; scale->x *= 0.8f; @@ -1039,14 +1039,14 @@ void func_8097B128(DemoGj* this, GlobalContext* globalCtx) { } } -s32 DemoGj_HasCylinderAnyExploded(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[0])) { +s32 DemoGj_HasCylinderAnyExploded(DemoGj* this, PlayState* play) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[0])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[1])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[1])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[2])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[2])) { return true; } return false; @@ -1057,61 +1057,61 @@ s32 DemoGj_HasCylinderAnyExploded(DemoGj* this, GlobalContext* globalCtx) { * Kills the actor if ganon->unk_314==4 (Ganon killed), this rubble was hit by an explosion or killFlag==true * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1 */ -void func_8097B22C(DemoGj* this, GlobalContext* globalCtx) { +void func_8097B22C(DemoGj* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (func_809797E4(this, 4)) { Actor_Kill(thisx); - } else if (DemoGj_HasCylinderAnyExploded(this, globalCtx)) { + } else if (DemoGj_HasCylinderAnyExploded(this, play)) { Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion(this, globalCtx, &vec1); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion(this, play, &vec1); Actor_Kill(thisx); } else if (this->killFlag) { Vec3f vec2 = this->unk_26C; vec2.y = 0.0f; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion(this, globalCtx, &vec2); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion(this, play, &vec2); Actor_Kill(thisx); } - func_8097AEE8(this, globalCtx); - DemoGj_SetCylindersAsAC(this, globalCtx); + func_8097AEE8(this, play); + DemoGj_SetCylindersAsAC(this, play); } // func_8097B340 -void DemoGj_Update15(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097B128(this, globalCtx); +void DemoGj_Update15(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097B128(this, play); } // func_8097B370 -void DemoGj_Update18(DemoGj* this, GlobalContext* globalCtx) { - func_8097B22C(this, globalCtx); - DemoGj_DoNothing1(this, globalCtx); +void DemoGj_Update18(DemoGj* this, PlayState* play) { + func_8097B22C(this, play); + DemoGj_DoNothing1(this, play); } -void DemoGj_DrawDestructableRubble1(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble2DL); +void DemoGj_DrawDestructableRubble1(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble2DL); } // Inits the three cylinders with `sCylinderInit2` -void DemoGj_InitDestructableRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 16, 0, NULL); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit2); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[1], &sCylinderInit2); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[2], &sCylinderInit2); +void DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 16, 0, NULL); + DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit2); + DemoGj_InitCylinder(this, play, &this->cylinders[1], &sCylinderInit2); + DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit2); } -void DemoGj_DoNothing2(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DoNothing2(DemoGj* this, PlayState* play) { } // Moves the ColliderCylinder's relative to the actor's position. -void func_8097B450(DemoGj* this, GlobalContext* globalCtx) { +void func_8097B450(DemoGj* this, PlayState* play) { ColliderCylinder* cylinder0 = &this->cylinders[0]; ColliderCylinder* cylinder1 = &this->cylinders[1]; ColliderCylinder* cylinder2 = &this->cylinders[2]; @@ -1134,47 +1134,47 @@ void func_8097B450(DemoGj* this, GlobalContext* globalCtx) { cylinder2->dim.pos.y = actorPos->y; } -void DemoGj_SetCylindersAsAC2(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetCylindersAsAC2(DemoGj* this, PlayState* play) { s32 pad[2]; Collider* cylinder0 = &this->cylinders[0].base; Collider* cylinder1 = &this->cylinders[1].base; Collider* cylinder2 = &this->cylinders[2].base; s32 pad2[3]; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder0); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder1); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder2); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder0); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder1); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder2); } // Does the same as `DemoGj_HasCylinderAnyExploded` -s32 DemoGj_HasCylinderAnyExploded2(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[0])) { +s32 DemoGj_HasCylinderAnyExploded2(DemoGj* this, PlayState* play) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[0])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[1])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[1])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[2])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[2])) { return true; } return false; } -void DemoGj_DirectedExplosion2(DemoGj* this, GlobalContext* globalCtx, Vec3f* direction) { +void DemoGj_DirectedExplosion2(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); } -void func_8097B6C4(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097B6C4(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Vec3f* scale = &this->dyna.actor.scale; - DemoGj_InitCommon(this, globalCtx, &gGanonsCastleRubble3Col); + DemoGj_InitCommon(this, play, &gGanonsCastleRubble3Col); this->updateMode = 19; this->drawConfig = 17; scale->x *= 0.8f; @@ -1188,76 +1188,76 @@ void func_8097B6C4(DemoGj* this, GlobalContext* globalCtx) { * Kills the actor if ganon->unk_314==4 (Ganon killed), this rubble was hit by an explosion or killFlag==true * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2 */ -void func_8097B750(DemoGj* this, GlobalContext* globalCtx) { +void func_8097B750(DemoGj* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (func_809797E4(this, 4)) { Actor_Kill(thisx); - } else if (DemoGj_HasCylinderAnyExploded2(this, globalCtx)) { + } else if (DemoGj_HasCylinderAnyExploded2(this, play)) { Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion2(this, globalCtx, &vec1); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion2(this, play, &vec1); Actor_Kill(thisx); } else if (this->killFlag) { Vec3f vec2 = this->unk_26C; vec2.y = 0.0f; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion2(this, globalCtx, &vec2); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion2(this, play, &vec2); Actor_Kill(thisx); } - func_8097B450(this, globalCtx); - DemoGj_SetCylindersAsAC2(this, globalCtx); + func_8097B450(this, play); + DemoGj_SetCylindersAsAC2(this, play); } // func_8097B864 -void DemoGj_Update16(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097B6C4(this, globalCtx); +void DemoGj_Update16(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097B6C4(this, play); } // func_8097B894 -void DemoGj_Update19(DemoGj* this, GlobalContext* globalCtx) { - func_8097B750(this, globalCtx); - DemoGj_DoNothing2(this, globalCtx); +void DemoGj_Update19(DemoGj* this, PlayState* play) { + func_8097B750(this, play); + DemoGj_DoNothing2(this, play); } -void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble3DL); +void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble3DL); } // Inits the first cylinder (only that one) with `sCylinderInit3` -void DemoGj_InitDestructableRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndexes(this, globalCtx, 17, 0, NULL); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit3); +void DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndexes(this, play, 17, 0, NULL); + DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit3); } -void DemoGj_DoNothing3(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DoNothing3(DemoGj* this, PlayState* play) { } -void DemoGj_DirectedDoubleExplosion(DemoGj* this, GlobalContext* globalCtx, Vec3f* direction) { +void DemoGj_DirectedDoubleExplosion(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 100.0f; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); } -void func_8097B9BC(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097B9BC(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Vec3f* scale = &this->dyna.actor.scale; - DemoGj_InitCommon(this, globalCtx, &gGanonsCastleRubbleTallCol); + DemoGj_InitCommon(this, play, &gGanonsCastleRubbleTallCol); this->updateMode = 20; this->drawConfig = 18; scale->x *= 0.8f; @@ -1271,48 +1271,48 @@ void func_8097B9BC(DemoGj* this, GlobalContext* globalCtx) { * Kills the actor if ganon->unk_314==4 (Ganon killed), this rubble was hit by an explosion or killFlag==true * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL */ -void func_8097BA48(DemoGj* this, GlobalContext* globalCtx) { +void func_8097BA48(DemoGj* this, PlayState* play) { Actor* thisx = &this->dyna.actor; ColliderCylinder* cylinder = &this->cylinders[0]; s32 pad[2]; if (func_809797E4(this, 4)) { Actor_Kill(thisx); - } else if (DemoGj_HitByExplosion(this, globalCtx, cylinder)) { + } else if (DemoGj_HitByExplosion(this, play, cylinder)) { Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedDoubleExplosion(this, globalCtx, &vec1); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedDoubleExplosion(this, play, &vec1); Actor_Kill(thisx); } else if (this->killFlag) { Vec3f vec2 = this->unk_26C; vec2.y = 0.0f; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedDoubleExplosion(this, globalCtx, &vec2); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedDoubleExplosion(this, play, &vec2); Actor_Kill(thisx); } Collider_UpdateCylinder(thisx, cylinder); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &cylinder->base); + CollisionCheck_SetAC(play, &play->colChkCtx, &cylinder->base); } // func_8097BB78 -void DemoGj_Update17(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097B9BC(this, globalCtx); +void DemoGj_Update17(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097B9BC(this, play); } // func_8097BBA8 -void DemoGj_Update20(DemoGj* this, GlobalContext* globalCtx) { - func_8097BA48(this, globalCtx); - DemoGj_DoNothing3(this, globalCtx); +void DemoGj_Update20(DemoGj* this, PlayState* play) { + func_8097BA48(this, play); + DemoGj_DoNothing3(this, play); } -void DemoGj_DemoGj_InitDestructableRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubbleTallDL); +void DemoGj_DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubbleTallDL); } static DemoGjUpdateFunc sUpdateFuncs[] = { @@ -1339,7 +1339,7 @@ static DemoGjUpdateFunc sUpdateFuncs[] = { DemoGj_Update20, }; -void DemoGj_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Update(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; if (this->updateMode < 0 || this->updateMode >= ARRAY_COUNT(sUpdateFuncs) || @@ -1349,66 +1349,66 @@ void DemoGj_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sUpdateFuncs[this->updateMode](this, globalCtx); + sUpdateFuncs[this->updateMode](this, play); } -void DemoGj_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Init(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; switch (DemoGj_GetType(this)) { case DEMOGJ_TYPE_AROUNDARENA: - DemoGj_InitRubbleAroundArena(this, globalCtx); + DemoGj_InitRubbleAroundArena(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_1: - DemoGj_InitRubblePile1(this, globalCtx); + DemoGj_InitRubblePile1(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_2: - DemoGj_InitRubblePile2(this, globalCtx); + DemoGj_InitRubblePile2(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_3: - DemoGj_InitRubblePile3(this, globalCtx); + DemoGj_InitRubblePile3(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_4: - DemoGj_InitRubblePile4(this, globalCtx); + DemoGj_InitRubblePile4(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_5: - DemoGj_InitRubblePile5(this, globalCtx); + DemoGj_InitRubblePile5(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_6: - DemoGj_InitRubblePile6(this, globalCtx); + DemoGj_InitRubblePile6(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_7: - DemoGj_InitRubblePile7(this, globalCtx); + DemoGj_InitRubblePile7(this, play); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1: - DemoGj_InitDestructableRubble1(this, globalCtx); + DemoGj_InitDestructableRubble1(this, play); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2: - DemoGj_InitDestructableRubble2(this, globalCtx); + DemoGj_InitDestructableRubble2(this, play); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL: - DemoGj_InitDestructableRubbleTall(this, globalCtx); + DemoGj_InitDestructableRubbleTall(this, play); break; default: // "Demo_Gj_Actor_ct There is no such argument!!!!!!!!!!!!!!!!!!!!!!" - osSyncPrintf(VT_FGCOL(RED) "Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST, globalCtx, + osSyncPrintf(VT_FGCOL(RED) "Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST, play, this); Actor_Kill(&this->dyna.actor); } } -void DemoGj_DrawNothing(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DrawNothing(DemoGj* this, PlayState* play) { } static DemoGjDrawFunc sDrawFuncs[] = { @@ -1433,7 +1433,7 @@ static DemoGjDrawFunc sDrawFuncs[] = { DemoGj_DemoGj_InitDestructableRubbleTall, }; -void DemoGj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Draw(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == NULL) { @@ -1442,7 +1442,7 @@ void DemoGj_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } const ActorInit Demo_Gj_InitVars = { diff --git a/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 44b108884..6828764a7 100644 --- a/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -10,21 +10,21 @@ #define FLAGS ACTOR_FLAG_4 -void DemoGo_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGo_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGo_Init(Actor* thisx, PlayState* play); +void DemoGo_Destroy(Actor* thisx, PlayState* play); +void DemoGo_Update(Actor* thisx, PlayState* play); +void DemoGo_Draw(Actor* thisx, PlayState* play); -void func_8097CE10(DemoGo* this, GlobalContext* globalCtx); -void func_8097CFDC(DemoGo* this, GlobalContext* globalCtx); -void func_8097CFFC(DemoGo* this, GlobalContext* globalCtx); -void func_8097D01C(DemoGo* this, GlobalContext* globalCtx); -void func_8097D058(DemoGo* this, GlobalContext* globalCtx); -void func_8097D088(DemoGo* this, GlobalContext* globalCtx); -void func_8097D0D0(DemoGo* this, GlobalContext* globalCtx); -void func_8097D130(DemoGo* this, GlobalContext* globalCtx); -void func_8097D290(DemoGo* this, GlobalContext* globalCtx); -void func_8097D29C(DemoGo* this, GlobalContext* globalCtx); +void func_8097CE10(DemoGo* this, PlayState* play); +void func_8097CFDC(DemoGo* this, PlayState* play); +void func_8097CFFC(DemoGo* this, PlayState* play); +void func_8097D01C(DemoGo* this, PlayState* play); +void func_8097D058(DemoGo* this, PlayState* play); +void func_8097D088(DemoGo* this, PlayState* play); +void func_8097D0D0(DemoGo* this, PlayState* play); +void func_8097D130(DemoGo* this, PlayState* play); +void func_8097D290(DemoGo* this, PlayState* play); +void func_8097D29C(DemoGo* this, PlayState* play); static void* sEyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; @@ -69,21 +69,21 @@ s32 func_8097C870(DemoGo* this) { return ret; } -void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) { +void func_8097C8A8(DemoGo* this, PlayState* play) { Actor* thisx = &this->actor; Vec3f sp20; f32 sp1C; if ((thisx->params == 0) || (thisx->params == 1)) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &thisx->world.pos, &sp20, &sp1C); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &sp20, 20, NA_SE_EV_OBJECT_FALL); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &thisx->world.pos, &sp20, &sp1C); + SoundSource_PlaySfxAtFixedWorldPos(play, &sp20, 20, NA_SE_EV_OBJECT_FALL); } } -void DemoGo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Destroy(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void func_8097C930(DemoGo* this) { @@ -112,28 +112,28 @@ void func_8097C9DC(DemoGo* this) { } } -void func_8097CA30(DemoGo* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void func_8097CA30(DemoGo* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } -void func_8097CA78(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CA78(DemoGo* this, PlayState* play) { s16 pad; Vec3f vec = this->actor.world.pos; - func_80033480(globalCtx, &vec, kREG(11) + 100.0f, kREG(12) + 0xA, kREG(13) + 0x12C, kREG(14), 0); + func_80033480(play, &vec, kREG(11) + 100.0f, kREG(12) + 0xA, kREG(13) + 0x12C, kREG(14), 0); func_8097C9B8(this); } -void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CB0C(DemoGo* this, PlayState* play) { Actor* thisx = &this->actor; PosRot* world = &thisx->world; - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* npcAction; f32 temp_ret; s32 pad; Vec3f startPos; Vec3f endPos; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { npcAction = csCtx->npcActions[func_8097C870(this)]; if (npcAction != NULL) { temp_ret = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, csCtx->frames); @@ -166,15 +166,15 @@ void func_8097CCC0(DemoGo* this) { Actor_MoveForward(&this->actor); } -void func_8097CCE0(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CCE0(DemoGo* this, PlayState* play) { CsCmdActorAction* npcAction; Actor* thisx = &this->actor; s32 rotYDelta; s32 newRotY; s32 thisRotY; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[func_8097C870(this)]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[func_8097C870(this)]; if (npcAction != NULL) { thisRotY = thisx->world.rot.y; rotYDelta = npcAction->rot.y - thisRotY; @@ -195,8 +195,8 @@ s32 DemoGo_UpdateSkelAnime(DemoGo* this) { return SkelAnime_Update(&this->skelAnime); } -s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 npcAction) { - CutsceneContext* csCtx = &globalCtx->csCtx; +s32 func_8097CDB0(DemoGo* this, PlayState* play, u16 npcAction) { + CutsceneContext* csCtx = &play->csCtx; s32 actionIdx = func_8097C870(this); if ((csCtx->state != CS_STATE_IDLE) && (csCtx->npcActions[actionIdx] != NULL) && @@ -206,39 +206,39 @@ s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 npcAction) { return 0; } -void func_8097CE10(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CE10(DemoGo* this, PlayState* play) { this->action = 1; } -void func_8097CE20(DemoGo* this, GlobalContext* globalCtx) { - if (func_8097CDB0(this, globalCtx, 2)) { +void func_8097CE20(DemoGo* this, PlayState* play) { + if (func_8097CDB0(this, play, 2)) { this->action = 2; this->drawConfig = 1; - func_8097CB0C(this, globalCtx); - func_8097C8A8(this, globalCtx); + func_8097CB0C(this, play); + func_8097C8A8(this, play); } } -void func_8097CE78(DemoGo* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_8097CE78(DemoGo* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { npcAction = csCtx->npcActions[func_8097C870(this)]; if (npcAction != NULL && csCtx->frames >= npcAction->endFrame) { - func_8097CA78(this, globalCtx); + func_8097CA78(this, play); this->action = 3; } } } -void func_8097CEEC(DemoGo* this, GlobalContext* globalCtx) { - if (func_8097CDB0(this, globalCtx, 3)) { +void func_8097CEEC(DemoGo* this, PlayState* play) { + if (func_8097CDB0(this, play, 3)) { this->action = 4; } } -void func_8097CF20(DemoGo* this, GlobalContext* globalCtx, s32 arg2) { +void func_8097CF20(DemoGo* this, PlayState* play, s32 arg2) { AnimationHeader* animation = &gGoronAnim_0029A8; if (arg2 != 0) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -255,100 +255,100 @@ void func_8097CF9C(DemoGo* this) { } } -void func_8097CFDC(DemoGo* this, GlobalContext* globalCtx) { - func_8097CE10(this, globalCtx); +void func_8097CFDC(DemoGo* this, PlayState* play) { + func_8097CE10(this, play); } -void func_8097CFFC(DemoGo* this, GlobalContext* globalCtx) { - func_8097CE20(this, globalCtx); +void func_8097CFFC(DemoGo* this, PlayState* play) { + func_8097CE20(this, play); } -void func_8097D01C(DemoGo* this, GlobalContext* globalCtx) { - func_8097CB0C(this, globalCtx); - func_8097CA30(this, globalCtx); - func_8097CE78(this, globalCtx); +void func_8097D01C(DemoGo* this, PlayState* play) { + func_8097CB0C(this, play); + func_8097CA30(this, play); + func_8097CE78(this, play); } -void func_8097D058(DemoGo* this, GlobalContext* globalCtx) { - func_8097CA30(this, globalCtx); - func_8097CEEC(this, globalCtx); +void func_8097D058(DemoGo* this, PlayState* play) { + func_8097CA30(this, play); + func_8097CEEC(this, play); } -void func_8097D088(DemoGo* this, GlobalContext* globalCtx) { +void func_8097D088(DemoGo* this, PlayState* play) { s32 something; - func_8097CA30(this, globalCtx); + func_8097CA30(this, play); something = DemoGo_UpdateSkelAnime(this); func_8097C930(this); - func_8097CF20(this, globalCtx, something); + func_8097CF20(this, play, something); } -void func_8097D0D0(DemoGo* this, GlobalContext* globalCtx) { - func_8097CCE0(this, globalCtx); +void func_8097D0D0(DemoGo* this, PlayState* play) { + func_8097CCE0(this, play); func_8097CCC0(this); - func_8097CA30(this, globalCtx); + func_8097CA30(this, play); DemoGo_UpdateSkelAnime(this); func_8097C930(this); func_8097C9DC(this); func_8097CF9C(this); } -void func_8097D130(DemoGo* this, GlobalContext* globalCtx) { - func_8097CCE0(this, globalCtx); +void func_8097D130(DemoGo* this, PlayState* play) { + func_8097CCE0(this, play); func_8097CC08(this); - func_8097CA30(this, globalCtx); + func_8097CA30(this, play); DemoGo_UpdateSkelAnime(this); func_8097C930(this); func_8097C9DC(this); } -void DemoGo_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Update(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; if (this->action < 0 || this->action >= 7 || D_8097D44C[this->action] == 0) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - D_8097D44C[this->action](this, globalCtx); + D_8097D44C[this->action](this, play); } -void DemoGo_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Init(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; AnimationHeader* animation = &gGoronAnim_004930; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); this->action = 0; } -void func_8097D290(DemoGo* this, GlobalContext* globalCtx) { +void func_8097D290(DemoGo* this, PlayState* play) { } -void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) { +void func_8097D29C(DemoGo* this, PlayState* play) { s32 pad; s16 eyeTexIdx = this->unk_190; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeTexIdx]; void* mouthTexture = gGoronCsMouthSmileTex; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Draw(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - D_8097D468[this->drawConfig](this, globalCtx); + D_8097D468[this->drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.h b/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.h index 688a8a99c..969fdd8e0 100644 --- a/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.h +++ b/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.h @@ -6,8 +6,8 @@ struct DemoGo; -typedef void (*DemoGoActionFunc)(struct DemoGo*, GlobalContext*); -typedef void (*DemoGoDrawFunc)(struct DemoGo*, GlobalContext*); +typedef void (*DemoGoActionFunc)(struct DemoGo*, PlayState*); +typedef void (*DemoGoDrawFunc)(struct DemoGo*, PlayState*); typedef struct DemoGo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index efcc8ecd6..41e5de0f4 100644 --- a/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -6,16 +6,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoGt_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGt_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGt_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGt_Init(Actor* thisx, PlayState* play); +void DemoGt_Destroy(Actor* thisx, PlayState* play); +void DemoGt_Update(Actor* thisx, PlayState* play); +void DemoGt_Draw(Actor* thisx, PlayState* play); -void DemoGt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Destroy(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; if ((this->dyna.actor.params == 1) || (this->dyna.actor.params == 2)) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -23,32 +23,32 @@ void DemoGt_PlayEarthquakeSfx() { func_800788CC(NA_SE_EV_EARTHQUAKE - SFX_FLAG); } -void DemoGt_PlayExplosion1Sfx(GlobalContext* globalCtx, Vec3f* pos) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, pos, 60, NA_SE_IT_BOMB_EXPLOSION); +void DemoGt_PlayExplosion1Sfx(PlayState* play, Vec3f* pos) { + SoundSource_PlaySfxAtFixedWorldPos(play, pos, 60, NA_SE_IT_BOMB_EXPLOSION); } -void DemoGt_PlayExplosion2Sfx(GlobalContext* globalCtx, Vec3f* pos) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, pos, 60, NA_SE_EV_GRAVE_EXPLOSION); +void DemoGt_PlayExplosion2Sfx(PlayState* play, Vec3f* pos) { + SoundSource_PlaySfxAtFixedWorldPos(play, pos, 60, NA_SE_EV_GRAVE_EXPLOSION); } -void DemoGt_Rumble(GlobalContext* globalCtx) { +void DemoGt_Rumble(PlayState* play) { func_800AA000(0.0f, 0x32, 0xA, 5); } -void DemoGt_SpawnDust(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 scaleStep, +void DemoGt_SpawnDust(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 scaleStep, s16 life) { static Color_RGBA8 brownPrim = { 100, 80, 100, 0 }; static Color_RGBA8 redEnv = { 255, 110, 96, 0 }; - func_8002843C(globalCtx, pos, velocity, accel, &brownPrim, &redEnv, ((Rand_ZeroOne() * (scale * 0.2f)) + scale), + func_8002843C(play, pos, velocity, accel, &brownPrim, &redEnv, ((Rand_ZeroOne() * (scale * 0.2f)) + scale), scaleStep, life); } -void func_8097D7D8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velOffset, f32 scale, s32 arg4, s32 arg5, s16 life) { +void func_8097D7D8(PlayState* play, Vec3f* pos, Vec3f* velOffset, f32 scale, s32 arg4, s32 arg5, s16 life) { s32 pad; - if (!FrameAdvance_IsEnabled(globalCtx)) { - s32 frames = globalCtx->gameplayFrames; + if (!FrameAdvance_IsEnabled(play)) { + s32 frames = play->gameplayFrames; if (ABS(frames % arg4) == arg5) { s32 pad[2]; @@ -67,30 +67,30 @@ void func_8097D7D8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velOffset, f32 s accel.y *= scale; accel.z *= scale; - DemoGt_SpawnDust(globalCtx, pos, &velocity, &accel, (300.0f * scale), (15.0f * scale), life); + DemoGt_SpawnDust(play, pos, &velocity, &accel, (300.0f * scale), (15.0f * scale), life); } } } -Actor* DemoGt_SpawnCloudRing(GlobalContext* globalCtx, Vec3f* pos, s16 params) { - return Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SPOT16_DOUGHNUT, pos->x, pos->y, pos->z, 0, 0, 0, +Actor* DemoGt_SpawnCloudRing(PlayState* play, Vec3f* pos, s16 params) { + return Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SPOT16_DOUGHNUT, pos->x, pos->y, pos->z, 0, 0, 0, params); } -void DemoGt_SpawnExplosionWithSound(GlobalContext* globalCtx, Vec3f* pos, f32 scale) { +void DemoGt_SpawnExplosionWithSound(PlayState* play, Vec3f* pos, f32 scale) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; - EffectSsBomb2_SpawnLayered(globalCtx, pos, &velocity, &accel, (100.0f * scale), (15.0f * scale)); - DemoGt_PlayExplosion1Sfx(globalCtx, pos); + EffectSsBomb2_SpawnLayered(play, pos, &velocity, &accel, (100.0f * scale), (15.0f * scale)); + DemoGt_PlayExplosion1Sfx(play, pos); } -void DemoGt_SpawnExplosionNoSound(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale) { - EffectSsBomb2_SpawnLayered(globalCtx, pos, velocity, accel, (100.0f * scale), (25.0f * scale)); +void DemoGt_SpawnExplosionNoSound(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale) { + EffectSsBomb2_SpawnLayered(play, pos, velocity, accel, (100.0f * scale), (25.0f * scale)); } -void func_8097DAC8(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { +void func_8097DAC8(DemoGt* this, PlayState* play, Vec3f* spawnerPos) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -124,14 +124,14 @@ void func_8097DAC8(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { phi_s0 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, (s32)(Rand_ZeroOne() * 10.0f + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 30, KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); angle += 0x1555; } } -void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { +void func_8097DD28(DemoGt* this, PlayState* play, Vec3f* spawnerPos) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -165,7 +165,7 @@ void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { phi_s0 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, (s32)((Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 0x1E, KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); @@ -173,7 +173,7 @@ void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { } } -void func_8097DF70(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { +void func_8097DF70(DemoGt* this, PlayState* play, Vec3f* spawnerPos) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -207,14 +207,14 @@ void func_8097DF70(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { phi_s0 = 33; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -200, phi_s0, 10, 10, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, spawnerPos, -200, phi_s0, 10, 10, 0, Rand_ZeroOne() * 30.0f + 30.0f, 2, 300, (s32)(Rand_ZeroOne() * 30.0f) + 30, KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); angle += 0x1555; } } -void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) { +void func_8097E1D4(PlayState* play, Vec3f* arg1, s16 arg2) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -248,7 +248,7 @@ void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) { phi_s0 = 33; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, arg1, -247, phi_s0, 3, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, arg1, -247, phi_s0, 3, 0, 0, (s32)((Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 30, KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); @@ -256,7 +256,7 @@ void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) { } } -void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* accel, f32 arg4, f32 scale, +void func_8097E454(PlayState* play, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* accel, f32 arg4, f32 scale, s32 arg6, s32 arg7, s16 life) { s32 pad2[3]; s16 increment; @@ -267,8 +267,8 @@ void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, f32 dustScale = 300.0f * scale; Vec3f pos; - if ((!FrameAdvance_IsEnabled(globalCtx)) && (arg7 > 0) && (arg6 > 0)) { - frames = (ABS((s32)globalCtx->gameplayFrames) % arg7); + if ((!FrameAdvance_IsEnabled(play)) && (arg7 > 0) && (arg6 > 0)) { + frames = (ABS((s32)play->gameplayFrames) % arg7); phi_s0 = 0x10000 * frames / arg6; increment = 0x10000 / arg6; @@ -278,10 +278,10 @@ void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, pos.y = spawnerPos->y; pos.z = (Math_CosS(phi_s0) * arg4) + spawnerPos->z; - DemoGt_SpawnDust(globalCtx, &pos, velocity, accel, dustScale, dustScaleStep, life); + DemoGt_SpawnDust(play, &pos, velocity, accel, dustScale, dustScaleStep, life); if (Rand_ZeroOne() <= 0.05f) { - func_8097E1D4(globalCtx, &pos, phi_s0); + func_8097E1D4(play, &pos, phi_s0); } phi_s0 += increment; @@ -289,27 +289,27 @@ void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, } } -u8 func_8097E69C(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +u8 func_8097E69C(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } else { return false; } } -CsCmdActorAction* DemoGt_GetNpcAction(GlobalContext* globalCtx, u32 actionIdx) { +CsCmdActorAction* DemoGt_GetNpcAction(PlayState* play, u32 actionIdx) { s32 pad[2]; CsCmdActorAction* ret = NULL; - if (!func_8097E69C(globalCtx)) { - ret = globalCtx->csCtx.npcActions[actionIdx]; + if (!func_8097E69C(play)) { + ret = play->csCtx.npcActions[actionIdx]; } return ret; } -u8 func_8097E704(GlobalContext* globalCtx, u16 arg1, s32 arg2) { - CsCmdActorAction* action = DemoGt_GetNpcAction(globalCtx, arg2); +u8 func_8097E704(PlayState* play, u16 arg1, s32 arg2) { + CsCmdActorAction* action = DemoGt_GetNpcAction(play, arg2); if ((action != NULL) && (action->action == arg1)) { return true; @@ -318,8 +318,8 @@ u8 func_8097E704(GlobalContext* globalCtx, u16 arg1, s32 arg2) { } } -void func_8097E744(DemoGt* this, GlobalContext* globalCtx, u32 actionIdx) { - CsCmdActorAction* npcAction = DemoGt_GetNpcAction(globalCtx, actionIdx); +void func_8097E744(DemoGt* this, PlayState* play, u32 actionIdx) { + CsCmdActorAction* npcAction = DemoGt_GetNpcAction(play, actionIdx); Vec3f* pos = &this->dyna.actor.world.pos; f32 startX; f32 startY; @@ -331,7 +331,7 @@ void func_8097E744(DemoGt* this, GlobalContext* globalCtx, u32 actionIdx) { if (npcAction != NULL) { someFloat = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 8, 0); + Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 8, 0); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -430,8 +430,8 @@ void func_8097E824(DemoGt* this, s32 arg1) { pos->z += tempf3; } -void func_8097ED64(DemoGt* this, GlobalContext* globalCtx, s32 actionIdx) { - func_8097E744(this, globalCtx, actionIdx); +void func_8097ED64(DemoGt* this, PlayState* play, s32 actionIdx) { + func_8097E744(this, play, actionIdx); func_8097E824(this, actionIdx); } @@ -449,7 +449,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void func_8097EDD8(DemoGt* this, GlobalContext* globalCtx, CollisionHeader* collision) { +void func_8097EDD8(DemoGt* this, PlayState* play, CollisionHeader* collision) { s32 pad[3]; CollisionHeader* colHeader; @@ -458,16 +458,16 @@ void func_8097EDD8(DemoGt* this, GlobalContext* globalCtx, CollisionHeader* coll DynaPolyActor_Init(&this->dyna, DPM_UNK); colHeader = NULL; CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } } -u8 func_8097EE44(DemoGt* this, GlobalContext* globalCtx, s32 updateMode, s32 drawConfig, CollisionHeader* colHeader) { +u8 func_8097EE44(DemoGt* this, PlayState* play, s32 updateMode, s32 drawConfig, CollisionHeader* colHeader) { if (func_8097ED94()) { this->updateMode = updateMode; this->drawConfig = drawConfig; - func_8097EDD8(this, globalCtx, colHeader); + func_8097EDD8(this, play, colHeader); return true; } else { Actor_Kill(&this->dyna.actor); @@ -475,27 +475,27 @@ u8 func_8097EE44(DemoGt* this, GlobalContext* globalCtx, s32 updateMode, s32 dra } } -void func_8097EEA8_Init0(DemoGt* this, GlobalContext* globalCtx) { +void func_8097EEA8_Init0(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 0, 1, NULL); + func_8097EE44(this, play, 0, 1, NULL); } -void func_8097EF00(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_8097EF00(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 527) { func_800F3F3C(13); } } -void func_8097EF34(DemoGt* this, GlobalContext* globalCtx) { +void func_8097EF34(DemoGt* this, PlayState* play) { } -void func_8097EF40(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_8097EF40(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; s32 pad1[3]; Vec3f dustPos; Vec3f velocity = { 0.0f, -16.0f, 0.0f }; @@ -508,43 +508,43 @@ void func_8097EF40(DemoGt* this, GlobalContext* globalCtx) { dustPos.y = pos->y + 679.0f; dustPos.z = pos->z + 82.0f; - DemoGt_SpawnDust(globalCtx, &dustPos, &velocity, &accel, 1700.0f, 15, 30); + DemoGt_SpawnDust(play, &dustPos, &velocity, &accel, 1700.0f, 15, 30); dustPos.x = pos->x + 256.0f; dustPos.y = pos->y + 679.0f; dustPos.z = pos->z - 60.0f; - DemoGt_SpawnDust(globalCtx, &dustPos, &velocity, &accel, 1700.0f, 15, 30); + DemoGt_SpawnDust(play, &dustPos, &velocity, &accel, 1700.0f, 15, 30); } } -void func_8097F0AC(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F0AC(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp38; s16 pad1[3]; Vec3f sp24; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; s32 pad2; if ((frames == 140) || (kREG(1) == 19)) { sp38.x = this->dyna.actor.world.pos.x + 260.0f; sp38.y = this->dyna.actor.world.pos.y + 340.0f; sp38.z = this->dyna.actor.world.pos.z + 45.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp38, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp38, 2.0f); } if (frames == 176) { sp24.x = this->dyna.actor.world.pos.x + 260.0f; sp24.y = this->dyna.actor.world.pos.y + 840.0f; sp24.z = this->dyna.actor.world.pos.z + 45.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp24, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp24, 2.0f); } } -void func_8097F19C(DemoGt* this, GlobalContext* globalCtx) { - func_8097EF34(this, globalCtx); - func_8097EF40(this, globalCtx); - func_8097F0AC(this, globalCtx); +void func_8097F19C(DemoGt* this, PlayState* play) { + func_8097EF34(this, play); + func_8097EF40(this, play); + func_8097F0AC(this, play); } void func_8097F1D8(DemoGt* this) { @@ -558,13 +558,13 @@ void func_8097F1D8(DemoGt* this) { } } -void func_8097F280(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F280(DemoGt* this, PlayState* play) { s32* unk178 = this->unk_178; s32* unk188 = this->unk_188; s32* unk198 = this->unk_198; f32 temp_f0; - if (globalCtx->csCtx.frames < 160) { + if (play->csCtx.frames < 160) { unk178[0] = 100; unk178[1] = 255; unk178[2] = 200; @@ -575,8 +575,8 @@ void func_8097F280(DemoGt* this, GlobalContext* globalCtx) { unk198[0]++; unk198[1]--; - } else if (globalCtx->csCtx.frames < 170) { - temp_f0 = Environment_LerpWeightAccelDecel(170, 160, globalCtx->csCtx.frames, 0, 0); + } else if (play->csCtx.frames < 170) { + temp_f0 = Environment_LerpWeightAccelDecel(170, 160, play->csCtx.frames, 0, 0); unk178[0] = (temp_f0 * -63.0f) + 163.0f; unk178[1] = (temp_f0 * -155.0f) + 255.0f; @@ -596,36 +596,36 @@ void func_8097F280(DemoGt* this, GlobalContext* globalCtx) { } } -void func_8097F3EC(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 1)) { +void func_8097F3EC(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 1)) { this->updateMode = 8; } } -void DemoGt_Update0(DemoGt* this, GlobalContext* globalCtx) { - func_8097F280(this, globalCtx); +void DemoGt_Update0(DemoGt* this, PlayState* play) { + func_8097F280(this, play); func_8097E824(this, 1); - func_8097F19C(this, globalCtx); - func_8097F3EC(this, globalCtx); + func_8097F19C(this, play); + func_8097F3EC(this, play); DemoGt_PlayEarthquakeSfx(); - DemoGt_Rumble(globalCtx); - func_8097EF00(this, globalCtx); + DemoGt_Rumble(play); + func_8097EF00(this, play); } -void DemoGt_Update8(DemoGt* this, GlobalContext* globalCtx) { - func_8097F280(this, globalCtx); +void DemoGt_Update8(DemoGt* this, PlayState* play) { + func_8097F280(this, play); func_8097F1D8(this); - func_8097ED64(this, globalCtx, 1); - func_8097F19C(this, globalCtx); + func_8097ED64(this, play, 1); + func_8097F19C(this, play); DemoGt_PlayEarthquakeSfx(); - DemoGt_Rumble(globalCtx); - func_8097EF00(this, globalCtx); + DemoGt_Rumble(play); + func_8097EF00(this, play); } -void DemoGt_Draw1(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw1(DemoGt* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - u32 gameplayFrames = globalCtx->gameplayFrames; + GraphicsContext* gfxCtx = play->state.gfxCtx; + u32 gameplayFrames = play->gameplayFrames; s16 pad2[2]; s16 spC6; f32 spC0; @@ -689,22 +689,22 @@ void DemoGt_Draw1(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void func_8097F904_Init1(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F904_Init1(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 1, 2, &gTowerCollapseCsCollapsedStructureInnerCol); + func_8097EE44(this, play, 1, 2, &gTowerCollapseCsCollapsedStructureInnerCol); } -void func_8097F960(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F960(DemoGt* this, PlayState* play) { } -void func_8097F96C(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F96C(DemoGt* this, PlayState* play) { static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if (((frames > 1059) && (frames < 1062)) || kREG(1) == 17) { pos.x = this->dyna.actor.world.pos.x; @@ -712,7 +712,7 @@ void func_8097F96C(DemoGt* this, GlobalContext* globalCtx) { pos.z = this->dyna.actor.world.pos.z; if (cloudRing == NULL) { - cloudRing = DemoGt_SpawnCloudRing(globalCtx, &pos, 2); + cloudRing = DemoGt_SpawnCloudRing(play, &pos, 2); } else { actor = cloudRing; actor->world.pos.x = pos.x; @@ -722,10 +722,10 @@ void func_8097F96C(DemoGt* this, GlobalContext* globalCtx) { } } -void func_8097FA1C(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FA1C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { -12.0f, -17.0, 5.0 }; s32 pad1[3]; @@ -734,11 +734,11 @@ void func_8097FA1C(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 300.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z - 377.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 1, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 1, 35); } } -void func_8097FAFC(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FAFC(DemoGt* this, PlayState* play) { static Vec3f velocity = { 0.0f, 1.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static f32 arg4 = 280.0f; @@ -747,7 +747,7 @@ void func_8097FAFC(DemoGt* this, GlobalContext* globalCtx) { static s32 arg7 = 1; static s16 life = 3; s32 pad[2]; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f pos; f32 new_var = -200.0; @@ -761,14 +761,14 @@ void func_8097FAFC(DemoGt* this, GlobalContext* globalCtx) { accel.y += new_var; } - func_8097E454(globalCtx, &pos, &velocity, &accel, arg4, scale, arg6, arg7, life); + func_8097E454(play, &pos, &velocity, &accel, arg4, scale, arg6, arg7, life); } } -void func_8097FC1C(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FC1C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -777,44 +777,44 @@ void func_8097FC1C(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 260.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z + 260.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 0, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 0, 35); } } -void func_8097FCE4(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FCE4(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f vec; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if (frames == 0x1F7 || kREG(1) == 4) { vec.x = this->dyna.actor.world.pos.x + 300.0f; vec.y = this->dyna.actor.world.pos.y + 560.0f; vec.z = this->dyna.actor.world.pos.z - 377.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &vec, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &vec, 2.0f); } } -void func_8097FD70(DemoGt* this, GlobalContext* globalCtx) { - func_8097F960(this, globalCtx); - func_8097F96C(this, globalCtx); - func_8097FA1C(this, globalCtx); - func_8097FAFC(this, globalCtx); - func_8097FC1C(this, globalCtx); - func_8097FCE4(this, globalCtx); +void func_8097FD70(DemoGt* this, PlayState* play) { + func_8097F960(this, play); + func_8097F96C(this, play); + func_8097FA1C(this, play); + func_8097FAFC(this, play); + func_8097FC1C(this, play); + func_8097FCE4(this, play); } -void func_8097FDDC(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FDDC(DemoGt* this, PlayState* play) { s32* unk178 = this->unk_178; s32* unk198 = this->unk_198; - if (globalCtx->csCtx.frames < 610) { + if (play->csCtx.frames < 610) { unk178[0] = 163; unk178[1] = 193; unk178[2] = 193; unk198[0]++; unk198[1]--; - } else if (globalCtx->csCtx.frames < 620) { - f32 temp_f0 = Environment_LerpWeightAccelDecel(620, 610, globalCtx->csCtx.frames, 0, 0); + } else if (play->csCtx.frames < 620) { + f32 temp_f0 = Environment_LerpWeightAccelDecel(620, 610, play->csCtx.frames, 0, 0); unk178[0] = (temp_f0 * (-13.0f)) + 163.0f; unk178[1] = (temp_f0 * (-43.0f)) + 193.0f; @@ -826,27 +826,27 @@ void func_8097FDDC(DemoGt* this, GlobalContext* globalCtx) { } } -void func_8097FED8(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 2)) { +void func_8097FED8(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 2)) { this->updateMode = 9; } } -void DemoGt_Update1(DemoGt* this, GlobalContext* globalCtx) { - func_8097FDDC(this, globalCtx); +void DemoGt_Update1(DemoGt* this, PlayState* play) { + func_8097FDDC(this, play); func_8097E824(this, 2); - func_8097FD70(this, globalCtx); - func_8097FED8(this, globalCtx); + func_8097FD70(this, play); + func_8097FED8(this, play); } -void DemoGt_Update9(DemoGt* this, GlobalContext* globalCtx) { - func_8097FDDC(this, globalCtx); - func_8097ED64(this, globalCtx, 2); - func_8097FD70(this, globalCtx); +void DemoGt_Update9(DemoGt* this, PlayState* play) { + func_8097FDDC(this, play); + func_8097ED64(this, play, 2); + func_8097FD70(this, play); } -void DemoGt_Draw2(DemoGt* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void DemoGt_Draw2(DemoGt* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32* unk198; s32* unk178; s32 pad; @@ -867,32 +867,32 @@ void DemoGt_Draw2(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void func_80980110_Init2(DemoGt* this, GlobalContext* globalCtx) { +void func_80980110_Init2(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 2, 3, &gTowerCollapseCsCollapsedStructureOuterCol); + func_8097EE44(this, play, 2, 3, &gTowerCollapseCsCollapsedStructureOuterCol); } -void func_8098016C(DemoGt* this, GlobalContext* globalCtx) { +void func_8098016C(DemoGt* this, PlayState* play) { } -void func_80980178(DemoGt* this, GlobalContext* globalCtx) { +void func_80980178(DemoGt* this, PlayState* play) { } -void func_80980184(DemoGt* this, GlobalContext* globalCtx) { +void func_80980184(DemoGt* this, PlayState* play) { static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; - if ((globalCtx->csCtx.frames > 1027) && (globalCtx->csCtx.frames < 1031)) { + if ((play->csCtx.frames > 1027) && (play->csCtx.frames < 1031)) { pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 247.0f; pos.z = this->dyna.actor.world.pos.z; if (cloudRing == NULL) { - cloudRing = DemoGt_SpawnCloudRing(globalCtx, &pos, 3); + cloudRing = DemoGt_SpawnCloudRing(play, &pos, 3); } else { actor = cloudRing; actor->world.pos.x = pos.x; @@ -902,19 +902,19 @@ void func_80980184(DemoGt* this, GlobalContext* globalCtx) { } } -void func_80980218(DemoGt* this, GlobalContext* globalCtx) { +void func_80980218(DemoGt* this, PlayState* play) { static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; - if ((globalCtx->csCtx.frames > 997) && (globalCtx->csCtx.frames < 1001)) { + if ((play->csCtx.frames > 997) && (play->csCtx.frames < 1001)) { pos.x = this->dyna.actor.home.pos.x; pos.y = this->dyna.actor.home.pos.y + 38.0f; pos.z = this->dyna.actor.home.pos.z; if (cloudRing == NULL) { - cloudRing = DemoGt_SpawnCloudRing(globalCtx, &pos, 4); + cloudRing = DemoGt_SpawnCloudRing(play, &pos, 4); } else { actor = cloudRing; actor->world.pos.x = pos.x; @@ -924,10 +924,10 @@ void func_80980218(DemoGt* this, GlobalContext* globalCtx) { } } -void func_809802AC(DemoGt* this, GlobalContext* globalCtx) { +void func_809802AC(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 0.0f, 0.0f, -10.0f }; s32 pad1[3]; @@ -936,14 +936,14 @@ void func_809802AC(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x - 100.0f; dustPos.y = pos->y + 1260.0f; dustPos.z = pos->z - 323.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 4.0f, 3, 0, 20); + func_8097D7D8(play, &dustPos, &velOffset, 4.0f, 3, 0, 20); } } -void func_8098036C(DemoGt* this, GlobalContext* globalCtx) { +void func_8098036C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* world = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -3.0f, 0.0f }; s32 pad1[3]; @@ -952,14 +952,14 @@ void func_8098036C(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = world->x + 760.0f; dustPos.y = world->y - 40.0f; dustPos.z = world->z - 240.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 1, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 1, 35); } } -void func_80980430(DemoGt* this, GlobalContext* globalCtx) { +void func_80980430(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - s32 frames = globalCtx->csCtx.frames; + s32 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -3.0f, 0.0f }; s32 pad1[3]; @@ -968,14 +968,14 @@ void func_80980430(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 760.0f; dustPos.y = pos->y - 40.0f; dustPos.z = pos->z - 240.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 1, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 1, 35); } } -void func_80980504(DemoGt* this, GlobalContext* globalCtx) { +void func_80980504(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -984,14 +984,14 @@ void func_80980504(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 830.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 390.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 2, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 2, 35); } } -void func_809805D8(DemoGt* this, GlobalContext* globalCtx) { +void func_809805D8(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* homePos = &this->dyna.actor.home.pos; Vec3f velOffset = { 15.0f, -26.0, 0.0f }; s32 pad1[3]; @@ -1000,14 +1000,14 @@ void func_809805D8(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = homePos->x + 550.0f; dustPos.y = homePos->y - 110.0f; dustPos.z = homePos->z + 50.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 4, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 4, 35); } } -void func_809806B8(DemoGt* this, GlobalContext* globalContext) { +void func_809806B8(DemoGt* this, PlayState* playState) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalContext->csCtx.frames; + u16 frames = playState->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -1016,14 +1016,14 @@ void func_809806B8(DemoGt* this, GlobalContext* globalContext) { dustPos.x = pos->x + 460.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 760.0f; - func_8097D7D8(globalContext, &dustPos, &velOffset, 6.0f, 6, 3, 35); + func_8097D7D8(playState, &dustPos, &velOffset, 6.0f, 6, 3, 35); } } -void func_8098078C(DemoGt* this, GlobalContext* globalContext) { +void func_8098078C(DemoGt* this, PlayState* playState) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalContext->csCtx.frames; + u16 frames = playState->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -1032,39 +1032,39 @@ void func_8098078C(DemoGt* this, GlobalContext* globalContext) { dustPos.x = pos->x + 360.0f; dustPos.y = pos->y + 70.0f; dustPos.z = pos->z - 640.0f; - func_8097D7D8(globalContext, &dustPos, &velOffset, 6.0, 6, 0, 35); + func_8097D7D8(playState, &dustPos, &velOffset, 6.0, 6, 0, 35); } } -void func_8098085C(DemoGt* this, GlobalContext* globalCtx) { +void func_8098085C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp28; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; if ((frames == 58) || (kREG(1) == 1)) { sp28.x = pos->x + 900.0f; sp28.y = pos->y - 50.0f; sp28.z = pos->z + 93.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp28, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp28, 2.0f); } else if (frames == 80) { sp28.x = pos->x + 810.0f; sp28.y = pos->y + 200.0f; sp28.z = pos->z - 37.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp28, 0.9f); + DemoGt_SpawnExplosionWithSound(play, &sp28, 0.9f); } else if (frames == 90) { sp28.x = pos->x - 220.0f; sp28.y = pos->y + 1350.0f; sp28.z = pos->z - 287.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp28, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp28, 2.0f); } } -void func_809809C0(DemoGt* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_809809C0(DemoGt* this, PlayState* play2) { + PlayState* play = play2; DemoGt* this2 = this; - s32 gameplayFrames = globalCtx->gameplayFrames; - u16 frames = globalCtx->csCtx.frames; + s32 gameplayFrames = play->gameplayFrames; + u16 frames = play->csCtx.frames; Vec3f sp54; s16 pad[3]; @@ -1078,93 +1078,93 @@ void func_809809C0(DemoGt* this, GlobalContext* globalCtx2) { sp54.z = this2->dyna.actor.world.pos.z + 23.0f; if (ABS(gameplayFrames % 12) == 0) { - DemoGt_SpawnExplosionNoSound(globalCtx, &sp54, &sp40, &sp34, 2.0f); + DemoGt_SpawnExplosionNoSound(play, &sp54, &sp40, &sp34, 2.0f); } } } -void func_80980AD4(DemoGt* this, GlobalContext* globalCtx) { +void func_80980AD4(DemoGt* this, PlayState* play) { s32 pad[4]; Vec3f pos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames == 477) || (kREG(2) == 1)) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; - func_8097DAC8(this, globalCtx, &pos); - DemoGt_PlayExplosion2Sfx(globalCtx, &pos); + func_8097DAC8(this, play, &pos); + DemoGt_PlayExplosion2Sfx(play, &pos); } } -void func_80980B68(DemoGt* this, GlobalContext* globalCtx) { +void func_80980B68(DemoGt* this, PlayState* play) { s32 pad[4]; Vec3f pos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames == 317) || (kREG(3) == 1)) { pos.x = this->dyna.actor.world.pos.x + 980.0f; pos.y = this->dyna.actor.world.pos.y + 410.0f; pos.z = this->dyna.actor.world.pos.z - 177.0f; - func_8097DD28(this, globalCtx, &pos); - DemoGt_PlayExplosion2Sfx(globalCtx, &pos); + func_8097DD28(this, play, &pos); + DemoGt_PlayExplosion2Sfx(play, &pos); } } -void func_80980BFC(DemoGt* this, GlobalContext* globalCtx) { +void func_80980BFC(DemoGt* this, PlayState* play) { s32 pad[4]; Vec3f pos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames == 740) || (kREG(4) == 1)) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; - func_8097DF70(this, globalCtx, &pos); - DemoGt_PlayExplosion2Sfx(globalCtx, &pos); + func_8097DF70(this, play, &pos); + DemoGt_PlayExplosion2Sfx(play, &pos); } } -void func_80980C90(DemoGt* this, GlobalContext* globalCtx) { - func_8098016C(this, globalCtx); - func_80980178(this, globalCtx); - func_80980184(this, globalCtx); - func_80980218(this, globalCtx); - func_809802AC(this, globalCtx); - func_8098036C(this, globalCtx); - func_80980430(this, globalCtx); - func_80980504(this, globalCtx); - func_809805D8(this, globalCtx); - func_809806B8(this, globalCtx); - func_8098078C(this, globalCtx); - func_8098085C(this, globalCtx); - func_809809C0(this, globalCtx); - func_80980AD4(this, globalCtx); - func_80980B68(this, globalCtx); - func_80980BFC(this, globalCtx); +void func_80980C90(DemoGt* this, PlayState* play) { + func_8098016C(this, play); + func_80980178(this, play); + func_80980184(this, play); + func_80980218(this, play); + func_809802AC(this, play); + func_8098036C(this, play); + func_80980430(this, play); + func_80980504(this, play); + func_809805D8(this, play); + func_809806B8(this, play); + func_8098078C(this, play); + func_8098085C(this, play); + func_809809C0(this, play); + func_80980AD4(this, play); + func_80980B68(this, play); + func_80980BFC(this, play); } -void func_80980D74(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 3)) { +void func_80980D74(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 3)) { this->updateMode = 10; } } -void DemoGt_Update2(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update2(DemoGt* this, PlayState* play) { func_8097E824(this, 3); - func_80980C90(this, globalCtx); - func_80980D74(this, globalCtx); + func_80980C90(this, play); + func_80980D74(this, play); } -void DemoGt_Update10(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 3); - func_80980C90(this, globalCtx); +void DemoGt_Update10(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 3); + func_80980C90(this, play); } -void DemoGt_Draw3(DemoGt* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void DemoGt_Draw3(DemoGt* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -1177,27 +1177,27 @@ void DemoGt_Draw3(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void func_80980F00_Init5(DemoGt* this, GlobalContext* globalCtx) { +void func_80980F00_Init5(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 3, 4, NULL); + func_8097EE44(this, play, 3, 4, NULL); } -void func_80980F58(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_80980F58(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 244) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); } } -void func_80980F8C(DemoGt* this, GlobalContext* globalCtx) { +void func_80980F8C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp58; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames > 259) && (frames < 289)) { Vec3f velOfset = { 0.0f, -17.0f, 0.0f }; @@ -1208,30 +1208,30 @@ void func_80980F8C(DemoGt* this, GlobalContext* globalCtx) { sp58.z = -170.0f; Matrix_MultVec3f(&sp58, &dustPos); - func_8097D7D8(globalCtx, &dustPos, &velOfset, 3.0f, 5, 0, 30); + func_8097D7D8(play, &dustPos, &velOfset, 3.0f, 5, 0, 30); } } -void func_8098103C(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 4)) { +void func_8098103C(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 4)) { this->updateMode = 11; - } else if (func_8097E704(globalCtx, 3, 4)) { + } else if (func_8097E704(play, 3, 4)) { this->updateMode = 16; } } -void DemoGt_Update3(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update3(DemoGt* this, PlayState* play) { func_8097E824(this, 4); - func_80980F58(this, globalCtx); - func_8098103C(this, globalCtx); + func_80980F58(this, play); + func_8098103C(this, play); } -void DemoGt_Update11(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 4); - func_80980F58(this, globalCtx); +void DemoGt_Update11(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 4); + func_80980F58(this, play); } -void DemoGt_Update16(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update16(DemoGt* this, PlayState* play) { f32 temp = this->unk_172; this->unk_174 = (temp * ((kREG(64) * 0.001f) + 0.048f)) + (kREG(65) + 98.0f); @@ -1242,10 +1242,10 @@ void DemoGt_Update16(DemoGt* this, GlobalContext* globalCtx) { } } -void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { +void DemoGt_Draw4(DemoGt* this, PlayState* play2) { GraphicsContext* gfxCtx; - GlobalContext* globalCtx = globalCtx2; - u16 frames = globalCtx->csCtx.frames; + PlayState* play = play2; + u16 frames = play->csCtx.frames; s32 pad; s16 sp76; f32 sp70; @@ -1265,7 +1265,7 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { sp6C = kREG(61); sp68 = (s16)((s32)kREG(58)) + 0x4000; sp6A = kREG(58); - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; sp60 = Graph_Alloc(gfxCtx, sizeof(Mtx)); sp44 = 1.0f - Math_CosS(sp76); @@ -1285,8 +1285,8 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY); MATRIX_TOMTX(sp60); - if (!FrameAdvance_IsEnabled(globalCtx)) { - func_80980F8C(this, globalCtx); + if (!FrameAdvance_IsEnabled(play)) { + func_80980F8C(this, play); } Matrix_Pop(); @@ -1300,27 +1300,27 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { } } -void func_809813CC_Init6(DemoGt* this, GlobalContext* globalCtx) { +void func_809813CC_Init6(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 4, 5, NULL); + func_8097EE44(this, play, 4, 5, NULL); } -void func_80981424(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_80981424(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 789) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); } } -void func_80981458(DemoGt* this, GlobalContext* globalCtx) { +void func_80981458(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp58; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if (((frames > 855) && (frames < 891)) || (kREG(1) == 13)) { Vec3f velOffset = { 0.0f, -30.0f, 0.0f }; @@ -1331,30 +1331,30 @@ void func_80981458(DemoGt* this, GlobalContext* globalCtx) { sp58.z = -1100.0f; Matrix_MultVec3f(&sp58, &dustPos); - func_8097D7D8(globalCtx, &dustPos, &velOffset, 7.1f, 5, 1, 30); + func_8097D7D8(play, &dustPos, &velOffset, 7.1f, 5, 1, 30); } } -void func_80981524(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 5)) { +void func_80981524(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 5)) { this->updateMode = 12; - } else if (func_8097E704(globalCtx, 3, 5)) { + } else if (func_8097E704(play, 3, 5)) { this->updateMode = 17; } } -void DemoGt_Update4(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update4(DemoGt* this, PlayState* play) { func_8097E824(this, 5); - func_80981424(this, globalCtx); - func_80981524(this, globalCtx); + func_80981424(this, play); + func_80981524(this, play); } -void DemoGt_Update12(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 5); - func_80981424(this, globalCtx); +void DemoGt_Update12(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 5); + func_80981424(this, play); } -void DemoGt_Update17(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update17(DemoGt* this, PlayState* play) { f32 temp = this->unk_172; this->unk_174 = temp * ((kREG(66) * 0.001f) + 0.048f) + (kREG(67) + 50.0f); @@ -1365,7 +1365,7 @@ void DemoGt_Update17(DemoGt* this, GlobalContext* globalCtx) { } } -void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw5(DemoGt* this, PlayState* play) { GraphicsContext* gfxCtx; s32 pad; s16 sp76; @@ -1384,7 +1384,7 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { sp6C = kREG(62); sp6A = kREG(59) - 0x4000; sp68 = (s16)(kREG(59) - 0x4000) + 0x4000; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; sp60 = Graph_Alloc(gfxCtx, sizeof(Mtx)); sp44 = 1 - Math_CosS(sp76); @@ -1404,8 +1404,8 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY); MATRIX_TOMTX(sp60); - if (!FrameAdvance_IsEnabled(globalCtx)) { - func_80981458(this, globalCtx); + if (!FrameAdvance_IsEnabled(play)) { + func_80981458(this, play); } Matrix_Pop(); @@ -1418,40 +1418,40 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void func_809818A4_Init7(DemoGt* this, GlobalContext* globalCtx) { +void func_809818A4_Init7(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 5, 6, NULL); + func_8097EE44(this, play, 5, 6, NULL); } -void func_809818FC(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_809818FC(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 845) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); } } -void func_80981930(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 6)) { +void func_80981930(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 6)) { this->updateMode = 13; - } else if (func_8097E704(globalCtx, 3, 6)) { + } else if (func_8097E704(play, 3, 6)) { this->updateMode = 18; } } -void DemoGt_Update5(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update5(DemoGt* this, PlayState* play) { func_8097E824(this, 6); - func_809818FC(this, globalCtx); - func_80981930(this, globalCtx); + func_809818FC(this, play); + func_80981930(this, play); } -void DemoGt_Update13(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 6); - func_809818FC(this, globalCtx); +void DemoGt_Update13(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 6); + func_809818FC(this, play); } -void DemoGt_Update18(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update18(DemoGt* this, PlayState* play) { f32 temp = this->unk_172; this->unk_174 = (temp * ((kREG(68) * 0.001f) + 0.005f)) + (kREG(69) + 50.0f); @@ -1462,7 +1462,7 @@ void DemoGt_Update18(DemoGt* this, GlobalContext* globalCtx) { } } -void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw6(DemoGt* this, PlayState* play) { DemoGt* this2 = this; s16 sp78 = this2->unk_172; f32 sp74; @@ -1480,7 +1480,7 @@ void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) { sp6E = kREG(60) + 0x4000; sp6C = kREG(60) + 0x4000; sp6C += 0x4000; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; sp64 = Graph_Alloc(gfxCtx, sizeof(Mtx)); sp48 = 1.0f - Math_CosS(sp78); @@ -1510,15 +1510,15 @@ void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void func_80981C94_Init23(DemoGt* this, GlobalContext* globalCtx) { +void func_80981C94_Init23(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 6, 7, NULL); + func_8097EE44(this, play, 6, 7, NULL); } -void func_80981CEC(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_80981CEC(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 183) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); @@ -1536,27 +1536,27 @@ void func_80981D20(DemoGt* this) { } } -void func_80981DC8(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 7)) { +void func_80981DC8(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 7)) { this->updateMode = 0xE; } } -void DemoGt_Update6(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update6(DemoGt* this, PlayState* play) { func_8097E824(this, 7); - func_80981CEC(this, globalCtx); - func_80981DC8(this, globalCtx); + func_80981CEC(this, play); + func_80981DC8(this, play); } -void DemoGt_Update14(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update14(DemoGt* this, PlayState* play) { func_80981D20(this); - func_8097ED64(this, globalCtx, 7); - func_80981CEC(this, globalCtx); + func_8097ED64(this, play, 7); + func_80981CEC(this, play); } -void DemoGt_Draw7(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw7(DemoGt* this, PlayState* play) { DemoGt* this2 = this; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 sp6E; f32 sp68; f32 sp64; @@ -1601,15 +1601,15 @@ void DemoGt_Draw7(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void func_80982054_Init24(DemoGt* this, GlobalContext* globalCtx) { +void func_80982054_Init24(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 7, 8, NULL); + func_8097EE44(this, play, 7, 8, NULL); } -void func_809820AC(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_809820AC(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 154) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); @@ -1627,27 +1627,27 @@ void func_809820E0(DemoGt* this) { } } -void func_80982188(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 9) != 0) { +void func_80982188(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 9) != 0) { this->updateMode = 15; } } -void DemoGt_Update7(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update7(DemoGt* this, PlayState* play) { func_8097E824(this, 9); - func_809820AC(this, globalCtx); - func_80982188(this, globalCtx); + func_809820AC(this, play); + func_80982188(this, play); } -void DemoGt_Update15(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update15(DemoGt* this, PlayState* play) { func_809820E0(this); - func_8097ED64(this, globalCtx, 9); - func_809820AC(this, globalCtx); + func_8097ED64(this, play, 9); + func_809820AC(this, play); } -void DemoGt_Draw8(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw8(DemoGt* this, PlayState* play) { DemoGt* this2 = this; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 sp6E; f32 sp68; f32 sp64; @@ -1699,7 +1699,7 @@ static DemoGtUpdateFunc sUpdateFuncs[] = { DemoGt_Update15, DemoGt_Update16, DemoGt_Update17, DemoGt_Update18, }; -void DemoGt_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Update(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; DemoGtUpdateFunc updateFunc; @@ -1709,36 +1709,36 @@ void DemoGt_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - updateFunc(this, globalCtx); + updateFunc(this, play); } -void DemoGt_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Init(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; switch (this->dyna.actor.params) { case 0: - func_8097EEA8_Init0(this, globalCtx); + func_8097EEA8_Init0(this, play); break; case 1: - func_8097F904_Init1(this, globalCtx); + func_8097F904_Init1(this, play); break; case 2: - func_80980110_Init2(this, globalCtx); + func_80980110_Init2(this, play); break; case 5: - func_80980F00_Init5(this, globalCtx); + func_80980F00_Init5(this, play); break; case 6: - func_809813CC_Init6(this, globalCtx); + func_809813CC_Init6(this, play); break; case 7: - func_809818A4_Init7(this, globalCtx); + func_809818A4_Init7(this, play); break; case 23: - func_80981C94_Init23(this, globalCtx); + func_80981C94_Init23(this, play); break; case 24: - func_80982054_Init24(this, globalCtx); + func_80982054_Init24(this, play); break; default: // "Demo_Gt_Actor_ct There is no such argument !" @@ -1747,7 +1747,7 @@ void DemoGt_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DemoGt_Draw0(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw0(DemoGt* this, PlayState* play) { } static DemoGtDrawFunc sDrawFuncs[] = { @@ -1755,7 +1755,7 @@ static DemoGtDrawFunc sDrawFuncs[] = { DemoGt_Draw5, DemoGt_Draw6, DemoGt_Draw7, DemoGt_Draw8, }; -void DemoGt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Draw(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; DemoGtDrawFunc drawFunc; @@ -1765,7 +1765,7 @@ void DemoGt_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - drawFunc(this, globalCtx); + drawFunc(this, play); } const ActorInit Demo_Gt_InitVars = { diff --git a/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h b/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h index 842e3ff46..83cae1cc1 100644 --- a/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h +++ b/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h @@ -6,8 +6,8 @@ struct DemoGt; -typedef void (*DemoGtUpdateFunc)(struct DemoGt*, GlobalContext*); -typedef void (*DemoGtDrawFunc)(struct DemoGt*, GlobalContext*); +typedef void (*DemoGtUpdateFunc)(struct DemoGt*, PlayState*); +typedef void (*DemoGtDrawFunc)(struct DemoGt*, PlayState*); typedef struct DemoGt { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index 780e1e3da..13377c331 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -4,45 +4,45 @@ #define FLAGS ACTOR_FLAG_4 -void DemoIk_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoIk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoIk_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoIk_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoIk_Init(Actor* thisx, PlayState* play); +void DemoIk_Destroy(Actor* thisx, PlayState* play); +void DemoIk_Update(Actor* thisx, PlayState* play); +void DemoIk_Draw(Actor* thisx, PlayState* play); -void DemoIk_Type1Init(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Init(DemoIk* this, GlobalContext* globalCtx); +void DemoIk_Type1Init(DemoIk* this, PlayState* play); +void DemoIk_Type2Init(DemoIk* this, PlayState* play); -void DemoIk_Type1Action0(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type1Action1(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type1Action2(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Action0(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Action1(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Action2(DemoIk* this, GlobalContext* globalCtx); +void DemoIk_Type1Action0(DemoIk* this, PlayState* play); +void DemoIk_Type1Action1(DemoIk* this, PlayState* play); +void DemoIk_Type1Action2(DemoIk* this, PlayState* play); +void DemoIk_Type2Action0(DemoIk* this, PlayState* play); +void DemoIk_Type2Action1(DemoIk* this, PlayState* play); +void DemoIk_Type2Action2(DemoIk* this, PlayState* play); -void DemoIk_DrawNothing(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type1Draw(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Draw(DemoIk* this, GlobalContext* globalCtx); +void DemoIk_DrawNothing(DemoIk* this, PlayState* play); +void DemoIk_Type1Draw(DemoIk* this, PlayState* play); +void DemoIk_Type2Draw(DemoIk* this, PlayState* play); -void DemoIk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Destroy(Actor* thisx, PlayState* play) { } -void DemoIk_BgCheck(DemoIk* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void DemoIk_BgCheck(DemoIk* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } s32 DemoIk_UpdateSkelAnime(DemoIk* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* DemoIk_GetCue(GlobalContext* globalCtx, s32 index) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[index]; +CsCmdActorAction* DemoIk_GetCue(PlayState* play, s32 index) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[index]; } return NULL; } -s32 DemoIk_CheckCue(GlobalContext* globalCtx, u16 action, s32 index) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, index); +s32 DemoIk_CheckCue(PlayState* play, u16 action, s32 index) { + CsCmdActorAction* cue = DemoIk_GetCue(play, index); if ((cue != NULL) && (cue->action == action)) { return 1; @@ -50,9 +50,9 @@ s32 DemoIk_CheckCue(GlobalContext* globalCtx, u16 action, s32 index) { return 0; } -void DemoIk_SetMove(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_SetMove(DemoIk* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void DemoIk_EndMove(DemoIk* this) { @@ -109,7 +109,7 @@ void DemoIk_Type1PlaySound(DemoIk* this) { } } -void DemoIk_SpawnDeadDb(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_SpawnDeadDb(DemoIk* this, PlayState* play) { static Vec3f deadDbOffsets[] = { { -14.0f, 5.0f, 5.0f }, { -20.0f, 12.0f, 0.0f }, { -5.0f, 10.0f, -1.0f }, { -10.0f, 8.0f, 14.0f }, { -3.0f, 10.0f, 7.0f }, { -10.0f, 11.0f, 0.0f }, { 9.0f, 10.0f, -8.0f }, { 4.0f, 10.0f, 3.0f }, @@ -118,7 +118,7 @@ void DemoIk_SpawnDeadDb(DemoIk* this, GlobalContext* globalCtx) { s32 i; s32 index = DemoIk_GetIndexFromParams(this->actor.params); - if (DemoIk_CheckCue(globalCtx, 5, index)) { + if (DemoIk_CheckCue(play, 5, index)) { Vec3f pos; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 startIndex; @@ -138,13 +138,13 @@ void DemoIk_SpawnDeadDb(DemoIk* this, GlobalContext* globalCtx) { pos.x = deadDbOffsets[i].x + this->actor.world.pos.x; pos.y = deadDbOffsets[i].y + this->actor.world.pos.y; pos.z = deadDbOffsets[i].z + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 10, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 10, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } } } -void DemoIk_MoveToStartPos(DemoIk* this, GlobalContext* globalCtx, s32 index) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, index); +void DemoIk_MoveToStartPos(DemoIk* this, PlayState* play, s32 index) { + CsCmdActorAction* cue = DemoIk_GetCue(play, index); if (cue != NULL) { this->actor.world.pos.x = cue->startPos.x; @@ -154,7 +154,7 @@ void DemoIk_MoveToStartPos(DemoIk* this, GlobalContext* globalCtx, s32 index) { } } -void DemoIk_Type1Init(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type1Init(DemoIk* this, PlayState* play) { s32 pad[3]; SkeletonHeader* skeleton; AnimationHeader* animation; @@ -178,7 +178,7 @@ void DemoIk_Type1Init(DemoIk* this, GlobalContext* globalCtx) { // No break is required for matching } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, phi_f0); - SkelAnime_Init(globalCtx, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); + SkelAnime_Init(play, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); } @@ -188,9 +188,9 @@ void func_8098393C(DemoIk* this) { this->actor.shape.shadowAlpha = 0; } -void func_8098394C(DemoIk* this, GlobalContext* globalCtx) { +void func_8098394C(DemoIk* this, PlayState* play) { DemoIk_EndMove(this); - DemoIk_MoveToStartPos(this, globalCtx, DemoIk_GetIndexFromParams(this->actor.params)); + DemoIk_MoveToStartPos(this, play, DemoIk_GetIndexFromParams(this->actor.params)); this->actionMode = 1; this->drawMode = 1; this->actor.shape.shadowAlpha = 255; @@ -204,8 +204,8 @@ void func_809839AC(DemoIk* this) { this->skelAnime.curFrame = 0.0f; } -void func_809839D0(DemoIk* this, GlobalContext* globalCtx) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, DemoIk_GetIndexFromParams(this->actor.params)); +void func_809839D0(DemoIk* this, PlayState* play) { + CsCmdActorAction* cue = DemoIk_GetCue(play, DemoIk_GetIndexFromParams(this->actor.params)); if (cue != NULL) { s32 nextCsAction = cue->action; @@ -217,7 +217,7 @@ void func_809839D0(DemoIk* this, GlobalContext* globalCtx) { func_8098393C(this); break; case 2: - func_8098394C(this, globalCtx); + func_8098394C(this, play); break; case 3: func_809839AC(this); @@ -237,27 +237,27 @@ void func_809839D0(DemoIk* this, GlobalContext* globalCtx) { } } -void DemoIk_Type1Action0(DemoIk* this, GlobalContext* globalCtx) { - func_809839D0(this, globalCtx); +void DemoIk_Type1Action0(DemoIk* this, PlayState* play) { + func_809839D0(this, play); } -void DemoIk_Type1Action1(DemoIk* this, GlobalContext* globalCtx) { - DemoIk_BgCheck(this, globalCtx); - func_809839D0(this, globalCtx); +void DemoIk_Type1Action1(DemoIk* this, PlayState* play) { + DemoIk_BgCheck(this, play); + func_809839D0(this, play); } -void DemoIk_Type1Action2(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type1Action2(DemoIk* this, PlayState* play) { DemoIk_UpdateSkelAnime(this); DemoIk_Type1PlaySound(this); - DemoIk_SetMove(this, globalCtx); - DemoIk_BgCheck(this, globalCtx); - DemoIk_SpawnDeadDb(this, globalCtx); - func_809839D0(this, globalCtx); + DemoIk_SetMove(this, play); + DemoIk_BgCheck(this, play); + DemoIk_SpawnDeadDb(this, play); + func_809839D0(this, play); } -void DemoIk_Type1PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void DemoIk_Type1PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { DemoIk* this = (DemoIk*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); if (limbIndex == 1) { @@ -277,23 +277,23 @@ void DemoIk_Type1PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi CLOSE_DISPS(gfxCtx); } -void DemoIk_Type1Draw(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type1Draw(DemoIk* this, PlayState* play) { s32 pad[2]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, DemoIk_SetColors(gfxCtx, 245, 225, 155, 30, 30, 0)); gSPSegment(POLY_OPA_DISP++, 0x09, DemoIk_SetColors(gfxCtx, 255, 40, 0, 40, 0, 0)); gSPSegment(POLY_OPA_DISP++, 0x0A, DemoIk_SetColors(gfxCtx, 255, 255, 255, 20, 40, 30)); - SkelAnime_DrawOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, NULL, DemoIk_Type1PostLimbDraw, this); + SkelAnime_DrawOpa(play, skelAnime->skeleton, skelAnime->jointTable, NULL, DemoIk_Type1PostLimbDraw, this); CLOSE_DISPS(gfxCtx); } -void DemoIk_Type2Init(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type2Init(DemoIk* this, PlayState* play) { s32 pad[2]; FlexSkeletonHeader* skeleton; AnimationHeader* animation; @@ -316,7 +316,7 @@ void DemoIk_Type2Init(DemoIk* this, GlobalContext* globalCtx) { animation = &object_ik_Anim_0008DC; } - SkelAnime_InitFlex(globalCtx, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); + SkelAnime_InitFlex(play, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); this->actionMode = 3; this->drawMode = 0; @@ -345,8 +345,8 @@ void func_80983FDC(DemoIk* this) { this->drawMode = 0; } -void func_80983FEC(DemoIk* this, GlobalContext* globalCtx) { - DemoIk_MoveToStartPos(this, globalCtx, 4); +void func_80983FEC(DemoIk* this, PlayState* play) { + DemoIk_MoveToStartPos(this, play, 4); this->actionMode = 4; this->drawMode = 2; this->skelAnime.curFrame = 0.0f; @@ -358,8 +358,8 @@ void func_8098402C(DemoIk* this) { this->skelAnime.curFrame = 0.0f; } -void func_80984048(DemoIk* this, GlobalContext* globalCtx) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, 4); +void func_80984048(DemoIk* this, PlayState* play) { + CsCmdActorAction* cue = DemoIk_GetCue(play, 4); if (cue != NULL) { s32 nextCsAction = cue->action; @@ -371,7 +371,7 @@ void func_80984048(DemoIk* this, GlobalContext* globalCtx) { func_80983FDC(this); break; case 5: - func_80983FEC(this, globalCtx); + func_80983FEC(this, play); break; case 6: func_8098402C(this); @@ -388,21 +388,21 @@ void func_80984048(DemoIk* this, GlobalContext* globalCtx) { } } -void DemoIk_Type2Action0(DemoIk* this, GlobalContext* globalCtx) { - func_80984048(this, globalCtx); +void DemoIk_Type2Action0(DemoIk* this, PlayState* play) { + func_80984048(this, play); } -void DemoIk_Type2Action1(DemoIk* this, GlobalContext* globalCtx) { - func_80984048(this, globalCtx); +void DemoIk_Type2Action1(DemoIk* this, PlayState* play) { + func_80984048(this, play); } -void DemoIk_Type2Action2(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type2Action2(DemoIk* this, PlayState* play) { DemoIk_UpdateSkelAnime(this); DemoIk_Type2PlaySound(this); - func_80984048(this, globalCtx); + func_80984048(this, play); } -s32 DemoIk_Type2OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 DemoIk_Type2OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { DemoIk* this = (DemoIk*)thisx; @@ -412,9 +412,9 @@ s32 DemoIk_Type2OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void DemoIk_Type2PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void DemoIk_Type2PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { DemoIk* this = (DemoIk*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 frame = DemoIk_GetCurFrame(this); OPEN_DISPS(gfxCtx); @@ -445,19 +445,19 @@ void DemoIk_Type2PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi CLOSE_DISPS(gfxCtx); } -void DemoIk_Type2Draw(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type2Draw(DemoIk* this, PlayState* play) { s32 pad[2]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, DemoIk_SetColors(gfxCtx, 245, 225, 155, 30, 30, 0)); gSPSegment(POLY_OPA_DISP++, 0x09, DemoIk_SetColors(gfxCtx, 255, 40, 0, 40, 0, 0)); gSPSegment(POLY_OPA_DISP++, 0x0A, DemoIk_SetColors(gfxCtx, 255, 255, 255, 20, 40, 30)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoIk_Type2OverrideLimbDraw, DemoIk_Type2PostLimbDraw, this); CLOSE_DISPS(gfxCtx); } @@ -467,7 +467,7 @@ static DemoIkActionFunc sActionFuncs[] = { DemoIk_Type2Action0, DemoIk_Type2Action1, DemoIk_Type2Action2, }; -void DemoIk_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Update(Actor* thisx, PlayState* play) { s32 pad; DemoIk* this = (DemoIk*)thisx; @@ -477,10 +477,10 @@ void DemoIk_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->actionMode](this, globalCtx); + sActionFuncs[this->actionMode](this, play); } -void DemoIk_DrawNothing(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_DrawNothing(DemoIk* this, PlayState* play) { } static DemoIkDrawFunc sDrawFuncs[] = { @@ -489,7 +489,7 @@ static DemoIkDrawFunc sDrawFuncs[] = { DemoIk_Type2Draw, }; -void DemoIk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Draw(Actor* thisx, PlayState* play) { s32 pad; DemoIk* this = (DemoIk*)thisx; @@ -498,7 +498,7 @@ void DemoIk_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawMode](this, globalCtx); + sDrawFuncs[this->drawMode](this, play); } const ActorInit Demo_Ik_InitVars = { @@ -514,13 +514,13 @@ const ActorInit Demo_Ik_InitVars = { NULL, }; -void DemoIk_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Init(Actor* thisx, PlayState* play) { s32 pad; DemoIk* this = (DemoIk*)thisx; if (this->actor.params == 0 || this->actor.params == 1 || this->actor.params == 2) { - DemoIk_Type1Init(this, globalCtx); + DemoIk_Type1Init(this, play); } else { - DemoIk_Type2Init(this, globalCtx); + DemoIk_Type2Init(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h index 24fe5d094..caae15f7b 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h +++ b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h @@ -6,8 +6,8 @@ struct DemoIk; -typedef void (*DemoIkActionFunc)(struct DemoIk* this, GlobalContext* globalCtx); -typedef void (*DemoIkDrawFunc)(struct DemoIk* this, GlobalContext* globalCtx); +typedef void (*DemoIkActionFunc)(struct DemoIk* this, PlayState* play); +typedef void (*DemoIkDrawFunc)(struct DemoIk* this, PlayState* play); typedef struct DemoIk { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 93007f547..b87e7a90d 100644 --- a/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -13,44 +13,44 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4) -void DemoIm_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoIm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoIm_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoIm_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_809856F8(DemoIm* this, GlobalContext* globalCtx); -void func_80985718(DemoIm* this, GlobalContext* globalCtx); -void func_80985738(DemoIm* this, GlobalContext* globalCtx); -void func_80985770(DemoIm* this, GlobalContext* globalCtx); -void func_809857B0(DemoIm* this, GlobalContext* globalCtx); -void func_809857F0(DemoIm* this, GlobalContext* globalCtx); -void func_80985830(DemoIm* this, GlobalContext* globalCtx); -void func_80985C10(DemoIm* this, GlobalContext* globalCtx); -void func_80985C40(DemoIm* this, GlobalContext* globalCtx); -void func_80985C94(DemoIm* this, GlobalContext* globalCtx); -void DemoIm_DrawTranslucent(DemoIm* this, GlobalContext* globalCtx); -void func_809863BC(DemoIm* this, GlobalContext* globalCtx); -void func_809863DC(DemoIm* this, GlobalContext* globalCtx); -void func_80986430(DemoIm* this, GlobalContext* globalCtx); -void func_80986494(DemoIm* this, GlobalContext* globalCtx); -void func_809864D4(DemoIm* this, GlobalContext* globalCtx); -void func_809868E8(DemoIm* this, GlobalContext* globalCtx); -void func_80986908(DemoIm* this, GlobalContext* globalCtx); -void func_80986948(DemoIm* this, GlobalContext* globalCtx); -void func_80986D40(DemoIm* this, GlobalContext* globalCtx); -void func_80986DC8(DemoIm* this, GlobalContext* globalCtx); -void func_80986E20(DemoIm* this, GlobalContext* globalCtx); -void func_80986E40(DemoIm* this, GlobalContext* globalCtx); -void func_80986EAC(DemoIm* this, GlobalContext* globalCtx); -void func_80986F08(DemoIm* this, GlobalContext* globalCtx); -void func_80986F28(DemoIm* this, GlobalContext* globalCtx); -void func_80986F88(DemoIm* this, GlobalContext* globalCtx); -void func_80986FA8(DemoIm* this, GlobalContext* globalCtx); -void func_80987288(DemoIm* this, GlobalContext* globalCtx); -void func_809872A8(DemoIm* this, GlobalContext* globalCtx); -void func_809872F0(DemoIm* this, GlobalContext* globalCtx); -void func_80987330(DemoIm* this, GlobalContext* globalCtx); -void DemoIm_DrawNothing(DemoIm* this, GlobalContext* globalCtx); -void DemoIm_DrawSolid(DemoIm* this, GlobalContext* globalCtx); +void DemoIm_Init(Actor* thisx, PlayState* play); +void DemoIm_Destroy(Actor* thisx, PlayState* play); +void DemoIm_Update(Actor* thisx, PlayState* play); +void DemoIm_Draw(Actor* thisx, PlayState* play); +void func_809856F8(DemoIm* this, PlayState* play); +void func_80985718(DemoIm* this, PlayState* play); +void func_80985738(DemoIm* this, PlayState* play); +void func_80985770(DemoIm* this, PlayState* play); +void func_809857B0(DemoIm* this, PlayState* play); +void func_809857F0(DemoIm* this, PlayState* play); +void func_80985830(DemoIm* this, PlayState* play); +void func_80985C10(DemoIm* this, PlayState* play); +void func_80985C40(DemoIm* this, PlayState* play); +void func_80985C94(DemoIm* this, PlayState* play); +void DemoIm_DrawTranslucent(DemoIm* this, PlayState* play); +void func_809863BC(DemoIm* this, PlayState* play); +void func_809863DC(DemoIm* this, PlayState* play); +void func_80986430(DemoIm* this, PlayState* play); +void func_80986494(DemoIm* this, PlayState* play); +void func_809864D4(DemoIm* this, PlayState* play); +void func_809868E8(DemoIm* this, PlayState* play); +void func_80986908(DemoIm* this, PlayState* play); +void func_80986948(DemoIm* this, PlayState* play); +void func_80986D40(DemoIm* this, PlayState* play); +void func_80986DC8(DemoIm* this, PlayState* play); +void func_80986E20(DemoIm* this, PlayState* play); +void func_80986E40(DemoIm* this, PlayState* play); +void func_80986EAC(DemoIm* this, PlayState* play); +void func_80986F08(DemoIm* this, PlayState* play); +void func_80986F28(DemoIm* this, PlayState* play); +void func_80986F88(DemoIm* this, PlayState* play); +void func_80986FA8(DemoIm* this, PlayState* play); +void func_80987288(DemoIm* this, PlayState* play); +void func_809872A8(DemoIm* this, PlayState* play); +void func_809872F0(DemoIm* this, PlayState* play); +void func_80987330(DemoIm* this, PlayState* play); +void DemoIm_DrawNothing(DemoIm* this, PlayState* play); +void DemoIm_DrawSolid(DemoIm* this, PlayState* play); static void* sEyeTextures[] = { gImpaEyeOpenTex, @@ -127,10 +127,10 @@ void func_80984C68(DemoIm* this) { this->unk_268 = 0.0f; } -void func_80984C8C(DemoIm* this, GlobalContext* globalCtx) { +void func_80984C8C(DemoIm* this, PlayState* play) { u32* something = &D_8098783C; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (*something != 0) { if (this->actor.params == 2) { func_80984C68(this); @@ -144,24 +144,24 @@ void func_80984C8C(DemoIm* this, GlobalContext* globalCtx) { } } -void DemoIm_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_InitCollider(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void DemoIm_DestroyCollider(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_DestroyCollider(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void DemoIm_UpdateCollider(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_UpdateCollider(DemoIm* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void func_80984DB8(DemoIm* this) { @@ -176,8 +176,8 @@ void func_80984DB8(DemoIm* this) { Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100); } -void func_80984E58(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80984E58(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; s16 phi_a3; @@ -189,8 +189,8 @@ void func_80984E58(DemoIm* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, phi_a3); } -void func_80984F10(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80984F10(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_2D4.unk_18 = player->actor.world.pos; this->unk_2D4.unk_14 = kREG(16) + 12.0f; @@ -198,42 +198,42 @@ void func_80984F10(DemoIm* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 2); } -void func_80984F94(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80984F94(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_2D4.unk_18 = player->actor.world.pos; this->unk_2D4.unk_14 = kREG(16) + 4.0f; func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 4); } -void DemoIm_UpdateBgCheckInfo(DemoIm* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void DemoIm_UpdateBgCheckInfo(DemoIm* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } s32 DemoIm_UpdateSkelAnime(DemoIm* this) { return SkelAnime_Update(&this->skelAnime); } -s32 DemoIm_IsCsStateIdle(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +s32 DemoIm_IsCsStateIdle(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } else { return false; } } -CsCmdActorAction* DemoIm_GetNpcAction(GlobalContext* globalCtx, s32 actionIdx) { +CsCmdActorAction* DemoIm_GetNpcAction(PlayState* play, s32 actionIdx) { s32 pad[2]; CsCmdActorAction* ret = NULL; - if (!DemoIm_IsCsStateIdle(globalCtx)) { - ret = globalCtx->csCtx.npcActions[actionIdx]; + if (!DemoIm_IsCsStateIdle(play)) { + ret = play->csCtx.npcActions[actionIdx]; } return ret; } -s32 func_809850E8(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +s32 func_809850E8(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { if (npcAction->action == action) { @@ -243,8 +243,8 @@ s32 func_809850E8(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 action return false; } -s32 func_80985134(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +s32 func_80985134(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { if (npcAction->action != action) { @@ -254,8 +254,8 @@ s32 func_80985134(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 action return false; } -void func_80985180(DemoIm* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +void func_80985180(DemoIm* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -265,8 +265,8 @@ void func_80985180(DemoIm* this, GlobalContext* globalCtx, s32 actionIdx) { } } -void func_80985200(DemoIm* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +void func_80985200(DemoIm* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -296,57 +296,57 @@ void DemoIm_ChangeAnim(DemoIm* this, AnimationHeader* animHeaderSeg, u8 animMode Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, startFrame, endFrame, animMode, transitionRate); } -void func_80985310(DemoIm* this, GlobalContext* globalCtx) { +void func_80985310(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->actor.shape.yOffset = -10000.0f; } -void func_80985358(DemoIm* this, GlobalContext* globalCtx) { +void func_80985358(DemoIm* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void func_809853B4(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809853B4(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerX = player->actor.world.pos.x; f32 playerY = player->actor.world.pos.y + 80.0f; f32 playerZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, playerX, playerY, playerZ, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, playerX, playerY, playerZ, 0, 0, 0, 0xD); - Item_Give(globalCtx, ITEM_MEDALLION_SHADOW); + Item_Give(play, ITEM_MEDALLION_SHADOW); } -void func_80985430(DemoIm* this, GlobalContext* globalCtx) { +void func_80985430(DemoIm* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } -void func_8098544C(DemoIm* this, GlobalContext* globalCtx) { +void func_8098544C(DemoIm* this, PlayState* play) { s32 pad[2]; if ((gSaveContext.chamberCutsceneNum == 4) && (gSaveContext.sceneSetupIndex < 4)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->action = 1; - globalCtx->csCtx.segment = D_8098786C; + play->csCtx.segment = D_8098786C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_SHADOW); + Item_Give(play, ITEM_MEDALLION_SHADOW); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void func_809854DC(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[5] != NULL) && - (globalCtx->csCtx.npcActions[5]->action == 2)) { +void func_809854DC(DemoIm* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[5] != NULL) && + (play->csCtx.npcActions[5]->action == 2)) { Animation_Change(&this->skelAnime, &gImpaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaIdleAnim), ANIMMODE_LOOP, 0.0f); this->action = 2; this->drawConfig = 1; - func_80985358(this, globalCtx); + func_80985358(this, play); } } @@ -357,9 +357,9 @@ void func_8098557C(DemoIm* this) { } } -void func_809855A8(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[5] != NULL) && - (globalCtx->csCtx.npcActions[5]->action == 3)) { +void func_809855A8(DemoIm* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[5] != NULL) && + (play->csCtx.npcActions[5]->action == 3)) { Animation_Change(&this->skelAnime, &gImpaRaiseArmsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaRaiseArmsAnim), ANIMMODE_ONCE, 4.0f); this->action = 4; @@ -374,59 +374,59 @@ void func_80985640(DemoIm* this, s32 arg1) { } } -void func_809856AC(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[6] != NULL) && - (globalCtx->csCtx.npcActions[6]->action == 2)) { +void func_809856AC(DemoIm* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[6] != NULL) && + (play->csCtx.npcActions[6]->action == 2)) { this->action = 6; - func_809853B4(this, globalCtx); + func_809853B4(this, play); } } -void func_809856F8(DemoIm* this, GlobalContext* globalCtx) { - func_8098544C(this, globalCtx); +void func_809856F8(DemoIm* this, PlayState* play) { + func_8098544C(this, play); } -void func_80985718(DemoIm* this, GlobalContext* globalCtx) { - func_809854DC(this, globalCtx); +void func_80985718(DemoIm* this, PlayState* play) { + func_809854DC(this, play); } -void func_80985738(DemoIm* this, GlobalContext* globalCtx) { - func_80985430(this, globalCtx); +void func_80985738(DemoIm* this, PlayState* play) { + func_80985430(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_8098557C(this); } -void func_80985770(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985770(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809855A8(this, globalCtx); + func_809855A8(this, play); } -void func_809857B0(DemoIm* this, GlobalContext* globalCtx) { +void func_809857B0(DemoIm* this, PlayState* play) { s32 sp1C; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp1C = DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_80985640(this, sp1C); } -void func_809857F0(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809857F0(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809856AC(this, globalCtx); + func_809856AC(this, play); } -void func_80985830(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985830(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); } -void func_80985860(DemoIm* this, GlobalContext* globalCtx) { +void func_80985860(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 7; this->actor.shape.shadowAlpha = 0; @@ -436,13 +436,13 @@ void func_809858A8(void) { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void DemoIm_SpawnLightBall(DemoIm* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void DemoIm_SpawnLightBall(DemoIm* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, (kREG(17) + 24.0f) + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 6); } -void func_80985948(DemoIm* this, GlobalContext* globalCtx) { - if (func_809850E8(this, globalCtx, 4, 5)) { +void func_80985948(DemoIm* this, PlayState* play) { + if (func_809850E8(this, play, 4, 5)) { Animation_Change(&this->skelAnime, &gImpaPrepareSealGanonAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaPrepareSealGanonAnim), ANIMMODE_ONCE, 0.0f); this->action = 8; @@ -454,11 +454,11 @@ void func_80985948(DemoIm* this, GlobalContext* globalCtx) { } } -void func_809859E0(DemoIm* this, GlobalContext* globalCtx) { +void func_809859E0(DemoIm* this, PlayState* play) { f32* unk_268 = &this->unk_268; s32 alpha = 255; - if (func_809850E8(this, globalCtx, 4, 5)) { + if (func_809850E8(this, play, 4, 5)) { *unk_268 += 1.0f; if (*unk_268 >= kREG(5) + 10.0f) { this->action = 9; @@ -481,8 +481,8 @@ void func_809859E0(DemoIm* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = this->alpha = (*unk_268 / (kREG(5) + 10.0f)) * 255.0f; } -void func_80985B34(DemoIm* this, GlobalContext* globalCtx) { - if (func_80985134(this, globalCtx, 4, 5)) { +void func_80985B34(DemoIm* this, PlayState* play) { + if (func_80985134(this, play, 4, 5)) { Animation_Change(&this->skelAnime, &gImpaSealGanonAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaSealGanonAnim), ANIMMODE_ONCE, -8.0f); this->action = 8; @@ -490,64 +490,64 @@ void func_80985B34(DemoIm* this, GlobalContext* globalCtx) { this->unk_268 = kREG(5) + 10.0f; this->alpha = 255; if (this->unk_270 == 0) { - DemoIm_SpawnLightBall(this, globalCtx); + DemoIm_SpawnLightBall(this, play); this->unk_270 = 1; } this->actor.shape.shadowAlpha = 0xFF; } } -void func_80985C10(DemoIm* this, GlobalContext* globalCtx) { - func_80985948(this, globalCtx); - func_80984C8C(this, globalCtx); +void func_80985C10(DemoIm* this, PlayState* play) { + func_80985948(this, play); + func_80984C8C(this, play); } -void func_80985C40(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985C40(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809859E0(this, globalCtx); - func_80984C8C(this, globalCtx); + func_809859E0(this, play); + func_80984C8C(this, play); } -void func_80985C94(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985C94(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80985B34(this, globalCtx); - func_80984C8C(this, globalCtx); + func_80985B34(this, play); + func_80984C8C(this, play); } -void DemoIm_DrawTranslucent(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_DrawTranslucent(DemoIm* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80985E60(DemoIm* this, GlobalContext* globalCtx) { +void func_80985E60(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 10; this->unk_280 = 1; } -void func_80985EAC(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.frames >= 80) && (globalCtx->csCtx.frames < 243)) { - func_80984F10(this, globalCtx); +void func_80985EAC(DemoIm* this, PlayState* play) { + if ((play->csCtx.frames >= 80) && (play->csCtx.frames < 243)) { + func_80984F10(this, play); } else { func_80984DB8(this); } @@ -564,10 +564,10 @@ void func_80985F54(DemoIm* this) { this->drawConfig = 0; } -void func_80985F64(DemoIm* this, GlobalContext* globalCtx) { +void func_80985F64(DemoIm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gImpaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaIdleAnim), ANIMMODE_LOOP, 0.0f); - func_80985180(this, globalCtx, 5); + func_80985180(this, play, 5); this->action = 11; this->drawConfig = 1; } @@ -608,8 +608,8 @@ void func_80986148(DemoIm* this) { this->drawConfig = 1; } -void func_809861C4(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_809861C4(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -633,16 +633,16 @@ void func_809861C4(DemoIm* this, GlobalContext* globalCtx) { } } -void func_8098629C(DemoIm* this, GlobalContext* globalCtx) { - if (DemoIm_IsCsStateIdle(globalCtx)) { +void func_8098629C(DemoIm* this, PlayState* play) { + if (DemoIm_IsCsStateIdle(play)) { this->action = 21; this->drawConfig = 1; this->unk_280 = 1; } } -void func_809862E0(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_809862E0(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -654,7 +654,7 @@ void func_809862E0(DemoIm* this, GlobalContext* globalCtx) { func_80985F54(this); break; case 2: - func_80985F64(this, globalCtx); + func_80985F64(this, play); break; case 7: func_8098604C(this); @@ -673,61 +673,61 @@ void func_809862E0(DemoIm* this, GlobalContext* globalCtx) { } } -void func_809863BC(DemoIm* this, GlobalContext* globalCtx) { - func_809862E0(this, globalCtx); +void func_809863BC(DemoIm* this, PlayState* play) { + func_809862E0(this, play); } -void func_809863DC(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809863DC(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); - func_80985EAC(this, globalCtx); + func_80985EAC(this, play); func_80984BE0(this); - func_809862E0(this, globalCtx); + func_809862E0(this, play); } -void func_80986430(DemoIm* this, GlobalContext* globalCtx) { +void func_80986430(DemoIm* this, PlayState* play) { s32 sp24; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp24 = DemoIm_UpdateSkelAnime(this); - func_80985EAC(this, globalCtx); + func_80985EAC(this, play); func_80984BE0(this); func_80985FE8(this, sp24); - func_809862E0(this, globalCtx); + func_809862E0(this, play); } -void func_80986494(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986494(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); func_80985EF4(this); func_80984BE0(this); - func_809861C4(this, globalCtx); + func_809861C4(this, play); } -void func_809864D4(DemoIm* this, GlobalContext* globalCtx) { +void func_809864D4(DemoIm* this, PlayState* play) { s32 sp24; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp24 = DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_809860DC(this, sp24); - func_8098629C(this, globalCtx); + func_8098629C(this, play); } -void func_8098652C(DemoIm* this, GlobalContext* globalCtx) { +void func_8098652C(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 15; } -void func_80986570(DemoIm* this, GlobalContext* globalCtx) { +void func_80986570(DemoIm* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & 1)) { u32 sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); Audio_PlaySoundGeneral(sfxId, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } -void func_809865F8(DemoIm* this, GlobalContext* globalCtx, s32 arg2) { +void func_809865F8(DemoIm* this, PlayState* play, s32 arg2) { s32 pad[2]; if (arg2 != 0) { @@ -741,7 +741,7 @@ void func_809865F8(DemoIm* this, GlobalContext* globalCtx, s32 arg2) { f32 spawnPosY = thisPos->y; f32 spawnPosZ = thisPos->z + (Math_CosS(shapeRotY) * 30.0f); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, spawnPosX, spawnPosY, spawnPosZ, 0xFA0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, spawnPosX, spawnPosY, spawnPosZ, 0xFA0, this->actor.shape.rot.y, 0, ARROW_CS_NUT); this->unk_27C = 1; } @@ -756,10 +756,10 @@ void func_80986700(DemoIm* this) { this->drawConfig = 0; } -void func_80986710(DemoIm* this, GlobalContext* globalCtx) { +void func_80986710(DemoIm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gImpaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaIdleAnim), ANIMMODE_LOOP, 0.0f); - func_80985180(this, globalCtx, 5); + func_80985180(this, play, 5); this->action = 16; this->drawConfig = 1; } @@ -771,8 +771,8 @@ void func_80986794(DemoIm* this) { this->drawConfig = 1; } -void func_8098680C(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_8098680C(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -784,7 +784,7 @@ void func_8098680C(DemoIm* this, GlobalContext* globalCtx) { func_80986700(this); break; case 2: - func_80986710(this, globalCtx); + func_80986710(this, play); break; case 10: func_80986794(this); @@ -800,36 +800,36 @@ void func_8098680C(DemoIm* this, GlobalContext* globalCtx) { } } -void func_809868E8(DemoIm* this, GlobalContext* globalCtx) { - func_8098680C(this, globalCtx); +void func_809868E8(DemoIm* this, PlayState* play) { + func_8098680C(this, play); } -void func_80986908(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986908(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_8098680C(this, globalCtx); + func_8098680C(this, play); } -void func_80986948(DemoIm* this, GlobalContext* globalCtx) { +void func_80986948(DemoIm* this, PlayState* play) { s32 sp24; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp24 = DemoIm_UpdateSkelAnime(this); - func_80986570(this, globalCtx); + func_80986570(this, play); func_80984BE0(this); - func_809865F8(this, globalCtx, sp24); - func_8098680C(this, globalCtx); + func_809865F8(this, play, sp24); + func_8098680C(this, play); } -void func_809869B0(DemoIm* this, GlobalContext* globalCtx) { +void func_809869B0(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 18; this->actor.shape.shadowAlpha = 0; } -s32 func_809869F8(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_809869F8(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerPosX = player->actor.world.pos.x; f32 thisPosX = this->actor.world.pos.x; @@ -840,42 +840,42 @@ s32 func_809869F8(DemoIm* this, GlobalContext* globalCtx) { } } -s32 func_80986A5C(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80986A5C(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerPosX = player->actor.world.pos.x; f32 thisPosX = this->actor.world.pos.x; - if ((thisPosX - (kREG(17) + 130.0f) < playerPosX) && (!Gameplay_InCsMode(globalCtx))) { + if ((thisPosX - (kREG(17) + 130.0f) < playerPosX) && (!Play_InCsMode(play))) { return true; } else { return false; } } -s32 func_80986AD0(DemoIm* this, GlobalContext* globalCtx) { +s32 func_80986AD0(DemoIm* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.textId = 0x708E; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { return true; } return false; } -void func_80986B2C(GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { - Player* player = GET_PLAYER(globalCtx); +void func_80986B2C(PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { + Player* player = GET_PLAYER(play); - globalCtx->nextEntranceIndex = 0xCD; - globalCtx->fadeTransition = 38; - globalCtx->sceneLoadFlag = 0x14; - func_8002DF54(globalCtx, &player->actor, 8); + play->nextEntranceIndex = 0xCD; + play->fadeTransition = 38; + play->sceneLoadFlag = 0x14; + func_8002DF54(play, &player->actor, 8); } } -void func_80986BA0(DemoIm* this, GlobalContext* globalCtx) { - if (func_809869F8(this, globalCtx)) { +void func_80986BA0(DemoIm* this, PlayState* play) { + if (func_809869F8(this, play)) { this->action = 21; this->drawConfig = 1; this->unk_280 = 1; @@ -889,7 +889,7 @@ void func_80986BE4(DemoIm* this, s32 arg1) { } } -void func_80986BF8(DemoIm* this, GlobalContext* globalCtx) { +void func_80986BF8(DemoIm* this, PlayState* play) { if (gSaveContext.eventChkInf[4] & 1) { this->action = 24; this->drawConfig = 1; @@ -898,33 +898,33 @@ void func_80986BF8(DemoIm* this, GlobalContext* globalCtx) { } } -void GivePlayerRandoRewardImpa(Actor* impa, GlobalContext* globalCtx, RandomizerCheck check) { +void GivePlayerRandoRewardImpa(Actor* impa, PlayState* play, RandomizerCheck check) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_ZELDAS_LULLABY); - if (impa->parent != NULL && impa->parent->id == GET_PLAYER(globalCtx)->actor.id && - !Flags_GetTreasure(globalCtx, 0x1F)) { - Flags_SetTreasure(globalCtx, 0x1F); - } else if (!Flags_GetTreasure(globalCtx, 0x1F) && !Randomizer_GetSettingValue(RSK_SKIP_CHILD_ZELDA)) { - GiveItemEntryFromActor(impa, globalCtx, getItemEntry, 75.0f, 50.0f); - } else if (!Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) { + if (impa->parent != NULL && impa->parent->id == GET_PLAYER(play)->actor.id && + !Flags_GetTreasure(play, 0x1F)) { + Flags_SetTreasure(play, 0x1F); + } else if (!Flags_GetTreasure(play, 0x1F) && !Randomizer_GetSettingValue(RSK_SKIP_CHILD_ZELDA)) { + GiveItemEntryFromActor(impa, play, getItemEntry, 75.0f, 50.0f); + } else if (!Player_InBlockingCsMode(play, GET_PLAYER(play))) { gSaveContext.eventChkInf[5] |= 0x200; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; - globalCtx->nextEntranceIndex = 0x0594; + play->nextEntranceIndex = 0x0594; gSaveContext.nextCutsceneIndex = 0; } } -void func_80986C30(DemoIm* this, GlobalContext* globalCtx) { - if (func_80986A5C(this, globalCtx)) { +void func_80986C30(DemoIm* this, PlayState* play) { + if (func_80986A5C(this, play)) { if (gSaveContext.n64ddFlag) { - GivePlayerRandoRewardImpa(this, globalCtx, RC_SONG_FROM_IMPA); + GivePlayerRandoRewardImpa(this, play, RC_SONG_FROM_IMPA); } else { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardLullabyCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardLullabyCs); gSaveContext.cutsceneTrigger = 1; gSaveContext.eventChkInf[5] |= 0x200; - Item_Give(globalCtx, ITEM_SONG_LULLABY); + Item_Give(play, ITEM_SONG_LULLABY); func_80985F54(this); } } @@ -939,14 +939,14 @@ void func_80986CC8(DemoIm* this) { } } -void func_80986CFC(DemoIm* this, GlobalContext* globalCtx) { - if (func_80986A5C(this, globalCtx)) { +void func_80986CFC(DemoIm* this, PlayState* play) { + if (func_80986A5C(this, play)) { gSaveContext.eventChkInf[4] |= 0x1000; this->action = 19; } } -void func_80986D40(DemoIm* this, GlobalContext* globalCtx) { +void func_80986D40(DemoIm* this, PlayState* play) { if (gSaveContext.sceneSetupIndex == 6) { this->action = 19; this->drawConfig = 1; @@ -959,64 +959,64 @@ void func_80986D40(DemoIm* this, GlobalContext* globalCtx) { } } -void func_80986DC8(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986DC8(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); + func_80984E58(this, play); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } -void func_80986E20(DemoIm* this, GlobalContext* globalCtx) { - func_80986BA0(this, globalCtx); +void func_80986E20(DemoIm* this, PlayState* play) { + func_80986BA0(this, play); } -void func_80986E40(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986E40(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); - DemoIm_UpdateCollider(this, globalCtx); - func_80986BE4(this, func_80986AD0(this, globalCtx)); + func_80984E58(this, play); + DemoIm_UpdateCollider(this, play); + func_80986BE4(this, func_80986AD0(this, play)); } -void func_80986EAC(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986EAC(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984F94(this, globalCtx); - DemoIm_UpdateCollider(this, globalCtx); - func_80986B2C(globalCtx); + func_80984F94(this, play); + DemoIm_UpdateCollider(this, play); + func_80986B2C(play); } -void func_80986F08(DemoIm* this, GlobalContext* globalCtx) { - func_80986BF8(this, globalCtx); +void func_80986F08(DemoIm* this, PlayState* play) { + func_80986BF8(this, play); } -void func_80986F28(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986F28(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); - DemoIm_UpdateCollider(this, globalCtx); - func_80986C30(this, globalCtx); + func_80984E58(this, play); + DemoIm_UpdateCollider(this, play); + func_80986C30(this, play); } -void func_80986F88(DemoIm* this, GlobalContext* globalCtx) { +void func_80986F88(DemoIm* this, PlayState* play) { func_80986CC8(this); } -void func_80986FA8(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986FA8(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); + func_80984E58(this, play); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); - DemoIm_UpdateCollider(this, globalCtx); - func_80986CFC(this, globalCtx); + DemoIm_UpdateCollider(this, play); + func_80986CFC(this, play); } -void func_80987018(DemoIm* this, GlobalContext* globalCtx) { +void func_80987018(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 27; this->drawConfig = 0; @@ -1038,8 +1038,8 @@ void func_80987064(DemoIm* this) { } } -void func_809870F0(DemoIm* this, GlobalContext* globalCtx) { - func_80985200(this, globalCtx, 5); +void func_809870F0(DemoIm* this, PlayState* play) { + func_80985200(this, play, 5); this->action = 28; this->drawConfig = 2; } @@ -1062,8 +1062,8 @@ void func_809871B4(DemoIm* this, s32 arg1) { } } -void func_809871E8(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_809871E8(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -1072,7 +1072,7 @@ void func_809871E8(DemoIm* this, GlobalContext* globalCtx) { if (action != unk_274) { switch (action) { case 12: - func_809870F0(this, globalCtx); + func_809870F0(this, play); break; case 13: func_80987174(this); @@ -1085,78 +1085,78 @@ void func_809871E8(DemoIm* this, GlobalContext* globalCtx) { } } -void func_80987288(DemoIm* this, GlobalContext* globalCtx) { - func_809871E8(this, globalCtx); +void func_80987288(DemoIm* this, PlayState* play) { + func_809871E8(this, play); } -void func_809872A8(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809872A8(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_80987064(this); func_80987128(this); } -void func_809872F0(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809872F0(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809871E8(this, globalCtx); + func_809871E8(this, play); } -void func_80987330(DemoIm* this, GlobalContext* globalCtx) { +void func_80987330(DemoIm* this, PlayState* play) { s32 sp1C; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp1C = DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_809871B4(this, sp1C); } -void DemoIm_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_Update(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; if ((this->action < 0) || (this->action >= 31) || (sActionFuncs[this->action] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void DemoIm_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_Init(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - DemoIm_InitCollider(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gImpaSkel, NULL, this->jointTable, this->morphTable, 17); + DemoIm_InitCollider(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gImpaSkel, NULL, this->jointTable, this->morphTable, 17); thisx->flags &= ~ACTOR_FLAG_0; switch (this->actor.params) { case 2: - func_80985860(this, globalCtx); + func_80985860(this, play); break; case 3: - func_80985E60(this, globalCtx); + func_80985E60(this, play); break; case 4: - func_8098652C(this, globalCtx); + func_8098652C(this, play); break; case 5: - func_809869B0(this, globalCtx); + func_809869B0(this, play); break; case 6: - func_80987018(this, globalCtx); + func_80987018(this, play); break; default: - func_80985310(this, globalCtx); + func_80985310(this, play); } } -void DemoIm_Destroy(Actor* thisx, GlobalContext* globalCtx) { - DemoIm_DestroyCollider(thisx, globalCtx); +void DemoIm_Destroy(Actor* thisx, PlayState* play) { + DemoIm_DestroyCollider(thisx, play); } -s32 DemoIm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 DemoIm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { DemoIm* this = (DemoIm*)thisx; s32* unk_2D0 = &this->unk_2D0; @@ -1183,7 +1183,7 @@ s32 DemoIm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void DemoIm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void DemoIm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { DemoIm* this = (DemoIm*)thisx; if (limbIndex == IMPA_LIMB_HEAD) { @@ -1200,36 +1200,36 @@ void DemoIm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void DemoIm_DrawNothing(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_DrawNothing(DemoIm* this, PlayState* play) { } -void DemoIm_DrawSolid(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_DrawSolid(DemoIm* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTexture = sEyeTextures[eyeIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoIm_OverrideLimbDraw, DemoIm_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoIm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_Draw(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; if ((this->drawConfig < 0) || (this->drawConfig >= 3) || (sDrawFuncs[this->drawConfig] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.h b/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.h index 12e898e27..97192b39a 100644 --- a/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.h +++ b/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.h @@ -6,8 +6,8 @@ struct DemoIm; -typedef void (*DemoImActionFunc)(struct DemoIm*, GlobalContext*); -typedef void (*DemoImDrawFunc)(struct DemoIm*, GlobalContext*); +typedef void (*DemoImActionFunc)(struct DemoIm*, PlayState*); +typedef void (*DemoImDrawFunc)(struct DemoIm*, PlayState*); typedef enum { /* 0x00 */ IMPA_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 637a4d0f1..e9b557f1e 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -7,26 +7,26 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoKankyo_Init(Actor* thisx, PlayState* play); +void DemoKankyo_Destroy(Actor* thisx, PlayState* play); +void DemoKankyo_Update(Actor* thisx, PlayState* play); +void DemoKankyo_Draw(Actor* thisx, PlayState* play); -void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_UpdateClouds(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_UpdateRock(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_DoNothing2(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_DoNothing(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, GlobalContext* globalCtx); +void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play); +void DemoKankyo_UpdateClouds(DemoKankyo* this, PlayState* play); +void DemoKankyo_UpdateRock(DemoKankyo* this, PlayState* play); +void DemoKankyo_DoNothing2(DemoKankyo* this, PlayState* play); +void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, PlayState* play); +void DemoKankyo_DoNothing(DemoKankyo* this, PlayState* play); +void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, PlayState* play); -void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawRock(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawDoorOfTime(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawLightPlane(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx); +void DemoKankyo_DrawRain(Actor* thisx, PlayState* play); +void DemoKankyo_DrawRock(Actor* thisx, PlayState* play); +void DemoKankyo_DrawClouds(Actor* thisx, PlayState* play); +void DemoKankyo_DrawDoorOfTime(Actor* thisx, PlayState* play); +void DemoKankyo_DrawLightPlane(Actor* thisx, PlayState* play); +void DemoKankyo_DrawWarpSparkles(Actor* thisx, PlayState* play); +void DemoKankyo_DrawSparkles(Actor* thisx, PlayState* play); // adult warp songs cutscenes extern CutsceneData gAdultWarpInCS[]; @@ -180,10 +180,10 @@ void DemoKankyo_SetupAction(DemoKankyo* this, DemoKankyoActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Init(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s16 i; - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjIds[this->actor.params]); + s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjIds[this->actor.params]); osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { @@ -195,9 +195,9 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case DEMOKANKYO_BLUE_RAIN: case DEMOKANKYO_BLUE_RAIN_2: - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_HIRAL_DEMO: - globalCtx->roomCtx.curRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; D_8098CF80 = 10; sRainScale = 8; break; @@ -219,7 +219,7 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { case DEMOKANKYO_ROCK_3: case DEMOKANKYO_ROCK_4: case DEMOKANKYO_ROCK_5: - globalCtx->roomCtx.curRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = Rand_ZeroOne() * 0.5f + 0.5f; this->unk_150[0].unk_0.x = Rand_ZeroOne() * 3.0f + 1.0f; this->unk_150[0].unk_0.y = Rand_ZeroOne() * 3.0f + 1.0f; @@ -235,11 +235,11 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 1.0f; this->unk_150[0].unk_18 = 0.0f; if (!(gSaveContext.eventChkInf[4] & 0x800)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_TOKI, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_TOKI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x0000); } else { - globalCtx->roomCtx.unk_74[1] = 0xFF; + play->roomCtx.unk_74[1] = 0xFF; Actor_Kill(&this->actor); } break; @@ -249,7 +249,7 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { break; case DEMOKANKYO_WARP_OUT: case DEMOKANKYO_WARP_IN: - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); this->actor.flags |= ACTOR_FLAG_25; this->actor.room = -1; this->warpTimer = 35; @@ -273,12 +273,12 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { DemoKankyo_SetupAction(this, DemoKankyo_SetupType); } -void DemoKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Destroy(Actor* thisx, PlayState* play) { if (thisx) {} } -void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp; if (this->actor.objBankIndex == this->objBankIndex) { @@ -294,24 +294,24 @@ void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { DemoKankyo_SetupAction(this, DemoKankyo_UpdateClouds); break; case DEMOKANKYO_DOOR_OF_TIME: - if (Flags_GetEnv(globalCtx, 2)) { + if (Flags_GetEnv(play, 2)) { DemoKankyo_SetupAction(this, DemoKankyo_UpdateDoorOfTime); } break; case DEMOKANKYO_WARP_OUT: - globalCtx->envCtx.screenFillColor[0] = 0xFF; - globalCtx->envCtx.screenFillColor[1] = 0xFF; - globalCtx->envCtx.screenFillColor[2] = 0xFF; - globalCtx->envCtx.fillScreen = false; + play->envCtx.screenFillColor[0] = 0xFF; + play->envCtx.screenFillColor[1] = 0xFF; + play->envCtx.screenFillColor[2] = 0xFF; + play->envCtx.fillScreen = false; if (this->warpTimer < 21 && this->warpTimer >= 15) { temp = (this->warpTimer - 15.0f) / 5.0f; - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[3] = 255 - 255 * temp; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[3] = 255 - 255 * temp; } if (this->warpTimer < 15 && this->warpTimer >= 4) { temp = (this->warpTimer - 4.0f) / 10.0f; - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[3] = 255 * temp; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[3] = 255 * temp; } if (this->warpTimer == 15) { player->actor.draw = NULL; @@ -320,39 +320,39 @@ void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { this->warpTimer--; } if (this->warpTimer == 1) { - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { D_8098CF84 = 25; if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpInToTCS; + play->csCtx.segment = gChildWarpInToTCS; } else { - globalCtx->csCtx.segment = gAdultWarpInToTCS; + play->csCtx.segment = gAdultWarpInToTCS; } } else { D_8098CF84 = 32; if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpInCS; + play->csCtx.segment = gChildWarpInCS; } else { - globalCtx->csCtx.segment = gAdultWarpInCS; + play->csCtx.segment = gAdultWarpInCS; } } - if (func_800C0CB8(globalCtx) != 0) { + if (func_800C0CB8(play) != 0) { gSaveContext.cutsceneTrigger = 1; } DemoKankyo_SetupAction(this, DemoKankyo_DoNothing); } break; case DEMOKANKYO_WARP_IN: - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpOutToTCS; + play->csCtx.segment = gChildWarpOutToTCS; } else { - globalCtx->csCtx.segment = gAdultWarpOutToTCS; + play->csCtx.segment = gAdultWarpOutToTCS; } } else { if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpOutCS; + play->csCtx.segment = gChildWarpOutCS; } else { - globalCtx->csCtx.segment = gAdultWarpOutCS; + play->csCtx.segment = gAdultWarpOutCS; } } gSaveContext.cutsceneTrigger = 1; @@ -365,17 +365,17 @@ void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { } } -void DemoKankyo_DoNothing(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_DoNothing(DemoKankyo* this, PlayState* play) { } -void DemoKankyo_DoNothing2(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_DoNothing2(DemoKankyo* this, PlayState* play) { DemoKankyo_SetupAction(this, DemoKankyo_DoNothing); } -void DemoKankyo_SetRockPos(DemoKankyo* this, GlobalContext* globalCtx, s32 params) { +void DemoKankyo_SetRockPos(DemoKankyo* this, PlayState* play, s32 params) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* csAction = globalCtx->csCtx.npcActions[params]; + CsCmdActorAction* csAction = play->csCtx.npcActions[params]; f32 temp_f0; startPos.x = csAction->startPos.x; @@ -384,22 +384,22 @@ void DemoKankyo_SetRockPos(DemoKankyo* this, GlobalContext* globalCtx, s32 param endPos.x = csAction->endPos.x; endPos.y = csAction->endPos.y; endPos.z = csAction->endPos.z; - temp_f0 = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, globalCtx->csCtx.frames); + temp_f0 = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, play->csCtx.frames); this->actor.world.pos.x = ((endPos.x - startPos.x) * temp_f0) + startPos.x; this->actor.world.pos.y = ((endPos.y - startPos.y) * temp_f0) + startPos.y; this->actor.world.pos.z = ((endPos.z - startPos.z) * temp_f0) + startPos.z; } -void DemoKankyo_UpdateRock(DemoKankyo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->actor.params - 2] != NULL) { - DemoKankyo_SetRockPos(this, globalCtx, this->actor.params - 2); +void DemoKankyo_UpdateRock(DemoKankyo* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->actor.params - 2] != NULL) { + DemoKankyo_SetRockPos(this, play, this->actor.params - 2); } this->unk_150[0].unk_C.x += this->unk_150[0].unk_0.x; this->unk_150[0].unk_C.y += this->unk_150[0].unk_0.y; this->unk_150[0].unk_C.z += this->unk_150[0].unk_0.z; } -void DemoKankyo_UpdateClouds(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_UpdateClouds(DemoKankyo* this, PlayState* play) { u8 i; for (i = 0; i < 30; i++) { @@ -407,7 +407,7 @@ void DemoKankyo_UpdateClouds(DemoKankyo* this, GlobalContext* globalCtx) { } } -void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_STONE_STATUE_OPEN - SFX_FLAG); this->unk_150[0].unk_18 += 1.0f; if (this->unk_150[0].unk_18 >= 102.0f) { @@ -418,76 +418,76 @@ void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, GlobalContext* globalCtx) { } } -void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, PlayState* play) { Actor_Kill(this->actor.child); } -void DemoKankyo_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Update(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DemoKankyo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Draw(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; if (this->actor.objBankIndex == this->objBankIndex) { switch (this->actor.params) { case DEMOKANKYO_BLUE_RAIN: case DEMOKANKYO_BLUE_RAIN_2: - if (globalCtx->sceneNum == SCENE_TOKINOMA) { - if (!Flags_GetEnv(globalCtx, 1)) { + if (play->sceneNum == SCENE_TOKINOMA) { + if (!Flags_GetEnv(play, 1)) { break; } else if (!Actor_IsFacingAndNearPlayer(&this->actor, 300.0f, 0x7530)) { break; } else { if (!LINK_IS_ADULT) { - if (globalCtx->csCtx.frames < 170 || globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.frames < 170 || play->csCtx.state == CS_STATE_IDLE) { break; } } else { - if (globalCtx->csCtx.frames < 120 || globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.frames < 120 || play->csCtx.state == CS_STATE_IDLE) { break; } } } } - DemoKankyo_DrawRain(thisx, globalCtx); + DemoKankyo_DrawRain(thisx, play); break; case DEMOKANKYO_ROCK_1: case DEMOKANKYO_ROCK_2: case DEMOKANKYO_ROCK_3: case DEMOKANKYO_ROCK_4: case DEMOKANKYO_ROCK_5: - DemoKankyo_DrawRock(thisx, globalCtx); + DemoKankyo_DrawRock(thisx, play); break; case DEMOKANKYO_CLOUDS: - DemoKankyo_DrawClouds(thisx, globalCtx); + DemoKankyo_DrawClouds(thisx, play); break; case DEMOKANKYO_DOOR_OF_TIME: - DemoKankyo_DrawDoorOfTime(thisx, globalCtx); + DemoKankyo_DrawDoorOfTime(thisx, play); break; case DEMOKANKYO_LIGHT_PLANE: - DemoKankyo_DrawLightPlane(thisx, globalCtx); + DemoKankyo_DrawLightPlane(thisx, play); break; case DEMOKANKYO_WARP_OUT: case DEMOKANKYO_WARP_IN: - DemoKankyo_DrawWarpSparkles(thisx, globalCtx); + DemoKankyo_DrawWarpSparkles(thisx, play); break; case DEMOKANKYO_SPARKLES: - DemoKankyo_DrawSparkles(thisx, globalCtx); + DemoKankyo_DrawSparkles(thisx, play); break; } } - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; } } // transform relating to blue rain -void func_80989B54(Actor* thisx, GlobalContext* globalCtx, s16 i) { +void func_80989B54(Actor* thisx, PlayState* play, s16 i) { DemoKankyo* this = (DemoKankyo*)thisx; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_HIRAL_DEMO: this->unk_150[i].unk_0.x = (Rand_ZeroOne() - 0.5f) * 500.0f; this->unk_150[i].unk_0.y = 500.0f; @@ -510,7 +510,7 @@ void func_80989B54(Actor* thisx, GlobalContext* globalCtx, s16 i) { this->unk_150[i].unk_18 = Rand_ZeroOne() * (D_8098CF80 * 4.0f) + D_8098CF80; } -void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawRain(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; f32 temp_f12_2; s16 i; @@ -523,25 +523,25 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { f32 translateZ; s16 j; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < 30; i++) { s32 pad[2]; - dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + dx = play->view.lookAt.x - play->view.eye.x; + dy = play->view.lookAt.y - play->view.eye.y; + dz = play->view.lookAt.z - play->view.eye.z; norm = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); - if (globalCtx->sceneNum != SCENE_TOKINOMA) { - this->unk_150[i].unk_C.x = globalCtx->view.eye.x + (dx / norm) * 350.0f; - this->unk_150[i].unk_C.y = globalCtx->view.eye.y + (dy / norm) * 80.0f; - this->unk_150[i].unk_C.z = globalCtx->view.eye.z + (dz / norm) * 350.0f; + if (play->sceneNum != SCENE_TOKINOMA) { + this->unk_150[i].unk_C.x = play->view.eye.x + (dx / norm) * 350.0f; + this->unk_150[i].unk_C.y = play->view.eye.y + (dy / norm) * 80.0f; + this->unk_150[i].unk_C.z = play->view.eye.z + (dz / norm) * 350.0f; } switch (this->unk_150[i].unk_22) { case 0: - func_80989B54(thisx, globalCtx, i); + func_80989B54(thisx, play, i); if (gSaveContext.entranceIndex == 0x00A0) { // Cutscene Map this->unk_150[i].unk_0.y = Rand_ZeroOne() * 500.0f; } else { @@ -550,7 +550,7 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { this->unk_150[i].unk_22++; break; case 1: - temp_f12_2 = globalCtx->view.eye.y + (dy / norm) * 150.0f; + temp_f12_2 = play->view.eye.y + (dy / norm) * 150.0f; if (gSaveContext.entranceIndex == 0x00A0) { // Cutscene Map this->unk_150[i].unk_0.y -= this->unk_150[i].unk_18; } else { @@ -571,7 +571,7 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { } break; case 2: - func_80989B54(thisx, globalCtx, i); + func_80989B54(thisx, play, i); this->unk_150[i].unk_22--; break; } @@ -599,7 +599,7 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { s32 pad1; - if (globalCtx->sceneNum != SCENE_TOKINOMA) { + if (play->sceneNum != SCENE_TOKINOMA) { if (this->unk_150[i].unk_0.x >= 0.0f) { translateX = -j * 1500.0f; } else { @@ -622,7 +622,7 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Translate(translateX, translateY, translateZ, 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); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPDisplayList(POLY_XLU_DISP++, object_efc_star_field_DL_000080); @@ -630,16 +630,16 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoKankyo_DrawRock(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawRock(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateX(DEG_TO_RAD(this->unk_150[0].unk_C.x), MTXMODE_APPLY); Matrix_RotateY(DEG_TO_RAD(this->unk_150[0].unk_C.y), MTXMODE_APPLY); @@ -647,14 +647,14 @@ void DemoKankyo_DrawRock(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255); gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawClouds(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s16 i; s32 pad; @@ -662,7 +662,7 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { f32 dy; f32 dz; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < 30; i++) { FrameInterpolation_RecordOpenChild("Kankyo Clouds", i); @@ -671,8 +671,8 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { dy = Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 5.0f + 1200.0f; dz = (Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 120.0f) * (30.0f + (i / 30.0f) * 10.0f); - Matrix_Translate(globalCtx->view.eye.x + dx, globalCtx->view.eye.y + dy + ((i - 12.0f) * 300.0f), - globalCtx->view.eye.z + dz, MTXMODE_NEW); + Matrix_Translate(play->view.eye.x + dx, play->view.eye.y + dy + ((i - 12.0f) * 300.0f), + play->view.eye.z + dz, MTXMODE_NEW); Matrix_Scale(125.0f, 60.0f, 125.0f, MTXMODE_APPLY); gDPPipeSync(POLY_XLU_DISP++); @@ -680,11 +680,11 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 255); gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); gDPSetColorDither(POLY_XLU_DISP++, G_AD_NOTPATTERN | G_CD_MAGICSQ); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDust5Tex)); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffDustDL); @@ -692,45 +692,45 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoKankyo_DrawDoorOfTime(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawDoorOfTime(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(-this->unk_150[0].unk_18, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_007440); Matrix_Translate(this->unk_150[0].unk_18 + this->unk_150[0].unk_18, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_007578); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoKankyo_DrawLightPlane(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawLightPlane(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (globalCtx->csCtx.state == CS_STATE_IDLE || gSaveContext.sceneSetupIndex >= 4) { - func_80093D84(globalCtx->state.gfxCtx); + if (play->csCtx.state == CS_STATE_IDLE || gSaveContext.sceneSetupIndex >= 4) { + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames & 0x7F, 64, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TexScroll(play->state.gfxCtx, 0, play->state.frames & 0x7F, 64, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_008390); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void DemoKankyo_Vec3fCopy(Vec3f* src, Vec3f* dst) { @@ -761,7 +761,7 @@ void DemoKankyo_Vec3fAddPosRot(PosRot* posRot, Vec3f* vec, Vec3f* dst) { DemoKankyo_Vec3fAddVecSph(dst, &posRot->pos, &sph); } -void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawWarpSparkles(Actor* thisx, PlayState* play) { static f32 sWarpRoll; static f32 sWarpFoV; // the following 2 vars are unused @@ -773,7 +773,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { f32 temp_f22; DemoKankyo* this = (DemoKankyo*)thisx; Gfx* disp; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f camPos; f32 translateX; f32 translateY; @@ -781,7 +781,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { PosRot posRot; u8 linkAge = gSaveContext.linkAge; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->sparkleCounter < 30) { this->sparkleCounter += 2; @@ -813,7 +813,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { &this->unk_150[i].unk_1C) != 0) { this->unk_150[i].unk_22++; } - if (globalCtx->sceneNum == SCENE_TOKINOMA && globalCtx->csCtx.frames == 25) { + if (play->sceneNum == SCENE_TOKINOMA && play->csCtx.frames == 25) { this->unk_150[i].unk_22++; } } else { @@ -823,7 +823,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { &this->unk_150[i].unk_1C) != 0) { this->unk_150[i].unk_22++; } - if (D_8098CF84 < globalCtx->csCtx.frames && this->actor.params == DEMOKANKYO_WARP_OUT) { + if (D_8098CF84 < play->csCtx.frames && this->actor.params == DEMOKANKYO_WARP_OUT) { this->unk_150[i].unk_22++; } } @@ -833,11 +833,11 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { case 2: if (this->actor.params == DEMOKANKYO_WARP_OUT) { if (i == 0) { - Environment_WarpSongLeave(globalCtx); + Environment_WarpSongLeave(play); this->unk_150[i].unk_22++; } - } else if (i + 1 == this->sparkleCounter && globalCtx->csCtx.state == CS_STATE_IDLE) { - func_80088AF0(globalCtx); + } else if (i + 1 == this->sparkleCounter && play->csCtx.state == CS_STATE_IDLE) { + func_80088AF0(play); Actor_Kill(&this->actor); } break; @@ -885,19 +885,19 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { this->unk_150[i].unk_18 * (0.018f * temp_f22), MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); if (this->actor.params == DEMOKANKYO_WARP_OUT) { - gDPSetEnvColor(POLY_XLU_DISP++, sWarpSparkleEnvColors[globalCtx->msgCtx.lastPlayedSong].r, - sWarpSparkleEnvColors[globalCtx->msgCtx.lastPlayedSong].g, - sWarpSparkleEnvColors[globalCtx->msgCtx.lastPlayedSong].b, 255); + gDPSetEnvColor(POLY_XLU_DISP++, sWarpSparkleEnvColors[play->msgCtx.lastPlayedSong].r, + sWarpSparkleEnvColors[play->msgCtx.lastPlayedSong].g, + sWarpSparkleEnvColors[play->msgCtx.lastPlayedSong].b, 255); } else { s8 respawnData = gSaveContext.respawn[1].data; gDPSetEnvColor(POLY_XLU_DISP++, sWarpSparkleEnvColors[respawnData].r, sWarpSparkleEnvColors[respawnData].g, sWarpSparkleEnvColors[respawnData].b, 255); } - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(this->unk_150[i].unk_24), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, disp); this->unk_150[i].unk_24 += 0x190; @@ -906,10 +906,10 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawSparkles(Actor* thisx, PlayState* play) { static f32 sSparklesRoll; static f32 sSparklesFoV; // the following 3 vars are unused @@ -928,7 +928,7 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { s16 i; PosRot posRot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->sparkleCounter < 20) { this->sparkleCounter++; @@ -957,7 +957,7 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { DemoKankyo_Vec3fAddPosRot(&posRot, &camPos, &D_8098CFB8); break; case 2: - if (i + 1 == this->sparkleCounter && globalCtx->csCtx.state == CS_STATE_IDLE) { + if (i + 1 == this->sparkleCounter && play->csCtx.state == CS_STATE_IDLE) { Actor_Kill(&this->actor); } break; @@ -1000,10 +1000,10 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, sSparkleEnvColors[3].r, sSparkleEnvColors[3].g, sSparkleEnvColors[3].b, 255); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(this->unk_150[i].unk_24), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); this->unk_150[i].unk_24 += 0x190; @@ -1012,5 +1012,5 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h index efc63ab73..89ad474b3 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h +++ b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h @@ -6,7 +6,7 @@ struct DemoKankyo; -typedef void (*DemoKankyoActionFunc)(struct DemoKankyo*, GlobalContext*); +typedef void (*DemoKankyoActionFunc)(struct DemoKankyo*, PlayState*); typedef enum { /* 0x00 */ DEMOKANKYO_BLUE_RAIN, diff --git a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index b2dc185d7..764529bf7 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_DrawTowerBarrier(Actor* thisx, GlobalContext* globalCtx); +void DemoKekkai_Init(Actor* thisx, PlayState* play); +void DemoKekkai_Destroy(Actor* thisx, PlayState* play); +void DemoKekkai_Update(Actor* thisx, PlayState* play); +void DemoKekkai_DrawTowerBarrier(Actor* thisx, PlayState* play); void DemoKekkai_Reset(void); -void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_TrialBarrierIdle(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx); +void DemoKekkai_TrialBarrierDispel(Actor* thisx, PlayState* play); +void DemoKekkai_TrialBarrierIdle(Actor* thisx, PlayState* play); +void DemoKekkai_DrawTrialBarrier(Actor* thisx, PlayState* play); -void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx); +void DemoKekkai_TowerBarrier(DemoKekkai* this, PlayState* play); const ActorInit Demo_Kekkai_InitVars = { ACTOR_DEMO_KEKKAI, @@ -124,7 +124,7 @@ u32 TrialsDoneCount() { return trialCount; } -void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_Init(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; @@ -132,10 +132,10 @@ void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx) { this->energyAlpha = 1.0f; Actor_SetScale(thisx, 0.1f); thisx->colChkInfo.mass = MASS_IMMOVABLE; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinder(globalCtx, &this->collider1, thisx, &sCylinderInit); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinder(globalCtx, &this->collider2, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinder(play, &this->collider1, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinder(play, &this->collider2, thisx, &sCylinderInit); Collider_UpdateCylinder(thisx, &this->collider1); Collider_UpdateCylinder(thisx, &this->collider2); this->timer = 0; @@ -180,22 +180,22 @@ void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx) { } if (DemoKekkai_CheckEventFlag(thisx->params)) { if (thisx->params == KEKKAI_TOWER) { - globalCtx->envCtx.unk_BF = 1; + play->envCtx.unk_BF = 1; } Actor_Kill(thisx); } } -void DemoKekkai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_Destroy(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } Vec3f demoKekkaiVel = { 0.0f, 0.0f, 0.0f }; -void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) { +void DemoKekkai_SpawnParticles(DemoKekkai* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 lightYellow = { 255, 255, 170, 0 }; static Color_RGBA8 darkRed = { 200, 0, 0, 0 }; @@ -214,14 +214,14 @@ void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) { pos.y = (demoKekkaiVel.y * 20.0f) + this->actor.world.pos.y + 120.0f; pos.z = (demoKekkaiVel.z * 7.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &demoKekkaiVel, &accel, &lightYellow, &darkRed, 3000, + EffectSsKiraKira_SpawnFocused(play, &pos, &demoKekkaiVel, &accel, &lightYellow, &darkRed, 3000, (s32)Rand_ZeroFloat(40.0f) + 45); } } -void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[0] != NULL) && - (globalCtx->csCtx.npcActions[0]->action != 1) && (globalCtx->csCtx.npcActions[0]->action == 2)) { +void DemoKekkai_TowerBarrier(DemoKekkai* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL) && + (play->csCtx.npcActions[0]->action != 1) && (play->csCtx.npcActions[0]->action == 2)) { if (!(this->sfxFlag & 1)) { func_800F3F3C(0xC); this->sfxFlag |= 1; @@ -244,27 +244,27 @@ void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx) { } } -void DemoKekkai_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoKekkai_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoKekkai* this = (DemoKekkai*)thisx; if (this->energyAlpha > 0.99f) { if ((this->collider1.base.atFlags & AT_HIT) || (this->collider2.base.atFlags & AT_HIT)) { - func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); this->barrierScroll += this->barrierScrollRate; if (this->barrierScroll > 65536.0f) { this->barrierScroll -= 65536.0f; } } -void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_TrialBarrierDispel(Actor* thisx, PlayState* play) { static s32 eventFlags[] = { 0xC3, 0xBC, 0xBF, 0xBE, 0xBD, 0xAD, 0xBB }; static u16 csFrames[] = { 0, 280, 280, 280, 280, 280, 280 }; s32 pad; @@ -277,7 +277,7 @@ void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx) { Flags_SetEventChkInf(eventFlags[thisx->params]); } - if (globalCtx->csCtx.frames == csFrames[this->actor.params]) { + if (play->csCtx.frames == csFrames[this->actor.params]) { func_800F3F3C(0xA); } if (this->energyAlpha >= 0.05f) { @@ -291,7 +291,7 @@ void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx) { this->orbScale = 2.0f; } else if (this->timer == 50) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); - DemoKekkai_SpawnParticles(this, globalCtx); + DemoKekkai_SpawnParticles(this, play); } else { this->orbScale = 0.0f; } @@ -311,31 +311,31 @@ static CutsceneData* sSageCutscenes[] = { gForestTrialSageCs, }; -void DemoKekkai_TrialBarrierIdle(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_TrialBarrierIdle(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; if (this->collider1.base.atFlags & AT_HIT) { - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 5.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 5.0f); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (this->collider2.base.acFlags & AC_HIT) { func_80078884(NA_SE_SY_CORRECT_CHIME); // "I got it" LOG_STRING("当ったよ"); this->actor.update = DemoKekkai_TrialBarrierDispel; this->timer = 0; - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); gSaveContext.cutsceneTrigger = 1; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); func_8002F974(&this->actor, NA_SE_EV_TOWER_ENERGY - SFX_FLAG); } -void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; - s32 frames = globalCtx->gameplayFrames & 0xFFFF; +void DemoKekkai_DrawTrialBarrier(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + s32 frames = play->gameplayFrames & 0xFFFF; u8 alphaIndex[102] = { 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -355,25 +355,25 @@ void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx2) { energyVtx[i].v.cn[3] = alphas[alphaIndex[i]]; } colorIndex = (this->actor.params - 1) * 6; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(0.0f, 1200.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(this->orbScale, this->orbScale, this->orbScale, MTXMODE_APPLY); Matrix_Translate(0.0f, -1200.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, frames * -10, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierOrbDL); Matrix_Pop(); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, 0x00, 0x80, 50, 0, 100, 255); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierFloorDL); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, sEnergyColors[colorIndex + 0], sEnergyColors[colorIndex + 1], @@ -381,29 +381,29 @@ void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, sEnergyColors[colorIndex + 3], sEnergyColors[colorIndex + 4], sEnergyColors[colorIndex + 5], 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, frames * -10, 0x20, 0x40)); gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierEnergyDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void DemoKekkai_DrawTowerBarrier(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_DrawTowerBarrier(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; s32 scroll; scroll = (s32)this->barrierScroll & 0xFFFF; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(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++, 0x00, 0x80, 255, 170, 255, 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * -4, 0x20, 0x40, 1, scroll * 2, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * -4, 0x20, 0x40, 1, scroll * 2, scroll * -4, 0x20, 0x40)); gSPDisplayList(POLY_XLU_DISP++, gTowerBarrierDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void DemoKekkai_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h index b8e85058d..c6711097e 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h +++ b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h @@ -6,7 +6,7 @@ struct DemoKekkai; -typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, GlobalContext* globalCtx); +typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, PlayState* play); typedef struct DemoKekkai { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index b4bb5f0ee..ec9c2b812 100644 --- a/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -13,36 +13,36 @@ #define FLAGS ACTOR_FLAG_4 -void DemoSa_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoSa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoSa_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoSa_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoSa_Init(Actor* thisx, PlayState* play); +void DemoSa_Destroy(Actor* thisx, PlayState* play); +void DemoSa_Update(Actor* thisx, PlayState* play); +void DemoSa_Draw(Actor* thisx, PlayState* play); -void func_8098EBB8(DemoSa* this, GlobalContext* globalCtx); -void func_8098EBD8(DemoSa* this, GlobalContext* globalCtx); -void func_8098EBF8(DemoSa* this, GlobalContext* globalCtx); -void func_8098EC28(DemoSa* this, GlobalContext* globalCtx); -void func_8098EC60(DemoSa* this, GlobalContext* globalCtx); -void func_8098EC94(DemoSa* this, GlobalContext* globalCtx); -void func_8098ECCC(DemoSa* this, GlobalContext* globalCtx); -void func_8098F0E8(DemoSa* this, GlobalContext* globalCtx); -void func_8098F118(DemoSa* this, GlobalContext* globalCtx); -void func_8098F16C(DemoSa* this, GlobalContext* globalCtx); -void func_8098F3F0(DemoSa* this, GlobalContext* globalCtx); -void func_8098F714(DemoSa* this, GlobalContext* globalCtx); -void func_8098F734(DemoSa* this, GlobalContext* globalCtx); -void func_8098F77C(DemoSa* this, GlobalContext* globalCtx); -void func_8098F7BC(DemoSa* this, GlobalContext* globalCtx); -void func_8098F7FC(DemoSa* this, GlobalContext* globalCtx); -void func_8098FC44(DemoSa* this, GlobalContext* globalCtx); -void func_8098FC64(DemoSa* this, GlobalContext* globalCtx); -void func_8098FC9C(DemoSa* this, GlobalContext* globalCtx); -void func_8098FCD4(DemoSa* this, GlobalContext* globalCtx); -void func_8098FD0C(DemoSa* this, GlobalContext* globalCtx); +void func_8098EBB8(DemoSa* this, PlayState* play); +void func_8098EBD8(DemoSa* this, PlayState* play); +void func_8098EBF8(DemoSa* this, PlayState* play); +void func_8098EC28(DemoSa* this, PlayState* play); +void func_8098EC60(DemoSa* this, PlayState* play); +void func_8098EC94(DemoSa* this, PlayState* play); +void func_8098ECCC(DemoSa* this, PlayState* play); +void func_8098F0E8(DemoSa* this, PlayState* play); +void func_8098F118(DemoSa* this, PlayState* play); +void func_8098F16C(DemoSa* this, PlayState* play); +void func_8098F3F0(DemoSa* this, PlayState* play); +void func_8098F714(DemoSa* this, PlayState* play); +void func_8098F734(DemoSa* this, PlayState* play); +void func_8098F77C(DemoSa* this, PlayState* play); +void func_8098F7BC(DemoSa* this, PlayState* play); +void func_8098F7FC(DemoSa* this, PlayState* play); +void func_8098FC44(DemoSa* this, PlayState* play); +void func_8098FC64(DemoSa* this, PlayState* play); +void func_8098FC9C(DemoSa* this, PlayState* play); +void func_8098FCD4(DemoSa* this, PlayState* play); +void func_8098FD0C(DemoSa* this, PlayState* play); -void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx); -void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx); -void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx); +void DemoSa_DrawNothing(DemoSa* this, PlayState* play); +void DemoSa_DrawOpa(DemoSa* this, PlayState* play); +void DemoSa_DrawXlu(DemoSa* this, PlayState* play); typedef enum { /* 0 */ SARIA_EYE_OPEN, @@ -98,10 +98,10 @@ const ActorInit Demo_Sa_InitVars = { NULL, }; -void DemoSa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Destroy(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void func_8098E480(DemoSa* this) { @@ -136,10 +136,10 @@ void func_8098E530(DemoSa* this) { this->unk_1A0 = 0.0f; } -void func_8098E554(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E554(DemoSa* this, PlayState* play) { u32* something = &D_80990108; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (*something != 0) { if (this->actor.params == 2) { func_8098E530(this); @@ -151,23 +151,23 @@ void func_8098E554(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098E5C8(DemoSa* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void func_8098E5C8(DemoSa* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } s32 DemoSa_UpdateSkelAnime(DemoSa* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* DemoSa_GetNpcAction(GlobalContext* globalCtx, s32 idx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[idx]; +CsCmdActorAction* DemoSa_GetNpcAction(PlayState* play, s32 idx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[idx]; } return NULL; } -s32 func_8098E654(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, arg3); +s32 func_8098E654(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, arg3); if ((npcAction != NULL) && (npcAction->action == arg2)) { return 1; @@ -175,8 +175,8 @@ s32 func_8098E654(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -s32 func_8098E6A0(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, arg3); +s32 func_8098E6A0(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, arg3); if ((npcAction != NULL) && (npcAction->action != arg2)) { return 1; @@ -184,8 +184,8 @@ s32 func_8098E6A0(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -void func_8098E6EC(DemoSa* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, actionIdx); +void func_8098E6EC(DemoSa* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -215,61 +215,61 @@ void func_8098E76C(DemoSa* this, AnimationHeader* animHeaderSeg, u8 arg2, f32 tr Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, unk0, fc, arg2, transitionRate); } -void func_8098E7FC(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); +void func_8098E7FC(DemoSa* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); this->actor.shape.yOffset = -10000.0f; DemoSa_SetEyeIndex(this, SARIA_EYE_HALF); DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED2); } -void func_8098E86C(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E86C(DemoSa* this, PlayState* play) { Vec3f* world = &this->actor.world.pos; f32 posX = world->x; f32 posY = world->y; f32 posZ = world->z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void func_8098E8C8(DemoSa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098E8C8(DemoSa* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 80.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0xB); - Item_Give(globalCtx, ITEM_MEDALLION_FOREST); + Item_Give(play, ITEM_MEDALLION_FOREST); } -void func_8098E944(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E944(DemoSa* this, PlayState* play) { this->actor.shape.yOffset += (250.0f / 3.0f); } -void func_8098E960(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E960(DemoSa* this, PlayState* play) { s32 pad[2]; Player* player; if ((gSaveContext.chamberCutsceneNum == 0) && (gSaveContext.sceneSetupIndex < 4)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->action = 1; - globalCtx->csCtx.segment = D_8099010C; + play->csCtx.segment = D_8099010C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_FOREST); + Item_Give(play, ITEM_MEDALLION_FOREST); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void func_8098E9EC(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E9EC(DemoSa* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[4]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[4]; if ((npcAction != NULL) && (npcAction->action == 2)) { this->action = 2; this->drawConfig = 1; - func_8098E86C(this, globalCtx); + func_8098E86C(this, play); } } } @@ -281,11 +281,11 @@ void func_8098EA3C(DemoSa* this) { } } -void func_8098EA68(DemoSa* this, GlobalContext* globalCtx) { +void func_8098EA68(DemoSa* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[4]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[4]; if ((npcAction != NULL) && (npcAction->action == 3)) { Animation_Change(&this->skelAnime, &gSariaGiveForestMedallionAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSariaGiveForestMedallionAnim), ANIMMODE_ONCE, -4.0f); @@ -302,60 +302,60 @@ void func_8098EB00(DemoSa* this, s32 arg1) { } } -void func_8098EB6C(DemoSa* this, GlobalContext* globalCtx) { +void func_8098EB6C(DemoSa* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[6]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[6]; if ((npcAction != NULL) && (npcAction->action == 2)) { this->action = 6; - func_8098E8C8(this, globalCtx); + func_8098E8C8(this, play); } } } -void func_8098EBB8(DemoSa* this, GlobalContext* globalCtx) { - func_8098E960(this, globalCtx); +void func_8098EBB8(DemoSa* this, PlayState* play) { + func_8098E960(this, play); } -void func_8098EBD8(DemoSa* this, GlobalContext* globalCtx) { - func_8098E9EC(this, globalCtx); +void func_8098EBD8(DemoSa* this, PlayState* play) { + func_8098E9EC(this, play); } -void func_8098EBF8(DemoSa* this, GlobalContext* globalCtx) { - func_8098E944(this, globalCtx); +void func_8098EBF8(DemoSa* this, PlayState* play) { + func_8098E944(this, play); DemoSa_UpdateSkelAnime(this); func_8098EA3C(this); } -void func_8098EC28(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098EC28(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098EA68(this, globalCtx); + func_8098EA68(this, play); } -void func_8098EC60(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098EC60(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); func_8098EB00(this, DemoSa_UpdateSkelAnime(this)); } -void func_8098EC94(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098EC94(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098EB6C(this, globalCtx); + func_8098EB6C(this, play); } -void func_8098ECCC(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098ECCC(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); } -void func_8098ECF4(DemoSa* this, GlobalContext* globalCtx) { +void func_8098ECF4(DemoSa* this, PlayState* play) { s32 pad[2]; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSariaSealGanonAnim); - SkelAnime_InitFlex(globalCtx, skelAnime, &gSariaSkel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, skelAnime, &gSariaSkel, NULL, NULL, NULL, 0); Animation_Change(skelAnime, &gSariaSealGanonAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = 7; this->actor.shape.shadowAlpha = 0; @@ -376,13 +376,13 @@ void func_8098EE08(void) { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void func_8098EE28(DemoSa* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void func_8098EE28(DemoSa* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, (kREG(23) + 25.0f) + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 4); } -void func_8098EEA8(DemoSa* this, GlobalContext* globalCtx) { - if (func_8098E654(this, globalCtx, 4, 4)) { +void func_8098EEA8(DemoSa* this, PlayState* play) { + if (func_8098E654(this, play, 4, 4)) { this->action = 8; this->drawConfig = 2; this->alpha = 0; @@ -392,11 +392,11 @@ void func_8098EEA8(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098EEFC(DemoSa* this, GlobalContext* globalCtx) { +void func_8098EEFC(DemoSa* this, PlayState* play) { s32 alpha = 255; f32* unk_1A0 = &this->unk_1A0; - if (func_8098E654(this, globalCtx, 4, 4)) { + if (func_8098E654(this, play, 4, 4)) { *unk_1A0 += 1.0f; if ((kREG(5) + 10.0f) <= *unk_1A0) { this->action = 9; @@ -420,42 +420,42 @@ void func_8098EEFC(DemoSa* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = this->alpha = (*unk_1A0 / (kREG(5) + 10.0f)) * 255.0f; } -void func_8098F050(DemoSa* this, GlobalContext* globalCtx) { - if (func_8098E6A0(this, globalCtx, 4, 4)) { +void func_8098F050(DemoSa* this, PlayState* play) { + if (func_8098E6A0(this, play, 4, 4)) { this->action = 8; this->drawConfig = 2; this->unk_1A0 = kREG(5) + 10.0f; this->alpha = 255; if (this->unk_1A8 == 0) { - func_8098EE28(this, globalCtx); + func_8098EE28(this, play); this->unk_1A8 = 1; } this->actor.shape.shadowAlpha = 0xFF; } } -void func_8098F0E8(DemoSa* this, GlobalContext* globalCtx) { - func_8098EEA8(this, globalCtx); - func_8098E554(this, globalCtx); +void func_8098F0E8(DemoSa* this, PlayState* play) { + func_8098EEA8(this, play); + func_8098E554(this, play); } -void func_8098F118(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F118(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); - func_8098EEFC(this, globalCtx); - func_8098E554(this, globalCtx); + func_8098EEFC(this, play); + func_8098E554(this, play); } -void func_8098F16C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F16C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098EDB0(this); - func_8098F050(this, globalCtx); - func_8098E554(this, globalCtx); + func_8098F050(this, play); + func_8098E554(this, play); } -void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawXlu(DemoSa* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* sp78 = sEyeTextures[eyeIndex]; @@ -464,9 +464,9 @@ void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) { void* sp6C = sMouthTextures[mouthIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sp78)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sp78)); @@ -474,26 +474,26 @@ void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8098F390(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); +void func_8098F390(DemoSa* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); this->action = 10; this->drawConfig = 1; } -void func_8098F3F0(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F3F0(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); } -void func_8098F420(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaSitting3Anim, NULL, NULL, 0); +void func_8098F420(DemoSa* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaSitting3Anim, NULL, NULL, 0); this->action = 11; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; @@ -514,8 +514,8 @@ void func_8098F480(DemoSa* this) { } } -void func_8098F50C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E6EC(this, globalCtx, 4); +void func_8098F50C(DemoSa* this, PlayState* play) { + func_8098E6EC(this, play, 4); this->action = 12; this->drawConfig = 2; } @@ -544,10 +544,10 @@ void func_8098F610(DemoSa* this, s32 arg1) { } } -void func_8098F654(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F654(DemoSa* this, PlayState* play) { s32 unk_1AC; s32 action; - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, 4); + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, 4); if (npcAction != NULL) { action = npcAction->action; @@ -555,7 +555,7 @@ void func_8098F654(DemoSa* this, GlobalContext* globalCtx) { if (action != unk_1AC) { switch (action) { case 7: - func_8098F50C(this, globalCtx); + func_8098F50C(this, play); break; case 8: func_8098F590(this); @@ -571,46 +571,46 @@ void func_8098F654(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098F714(DemoSa* this, GlobalContext* globalCtx) { - func_8098F654(this, globalCtx); +void func_8098F714(DemoSa* this, PlayState* play) { + func_8098F654(this, play); } -void func_8098F734(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F734(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); func_8098F480(this); func_8098F544(this); } -void func_8098F77C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F77C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); - func_8098F654(this, globalCtx); + func_8098F654(this, play); } -void func_8098F7BC(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F7BC(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); - func_8098F654(this, globalCtx); + func_8098F654(this, play); } -void func_8098F7FC(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F7FC(DemoSa* this, PlayState* play) { s32 sp1C; - func_8098E5C8(this, globalCtx); + func_8098E5C8(this, play); sp1C = DemoSa_UpdateSkelAnime(this); func_8098E480(this); func_8098F610(this, sp1C); } -void func_8098F83C(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F83C(DemoSa* this, PlayState* play) { Vec3f* thisPos = &this->actor.world.pos; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitOnBridgeAnim, NULL, NULL, 0); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, thisPos->x, thisPos->y, thisPos->z, + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaWaitOnBridgeAnim, NULL, NULL, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, thisPos->x, thisPos->y, thisPos->z, 0, 0, 0, FAIRY_KOKIRI); this->action = 16; this->drawConfig = 0; @@ -640,9 +640,9 @@ void func_8098F984(DemoSa* this) { this->actor.shape.shadowAlpha = 0; } -void func_8098F998(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F998(DemoSa* this, PlayState* play) { if (this->unk_1AC == 4) { - func_8098E6EC(this, globalCtx, 1); + func_8098E6EC(this, play, 1); this->action = 17; this->drawConfig = 2; this->unk_1B0 = 0; @@ -689,10 +689,10 @@ void func_8098FB34(DemoSa* this, s32 arg1) { } } -void func_8098FB68(DemoSa* this, GlobalContext* globalCtx) { +void func_8098FB68(DemoSa* this, PlayState* play) { s32 unk_1AC; s32 action; - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, 1); + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, 1); if (npcAction != NULL) { action = npcAction->action; @@ -703,7 +703,7 @@ void func_8098FB68(DemoSa* this, GlobalContext* globalCtx) { func_8098F984(this); break; case 12: - func_8098F998(this, globalCtx); + func_8098F998(this, play); break; case 13: func_8098FA84(this); @@ -719,69 +719,69 @@ void func_8098FB68(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098FC44(DemoSa* this, GlobalContext* globalCtx) { - func_8098FB68(this, globalCtx); +void func_8098FC44(DemoSa* this, PlayState* play) { + func_8098FB68(this, play); } -void func_8098FC64(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FC64(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098F8F8(this); func_8098FA2C(this); } -void func_8098FC9C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FC9C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098FB68(this, globalCtx); + func_8098FB68(this, play); } -void func_8098FCD4(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FCD4(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098FB68(this, globalCtx); + func_8098FB68(this, play); } -void func_8098FD0C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FD0C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); func_8098FB34(this, DemoSa_UpdateSkelAnime(this)); - func_8098FB68(this, globalCtx); + func_8098FB68(this, play); } -void DemoSa_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Update(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; if (this->action < 0 || this->action >= 21 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void DemoSa_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Init(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); switch (this->actor.params) { case 2: - func_8098ECF4(this, globalCtx); + func_8098ECF4(this, play); break; case 3: - func_8098F390(this, globalCtx); + func_8098F390(this, play); break; case 4: - func_8098F420(this, globalCtx); + func_8098F420(this, play); break; case 5: - func_8098F83C(this, globalCtx); + func_8098F83C(this, play); break; default: - func_8098E7FC(this, globalCtx); + func_8098E7FC(this, play); } } -s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 DemoSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { DemoSa* this = (DemoSa*)thisx; if ((limbIndex == 15) && (this->unk_1B0 != 0)) { @@ -790,10 +790,10 @@ s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawNothing(DemoSa* this, PlayState* play) { } -void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawOpa(DemoSa* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; @@ -802,9 +802,9 @@ void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -812,18 +812,18 @@ void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoSa_OverrideLimbDraw, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoSa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Draw(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h b/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h index dd3fe27db..7801aca27 100644 --- a/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h +++ b/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h @@ -6,8 +6,8 @@ struct DemoSa; -typedef void (*DemoSaActionFunc)(struct DemoSa*, GlobalContext*); -typedef void (*DemoSaDrawFunc)(struct DemoSa*, GlobalContext*); +typedef void (*DemoSaActionFunc)(struct DemoSa*, PlayState*); +typedef void (*DemoSaDrawFunc)(struct DemoSa*, PlayState*); typedef struct DemoSa { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c b/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c index edda06af1..ad4d40deb 100644 --- a/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoShd_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoShd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoShd_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoShd_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoShd_Init(Actor* thisx, PlayState* play); +void DemoShd_Destroy(Actor* thisx, PlayState* play); +void DemoShd_Update(Actor* thisx, PlayState* play); +void DemoShd_Draw(Actor* thisx, PlayState* play); -void func_80991298(DemoShd* this, GlobalContext* globalCtx); +void func_80991298(DemoShd* this, PlayState* play); const ActorInit Demo_Shd_InitVars = { ACTOR_DEMO_SHD, @@ -34,7 +34,7 @@ void DemoShd_SetupAction(DemoShd* this, DemoShdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DemoShd_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Init(Actor* thisx, PlayState* play) { DemoShd* this = (DemoShd*)thisx; this->unk_14C = 0; @@ -44,22 +44,22 @@ void DemoShd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.x = 0.0f; } -void DemoShd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Destroy(Actor* thisx, PlayState* play) { } -void func_80991298(DemoShd* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL) || - (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL)) { - if (globalCtx->csCtx.frames == 800) { +void func_80991298(DemoShd* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL) || + (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL)) { + if (play->csCtx.frames == 800) { func_800F3F3C(9); } - if (globalCtx->csCtx.frames == 1069) { + if (play->csCtx.frames == 1069) { func_800F3F3C(8); } } - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction0 = globalCtx->csCtx.npcActions[0]; + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction0 = play->csCtx.npcActions[0]; if (npcAction0 != NULL) { if (npcAction0->action == 2) { @@ -73,8 +73,8 @@ void func_80991298(DemoShd* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction1 = globalCtx->csCtx.npcActions[1]; + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction1 = play->csCtx.npcActions[1]; if (npcAction1 != NULL) { if (npcAction1->action == 2) { @@ -91,34 +91,34 @@ void func_80991298(DemoShd* this, GlobalContext* globalCtx) { this->unk_14E++; } -void DemoShd_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Update(Actor* thisx, PlayState* play) { DemoShd* this = (DemoShd*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DemoShd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Draw(Actor* thisx, PlayState* play) { DemoShd* this = (DemoShd*)thisx; s32 pad; u32 unk_14E = this->unk_14E; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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++, D_809932D0); if (this->unk_14C & 1) { - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), 16, 256, 1, 0, 255 - ((unk_14E * 5) & 255), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, D_80993390); } else if (this->unk_14C & 2) { - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), 16, 256, 1, 0, 255 - ((unk_14E * 5) & 255), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, D_809934B8); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h b/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h index 563d8b31e..fe9198f62 100644 --- a/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h +++ b/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h @@ -6,7 +6,7 @@ struct DemoShd; -typedef void (*DemoShdActionFunc)(struct DemoShd*, GlobalContext*); +typedef void (*DemoShdActionFunc)(struct DemoShd*, PlayState*); typedef struct DemoShd { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index da3041c7e..12265a6af 100644 --- a/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -4,15 +4,15 @@ #define FLAGS ACTOR_FLAG_4 -void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoTreLgt_Init(Actor* thisx, PlayState* play); +void DemoTreLgt_Destroy(Actor* thisx, PlayState* play); +void DemoTreLgt_Update(Actor* thisx, PlayState* play); +void DemoTreLgt_Draw(Actor* thisx, PlayState* play); -void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx); +void func_80993848(DemoTreLgt* this, PlayState* play); void func_80993754(DemoTreLgt* this); -void func_8099375C(DemoTreLgt* this, GlobalContext* globalCtx); -void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame); +void func_8099375C(DemoTreLgt* this, PlayState* play); +void func_809937B4(DemoTreLgt* this, PlayState* play, f32 currentFrame); typedef struct { /* 0x00 */ f32 startFrame; @@ -46,10 +46,10 @@ static DemoTreLgtActionFunc sActionFuncs[] = { func_80993848, }; -void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Init(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; - if (!SkelCurve_Init(globalCtx, &this->skelCurve, &gTreasureChestCurveSkel, sTransformUpdIdx[0])) { + if (!SkelCurve_Init(play, &this->skelCurve, &gTreasureChestCurveSkel, sTransformUpdIdx[0])) { // "Demo_Tre_Lgt_Actor_ct (); Construct failed" osSyncPrintf("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n"); } @@ -62,25 +62,25 @@ void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) { func_80993754(this); } -void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Destroy(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; - SkelCurve_Destroy(globalCtx, &this->skelCurve); + SkelCurve_Destroy(play, &this->skelCurve); } void func_80993754(DemoTreLgt* this) { this->action = DEMO_TRE_LGT_ACTION_WAIT; } -void func_8099375C(DemoTreLgt* this, GlobalContext* globalCtx) { +void func_8099375C(DemoTreLgt* this, PlayState* play) { EnBox* treasureChest = (EnBox*)this->actor.parent; if (treasureChest != NULL && Animation_OnFrame(&treasureChest->skelanime, 10.0f)) { - func_809937B4(this, globalCtx, treasureChest->skelanime.curFrame); + func_809937B4(this, play, treasureChest->skelanime.curFrame); } } -void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame) { +void func_809937B4(DemoTreLgt* this, PlayState* play, f32 currentFrame) { SkelAnimeCurve* skelCurve = &this->skelCurve; s32 pad[2]; @@ -89,10 +89,10 @@ void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame) SkelCurve_SetAnim(skelCurve, sTransformUpdIdx[gSaveContext.linkAge], 1.0f, sDemoTreLgtInfo[gSaveContext.linkAge].endFrame + sDemoTreLgtInfo[gSaveContext.linkAge].unk_08, currentFrame, 1.0f); - SkelCurve_Update(globalCtx, skelCurve); + SkelCurve_Update(play, skelCurve); } -void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) { +void func_80993848(DemoTreLgt* this, PlayState* play) { f32 currentFrame = this->skelCurve.animCurFrame; if (currentFrame < sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame) { @@ -121,25 +121,25 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EV_TRE_BOX_FLASH, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { + if (SkelCurve_Update(play, &this->skelCurve)) { Actor_Kill(&this->actor); } } -void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Update(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -s32 DemoTreLgt_PostLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) { +s32 DemoTreLgt_PostLimbDraw(PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) { s32 pad; DemoTreLgt* this = (DemoTreLgt*)thisx; - 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 == 1) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->unk_170); @@ -147,12 +147,12 @@ s32 DemoTreLgt_PostLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->unk_174); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return 1; } -void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void DemoTreLgt_Draw(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; DemoTreLgt* this = (DemoTreLgt*)thisx; OPEN_DISPS(gfxCtx); @@ -163,7 +163,7 @@ void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 0); - SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, DemoTreLgt_PostLimbDraw, NULL, 1, thisx); + SkelCurve_Draw(&this->actor, play, &this->skelCurve, DemoTreLgt_PostLimbDraw, NULL, 1, thisx); CLOSE_DISPS(gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h b/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h index d34056ab8..7f03d6f1d 100644 --- a/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h +++ b/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h @@ -6,7 +6,7 @@ struct DemoTreLgt; -typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, GlobalContext*); +typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, PlayState*); typedef struct DemoTreLgt { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index ed3d7382f..2d7356bb4 100644 --- a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_25 -void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorAna_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorAna_Init(Actor* thisx, PlayState* play); +void DoorAna_Destroy(Actor* thisx, PlayState* play); +void DoorAna_Update(Actor* thisx, PlayState* play); +void DoorAna_Draw(Actor* thisx, PlayState* play); -void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx); -void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx); -void DoorAna_GrabPlayer(DoorAna* this, GlobalContext* globalCtx); +void DoorAna_WaitClosed(DoorAna* this, PlayState* play); +void DoorAna_WaitOpen(DoorAna* this, PlayState* play); +void DoorAna_GrabPlayer(DoorAna* this, PlayState* play); const ActorInit Door_Ana_InitVars = { ACTOR_DOOR_ANA, @@ -61,7 +61,7 @@ void DoorAna_SetupAction(DoorAna* this, DoorAnaActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Init(Actor* thisx, PlayState* play) { DoorAna* this = (DoorAna*)thisx; this->actor.shape.rot.z = 0; @@ -70,8 +70,8 @@ void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.params & 0x300) != 0) { // only allocate collider for grottos that need bombing/hammering open if ((this->actor.params & 0x200) != 0) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } else { this->actor.flags |= ACTOR_FLAG_4; } @@ -83,22 +83,22 @@ void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 0; } -void DoorAna_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Destroy(Actor* thisx, PlayState* play) { DoorAna* this = (DoorAna*)thisx; // free collider if it has one if ((this->actor.params & 0x200) != 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } // update routine for grottos that are currently "hidden"/unopened -void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_WaitClosed(DoorAna* this, PlayState* play) { u32 openGrotto = false; if (!(this->actor.params & 0x200)) { // opening with song of storms - if (this->actor.xyzDistToPlayerSq < 40000.0f && Flags_GetEnv(globalCtx, 5)) { + if (this->actor.xyzDistToPlayerSq < 40000.0f && Flags_GetEnv(play, 5)) { openGrotto = true; this->actor.flags &= ~ACTOR_FLAG_4; } @@ -106,10 +106,10 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { // bombing/hammering open a grotto if (this->collider.base.acFlags & AC_HIT) { openGrotto = true; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } // open the grotto @@ -118,30 +118,30 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { DoorAna_SetupAction(this, DoorAna_WaitOpen); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - func_8002F5F0(&this->actor, globalCtx); + func_8002F5F0(&this->actor, play); } // update routine for grottos that are open -void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { Player* player; s32 destinationIdx; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { - if ((this->actor.targetMode != 0) && (globalCtx->sceneLoadFlag == 0) && (player->stateFlags1 & 0x80000000) && + if ((this->actor.targetMode != 0) && (play->sceneLoadFlag == 0) && (player->stateFlags1 & 0x80000000) && (player->unk_84F == 0)) { destinationIdx = ((this->actor.params >> 0xC) & 7) - 1; - Gameplay_SetupRespawnPoint(globalCtx, RESPAWN_MODE_RETURN, 0x4FF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF); gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y; gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.home.rot.y; gSaveContext.respawn[RESPAWN_MODE_RETURN].data = this->actor.params & 0xFFFF; if (destinationIdx < 0) { destinationIdx = this->actor.home.rot.z + 1; } - globalCtx->nextEntranceIndex = entrances[destinationIdx]; + play->nextEntranceIndex = entrances[destinationIdx]; DoorAna_SetupAction(this, DoorAna_GrabPlayer); } else { - if (!Player_InCsMode(globalCtx) && !(player->stateFlags1 & 0x8800000) && + if (!Player_InCsMode(play) && !(player->stateFlags1 & 0x8800000) && this->actor.xzDistToPlayer <= 15.0f && -50.0f <= this->actor.yDistToPlayer && this->actor.yDistToPlayer <= 15.0f) { player->stateFlags1 |= 0x80000000; @@ -155,31 +155,31 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { } // update function for after the player has triggered the grotto -void DoorAna_GrabPlayer(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_GrabPlayer(DoorAna* this, PlayState* play) { Player* player; if (this->actor.yDistToPlayer <= 0.0f && 15.0f < this->actor.xzDistToPlayer) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->actor.world.pos.x = Math_SinS(this->actor.yawTowardsPlayer) * 15.0f + this->actor.world.pos.x; player->actor.world.pos.z = Math_CosS(this->actor.yawTowardsPlayer) * 15.0f + this->actor.world.pos.z; } } -void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Update(Actor* thisx, PlayState* play) { DoorAna* this = (DoorAna*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); // changes the grottos facing angle based on camera angle - this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; } -void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void DoorAna_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(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++, gGrottoDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.h b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.h index 3ad932b62..51c24b84a 100644 --- a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.h +++ b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.h @@ -6,7 +6,7 @@ struct DoorAna; -typedef void (*DoorAnaActionFunc)(struct DoorAna*, GlobalContext*); +typedef void (*DoorAnaActionFunc)(struct DoorAna*, PlayState*); typedef struct DoorAna { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index 15f38ef7a..c288863e5 100644 --- a/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void DoorGerudo_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorGerudo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorGerudo_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorGerudo_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorGerudo_Init(Actor* thisx, PlayState* play); +void DoorGerudo_Destroy(Actor* thisx, PlayState* play); +void DoorGerudo_Update(Actor* thisx, PlayState* play); +void DoorGerudo_Draw(Actor* thisx, PlayState* play); -void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx); -s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx); -void func_8099496C(DoorGerudo* this, GlobalContext* globalCtx); -void func_809949C8(DoorGerudo* this, GlobalContext* globalCtx); +void func_8099485C(DoorGerudo* this, PlayState* play); +s32 func_80994750(DoorGerudo* this, PlayState* play); +void func_8099496C(DoorGerudo* this, PlayState* play); +void func_809949C8(DoorGerudo* this, PlayState* play); const ActorInit Door_Gerudo_InitVars = { ACTOR_DOOR_GERUDO, @@ -36,16 +36,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_STOP), }; -void DoorGerudo_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Init(Actor* thisx, PlayState* play) { s32 pad; DoorGerudo* this = (DoorGerudo*)thisx; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); CollisionHeader_GetVirtual(&gGerudoCellDoorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (Flags_GetSwitch(play, thisx->params & 0x3F)) { this->actionFunc = func_8099485C; thisx->world.pos.y = thisx->home.pos.y + 200.0f; } else { @@ -54,14 +54,14 @@ void DoorGerudo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DoorGerudo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Destroy(Actor* thisx, PlayState* play) { DoorGerudo* this = (DoorGerudo*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -f32 func_809946BC(GlobalContext* globalCtx, DoorGerudo* this, f32 arg2, f32 arg3, f32 arg4) { - Player* player = GET_PLAYER(globalCtx); +f32 func_809946BC(PlayState* play, DoorGerudo* this, f32 arg2, f32 arg3, f32 arg4) { + Player* player = GET_PLAYER(play); Vec3f playerPos; Vec3f sp1C; @@ -77,13 +77,13 @@ f32 func_809946BC(GlobalContext* globalCtx, DoorGerudo* this, f32 arg2, f32 arg3 } } -s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80994750(DoorGerudo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f0; s16 rotYDiff; - if (!Player_InCsMode(globalCtx)) { - temp_f0 = func_809946BC(globalCtx, this, 0.0f, 20.0f, 15.0f); + if (!Player_InCsMode(play)) { + temp_f0 = func_809946BC(play, this, 0.0f, 20.0f, 15.0f); if (fabsf(temp_f0) < 40.0f) { rotYDiff = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y; if (temp_f0 > 0.0f) { @@ -97,21 +97,21 @@ s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) { return 0; } -void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) { +void func_8099485C(DoorGerudo* this, PlayState* play) { if (this->unk_164 != 0) { this->actionFunc = func_8099496C; gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] -= 1; - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { - s32 direction = func_80994750(this, globalCtx); + s32 direction = func_80994750(this, play); if (direction != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) { player->naviTextId = -0x203; - } else if (!Flags_GetCollectible(globalCtx, (this->dyna.actor.params >> 8) & 0x1F)) { + } else if (!Flags_GetCollectible(play, (this->dyna.actor.params >> 8) & 0x1F)) { player->naviTextId = -0x225; } else { player->doorType = PLAYER_DOORTYPE_SLIDING; @@ -123,39 +123,39 @@ void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) { } } -void func_8099496C(DoorGerudo* this, GlobalContext* globalCtx) { +void func_8099496C(DoorGerudo* this, PlayState* play) { if (DECR(this->unk_166) == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_809949C8; } } -void func_809949C8(DoorGerudo* this, GlobalContext* globalCtx) { +void func_809949C8(DoorGerudo* this, PlayState* play) { Math_StepToF(&this->dyna.actor.velocity.y, 15.0f, 3.0f); Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y); } -void DoorGerudo_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Update(Actor* thisx, PlayState* play) { DoorGerudo* this = (DoorGerudo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DoorGerudo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Draw(Actor* thisx, PlayState* play) { DoorGerudo* this = (DoorGerudo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, gGerudoCellDoorDL); if (this->unk_166 != 0) { Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY); - Actor_DrawDoorLock(globalCtx, this->unk_166, DOORLOCK_NORMAL); + Actor_DrawDoorLock(play, this->unk_166, DOORLOCK_NORMAL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h b/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h index 3c6fac394..fc545e0e0 100644 --- a/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h +++ b/soh/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h @@ -6,7 +6,7 @@ struct DoorGerudo; -typedef void (*DoorGerudoActionFunc)(struct DoorGerudo*, GlobalContext*); +typedef void (*DoorGerudoActionFunc)(struct DoorGerudo*, PlayState*); typedef struct DoorGerudo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index 10757ba17..149f57dad 100644 --- a/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -21,13 +21,13 @@ typedef enum { /* 4 */ DOOR_KILLER_RUBBLE_PIECE_4 } DoorKillerBehaviour; -void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx); -void DoorKiller_SetProperties(DoorKiller* this, GlobalContext* globalCtx); -void DoorKiller_DrawDoor(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_DrawRubble(Actor* thisx, GlobalContext* globalCtx); +void DoorKiller_Init(Actor* thisx, PlayState* play); +void DoorKiller_Destroy(Actor* thisx, PlayState* play); +void DoorKiller_Update(Actor* thisx, PlayState* play); +void DoorKiller_Wait(DoorKiller* this, PlayState* play); +void DoorKiller_SetProperties(DoorKiller* this, PlayState* play); +void DoorKiller_DrawDoor(Actor* thisx, PlayState* play); +void DoorKiller_DrawRubble(Actor* thisx, PlayState* play); const ActorInit Door_Killer_InitVars = { ACTOR_DOOR_KILLER, @@ -96,8 +96,8 @@ static DoorKillerTextureEntry sDoorTextures[4] = { { OBJECT_GAMEPLAY_KEEP, gWoodenDoorTex }, }; -void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DoorKiller_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; f32 randF; DoorKiller* this = (DoorKiller*)thisx; s32 bankIndex; @@ -107,13 +107,13 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { // Look in the object bank for one of the four objects containing door textures bankIndex = -1; for (i = 0; bankIndex < 0; i++) { - bankIndex = Object_GetIndex(&globalCtx->objectCtx, sDoorTextures[i].objectId); + bankIndex = Object_GetIndex(&play->objectCtx, sDoorTextures[i].objectId); this->textureEntryIndex = i; } */ // For SoH where all objects are loaded, hardcode the index to match the current map. - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_HIDAN: this->textureEntryIndex = 0; break; @@ -127,7 +127,7 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { default: this->textureEntryIndex = 3; } - bankIndex = Object_GetIndex(&globalCtx->objectCtx, sDoorTextures[this->textureEntryIndex].objectId); + bankIndex = Object_GetIndex(&play->objectCtx, sDoorTextures[this->textureEntryIndex].objectId); osSyncPrintf("bank_ID = %d\n", bankIndex); osSyncPrintf("status = %d\n", this->textureEntryIndex); @@ -145,19 +145,19 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { case DOOR_KILLER_DOOR: // `jointTable` is used for both the `jointTable` and `morphTable` args here. Because this actor doesn't // play any animations it does not cause problems, but it would need to be changed otherwise. - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_door_killer_Skel_001BC8, NULL, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_door_killer_Skel_001BC8, NULL, this->jointTable, this->jointTable, 9); this->actionFunc = DoorKiller_SetProperties; - DoorKiller_SetProperties(this, globalCtx); + DoorKiller_SetProperties(this, play); // manually set the overall rotation of the door this->jointTable[1].x = this->jointTable[1].z = 0x4000; // Set a cylinder collider to detect link attacks and larger sphere collider to detect explosions - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphItems); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphItems); this->colliderJntSph.elements[0].dim.worldSphere.radius = 80; this->colliderJntSph.elements[0].dim.worldSphere.center.x = (s16)this->actor.world.pos.x; this->colliderJntSph.elements[0].dim.worldSphere.center.y = (s16)this->actor.world.pos.y + 50; @@ -165,7 +165,7 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { // If tied to a switch flag and that switch flag is already set, kill the actor. if ((((this->actor.params >> 8) & 0x3F) != 0x3F) && - Flags_GetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F))) { + Flags_GetSwitch(play, ((this->actor.params >> 8) & 0x3F))) { Actor_Kill(&this->actor); } break; @@ -174,7 +174,7 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { case DOOR_KILLER_RUBBLE_PIECE_3: case DOOR_KILLER_RUBBLE_PIECE_4: this->actionFunc = DoorKiller_SetProperties; - DoorKiller_SetProperties(this, globalCtx); + DoorKiller_SetProperties(this, play); this->actor.gravity = -0.6f; this->actor.minVelocityY = -6.0f; @@ -197,26 +197,26 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void DoorKiller_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_Destroy(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; if ((thisx->params & 0xFF) == DOOR_KILLER_DOOR) { - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderJntSph); } } -void DoorKiller_SpawnRubble(Actor* thisx, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x, thisx->world.pos.y + 9.0f, +void DoorKiller_SpawnRubble(Actor* thisx, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x, thisx->world.pos.y + 9.0f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x + 7.88f, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x + 7.88f, thisx->world.pos.y + 39.8f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x - 15.86f, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x - 15.86f, thisx->world.pos.y + 61.98f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_3); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x + 3.72f, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x + 3.72f, thisx->world.pos.y + 85.1f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_4); } @@ -224,7 +224,7 @@ void DoorKiller_SpawnRubble(Actor* thisx, GlobalContext* globalCtx) { /** * action function for the individual door pieces that spawn and fall down when the door is destroyed */ -void DoorKiller_FallAsRubble(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_FallAsRubble(DoorKiller* this, PlayState* play) { this->actor.velocity.y += this->actor.gravity; if (this->actor.velocity.y < this->actor.minVelocityY) { this->actor.velocity.y = this->actor.minVelocityY; @@ -246,7 +246,7 @@ void DoorKiller_FallAsRubble(DoorKiller* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } -s32 DoorKiller_IsHit(Actor* thisx, GlobalContext* globalCtx) { +s32 DoorKiller_IsHit(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; if ((this->colliderCylinder.base.acFlags & 2) && (this->colliderCylinder.info.acHitInfo != NULL)) { return true; @@ -254,18 +254,18 @@ s32 DoorKiller_IsHit(Actor* thisx, GlobalContext* globalCtx) { return false; } -void DoorKiller_SetAC(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_SetAC(DoorKiller* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } -void DoorKiller_Die(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_Die(DoorKiller* this, PlayState* play) { s32 switchFlag = (this->actor.params >> 8) & 0x3F; // Can set a switch flag on death based on params if (switchFlag != 0x3F) { - Flags_SetSwitch(globalCtx, switchFlag); + Flags_SetSwitch(play, switchFlag); } Actor_Kill(&this->actor); } @@ -273,7 +273,7 @@ void DoorKiller_Die(DoorKiller* this, GlobalContext* globalCtx) { /** * After slamming on the floor, rise back upright */ -void DoorKiller_RiseBackUp(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_RiseBackUp(DoorKiller* this, PlayState* play) { s32 i; s16 rotation; @@ -282,7 +282,7 @@ void DoorKiller_RiseBackUp(DoorKiller* this, GlobalContext* globalCtx) { } else { this->actionFunc = DoorKiller_Wait; this->timer = 16; - DoorKiller_SetAC(this, globalCtx); + DoorKiller_SetAC(this, play); return; } @@ -314,7 +314,7 @@ void DoorKiller_RiseBackUp(DoorKiller* this, GlobalContext* globalCtx) { * After wobbling, fall over and slam onto the floor, damaging the player if they are in the way. Uses manual distance * check for damaging player, not AT system. */ -void DoorKiller_FallOver(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_FallOver(DoorKiller* this, PlayState* play) { s32 i; s16 rotation; @@ -363,17 +363,17 @@ void DoorKiller_FallOver(DoorKiller* this, GlobalContext* globalCtx) { pos.x += this->actor.world.pos.x; pos.y += this->actor.world.pos.y; pos.z += this->actor.world.pos.z; - func_8002865C(globalCtx, &pos, &velocity, &accel, 300, 30); + func_8002865C(play, &pos, &velocity, &accel, 300, 30); } } if (!(this->hasHitPlayerOrGround & 1)) { Vec3f playerPosRelToDoor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_8002DBD0(&this->actor, &playerPosRelToDoor, &player->actor.world.pos); if ((fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (playerPosRelToDoor.z < 100.0f) && (playerPosRelToDoor.z > 0.0f)) { this->hasHitPlayerOrGround |= 1; - func_8002F6D4(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 16); + func_8002F6D4(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 16); Audio_PlayActorSound2(&this->actor, NA_SE_EN_KDOOR_HIT); func_8002F7DC(&player->actor, NA_SE_PL_BODY_HIT); } @@ -387,7 +387,7 @@ void DoorKiller_FallOver(DoorKiller* this, GlobalContext* globalCtx) { /** * Wobble around, signifying the door is about to fall over. Does not set AC and so cannot be destroyed during this. */ -void DoorKiller_Wobble(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_Wobble(DoorKiller* this, PlayState* play) { s16 rotation; s32 i; @@ -417,7 +417,7 @@ void DoorKiller_Wobble(DoorKiller* this, GlobalContext* globalCtx) { /** * Idle while the player attempts to open the door and then begin to wobble */ -void DoorKiller_WaitBeforeWobble(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_WaitBeforeWobble(DoorKiller* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -426,8 +426,8 @@ void DoorKiller_WaitBeforeWobble(DoorKiller* this, GlobalContext* globalCtx) { } } -void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorKiller_Wait(DoorKiller* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f playerPosRelToDoor; s16 angleToFacingPlayer; @@ -441,22 +441,22 @@ void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx) { return; } - if (DoorKiller_IsHit(&this->actor, globalCtx)) { + if (DoorKiller_IsHit(&this->actor, play)) { // AC cylinder: wobble if hit by most weapons, die if hit by explosives or hammer if ((this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0x1FFA6) != 0) { this->timer = 16; this->actionFunc = DoorKiller_Wobble; } else if ((this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0x48) != 0) { - DoorKiller_SpawnRubble(&this->actor, globalCtx); + DoorKiller_SpawnRubble(&this->actor, play); this->actionFunc = DoorKiller_Die; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); } - } else if (Actor_GetCollidedExplosive(globalCtx, &this->colliderJntSph.base) != NULL) { + } else if (Actor_GetCollidedExplosive(play, &this->colliderJntSph.base) != NULL) { // AC sphere: die if hit by explosive - DoorKiller_SpawnRubble(&this->actor, globalCtx); + DoorKiller_SpawnRubble(&this->actor, play); this->actionFunc = DoorKiller_Die; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); - } else if (!Player_InCsMode(globalCtx) && (fabsf(playerPosRelToDoor.y) < 20.0f) && + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); + } else if (!Player_InCsMode(play) && (fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (playerPosRelToDoor.z < 50.0f) && (playerPosRelToDoor.z > 0.0f)) { // Set player properties to make the door openable if within range @@ -471,27 +471,27 @@ void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx) { } } - DoorKiller_SetAC(this, globalCtx); + DoorKiller_SetAC(this, play); } /** * Grabs the virtual address of the texture from the relevant door object */ -void DoorKiller_UpdateTexture(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->doorObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->doorObjBankIndex].segment); this->texture = SEGMENTED_TO_VIRTUAL(this->texture); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[thisx->objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[thisx->objBankIndex].segment); } /** * Gets the correct door texture, defines the appropriate draw fucntion and action function based on type behaviour * (door or rubble). */ -void DoorKiller_SetProperties(DoorKiller* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->doorObjBankIndex)) { - DoorKiller_UpdateTexture(&this->actor, globalCtx); +void DoorKiller_SetProperties(DoorKiller* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->doorObjBankIndex)) { + DoorKiller_UpdateTexture(&this->actor, play); switch (this->actor.params & 0xFF) { case DOOR_KILLER_DOOR: this->actionFunc = DoorKiller_Wait; @@ -508,38 +508,38 @@ void DoorKiller_SetProperties(DoorKiller* this, GlobalContext* globalCtx) { } } -void DoorKiller_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_Update(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DoorKiller_SetTexture(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_SetTexture(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; void* doorTexture = this->texture; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, doorTexture); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DoorKiller_DrawDoor(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_DrawDoor(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - DoorKiller_SetTexture(&this->actor, globalCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + DoorKiller_SetTexture(&this->actor, play); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, NULL); } -void DoorKiller_DrawRubble(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_DrawRubble(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { object_door_killer_DL_001250, object_door_killer_DL_001550, object_door_killer_DL_0017B8, object_door_killer_DL_001A58 }; s32 rubblePieceIndex = (thisx->params & 0xFF) - 1; DoorKiller* this = (DoorKiller*)thisx; if ((this->timer >= 20) || ((this->timer & 1) == 0)) { - DoorKiller_SetTexture(thisx, globalCtx); - Gfx_DrawDListOpa(globalCtx, dLists[rubblePieceIndex]); + DoorKiller_SetTexture(thisx, play); + Gfx_DrawDListOpa(play, dLists[rubblePieceIndex]); } } diff --git a/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.h b/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.h index 246552f13..2fe74808b 100644 --- a/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.h +++ b/soh/src/overlays/actors/ovl_Door_Killer/z_door_killer.h @@ -16,7 +16,7 @@ typedef struct { struct DoorKiller; -typedef void (*DoorKillerActionFunc)(struct DoorKiller*, GlobalContext*); +typedef void (*DoorKillerActionFunc)(struct DoorKiller*, PlayState*); typedef struct DoorKiller { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 75a00a43a..91625301f 100644 --- a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -26,26 +26,26 @@ #define FLAGS ACTOR_FLAG_4 -void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorShutter_Init(Actor* thisx, PlayState* play); +void DoorShutter_Destroy(Actor* thisx, PlayState* play); +void DoorShutter_Update(Actor* thisx, PlayState* play); +void DoorShutter_Draw(Actor* thisx, PlayState* play); -void func_8099803C(GlobalContext* globalCtx, s16 y, s16 countdown, s16 arg3); -void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx); -void func_80996A54(DoorShutter* this, GlobalContext* globalCtx); -void func_80996B00(DoorShutter* this, GlobalContext* globalCtx); -void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx); -void func_80996EE8(DoorShutter* this, GlobalContext* globalCtx); -void func_80996F98(DoorShutter* this, GlobalContext* globalCtx); -void func_80997004(DoorShutter* this, GlobalContext* globalCtx); -void func_80997150(DoorShutter* this, GlobalContext* globalCtx); -void func_809973E8(DoorShutter* this, GlobalContext* globalCtx); -void func_80997528(DoorShutter* this, GlobalContext* globalCtx); -void func_80997568(DoorShutter* this, GlobalContext* globalCtx); -void func_809975C0(DoorShutter* this, GlobalContext* globalCtx); -void func_809976B8(DoorShutter* this, GlobalContext* globalCtx); -void func_80997744(DoorShutter* this, GlobalContext* globalCtx); +void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 arg3); +void DoorShutter_SetupType(DoorShutter* this, PlayState* play); +void func_80996A54(DoorShutter* this, PlayState* play); +void func_80996B00(DoorShutter* this, PlayState* play); +void func_80996B0C(DoorShutter* this, PlayState* play); +void func_80996EE8(DoorShutter* this, PlayState* play); +void func_80996F98(DoorShutter* this, PlayState* play); +void func_80997004(DoorShutter* this, PlayState* play); +void func_80997150(DoorShutter* this, PlayState* play); +void func_809973E8(DoorShutter* this, PlayState* play); +void func_80997528(DoorShutter* this, PlayState* play); +void func_80997568(DoorShutter* this, PlayState* play); +void func_809975C0(DoorShutter* this, PlayState* play); +void func_809976B8(DoorShutter* this, PlayState* play); +void func_80997744(DoorShutter* this, PlayState* play); const ActorInit Door_Shutter_InitVars = { ACTOR_DOOR_SHUTTER, @@ -174,8 +174,8 @@ void DoorShutter_SetupAction(DoorShutter* this, DoorShutterActionFunc actionFunc this->unk_16F = 0; } -s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { - TransitionActorEntry* transitionEntry = &globalCtx->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; +s32 DoorShutter_SetupDoor(DoorShutter* this, PlayState* play) { + TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; s8 frontRoom = transitionEntry->sides[0].room; s32 doorType = this->doorType; ShutterObjectInfo* temp_t0 = &sObjectInfo[this->unk_16B]; @@ -197,13 +197,13 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { this->unk_16C = (doorType == SHUTTER) ? temp_t0->index1 : temp_t0->index2; if (doorType == SHUTTER_FRONT_CLEAR) { - if (!Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (!Flags_GetClear(play, this->dyna.actor.room)) { DoorShutter_SetupAction(this, func_80996A54); this->unk_170 = 1.0f; return true; } } else if (doorType == SHUTTER_FRONT_SWITCH || doorType == SHUTTER_FRONT_SWITCH_BACK_CLEAR) { - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { DoorShutter_SetupAction(this, func_80996EE8); this->unk_170 = 1.0f; return true; @@ -218,9 +218,9 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { return false; } -void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { +void DoorShutter_Init(Actor* thisx, PlayState* play2) { DoorShutter* this = (DoorShutter*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 phi_a3; s32 pad; s32 objectIndex; @@ -235,7 +235,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { ShutterSceneInfo* phi_v1; for (phi_v1 = &sSceneInfo[0], i = 0; i < ARRAY_COUNT(sSceneInfo) - 1; i++, phi_v1++) { - if (globalCtx->sceneNum == phi_v1->sceneNum) { + if (play->sceneNum == phi_v1->sceneNum) { break; } } @@ -244,7 +244,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { BossDoorInfo* phi_v1_2; for (phi_v1_2 = &D_80998288[0], i = 0; i < ARRAY_COUNT(D_80998288) - 1; i++, phi_v1_2++) { - if (globalCtx->sceneNum == phi_v1_2->dungeonScene || globalCtx->sceneNum == phi_v1_2->bossScene) { + if (play->sceneNum == phi_v1_2->dungeonScene || play->sceneNum == phi_v1_2->bossScene) { break; } } @@ -252,7 +252,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { } else { this->dyna.actor.room = -1; } - if (this->requiredObjBankIndex = objectIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectInfo[phi_a3].objectId), + if (this->requiredObjBankIndex = objectIndex = Object_GetIndex(&play->objectCtx, sObjectInfo[phi_a3].objectId), (s8)objectIndex < 0) { Actor_Kill(&this->dyna.actor); return; @@ -260,7 +260,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { DoorShutter_SetupAction(this, DoorShutter_SetupType); this->unk_16B = phi_a3; if (this->doorType == SHUTTER_KEY_LOCKED || this->doorType == SHUTTER_BOSS) { - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { this->unk_16E = 10; } Actor_SetFocus(&this->dyna.actor, 60.0f); @@ -274,29 +274,29 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void DoorShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Destroy(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (this->dyna.actor.room >= 0) { s32 transitionActorId = (u16)this->dyna.actor.params >> 0xA; - globalCtx->transiActorCtx.list[transitionActorId].id *= -1; + play->transiActorCtx.list[transitionActorId].id *= -1; } } -void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void DoorShutter_SetupType(DoorShutter* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->dyna.actor.objBankIndex = this->requiredObjBankIndex; if (this->doorType == SHUTTER_PG_BARS || this->doorType == SHUTTER_GOHMA_BLOCK) { // Init dynapoly for shutters of the type that uses it CollisionHeader* colHeader = NULL; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); this->unk_16C = sObjectInfo[this->unk_16B].index1; CollisionHeader_GetVirtual((this->doorType == SHUTTER_GOHMA_BLOCK) ? &gGohmaDoorCol : &gPhantomGanonBarsCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->doorType == SHUTTER_GOHMA_BLOCK) { this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.gravity = -2.0f; @@ -307,16 +307,16 @@ void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx) { this->unk_164 = 7; } } else { - DoorShutter_SetupDoor(this, globalCtx); + DoorShutter_SetupDoor(this, play); } } } -f32 func_80996840(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg3, f32 arg4) { +f32 func_80996840(PlayState* play, DoorShutter* this, f32 arg2, f32 arg3, f32 arg4) { s32 pad; Vec3f sp28; Vec3f sp1C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sp28.x = player->actor.world.pos.x; sp28.y = player->actor.world.pos.y + arg2; @@ -329,12 +329,12 @@ f32 func_80996840(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg } } -s32 func_809968D4(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_809968D4(DoorShutter* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { ShutterInfo* temp_v1 = &sShutterInfo[this->unk_16C]; - f32 temp_f2 = func_80996840(globalCtx, this, (this->unk_16C != 3) ? 0.0f : 80.0f, temp_v1->e, temp_v1->f); + f32 temp_f2 = func_80996840(play, this, (this->unk_16C != 3) ? 0.0f : 80.0f, temp_v1->e, temp_v1->f); if (fabsf(temp_f2) < 50.0f) { s16 phi_v0 = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y; @@ -350,29 +350,29 @@ s32 func_809968D4(DoorShutter* this, GlobalContext* globalCtx) { return 0.0f; } -void func_80996A54(DoorShutter* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room) || Flags_GetTempClear(globalCtx, this->dyna.actor.room)) { - Flags_SetClear(globalCtx, this->dyna.actor.room); +void func_80996A54(DoorShutter* this, PlayState* play) { + if (Flags_GetClear(play, this->dyna.actor.room) || Flags_GetTempClear(play, this->dyna.actor.room)) { + Flags_SetClear(play, this->dyna.actor.room); DoorShutter_SetupAction(this, func_80997150); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); - OnePointCutscene_Attention(globalCtx, &GET_PLAYER(globalCtx)->actor); + OnePointCutscene_Attention(play, &this->dyna.actor); + OnePointCutscene_Attention(play, &GET_PLAYER(play)->actor); this->unk_16F = -100; - } else if (func_809968D4(this, globalCtx) != 0) { - Player* player = GET_PLAYER(globalCtx); + } else if (func_809968D4(this, play) != 0) { + Player* player = GET_PLAYER(play); player->naviTextId = -0x202; } } -void func_80996B00(DoorShutter* this, GlobalContext* globalCtx) { +void func_80996B00(DoorShutter* this, PlayState* play) { } -void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { +void func_80996B0C(DoorShutter* this, PlayState* play) { if (this->unk_164 != 0) { DoorShutter_SetupAction(this, func_80997004); this->dyna.actor.velocity.y = 0.0f; if (this->unk_16E != 0) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); if (this->doorType != SHUTTER_BOSS) { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); @@ -381,10 +381,10 @@ void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { } } } else { - s32 doorDirection = func_809968D4(this, globalCtx); + s32 doorDirection = func_809968D4(this, play); if (doorDirection != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unk_16E != 0) { if (this->doorType == SHUTTER_BOSS) { @@ -405,27 +405,27 @@ void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80996C60(DoorShutter* this, GlobalContext* globalCtx) { +void func_80996C60(DoorShutter* this, PlayState* play) { if (this->dyna.actor.category == ACTORCAT_DOOR) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp38 = this->unk_16C; s32 sp34 = 0xF; - if (DoorShutter_SetupDoor(this, globalCtx)) { + if (DoorShutter_SetupDoor(this, play)) { sp34 = 0x20; } DoorShutter_SetupAction(this, func_80997004); this->unk_16C = sp38; this->unk_170 = 0.0f; - Camera_ChangeDoorCam(globalCtx->cameraPtrs[MAIN_CAM], &this->dyna.actor, player->unk_46A, 0.0f, 12, sp34, 10); + Camera_ChangeDoorCam(play->cameraPtrs[MAIN_CAM], &this->dyna.actor, player->unk_46A, 0.0f, 12, sp34, 10); } } -s32 func_80996D14(DoorShutter* this, GlobalContext* globalCtx) { +s32 func_80996D14(DoorShutter* this, PlayState* play) { if (this->unk_16C != 3) { if (this->dyna.actor.velocity.y == 0.0f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); - func_80996C60(this, globalCtx); + func_80996C60(this, play); } Math_StepToF(&this->dyna.actor.velocity.y, 15.0f, 3.0f); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, @@ -435,7 +435,7 @@ s32 func_80996D14(DoorShutter* this, GlobalContext* globalCtx) { } else { if (this->unk_166 == 100) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYODOOR_OPEN); - func_80996C60(this, globalCtx); + func_80996C60(this, play); } if (Math_StepToS(&this->unk_166, 0, 10)) { return true; @@ -444,7 +444,7 @@ s32 func_80996D14(DoorShutter* this, GlobalContext* globalCtx) { return false; } -s32 func_80996E08(DoorShutter* this, GlobalContext* globalCtx, f32 arg2) { +s32 func_80996E08(DoorShutter* this, PlayState* play, f32 arg2) { if (this->unk_170 == 1.0f - arg2) { if (this->unk_16C != 3) { if (arg2 == 1.0f) { @@ -466,32 +466,32 @@ s32 func_80996E08(DoorShutter* this, GlobalContext* globalCtx, f32 arg2) { return false; } -void func_80996EE8(DoorShutter* this, GlobalContext* globalCtx) { - if (func_80996E08(this, globalCtx, 1.0f)) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_80996EE8(DoorShutter* this, PlayState* play) { + if (func_80996E08(this, play, 1.0f)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { DoorShutter_SetupAction(this, func_80997150); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_16F = -100; - } else if (func_809968D4(this, globalCtx)) { - Player* player = GET_PLAYER(globalCtx); + } else if (func_809968D4(this, play)) { + Player* player = GET_PLAYER(play); // Jabu navi text for switch doors is different - player->naviTextId = (globalCtx->sceneNum == SCENE_BDAN) ? -0x20B : -0x202; + player->naviTextId = (play->sceneNum == SCENE_BDAN) ? -0x20B : -0x202; } } } -void func_80996F98(DoorShutter* this, GlobalContext* globalCtx) { - if (this->unk_164 == 0 && !Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_80996F98(DoorShutter* this, PlayState* play) { + if (this->unk_164 == 0 && !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { DoorShutter_SetupAction(this, func_80996EE8); } else { - func_80996B0C(this, globalCtx); + func_80996B0C(this, play); } } -void func_80997004(DoorShutter* this, GlobalContext* globalCtx) { - if (DECR(this->unk_16E) == 0 && globalCtx->roomCtx.status == 0 && func_80996D14(this, globalCtx) != 0) { +void func_80997004(DoorShutter* this, PlayState* play) { + if (DECR(this->unk_16E) == 0 && play->roomCtx.status == 0 && func_80996D14(this, play) != 0) { if (((this->doorType == SHUTTER_BOSS) ? 20.0f : 50.0f) < this->dyna.actor.xzDistToPlayer) { - if (DoorShutter_SetupDoor(this, globalCtx)) { + if (DoorShutter_SetupDoor(this, play)) { this->dyna.actor.velocity.y = 30.0f; } if (this->unk_16C != 3) { @@ -500,7 +500,7 @@ void func_80997004(DoorShutter* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYODOOR_CLOSE); if ((this->doorType == SHUTTER_FRONT_SWITCH || this->doorType == SHUTTER_FRONT_SWITCH_BACK_CLEAR) && - !Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSHUTTER_CLOSE); } DoorShutter_SetupAction(this, func_80997528); @@ -509,10 +509,10 @@ void func_80997004(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80997150(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997150(DoorShutter* this, PlayState* play) { if (this->unk_16F != 0) { if (this->unk_16F < 0) { - if (globalCtx->state.frames % 2 != 0) { + if (play->state.frames % 2 != 0) { this->unk_16F++; } if (this->dyna.actor.category == func_8005B198() || this->unk_16F == 0) { @@ -521,7 +521,7 @@ void func_80997150(DoorShutter* this, GlobalContext* globalCtx) { } else { this->unk_16F--; } - } else if (func_80996E08(this, globalCtx, 0.0f)) { + } else if (func_80996E08(this, play, 0.0f)) { if (!(this->doorType == SHUTTER || this->doorType == SHUTTER_FRONT_CLEAR)) { DoorShutter_SetupAction(this, func_80996F98); } else { @@ -531,8 +531,8 @@ void func_80997150(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80997220(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80997220(DoorShutter* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 room = this->dyna.actor.room; if (this->dyna.actor.room >= 0) { @@ -540,26 +540,26 @@ void func_80997220(DoorShutter* this, GlobalContext* globalCtx) { func_8002DBD0(&this->dyna.actor, &vec, &player->actor.world.pos); this->dyna.actor.room = - globalCtx->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA].sides[(vec.z < 0.0f) ? 0 : 1].room; + play->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA].sides[(vec.z < 0.0f) ? 0 : 1].room; if (room != this->dyna.actor.room) { - Room tempRoom = globalCtx->roomCtx.curRoom; + Room tempRoom = play->roomCtx.curRoom; - globalCtx->roomCtx.curRoom = globalCtx->roomCtx.prevRoom; - globalCtx->roomCtx.prevRoom = tempRoom; - globalCtx->roomCtx.unk_30 ^= 1; + play->roomCtx.curRoom = play->roomCtx.prevRoom; + play->roomCtx.prevRoom = tempRoom; + play->roomCtx.unk_30 ^= 1; } - func_80097534(globalCtx, &globalCtx->roomCtx); - Gameplay_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0x0EFF); + func_80097534(play, &play->roomCtx); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0x0EFF); } this->unk_164 = 0; this->dyna.actor.velocity.y = 0.0f; - if (DoorShutter_SetupDoor(this, globalCtx) && !(player->stateFlags1 & 0x800)) { + if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & 0x800)) { DoorShutter_SetupAction(this, func_80997568); - func_8002DF54(globalCtx, NULL, 2); + func_8002DF54(play, NULL, 2); } } -void func_809973E8(DoorShutter* this, GlobalContext* globalCtx) { +void func_809973E8(DoorShutter* this, PlayState* play) { s32 quakeId; if (this->dyna.actor.velocity.y < 20.0f) { @@ -568,35 +568,35 @@ void func_809973E8(DoorShutter* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { if (this->dyna.actor.velocity.y > 20.0f) { this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y; - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 45.0f, 10, 8.0f, 500, + Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 45.0f, 10, 8.0f, 500, 10, false); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - quakeId = Quake_Add(Gameplay_GetCamera(globalCtx, 0), 3); + quakeId = Quake_Add(Play_GetCamera(play, 0), 3); Quake_SetSpeed(quakeId, -32536); Quake_SetQuakeValues(quakeId, 2, 0, 0, 0); Quake_SetCountdown(quakeId, 10); func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); - func_80997220(this, globalCtx); + func_80997220(this, play); } } -void func_80997528(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997528(DoorShutter* this, PlayState* play) { if (Math_StepToS(&this->unk_166, 0x64, 0xA)) { - func_80997220(this, globalCtx); + func_80997220(this, play); } } -void func_80997568(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997568(DoorShutter* this, PlayState* play) { if (this->unk_16F++ > 30) { - func_8002DF54(globalCtx, NULL, 7); - DoorShutter_SetupDoor(this, globalCtx); + func_8002DF54(play, NULL, 7); + DoorShutter_SetupDoor(this, play); } } -void func_809975C0(DoorShutter* this, GlobalContext* globalCtx) { +void func_809975C0(DoorShutter* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); if (this->dyna.actor.bgCheckFlags & 1) { DoorShutter_SetupAction(this, func_809976B8); if (!(gSaveContext.eventChkInf[7] & 1)) { @@ -604,14 +604,14 @@ void func_809975C0(DoorShutter* this, GlobalContext* globalCtx) { this->unk_164 = 10; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - func_8099803C(globalCtx, 2, 10, parent->subCameraId); - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, + func_8099803C(play, 2, 10, parent->subCameraId); + Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, 10, true); } } } -void func_809976B8(DoorShutter* this, GlobalContext* globalCtx) { +void func_809976B8(DoorShutter* this, PlayState* play) { f32 mult; if (this->unk_164 != 0) { @@ -621,7 +621,7 @@ void func_809976B8(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80997744(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997744(DoorShutter* this, PlayState* play) { f32 phi_f0; osSyncPrintf("FHG SAKU START !!\n"); @@ -633,16 +633,16 @@ void func_80997744(DoorShutter* this, GlobalContext* globalCtx) { osSyncPrintf("FHG SAKU END !!\n"); } -void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Update(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x100004C0) || (this->actionFunc == DoorShutter_SetupType)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -Gfx* func_80997838(GlobalContext* globalCtx, DoorShutter* this, Gfx* p) { +Gfx* func_80997838(PlayState* play, DoorShutter* this, Gfx* p) { MtxF mtx; f32 angle = 0.0f; f32 yScale = this->unk_166 * 0.01f; @@ -661,7 +661,7 @@ Gfx* func_80997838(GlobalContext* globalCtx, DoorShutter* this, Gfx* p) { if (this->unk_166 != 100) { Matrix_Scale(1.0f, yScale, 1.0f, MTXMODE_APPLY); } - gSPMatrix(p++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(p++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(p++, sJabuDoorDLists[i]); angle -= M_PI / 4; @@ -670,14 +670,14 @@ Gfx* func_80997838(GlobalContext* globalCtx, DoorShutter* this, Gfx* p) { return p; } -s32 func_80997A34(DoorShutter* this, GlobalContext* globalCtx) { +s32 func_80997A34(DoorShutter* this, PlayState* play) { s32 phi_a1; s32 phi_a0; - if (Player_InCsMode(globalCtx)) { + if (Player_InCsMode(play)) { return true; } - phi_a0 = (s16)(Actor_WorldYawTowardPoint(&this->dyna.actor, &globalCtx->view.eye) - this->dyna.actor.shape.rot.y); + phi_a0 = (s16)(Actor_WorldYawTowardPoint(&this->dyna.actor, &play->view.eye) - this->dyna.actor.shape.rot.y); phi_a1 = (s16)(this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y); phi_a0 = ABS(phi_a0); phi_a1 = ABS(phi_a1); @@ -687,7 +687,7 @@ s32 func_80997A34(DoorShutter* this, GlobalContext* globalCtx) { return true; } -void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Draw(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; //! @bug This actor is not fully initialized until the required object dependency is loaded. @@ -703,35 +703,35 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { //! the init vars for the actor, and only set draw after initialization is complete. if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex && - (this->unk_16B == 0 || func_80997A34(this, globalCtx) != 0)) { + (this->unk_16B == 0 || func_80997A34(this, play) != 0)) { s32 pad[2]; ShutterInfo* sp70 = &sShutterInfo[this->unk_16C]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->unk_16C == 3) { - POLY_OPA_DISP = func_80997838(globalCtx, this, POLY_OPA_DISP); + POLY_OPA_DISP = func_80997838(play, this, POLY_OPA_DISP); if (this->unk_170 != 0.0f) { f32 sp58 = (this->unk_166 * 0.01f) * this->unk_170; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255.0f * sp58); Matrix_Translate(0, 0, sp70->translateZ, MTXMODE_APPLY); Matrix_Scale(sp58, sp58, sp58, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp70->b); } } else { if (sp70->b != NULL) { TransitionActorEntry* transitionEntry = - &globalCtx->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; + &play->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; - if (globalCtx->roomCtx.prevRoom.num >= 0 || + if (play->roomCtx.prevRoom.num >= 0 || transitionEntry->sides[0].room == transitionEntry->sides[1].room) { - s32 yaw = Math_Vec3f_Yaw(&globalCtx->view.eye, &this->dyna.actor.world.pos); + s32 yaw = Math_Vec3f_Yaw(&play->view.eye, &this->dyna.actor.world.pos); if (ABS((s16)(this->dyna.actor.shape.rot.y - yaw)) < 0x4000) { Matrix_RotateY(M_PI, MTXMODE_APPLY); @@ -742,12 +742,12 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { } else if (this->doorType == SHUTTER_BOSS) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809982D4[this->unk_168])); } - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp70->a); if (this->unk_170 != 0.0f && sp70->b != NULL) { Matrix_Translate(0, sp70->c * (1.0f - this->unk_170), sp70->translateZ, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp70->b); } @@ -755,18 +755,18 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_16E != 0) { Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY); - Actor_DrawDoorLock(globalCtx, this->unk_16E, + Actor_DrawDoorLock(play, this->unk_16E, (this->doorType == SHUTTER_BOSS) ? DOORLOCK_BOSS : ((this->unk_16C == 6) ? DOORLOCK_NORMAL_SPIRIT : DOORLOCK_NORMAL)); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_8099803C(GlobalContext* globalCtx, s16 y, s16 countdown, s16 camId) { - s16 quakeId = Quake_Add(Gameplay_GetCamera(globalCtx, camId), 3); +void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 camId) { + s16 quakeId = Quake_Add(Play_GetCamera(play, camId), 3); func_800A9F6C(0.0f, 180, 20, 100); Quake_SetSpeed(quakeId, 20000); diff --git a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index d9a17f07b..029132210 100644 --- a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -41,7 +41,7 @@ typedef enum { struct DoorShutter; -typedef void (*DoorShutterActionFunc)(struct DoorShutter*, GlobalContext*); +typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*); typedef struct DoorShutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Door_Toki/z_door_toki.c b/soh/src/overlays/actors/ovl_Door_Toki/z_door_toki.c index 6a8ae1568..b6a8b83e0 100644 --- a/soh/src/overlays/actors/ovl_Door_Toki/z_door_toki.c +++ b/soh/src/overlays/actors/ovl_Door_Toki/z_door_toki.c @@ -9,9 +9,9 @@ #define FLAGS 0 -void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorToki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorToki_Update(Actor* thisx, GlobalContext* globalCtx); +void DoorToki_Init(Actor* thisx, PlayState* play); +void DoorToki_Destroy(Actor* thisx, PlayState* play); +void DoorToki_Update(Actor* thisx, PlayState* play); const ActorInit Door_Toki_InitVars = { ACTOR_DOOR_TOKI, @@ -30,7 +30,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorToki_Init(Actor* thisx, PlayState* play) { s32 pad; DoorToki* this = (DoorToki*)thisx; CollisionHeader* colHeader = NULL; @@ -38,21 +38,21 @@ void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDoorTokiCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void DoorToki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorToki_Destroy(Actor* thisx, PlayState* play) { DoorToki* this = (DoorToki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void DoorToki_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorToki_Update(Actor* thisx, PlayState* play) { DoorToki* this = (DoorToki*)thisx; if (gSaveContext.eventChkInf[4] & 0x800) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } } diff --git a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 9e58bf958..2ea62559a 100644 --- a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -3,35 +3,35 @@ #define FLAGS 0 -void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorWarp1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorWarp1_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorWarp1_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorWarp1_Init(Actor* thisx, PlayState* play); +void DoorWarp1_Destroy(Actor* thisx, PlayState* play); +void DoorWarp1_Update(Actor* thisx, PlayState* play); +void DoorWarp1_Draw(Actor* thisx, PlayState* play); void DoorWarp1_Reset(void); -void DoorWarp1_WarpAppear(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_Destination(DoorWarp1* this, GlobalContext* globalCtx); -void func_8099B020(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_AwaitClearFlag(DoorWarp1* this, GlobalContext* globalCtx); -void func_8099A3A4(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_BlueCrystal(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_PurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999214(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999348(DoorWarp1* this, GlobalContext* globalCtx); -void func_809995D4(DoorWarp1* this, GlobalContext* globalCtx); -void func_809998A4(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_RutoWarpIdle(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999EE0(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999FE4(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx); -void func_8099A508(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_DoNothing(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_ChooseInitialAction(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_FloatPlayer(DoorWarp1* this, GlobalContext* globalCtx); +void DoorWarp1_WarpAppear(DoorWarp1* this, PlayState* play); +void DoorWarp1_Destination(DoorWarp1* this, PlayState* play); +void func_8099B020(DoorWarp1* this, PlayState* play); +void DoorWarp1_AwaitClearFlag(DoorWarp1* this, PlayState* play); +void func_8099A3A4(DoorWarp1* this, PlayState* play); +void DoorWarp1_BlueCrystal(DoorWarp1* this, PlayState* play); +void DoorWarp1_PurpleCrystal(DoorWarp1* this, PlayState* play); +void func_80999214(DoorWarp1* this, PlayState* play); +void func_80999348(DoorWarp1* this, PlayState* play); +void func_809995D4(DoorWarp1* this, PlayState* play); +void func_809998A4(DoorWarp1* this, PlayState* play); +void DoorWarp1_ChildWarpIdle(DoorWarp1* this, PlayState* play); +void DoorWarp1_RutoWarpIdle(DoorWarp1* this, PlayState* play); +void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play); +void func_80999EE0(DoorWarp1* this, PlayState* play); +void func_80999FE4(DoorWarp1* this, PlayState* play); +void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play); +void DoorWarp1_AdultWarpIdle(DoorWarp1* this, PlayState* play); +void func_8099A508(DoorWarp1* this, PlayState* play); +void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play); +void DoorWarp1_DoNothing(DoorWarp1* this, PlayState* play); +void DoorWarp1_ChooseInitialAction(DoorWarp1* this, PlayState* play); +void DoorWarp1_FloatPlayer(DoorWarp1* this, PlayState* play); const ActorInit Door_Warp1_InitVars = { ACTOR_DOOR_WARP1, @@ -59,9 +59,9 @@ void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Init(Actor* thisx, PlayState* play) { DoorWarp1* this = (DoorWarp1*)thisx; - GlobalContext* globalCtx2 = globalCtx; + PlayState* play2 = play; this->unk_1B8 = 0; @@ -74,33 +74,33 @@ void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->upperLightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->upperLight = LightContext_InsertLight(globalCtx2, &globalCtx2->lightCtx, &this->upperLightInfo); + this->upperLight = LightContext_InsertLight(play2, &play2->lightCtx, &this->upperLightInfo); Lights_PointNoGlowSetInfo(&this->lowerLightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->lowerLight = LightContext_InsertLight(globalCtx2, &globalCtx2->lightCtx, &this->lowerLightInfo); + this->lowerLight = LightContext_InsertLight(play2, &play2->lightCtx, &this->lowerLightInfo); } osSyncPrintf("\nBOSSWARP arg_data=[%d]", this->actor.params); - DoorWarp1_ChooseInitialAction(this, globalCtx2); + DoorWarp1_ChooseInitialAction(this, play2); } -void DoorWarp1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Destroy(Actor* thisx, PlayState* play) { u8 i; DoorWarp1* this = (DoorWarp1*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->upperLight); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lowerLight); + LightContext_RemoveLight(play, &play->lightCtx, this->upperLight); + LightContext_RemoveLight(play, &play->lightCtx, this->lowerLight); for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = globalCtx->envCtx.adjLight1Color[i] = + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] = 0; } //! @bug SkelAnime_Free is not called for crystal variants } -void DoorWarp1_SetupWarp(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->scale = 0; this->unk_1AE = -140; @@ -172,7 +172,7 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, GlobalContext* globalCtx) { gSaveContext.entranceIndex == 0x610 || // desert colossus gSaveContext.entranceIndex == 0x580) && // graveyard gSaveContext.sceneSetupIndex < 4) || - (GET_PLAYER(globalCtx)->actor.params & 0xF00) != 0x200) { + (GET_PLAYER(play)->actor.params & 0xF00) != 0x200) { Actor_Kill(&this->actor); } if (Actor_WorldDistXZToActor(&player->actor, &this->actor) > 100.0f) { @@ -189,8 +189,8 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_SetupAdultDungeonWarp(DoorWarp1* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); +void DoorWarp1_SetupAdultDungeonWarp(DoorWarp1* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 1.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 40.0f, 1); this->scale = 0; @@ -215,10 +215,10 @@ void DoorWarp1_SetupAdultDungeonWarp(DoorWarp1* this, GlobalContext* globalCtx) DoorWarp1_SetupAction(this, func_8099A3A4); } -void DoorWarp1_SetupBlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_SetupBlueCrystal(DoorWarp1* this, PlayState* play) { s16 i; - SkelAnime_Init(globalCtx, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 0, Animation_GetLastFrame(&gWarpCrystalAnim), Animation_GetLastFrame(&gWarpCrystalAnim), ANIMMODE_ONCE, 0.0f, 1); @@ -237,18 +237,18 @@ void DoorWarp1_SetupBlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = 800.0f; for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = globalCtx->envCtx.adjLight1Color[i] = + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] = -255; } - globalCtx->envCtx.adjFogNear = -500; + play->envCtx.adjFogNear = -500; this->warpTimer = 30; this->unk_1B8 = 4000; DoorWarp1_SetupAction(this, DoorWarp1_BlueCrystal); } -void DoorWarp1_SetupPurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); +void DoorWarp1_SetupPurpleCrystal(DoorWarp1* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 0, Animation_GetLastFrame(&gWarpCrystalAnim), Animation_GetLastFrame(&gWarpCrystalAnim), ANIMMODE_ONCE, 0.0f, 1); @@ -278,8 +278,8 @@ void DoorWarp1_SetupPurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { DoorWarp1_SetupAction(this, DoorWarp1_PurpleCrystal); } -void DoorWarp1_SetPlayerPos(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_SetPlayerPos(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.velocity.y = 0.0f; player->actor.world.pos.x = this->actor.world.pos.x; @@ -287,16 +287,16 @@ void DoorWarp1_SetPlayerPos(DoorWarp1* this, GlobalContext* globalCtx) { player->actor.world.pos.z = this->actor.world.pos.z; } -void DoorWarp1_BlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_BlueCrystal(DoorWarp1* this, PlayState* play) { if (this->warpTimer != 0) { this->warpTimer--; } else { DoorWarp1_SetupAction(this, func_80999214); } - DoorWarp1_SetPlayerPos(this, globalCtx); + DoorWarp1_SetPlayerPos(this, play); } -void func_80999214(DoorWarp1* this, GlobalContext* globalCtx) { +void func_80999214(DoorWarp1* this, PlayState* play) { s32 temp_f4; f32 darkness; s16 i; @@ -307,23 +307,23 @@ void func_80999214(DoorWarp1* this, GlobalContext* globalCtx) { darkness = CLAMP_MIN(darkness, 0); for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = globalCtx->envCtx.adjLight1Color[i] = + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] = -255.0f * darkness; } - globalCtx->envCtx.adjFogNear = -500.0f * darkness; + play->envCtx.adjFogNear = -500.0f * darkness; this->warpTimer++; if (darkness <= 0) { DoorWarp1_SetupAction(this, func_80999348); } this->actor.shape.rot.y += 0x320; - DoorWarp1_SetPlayerPos(this, globalCtx); + DoorWarp1_SetPlayerPos(this, play); } -void func_80999348(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80999348(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); - DoorWarp1_SetPlayerPos(this, globalCtx); + DoorWarp1_SetPlayerPos(this, play); if (this->warpTimer == 0) { Math_SmoothStepToF(&this->crystalAlpha, 0.0f, 0.1f, 4.0f, 1.0f); @@ -339,13 +339,13 @@ void func_80999348(DoorWarp1* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += 0x320; } -void DoorWarp1_FloatPlayer(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_FloatPlayer(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.gravity = -0.1f; } -void DoorWarp1_PurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_PurpleCrystal(DoorWarp1* this, PlayState* play) { if (this->warpTimer != 0) { this->warpTimer--; Math_SmoothStepToF(&this->actor.scale.x, 0.0499f, 0.2f, 0.05f, 0.001f); @@ -355,7 +355,7 @@ void DoorWarp1_PurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_ChooseInitialAction(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_ChooseInitialAction(DoorWarp1* this, PlayState* play) { switch (this->actor.params) { case WARP_DUNGEON_CHILD: case WARP_CLEAR_FLAG: @@ -367,29 +367,29 @@ void DoorWarp1_ChooseInitialAction(DoorWarp1* this, GlobalContext* globalCtx) { case WARP_ORANGE: case WARP_GREEN: case WARP_RED: - DoorWarp1_SetupWarp(this, globalCtx); + DoorWarp1_SetupWarp(this, play); break; case WARP_DUNGEON_ADULT: - DoorWarp1_SetupAdultDungeonWarp(this, globalCtx); + DoorWarp1_SetupAdultDungeonWarp(this, play); break; case WARP_BLUE_CRYSTAL: - DoorWarp1_SetupBlueCrystal(this, globalCtx); + DoorWarp1_SetupBlueCrystal(this, play); break; case WARP_PURPLE_CRYSTAL: - DoorWarp1_SetupPurpleCrystal(this, globalCtx); + DoorWarp1_SetupPurpleCrystal(this, play); break; } } -void DoorWarp1_AwaitClearFlag(DoorWarp1* this, GlobalContext* globalCtx) { - if (Flags_GetTempClear(globalCtx, this->actor.room)) { +void DoorWarp1_AwaitClearFlag(DoorWarp1* this, PlayState* play) { + if (Flags_GetTempClear(play, this->actor.room)) { this->warpTimer = 200; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); DoorWarp1_SetupAction(this, func_809995D4); } } -void func_809995D4(DoorWarp1* this, GlobalContext* globalCtx) { +void func_809995D4(DoorWarp1* this, PlayState* play) { if (this->warpTimer == 0) { if (this->actor.xzDistToPlayer < 100.0f) { this->actor.world.pos.x = -98.0f; @@ -405,7 +405,7 @@ void func_809995D4(DoorWarp1* this, GlobalContext* globalCtx) { this->warpTimer--; } -void DoorWarp1_WarpAppear(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_WarpAppear(DoorWarp1* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->lightRayAlpha, 255.0f, 0.4f, 10.0f, 0.01f); Math_SmoothStepToF(&this->warpAlpha, 255.0f, 0.4f, 10.0f, 0.01f); @@ -439,7 +439,7 @@ void DoorWarp1_WarpAppear(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_809998A4(DoorWarp1* this, GlobalContext* globalCtx) { +void func_809998A4(DoorWarp1* this, PlayState* play) { if (this->lightRayAlpha != 0.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); } @@ -447,8 +447,8 @@ void func_809998A4(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->warpAlpha, 0.0f, 0.1f, 2.0f, 0.01f); } -s32 DoorWarp1_PlayerInRange(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 DoorWarp1_PlayerInRange(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; if (fabsf(this->actor.xzDistToPlayer) < 60.0f) { @@ -461,18 +461,18 @@ s32 DoorWarp1_PlayerInRange(DoorWarp1* this, GlobalContext* globalCtx) { return ret; } -void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globalCtx, u8 ruto, u8 adult) { - GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, 0x00, GI_NONE); +void GivePlayerRandoReward(DoorWarp1* this, Player* player, PlayState* play, u8 ruto, u8 adult) { + GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, play->sceneNum, 0x00, GI_NONE); - if (this->actor.parent != NULL && this->actor.parent->id == GET_PLAYER(globalCtx)->actor.id && - !Flags_GetTreasure(globalCtx, 0x1F)) { - Flags_SetTreasure(globalCtx, 0x1F); - } else if (!Flags_GetTreasure(globalCtx, 0x1F)) { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 100.0f); - } else if (!Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) { + if (this->actor.parent != NULL && this->actor.parent->id == GET_PLAYER(play)->actor.id && + !Flags_GetTreasure(play, 0x1F)) { + Flags_SetTreasure(play, 0x1F); + } else if (!Flags_GetTreasure(play, 0x1F)) { + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 100.0f); + } else if (!Player_InBlockingCsMode(play, GET_PLAYER(play))) { if (adult) { - OnePointCutscene_Init(globalCtx, 0x25E8, 999, &this->actor, MAIN_CAM); - func_8002DF54(globalCtx, &this->actor, 10); + OnePointCutscene_Init(play, 0x25E8, 999, &this->actor, MAIN_CAM); + func_8002DF54(play, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; this->unk_1B2 = 20; @@ -480,14 +480,14 @@ void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globa } else { if (ruto) { this->rutoWarpState = WARP_BLUE_RUTO_STATE_ENTERED; - func_8002DF54(globalCtx, &this->actor, 10); + func_8002DF54(play, &this->actor, 10); this->unk_1B2 = 1; DoorWarp1_SetupAction(this, func_80999EE0); } else { Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); - OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, MAIN_CAM); - func_8002DF54(globalCtx, &this->actor, 10); + OnePointCutscene_Init(play, 0x25E7, 999, &this->actor, MAIN_CAM); + func_8002DF54(play, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; @@ -499,23 +499,23 @@ void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globa } } -void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_ChildWarpIdle(DoorWarp1* this, PlayState* play) { Player* player; Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if (DoorWarp1_PlayerInRange(this, globalCtx)) { - player = GET_PLAYER(globalCtx); + if (DoorWarp1_PlayerInRange(this, play)) { + player = GET_PLAYER(play); if (gSaveContext.n64ddFlag) { - GivePlayerRandoReward(this, player, globalCtx, 0, 0); + GivePlayerRandoReward(this, player, play, 0, 0); return; } Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); - OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, MAIN_CAM); - func_8002DF54(globalCtx, &this->actor, 10); + OnePointCutscene_Init(play, 0x25E7, 999, &this->actor, MAIN_CAM); + func_8002DF54(play, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; @@ -524,8 +524,8 @@ void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1B2 >= 101) { if (player->actor.velocity.y < 10.0f) { @@ -541,48 +541,48 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { this->warpTimer++; if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == 0xFFEF) { - osSyncPrintf("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", globalCtx->sceneLoadFlag, 0x14); + osSyncPrintf("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", play->sceneLoadFlag, 0x14); - if (globalCtx->sceneNum == SCENE_DDAN_BOSS) { + if (play->sceneNum == SCENE_DDAN_BOSS) { if (!Flags_GetEventChkInf(0x25)) { Flags_SetEventChkInf(0x25); Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_DODONGOS_CAVERN); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x47A; + play->nextEntranceIndex = 0x47A; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_GORON_RUBY); - globalCtx->nextEntranceIndex = 0x13D; + Item_Give(play, ITEM_GORON_RUBY); + play->nextEntranceIndex = 0x13D; gSaveContext.nextCutsceneIndex = 0xFFF1; } } else { - globalCtx->nextEntranceIndex = 0x47A; + play->nextEntranceIndex = 0x47A; gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_YDAN_BOSS) { + } else if (play->sceneNum == SCENE_YDAN_BOSS) { if (!Flags_GetEventChkInf(7) || gSaveContext.n64ddFlag) { Flags_SetEventChkInf(7); Flags_SetEventChkInf(9); Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_DEKU_TREE); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x0457; + play->nextEntranceIndex = 0x0457; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_KOKIRI_EMERALD); - globalCtx->nextEntranceIndex = 0xEE; + Item_Give(play, ITEM_KOKIRI_EMERALD); + play->nextEntranceIndex = 0xEE; gSaveContext.nextCutsceneIndex = 0xFFF1; } } else { - globalCtx->nextEntranceIndex = 0x457; + play->nextEntranceIndex = 0x457; gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_BDAN_BOSS) { - globalCtx->nextEntranceIndex = 0x10E; + } else if (play->sceneNum == SCENE_BDAN_BOSS) { + play->nextEntranceIndex = 0x10E; gSaveContext.nextCutsceneIndex = 0; } osSyncPrintf("\n\n\nおわりおわり"); - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 7; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 7; gSaveContext.nextTransition = 3; } @@ -597,18 +597,18 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 0.5f, 2.0f, 0.1f); } -void DoorWarp1_RutoWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_RutoWarpIdle(DoorWarp1* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if (this->rutoWarpState != WARP_BLUE_RUTO_STATE_INITIAL && DoorWarp1_PlayerInRange(this, globalCtx)) { + if (this->rutoWarpState != WARP_BLUE_RUTO_STATE_INITIAL && DoorWarp1_PlayerInRange(this, play)) { if (gSaveContext.n64ddFlag) { - GivePlayerRandoReward(this, GET_PLAYER(globalCtx), globalCtx, 1, 0); + GivePlayerRandoReward(this, GET_PLAYER(play), play, 1, 0); return; } this->rutoWarpState = WARP_BLUE_RUTO_STATE_ENTERED; - func_8002DF54(globalCtx, &this->actor, 10); + func_8002DF54(play, &this->actor, 10); this->unk_1B2 = 1; DoorWarp1_SetupAction(this, func_80999EE0); } @@ -616,16 +616,16 @@ void DoorWarp1_RutoWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { static s16 sRutoWarpSubCamId; -void func_80999EE0(DoorWarp1* this, GlobalContext* globalCtx) { +void func_80999EE0(DoorWarp1* this, PlayState* play) { Vec3f at; Vec3f eye; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->rutoWarpState == WARP_BLUE_RUTO_STATE_3) { - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - sRutoWarpSubCamId = Gameplay_CreateSubCamera(globalCtx); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + sRutoWarpSubCamId = Play_CreateSubCamera(play); - Gameplay_ChangeCameraStatus(globalCtx, sRutoWarpSubCamId, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, sRutoWarpSubCamId, CAM_STAT_ACTIVE); at.x = this->actor.world.pos.x; at.y = 49.0f; at.z = this->actor.world.pos.z; @@ -633,29 +633,29 @@ void func_80999EE0(DoorWarp1* this, GlobalContext* globalCtx) { eye.y = 43.0f; eye.z = player->actor.world.pos.z; - Gameplay_CameraSetAtEye(globalCtx, sRutoWarpSubCamId, &at, &eye); - Gameplay_CameraSetFov(globalCtx, sRutoWarpSubCamId, 90.0f); + Play_CameraSetAtEye(play, sRutoWarpSubCamId, &at, &eye); + Play_CameraSetFov(play, sRutoWarpSubCamId, 90.0f); this->rutoWarpState = WARP_BLUE_RUTO_STATE_TALKING; if (!gSaveContext.n64ddFlag) { - Message_StartTextbox(globalCtx, 0x4022, NULL); + Message_StartTextbox(play, 0x4022, NULL); } DoorWarp1_SetupAction(this, func_80999FE4); } } -void func_80999FE4(DoorWarp1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { +void func_80999FE4(DoorWarp1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); - OnePointCutscene_Init(globalCtx, 0x25E9, 999, &this->actor, MAIN_CAM); - Gameplay_CopyCamera(globalCtx, -1, sRutoWarpSubCamId); - Gameplay_ChangeCameraStatus(globalCtx, sRutoWarpSubCamId, CAM_STAT_WAIT); + OnePointCutscene_Init(play, 0x25E9, 999, &this->actor, MAIN_CAM); + Play_CopyCamera(play, -1, sRutoWarpSubCamId); + Play_ChangeCameraStatus(play, sRutoWarpSubCamId, CAM_STAT_WAIT); this->rutoWarpState = WARP_BLUE_RUTO_STATE_WARPING; DoorWarp1_SetupAction(this, DoorWarp1_RutoWarpOut); } } -void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1B2 >= 61) { if (player->actor.velocity.y < 10.f) { @@ -674,16 +674,16 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_JABU_JABUS_BELLY); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x10E; + play->nextEntranceIndex = 0x10E; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_ZORA_SAPPHIRE); - globalCtx->nextEntranceIndex = 0x10E; + Item_Give(play, ITEM_ZORA_SAPPHIRE); + play->nextEntranceIndex = 0x10E; gSaveContext.nextCutsceneIndex = 0xFFF0; } - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 7; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 7; } Math_StepToF(&this->unk_194, 2.0f, 0.01f); @@ -697,7 +697,7 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 0.5f, 2.0f, 0.1f); } -void func_8099A3A4(DoorWarp1* this, GlobalContext* globalCtx) { +void func_8099A3A4(DoorWarp1* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->lightRayAlpha, 255.0f, 0.2f, 2.0f, 0.1f); Math_SmoothStepToF(&this->warpAlpha, 255.0f, 0.2f, 2.0f, 0.1f); @@ -715,21 +715,21 @@ void func_8099A3A4(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_AdultWarpIdle(DoorWarp1* this, PlayState* play) { Player* player; Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if (DoorWarp1_PlayerInRange(this, globalCtx)) { - player = GET_PLAYER(globalCtx); + if (DoorWarp1_PlayerInRange(this, play)) { + player = GET_PLAYER(play); if (gSaveContext.n64ddFlag) { - GivePlayerRandoReward(this, player, globalCtx, 0, 1); + GivePlayerRandoReward(this, player, play, 0, 1); return; } - OnePointCutscene_Init(globalCtx, 0x25E8, 999, &this->actor, MAIN_CAM); - func_8002DF54(globalCtx, &this->actor, 10); + OnePointCutscene_Init(play, 0x25E8, 999, &this->actor, MAIN_CAM); + func_8002DF54(play, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; this->unk_1B2 = 20; @@ -737,8 +737,8 @@ void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_8099A508(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8099A508(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1B2 != 0) { this->unk_1B2--; @@ -752,8 +752,8 @@ void func_8099A508(DoorWarp1* this, GlobalContext* globalCtx) { DoorWarp1_SetupAction(this, DoorWarp1_AdultWarpOut); } -void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f0_2; if (this->unk_1B2 != 0) { @@ -782,131 +782,131 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { this->warpTimer++; if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == 0xFFEF) { - if (globalCtx->sceneNum == SCENE_MORIBOSSROOM) { + if (play->sceneNum == SCENE_MORIBOSSROOM) { if (!(gSaveContext.eventChkInf[4] & 0x100)) { gSaveContext.eventChkInf[4] |= 0x100; Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_FOREST_TEMPLE); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x608; + play->nextEntranceIndex = 0x608; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_MEDALLION_FOREST); - globalCtx->nextEntranceIndex = 0x6B; + Item_Give(play, ITEM_MEDALLION_FOREST); + play->nextEntranceIndex = 0x6B; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; } } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = 0x600; + play->nextEntranceIndex = 0x600; } else { - globalCtx->nextEntranceIndex = 0x608; + play->nextEntranceIndex = 0x608; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_FIRE_BS) { + } else if (play->sceneNum == SCENE_FIRE_BS) { if (!(gSaveContext.eventChkInf[4] & 0x200)) { gSaveContext.eventChkInf[4] |= 0x200; Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_FIRE_TEMPLE); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x564; + play->nextEntranceIndex = 0x564; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); - globalCtx->nextEntranceIndex = 0xDB; + Item_Give(play, ITEM_MEDALLION_FIRE); + play->nextEntranceIndex = 0xDB; gSaveContext.nextCutsceneIndex = 0xFFF3; } } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = 0x4F6; + play->nextEntranceIndex = 0x4F6; } else { - globalCtx->nextEntranceIndex = 0x564; + play->nextEntranceIndex = 0x564; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_MIZUSIN_BS) { + } else if (play->sceneNum == SCENE_MIZUSIN_BS) { if (!(gSaveContext.eventChkInf[4] & 0x400)) { gSaveContext.eventChkInf[4] |= 0x400; Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_WATER_TEMPLE); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x60C; + play->nextEntranceIndex = 0x60C; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_MEDALLION_WATER); - globalCtx->nextEntranceIndex = 0x6B; + Item_Give(play, ITEM_MEDALLION_WATER); + play->nextEntranceIndex = 0x6B; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_WATER; } } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = 0x604; + play->nextEntranceIndex = 0x604; } else { - globalCtx->nextEntranceIndex = 0x60C; + play->nextEntranceIndex = 0x60C; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_JYASINBOSS) { + } else if (play->sceneNum == SCENE_JYASINBOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) || gSaveContext.n64ddFlag) { Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_SPIRIT_TEMPLE); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x610; + play->nextEntranceIndex = 0x610; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_MEDALLION_SPIRIT); - globalCtx->nextEntranceIndex = 0x6B; + Item_Give(play, ITEM_MEDALLION_SPIRIT); + play->nextEntranceIndex = 0x6B; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SPIRIT; } } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = 0x1F1; + play->nextEntranceIndex = 0x1F1; } else { - globalCtx->nextEntranceIndex = 0x610; + play->nextEntranceIndex = 0x610; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_HAKADAN_BS) { + } else if (play->sceneNum == SCENE_HAKADAN_BS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) || gSaveContext.n64ddFlag) { Flags_SetRandomizerInf(RAND_INF_DUNGEONS_DONE_SHADOW_TEMPLE); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x580; + play->nextEntranceIndex = 0x580; gSaveContext.nextCutsceneIndex = 0; } else { - Item_Give(globalCtx, ITEM_MEDALLION_SHADOW); - globalCtx->nextEntranceIndex = 0x6B; + Item_Give(play, ITEM_MEDALLION_SHADOW); + play->nextEntranceIndex = 0x6B; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SHADOW; } } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = 0x568; + play->nextEntranceIndex = 0x568; } else { - globalCtx->nextEntranceIndex = 0x580; + play->nextEntranceIndex = 0x580; } gSaveContext.nextCutsceneIndex = 0; } } - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 7; } if (this->warpTimer >= 141) { f32 screenFillAlpha; - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; screenFillAlpha = (f32)(this->warpTimer - 140) / 20.0f; if (screenFillAlpha > 1.0f) { screenFillAlpha = 1.0f; } - globalCtx->envCtx.screenFillColor[0] = 160; - globalCtx->envCtx.screenFillColor[1] = 160; - globalCtx->envCtx.screenFillColor[2] = 160; - globalCtx->envCtx.screenFillColor[3] = (u32)(255.0f * screenFillAlpha); + play->envCtx.screenFillColor[0] = 160; + play->envCtx.screenFillColor[1] = 160; + play->envCtx.screenFillColor[2] = 160; + play->envCtx.screenFillColor[3] = (u32)(255.0f * screenFillAlpha); osSyncPrintf("\nparcent=[%f]", screenFillAlpha); } @@ -932,18 +932,18 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { s16 i; for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = - globalCtx->envCtx.adjLight1Color[i] = -255.0f * temp_f0_2; + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = + play->envCtx.adjLight1Color[i] = -255.0f * temp_f0_2; } - globalCtx->envCtx.adjFogNear = -500.0f * temp_f0_2; - if (globalCtx->envCtx.adjFogNear < -300) { - globalCtx->roomCtx.curRoom.segment = NULL; + play->envCtx.adjFogNear = -500.0f * temp_f0_2; + if (play->envCtx.adjFogNear < -300) { + play->roomCtx.curRoom.segment = NULL; } } } -void DoorWarp1_Destination(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_Destination(DoorWarp1* this, PlayState* play) { f32 alphaFrac; this->warpTimer++; @@ -965,10 +965,10 @@ void DoorWarp1_Destination(DoorWarp1* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); } -void DoorWarp1_DoNothing(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DoNothing(DoorWarp1* this, PlayState* play) { } -void func_8099B020(DoorWarp1* this, GlobalContext* globalCtx) { +void func_8099B020(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 128.0f, 0.2f, 2.0f, 0.1f); Math_SmoothStepToF(&this->warpAlpha, 128.0f, 0.2f, 2.0f, 0.1f); @@ -979,68 +979,68 @@ void func_8099B020(DoorWarp1* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); } -void DoorWarp1_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Update(Actor* thisx, PlayState* play) { DoorWarp1* this = (DoorWarp1*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params != WARP_PURPLE_CRYSTAL) { Actor_SetScale(&this->actor, this->scale / 100.0f); } } -void DoorWarp1_DrawBlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DrawBlueCrystal(DoorWarp1* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0xFF, 200, 255, 255, (u8)this->crystalAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, (u8)this->crystalAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); SkelAnime_Update(&this->skelAnime); } -void DoorWarp1_DrawPurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DrawPurpleCrystal(DoorWarp1* this, PlayState* play) { s32 pad[2]; Vec3f eye; - eye.x = -(Math_SinS(globalCtx->state.frames * 200) * 120.0f) * 80.0f; - eye.y = (Math_CosS(globalCtx->state.frames * 200) * 120.0f) * 80.0f; - eye.z = (Math_CosS(globalCtx->state.frames * 200) * 120.0f) * 80.0f; + eye.x = -(Math_SinS(play->state.frames * 200) * 120.0f) * 80.0f; + eye.y = (Math_CosS(play->state.frames * 200) * 120.0f) * 80.0f; + eye.z = (Math_CosS(play->state.frames * 200) * 120.0f) * 80.0f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - func_8002EB44(&this->actor.world.pos, &eye, &eye, globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + func_8002EB44(&this->actor.world.pos, &eye, &eye, play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)this->crystalAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 150, 0, 100, (u8)this->crystalAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); SkelAnime_Update(&this->skelAnime); } -void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DrawWarp(DoorWarp1* this, PlayState* play) { s32 pad; u32 pad1; - u32 spEC = globalCtx->state.frames * 10; + u32 spEC = play->state.frames * 10; f32 spE8 = (this->unk_194 >= 1.0f) ? 0.0f : 1.0f - this->unk_194; f32 spE4 = (this->unk_198 >= 1.0f) ? 0.0f : 1.0f - this->unk_198; f32 xzScale; f32 temp_f0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); temp_f0 = 1.0f - (2.0f - this->unk_194) / 1.7f; if (this->actor.params != WARP_YELLOW && this->actor.params != WARP_DESTINATION && @@ -1050,7 +1050,7 @@ void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { if (this->actor.params == WARP_DESTINATION) { this->unk_19C -= (s16)(temp_f0 * 2.0f); } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->actor.params) { case WARP_YELLOW: @@ -1078,18 +1078,18 @@ void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { gDPSetColorDither(POLY_XLU_DISP++, G_AD_NOTPATTERN | G_CD_MAGICSQ); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + 1.0f, this->actor.world.pos.z, MTXMODE_NEW); - gSPSegment(POLY_XLU_DISP++, 0x0A, MATRIX_NEWMTX(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x0A, MATRIX_NEWMTX(play->state.gfxCtx)); Matrix_Push(); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, spEC & 0xFF, -((s16)(this->unk_19C + this->unk_19C) & 511), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, spEC & 0xFF, -((s16)(this->unk_19C + this->unk_19C) & 511), 0x100, 0x100, 1, spEC & 0xFF, -((s16)(this->unk_19C + this->unk_19C) & 511), 0x100, 0x100)); Matrix_Translate(0.0f, this->unk_194 * 230.0f, 0.0f, MTXMODE_APPLY); xzScale = (((f32)this->unk_1AE * spE8) / 100.0f) + 1.0f; Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x09, MATRIX_NEWMTX(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x09, MATRIX_NEWMTX(play->state.gfxCtx)); gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL); Matrix_Pop(); @@ -1119,7 +1119,7 @@ void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { spEC *= 2; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, spEC & 0xFF, -((s16)this->unk_19C & 511), 0x100, 0x100, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, spEC & 0xFF, -((s16)this->unk_19C & 511), 0x100, 0x100, 1, spEC & 0xFF, -((s16)this->unk_19C & 511), 0x100, 0x100)); Matrix_Translate(0.0f, this->unk_198 * 60.0f, 0.0f, MTXMODE_APPLY); @@ -1127,20 +1127,20 @@ void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { xzScale = (((f32)this->unk_1B0 * spE4) / 100.0f) + 1.0f; Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x09, MATRIX_NEWMTX(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x09, MATRIX_NEWMTX(play->state.gfxCtx)); gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL); } - 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 = (DoorWarp1*)thisx; switch (this->actor.params) { case WARP_DUNGEON_ADULT: - DoorWarp1_DrawBlueCrystal(this, globalCtx); - DoorWarp1_DrawWarp(this, globalCtx); + DoorWarp1_DrawBlueCrystal(this, play); + DoorWarp1_DrawWarp(this, play); break; case WARP_DUNGEON_CHILD: case WARP_CLEAR_FLAG: @@ -1152,13 +1152,13 @@ void DoorWarp1_Draw(Actor* thisx, GlobalContext* globalCtx) { case WARP_ORANGE: case WARP_GREEN: case WARP_RED: - DoorWarp1_DrawWarp(this, globalCtx); + DoorWarp1_DrawWarp(this, play); break; case WARP_BLUE_CRYSTAL: - DoorWarp1_DrawBlueCrystal(this, globalCtx); + DoorWarp1_DrawBlueCrystal(this, play); break; case WARP_PURPLE_CRYSTAL: - DoorWarp1_DrawPurpleCrystal(this, globalCtx); + DoorWarp1_DrawPurpleCrystal(this, play); break; } } diff --git a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h index 4f335c81d..09e00fbfd 100644 --- a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h +++ b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h @@ -31,7 +31,7 @@ typedef enum { /* 5 */ WARP_BLUE_RUTO_STATE_WARPING // set by warp, after closing dialog } DoorWarp1RutoState; -typedef void (*DoorWarp1ActionFunc)(struct DoorWarp1*, GlobalContext*); +typedef void (*DoorWarp1ActionFunc)(struct DoorWarp1*, PlayState*); typedef struct DoorWarp1 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index 97ba202bb..ed53284e7 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -4,14 +4,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx); -void EfcErupc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx); -void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx); +void EfcErupc_Init(Actor* thisx, PlayState* play); +void EfcErupc_Destroy(Actor* thisx, PlayState* play); +void EfcErupc_Update(Actor* thisx, PlayState* play); +void EfcErupc_Draw(Actor* thisx, PlayState* play); -void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx); -void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalCtx); -void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx); +void EfcErupc_UpdateAction(EfcErupc* this, PlayState* play); +void EfcErupc_DrawParticles(EfcErupcParticles* particles, PlayState* play); +void EfcErupc_UpdateParticles(EfcErupc* this, PlayState* play); void EfcErupc_AddParticle(EfcErupcParticles* particles, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor); void EfcErupc_InitParticles(EfcErupcParticles* particles); @@ -32,7 +32,7 @@ void EfcErupc_SetupAction(EfcErupc* this, EfcErupcActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Init(Actor* thisx, PlayState* play) { EfcErupc* this = (EfcErupc*)thisx; EfcErupc_SetupAction(this, EfcErupc_UpdateAction); @@ -43,18 +43,18 @@ void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_154 = -100; } -void EfcErupc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Destroy(Actor* thisx, PlayState* play) { } -void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { +void EfcErupc_UpdateAction(EfcErupc* this, PlayState* play) { Vec3f pos; Vec3f vel; Vec3f accel; s32 i; - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[1] != NULL) { - if (globalCtx->csCtx.npcActions[1]->action == 2) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[1] != NULL) { + if (play->csCtx.npcActions[1]->action == 2) { if (this->unk_150 == 30) { func_800788CC(NA_SE_IT_EARTHQUAKE); } @@ -75,9 +75,9 @@ void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { } } } - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[2] != NULL) { - switch (globalCtx->csCtx.npcActions[2]->action) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[2] != NULL) { + switch (play->csCtx.npcActions[2]->action) { case 2: if (this->unk_14E == 0) { func_800F3F3C(6); @@ -105,49 +105,49 @@ void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { } } -void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Update(Actor* thisx, PlayState* play) { EfcErupc* this = (EfcErupc*)thisx; - this->actionFunc(this, globalCtx); - EfcErupc_UpdateParticles(this, globalCtx); + this->actionFunc(this, play); + EfcErupc_UpdateParticles(this, play); } -void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Draw(Actor* thisx, PlayState* play) { EfcErupc* this = (EfcErupc*)thisx; u16 csAction; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_14C * 1, this->unk_14E * -4, 32, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_14C * 1, this->unk_14E * -4, 32, 64, 1, this->unk_14C * 4, this->unk_14E * -20, 64, 64)); gSPSegment( POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); gSPSegment( POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); Matrix_Push(); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (globalCtx->csCtx.state != 0) { - if ((globalCtx->csCtx.npcActions[1] != 0) && (globalCtx->csCtx.npcActions[1]->action == 2)) { + if (play->csCtx.state != 0) { + if ((play->csCtx.npcActions[1] != 0) && (play->csCtx.npcActions[1]->action == 2)) { gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002570); } } Matrix_Pop(); Matrix_Scale(3.4f, 3.4f, 3.4f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* csActorAction = globalCtx->csCtx.npcActions[2]; + if (play->csCtx.state != 0) { + CsCmdActorAction* csActorAction = play->csCtx.npcActions[2]; if (csActorAction != 0) { csAction = csActorAction->action; if ((csAction == 2) || (csAction == 3)) { @@ -157,12 +157,12 @@ void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) { } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); - EfcErupc_DrawParticles(this->particles, globalCtx); + CLOSE_DISPS(play->state.gfxCtx); + EfcErupc_DrawParticles(this->particles, play); } -void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EfcErupc_DrawParticles(EfcErupcParticles* particles, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; s32 pad; @@ -171,14 +171,14 @@ void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalC FrameInterpolation_RecordOpenChild(particles, particles->epoch); if (particles->isActive) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002760); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, particles->color.r, particles->color.g, particles->color.b, particles->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 150, 0, 0, 0); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(particles->pos.x, particles->pos.y, particles->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(particles->scale, particles->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -198,7 +198,7 @@ static Color_RGB8 D_8099D770[] = { { 255, 0, 0 }, }; -void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx) { +void EfcErupc_UpdateParticles(EfcErupc* this, PlayState* play) { s16 i; s16 index; Color_RGB8 particleColors[] = { diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h index e3edf503b..ab0b7f0b3 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h @@ -6,7 +6,7 @@ struct EfcErupc; -typedef void (*EfcErupcActionFunc)(struct EfcErupc*, GlobalContext*); +typedef void (*EfcErupcActionFunc)(struct EfcErupc*, PlayState*); typedef struct { /* 0x00 */ Vec3f pos; diff --git a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 9fbe721b6..5f08ee401 100644 --- a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EffDust_Init(Actor* thisx, GlobalContext* globalCtx); -void EffDust_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EffDust_Update(Actor* thisx, GlobalContext* globalCtx); -void EffDust_Draw(Actor* thisx, GlobalContext* globalCtx); +void EffDust_Init(Actor* thisx, PlayState* play); +void EffDust_Destroy(Actor* thisx, PlayState* play); +void EffDust_Update(Actor* thisx, PlayState* play); +void EffDust_Draw(Actor* thisx, PlayState* play); void EffDust_InitPosAndDistance(EffDust* this); -void EffDust_UpdateFunc_8099DB28(EffDust* this, GlobalContext* globalCtx); -void EffDust_UpdateFunc_8099DD74(EffDust* this, GlobalContext* globalCtx); -void EffDust_UpdateFunc_8099DFC0(EffDust* this, GlobalContext* globalCtx); -void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx); -void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx); +void EffDust_UpdateFunc_8099DB28(EffDust* this, PlayState* play); +void EffDust_UpdateFunc_8099DD74(EffDust* this, PlayState* play); +void EffDust_UpdateFunc_8099DFC0(EffDust* this, PlayState* play); +void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play); +void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play); const ActorInit Eff_Dust_InitVars = { ACTOR_EFF_DUST, @@ -61,7 +61,7 @@ void EffDust_InitPosAndDistance(EffDust* this) { this->index = 0; } -void EffDust_Init(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Init(Actor* thisx, PlayState* play) { EffDust* this = (EffDust*)thisx; EffDustType dustEffect = this->actor.params; @@ -111,10 +111,10 @@ void EffDust_Init(Actor* thisx, GlobalContext* globalCtx) { this->life = 10; } -void EffDust_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Destroy(Actor* thisx, PlayState* play) { } -void EffDust_UpdateFunc_8099DB28(EffDust* this, GlobalContext* globalCtx) { +void EffDust_UpdateFunc_8099DB28(EffDust* this, PlayState* play) { s16 theta; s16 fi; f32* distanceTraveled = this->distanceTraveled; @@ -143,7 +143,7 @@ void EffDust_UpdateFunc_8099DB28(EffDust* this, GlobalContext* globalCtx) { } } -void EffDust_UpdateFunc_8099DD74(EffDust* this, GlobalContext* globalCtx) { +void EffDust_UpdateFunc_8099DD74(EffDust* this, PlayState* play) { s16 theta; s16 fi; f32* distanceTraveled = this->distanceTraveled; @@ -172,9 +172,9 @@ void EffDust_UpdateFunc_8099DD74(EffDust* this, GlobalContext* globalCtx) { } } -void EffDust_UpdateFunc_8099DFC0(EffDust* this, GlobalContext* globalCtx) { +void EffDust_UpdateFunc_8099DFC0(EffDust* this, PlayState* play) { s16 theta; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* parent = this->actor.parent; f32* distanceTraveled = this->distanceTraveled; s32 i; @@ -255,16 +255,16 @@ void EffDust_UpdateFunc_8099DFC0(EffDust* this, GlobalContext* globalCtx) { } } -void EffDust_Update(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Update(Actor* thisx, PlayState* play) { EffDust* this = (EffDust*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { +void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play2) { EffDust* this = (EffDust*)thisx; - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + PlayState* play = play2; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vec3f* initialPositions; f32* distanceTraveled; s32 i; @@ -294,7 +294,7 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { MTXMODE_NEW); Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -310,15 +310,15 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { CLOSE_DISPS(gfxCtx); } -void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { +void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) { EffDust* this = (EffDust*)thisx; - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + PlayState* play = play2; + GraphicsContext* gfxCtx = play->state.gfxCtx; f32* distanceTraveled; Vec3f* initialPositions; s32 i; f32 aux; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); OPEN_DISPS(gfxCtx); @@ -357,7 +357,7 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -373,8 +373,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { CLOSE_DISPS(gfxCtx); } -void EffDust_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Draw(Actor* thisx, PlayState* play) { EffDust* this = (EffDust*)thisx; - this->drawFunc(thisx, globalCtx); + this->drawFunc(thisx, play); } diff --git a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h index a53866e55..d5eeaffed 100644 --- a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h +++ b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h @@ -6,8 +6,8 @@ struct EffDust; -typedef void (*EffDustActionFunc)(struct EffDust*, GlobalContext*); -typedef void (*EffDustDrawFunc)(Actor*, GlobalContext*); +typedef void (*EffDustActionFunc)(struct EffDust*, PlayState*); +typedef void (*EffDustDrawFunc)(Actor*, PlayState*); typedef struct EffDust { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index a333c3be0..8ea458d5f 100644 --- a/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Update(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Draw(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg_Init(Actor* thisx, PlayState* play); +void ElfMsg_Destroy(Actor* thisx, PlayState* play); +void ElfMsg_Update(Actor* thisx, PlayState* play); +void ElfMsg_Draw(Actor* thisx, PlayState* play); -void ElfMsg_CallNaviCuboid(ElfMsg* this, GlobalContext* globalCtx); -void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx); +void ElfMsg_CallNaviCuboid(ElfMsg* this, PlayState* play); +void ElfMsg_CallNaviCylinder(ElfMsg* this, PlayState* play); const ActorInit Elf_Msg_InitVars = { ACTOR_ELF_MSG, @@ -44,32 +44,32 @@ void ElfMsg_SetupAction(ElfMsg* this, ElfMsgActionFunc actionFunc) { * Checks a scene flag - if flag is set, the actor is killed and function returns 1. Otherwise returns 0. * Can also set a switch flag from params while killing. */ -s32 ElfMsg_KillCheck(ElfMsg* this, GlobalContext* globalCtx) { +s32 ElfMsg_KillCheck(ElfMsg* this, PlayState* play) { if ((this->actor.world.rot.y > 0) && (this->actor.world.rot.y < 0x41) && - Flags_GetSwitch(globalCtx, this->actor.world.rot.y - 1)) { + Flags_GetSwitch(play, this->actor.world.rot.y - 1)) { LOG_STRING("共倒れ"); // "Mutual destruction" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); } Actor_Kill(&this->actor); return 1; - } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(globalCtx, this->actor.room)) { + } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(play, this->actor.room)) { LOG_STRING("共倒れ"); // "Mutual destruction" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); } Actor_Kill(&this->actor); return 1; } else if (((this->actor.params >> 8) & 0x3F) == 0x3F) { return 0; - } else if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + } else if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { Actor_Kill(&this->actor); return 1; } return 0; } -void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg_Init(Actor* thisx, PlayState* play) { ElfMsg* this = (ElfMsg*)thisx; // "Conditions for Elf Tag disappearing" @@ -80,7 +80,7 @@ void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(CYAN) "\nエルフ タグ 出現条件 %d" VT_RST "\n", thisx->shape.rot.y - 0x41); } - if (!ElfMsg_KillCheck(this, globalCtx)) { + if (!ElfMsg_KillCheck(this, play)) { Actor_ProcessInitChain(thisx, sInitChain); if (thisx->world.rot.x == 0) { thisx->scale.z = 0.4f; @@ -105,7 +105,7 @@ void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ElfMsg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg_Destroy(Actor* thisx, PlayState* play) { } s32 ElfMsg_GetMessageId(ElfMsg* this) { @@ -117,8 +117,8 @@ s32 ElfMsg_GetMessageId(ElfMsg* this) { } } -void ElfMsg_CallNaviCuboid(ElfMsg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ElfMsg_CallNaviCuboid(ElfMsg* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnElf* navi = (EnElf*)player->naviActor; if ((fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && @@ -134,8 +134,8 @@ s32 ElfMsg_WithinXZDistance(Vec3f* pos1, Vec3f* pos2, f32 distance) { return (SQ(pos2->x - pos1->x) + SQ(pos2->z - pos1->z)) < SQ(distance); } -void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ElfMsg_CallNaviCylinder(ElfMsg* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnElf* navi = (EnElf*)player->naviActor; // This fixes a crash when using a grotto exit when you never properly entered @@ -150,20 +150,20 @@ void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx) { } } -void ElfMsg_Update(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg_Update(Actor* thisx, PlayState* play) { ElfMsg* this = (ElfMsg*)thisx; - if (!ElfMsg_KillCheck(this, globalCtx)) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (!ElfMsg_KillCheck(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); } Actor_Kill(&this->actor); return; } if ((this->actor.world.rot.y <= 0x41) || (this->actor.world.rot.y > 0x80) || - Flags_GetSwitch(globalCtx, this->actor.world.rot.y - 0x41)) { - this->actionFunc(this, globalCtx); + Flags_GetSwitch(play, this->actor.world.rot.y - 0x41)) { + this->actionFunc(this, play); } } } @@ -172,23 +172,23 @@ void ElfMsg_Update(Actor* thisx, GlobalContext* globalCtx) { #include "overlays/ovl_Elf_Msg/ovl_Elf_Msg.h" #endif -void ElfMsg_Draw(Actor* thisx, GlobalContext* globalCtx) +void ElfMsg_Draw(Actor* thisx, PlayState* play) { #ifdef ZELDA_DEBUG - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (R_NAVI_MSG_REGION_ALPHA == 0) { return; } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (thisx->params & 0x8000) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 100, 100, R_NAVI_MSG_REGION_ALPHA); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, R_NAVI_MSG_REGION_ALPHA); } - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_809AD278); @@ -198,6 +198,6 @@ void ElfMsg_Draw(Actor* thisx, GlobalContext* globalCtx) gSPDisplayList(POLY_XLU_DISP++, sCylinderDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); #endif } diff --git a/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h b/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h index 1e7fe65a6..ba523060f 100644 --- a/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h +++ b/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h @@ -6,7 +6,7 @@ struct ElfMsg; -typedef void (*ElfMsgActionFunc)(struct ElfMsg*, GlobalContext*); +typedef void (*ElfMsgActionFunc)(struct ElfMsg*, PlayState*); typedef struct ElfMsg { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index e8a45cf1f..64c30e7d2 100644 --- a/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void ElfMsg2_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Update(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Draw(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg2_Init(Actor* thisx, PlayState* play); +void ElfMsg2_Destroy(Actor* thisx, PlayState* play); +void ElfMsg2_Update(Actor* thisx, PlayState* play); +void ElfMsg2_Draw(Actor* thisx, PlayState* play); s32 ElfMsg2_GetMessageId(ElfMsg2* this); -void ElfMsg2_WaitUntilActivated(ElfMsg2* this, GlobalContext* globalCtx); -void ElfMsg2_WaitForTextRead(ElfMsg2* this, GlobalContext* globalCtx); +void ElfMsg2_WaitUntilActivated(ElfMsg2* this, PlayState* play); +void ElfMsg2_WaitForTextRead(ElfMsg2* this, PlayState* play); const ActorInit Elf_Msg2_InitVars = { ACTOR_ELF_MSG2, @@ -44,25 +44,25 @@ void ElfMsg2_SetupAction(ElfMsg2* this, ElfMsg2ActionFunc actionFunc) { * Checks a scene flag - if flag is set, the actor is killed and function returns 1. Otherwise returns 0. * Can also set a switch flag from params while killing. */ -s32 ElfMsg2_KillCheck(ElfMsg2* this, GlobalContext* globalCtx) { +s32 ElfMsg2_KillCheck(ElfMsg2* this, PlayState* play) { if ((this->actor.world.rot.y > 0) && (this->actor.world.rot.y < 0x41) && - Flags_GetSwitch(globalCtx, this->actor.world.rot.y - 1)) { + Flags_GetSwitch(play, this->actor.world.rot.y - 1)) { LOG_STRING("共倒れ"); // "Mutual destruction" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F)); + Flags_SetSwitch(play, ((this->actor.params >> 8) & 0x3F)); } Actor_Kill(&this->actor); return 1; - } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(globalCtx, this->actor.room)) { + } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(play, this->actor.room)) { LOG_STRING("共倒れ2"); // "Mutual destruction 2" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F)); + Flags_SetSwitch(play, ((this->actor.params >> 8) & 0x3F)); } Actor_Kill(&this->actor); return 1; } else if (((this->actor.params >> 8) & 0x3F) == 0x3F) { return 0; - } else if (Flags_GetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F))) { + } else if (Flags_GetSwitch(play, ((this->actor.params >> 8) & 0x3F))) { LOG_STRING("共倒れ"); // "Mutual destruction" Actor_Kill(&this->actor); return 1; @@ -70,11 +70,11 @@ s32 ElfMsg2_KillCheck(ElfMsg2* this, GlobalContext* globalCtx) { return 0; } -void ElfMsg2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg2_Init(Actor* thisx, PlayState* play) { ElfMsg2* this = (ElfMsg2*)thisx; osSyncPrintf(VT_FGCOL(CYAN) " Elf_Msg2_Actor_ct %04x\n\n" VT_RST, this->actor.params); - if (!ElfMsg2_KillCheck(this, globalCtx)) { + if (!ElfMsg2_KillCheck(this, play)) { if ((this->actor.world.rot.x > 0) && (this->actor.world.rot.x < 8)) { this->actor.targetMode = this->actor.world.rot.x - 1; } @@ -90,7 +90,7 @@ void ElfMsg2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ElfMsg2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg2_Destroy(Actor* thisx, PlayState* play) { } s32 ElfMsg2_GetMessageId(ElfMsg2* this) { @@ -101,15 +101,15 @@ s32 ElfMsg2_GetMessageId(ElfMsg2* this) { * Runs while Navi text is up. Kills the actor upon closing the text box unless rot.z == 1, can also set a switch flag * from params. */ -void ElfMsg2_WaitForTextClose(ElfMsg2* this, GlobalContext* globalCtx) { +void ElfMsg2_WaitForTextClose(ElfMsg2* this, PlayState* play) { s32 switchFlag; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.world.rot.z != 1) { Actor_Kill(&this->actor); switchFlag = (this->actor.params >> 8) & 0x3F; if (switchFlag != 0x3F) { - Flags_SetSwitch(globalCtx, switchFlag); + Flags_SetSwitch(play, switchFlag); } } else { ElfMsg2_SetupAction(this, ElfMsg2_WaitForTextRead); @@ -120,8 +120,8 @@ void ElfMsg2_WaitForTextClose(ElfMsg2* this, GlobalContext* globalCtx) { /** * Runs while Navi text is not up. */ -void ElfMsg2_WaitForTextRead(ElfMsg2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void ElfMsg2_WaitForTextRead(ElfMsg2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { ElfMsg2_SetupAction(this, ElfMsg2_WaitForTextClose); } } @@ -129,22 +129,22 @@ void ElfMsg2_WaitForTextRead(ElfMsg2* this, GlobalContext* globalCtx) { /** * Idles until a switch flag is set, at which point the actor becomes interactable */ -void ElfMsg2_WaitUntilActivated(ElfMsg2* this, GlobalContext* globalCtx) { +void ElfMsg2_WaitUntilActivated(ElfMsg2* this, PlayState* play) { // If (y >= 0x41) && (y <= 0x80), Idles until switch flag (actor.world.rot.y - 0x41) is set // If (y > 0x80), Idles forever (Bug?) if ((this->actor.world.rot.y >= 0x41) && (this->actor.world.rot.y <= 0x80) && - (Flags_GetSwitch(globalCtx, (this->actor.world.rot.y - 0x41)))) { + (Flags_GetSwitch(play, (this->actor.world.rot.y - 0x41)))) { ElfMsg2_SetupAction(this, ElfMsg2_WaitForTextRead); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_18; // Make actor targetable and Navi-checkable this->actor.textId = ElfMsg2_GetMessageId(this); } } -void ElfMsg2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg2_Update(Actor* thisx, PlayState* play) { ElfMsg2* this = (ElfMsg2*)thisx; - if (!ElfMsg2_KillCheck(this, globalCtx)) { - this->actionFunc(this, globalCtx); + if (!ElfMsg2_KillCheck(this, play)) { + this->actionFunc(this, play); } } @@ -152,21 +152,21 @@ void ElfMsg2_Update(Actor* thisx, GlobalContext* globalCtx) { #include "overlays/ovl_Elf_Msg2/ovl_Elf_Msg2.h" #endif -void ElfMsg2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg2_Draw(Actor* thisx, PlayState* play) { #if ZELDA_DEBUG - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (R_NAVI_MSG_REGION_ALPHA == 0) { return; } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 100, 255, R_NAVI_MSG_REGION_ALPHA); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_809ADC38); gSPDisplayList(POLY_XLU_DISP++, sCubeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); #endif } diff --git a/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h b/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h index 741e72cbb..802769f2b 100644 --- a/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h +++ b/soh/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h @@ -6,7 +6,7 @@ struct ElfMsg2; -typedef void (*ElfMsg2ActionFunc)(struct ElfMsg2*, GlobalContext*); +typedef void (*ElfMsg2ActionFunc)(struct ElfMsg2*, PlayState*); typedef struct ElfMsg2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c index a5ee34ba6..27b4b3769 100644 --- a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -10,23 +10,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_26) -void EnAm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAm_Init(Actor* thisx, PlayState* play); +void EnAm_Destroy(Actor* thisx, PlayState* play); +void EnAm_Update(Actor* thisx, PlayState* play); +void EnAm_Draw(Actor* thisx, PlayState* play); void EnAm_SetupStatue(EnAm* this); void EnAm_SetupSleep(EnAm* this); -void EnAm_Statue(EnAm* this, GlobalContext* globalCtx); -void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx); -void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx); -void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx); -void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx); -void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx); -void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx); -void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx); -void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx); -void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx); +void EnAm_Statue(EnAm* this, PlayState* play); +void EnAm_Sleep(EnAm* this, PlayState* play); +void EnAm_Lunge(EnAm* this, PlayState* play); +void EnAm_RotateToHome(EnAm* this, PlayState* play); +void EnAm_MoveToHome(EnAm* this, PlayState* play); +void EnAm_RotateToInit(EnAm* this, PlayState* play); +void EnAm_Cooldown(EnAm* this, PlayState* play); +void EnAm_Ricochet(EnAm* this, PlayState* play); +void EnAm_Stunned(EnAm* this, PlayState* play); +void EnAm_RecoilFromDamage(EnAm* this, PlayState* play); typedef enum { /* 00 */ AM_BEHAVIOR_NONE, @@ -174,7 +174,7 @@ void EnAm_SetupAction(EnAm* this, EnAmActionFunc actionFunc) { * If it won't land on the ground, it will return true anyway if the floor the armos will be on * is no more than 20 units lower than the home position. This prevents the armos from going down steep slopes. */ -s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) { +s32 EnAm_CanMove(EnAm* this, PlayState* play, f32 distance, s16 yaw) { s16 ret; s16 curBgCheckFlags; f32 sin; @@ -191,7 +191,7 @@ s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) { this->dyna.actor.world.pos.x += sin; this->dyna.actor.world.pos.z += cos; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); this->dyna.actor.world.pos = curPos; ret = this->dyna.actor.bgCheckFlags & 1; @@ -204,34 +204,34 @@ s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) { return ret; } -void EnAm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; s32 pad; EnAm* this = (EnAm*)thisx; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gArmosSkel, &gArmosRicochetAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gArmosSkel, &gArmosRicochetAnim, this->jointTable, this->morphTable, 14); Actor_SetScale(&this->dyna.actor, 0.01f); DynaPolyActor_Init(&this->dyna, DPM_UNK); - Collider_InitCylinder(globalCtx, &this->hurtCollider); - Collider_InitCylinder(globalCtx, &this->blockCollider); - Collider_SetCylinder(globalCtx, &this->hurtCollider, &this->dyna.actor, &sHurtCylinderInit); + Collider_InitCylinder(play, &this->hurtCollider); + Collider_InitCylinder(play, &this->blockCollider); + Collider_SetCylinder(play, &this->hurtCollider, &this->dyna.actor, &sHurtCylinderInit); if (this->dyna.actor.params == ARMOS_STATUE) { this->dyna.actor.colChkInfo.health = 1; - Collider_SetCylinder(globalCtx, &this->blockCollider, &this->dyna.actor, &sHurtCylinderInit); + Collider_SetCylinder(play, &this->blockCollider, &this->dyna.actor, &sHurtCylinderInit); this->hurtCollider.base.ocFlags1 = (OC1_ON | OC1_NO_PUSH | OC1_TYPE_1 | OC1_TYPE_2); this->blockCollider.base.ocFlags1 = (OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER); CollisionHeader_GetVirtual(&gArmosCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, ACTORCAT_BG); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_BG); EnAm_SetupStatue(this); } else { - Collider_SetCylinder(globalCtx, &this->blockCollider, &this->dyna.actor, &sBlockCylinderInit); - Collider_InitQuad(globalCtx, &this->hitCollider); - Collider_SetQuad(globalCtx, &this->hitCollider, &this->dyna.actor, &sQuadInit); + Collider_SetCylinder(play, &this->blockCollider, &this->dyna.actor, &sBlockCylinderInit); + Collider_InitQuad(play, &this->hitCollider); + Collider_SetQuad(play, &this->hitCollider, &this->dyna.actor, &sQuadInit); this->dyna.actor.colChkInfo.health = 1; this->dyna.actor.colChkInfo.damageTable = &sDamageTable; EnAm_SetupSleep(this); @@ -241,17 +241,17 @@ void EnAm_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.colChkInfo.mass = MASS_HEAVY; } -void EnAm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnAm* this = (EnAm*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->hurtCollider); - Collider_DestroyCylinder(globalCtx, &this->blockCollider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->hurtCollider); + Collider_DestroyCylinder(play, &this->blockCollider); //! @bug Quad collider is not destroyed (though destroy doesnt really do anything anyway) } -void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SpawnEffects(EnAm* this, PlayState* play) { static Vec3f velocity = { 0.0f, -1.5f, 0.0f }; static Vec3f accel = { 0.0f, -0.2f, 0.0f }; s32 i; @@ -265,11 +265,11 @@ void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { pos.y = (this->dyna.actor.world.pos.y + 40.0f) + ((Rand_ZeroOne() - 0.5f) * 10.0f); pos.z = this->dyna.actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 65.0f); - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &accel, &primColor, &envColor); + EffectSsKiraKira_SpawnSmall(play, &pos, &velocity, &accel, &primColor, &envColor); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 4.0f, 3, 8.0f, 300, 15, false); + Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 4.0f, 3, 8.0f, 300, 15, false); } void EnAm_SetupSleep(EnAm* this) { @@ -335,27 +335,27 @@ void EnAm_SetupRotateToHome(EnAm* this) { EnAm_SetupAction(this, EnAm_RotateToHome); } -void EnAm_SetupRecoilFromDamage(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SetupRecoilFromDamage(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosDamagedAnim, 1.0f, 4.0f, Animation_GetLastFrame(&gArmosDamagedAnim) - 6.0f, ANIMMODE_ONCE, 0.0f); this->behavior = AM_BEHAVIOR_DAMAGED; this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_DAMAGE); - if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, -6.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = -6.0f; } this->dyna.actor.colorFilterTimer = 0; - Enemy_StartFinishingBlow(globalCtx, &this->dyna.actor); + Enemy_StartFinishingBlow(play, &this->dyna.actor); EnAm_SetupAction(this, EnAm_RecoilFromDamage); } -void EnAm_SetupRicochet(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SetupRicochet(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosRicochetAnim, 1.0f, 0.0f, 8.0f, ANIMMODE_ONCE, 0.0f); this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; - if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, -6.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = -6.0f; } @@ -366,12 +366,12 @@ void EnAm_SetupRicochet(EnAm* this, GlobalContext* globalCtx) { EnAm_SetupAction(this, EnAm_Ricochet); } -void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Sleep(EnAm* this, PlayState* play) { f32 cos; s32 pad; f32 rand; f32 sin; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk_258 != 0) || ((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (this->hurtCollider.base.oc == &player->actor)) || @@ -433,7 +433,7 @@ void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx) { /** * Spin toward the direction of the home position to start moving back to it. */ -void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) { +void EnAm_RotateToHome(EnAm* this, PlayState* play) { s16 yawToHome = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos); if (this->skelAnime.curFrame == 8.0f) { @@ -443,7 +443,7 @@ void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) { if (!(this->dyna.actor.bgCheckFlags & 1)) { this->skelAnime.curFrame = 11; } else { - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (this->dyna.actor.world.rot.y == yawToHome) { this->unk_258 = 0; @@ -466,7 +466,7 @@ void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) { /** * After reaching the home position, spin back to the starting rotation. */ -void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) { +void EnAm_RotateToInit(EnAm* this, PlayState* play) { if (this->skelAnime.curFrame == 8.0f) { if ((this->dyna.actor.world.pos.x == this->dyna.actor.home.pos.x) && (this->dyna.actor.world.pos.z == this->dyna.actor.home.pos.z)) { @@ -479,7 +479,7 @@ void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) { this->skelAnime.curFrame = 11; } else { this->unk_258 = 1; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (this->dyna.actor.home.rot.y == this->dyna.actor.world.rot.y) { this->unk_258 = 0; @@ -504,7 +504,7 @@ void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; } -void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { +void EnAm_MoveToHome(EnAm* this, PlayState* play) { s16 yawToHome = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos); if (this->skelAnime.curFrame == 8.0f) { @@ -523,7 +523,7 @@ void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.speedXZ = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (Actor_WorldDistXYZToPoint(&this->dyna.actor, &this->dyna.actor.home.pos) < 80.0f) { EnAm_SetupRotateToInit(this); @@ -542,12 +542,12 @@ void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; } -void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx) { +void EnAm_RecoilFromDamage(EnAm* this, PlayState* play) { if (this->dyna.actor.speedXZ < 0.0f) { this->dyna.actor.speedXZ += 0.5f; } - if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, globalCtx, -8.0f, this->dyna.actor.world.rot.y)) { + if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, play, -8.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 0.0f; } @@ -562,7 +562,7 @@ void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx) { * After doing 3 lunges, wait for 2 seconds before attacking again. * Turn toward the player before lunging again. */ -void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Cooldown(EnAm* this, PlayState* play) { s16 yawDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.world.rot.y; yawDiff = ABS(yawDiff); @@ -582,7 +582,7 @@ void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) { } this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); } } @@ -601,12 +601,12 @@ void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) { * Lunge toward the player in an attempt to deal damage. Hop 3 times. * Used for both normal attacks and the death sequence. */ -void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Lunge(EnAm* this, PlayState* play) { if (this->deathTimer < 52) { if (this->skelAnime.curFrame == 8.0f) { this->dyna.actor.velocity.y = 12.0f; - if (EnAm_CanMove(this, globalCtx, 80.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, 80.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 6.0f; } else { this->dyna.actor.speedXZ = 0.0f; @@ -628,7 +628,7 @@ void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.speedXZ = 0.0f; this->unk_264 = 0; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (((Actor_WorldDistXZToPoint(&this->dyna.actor, &this->dyna.actor.home.pos) > 240.0f) || (this->attackTimer == 0)) && @@ -663,8 +663,8 @@ void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { } } -void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnAm_Statue(EnAm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp158f = this->dyna.unk_158; s16 moveDir = 0; s32 blockSpeed = CVar_GetS32("gFasterBlockPush", 0); @@ -686,7 +686,7 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { } if ((this->dyna.unk_150 == 0.0f) || (this->unk_258 == 0) || !(this->dyna.actor.bgCheckFlags & 1) || - !func_800435D8(globalCtx, &this->dyna, 0x14, + !func_800435D8(play, &this->dyna, 0x14, (Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f)) + 40.0f, 0xA) || ((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (ABS(moveDir) <= 0x2000))) { @@ -712,7 +712,7 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { this->dyna.unk_150 = this->dyna.unk_154 = 0.0f; } -void EnAm_SetupStunned(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SetupStunned(EnAm* this, PlayState* play) { // animation is set but SkelAnime_Update is not called in the action // likely copy pasted from EnAm_SetupRecoilFromDamage Animation_Change(&this->skelAnime, &gArmosDamagedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gArmosDamagedAnim), @@ -720,7 +720,7 @@ void EnAm_SetupStunned(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; - if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, -6.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = -6.0f; } @@ -735,14 +735,14 @@ void EnAm_SetupStunned(EnAm* this, GlobalContext* globalCtx) { EnAm_SetupAction(this, EnAm_Stunned); } -void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Stunned(EnAm* this, PlayState* play) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.world.rot.y, 1, 0xFA0, 0); if (this->dyna.actor.speedXZ < 0.0f) { this->dyna.actor.speedXZ += 0.5f; } - if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, globalCtx, -9.0f, this->dyna.actor.world.rot.y)) { + if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, play, -9.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 0.0f; } @@ -750,18 +750,18 @@ void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx) { if (this->dyna.actor.colChkInfo.health != 0) { EnAm_SetupLunge(this); } else { - EnAm_SetupRecoilFromDamage(this, globalCtx); + EnAm_SetupRecoilFromDamage(this, play); } } } -void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Ricochet(EnAm* this, PlayState* play) { if (this->dyna.actor.speedXZ < 0.0f) { this->dyna.actor.speedXZ += 0.5f; } if ((this->dyna.actor.velocity.y <= 0.0f) && - !EnAm_CanMove(this, globalCtx, this->dyna.actor.speedXZ * 1.5f, this->dyna.actor.world.rot.y)) { + !EnAm_CanMove(this, play, this->dyna.actor.speedXZ * 1.5f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 0.0f; } @@ -771,7 +771,7 @@ void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx) { } } -void EnAm_TransformSwordHitbox(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_TransformSwordHitbox(Actor* thisx, PlayState* play) { static Vec3f D_809B0074 = { 2500.0f, 7000.0f, 0.0f }; static Vec3f D_809B0080 = { -2500.0f, 0.0f, 0.0f }; static Vec3f D_809B008C = { 2500.0f, 7000.0f, 4000.0f }; @@ -787,7 +787,7 @@ void EnAm_TransformSwordHitbox(Actor* thisx, GlobalContext* globalCtx) { &this->hitCollider.dim.quad[2], &this->hitCollider.dim.quad[3]); } -void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { +void EnAm_UpdateDamage(EnAm* this, PlayState* play) { s32 pad; Vec3f sparkPos; @@ -797,7 +797,7 @@ void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { this->hurtCollider.base.acFlags &= ~AC_HIT; if (this->behavior >= AM_BEHAVIOR_5) { - EnAm_SetupRicochet(this, globalCtx); + EnAm_SetupRicochet(this, play); } } else if ((this->hurtCollider.base.acFlags & AC_HIT) && (this->behavior >= AM_BEHAVIOR_5)) { this->hurtCollider.base.acFlags &= ~AC_HIT; @@ -811,7 +811,7 @@ void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) || (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_ICE)) { if (this->behavior != AM_BEHAVIOR_STUNNED) { - EnAm_SetupStunned(this, globalCtx); + EnAm_SetupStunned(this, play); if (this->dyna.actor.colChkInfo.damage != 0) { this->dyna.actor.colChkInfo.health = 0; @@ -819,22 +819,22 @@ void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { } else if (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) { sparkPos = this->dyna.actor.world.pos; sparkPos.y += 50.0f; - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sparkPos); + CollisionCheck_SpawnShieldParticlesMetal(play, &sparkPos); } } else if ((this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_KILL) || (this->behavior == AM_BEHAVIOR_STUNNED)) { this->dyna.actor.colChkInfo.health = 0; - EnAm_SetupRecoilFromDamage(this, globalCtx); + EnAm_SetupRecoilFromDamage(this, play); } else { - EnAm_SetupRicochet(this, globalCtx); + EnAm_SetupRicochet(this, play); } } } } } -void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Update(Actor* thisx, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 dustPrimColor = { 150, 150, 150, 255 }; static Color_RGBA8 dustEnvColor = { 100, 100, 100, 150 }; @@ -847,7 +847,7 @@ void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad1; if (this->dyna.actor.params != ARMOS_STATUE) { - EnAm_UpdateDamage(this, globalCtx); + EnAm_UpdateDamage(this, play); } if (this->dyna.actor.colChkInfo.damageEffect != AM_DMGEFF_MAGIC_FIRE_LIGHT) { @@ -855,31 +855,31 @@ void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { this->attackTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->deathTimer != 0) { this->deathTimer--; if (this->deathTimer == 0) { - dustPosScale = globalCtx->gameplayFrames * 10; + dustPosScale = play->gameplayFrames * 10; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); bomb = - (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->dyna.actor.world.pos.x, + (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 2, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_DEAD); - Item_DropCollectibleRandom(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, &this->dyna.actor, &this->dyna.actor.world.pos, 0xA0); for (i = 9; i >= 0; i--) { dustPos.x = (sinf(dustPosScale) * 7.0f) + this->dyna.actor.world.pos.x; dustPos.y = (Rand_CenteredFloat(10.0f) * 6.0f) + (this->dyna.actor.world.pos.y + 40.0f); dustPos.z = (cosf(dustPosScale) * 7.0f) + this->dyna.actor.world.pos.z; - func_8002836C(globalCtx, &dustPos, &zeroVec, &zeroVec, &dustPrimColor, &dustEnvColor, 200, 45, 12); + func_8002836C(play, &dustPos, &zeroVec, &zeroVec, &dustPrimColor, &dustEnvColor, 200, 45, 12); dustPosScale += 60.0f; } @@ -893,51 +893,51 @@ void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 28.0f, 80.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 28.0f, 80.0f, 0x1D); } Collider_UpdateCylinder(&this->dyna.actor, &this->hurtCollider); Collider_UpdateCylinder(&this->dyna.actor, &this->blockCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->hurtCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->hurtCollider.base); if (this->dyna.actor.params != ARMOS_STATUE) { Actor_SetFocus(&this->dyna.actor, this->dyna.actor.scale.x * 4500.0f); if (this->dyna.actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->blockCollider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->hurtCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->hurtCollider.base); if ((this->behavior >= 4) && (this->unk_264 > 0)) { if (!(this->hitCollider.base.atFlags & AT_BOUNCED)) { if (this->hitCollider.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->hitCollider.base.at == &player->actor) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->hitCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->hitCollider.base); } else { this->hitCollider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); this->hitCollider.base.at = NULL; - EnAm_SetupRicochet(this, globalCtx); + EnAm_SetupRicochet(this, play); } } } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->blockCollider.base); } } static Vec3f sUnused1 = { 1100.0f, -700.0f, 0.0f }; static Vec3f sUnused2 = { 0.0f, 0.0f, 0.0f }; -void EnAm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnAm* this = (EnAm*)thisx; if ((limbIndex == 1) && (this->unk_264 != 0)) { - EnAm_TransformSwordHitbox(&this->dyna.actor, globalCtx); + EnAm_TransformSwordHitbox(&this->dyna.actor, play); } } @@ -947,16 +947,16 @@ static Vec3f sIcePosOffsets[] = { { 10.0f, 20.0f, -10.0f }, { 0.0f, 40.0f, 20.0f }, { -10.0f, 20.0f, 10.0f }, { -10.0f, 20.0f, -10.0f }, }; -void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Draw(Actor* thisx, PlayState* play) { s32 pad; Vec3f sp68; EnAm* this = (EnAm*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->textureBlend); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, this); if (this->iceTimer != 0) { this->dyna.actor.colorFilterTimer++; @@ -971,10 +971,10 @@ void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx) { sp68.y = this->dyna.actor.world.pos.y + sIcePosOffsets[index].y; sp68.z = this->dyna.actor.world.pos.z + sIcePosOffsets[index].z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->dyna.actor, &sp68, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->dyna.actor, &sp68, 150, 150, 150, 250, 235, 245, 255, 1.4f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Am/z_en_am.h b/soh/src/overlays/actors/ovl_En_Am/z_en_am.h index 6cb4c40ec..61e9042f9 100644 --- a/soh/src/overlays/actors/ovl_En_Am/z_en_am.h +++ b/soh/src/overlays/actors/ovl_En_Am/z_en_am.h @@ -6,7 +6,7 @@ struct EnAm; -typedef void (*EnAmActionFunc)(struct EnAm*, GlobalContext*); +typedef void (*EnAmActionFunc)(struct EnAm*, PlayState*); typedef struct EnAm { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 5debc658e..f95c5de80 100644 --- a/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -9,22 +9,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnAni_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAni_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAni_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAni_Init(Actor* thisx, PlayState* play); +void EnAni_Destroy(Actor* thisx, PlayState* play); +void EnAni_Update(Actor* thisx, PlayState* play); +void EnAni_Draw(Actor* thisx, PlayState* play); -s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId); -void func_809B04F0(EnAni* this, GlobalContext* globalCtx); -void func_809B0524(EnAni* this, GlobalContext* globalCtx); -void func_809B0558(EnAni* this, GlobalContext* globalCtx); -void func_809B05F0(EnAni* this, GlobalContext* globalCtx); -void func_809B064C(EnAni* this, GlobalContext* globalCtx); -void func_809B07F8(EnAni* this, GlobalContext* globalCtx); -void func_809B0988(EnAni* this, GlobalContext* globalCtx); -void func_809B0994(EnAni* this, GlobalContext* globalCtx); -void func_809B0A28(EnAni* this, GlobalContext* globalCtx); -void func_809B0A6C(EnAni* this, GlobalContext* globalCtx); +s32 EnAni_SetText(EnAni* this, PlayState* play, u16 textId); +void func_809B04F0(EnAni* this, PlayState* play); +void func_809B0524(EnAni* this, PlayState* play); +void func_809B0558(EnAni* this, PlayState* play); +void func_809B05F0(EnAni* this, PlayState* play); +void func_809B064C(EnAni* this, PlayState* play); +void func_809B07F8(EnAni* this, PlayState* play); +void func_809B0988(EnAni* this, PlayState* play); +void func_809B0994(EnAni* this, PlayState* play); +void func_809B0A28(EnAni* this, PlayState* play); +void func_809B0A6C(EnAni* this, PlayState* play); const ActorInit En_Ani_InitVars = { ACTOR_EN_ANI, @@ -68,17 +68,17 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 850, ICHAIN_STOP), }; -void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Init(Actor* thisx, PlayState* play) { s32 pad; EnAni* this = (EnAni*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, -2800.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRoofManSkel, &gRoofManIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gRoofManSkel, &gRoofManIdleAnim, this->jointTable, this->morphTable, 0x10); Animation_PlayOnce(&this->skelAnime, &gRoofManIdleAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (!LINK_IS_ADULT) { EnAni_SetupAction(this, func_809B064C); @@ -91,33 +91,33 @@ void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.velocity.y = -1.0f; } -void EnAni_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Destroy(Actor* thisx, PlayState* play) { EnAni* this = (EnAni*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId) { +s32 EnAni_SetText(EnAni* this, PlayState* play, u16 textId) { this->actor.textId = textId; this->unk_2A8 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); return 0; } -void func_809B04F0(EnAni* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809B04F0(EnAni* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { EnAni_SetupAction(this, func_809B064C); } } -void func_809B0524(EnAni* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809B0524(EnAni* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { EnAni_SetupAction(this, func_809B07F8); } } -void func_809B0558(EnAni* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809B0558(EnAni* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (!LINK_IS_ADULT) { EnAni_SetupAction(this, func_809B04F0); @@ -127,33 +127,33 @@ void func_809B0558(EnAni* this, GlobalContext* globalCtx) { gSaveContext.itemGetInf[1] |= 0x20; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 200.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_MAN_ON_ROOF, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 200.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 200.0f); } } } -void func_809B05F0(EnAni* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809B05F0(EnAni* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { EnAni_SetupAction(this, func_809B0558); } if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 200.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_MAN_ON_ROOF, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 200.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 200.0f); } } -void func_809B064C(EnAni* this, GlobalContext* globalCtx) { +void func_809B064C(EnAni* this, PlayState* play) { u16 textId; s16 yawDiff; u16 textId2; - textId2 = Text_GetFaceReaction(globalCtx, 0xA); + textId2 = Text_GetFaceReaction(play, 0xA); textId = textId2 & 0xFFFF; if (!textId) {} @@ -163,7 +163,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { } yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.textId == 0x5056) { EnAni_SetupAction(this, func_809B04F0); } else if (this->actor.textId == 0x5055) { @@ -174,22 +174,22 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { } else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f && -80.0f < this->actor.yDistToPlayer) { if (gSaveContext.itemGetInf[1] & 0x20) { - EnAni_SetText(this, globalCtx, 0x5056); + EnAni_SetText(this, play, 0x5056); } else { - EnAni_SetText(this, globalCtx, 0x5055); + EnAni_SetText(this, play, 0x5055); } } else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { - EnAni_SetText(this, globalCtx, textId); + EnAni_SetText(this, play, textId); } } -void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { +void func_809B07F8(EnAni* this, PlayState* play) { s16 pad; s16 yawDiff; u16 textId; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.textId == 0x5056) { EnAni_SetupAction(this, func_809B0524); } else if (this->actor.textId == 0x5055) { @@ -200,9 +200,9 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { } else if (yawDiff > -0x36B0 && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f && -80.0f < this->actor.yDistToPlayer) { if (gSaveContext.itemGetInf[1] & 0x20) { - EnAni_SetText(this, globalCtx, 0x5056); + EnAni_SetText(this, play, 0x5056); } else { - EnAni_SetText(this, globalCtx, 0x5055); + EnAni_SetText(this, play, 0x5055); } } else if (yawDiff > -0x3E8 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { if (!(gSaveContext.eventChkInf[2] & 0x8000)) { @@ -210,15 +210,15 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { } else { textId = (gSaveContext.itemGetInf[1] & 0x20) ? 0x5054 : 0x5053; } - EnAni_SetText(this, globalCtx, textId); + EnAni_SetText(this, play, textId); } } -void func_809B0988(EnAni* this, GlobalContext* globalCtx) { +void func_809B0988(EnAni* this, PlayState* play) { } -void func_809B0994(EnAni* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.npcActions[0]->action == 4) { +void func_809B0994(EnAni* this, PlayState* play) { + if (play->csCtx.npcActions[0]->action == 4) { Animation_Change(&this->skelAnime, &gRoofManGettingUpAfterKnockbackAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gRoofManGettingUpAfterKnockbackAnim), ANIMMODE_ONCE, -4.0f); this->unk_2AA++; @@ -226,17 +226,17 @@ void func_809B0994(EnAni* this, GlobalContext* globalCtx) { } } -void func_809B0A28(EnAni* this, GlobalContext* globalCtx) { +void func_809B0A28(EnAni* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_2AA++; } } -void func_809B0A6C(EnAni* this, GlobalContext* globalCtx) { +void func_809B0A6C(EnAni* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; } - if (globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.npcActions[0]->action == 2) { Animation_Change(&this->skelAnime, &gRoofManKnockbackAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gRoofManKnockbackAnim), ANIMMODE_ONCE, 0.0f); this->actor.shape.shadowDraw = NULL; @@ -244,45 +244,45 @@ void func_809B0A6C(EnAni* this, GlobalContext* globalCtx) { } } -void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Update(Actor* thisx, PlayState* play) { EnAni* this = (EnAni*)thisx; s32 pad[2]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[0] != NULL)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL)) { switch (this->unk_2AA) { case 0: - func_809B0A6C(this, globalCtx); + func_809B0A6C(this, play); break; case 1: - func_809B0A28(this, globalCtx); + func_809B0A28(this, play); break; case 2: - func_809B0994(this, globalCtx); + func_809B0994(this, play); break; case 3: - func_809B0A28(this, globalCtx); + func_809B0A28(this, play); break; case 4: - func_809B0988(this, globalCtx); + func_809B0988(this, play); break; } - if (globalCtx->csCtx.frames == 100) { + if (play->csCtx.frames == 100) { func_800788CC(NA_SE_IT_EARTHQUAKE); } } else { if (SkelAnime_Update(&this->skelAnime) != 0) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } if (this->unk_2A8 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); this->unk_2A2.z = 0; this->unk_2A2.y = this->unk_2A2.z; this->unk_2A2.x = this->unk_2A2.z; @@ -302,7 +302,7 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnAni_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAni* this = (EnAni*)thisx; if (limbIndex == 15) { @@ -312,7 +312,7 @@ s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnAni_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f sMultVec = { 800.0f, 500.0f, 0.0f }; EnAni* this = (EnAni*)thisx; @@ -321,7 +321,7 @@ void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gRoofManEyeOpenTex, gRoofManEyeHalfTex, @@ -330,14 +330,14 @@ void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) { EnAni* this = (EnAni*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 6ab185cb8..99bad6e1c 100644 --- a/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/soh/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -6,7 +6,7 @@ struct EnAni; -typedef void (*EnAniActionFunc)(struct EnAni*, GlobalContext*); +typedef void (*EnAniActionFunc)(struct EnAni*, PlayState*); typedef struct EnAni { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index 3656a0d7a..2042d906a 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -12,18 +12,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAnubice_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAnubice_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAnubice_Init(Actor* thisx, PlayState* play); +void EnAnubice_Destroy(Actor* thisx, PlayState* play); +void EnAnubice_Update(Actor* thisx, PlayState* play); +void EnAnubice_Draw(Actor* thisx, PlayState* play); -void EnAnubice_FindFlameCircles(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_SetupIdle(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_Idle(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_GoToHome(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_SetupShootFireball(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_Die(EnAnubice* this, GlobalContext* globalCtx); +void EnAnubice_FindFlameCircles(EnAnubice* this, PlayState* play); +void EnAnubice_SetupIdle(EnAnubice* this, PlayState* play); +void EnAnubice_Idle(EnAnubice* this, PlayState* play); +void EnAnubice_GoToHome(EnAnubice* this, PlayState* play); +void EnAnubice_SetupShootFireball(EnAnubice* this, PlayState* play); +void EnAnubice_ShootFireball(EnAnubice* this, PlayState* play); +void EnAnubice_Die(EnAnubice* this, PlayState* play); const ActorInit En_Anubice_InitVars = { ACTOR_EN_ANUBICE, @@ -99,8 +99,8 @@ static DamageTable sDamageTable[] = { /* Unknown 2 */ DMG_ENTRY(0, ANUBICE_DMGEFF_NONE), }; -void EnAnubice_Hover(EnAnubice* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnAnubice_Hover(EnAnubice* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->hoverVelocityTimer += 1500.0f; this->targetHeight = player->actor.world.pos.y + this->playerHeightOffset; @@ -109,12 +109,12 @@ void EnAnubice_Hover(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.y = Math_SinS(this->hoverVelocityTimer); } -void EnAnubice_SetFireballRot(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_SetFireballRot(EnAnubice* this, PlayState* play) { f32 xzdist; f32 x; f32 y; f32 z; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); x = player->actor.world.pos.x - this->fireballPos.x; y = player->actor.world.pos.y + 10.0f - this->fireballPos.y; @@ -125,11 +125,11 @@ void EnAnubice_SetFireballRot(EnAnubice* this, GlobalContext* globalCtx) { this->fireballRot.y = RADF_TO_BINANG(Math_FAtan2F(x, z)); } -void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Init(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gAnubiceSkel, &gAnubiceIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gAnubiceSkel, &gAnubiceIdleAnim, this->jointTable, this->morphTable, ANUBICE_LIMB_MAX); osSyncPrintf("\n\n"); @@ -138,8 +138,8 @@ void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.naviEnemyId = 0x3A; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.015f); @@ -153,11 +153,11 @@ void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnAnubice_FindFlameCircles; } -void EnAnubice_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Destroy(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; EnAnubiceTag* tag; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (this->actor.params != 0) { if (this->actor.parent) {} @@ -169,14 +169,14 @@ void EnAnubice_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void EnAnubice_FindFlameCircles(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_FindFlameCircles(EnAnubice* this, PlayState* play) { Actor* currentProp; s32 flameCirclesFound; if (this->isMirroringLink) { if (!this->hasSearchedForFlameCircles) { flameCirclesFound = 0; - currentProp = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + currentProp = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (currentProp != NULL) { if (currentProp->id != ACTOR_BG_HIDAN_CURTAIN) { currentProp = currentProp->next; @@ -199,7 +199,7 @@ void EnAnubice_FindFlameCircles(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_SetupIdle(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_SetupIdle(EnAnubice* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gAnubiceIdleAnim); Animation_Change(&this->skelAnime, &gAnubiceIdleAnim, 1.0f, 0.0f, (s16)lastFrame, ANIMMODE_LOOP, -10.0f); @@ -208,8 +208,8 @@ void EnAnubice_SetupIdle(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.x = this->actor.velocity.z = this->actor.gravity = 0.0f; } -void EnAnubice_Idle(EnAnubice* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnAnubice_Idle(EnAnubice* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.shape.yOffset, 0.5f, 300.0f); @@ -232,7 +232,7 @@ void EnAnubice_Idle(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_GoToHome(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_GoToHome(EnAnubice* this, PlayState* play) { f32 xzdist; f32 xRatio; f32 zRatio; @@ -264,7 +264,7 @@ void EnAnubice_GoToHome(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_SetupShootFireball(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_SetupShootFireball(EnAnubice* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gAnubiceAttackingAnim); this->animLastFrame = lastFrame; @@ -273,7 +273,7 @@ void EnAnubice_SetupShootFireball(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.x = this->actor.velocity.z = 0.0f; } -void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_ShootFireball(EnAnubice* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -282,10 +282,10 @@ void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 3000, 0); } - EnAnubice_SetFireballRot(this, globalCtx); + EnAnubice_SetFireballRot(this, play); if (curFrame == 12.0f) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ANUBICE_FIRE, this->fireballPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ANUBICE_FIRE, this->fireballPos.x, this->fireballPos.y + 15.0f, this->fireballPos.z, this->fireballRot.x, this->fireballRot.y, 0, 0); } @@ -294,7 +294,7 @@ void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_SetupDie(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_SetupDie(EnAnubice* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gAnubiceFallDownAnim); this->animLastFrame = lastFrame; @@ -306,7 +306,7 @@ void EnAnubice_SetupDie(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.x = this->actor.velocity.z = 0.0f; this->actor.gravity = -1.0f; - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->fireballPos, 70.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->fireballPos, 70.0f)) { this->isFallingOver = true; this->fallTargetPitch = this->actor.shape.rot.x - 0x7F00; } @@ -314,7 +314,7 @@ void EnAnubice_SetupDie(EnAnubice* this, GlobalContext* globalCtx) { this->actionFunc = EnAnubice_Die; } -void EnAnubice_Die(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_Die(EnAnubice* this, PlayState* play) { f32 curFrame; f32 rotX; Vec3f fireEffectInitialPos = { 0.0f, 0.0f, 0.0f }; @@ -343,18 +343,18 @@ void EnAnubice_Die(EnAnubice* this, GlobalContext* globalCtx) { fireEffectPos.y += this->actor.world.pos.y + Rand_CenteredFloat(40.0f); fireEffectPos.z += this->actor.world.pos.z + Rand_CenteredFloat(30.0f); Actor_SetColorFilter(&this->actor, 0x4000, 128, 0, 8); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &fireEffectPos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &fireEffectPos, 100, 0, 0, -1); if ((this->animLastFrame <= curFrame) && (this->actor.bgCheckFlags & 1)) { Math_ApproachF(&this->actor.shape.yOffset, -4230.0f, 0.5f, 300.0f); if (this->actor.shape.yOffset < -2000.0f) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xC0); Actor_Kill(&this->actor); } } } -void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Update(Actor* thisx, PlayState* play) { f32 zero; BgHidanCurtain* flameCircle; s32 i; @@ -364,16 +364,16 @@ void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actionFunc != EnAnubice_SetupDie) && (this->actionFunc != EnAnubice_Die) && (this->actor.shape.yOffset == 0.0f)) { - EnAnubice_Hover(this, globalCtx); + EnAnubice_Hover(this, play); for (i = 0; i < ARRAY_COUNT(this->flameCircles); i++) { flameCircle = this->flameCircles[i]; if ((flameCircle != NULL) && (fabsf(flameCircle->actor.world.pos.x - this->actor.world.pos.x) < 60.0f) && (fabsf(this->flameCircles[i]->actor.world.pos.z - this->actor.world.pos.z) < 60.0f) && (flameCircle->timer != 0)) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.flags &= ~ACTOR_FLAG_0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_DEAD); this->actionFunc = EnAnubice_SetupDie; return; @@ -383,9 +383,9 @@ void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect == ANUBICE_DMGEFF_FIRE) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.flags &= ~ACTOR_FLAG_0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_DEAD); this->actionFunc = EnAnubice_SetupDie; return; @@ -440,29 +440,29 @@ void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { this->deathTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.velocity.y += this->actor.gravity; func_8002D7EC(&this->actor); if (!this->isLinkOutOfRange) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 5.0f, 10.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 5.0f, 10.0f, 0x1D); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 5.0f, 10.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 5.0f, 10.0f, 0x1C); } if ((this->actionFunc != EnAnubice_SetupDie) && (this->actionFunc != EnAnubice_Die)) { Actor_SetFocus(&this->actor, this->focusHeightOffset); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (!this->isKnockedback && (this->actor.shape.yOffset == 0.0f)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnAnubice_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnAnubice_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAnubice* this = (EnAnubice*)thisx; @@ -473,26 +473,26 @@ s32 EnAnubice_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnAnubice_PostLimbDraw(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnAnubice_PostLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnAnubice* this = (EnAnubice*)thisx; Vec3f pos = { 0.0f, 0.0f, 0.0f }; if (limbIndex == ANUBICE_LIMB_HEAD) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - 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++, gAnubiceEyesDL); Matrix_MultVec3f(&pos, &this->fireballPos); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnAnubice_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Draw(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; - func_80093D84(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnAnubice_OverrideLimbDraw, + func_80093D84(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnAnubice_OverrideLimbDraw, EnAnubice_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h b/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h index 0796c0fb5..cea8a86de 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h +++ b/soh/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h @@ -7,7 +7,7 @@ struct EnAnubice; -typedef void (*EnAnubiceActionFunc)(struct EnAnubice*, struct GlobalContext*); +typedef void (*EnAnubiceActionFunc)(struct EnAnubice*, struct PlayState*); typedef enum { /* 0 */ ANUBICE_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index e01c093c6..8659b80a3 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -11,14 +11,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAnubiceFire_Init(Actor* thisx, PlayState* play); +void EnAnubiceFire_Destroy(Actor* thisx, PlayState* play); +void EnAnubiceFire_Update(Actor* thisx, PlayState* play); +void EnAnubiceFire_Draw(Actor* thisx, PlayState* play); -void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx); -void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx); -void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx); +void func_809B26EC(EnAnubiceFire* this, PlayState* play); +void func_809B27D8(EnAnubiceFire* this, PlayState* play); +void func_809B2B48(EnAnubiceFire* this, PlayState* play); const ActorInit En_Anubice_Fire_InitVars = { ACTOR_EN_ANUBICE_FIRE, @@ -53,12 +53,12 @@ static ColliderCylinderInit sCylinderInit = { { 0, 0, 0, { 0, 0, 0 } }, }; -void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Init(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; s32 i; - Collider_InitCylinder(globalCtx, &this->cylinder); - Collider_SetCylinder(globalCtx, &this->cylinder, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->cylinder); + Collider_SetCylinder(play, &this->cylinder, &this->actor, &sCylinderInit); this->unk_15A = 30; this->unk_154 = 2.0f; @@ -73,13 +73,13 @@ void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_809B26EC; } -void EnAnubiceFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Destroy(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; - Collider_DestroyCylinder(globalCtx, &this->cylinder); + Collider_DestroyCylinder(play, &this->cylinder); } -void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx) { +void func_809B26EC(EnAnubiceFire* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Matrix_Push(); @@ -93,7 +93,7 @@ void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx) { this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = 0; } -void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { +void func_809B27D8(EnAnubiceFire* this, PlayState* play) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -112,7 +112,7 @@ void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { if ((this->unk_15A == 0) && (this->scale < 0.1f)) { Actor_Kill(&this->actor); } else if ((this->actor.params == 0) && (this->cylinder.base.atFlags & 4)) { - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); this->cylinder.base.atFlags &= 0xFFE9; this->cylinder.base.atFlags |= 8; @@ -124,7 +124,7 @@ void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { this->actor.velocity.z *= -1.0f; } else { this->unk_15A = 0; - EffectSsBomb2_SpawnLayered(globalCtx, &this->actor.world.pos, &sp78, &sp84, 10, 5); + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &sp78, &sp84, 10, 5); this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIREBOMB); this->actionFunc = func_809B2B48; @@ -138,13 +138,13 @@ void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * (this->scale * 20.0f); pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * (this->scale * 20.0f); pos.z = this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, life); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, scale, life); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIRE - SFX_FLAG); } } -void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx) { +void func_809B2B48(EnAnubiceFire* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f pos; @@ -161,7 +161,7 @@ void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx) { accel.x = Rand_CenteredFloat(8.0f); accel.y = Rand_CenteredFloat(2.0f); accel.z = Rand_CenteredFloat(8.0f); - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 2000, 10); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 2000, 10); } this->unk_15C = 2; @@ -172,13 +172,13 @@ void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx) { } } -void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Update(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; s32 pad; s32 i; Actor_SetScale(&this->actor, this->scale); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002D7EC(&this->actor); this->unk_160[0] = this->actor.world.pos; @@ -194,7 +194,7 @@ void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C--; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 5.0f, 10.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 5.0f, 10.0f, 0x1D); if (!(this->scale < 0.6f || this->actionFunc == func_809B2B48)) { this->cylinder.dim.radius = this->scale * 15.0f + 5.0f; this->cylinder.dim.height = this->scale * 15.0f + 5.0f; @@ -202,11 +202,11 @@ void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_15A != 0) { Collider_UpdateCylinder(&this->actor, &this->cylinder); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder.base); } - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->actor.world.pos, 30.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->actor.world.pos, 30.0f)) { this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIREBOMB); this->actionFunc = func_809B2B48; @@ -214,7 +214,7 @@ void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Draw(Actor* thisx, PlayState* play) { static void* D_809B3270[] = { gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, }; @@ -222,8 +222,8 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad[2]; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); @@ -243,10 +243,10 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { if (scale >= 0.1f) { Matrix_Translate(this->unk_160[i].x, this->unk_160[i].y, this->unk_160[i].z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ(this->actor.world.rot.z + i * 1000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gAnubiceFireAttackDL); @@ -260,5 +260,5 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h index aa6359c48..1039066bc 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h +++ b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h @@ -6,7 +6,7 @@ struct EnAnubiceFire; -typedef void (*EnAnubiceFireActionFunc)(struct EnAnubiceFire*, GlobalContext*); +typedef void (*EnAnubiceFireActionFunc)(struct EnAnubiceFire*, PlayState*); typedef struct EnAnubiceFire { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 73e462a67..8867436e2 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -9,13 +9,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnAnubiceTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceTag_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceTag_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAnubiceTag_Init(Actor* thisx, PlayState* play); +void EnAnubiceTag_Destroy(Actor* thisx, PlayState* play); +void EnAnubiceTag_Update(Actor* thisx, PlayState* play); +void EnAnubiceTag_Draw(Actor* thisx, PlayState* play); -void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx); -void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx); +void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, PlayState* play); +void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, PlayState* play); const ActorInit En_Anubice_Tag_InitVars = { ACTOR_EN_ANUBICE_TAG, @@ -30,7 +30,7 @@ const ActorInit En_Anubice_Tag_InitVars = { NULL, }; -void EnAnubiceTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Init(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; osSyncPrintf("\n\n"); @@ -46,11 +46,11 @@ void EnAnubiceTag_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnAnubiceTag_SpawnAnubis; } -void EnAnubiceTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Destroy(Actor* thisx, PlayState* play) { } -void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { - this->anubis = (EnAnubice*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANUBICE, +void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, PlayState* play) { + this->anubis = (EnAnubice*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ANUBICE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.yawTowardsPlayer, 0, 0); @@ -59,7 +59,7 @@ void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { } } -void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { +void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, PlayState* play) { EnAnubice* anubis; Vec3f offset; @@ -96,18 +96,18 @@ void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { } } -void EnAnubiceTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Update(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnAnubiceTag_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Draw(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0xFF, 0, 0, 0xFF, 4, globalCtx->state.gfxCtx); + 1.0f, 0xFF, 0, 0, 0xFF, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h b/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h index 45dabd96f..4aebaa0a6 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h +++ b/soh/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h @@ -7,7 +7,7 @@ struct EnAnubiceTag; -typedef void (*EnAnubiceTagActionFunc)(struct EnAnubiceTag*, GlobalContext*); +typedef void (*EnAnubiceTagActionFunc)(struct EnAnubiceTag*, PlayState*); typedef struct EnAnubiceTag { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c b/soh/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c index 73b87aaa6..626f235b9 100644 --- a/soh/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c +++ b/soh/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c @@ -8,9 +8,9 @@ #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #define FLAGS ACTOR_FLAG_4 -void EnArowTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnArowTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx); +void EnArowTrap_Init(Actor* thisx, PlayState* play); +void EnArowTrap_Destroy(Actor* thisx, PlayState* play); +void EnArowTrap_Update(Actor* thisx, PlayState* play); const ActorInit En_Arow_Trap_InitVars = { ACTOR_EN_AROW_TRAP, @@ -25,7 +25,7 @@ const ActorInit En_Arow_Trap_InitVars = { NULL, }; -void EnArowTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnArowTrap_Init(Actor* thisx, PlayState* play) { EnArowTrap* this = (EnArowTrap*)thisx; Actor_SetScale(&this->actor, 0.01); @@ -34,17 +34,17 @@ void EnArowTrap_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; } -void EnArowTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnArowTrap_Destroy(Actor* thisx, PlayState* play) { } -void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnArowTrap_Update(Actor* thisx, PlayState* play) { EnArowTrap* this = (EnArowTrap*)thisx; if (this->actor.xzDistToPlayer <= 400) { this->attackTimer--; if (this->attackTimer == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, ARROW_NORMAL_SILENT); this->attackTimer = 80; diff --git a/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 1e48ec18d..c582d8b95 100644 --- a/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -10,15 +10,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnArrow_Init(Actor* thisx, PlayState* play); +void EnArrow_Destroy(Actor* thisx, PlayState* play); +void EnArrow_Update(Actor* thisx, PlayState* play); +void EnArrow_Draw(Actor* thisx, PlayState* play); -void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx); -void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx); -void func_809B45E0(EnArrow* this, GlobalContext* globalCtx); -void func_809B4640(EnArrow* this, GlobalContext* globalCtx); +void EnArrow_Shoot(EnArrow* this, PlayState* play); +void EnArrow_Fly(EnArrow* this, PlayState* play); +void func_809B45E0(EnArrow* this, PlayState* play); +void func_809B4640(EnArrow* this, PlayState* play); const ActorInit En_Arrow_InitVars = { ACTOR_EN_ARROW, @@ -61,7 +61,7 @@ void EnArrow_SetupAction(EnArrow* this, EnArrowActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Init(Actor* thisx, PlayState* play) { static EffectBlureInit2 blureNormal = { 0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16, 0, 1, 0, { 255, 255, 170, 255 }, { 0, 150, 0, 0 }, 0, @@ -124,7 +124,7 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params <= ARROW_SEED) { if (this->actor.params <= ARROW_0E) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gArrowSkel, &gArrow2Anim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gArrowSkel, &gArrow2Anim, NULL, NULL, 0); } if (this->actor.params <= ARROW_NORMAL) { @@ -134,23 +134,23 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { blureNormal.elemDuration = 16; } - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureNormal); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureNormal); } else if (this->actor.params == ARROW_FIRE) { - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureFire); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureFire); } else if (this->actor.params == ARROW_ICE) { - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureIce); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureIce); } else if (this->actor.params == ARROW_LIGHT) { - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureLight); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureLight); } - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sColliderInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sColliderInit); if (this->actor.params <= ARROW_NORMAL) { this->collider.info.toucherFlags &= ~0x18; @@ -168,23 +168,23 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { EnArrow_SetupAction(this, EnArrow_Shoot); } -void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Destroy(Actor* thisx, PlayState* play) { EnArrow* this = (EnArrow*)thisx; if (this->actor.params <= ARROW_LIGHT) { - Effect_Delete(globalCtx, this->effectIndex); + Effect_Delete(play, this->effectIndex); } - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyQuad(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyQuad(play, &this->collider); if ((this->hitActor != NULL) && (this->hitActor->update != NULL)) { this->hitActor->flags &= ~ACTOR_FLAG_15; } } -void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnArrow_Shoot(EnArrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.parent == NULL) { if ((this->actor.params != ARROW_NUT) && (player->unk_A73 == 0)) { @@ -224,7 +224,7 @@ void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx) { } } -void func_809B3CEC(GlobalContext* globalCtx, EnArrow* this) { +void func_809B3CEC(PlayState* play, EnArrow* this) { EnArrow_SetupAction(this, func_809B4640); Animation_PlayOnce(&this->skelAnime, &gArrow1Anim); this->actor.world.rot.y += (s32)(24576.0f * (Rand_ZeroOne() - 0.5f)) + 0x8000; @@ -234,7 +234,7 @@ void func_809B3CEC(GlobalContext* globalCtx, EnArrow* this) { this->actor.gravity = -1.5f; } -void EnArrow_CarryActor(EnArrow* this, GlobalContext* globalCtx) { +void EnArrow_CarryActor(EnArrow* this, PlayState* play) { CollisionPoly* hitPoly; Vec3f posDiffLastFrame; Vec3f actorNextPos; @@ -257,7 +257,7 @@ void EnArrow_CarryActor(EnArrow* this, GlobalContext* globalCtx) { Math_Vec3f_Scale(&posDiffLastFrame, scale); Math_Vec3f_Sum(&this->hitActor->world.pos, &posDiffLastFrame, &actorNextPos); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->hitActor->world.pos, &actorNextPos, &hitPos, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->hitActor->world.pos, &actorNextPos, &hitPos, &hitPoly, true, true, true, true, &bgId)) { this->hitActor->world.pos.x = hitPos.x + ((actorNextPos.x <= hitPos.x) ? 1.0f : -1.0f); this->hitActor->world.pos.y = hitPos.y + ((actorNextPos.y <= hitPos.y) ? 1.0f : -1.0f); @@ -269,7 +269,7 @@ void EnArrow_CarryActor(EnArrow* this, GlobalContext* globalCtx) { } } -void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { +void EnArrow_Fly(EnArrow* this, PlayState* play) { CollisionPoly* hitPoly; s32 bgId; Vec3f hitPoint; @@ -302,18 +302,18 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { if (this->actor.params == ARROW_NUT) { iREG(50) = -1; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_M_FIRE1, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_M_FIRE1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); sfxId = NA_SE_IT_DEKU; } else { sfxId = NA_SE_IT_SLING_REFLECT; } - EffectSsStone1_Spawn(globalCtx, &this->actor.world.pos, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, sfxId); + EffectSsStone1_Spawn(play, &this->actor.world.pos, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, sfxId); Actor_Kill(&this->actor); } else { - EffectSsHitMark_SpawnCustomScale(globalCtx, 0, 150, &this->actor.world.pos); + EffectSsHitMark_SpawnCustomScale(play, 0, 150, &this->actor.world.pos); if (atTouched && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) { hitActor = this->collider.base.at; @@ -321,7 +321,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { if ((hitActor->update != NULL) && (!(this->collider.base.atFlags & AT_BOUNCED)) && (hitActor->flags & ACTOR_FLAG_14)) { this->hitActor = hitActor; - EnArrow_CarryActor(this, globalCtx); + EnArrow_CarryActor(this, play); Math_Vec3f_Diff(&hitActor->world.pos, &this->actor.world.pos, &this->unk_250); hitActor->flags |= ACTOR_FLAG_15; this->collider.base.atFlags &= ~AT_HIT; @@ -337,7 +337,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { this->actor.world.pos.z = this->collider.info.atHitInfo->bumper.hitPos.z; } - func_809B3CEC(globalCtx, this); + func_809B3CEC(play, this); Audio_PlayActorSound2(&this->actor, NA_SE_IT_ARROW_STICK_CRE); } } else if (this->touchedPoly) { @@ -359,9 +359,9 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if ((this->touchedPoly = - BgCheck_ProjectileLineTest(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint, + BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint, &this->actor.wallPoly, true, true, true, true, &bgId))) { - func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, bgId, &hitPoint); + func_8002F9EC(play, &this->actor, this->actor.wallPoly, bgId, &hitPoint); Math_Vec3f_Copy(&posCopy, &this->actor.world.pos); Math_Vec3f_Copy(&this->actor.world.pos, &hitPoint); } @@ -376,7 +376,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { Math_Vec3f_Sum(&this->unk_210, &this->unk_250, &sp60); Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_250, &sp54); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &sp54, &hitPoint, &hitPoly, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &sp54, &hitPoint, &hitPoly, true, true, true, true, &bgId)) { this->hitActor->world.pos.x = hitPoint.x + ((sp54.x <= hitPoint.x) ? 1.0f : -1.0f); this->hitActor->world.pos.y = hitPoint.y + ((sp54.y <= hitPoint.y) ? 1.0f : -1.0f); @@ -398,7 +398,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { } } -void func_809B45E0(EnArrow* this, GlobalContext* globalCtx) { +void func_809B45E0(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (DECR(this->timer) == 0) { @@ -406,7 +406,7 @@ void func_809B45E0(EnArrow* this, GlobalContext* globalCtx) { } } -void func_809B4640(EnArrow* this, GlobalContext* globalCtx) { +void func_809B4640(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); @@ -415,14 +415,14 @@ void func_809B4640(EnArrow* this, GlobalContext* globalCtx) { } } -void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Update(Actor* thisx, PlayState* play) { s32 pad; EnArrow* this = (EnArrow*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->isCsNut || ((this->actor.params >= ARROW_NORMAL_LIT) && (player->unk_A73 != 0)) || - !Player_InBlockingCsMode(globalCtx, player)) { - this->actionFunc(this, globalCtx); + !Player_InBlockingCsMode(play, player)) { + this->actionFunc(this, play); } if ((this->actor.params >= ARROW_FIRE) && (this->actor.params <= ARROW_0E)) { @@ -430,7 +430,7 @@ void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { ACTOR_ARROW_FIRE, ACTOR_ARROW_FIRE, ACTOR_ARROW_FIRE }; if (this->actor.child == NULL) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, elementalActorIds[this->actor.params - 3], + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, elementalActorIds[this->actor.params - 3], this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } } else if (this->actor.params == ARROW_NORMAL_LIT) { @@ -439,11 +439,11 @@ void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { static Color_RGBA8 primColor = { 255, 255, 100, 255 }; static Color_RGBA8 envColor = { 255, 50, 0, 0 }; // spawn dust for the flame - func_8002836C(globalCtx, &this->unk_21C, &velocity, &accel, &primColor, &envColor, 100, 0, 8); + func_8002836C(play, &this->unk_21C, &velocity, &accel, &primColor, &envColor, 100, 0, 8); } } -void func_809B4800(EnArrow* this, GlobalContext* globalCtx) { +void func_809B4800(EnArrow* this, PlayState* play) { static Vec3f D_809B4E88 = { 0.0f, 400.0f, 1500.0f }; static Vec3f D_809B4E94 = { 0.0f, -400.0f, 1500.0f }; static Vec3f D_809B4EA0 = { 0.0f, 0.0f, -300.0f }; @@ -461,7 +461,7 @@ void func_809B4800(EnArrow* this, GlobalContext* globalCtx) { addBlureVertex = this->actor.params <= ARROW_LIGHT; if (this->hitActor == NULL) { - addBlureVertex &= func_80090480(globalCtx, &this->collider, &this->weaponInfo, &sp44, &sp38); + addBlureVertex &= func_80090480(play, &this->collider, &this->weaponInfo, &sp44, &sp38); } else { if (addBlureVertex) { if ((sp44.x == this->weaponInfo.tip.x) && (sp44.y == this->weaponInfo.tip.y) && @@ -479,22 +479,22 @@ void func_809B4800(EnArrow* this, GlobalContext* globalCtx) { } } -void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Draw(Actor* thisx, PlayState* play) { s32 pad; EnArrow* this = (EnArrow*)thisx; u8 alpha; f32 scale; if (this->actor.params <= ARROW_0E) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawLod(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawLod(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this, (this->actor.projectedPos.z < MREG(95)) ? 0 : 1); } else if (this->actor.speedXZ != 0.0f) { alpha = (Math_CosS(this->timer * 5000) * 127.5f) + 127.5f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093C14(globalCtx->state.gfxCtx); + func_80093C14(play->state.gfxCtx); if (this->actor.params == ARROW_SEED) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); @@ -507,19 +507,19 @@ void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Push(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); // redundant check because this is contained in an if block for non-zero speed Matrix_RotateZ( - (this->actor.speedXZ == 0.0f) ? 0.0f : ((globalCtx->gameplayFrames & 0xFF) * 4000) * (M_PI / 0x8000), + (this->actor.speedXZ == 0.0f) ? 0.0f : ((play->gameplayFrames & 0xFF) * 4000) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, 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++, gEffSparklesDL); Matrix_Pop(); Matrix_RotateY(this->actor.world.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } - func_809B4800(this, globalCtx); + func_809B4800(this, play); } diff --git a/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h b/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h index 2cb30afcc..f250cafe3 100644 --- a/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h +++ b/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h @@ -6,7 +6,7 @@ struct EnArrow; -typedef void (*EnArrowActionFunc)(struct EnArrow*, GlobalContext*); +typedef void (*EnArrowActionFunc)(struct EnArrow*, PlayState*); typedef struct EnArrow { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index c67f39524..d299eadba 100644 --- a/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -10,14 +10,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAttackNiw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAttackNiw_Init(Actor* thisx, PlayState* play); +void EnAttackNiw_Destroy(Actor* thisx, PlayState* play); +void EnAttackNiw_Update(Actor* thisx, PlayState* play); +void EnAttackNiw_Draw(Actor* thisx, PlayState* play); -void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx); -void func_809B5C18(EnAttackNiw* this, GlobalContext* globalCtx); -void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx); +void func_809B5670(EnAttackNiw* this, PlayState* play); +void func_809B5C18(EnAttackNiw* this, PlayState* play); +void func_809B59B0(EnAttackNiw* this, PlayState* play); const ActorInit En_Attack_Niw_InitVars = { ACTOR_EN_ATTACK_NIW, @@ -38,13 +38,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Init(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); if (this->actor.params < 0) { this->actor.params = 0; } @@ -59,7 +59,7 @@ void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_809B5670; } -void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Destroy(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; EnNiw* cucco = (EnNiw*)this->actor.parent; @@ -70,7 +70,7 @@ void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_809B5268(EnAttackNiw* this, GlobalContext* globalCtx, s16 arg2) { +void func_809B5268(EnAttackNiw* this, PlayState* play, s16 arg2) { if (this->unk_254 == 0) { if (arg2 == 0) { this->unk_264 = 0.0f; @@ -164,12 +164,12 @@ void func_809B5268(EnAttackNiw* this, GlobalContext* globalCtx, s16 arg2) { } } -s32 func_809B55EC(EnAttackNiw* this, GlobalContext* globalCtx) { +s32 func_809B55EC(EnAttackNiw* this, PlayState* play) { s16 sp1E; s16 sp1C; Actor_SetFocus(&this->actor, this->unk_2E4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp1E, &sp1C); + Actor_GetScreenPos(play, &this->actor, &sp1E, &sp1C); if ((this->actor.projectedPos.z < -20.0f) || (sp1E < 0) || (sp1E > SCREEN_WIDTH) || (sp1C < 0) || (sp1C > SCREEN_HEIGHT)) { return 0; @@ -178,7 +178,7 @@ s32 func_809B55EC(EnAttackNiw* this, GlobalContext* globalCtx) { } } -void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { +void func_809B5670(EnAttackNiw* this, PlayState* play) { s16 sp4E; s16 sp4C; f32 tmpf1; @@ -188,13 +188,13 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { this->actor.speedXZ = 10.0f; - tmpf1 = (this->unk_298.x + globalCtx->view.lookAt.x) - globalCtx->view.eye.x; - tmpf2 = (this->unk_298.y + globalCtx->view.lookAt.y) - globalCtx->view.eye.y; - tmpf3 = (this->unk_298.z + globalCtx->view.lookAt.z) - globalCtx->view.eye.z; + tmpf1 = (this->unk_298.x + play->view.lookAt.x) - play->view.eye.x; + tmpf2 = (this->unk_298.y + play->view.lookAt.y) - play->view.eye.y; + tmpf3 = (this->unk_298.z + play->view.lookAt.z) - play->view.eye.z; - sp34.x = globalCtx->view.lookAt.x + tmpf1; - sp34.y = globalCtx->view.lookAt.y + tmpf2; - sp34.z = globalCtx->view.lookAt.z + tmpf3; + sp34.x = play->view.lookAt.x + tmpf1; + sp34.y = play->view.lookAt.y + tmpf2; + sp34.z = play->view.lookAt.z + tmpf3; this->unk_2D4 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp34); this->unk_2D0 = Math_Vec3f_Pitch(&this->actor.world.pos, &sp34) * -1.0f; @@ -204,7 +204,7 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_2DC, 5000.0f, 1.0f, 100.0f); Actor_SetFocus(&this->actor, this->unk_2E4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp4E, &sp4C); + Actor_GetScreenPos(play, &this->actor, &sp4E, &sp4C); if (this->actor.bgCheckFlags & 8) { this->unk_2D4 = this->actor.yawTowardsPlayer; @@ -237,12 +237,12 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { this->unk_254 = 10; this->unk_264 = -10000.0f; this->unk_288 = -3000.0f; - func_809B5268(this, globalCtx, 2); + func_809B5268(this, play, 2); } } -void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx) { - if (!func_809B55EC(this, globalCtx)) { +void func_809B59B0(EnAttackNiw* this, PlayState* play) { + if (!func_809B55EC(this, play)) { Actor_Kill(&this->actor); return; } @@ -276,31 +276,31 @@ void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx) { this->unk_2D0 = this->actor.world.rot.x - 5000.0f; this->actionFunc = func_809B5C18; } else if (this->actor.bgCheckFlags & 1) { - func_809B5268(this, globalCtx, 5); + func_809B5268(this, play, 5); } else { - func_809B5268(this, globalCtx, 2); + func_809B5268(this, play, 2); } } -void func_809B5C18(EnAttackNiw* this, GlobalContext* globalCtx) { - if (!func_809B55EC(this, globalCtx)) { +void func_809B5C18(EnAttackNiw* this, PlayState* play) { + if (!func_809B55EC(this, play)) { Actor_Kill(&this->actor); return; } Math_SmoothStepToS(&this->actor.world.rot.x, this->unk_2D0, 5, this->unk_2DC, 0); Math_ApproachF(&this->unk_2DC, 5000.0f, 1.0f, 100.0f); Math_ApproachF(&this->actor.velocity.y, 5.0f, 0.3f, 1.0f); - func_809B5268(this, globalCtx, 2); + func_809B5268(this, play, 2); } -void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Update(Actor* thisx, PlayState* play) { f32 tmpf1; EnAttackNiw* this = (EnAttackNiw*)thisx; EnNiw* cucco; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp30; - GlobalContext* globalCtx2 = globalCtx; + PlayState* play2 = play; this->unk_28C++; if (this->unk_254 != 0) { @@ -327,8 +327,8 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; this->actor.shape.shadowScale = 15.0f; - this->actionFunc(this, globalCtx2); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + this->actionFunc(this, play2); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); if (this->actionFunc == func_809B5670) { func_8002D97C(&this->actor); @@ -344,7 +344,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 0x20) && (this->actionFunc != func_809B5C18)) { Math_Vec3f_Copy(&sp30, &this->actor.world.pos); sp30.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &sp30, 0, 0, 0, 0x190); + EffectSsGSplash_Spawn(play, &sp30, 0, 0, 0, 0x190); this->unk_2DC = 0.0f; this->actor.gravity = 0.0f; this->unk_2E0 = 0.0f; @@ -358,7 +358,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { cucco = (EnNiw*)this->actor.parent; if ((this->actor.parent->update != NULL) && (this->actor.parent != NULL) && (cucco != NULL) && (cucco->timer9 == 0) && (player->invincibilityTimer == 0)) { - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); cucco->timer9 = 0x46; } } @@ -372,7 +372,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_809B5F98(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_809B5F98(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAttackNiw* this = (EnAttackNiw*)thisx; Vec3f sp0 = { 0.0f, 0.0f, 0.0f }; @@ -395,10 +395,10 @@ s32 func_809B5F98(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void EnAttackNiw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Draw(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_809B5F98, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h b/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h index 746ecb23c..381b6a2aa 100644 --- a/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h +++ b/soh/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h @@ -6,7 +6,7 @@ struct EnAttackNiw; -typedef void (*EnAttackNiwActionFunc)(struct EnAttackNiw*, GlobalContext*); +typedef void (*EnAttackNiwActionFunc)(struct EnAttackNiw*, PlayState*); typedef struct EnAttackNiw { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 19749933e..449b4a4c5 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnBa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBa_Init(Actor* thisx, PlayState* play); +void EnBa_Destroy(Actor* thisx, PlayState* play); +void EnBa_Update(Actor* thisx, PlayState* play); +void EnBa_Draw(Actor* thisx, PlayState* play); void EnBa_SetupIdle(EnBa* this); void EnBa_SetupFallAsBlob(EnBa* this); -void EnBa_Idle(EnBa* this, GlobalContext* globalCtx); -void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx); -void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx); -void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx); -void EnBa_Die(EnBa* this, GlobalContext* globalCtx); +void EnBa_Idle(EnBa* this, PlayState* play); +void EnBa_FallAsBlob(EnBa* this, PlayState* play); +void EnBa_SwingAtPlayer(EnBa* this, PlayState* play); +void EnBa_RecoilFromDamage(EnBa* this, PlayState* play); +void EnBa_Die(EnBa* this, PlayState* play); void EnBa_SetupSwingAtPlayer(EnBa* this); const ActorInit En_Ba_InitVars = { @@ -90,7 +90,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Init(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; Vec3f sp38 = D_809B80E4; s32 pad; @@ -111,7 +111,7 @@ void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { this->epoch++; if (this->actor.params < EN_BA_DEAD_BLOB) { - if (Flags_GetSwitch(globalCtx, this->upperParams)) { + if (Flags_GetSwitch(play, this->upperParams)) { Actor_Kill(&this->actor); return; } @@ -120,17 +120,17 @@ void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { EnBa_SetupIdle(this); this->actor.colChkInfo.health = 4; this->actor.colChkInfo.mass = MASS_HEAVY; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); } else { Actor_SetScale(&this->actor, 0.021f); EnBa_SetupFallAsBlob(this); } } -void EnBa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Destroy(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnBa_SetupIdle(EnBa* this) { @@ -140,8 +140,8 @@ void EnBa_SetupIdle(EnBa* this) { EnBa_SetupAction(this, EnBa_Idle); } -void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBa_Idle(EnBa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s32 pad; Vec3s sp5C; @@ -153,7 +153,7 @@ void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 100.0f, 1.0f, 10.0f, 0.0f); } this->unk_2FC = this->actor.world.pos; - if (globalCtx->gameplayFrames % 16 == 0) { + if (play->gameplayFrames % 16 == 0) { this->unk_308.z += Rand_CenteredFloat(180.0f); this->unk_314 += Rand_CenteredFloat(180.0f); this->unk_308.x = Math_SinF(this->unk_308.z) * 80.0f; @@ -205,7 +205,7 @@ void EnBa_SetupFallAsBlob(EnBa* this) { /** * Action function of the pink fleshy blobs that spawn and fall to the floor when a tentacle dies */ -void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) { +void EnBa_FallAsBlob(EnBa* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { this->actor.scale.y -= 0.001f; this->actor.scale.x += 0.0005f; @@ -216,7 +216,7 @@ void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) { } } else { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 28.0f, 80.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 28.0f, 80.0f, 5); } } @@ -230,8 +230,8 @@ void EnBa_SetupSwingAtPlayer(EnBa* this) { EnBa_SetupAction(this, EnBa_SwingAtPlayer); } -void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp; s16 i; Vec3s sp58; @@ -306,10 +306,10 @@ void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { if (this->collider.base.atFlags & 2) { this->collider.base.atFlags &= ~2; if (this->collider.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); return; } if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & 0x4000000)) { @@ -332,13 +332,13 @@ void func_809B7174(EnBa* this) { EnBa_SetupAction(this, EnBa_RecoilFromDamage); } -void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) { +void EnBa_RecoilFromDamage(EnBa* this, PlayState* play) { s32 i; Vec3s sp6C; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 330.0f, 1.0f, 30.0f, 0.0f); this->unk_2FC = this->actor.world.pos; - if (globalCtx->gameplayFrames % 16 == 0) { + if (play->gameplayFrames % 16 == 0) { this->unk_308.z += Rand_CenteredFloat(180.0f); this->unk_314 += Rand_CenteredFloat(180.0f); this->unk_308.x = Math_SinF(this->unk_308.z) * 80.0f; @@ -378,18 +378,18 @@ void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) { } } -void func_809B75A0(EnBa* this, GlobalContext* globalCtx2) { +void func_809B75A0(EnBa* this, PlayState* play2) { s16 unk_temp; s32 i; Vec3f sp74 = { 0.0f, 0.0f, 0.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; this->unk_31C = 2500; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BALINADE_HAND_DEAD, 1, 1, 40); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_BALINADE_HAND_DEAD, 1, 1, 40); this->unk_14C = 0; for (i = 7; i < 14; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BA, this->unk_158[i].x, this->unk_158[i].y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BA, this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, 0, 0, 0, EN_BA_DEAD_BLOB); } unk_temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_158[0]) + 0x8000; @@ -410,7 +410,7 @@ void func_809B75A0(EnBa* this, GlobalContext* globalCtx2) { EnBa_SetupAction(this, EnBa_Die); } -void EnBa_Die(EnBa* this, GlobalContext* globalCtx) { +void EnBa_Die(EnBa* this, PlayState* play) { Vec3f sp6C = { 0.0f, 0.0f, 0.0f }; s16 temp; s32 i; @@ -442,29 +442,29 @@ void EnBa_Die(EnBa* this, GlobalContext* globalCtx) { } this->unk_31A--; } else { - Flags_SetSwitch(globalCtx, this->upperParams); + Flags_SetSwitch(play, this->upperParams); Actor_Kill(&this->actor); } } -void EnBa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Update(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; if ((this->actor.params < EN_BA_DEAD_BLOB) && (this->collider.base.acFlags & 2)) { this->collider.base.acFlags &= ~2; this->actor.colChkInfo.health--; if (this->actor.colChkInfo.health == 0) { - func_809B75A0(this, globalCtx); + func_809B75A0(this, play); } else { func_809B7174(this); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params < EN_BA_DEAD_BLOB) { this->actor.focus.pos = this->unk_158[6]; } if (this->unk_14C >= 2) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -474,22 +474,22 @@ static void* D_809B8118[] = { object_bxa_Tex_0029F0, }; -void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Draw(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; s32 pad; s16 i; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 14); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 14); Vec3f unused = { 0.0f, 0.0f, 448.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actor.params < EN_BA_DEAD_BLOB) { Matrix_Push(); gSPSegment(POLY_OPA_DISP++, 0x0C, mtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809B8118[this->actor.params])); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, - (globalCtx->gameplayFrames * -10) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, + (play->gameplayFrames * -10) % 128, 32, 32)); for (i = 0; i < 14; i++, mtx++) { FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); @@ -512,19 +512,19 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); - 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_bxa_DL_000890); } else { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->gameplayFrames * 2) % 128, - (globalCtx->gameplayFrames * 2) % 128, 32, 32, 1, - (globalCtx->gameplayFrames * -5) % 128, (globalCtx->gameplayFrames * -5) % 128, 32, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->gameplayFrames * 2) % 128, + (play->gameplayFrames * 2) % 128, 32, 32, 1, + (play->gameplayFrames * -5) % 128, (play->gameplayFrames * -5) % 128, 32, 32)); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 125, 100, 255); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_bxa_DL_001D80); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h index 1506fa253..6d5acc902 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h @@ -6,7 +6,7 @@ struct EnBa; -typedef void (*EnBaActionFunc)(struct EnBa*, GlobalContext*); +typedef void (*EnBaActionFunc)(struct EnBa*, PlayState*); typedef enum { /* 0x00 */ EN_BA_TENTACLE_RED, diff --git a/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 4840fa29a..16aebb71c 100644 --- a/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -53,42 +53,42 @@ typedef enum { // Main functions -void EnBb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBb_Update(Actor* this, GlobalContext* globalCtx); -void EnBb_Draw(Actor* this, GlobalContext* globalCtx); +void EnBb_Init(Actor* thisx, PlayState* play); +void EnBb_Destroy(Actor* thisx, PlayState* play); +void EnBb_Update(Actor* this, PlayState* play); +void EnBb_Draw(Actor* this, PlayState* play); // Helper functions void EnBb_FaceWaypoint(EnBb* this); -void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetWaypoint(EnBb* this, PlayState* play); // Action functions void EnBb_SetupFlameTrail(EnBb* this); -void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx); +void EnBb_FlameTrail(EnBb* this, PlayState* play); -void EnBb_SetupDeath(EnBb* this, GlobalContext* globalCtx); -void EnBb_Death(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetupDeath(EnBb* this, PlayState* play); +void EnBb_Death(EnBb* this, PlayState* play); -void EnBb_Damage(EnBb* this, GlobalContext* globalCtx); +void EnBb_Damage(EnBb* this, PlayState* play); void EnBb_SetupBlue(EnBb* this); -void EnBb_Blue(EnBb* this, GlobalContext* globalCtx); +void EnBb_Blue(EnBb* this, PlayState* play); void EnBb_SetupDown(EnBb* this); -void EnBb_Down(EnBb* this, GlobalContext* globalCtx); +void EnBb_Down(EnBb* this, PlayState* play); -void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this); -void EnBb_Red(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetupRed(PlayState* play, EnBb* this); +void EnBb_Red(EnBb* this, PlayState* play); -void EnBb_SetupWhite(GlobalContext* globalCtx, EnBb* this); -void EnBb_White(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetupWhite(PlayState* play, EnBb* this); +void EnBb_White(EnBb* this, PlayState* play); -void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx); -void EnBb_Green(EnBb* this, GlobalContext* globalCtx); +void EnBb_InitGreen(EnBb* this, PlayState* play); +void EnBb_Green(EnBb* this, PlayState* play); -void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx); +void EnBb_Stunned(EnBb* this, PlayState* play); static DamageTable sDamageTableBlueGreen = { /* Deku nut */ DMG_ENTRY(0, 0xF), @@ -243,8 +243,8 @@ void EnBb_SetupAction(EnBb* this, EnBbActionFunc actionFunc) { this->actionFunc = actionFunc; } -Actor* EnBb_FindExplosive(GlobalContext* globalCtx, EnBb* this, f32 range) { - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +Actor* EnBb_FindExplosive(PlayState* play, EnBb* this, f32 range) { + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; f32 dist; while (explosive != NULL) { @@ -261,13 +261,13 @@ Actor* EnBb_FindExplosive(GlobalContext* globalCtx, EnBb* this, f32 range) { return NULL; } -void EnBb_SpawnFlameTrail(GlobalContext* globalCtx, EnBb* this, s16 startAtZero) { +void EnBb_SpawnFlameTrail(PlayState* play, EnBb* this, s16 startAtZero) { EnBb* now = this; EnBb* next; s32 i; for (i = 0; i < 5; i++) { - next = (EnBb*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BB, this->actor.world.pos.x, + next = (EnBb*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BB, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (next != NULL) { now->actor.child = &next->actor; @@ -306,18 +306,18 @@ void EnBb_KillFlameTrail(EnBb* this) { this->actor.child = NULL; } -void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Init(Actor* thisx, PlayState* play) { EffectBlureInit1 blureInit; s32 pad; EnBb* this = (EnBb*)thisx; Actor_ProcessInitChain(thisx, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_Bb_Skel_001A30, &object_Bb_Anim_000444, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_Bb_Skel_001A30, &object_Bb_Anim_000444, this->jointTable, this->morphTable, 16); this->unk_254 = 0; thisx->colChkInfo.health = 4; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->elements); this->actionState = thisx->params >> 8; @@ -352,7 +352,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->colChkInfo.damageTable = &sDamageTableRed; this->flameEnvColor.r = 255; this->collider.elements[0].info.toucher.effect = 1; - EnBb_SetupRed(globalCtx, this); + EnBb_SetupRed(play, this); break; case ENBB_WHITE: thisx->naviEnemyId = 0x1D; @@ -370,9 +370,9 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); - EnBb_SetupWhite(globalCtx, this); - EnBb_SetWaypoint(this, globalCtx); + Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + EnBb_SetupWhite(play, this); + EnBb_SetWaypoint(this, play); EnBb_FaceWaypoint(this); thisx->flags |= ACTOR_FLAG_14; break; @@ -387,7 +387,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { this->flameEnvColor.g = 255; thisx->colChkInfo.health = 1; - EnBb_InitGreen(this, globalCtx); + EnBb_InitGreen(this, play); break; } thisx->focus.pos = thisx->world.pos; @@ -398,11 +398,11 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.elements[0].dim.modelSphere.radius * this->collider.elements[0].dim.scale; } -void EnBb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnBb* this = (EnBb*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnBb_SetupFlameTrail(EnBb* this) { @@ -415,10 +415,10 @@ void EnBb_SetupFlameTrail(EnBb* this) { EnBb_SetupAction(this, EnBb_FlameTrail); } -void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx) { +void EnBb_FlameTrail(EnBb* this, PlayState* play) { if (this->actor.params == ENBB_KILL_TRAIL) { if (this->actor.parent == NULL) { - EnBb_SetupDeath(this, globalCtx); + EnBb_SetupDeath(this, play); } } else { if (this->timer == 0) { @@ -452,19 +452,19 @@ void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_SetupDeath(EnBb* this, GlobalContext* globalCtx) { +void EnBb_SetupDeath(EnBb* this, PlayState* play) { if (this->actor.params <= ENBB_BLUE) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speedXZ = -7.0f; this->timer = 5; this->actor.shape.rot.x += 0x4E20; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BUBLE_DEAD, 1, 1, 0x28); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_BUBLE_DEAD, 1, 1, 0x28); } this->action = BB_KILL; EnBb_SetupAction(this, EnBb_Death); } -void EnBb_Death(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Death(EnBb* this, PlayState* play) { s16 enpartType = 3; Vec3f sp40 = { 0.0f, 0.5f, 0.0f }; Vec3f sp34 = { 0.0f, 0.0f, 0.0f }; @@ -479,17 +479,17 @@ void EnBb_Death(EnBb* this, GlobalContext* globalCtx) { } if (this->bodyBreak.val == BODYBREAK_STATUS_FINISHED) { - BodyBreak_Alloc(&this->bodyBreak, 12, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 12, play); } if ((this->dmgEffect == 7) || (this->dmgEffect == 5)) { enpartType = 11; } - if (!BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, enpartType)) { + if (!BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, enpartType)) { return; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); } else { if (this->flamePrimAlpha) { if (this->flamePrimAlpha <= 20) { @@ -521,7 +521,7 @@ void EnBb_SetupDamage(EnBb* this) { EnBb_SetupAction(this, EnBb_Damage); } -void EnBb_Damage(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Damage(EnBb* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (this->actor.speedXZ == 0.0f) { this->actor.shape.yOffset = 200.0f; @@ -539,7 +539,7 @@ void EnBb_SetupBlue(EnBb* this) { EnBb_SetupAction(this, EnBb_Blue); } -void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Blue(EnBb* this, PlayState* play) { Actor* explosive; s16 moveYawToWall; s16 thisYawToWall; @@ -600,7 +600,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) { this->vMoveAngleY = this->actor.yawTowardsPlayer; } if (this->targetActor == NULL) { - explosive = EnBb_FindExplosive(globalCtx, this, 300.0f); + explosive = EnBb_FindExplosive(play, this, 300.0f); } else if (this->targetActor->params == 0) { explosive = this->targetActor; } else { @@ -641,7 +641,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) { } else { afterHitAngle = 0x4000; Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_BITE); - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { afterHitAngle = -0x4000; } } @@ -681,7 +681,7 @@ void EnBb_SetupDown(EnBb* this) { EnBb_SetupAction(this, EnBb_Down); } -void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Down(EnBb* this, PlayState* play) { s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw; SkelAnime_Update(&this->skelAnime); @@ -693,7 +693,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & 3) { if (this->actor.params == ENBB_RED) { - s32 floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + s32 floorType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { this->moveMode = BBMOVE_HIDDEN; @@ -712,7 +712,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { this->actor.velocity.y = 10.0f; } this->actor.bgCheckFlags &= ~1; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); Math_SmoothStepToS(&this->actor.world.rot.y, -this->actor.yawTowardsPlayer, 1, 0xBB8, 0); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -729,14 +729,14 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { break; case ENBB_RED: if (this->actor.velocity.y == 10.0f) { - EnBb_SetupRed(globalCtx, this); - EnBb_SpawnFlameTrail(globalCtx, this, true); + EnBb_SetupRed(play, this); + EnBb_SpawnFlameTrail(play, this, true); } break; case ENBB_WHITE: this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; - EnBb_SetupWhite(globalCtx, this); + EnBb_SetupWhite(play, this); this->actor.world.pos.y -= 60.0f; break; } @@ -745,7 +745,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) { +void EnBb_SetupRed(PlayState* play, EnBb* this) { Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000184); if (this->action == BB_DOWN) { this->actor.speedXZ = 5.0f; @@ -770,8 +770,8 @@ void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) { EnBb_SetupAction(this, EnBb_Red); } -void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBb_Red(EnBb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 floorType; s16 yawDiff; @@ -792,7 +792,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->timer = 7; this->actor.bgCheckFlags &= ~1; this->actionState++; - EnBb_SpawnFlameTrail(globalCtx, this, false); + EnBb_SpawnFlameTrail(play, this, false); } break; case BBRED_ATTACK: @@ -812,7 +812,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~8; } if (this->actor.bgCheckFlags & 1) { - floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + floorType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { this->moveMode = BBMOVE_HIDDEN; this->timer = 10; @@ -828,7 +828,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~1; } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) != NULL) { + if (Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) { EnBb_SetupDown(this); } break; @@ -857,8 +857,8 @@ void EnBb_FaceWaypoint(EnBb* this) { this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->waypointPos); } -void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->path]; +void EnBb_SetWaypoint(EnBb* this, PlayState* play) { + Path* path = &play->setupPathList[this->path]; Vec3s* point; if (this->waypoint == (s16)(path->count - 1)) { @@ -872,7 +872,7 @@ void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx) { this->waypointPos.z = point->z; } -void EnBb_SetupWhite(GlobalContext* globalCtx, EnBb* this) { +void EnBb_SetupWhite(PlayState* play, EnBb* this) { Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000444); this->actor.speedXZ = 0.0f; this->actor.world.pos.y += 60.0f; @@ -884,7 +884,7 @@ void EnBb_SetupWhite(GlobalContext* globalCtx, EnBb* this) { EnBb_SetupAction(this, EnBb_White); } -void EnBb_White(EnBb* this, GlobalContext* globalCtx) { +void EnBb_White(EnBb* this, PlayState* play) { if (this->actor.speedXZ == 0.0f) { f32 distL1; f32 vx; @@ -902,7 +902,7 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) { if (distL1 == 0.0f) { this->timer--; if (this->timer == 0) { - EnBb_SetWaypoint(this, globalCtx); + EnBb_SetWaypoint(this, play); EnBb_FaceWaypoint(this); Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000184); this->timer = Rand_ZeroOne() * 30.0f + 40.0f; @@ -938,7 +938,7 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx) { +void EnBb_InitGreen(EnBb* this, PlayState* play) { Vec3f bobOffset = { 0.0f, 0.0f, 0.0f }; Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000444); @@ -948,7 +948,7 @@ void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx) { this->actor.shape.rot.x = this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; if (this->actor.params == ENBB_GREEN_BIG) { - EnBb_SetWaypoint(this, globalCtx); + EnBb_SetWaypoint(this, play); EnBb_FaceWaypoint(this); } Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); @@ -976,8 +976,8 @@ void EnBb_SetupGreen(EnBb* this) { EnBb_SetupAction(this, EnBb_Green); } -void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBb_Green(EnBb* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f bobOffset = { 0.0f, 0.0f, 0.0f }; Vec3f nextPos = player->actor.world.pos; @@ -1000,7 +1000,7 @@ void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { vz += Math_SmoothStepToF(&this->actor.home.pos.z, this->waypointPos.z, 1.0f, ABS(distL1), 0.0f); this->bobPhase += (0.05f + (Rand_ZeroOne() * 0.01f)); if (vz == 0.0f) { - EnBb_SetWaypoint(this, globalCtx); + EnBb_SetWaypoint(this, play); } this->moveMode = BBMOVE_NOCLIP; this->maxSpeed = 10.0f; @@ -1037,7 +1037,7 @@ void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.y, nextPos.y, 1.0f, this->bobPhase * 0.75f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.z, nextPos.z, 1.0f, this->bobPhase * 0.75f, 0.0f); this->bobPhase += 0.1f + this->bobSpeedMod; - if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) || (--this->vFlameTimer == 0)) { + if (Actor_GetCollidedExplosive(play, &this->collider.base) || (--this->vFlameTimer == 0)) { this->actionState++; this->timer = (Rand_ZeroOne() * 30.0f) + 60.0f; if (this->vFlameTimer != 0) { @@ -1096,7 +1096,7 @@ void EnBb_SetupStunned(EnBb* this) { EnBb_SetupAction(this, EnBb_Stunned); } -void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Stunned(EnBb* this, PlayState* play) { s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw; if (this->actor.bgCheckFlags & 8) { @@ -1112,7 +1112,7 @@ void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { } else { this->actor.velocity.y = 0.0f; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); } if (this->actor.colorFilterTimer == 0) { this->actor.shape.yOffset = 200.0f; @@ -1127,12 +1127,12 @@ void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { } } else { this->actor.flags &= ~ACTOR_FLAG_0; - EnBb_SetupDeath(this, globalCtx); + EnBb_SetupDeath(this, play); } } } -void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) { +void EnBb_CollisionCheck(EnBb* this, PlayState* play) { if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; if (this->action != BB_DOWN) { @@ -1195,7 +1195,7 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) { if (this->actor.params == ENBB_RED) { EnBb_KillFlameTrail(this); } - EnBb_SetupDeath(this, globalCtx); + EnBb_SetupDeath(this, play); //! @bug //! Because Din's Fire kills the bubble in a single hit, Actor_SetColorFilter is never called and //! colorFilterParams is never set. And because Din's Fire halts updating during its cutscene, @@ -1218,8 +1218,8 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBb_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBb* this = (EnBb*)thisx; Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; Vec3f sp40 = { 0.0f, -0.6f, 0.0f }; @@ -1228,10 +1228,10 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { f32 sp34 = -15.0f; if (this->actor.params <= ENBB_BLUE) { - EnBb_CollisionCheck(this, globalCtx); + EnBb_CollisionCheck(this, play); } if (this->actor.colChkInfo.damageEffect != 0xD) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actor.params <= ENBB_BLUE) && (this->actor.speedXZ >= -6.0f) && ((this->actor.flags & ACTOR_FLAG_15) == 0)) { Actor_MoveForward(&this->actor); @@ -1240,7 +1240,7 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->actor.world.pos.y - 20.0f) <= this->actor.floorHeight) { sp34 = 20.0f; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, sp34, 25.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, sp34, 25.0f, 20.0f, 5); } this->actor.focus.pos = this->actor.world.pos; this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; @@ -1249,18 +1249,18 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; if ((this->action > BB_KILL) && ((this->actor.speedXZ != 0.0f) || (this->action == BB_GREEN))) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->action > BB_FLAME_TRAIL) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) && (this->moveMode != BBMOVE_HIDDEN)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -void EnBb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnBb* this = (EnBb*)thisx; BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_DEFAULT); @@ -1272,7 +1272,7 @@ static Vec3f sFireIceOffsets[] = { { 5.0f, 0.0f, -5.0f }, { 0.0f, 10.0f, 13.0f }, { -5.0f, 0.0f, 5.0f }, { -5.0f, 0.0f, -5.0f }, }; -void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBb* this = (EnBb*)thisx; Vec3f blureBase1 = { 0.0f, 5000.0f, 0.0f }; @@ -1280,14 +1280,14 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f blureVtx1; Vec3f blureVtx2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); blureBase1.z = this->maxSpeed * 80.0f; blureBase2.z = this->maxSpeed * 80.0f; if (this->moveMode != BBMOVE_HIDDEN) { if (this->actor.params <= ENBB_BLUE) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBb_PostLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBb_PostLimbDraw, this); if (this->fireIceTimer != 0) { @@ -1307,11 +1307,11 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { sp70.z = this->actor.world.pos.z + sFireIceOffsets[index].z; if ((this->dmgEffect != 7) && (this->dmgEffect != 5)) { - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &sp70, 0x96, 0x96, 0x96, 0xFA, 0xEB, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp70, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, 0xFF, 0.8f); } else { sp70.y -= 17.0f; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &sp70, 0x28, 1, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &sp70, 0x28, 1, 0, -1); } } } @@ -1320,26 +1320,26 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, -40.0f, 0.0f, MTXMODE_APPLY); } if (this->actor.params != ENBB_WHITE) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - ((globalCtx->gameplayFrames + (this->flameScrollMod * 10)) * + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + ((play->gameplayFrames + (this->flameScrollMod * 10)) * (-20 - (this->flameScrollMod * -2))) % 0x200, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, this->flamePrimBlue, this->flamePrimAlpha); gDPSetEnvColor(POLY_XLU_DISP++, this->flameEnvColor.r, this->flameEnvColor.g, this->flameEnvColor.b, 0); - Matrix_RotateY(((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000)) * + Matrix_RotateY(((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000)) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(this->flameScaleX * 0.01f, this->flameScaleY * 0.01f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } else { Matrix_MultVec3f(&blureBase1, &blureVtx1); Matrix_MultVec3f(&blureBase2, &blureVtx2); - if ((this->maxSpeed != 0.0f) && (this->action == BB_WHITE) && !(globalCtx->gameplayFrames & 1) && + if ((this->maxSpeed != 0.0f) && (this->action == BB_WHITE) && !(play->gameplayFrames & 1) && (this->actor.colChkInfo.health != 0)) { EffectBlure_AddVertex(Effect_GetByIndex(this->blureIdx), &blureVtx1, &blureVtx2); } else if (this->action != BB_WHITE) { @@ -1347,5 +1347,5 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.h b/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.h index e12306fd2..693ff8284 100644 --- a/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.h +++ b/soh/src/overlays/actors/ovl_En_Bb/z_en_bb.h @@ -6,7 +6,7 @@ struct EnBb; -typedef void (*EnBbActionFunc)(struct EnBb*, GlobalContext*); +typedef void (*EnBbActionFunc)(struct EnBb*, PlayState*); typedef struct EnBb { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index 3a1c7f0be..d902e4fed 100644 --- a/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBdfire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBdfire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBdfire_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBdfire_Init(Actor* thisx, PlayState* play); +void EnBdfire_Destroy(Actor* thisx, PlayState* play); +void EnBdfire_Update(Actor* thisx, PlayState* play); +void EnBdfire_Draw(Actor* thisx, PlayState* play); -void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx); -void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx); -void func_809BC598(EnBdfire* this, GlobalContext* globalCtx); +void EnBdfire_DrawFire(EnBdfire* this, PlayState* play); +void func_809BC2A4(EnBdfire* this, PlayState* play); +void func_809BC598(EnBdfire* this, PlayState* play); const ActorInit En_Bdfire_InitVars = { 0, @@ -39,7 +39,7 @@ void EnbdFire_SetupDraw(EnBdfire* this, EnBdfireDrawFunc drawFunc) { this->drawFunc = drawFunc; } -void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Init(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; s32 pad; @@ -51,7 +51,7 @@ void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_154 = 90; Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 300); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfoNoGlow); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfoNoGlow); } else { EnBdfire_SetupAction(this, func_809BC598); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); @@ -73,15 +73,15 @@ void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBdfire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Destroy(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; if (this->actor.params < 0) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } } -void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx) { +void func_809BC2A4(EnBdfire* this, PlayState* play) { BossDodongo* kingDodongo; s32 temp; @@ -119,9 +119,9 @@ void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx) { } } -void func_809BC598(EnBdfire* this, GlobalContext* globalCtx) { +void func_809BC598(EnBdfire* this, PlayState* play) { s16 phi_v1_2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distToBurn; BossDodongo* bossDodongo; s16 i; @@ -181,21 +181,21 @@ void func_809BC598(EnBdfire* this, GlobalContext* globalCtx) { player->flameTimers[i] = Rand_S16Offset(0, 200); } player->isBurning = true; - func_8002F6D4(globalCtx, &this->actor, 20.0f, this->actor.world.rot.y, 0.0f, 8); + func_8002F6D4(play, &this->actor, 20.0f, this->actor.world.rot.y, 0.0f, 8); osSyncPrintf("POWER\n"); } } } -void EnBdfire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Update(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; this->unk_156++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); } -void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) { +void EnBdfire_DrawFire(EnBdfire* this, PlayState* play) { static void* D_809BCB10[] = { object_kingdodongo_Tex_0264E0, object_kingdodongo_Tex_0274E0, object_kingdodongo_Tex_0284E0, object_kingdodongo_Tex_0294E0, object_kingdodongo_Tex_02A4E0, object_kingdodongo_Tex_02B4E0, @@ -204,10 +204,10 @@ void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) { s16 temp; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); temp = this->unk_156 & 7; - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - func_80094BC4(globalCtx->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + func_80094BC4(play->state.gfxCtx); POLY_XLU_DISP = func_80094968(POLY_XLU_DISP); gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, @@ -217,14 +217,14 @@ void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_809BCB10[temp])); Matrix_Translate(0.0f, 11.0f, 0.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++, object_kingdodongo_DL_01D950); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBdfire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Draw(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; - this->drawFunc(this, globalCtx); + this->drawFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h b/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h index 190de9b49..93b37e3b1 100644 --- a/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h +++ b/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h @@ -7,8 +7,8 @@ struct EnBdfire; -typedef void (*EnBdfireActionFunc)(struct EnBdfire*, GlobalContext*); -typedef void (*EnBdfireDrawFunc)(struct EnBdfire*, GlobalContext*); +typedef void (*EnBdfireActionFunc)(struct EnBdfire*, PlayState*); +typedef void (*EnBdfireDrawFunc)(struct EnBdfire*, PlayState*); typedef struct EnBdfire { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 73d33ad28..d5de281a6 100644 --- a/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -3,28 +3,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBigokuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBigokuta_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBigokuta_Init(Actor* thisx, PlayState* play); +void EnBigokuta_Destroy(Actor* thisx, PlayState* play); +void EnBigokuta_Update(Actor* thisx, PlayState* play); +void EnBigokuta_Draw(Actor* thisx, PlayState* play); void func_809BD318(EnBigokuta* this); void func_809BD3E0(EnBigokuta* this); -void func_809BDF34(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BD84C(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDB90(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE3E4(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE4A4(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE518(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BCF68(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDFC8(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE26C(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE180(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE058(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BD1C8(EnBigokuta* this, GlobalContext* globalCtx); +void func_809BDF34(EnBigokuta* this, PlayState* play); +void func_809BD84C(EnBigokuta* this, PlayState* play); +void func_809BD8DC(EnBigokuta* this, PlayState* play); +void func_809BDAE8(EnBigokuta* this, PlayState* play); +void func_809BDB90(EnBigokuta* this, PlayState* play); +void func_809BDC08(EnBigokuta* this, PlayState* play); +void func_809BE3E4(EnBigokuta* this, PlayState* play); +void func_809BE4A4(EnBigokuta* this, PlayState* play); +void func_809BE518(EnBigokuta* this, PlayState* play); +void func_809BCF68(EnBigokuta* this, PlayState* play); +void func_809BDFC8(EnBigokuta* this, PlayState* play); +void func_809BE26C(EnBigokuta* this, PlayState* play); +void func_809BE180(EnBigokuta* this, PlayState* play); +void func_809BE058(EnBigokuta* this, PlayState* play); +void func_809BD1C8(EnBigokuta* this, PlayState* play); static Color_RGBA8 sEffectPrimColor = { 255, 255, 255, 255 }; static Color_RGBA8 sEffectEnvColor = { 100, 255, 255, 255 }; @@ -155,22 +155,22 @@ static InitChainEntry sInitChain[] = { // possibly color data static s32 sUnused[] = { 0xFFFFFFFF, 0x969696FF }; -void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Init(Actor* thisx, PlayState* play) { EnBigokuta* this = (EnBigokuta*)thisx; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bigokuta_Skel_006BC0, &object_bigokuta_Anim_0014B8, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bigokuta_Skel_006BC0, &object_bigokuta_Anim_0014B8, this->jointTable, this->morphTable, 20); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->element); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->element); this->collider.elements->dim.worldSphere.radius = this->collider.elements->dim.modelSphere.radius; for (i = 0; i < ARRAY_COUNT(sCylinderInit); i++) { - Collider_InitCylinder(globalCtx, &this->cylinder[i]); - Collider_SetCylinder(globalCtx, &this->cylinder[i], &this->actor, &sCylinderInit[i]); + Collider_InitCylinder(play, &this->cylinder[i]); + Collider_SetCylinder(play, &this->cylinder[i], &this->actor, &sCylinderInit[i]); } CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, sColChkInfoInit); @@ -178,7 +178,7 @@ void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_194 = 1; if (this->actor.params == 0) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); func_809BD318(this); } else { func_809BD3E0(this); @@ -188,13 +188,13 @@ void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBigokuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { EnBigokuta* this = (EnBigokuta*)thisx; s32 i; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - Collider_DestroyCylinder(globalCtx, &this->cylinder[i]); + Collider_DestroyCylinder(play, &this->cylinder[i]); } } @@ -204,7 +204,7 @@ void func_809BCE3C(EnBigokuta* this) { this->actor.world.pos.z = Math_CosS(this->actor.world.rot.y) * 263.0f + this->actor.home.pos.z; } -void func_809BCEBC(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BCEBC(EnBigokuta* this, PlayState* play) { Vec3f pos; f32 yDistFromHome = this->actor.world.pos.y - this->actor.home.pos.y; @@ -212,26 +212,26 @@ void func_809BCEBC(EnBigokuta* this, GlobalContext* globalCtx) { pos.y = this->actor.home.pos.y + 3.0f; pos.z = this->actor.world.pos.z; - if (((globalCtx->gameplayFrames % 7) == 0) && (yDistFromHome <= 0.0f) && (yDistFromHome > -100.0f)) { - EffectSsGRipple_Spawn(globalCtx, &pos, 800, 1300, 0); + if (((play->gameplayFrames % 7) == 0) && (yDistFromHome <= 0.0f) && (yDistFromHome > -100.0f)) { + EffectSsGRipple_Spawn(play, &pos, 800, 1300, 0); } } -void func_809BCF68(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BCF68(EnBigokuta* this, PlayState* play) { Vec3f effectPos; s16 rot; - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { rot = Rand_S16Offset(0x1200, 0xC00) + this->actor.shape.rot.y - this->unk_194 * 0xA00; } else { rot = this->actor.shape.rot.y - this->unk_194 * 0xA00 - Rand_S16Offset(0x1200, 0xC00); } if (this->actionFunc != func_809BE4A4) { - if (this->actionFunc == func_809BE3E4 || (globalCtx->gameplayFrames & 2)) { + if (this->actionFunc == func_809BE3E4 || (play->gameplayFrames & 2)) { effectPos.x = this->actor.world.pos.x - Math_SinS(rot) * 80.0f; effectPos.z = this->actor.world.pos.z - Math_CosS(rot) * 80.0f; effectPos.y = this->actor.home.pos.y + 1.0f; - EffectSsGRipple_Spawn(globalCtx, &effectPos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &effectPos, 100, 500, 0); } else { effectPos.x = this->actor.world.pos.x - Math_SinS(rot) * 120.0f; effectPos.z = this->actor.world.pos.z - Math_CosS(rot) * 120.0f; @@ -241,15 +241,15 @@ void func_809BCF68(EnBigokuta* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x - Math_SinS(rot) * 50.0f; effectPos.z = this->actor.world.pos.z - Math_CosS(rot) * 50.0f; effectPos.y = this->actor.home.pos.y + 1.0f; - EffectSsGRipple_Spawn(globalCtx, &effectPos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &effectPos, 100, 500, 0); } - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 800); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 800); if (this->actionFunc != func_809BE4A4) { func_8002F974(&this->actor, NA_SE_EN_DAIOCTA_SPLASH - SFX_FLAG); } } -void func_809BD1C8(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BD1C8(EnBigokuta* this, PlayState* play) { s32 i; Vec3f effectPos; @@ -258,12 +258,12 @@ void func_809BD1C8(EnBigokuta* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { effectPos.x = ((i >= 2) ? 1 : -1) * 60.0f + this->actor.world.pos.x; effectPos.z = ((i & 1) ? 1 : -1) * 60.0f + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 2000); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 2000); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_LAND_WATER); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOLON_LAND_BIG); - func_80033E88(&this->actor, globalCtx, 0xA, 8); + func_80033E88(&this->actor, play, 0xA, 8); } void func_809BD2E4(EnBigokuta* this) { @@ -390,14 +390,14 @@ void func_809BD768(EnBigokuta* this) { this->actionFunc = func_809BE4A4; } -void func_809BD7F0(EnBigokuta* this, GlobalContext* globalCtx) { - this->actor.world.rot.y = Actor_WorldYawTowardPoint(&GET_PLAYER(globalCtx)->actor, &this->actor.home.pos); +void func_809BD7F0(EnBigokuta* this, PlayState* play) { + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&GET_PLAYER(play)->actor, &this->actor.home.pos); this->actor.shape.rot.y = this->actor.world.rot.y + (this->unk_194 * 0x4000); func_809BCE3C(this); this->actionFunc = func_809BE518; } -void func_809BD84C(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BD84C(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_196--; @@ -413,7 +413,7 @@ void func_809BD84C(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BD8DC(EnBigokuta* this, PlayState* play) { Vec3f effectPos; this->unk_196--; @@ -431,9 +431,9 @@ void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x + 40.0f; effectPos.y = this->actor.world.pos.y; effectPos.z = this->actor.world.pos.z - 70.0f; - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 2000); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 2000); effectPos.x = this->actor.world.pos.x - 40.0f; - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 2000); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 2000); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_LAND_WATER); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOLON_LAND_BIG); func_800AA000(0.0f, 0xFF, 0x14, 0x96); @@ -446,7 +446,7 @@ void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDAE8(EnBigokuta* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y + 0x4000, 0x400)) { if (this->unk_196 != 0) { this->unk_196--; @@ -454,7 +454,7 @@ void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx) { if (this->unk_196 == 0) { func_809BCE3C(this); this->actor.home.pos.y = this->actor.world.pos.y; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.params = 2; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_VOICE); func_809BD3E0(this); @@ -462,7 +462,7 @@ void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDB90(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDB90(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; @@ -475,8 +475,8 @@ void func_809BDB90(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809BDC08(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_v0; s16 pad; s16 phi_v1; @@ -494,14 +494,14 @@ void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { if (this->unk_196 == 0) { this->unk_196 = 350; } - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); return; } phi_v1 = (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) - 180.0f) * (8.0f / 15); func_8002DBD0(&this->actor, &sp28, &player->actor.world.pos); if (fabsf(sp28.x) > 263.0f || ((sp28.z > 0.0f) && !Actor_IsFacingPlayer(&this->actor, 0x1B00) && - !Player_IsFacingActor(&this->actor, 0x2000, globalCtx))) { + !Player_IsFacingActor(&this->actor, 0x2000, play))) { phi_v1 -= 0x80; if (this->unk_196 != 0) { this->unk_196--; @@ -525,7 +525,7 @@ void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += phi_v1 * this->unk_194; func_809BCE3C(this); - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); if (this->unk_198 == 0) { func_809BD768(this); } else if (this->unk_196 == 0) { @@ -545,19 +545,19 @@ void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDF34(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDF34(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; } this->actor.world.pos.y = (sinf(this->unk_196 * (M_PI / 16)) * 100.0f) + this->actor.home.pos.y; if (this->unk_196 == 0) { - func_809BD1C8(this, globalCtx); + func_809BD1C8(this, play); func_809BD3F8(this); } } -void func_809BDFC8(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDFC8(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; @@ -571,8 +571,8 @@ void func_809BDFC8(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BE058(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809BE058(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 speedXZ; if (this->unk_196 != 0) { @@ -597,7 +597,7 @@ void func_809BE058(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BE180(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE180(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; @@ -613,11 +613,11 @@ void func_809BE180(EnBigokuta* this, GlobalContext* globalCtx) { this->actor.world.pos.y = sinf((this->unk_196 - 8) * (M_PI / 16)) * 100.0f + this->actor.home.pos.y; func_809BCE3C(this); if (this->unk_196 == 8) { - func_809BD1C8(this, globalCtx); + func_809BD1C8(this, play); } } } -void func_809BE26C(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE26C(EnBigokuta* this, PlayState* play) { Vec3f effectPos; if (this->unk_196 != 0) { @@ -635,22 +635,22 @@ void func_809BE26C(EnBigokuta* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x; effectPos.y = this->actor.world.pos.y + 150.0f; effectPos.z = this->actor.world.pos.z; - func_8002829C(globalCtx, &effectPos, &sEffectPosAccel, &sEffectPosAccel, &sEffectPrimColor, + func_8002829C(play, &effectPos, &sEffectPosAccel, &sEffectPosAccel, &sEffectPrimColor, &sEffectEnvColor, 1200, 20); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } if (this->unk_198 == 0 && Math_StepToF(&this->actor.scale.y, 0.0f, 0.001f)) { - Flags_SetClear(globalCtx, this->actor.room); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); - func_8005ACFC(globalCtx->cameraPtrs[MAIN_CAM], 4); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EN_OCTAROCK_BUBLE); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xB0); + Flags_SetClear(play, this->actor.room); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + func_8005ACFC(play->cameraPtrs[MAIN_CAM], 4); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_OCTAROCK_BUBLE); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); Actor_Kill(&this->actor); } } } -void func_809BE3E4(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE3E4(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { @@ -671,19 +671,19 @@ void func_809BE3E4(EnBigokuta* this, GlobalContext* globalCtx) { this->unk_196 = -40; } } - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); } -void func_809BE4A4(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE4A4(EnBigokuta* this, PlayState* play) { this->actor.world.pos.y -= 10.0f; this->actor.shape.rot.y += 0x2000; if (this->actor.world.pos.y < (this->actor.home.pos.y + -200.0f)) { - func_809BD7F0(this, globalCtx); + func_809BD7F0(this, play); } - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); } -void func_809BE518(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE518(EnBigokuta* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 10.0f)) { this->actor.flags |= ACTOR_FLAG_0; func_809BD3F8(this); @@ -713,7 +713,7 @@ void func_809BE568(EnBigokuta* this) { } } -void func_809BE798(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE798(EnBigokuta* this, PlayState* play) { s16 effectRot; s16 yawDiff; @@ -732,7 +732,7 @@ void func_809BE798(EnBigokuta* this, GlobalContext* globalCtx) { } else { effectRot = -0x6000; } - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.world.rot.y + effectRot, 5.0f); + func_8002F71C(play, &this->actor, 10.0f, this->actor.world.rot.y + effectRot, 5.0f); if (this->actionFunc == func_809BDC08) { func_809BD4A4(this); this->unk_196 = 40; @@ -745,7 +745,7 @@ void func_809BE798(EnBigokuta* this, GlobalContext* globalCtx) { } } -void EnBigokuta_UpdateDamage(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_UpdateDamage(EnBigokuta* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { @@ -758,7 +758,7 @@ void EnBigokuta_UpdateDamage(EnBigokuta* this, GlobalContext* globalCtx) { } else if (!Actor_IsFacingPlayer(&this->actor, 0x4000)) { if (Actor_ApplyDamage(&this->actor) == 0) { // Dead Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_DAMAGE); } @@ -768,47 +768,47 @@ void EnBigokuta_UpdateDamage(EnBigokuta* this, GlobalContext* globalCtx) { } } -void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnBigokuta_Update(Actor* thisx, PlayState* play2) { EnBigokuta* this = (EnBigokuta*)thisx; s32 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - func_809BE798(this, globalCtx); - EnBigokuta_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + func_809BE798(this, play); + EnBigokuta_UpdateDamage(this, play); + this->actionFunc(this, play); func_809BD2E4(this); func_809BE568(this); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BIG_OCTO); - func_8005AD1C(globalCtx->cameraPtrs[MAIN_CAM], 4); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_BIG_OCTO); + func_8005AD1C(play->cameraPtrs[MAIN_CAM], 4); if (this->cylinder[0].base.atFlags & AT_ON) { if (this->actionFunc != func_809BE058) { for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinder[i].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder[i].base); } this->actor.flags |= ACTOR_FLAG_24; } else { for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder[i].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder[i].base); } } for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder[i].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder[i].base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, this->actor.scale.y * 25.0f * 100.0f); - func_809BCEBC(this, globalCtx); + func_809BCEBC(this, play); } -s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnBigokuta* this = (EnBigokuta*)thisx; u8 intensity; @@ -817,7 +817,7 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d if (limbIndex == 15) { if (this->actionFunc == func_809BE058 || this->actionFunc == func_809BE180) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc == func_809BE058) { temp_hi = this->unk_196 % 12; @@ -839,10 +839,10 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, temp_f0, temp_f0, temp_f0, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } else if (limbIndex == 10) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc == func_809BE26C) { intensity = this->unk_196 * (255.0f / 38); } else { @@ -851,7 +851,7 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, intensity, intensity, intensity, intensity); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 17 && this->actionFunc == func_809BE26C) { if (this->unk_198 < 5) { Matrix_Scale((this->unk_198 * 0.2f * 0.25f) + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); @@ -866,13 +866,13 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnBigokuta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Draw(Actor* thisx, PlayState* play) { EnBigokuta* this = (EnBigokuta*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->actionFunc != func_809BE26C) || (this->unk_196 != 0) || (this->unk_198 != 0)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); if (this->unk_196 & 1) { @@ -888,14 +888,14 @@ void EnBigokuta_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(-rotY, MTXMODE_APPLY); } } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBigokuta_OverrideLimbDraw, NULL, this); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (this->actor.scale.y * (255 / 0.033f))); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, NULL, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h b/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index 2044a1865..fc6ca9ac7 100644 --- a/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/soh/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -6,7 +6,7 @@ struct EnBigokuta; -typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, GlobalContext*); +typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); typedef struct EnBigokuta { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.c index 9d74d03ce..7174497e7 100644 --- a/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -9,24 +9,24 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnBili_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBili_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBili_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBili_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBili_Init(Actor* thisx, PlayState* play); +void EnBili_Destroy(Actor* thisx, PlayState* play); +void EnBili_Update(Actor* thisx, PlayState* play); +void EnBili_Draw(Actor* thisx, PlayState* play); void EnBili_SetupFloatIdle(EnBili* this); void EnBili_SetupSpawnedFlyApart(EnBili* this); -void EnBili_FloatIdle(EnBili* this, GlobalContext* globalCtx); -void EnBili_SpawnedFlyApart(EnBili* this, GlobalContext* globalCtx); -void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx); -void EnBili_Climb(EnBili* this, GlobalContext* globalCtx); -void EnBili_ApproachPlayer(EnBili* this, GlobalContext* globalCtx); -void EnBili_SetNewHomeHeight(EnBili* this, GlobalContext* globalCtx); -void EnBili_Recoil(EnBili* this, GlobalContext* globalCtx); -void EnBili_Burnt(EnBili* this, GlobalContext* globalCtx); -void EnBili_Die(EnBili* this, GlobalContext* globalCtx); -void EnBili_Stunned(EnBili* this, GlobalContext* globalCtx); -void EnBili_Frozen(EnBili* this, GlobalContext* globalCtx); +void EnBili_FloatIdle(EnBili* this, PlayState* play); +void EnBili_SpawnedFlyApart(EnBili* this, PlayState* play); +void EnBili_DischargeLightning(EnBili* this, PlayState* play); +void EnBili_Climb(EnBili* this, PlayState* play); +void EnBili_ApproachPlayer(EnBili* this, PlayState* play); +void EnBili_SetNewHomeHeight(EnBili* this, PlayState* play); +void EnBili_Recoil(EnBili* this, PlayState* play); +void EnBili_Burnt(EnBili* this, PlayState* play); +void EnBili_Die(EnBili* this, PlayState* play); +void EnBili_Stunned(EnBili* this, PlayState* play); +void EnBili_Frozen(EnBili* this, PlayState* play); const ActorInit En_Bili_InitVars = { ACTOR_EN_BILI, @@ -112,16 +112,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -void EnBili_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBili_Init(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBiriSkel, &gBiriDefaultAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBiriSkel, &gBiriDefaultAnim, this->jointTable, this->morphTable, EN_BILI_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->playFlySound = false; @@ -132,10 +132,10 @@ void EnBili_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBili_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBili_Destroy(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } // Setup Action Functions @@ -247,7 +247,7 @@ void EnBili_SetupStunned(EnBili* this) { this->actionFunc = EnBili_Stunned; } -void EnBili_SetupFrozen(EnBili* this, GlobalContext* globalCtx) { +void EnBili_SetupFrozen(EnBili* this, PlayState* play) { s32 i; Vec3f effectPos; @@ -264,7 +264,7 @@ void EnBili_SetupFrozen(EnBili* this, GlobalContext* globalCtx) { effectPos.y += 2.5f; effectPos.z = this->actor.world.pos.z + ((i & 4) ? 7.0f : -7.0f); - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 0.7f); } @@ -324,7 +324,7 @@ void EnBili_UpdateFloating(EnBili* this) { // Action functions -void EnBili_FloatIdle(EnBili* this, GlobalContext* globalCtx) { +void EnBili_FloatIdle(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -346,7 +346,7 @@ void EnBili_FloatIdle(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_SpawnedFlyApart(EnBili* this, GlobalContext* globalCtx) { +void EnBili_SpawnedFlyApart(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -357,7 +357,7 @@ void EnBili_SpawnedFlyApart(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx) { +void EnBili_DischargeLightning(EnBili* this, PlayState* play) { static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 200, 255, 255, 255 }; s32 i; @@ -370,7 +370,7 @@ void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx) { effectPos.x = Rand_CenteredFloat(5.0f) + this->actor.world.pos.x; effectPos.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y + 2.5f; effectPos.z = Rand_CenteredFloat(5.0f) + this->actor.world.pos.z; - EffectSsLightning_Spawn(globalCtx, &effectPos, &primColor, &envColor, 15, effectYaw, 6, 2); + EffectSsLightning_Spawn(play, &effectPos, &primColor, &envColor, 15, effectYaw, 6, 2); } } @@ -392,7 +392,7 @@ void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Climb(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Climb(EnBili* this, PlayState* play) { s32 skelAnimeUpdate = SkelAnime_Update(&this->skelAnime); f32 curFrame = this->skelAnime.curFrame; @@ -410,7 +410,7 @@ void EnBili_Climb(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_ApproachPlayer(EnBili* this, GlobalContext* globalCtx) { +void EnBili_ApproachPlayer(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 1820); @@ -429,7 +429,7 @@ void EnBili_ApproachPlayer(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_SetNewHomeHeight(EnBili* this, GlobalContext* globalCtx) { +void EnBili_SetNewHomeHeight(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -444,7 +444,7 @@ void EnBili_SetNewHomeHeight(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Recoil(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Recoil(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.3f)) { @@ -453,7 +453,7 @@ void EnBili_Recoil(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Burnt(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Burnt(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.flags & ACTOR_FLAG_15) { @@ -469,7 +469,7 @@ void EnBili_Burnt(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Die(EnBili* this, PlayState* play) { static Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; static Vec3f effectAccel = { 0.0f, 0.0f, 0.0f }; s16 effectScale; @@ -481,7 +481,7 @@ void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { return; } this->actor.draw = NULL; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x50); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x50); } if (this->timer != 0) { @@ -498,10 +498,10 @@ void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { effectScale = Rand_S16Offset(40, 40); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &effectPos, &effectVelocity, &effectAccel, effectScale, + EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &effectPos, &effectVelocity, &effectAccel, effectScale, + EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 0, 1); } } @@ -510,11 +510,11 @@ void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { } if (this->timer == 14) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_BIRI_BUBLE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BIRI_BUBLE); } } -void EnBili_Stunned(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Stunned(EnBili* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -528,7 +528,7 @@ void EnBili_Stunned(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Frozen(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Frozen(EnBili* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -545,7 +545,7 @@ void EnBili_Frozen(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { +void EnBili_UpdateDamage(EnBili* this, PlayState* play) { u8 damageEffect; if ((this->actor.colChkInfo.health != 0) && (this->collider.base.acFlags & AC_HIT)) { @@ -555,7 +555,7 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIRI_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } @@ -580,7 +580,7 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { EnBili_SetupBurnt(this); this->timer = 2; } else if (damageEffect == BIRI_DMGEFF_ICE) { - EnBili_SetupFrozen(this, globalCtx); + EnBili_SetupFrozen(this, play); } else if (damageEffect == BIRI_DMGEFF_SLINGSHOT) { EnBili_SetupRecoil(this); } else { @@ -594,8 +594,8 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBili_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBili* this = (EnBili*)thisx; if (this->collider.base.atFlags & AT_HIT) { @@ -603,8 +603,8 @@ void EnBili_Update(Actor* thisx, GlobalContext* globalCtx2) { EnBili_SetupDischargeLightning(this); } - EnBili_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnBili_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnBili_Die) { EnBili_UpdateTentaclesIndex(this); @@ -625,17 +625,17 @@ void EnBili_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, this->collider.dim.radius, this->collider.dim.height, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, this->collider.dim.radius, this->collider.dim.height, 7); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_SetFocus(&this->actor, 0.0f); } } @@ -722,7 +722,7 @@ void EnBili_PulseLimb4(EnBili* this, f32 frame, Vec3f* arg2) { } } -s32 EnBili_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnBili_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnBili* this = (EnBili*)thisx; Vec3f limbScale = { 1.0f, 1.0f, 1.0f }; @@ -734,7 +734,7 @@ s32 EnBili_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList EnBili_PulseLimb2(this, curFrame, &limbScale); } else if (limbIndex == EN_BILI_LIMB_TENTACLES) { EnBili_PulseLimb4(this, curFrame, &limbScale); - rot->y = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y) + 0x8000; + rot->y = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000; } Matrix_Scale(limbScale.x, limbScale.y, limbScale.z, MTXMODE_APPLY); @@ -748,11 +748,11 @@ static void* sTentaclesTextures[] = { #include "overlays/ovl_En_Bili/ovl_En_Bili.h" -void EnBili_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBili_Draw(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); this->tentaclesTexIndex = CLAMP_MAX(this->tentaclesTexIndex, 7); @@ -764,7 +764,7 @@ void EnBili_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x09, D_809C1700); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBili_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.h b/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.h index 5e5f6815f..782412af8 100644 --- a/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/soh/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -6,7 +6,7 @@ struct EnBili; -typedef void (*EnBiliActionFunc)(struct EnBili*, GlobalContext*); +typedef void (*EnBiliActionFunc)(struct EnBili*, PlayState*); typedef enum { /* 0 */ EN_BILI_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.c b/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.c index f56ff53a6..fc0c673a1 100644 --- a/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.c +++ b/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.c @@ -9,14 +9,14 @@ #define FLAGS 0 -void EnBird_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBird_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBird_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBird_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBird_Init(Actor* thisx, PlayState* play); +void EnBird_Destroy(Actor* thisx, PlayState* play); +void EnBird_Update(Actor* thisx, PlayState* play); +void EnBird_Draw(Actor* thisx, PlayState* play); void func_809C1E00(EnBird* this, s16 params); -void func_809C1E40(EnBird* this, GlobalContext* globalCtx); -void func_809C1D60(EnBird* this, GlobalContext* globalCtx); +void func_809C1E40(EnBird* this, PlayState* play); +void func_809C1D60(EnBird* this, PlayState* play); void func_809C1CAC(EnBird* this, s16 params); const ActorInit En_Bird_InitVars = { @@ -40,12 +40,12 @@ void EnBird_SetupAction(EnBird* this, EnBirdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBird_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Init(Actor* thisx, PlayState* play) { EnBird* this = (EnBird*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, 0.01); - SkelAnime_Init(globalCtx, &this->skelAnime, &gBirdSkel, &gBirdFlyAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gBirdSkel, &gBirdFlyAnim, NULL, NULL, 0); ActorShape_Init(&this->actor.shape, 5500, ActorShadow_DrawCircle, 4); this->unk_194 = 0; this->unk_198 = 0; @@ -61,7 +61,7 @@ void EnBird_Init(Actor* thisx, GlobalContext* globalCtx) { func_809C1CAC(this, this->actor.params); } -void EnBird_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Destroy(Actor* thisx, PlayState* play) { } void func_809C1CAC(EnBird* this, s16 params) { @@ -74,7 +74,7 @@ void func_809C1CAC(EnBird* this, s16 params) { EnBird_SetupAction(this, func_809C1D60); } -void func_809C1D60(EnBird* this, GlobalContext* globalCtx) { +void func_809C1D60(EnBird* this, PlayState* play) { f32 fVar2 = sinf(this->unk_1B4); this->actor.shape.yOffset = this->actor.shape.yOffset + fVar2 * this->unk_1A0; @@ -97,7 +97,7 @@ void func_809C1E00(EnBird* this, s16 params) { EnBird_SetupAction(this, func_809C1E40); } -void func_809C1E40(EnBird* this, GlobalContext* globalCtx) { +void func_809C1E40(EnBird* this, PlayState* play) { f32 fVar4 = sinf(this->unk_1B4); this->actor.shape.yOffset += fVar4 * this->unk_1A0; @@ -119,15 +119,15 @@ void func_809C1E40(EnBird* this, GlobalContext* globalCtx) { } } -void EnBird_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Update(Actor* thisx, PlayState* play) { EnBird* this = (EnBird*)thisx; this->unk_1B4 += this->unk_1B8; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnBird_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Draw(Actor* thisx, PlayState* play) { EnBird* this = (EnBird*)thisx; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); } diff --git a/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.h b/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.h index bd5c23298..a8a745f2d 100644 --- a/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.h +++ b/soh/src/overlays/actors/ovl_En_Bird/z_en_bird.h @@ -6,7 +6,7 @@ struct EnBird; -typedef void (*EnBirdActionFunc)(struct EnBird*, GlobalContext*); +typedef void (*EnBirdActionFunc)(struct EnBird*, PlayState*); typedef struct EnBird { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index 8deec49c7..c58e756ae 100644 --- a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBlkobj_Init(Actor* thisx, PlayState* play); +void EnBlkobj_Destroy(Actor* thisx, PlayState* play); +void EnBlkobj_Update(Actor* thisx, PlayState* play); +void EnBlkobj_Draw(Actor* thisx, PlayState* play); -void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx); -void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx); -void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx); -void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx); +void EnBlkobj_Wait(EnBlkobj* this, PlayState* play); +void EnBlkobj_SpawnDarkLink(EnBlkobj* this, PlayState* play); +void EnBlkobj_DarkLinkFight(EnBlkobj* this, PlayState* play); +void EnBlkobj_DoNothing(EnBlkobj* this, PlayState* play); const ActorInit En_Blkobj_InitVars = { ACTOR_EN_BLKOBJ, @@ -54,32 +54,32 @@ void EnBlkobj_SetupAction(EnBlkobj* this, EnBlkobjActionFunc actionFunc) { this->timer = 0; } -void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Init(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (Flags_GetClear(play, this->dyna.actor.room)) { this->alpha = 255; EnBlkobj_SetupAction(this, EnBlkobj_DoNothing); } else { CollisionHeader_GetVirtual(&gIllusionRoomCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); EnBlkobj_SetupAction(this, EnBlkobj_Wait); } } -void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBlkobj_Wait(EnBlkobj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.actor.xzDistToPlayer < 120.0f) { EnBlkobj_SetupAction(this, EnBlkobj_SpawnDarkLink); @@ -87,21 +87,21 @@ void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) { player->stateFlags2 |= 0x04000000; } -void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx) { +void EnBlkobj_SpawnDarkLink(EnBlkobj* this, PlayState* play) { if (!(this->dyna.actor.flags & ACTOR_FLAG_6)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TORCH2, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TORCH2, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.yawTowardsPlayer, 0, 0); EnBlkobj_SetupAction(this, EnBlkobj_DarkLinkFight); } } -void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx) { +void EnBlkobj_DarkLinkFight(EnBlkobj* this, PlayState* play) { s32 alphaMod; if (this->timer == 0) { - if (Actor_Find(&globalCtx->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) { - Flags_SetClear(globalCtx, this->dyna.actor.room); + if (Actor_Find(&play->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) { + Flags_SetClear(play, this->dyna.actor.room); this->timer++; } } else if (this->timer++ > 100) { @@ -113,25 +113,25 @@ void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx) { if (this->alpha > 255) { this->alpha = 255; EnBlkobj_SetupAction(this, EnBlkobj_DoNothing); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } } -void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx) { +void EnBlkobj_DoNothing(EnBlkobj* this, PlayState* play) { } -void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Update(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnBlkobj_DrawAlpha(GlobalContext* globalCtx, Gfx* dList, s32 alpha) { +void EnBlkobj_DrawAlpha(PlayState* play, Gfx* dList, s32 alpha) { Gfx* segment; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (alpha == 255) { segment = sSetupOpaDL; @@ -143,33 +143,33 @@ void EnBlkobj_DrawAlpha(GlobalContext* globalCtx, Gfx* dList, s32 alpha) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, alpha); gSPDisplayList(POLY_XLU_DISP++, dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; s32 illusionAlpha; u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames % 128; + gameplayFrames = play->gameplayFrames % 128; gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->alpha != 0) { - EnBlkobj_DrawAlpha(globalCtx, gIllusionRoomNormalDL, this->alpha); + EnBlkobj_DrawAlpha(play, gIllusionRoomNormalDL, this->alpha); } illusionAlpha = 255 - this->alpha; if (illusionAlpha != 0) { - EnBlkobj_DrawAlpha(globalCtx, gIllusionRoomIllusionDL, illusionAlpha); + EnBlkobj_DrawAlpha(play, gIllusionRoomIllusionDL, illusionAlpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h index ada8f21de..4218c6466 100644 --- a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h +++ b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h @@ -6,7 +6,7 @@ struct EnBlkobj; -typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, GlobalContext*); +typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, PlayState*); typedef struct EnBlkobj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 76b072797..49aa1b46b 100644 --- a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -10,13 +10,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBom_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBom_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBom_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBom_Init(Actor* thisx, PlayState* play); +void EnBom_Destroy(Actor* thisx, PlayState* play); +void EnBom_Update(Actor* thisx, PlayState* play); +void EnBom_Draw(Actor* thisx, PlayState* play); -void EnBom_Move(EnBom* this, GlobalContext* globalCtx); -void EnBom_WaitForRelease(EnBom* this, GlobalContext* globalCtx); +void EnBom_Move(EnBom* this, PlayState* play); +void EnBom_WaitForRelease(EnBom* this, PlayState* play); const ActorInit En_Bom_InitVars = { ACTOR_EN_BOM, @@ -88,7 +88,7 @@ void EnBom_SetupAction(EnBom* this, EnBomActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Init(Actor* thisx, PlayState* play) { EnBom* this = (EnBom*)thisx; Actor_ProcessInitChain(thisx, sInitChain); @@ -98,10 +98,10 @@ void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->colChkInfo.cylHeight = 10; this->timer = 70; this->flashSpeedScale = 7; - Collider_InitCylinder(globalCtx, &this->bombCollider); - Collider_InitJntSph(globalCtx, &this->explosionCollider); - Collider_SetCylinder(globalCtx, &this->bombCollider, thisx, &sCylinderInit); - Collider_SetJntSph(globalCtx, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); + Collider_InitCylinder(play, &this->bombCollider); + Collider_InitJntSph(play, &this->explosionCollider); + Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); + Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); this->explosionColliderItems[0].info.toucher.damage += (thisx->shape.rot.z & 0xFF00) >> 8; if (CVar_GetS32("gNutsExplodeBombs", 0)) { this->bombCollider.info.bumper.dmgFlags |= 1; @@ -115,16 +115,16 @@ void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { EnBom_SetupAction(this, EnBom_Move); } -void EnBom_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Destroy(Actor* thisx, PlayState* play) { EnBom* this = (EnBom*)thisx; - Collider_DestroyJntSph(globalCtx, &this->explosionCollider); - Collider_DestroyCylinder(globalCtx, &this->bombCollider); + Collider_DestroyJntSph(play, &this->explosionCollider); + Collider_DestroyCylinder(play, &this->bombCollider); } -void EnBom_Move(EnBom* this, GlobalContext* globalCtx) { +void EnBom_Move(EnBom* this, PlayState* play) { // if bomb has a parent actor, the bomb hasnt been released yet - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { EnBom_SetupAction(this, EnBom_WaitForRelease); this->actor.room = -1; return; @@ -150,26 +150,26 @@ void EnBom_Move(EnBom* this, GlobalContext* globalCtx) { } else { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); if ((this->actor.bgCheckFlags & 2) && (this->actor.velocity.y < -3.0f)) { - func_8002F850(globalCtx, &this->actor); + func_8002F850(play, &this->actor); this->actor.velocity.y *= -0.3f; this->actor.bgCheckFlags &= ~2; } else if (this->timer >= 4) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } Actor_MoveForward(&this->actor); } -void EnBom_WaitForRelease(EnBom* this, GlobalContext* globalCtx) { +void EnBom_WaitForRelease(EnBom* this, PlayState* play) { // if parent is NULL bomb has been released - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { EnBom_SetupAction(this, EnBom_Move); - EnBom_Move(this, globalCtx); + EnBom_Move(this, play); } } -void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) { +void EnBom_Explode(EnBom* this, PlayState* play) { Player* player; if (this->explosionCollider.elements[0].dim.modelSphere.radius == 0) { @@ -180,35 +180,35 @@ void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) { this->explosionCollider.elements[0].dim.worldSphere.radius += this->actor.shape.rot.z + 8; if (this->actor.params == BOMB_EXPLOSION) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->explosionCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->explosionCollider.base); } - if (globalCtx->envCtx.adjLight1Color[0] != 0) { - globalCtx->envCtx.adjLight1Color[0] -= 25; + if (play->envCtx.adjLight1Color[0] != 0) { + play->envCtx.adjLight1Color[0] -= 25; } - if (globalCtx->envCtx.adjLight1Color[1] != 0) { - globalCtx->envCtx.adjLight1Color[1] -= 25; + if (play->envCtx.adjLight1Color[1] != 0) { + play->envCtx.adjLight1Color[1] -= 25; } - if (globalCtx->envCtx.adjLight1Color[2] != 0) { - globalCtx->envCtx.adjLight1Color[2] -= 25; + if (play->envCtx.adjLight1Color[2] != 0) { + play->envCtx.adjLight1Color[2] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[0] != 0) { - globalCtx->envCtx.adjAmbientColor[0] -= 25; + if (play->envCtx.adjAmbientColor[0] != 0) { + play->envCtx.adjAmbientColor[0] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[1] != 0) { - globalCtx->envCtx.adjAmbientColor[1] -= 25; + if (play->envCtx.adjAmbientColor[1] != 0) { + play->envCtx.adjAmbientColor[1] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[2] != 0) { - globalCtx->envCtx.adjAmbientColor[2] -= 25; + if (play->envCtx.adjAmbientColor[2] != 0) { + play->envCtx.adjAmbientColor[2] -= 25; } if (this->timer == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((player->stateFlags1 & 0x800) && (player->heldActor == &this->actor)) { player->actor.child = NULL; @@ -221,7 +221,7 @@ void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) { } } -void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnBom_Update(Actor* thisx, PlayState* play2) { Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f bomb2Accel = { 0.0f, 0.1f, 0.0f }; Vec3f effAccel = { 0.0f, 0.0f, 0.0f }; @@ -229,7 +229,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { Vec3f dustAccel = { 0.0f, 0.6f, 0.0f }; Color_RGBA8 dustColor = { 255, 255, 255, 255 }; s32 pad; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBom* this = (EnBom*)thisx; thisx->gravity = -1.2f; @@ -247,9 +247,9 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { this->bumpOn = true; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 5.0f, 10.0f, 15.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, thisx, 5.0f, 10.0f, 15.0f, 0x1F); if (thisx->params == BOMB_BODY) { if (this->timer < 63) { @@ -258,14 +258,14 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { // spawn spark effect on even frames effPos = thisx->world.pos; effPos.y += 17.0f; - if ((globalCtx->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(globalCtx, thisx, &effPos, &effVelocity, &effAccel); + if ((play->gameplayFrames % 2) == 0) { + EffectSsGSpk_SpawnFuse(play, thisx, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); effPos.y += 3.0f; - func_8002829C(globalCtx, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); + func_8002829C(play, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); } if ((this->bombCollider.base.acFlags & AC_HIT) || ((this->bombCollider.base.ocFlags1 & OC1_HIT) && @@ -275,7 +275,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { // if a lit stick touches the bomb, set timer to 100 // these bombs never have a timer over 70, so this isnt used - if ((this->timer > 100) && Player_IsBurningStickInRange(globalCtx, &thisx->world.pos, 30.0f, 50.0f)) { + if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) { this->timer = 100; } } @@ -304,27 +304,27 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { effPos = thisx->world.pos; effPos.y += 10.0f; - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(thisx, play)) { effPos.y += 30.0f; } - EffectSsBomb2_SpawnLayered(globalCtx, &effPos, &effVelocity, &bomb2Accel, 100, + EffectSsBomb2_SpawnLayered(play, &effPos, &effVelocity, &bomb2Accel, 100, (thisx->shape.rot.z * 6) + 19); effPos.y = thisx->floorHeight; if (thisx->floorHeight > BGCHECK_Y_MIN) { - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &effPos, &effVelocity, &effAccel); + EffectSsBlast_SpawnWhiteShockwave(play, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_EXPLOSION); - globalCtx->envCtx.adjLight1Color[0] = globalCtx->envCtx.adjLight1Color[1] = - globalCtx->envCtx.adjLight1Color[2] = 250; + play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = + play->envCtx.adjLight1Color[2] = 250; - globalCtx->envCtx.adjAmbientColor[0] = globalCtx->envCtx.adjAmbientColor[1] = - globalCtx->envCtx.adjAmbientColor[2] = 250; + play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = + play->envCtx.adjAmbientColor[2] = 250; - Camera_AddQuake(&globalCtx->mainCamera, 2, 0xB, 8); + Camera_AddQuake(&play->mainCamera, 2, 0xB, 8); thisx->params = BOMB_EXPLOSION; this->timer = 10; thisx->flags |= ACTOR_FLAG_5; @@ -338,16 +338,16 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { Collider_UpdateCylinder(thisx, &this->bombCollider); // if link is not holding the bomb anymore and bump conditions are met, subscribe to OC - if (!Actor_HasParent(thisx, globalCtx) && this->bumpOn) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + if (!Actor_HasParent(thisx, play) && this->bumpOn) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bombCollider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bombCollider.base); } if ((thisx->scale.x >= 0.01f) && (thisx->params != BOMB_EXPLOSION)) { if (thisx->yDistToWater >= 20.0f) { - EffectSsDeadSound_SpawnStationary(globalCtx, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, + EffectSsDeadSound_SpawnStationary(play, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, DEADSOUND_REPEAT_MODE_OFF, 10); Actor_Kill(thisx); return; @@ -359,21 +359,21 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBom* this = (EnBom*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (thisx->params == BOMB_BODY) { - func_80093D18(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - func_8002EBCC(thisx, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + func_8002EBCC(thisx, play, 0); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), 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++, gBombCapDL); Matrix_RotateZYX(0x4000, 0, 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); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->flashIntensity, 0, 40, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, (s16)this->flashIntensity, 0, 40, 255); @@ -381,5 +381,5 @@ void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateSpheres(0, &this->explosionCollider); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.h index f6d6f8855..7399d6edd 100644 --- a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -6,7 +6,7 @@ struct EnBom; -typedef void (*EnBomActionFunc)(struct EnBom*, struct GlobalContext*); +typedef void (*EnBomActionFunc)(struct EnBom*, struct PlayState*); typedef struct EnBom { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 6bb097d89..90d3f704f 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -13,26 +13,26 @@ typedef enum { /* 3 */ CHU_GIRL_EYES_AWAKE } BombchuGirlEyeMode; -void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBomBowlMan_Init(Actor* thisx, PlayState* play); +void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play); +void EnBomBowlMan_Update(Actor* thisx, PlayState* play); +void EnBomBowlMan_Draw(Actor* thisx, PlayState* play); -void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_WakeUp(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C41FC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx); +void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_WakeUp(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_RunGame(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play); +void func_809C41FC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, PlayState* play); const ActorInit En_Bom_Bowl_Man_InitVars = { ACTOR_EN_BOM_BOWL_MAN, @@ -47,29 +47,29 @@ const ActorInit En_Bom_Bowl_Man_InitVars = { NULL, }; -void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { static f32 cuccoColliderDims[][3] = { { 16.0f, 46.0f, 0.0f }, { 36.0f, 56.0f, 0.0f } }; static Vec3f cuccoSpawnPos[] = { { 60, -60, -430 }, { 0, -120, -620 } }; static f32 cuccoScales[] = { 0.01f, 0.03f }; EnBomBowlMan* this = (EnBomBowlMan*)thisx; EnSyatekiNiw* cucco; s32 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gChuGirlSkel, &gChuGirlNoddingOffAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gChuGirlSkel, &gChuGirlNoddingOffAnim, this->jointTable, this->morphTable, 11); // "☆ Man, my shoulders hurt~ ☆" osSyncPrintf(VT_FGCOL(GREEN) "☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n" VT_RST); // "☆ Isn't there some sort of job that will pay better and be more relaxing? ☆ %d" osSyncPrintf(VT_FGCOL(GREEN) "☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n" VT_RST, - globalCtx->bombchuBowlingStatus); + play->bombchuBowlingStatus); this->posCopy = this->actor.world.pos; this->actor.shape.yOffset = -60.0f; Actor_SetScale(&this->actor, 0.013f); for (i = 0; i < 2; i++) { - cucco = (EnSyatekiNiw*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x, + cucco = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x, cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0, 1); if (cucco != NULL) { @@ -84,10 +84,10 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnBomBowMan_SetupWaitAsleep; } -void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } -void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, PlayState* play) { this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlNoddingOffAnim); Animation_Change(&this->skelAnime, &gChuGirlNoddingOffAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0xC0; @@ -95,39 +95,39 @@ void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actionFunc = EnBomBowMan_WaitAsleep; } -void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, PlayState* play) { s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnBomBowMan_TalkAsleep; } else { yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (!(this->actor.xzDistToPlayer > 120.0f) && (yawDiff < 0x4300)) { - func_8002F2CC(&this->actor, globalCtx, 120.0f); + func_8002F2CC(&this->actor, play, 120.0f); } } } -void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = EnBomBowMan_WakeUp; } } -void EnBomBowMan_WakeUp(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_WakeUp(EnBomBowlMan* this, PlayState* play) { this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlWakeUpAnim); Animation_Change(&this->skelAnime, &gChuGirlWakeUpAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); this->eyeMode = CHU_GIRL_EYES_OPEN_SLOWLY; this->actionFunc = EnBomBowMan_BlinkAwake; } -void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, PlayState* play) { f32 frameCount = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -155,7 +155,7 @@ void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx) { } } } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); if ((this->eyeTextureIndex == 0) && (this->eyeMode == CHU_GIRL_EYES_BLINK_RAPIDLY) && (this->blinkTimer == 0)) { // Blink twice, then move on @@ -168,11 +168,11 @@ void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx) { } } -void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlLeanOverCounterAnim); Animation_Change(&this->skelAnime, &gChuGirlLeanOverCounterAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -194,32 +194,32 @@ void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x18; this->dialogState = TEXT_STATE_CHOICE; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = EnBomBowlMan_HandlePlayChoice; } } } -void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnBomBowMan_TalkNotBeatenDC; } else { - func_8002F2CC(&this->actor, globalCtx, 120.0f); + func_8002F2CC(&this->actor, play, 120.0f); } } -void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnBomBowMan_WaitNotBeatenDC; } } -void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->minigamePlayStatus == 0) { @@ -238,13 +238,13 @@ void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actionFunc = EnBomBowMan_RunGame; } -void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_RunGame(EnBomBowlMan* this, PlayState* play) { s16 yawDiff; SkelAnime_Update(&this->skelAnime); if (BREG(3)) { - osSyncPrintf(VT_FGCOL(RED) "☆ game_play->bomchu_game_flag ☆ %d\n" VT_RST, globalCtx->bombchuBowlingStatus); + osSyncPrintf(VT_FGCOL(RED) "☆ game_play->bomchu_game_flag ☆ %d\n" VT_RST, play->bombchuBowlingStatus); // "HOW'S THE FIRST WALL DOING?" osSyncPrintf(VT_FGCOL(RED) "☆ 壁1の状態どう? ☆ %d\n" VT_RST, this->wallStatus[0]); // "HOW'S THE SECOND WALL DOING?" @@ -264,8 +264,8 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n" VT_RST); } - if ((globalCtx->bombchuBowlingStatus == -1) && - (globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length == 0) && (this->bowlPit->status == 0) && + if ((play->bombchuBowlingStatus == -1) && + (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length == 0) && (this->bowlPit->status == 0) && (this->wallStatus[0] != 1) && (this->wallStatus[1] != 1)) { this->gameResult = 2; // Lost // "Bombchu lost" @@ -283,16 +283,16 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { this->exItem = NULL; } - globalCtx->bombchuBowlingStatus = 0; + play->bombchuBowlingStatus = 0; this->playingAgain = true; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); if (this->gameResult == 2) { - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); } this->actionFunc = EnBomBowlMan_HandlePlayChoice; } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->minigamePlayStatus == 0) { this->actionFunc = EnBomBowlMan_HandlePlayChoice; } else { @@ -302,44 +302,44 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (!(this->actor.xzDistToPlayer > 120.0f) && (yawDiff < 0x4300)) { - func_8002F2CC(&this->actor, globalCtx, 120.0f); + func_8002F2CC(&this->actor, play, 120.0f); } } } } -void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: // Yes if (gSaveContext.rupees >= 30) { Rupees_ChangeBy(-30); this->minigamePlayStatus = 1; this->wallStatus[0] = this->wallStatus[1] = 0; - globalCtx->bombchuBowlingStatus = 10; - Flags_SetSwitch(globalCtx, 0x38); + play->bombchuBowlingStatus = 10; + Flags_SetSwitch(play, 0x38); if (!this->startedPlaying && !this->playingAgain) { this->actor.textId = 0x19; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } else { this->actor.textId = 0x1B; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_Init(globalCtx, 8010, -99, NULL, MAIN_CAM); - func_8002DF54(globalCtx, NULL, 8); + OnePointCutscene_Init(play, 8010, -99, NULL, MAIN_CAM); + func_8002DF54(play, NULL, 8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } } else { this->playingAgain = false; this->actor.textId = 0x85; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } @@ -348,50 +348,50 @@ void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx) case 1: // No this->playingAgain = false; this->actor.textId = 0x2D; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } } } -void func_809C41FC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C41FC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(globalCtx, 0x38)) { - Flags_UnsetSwitch(globalCtx, 0x38); + if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(play, 0x38)) { + Flags_UnsetSwitch(play, 0x38); } if (this->minigamePlayStatus == 1) { this->actor.textId = 0x1B; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_Init(globalCtx, 8010, -99, NULL, MAIN_CAM); - func_8002DF54(globalCtx, NULL, 8); + OnePointCutscene_Init(play, 8010, -99, NULL, MAIN_CAM); + func_8002DF54(play, NULL, 8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } else { if (this->gameResult == 2) { - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); } this->actionFunc = EnBomBowMan_SetupRunGame; } } } -void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, PlayState* play) { Vec3f accel = { 0.0f, 0.1f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f pos; SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { pos.x = 148.0f; pos.y = 40.0f; pos.z = 300.0f; - EffectSsBomb2_SpawnLayered(globalCtx, &pos, &velocity, &accel, 50, 15); + EffectSsBomb2_SpawnLayered(play, &pos, &velocity, &accel, 50, 15); Audio_PlayActorSound2(&this->actor, NA_SE_IT_GOODS_APPEAR); this->prizeRevealTimer = 10; this->actionFunc = EnBomBowMan_ChooseShowPrize; @@ -404,7 +404,7 @@ static Vec3f sPrizePosOffset[] = { static s16 sPrizeRot[] = { 0x4268, 0x4268, -0x03E8, 0x0000, 0x4268, 0x0000 }; -void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, PlayState* play) { s16 prizeTemp; s32 pad; @@ -452,14 +452,14 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { this->prizeIndex = BREG(7) - 1; } - this->exItem = (EnExItem*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, + this->exItem = (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, sPrizePosOffset[this->prizeIndex].x + 148.0f, sPrizePosOffset[this->prizeIndex].y + 40.0f, sPrizePosOffset[this->prizeIndex].z + 300.0f, 0, sPrizeRot[this->prizeIndex], 0, this->prizeIndex + EXITEM_COUNTER); if (!this->startedPlaying) { - this->bowlPit = (EnBomBowlPit*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + this->bowlPit = (EnBomBowlPit*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOM_BOWL_PIT, 0.0f, 90.0f, -860.0f, 0, 0, 0, 0); if (this->bowlPit != NULL) { this->bowlPit->prizeIndex = this->prizeIndex; @@ -471,7 +471,7 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { this->bowlPit->start = 1; this->minigamePlayStatus = 2; this->actor.textId = 0x405A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; // Cycle through prizes in order @@ -483,12 +483,12 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { } } -void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8005B1A4(GET_ACTIVE_CAM(play)); this->startedPlaying = true; if (BREG(2)) { @@ -496,13 +496,13 @@ void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx) { } // "Wow" - osSyncPrintf(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, globalCtx->bombchuBowlingStatus); - func_8002DF54(globalCtx, NULL, 7); + osSyncPrintf(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, play->bombchuBowlingStatus); + func_8002DF54(play, NULL, 7); this->actionFunc = EnBomBowMan_SetupRunGame; } } -void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; this->timer++; @@ -535,17 +535,17 @@ void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { } } - func_80038290(globalCtx, &this->actor, &this->unk_218, &this->unk_224, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_218, &this->unk_224, this->actor.focus.pos); break; } DECR(this->prizeRevealTimer); DECR(this->blinkTimer); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; @@ -557,16 +557,16 @@ s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gChuGirlEyeOpenTex, gChuGirlEyeHalfTex, gChuGirlEyeClosedTex }; EnBomBowlMan* this = (EnBomBowlMan*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTextureIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBomBowlMan_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index 83b6217cd..fada65b55 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -8,7 +8,7 @@ struct EnBomBowlMan; -typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, GlobalContext*); +typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, PlayState*); typedef struct EnBomBowlMan { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index 321f76810..eceec0c4f 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -5,18 +5,18 @@ #define FLAGS ACTOR_FLAG_4 -void EnBomBowlPit_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlPit_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlPit_Update(Actor* thisx, GlobalContext* globalCtx); +void EnBomBowlPit_Init(Actor* thisx, PlayState* play); +void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play); +void EnBomBowlPit_Update(Actor* thisx, PlayState* play); -void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_Reset(EnBomBowlPit* this, GlobalContext* globalCtx); +void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_DetectHit(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_GivePrize(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_Reset(EnBomBowlPit* this, PlayState* play); static s32 sGetItemIds[] = { GI_BOMB_BAG_30, GI_HEART_PIECE, GI_BOMBCHUS_10, GI_BOMBS_1, GI_RUPEE_PURPLE }; @@ -33,28 +33,28 @@ const ActorInit En_Bom_Bowl_Pit_InitVars = { NULL, }; -void EnBomBowlPit_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlPit_Init(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; this->actionFunc = EnBomBowlPit_SetupDetectHit; } -void EnBomBowlPit_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play) { } -void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, PlayState* play) { if (this->start != 0) { this->start = this->status = 0; this->actionFunc = EnBomBowlPit_DetectHit; } } -void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_DetectHit(EnBomBowlPit* this, PlayState* play) { EnBomChu* chu; Vec3f chuPosDiff; - if (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_CHU_BOWLING) { - chu = (EnBomChu*)globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + if (play->cameraPtrs[MAIN_CAM]->setting == CAM_SET_CHU_BOWLING) { + chu = (EnBomChu*)play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (chu != NULL) { if ((&chu->actor == &this->actor) || (chu->actor.id != ACTOR_EN_BOM_CHU)) { @@ -68,23 +68,23 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { if (((fabsf(chuPosDiff.x) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.y) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.z) < 40.0f) || (BREG(2)))) { - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); chu->timer = 1; - this->camId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); + this->camId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->camId, CAM_STAT_ACTIVE); this->unk_1C8.x = this->unk_1C8.y = this->unk_1C8.z = 0.1f; this->unk_1A4.x = this->unk_1A4.y = this->unk_1A4.z = 0.1f; - this->unk_180.x = this->unk_168.x = globalCtx->view.lookAt.x; - this->unk_180.y = this->unk_168.y = globalCtx->view.lookAt.y; - this->unk_180.z = this->unk_168.z = globalCtx->view.lookAt.z; + this->unk_180.x = this->unk_168.x = play->view.lookAt.x; + this->unk_180.y = this->unk_168.y = play->view.lookAt.y; + this->unk_180.z = this->unk_168.z = play->view.lookAt.z; - this->unk_18C.x = this->unk_174.x = globalCtx->view.eye.x; - this->unk_18C.y = this->unk_174.y = globalCtx->view.eye.y; - this->unk_18C.z = this->unk_174.z = globalCtx->view.eye.z; + this->unk_18C.x = this->unk_174.x = play->view.eye.x; + this->unk_18C.y = this->unk_174.y = play->view.eye.y; + this->unk_18C.z = this->unk_174.z = play->view.eye.z; this->unk_1BC.x = 20.0f; this->unk_1BC.y = 100.0f; @@ -102,12 +102,12 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { this->unk_1D4.y = fabsf(this->unk_180.y - this->unk_1BC.y) * 0.02f; this->unk_1D4.z = fabsf(this->unk_180.z - this->unk_1BC.z) * 0.02f; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &this->unk_180, &this->unk_18C); + Play_CameraSetAtEye(play, this->camId, &this->unk_180, &this->unk_18C); this->actor.textId = 0xF; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_154 = TEXT_STATE_EVENT; func_80078884(NA_SE_EV_HIT_SOUND); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->status = 1; this->actionFunc = EnBomBowlPit_CameraDollyIn; break; @@ -118,7 +118,7 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { } } -void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, PlayState* play) { if (this->camId != SUBCAM_FREE) { Math_ApproachF(&this->unk_180.x, this->unk_1BC.x, this->unk_1C8.x, this->unk_1D4.x); Math_ApproachF(&this->unk_180.y, this->unk_1BC.y, this->unk_1C8.y, this->unk_1D4.y); @@ -128,24 +128,24 @@ void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_18C.z, this->unk_198.z, this->unk_1A4.z, this->unk_1B0.z); } - Gameplay_CameraSetAtEye(globalCtx, this->camId, &this->unk_180, &this->unk_18C); + Play_CameraSetAtEye(play, this->camId, &this->unk_180, &this->unk_18C); - if ((this->unk_154 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->unk_154 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); } if ((fabsf(this->unk_18C.x - this->unk_198.x) < 5.0f) && (fabsf(this->unk_18C.y - this->unk_198.y) < 5.0f) && (fabsf(this->unk_18C.z - this->unk_198.z) < 5.0f) && (fabsf(this->unk_180.x - this->unk_1BC.x) < 5.0f) && (fabsf(this->unk_180.y - this->unk_1BC.y) < 5.0f) && (fabsf(this->unk_180.z - this->unk_1BC.z) < 5.0f)) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->timer = 30; this->actionFunc = EnBomBowlPit_SpawnPrize; } } -void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, PlayState* play) { if (this->timer == 0) { - this->exItem = (EnExItem*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, + this->exItem = (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z - 70.0f, 0, 0, 0, this->prizeIndex); if (this->exItem != NULL) { @@ -154,7 +154,7 @@ void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, GlobalContext* globalCtx) { } } -void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, PlayState* play) { if (this->exItemDone != 0) { switch (this->prizeIndex) { case EXITEM_BOMB_BAG_BOWLING: @@ -165,17 +165,17 @@ void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { break; } - Gameplay_ClearCamera(globalCtx, this->camId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, NULL, 8); + Play_ClearCamera(play, this->camId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + func_8002DF54(play, NULL, 8); this->actionFunc = EnBomBowlPit_GivePrize; } } -void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBomBowlPit_GivePrize(EnBomBowlPit* this, PlayState* play) { + Player* player = GET_PLAYER(play); - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->getItemId = sGetItemIds[this->prizeIndex]; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; @@ -203,29 +203,29 @@ void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { player->stateFlags1 &= ~0x20000000; this->actor.parent = NULL; if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 2000.0f, 1000.0f); } player->stateFlags1 |= 0x20000000; this->actionFunc = EnBomBowlPit_WaitTillPrizeGiven; } -void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnBomBowlPit_Reset; } else { if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 2000.0f, 1000.0f); } } } -void EnBomBowlPit_Reset(EnBomBowlPit* this, GlobalContext* globalCtx) { - if (((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && - Message_ShouldAdvance(globalCtx)) || +void EnBomBowlPit_Reset(EnBomBowlPit* this, PlayState* play) { + if (((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && + Message_ShouldAdvance(play)) || (gSaveContext.n64ddFlag && this->getItemId == GI_ICE_TRAP)) { // "Normal termination"/"completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); @@ -240,10 +240,10 @@ void EnBomBowlPit_Reset(EnBomBowlPit* this, GlobalContext* globalCtx) { } } -void EnBomBowlPit_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlPit_Update(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer != 0) { this->timer--; diff --git a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h index fd7c03be4..892fc472d 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h +++ b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h @@ -7,7 +7,7 @@ struct EnBomBowlPit; -typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, GlobalContext*); +typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, PlayState*); typedef struct EnBomBowlPit { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 86b8e4e7d..bb4a1dbdd 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -6,14 +6,14 @@ #define BOMBCHU_SCALE 0.01f -void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomChu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBomChu_Init(Actor* thisx, PlayState* play); +void EnBomChu_Destroy(Actor* thisx, PlayState* play); +void EnBomChu_Update(Actor* thisx, PlayState* play); +void EnBomChu_Draw(Actor* thisx, PlayState* play); -void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx); -void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx); -void EnBomChu_WaitForKill(EnBomChu* this, GlobalContext* globalCtx); +void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play); +void EnBomChu_Move(EnBomChu* this, PlayState* play); +void EnBomChu_WaitForKill(EnBomChu* this, PlayState* play); const ActorInit En_Bom_Chu_InitVars = { ACTOR_EN_BOM_CHU, @@ -60,7 +60,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000 * BOMBCHU_SCALE, ICHAIN_STOP), }; -void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Init(Actor* thisx, PlayState* play) { static u8 p1StartColor[] = { 250, 0, 0, 250 }; static u8 p2StartColor[] = { 200, 0, 0, 130 }; static u8 p1EndColor[] = { 150, 0, 0, 100 }; @@ -70,8 +70,8 @@ void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.worldSphere.radius = this->collider.elements[0].dim.modelSphere.radius; @@ -87,27 +87,27 @@ void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.calcMode = 0; blureInit.trailType = 3; - Effect_Add(globalCtx, &this->blure1Index, EFFECT_BLURE1, 0, 0, &blureInit); - Effect_Add(globalCtx, &this->blure2Index, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blure1Index, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blure2Index, EFFECT_BLURE1, 0, 0, &blureInit); this->actor.room = -1; this->timer = 120; this->actionFunc = EnBomChu_WaitForRelease; } -void EnBomChu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Destroy(Actor* thisx, PlayState* play) { EnBomChu* this = (EnBomChu*)thisx; - Effect_Delete(globalCtx, this->blure1Index); - Effect_Delete(globalCtx, this->blure2Index); - Collider_DestroyJntSph(globalCtx, &this->collider); + Effect_Delete(play, this->blure1Index); + Effect_Delete(play, this->blure2Index); + Collider_DestroyJntSph(play, &this->collider); } -void EnBomChu_Explode(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_Explode(EnBomChu* this, PlayState* play) { EnBom* bomb; s32 i; - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; @@ -118,7 +118,7 @@ void EnBomChu_Explode(EnBomChu* this, GlobalContext* globalCtx) { if (this->actor.yDistToWater > 0.0f) { for (i = 0; i < 40; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 1.0f, 5.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 1.0f, 5.0f, 30.0f, 0.25f); } } @@ -131,7 +131,7 @@ void EnBomChu_CrossProduct(Vec3f* a, Vec3f* b, Vec3f* dest) { dest->z = (a->x * b->y) - (a->y * b->x); } -void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* globalCtx) { +void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayState* play) { Vec3f normal; Vec3f vec; f32 angle; @@ -140,7 +140,7 @@ void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCo MtxF mf; if (CVar_GetS32("gBombchusOOB", 0) && floorPoly == NULL) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } @@ -168,7 +168,7 @@ void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCo magnitude = Math3D_Vec3fMagnitude(&this->axisForwards); if (magnitude < 0.001f) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } @@ -204,21 +204,21 @@ void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCo } } -void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { this->actor.world.pos = player->actor.world.pos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.shape.rot.y = player->actor.shape.rot.y; // rot.y = 0 -> +z (forwards in model space) @@ -239,14 +239,14 @@ void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx) { this->actor.speedXZ = 8.0f; //! @bug there is no NULL check on the floor poly. If the player is out of bounds the floor poly will be NULL //! and will cause a crash inside this function. - EnBomChu_UpdateFloorPoly(this, this->actor.floorPoly, globalCtx); + EnBomChu_UpdateFloorPoly(this, this->actor.floorPoly, play); this->actor.flags |= ACTOR_FLAG_0; // make chu targetable - func_8002F850(globalCtx, &this->actor); + func_8002F850(play, &this->actor); this->actionFunc = EnBomChu_Move; } } -void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_Move(EnBomChu* this, PlayState* play) { CollisionPoly* polySide; CollisionPoly* polyUpDown; s32 bgIdSide; @@ -267,7 +267,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { if ((this->timer == 0) || (this->collider.base.acFlags & AC_HIT) || ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.oc->category != ACTORCAT_PLAYER))) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } @@ -279,26 +279,26 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { posB.y = this->actor.world.pos.y - (this->axisUp.y * 4.0f); posB.z = this->actor.world.pos.z - (this->axisUp.z * 4.0f); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posUpDown, &polyUpDown, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posUpDown, &polyUpDown, true, true, true, true, &bgIdUpDown) && - !(func_80041DB8(&globalCtx->colCtx, polyUpDown, bgIdUpDown) & 0x30) && // && not crawl space? - !SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, polyUpDown, bgIdUpDown)) { + !(func_80041DB8(&play->colCtx, polyUpDown, bgIdUpDown) & 0x30) && // && not crawl space? + !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polyUpDown, bgIdUpDown)) { // forwards posB.x = (this->axisForwards.x * lineLength) + posA.x; posB.y = (this->axisForwards.y * lineLength) + posA.y; posB.z = (this->axisForwards.z * lineLength) + posA.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, &bgIdSide) && - !(func_80041DB8(&globalCtx->colCtx, polySide, bgIdSide) & 0x30) && - !SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, polySide, bgIdSide)) { - EnBomChu_UpdateFloorPoly(this, polySide, globalCtx); + !(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) && + !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) { + EnBomChu_UpdateFloorPoly(this, polySide, play); this->actor.world.pos = posSide; this->actor.floorBgId = bgIdSide; this->actor.speedXZ = 0.0f; } else { if (this->actor.floorPoly != polyUpDown) { - EnBomChu_UpdateFloorPoly(this, polyUpDown, globalCtx); + EnBomChu_UpdateFloorPoly(this, polyUpDown, play); } this->actor.world.pos = posUpDown; @@ -327,11 +327,11 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { posB.z = posA.z - (this->axisLeft.z * lineLength); } - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, &bgIdSide) && - !(func_80041DB8(&globalCtx->colCtx, polySide, bgIdSide) & 0x30) && - !SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, polySide, bgIdSide)) { - EnBomChu_UpdateFloorPoly(this, polySide, globalCtx); + !(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) && + !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) { + EnBomChu_UpdateFloorPoly(this, polySide, play); this->actor.world.pos = posSide; this->actor.floorBgId = bgIdSide; break; @@ -340,7 +340,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { if (i == 3) { // no collision nearby - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); } } @@ -351,7 +351,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { func_8002F8F0(&this->actor, NA_SE_IT_BOMBCHU_MOVE - SFX_FLAG); } -void EnBomChu_WaitForKill(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_WaitForKill(EnBomChu* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -376,23 +376,23 @@ void EnBomChu_ModelToWorld(EnBomChu* this, Vec3f* posModel, Vec3f* dest) { (this->axisForwards.z * posModel->z); } -void EnBomChu_SpawnRipples(EnBomChu* this, GlobalContext* globalCtx, f32 y) { +void EnBomChu_SpawnRipples(EnBomChu* this, PlayState* play, f32 y) { Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = y; pos.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 8); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 0); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 4); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 8); } -void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnBomChu_Update(Actor* thisx, PlayState* play2) { static Vec3f blureP1Model = { 0.0f, 7.0f, -6.0f }; static Vec3f blureP2LeftModel = { 12.0f, 0.0f, -5.0f }; static Vec3f blureP2RightModel = { -12.0f, 0.0f, -5.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBomChu* this = (EnBomChu*)thisx; s16 yaw; f32 sin; @@ -405,7 +405,7 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->actor.floorBgId != BGCHECK_SCENE) { yaw = this->actor.shape.rot.y; - func_800433A4(&globalCtx->colCtx, this->actor.floorBgId, &this->actor); + func_800433A4(&play->colCtx, this->actor.floorBgId, &this->actor); if (yaw != this->actor.shape.rot.y) { yaw = this->actor.shape.rot.y - yaw; @@ -427,17 +427,17 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002D97C(&this->actor); this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc != EnBomChu_WaitForRelease) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 0.0f); @@ -456,21 +456,21 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { waterY = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterY, &waterBox)) { this->actor.yDistToWater = waterY - this->actor.world.pos.y; if (this->actor.yDistToWater < 0.0f) { if (this->actor.bgCheckFlags & 0x20) { - EnBomChu_SpawnRipples(this, globalCtx, waterY); + EnBomChu_SpawnRipples(this, play, waterY); } this->actor.bgCheckFlags &= ~0x20; } else { if (!(this->actor.bgCheckFlags & 0x20) && (this->timer != 120)) { - EnBomChu_SpawnRipples(this, globalCtx, waterY); + EnBomChu_SpawnRipples(this, play, waterY); } else { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 3.0f, 15.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 3.0f, 15.0f, 0.25f); } this->actor.bgCheckFlags |= 0x20; @@ -485,7 +485,7 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { const Color_RGB8 BombchuColorOriginal = { 209, 34, -35 }; -void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBomChu* this = (EnBomChu*)thisx; f32 colorIntensity; @@ -493,10 +493,10 @@ void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 blinkTime; Color_RGB8 BombchuCol = CVar_GetRGB("gBombTrailCol", BombchuColorOriginal); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); if (this->timer >= 40) { blinkTime = this->timer % 20; @@ -521,9 +521,9 @@ void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx) { else gDPSetEnvColor(POLY_OPA_DISP++, 9.0f + (colorIntensity * 209.0f), 9.0f + (colorIntensity * 34.0f), 35.0f + (colorIntensity * -35.0f), 255); Matrix_Translate(this->visualJitter * (1.0f / BOMBCHU_SCALE), 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h b/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h index 9efc1e0d5..7e2154a0a 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h +++ b/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h @@ -6,7 +6,7 @@ struct EnBomChu; -typedef void (*EnBomChuActionFunc)(struct EnBomChu*, GlobalContext*); +typedef void (*EnBomChuActionFunc)(struct EnBomChu*, PlayState*); typedef struct EnBomChu { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index a4eee51bc..2f564d8e6 100644 --- a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -10,15 +10,15 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4) -void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBombf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBombf_Init(Actor* thisx, PlayState* play); +void EnBombf_Destroy(Actor* thisx, PlayState* play); +void EnBombf_Update(Actor* thisx, PlayState* play); +void EnBombf_Draw(Actor* thisx, PlayState* play); -void EnBombf_Move(EnBombf* this, GlobalContext* globalCtx); -void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx); -void EnBombf_WaitForRelease(EnBombf* this, GlobalContext* globalCtx); -void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx); +void EnBombf_Move(EnBombf* this, PlayState* play); +void EnBombf_GrowBomb(EnBombf* this, PlayState* play); +void EnBombf_WaitForRelease(EnBombf* this, PlayState* play); +void EnBombf_Explode(EnBombf* this, PlayState* play); void EnBombf_SetupGrowBomb(EnBombf* this, s16 params); const ActorInit En_Bombf_InitVars = { @@ -85,17 +85,17 @@ void EnBombf_SetupAction(EnBombf* this, EnBombfActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Init(Actor* thisx, PlayState* play) { f32 shapeUnk10 = 0.0f; s32 pad; EnBombf* this = (EnBombf*)thisx; Actor_SetScale(thisx, 0.01f); this->unk_200 = 1; - Collider_InitCylinder(globalCtx, &this->bombCollider); - Collider_InitJntSph(globalCtx, &this->explosionCollider); - Collider_SetCylinder(globalCtx, &this->bombCollider, thisx, &sCylinderInit); - Collider_SetJntSph(globalCtx, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); + Collider_InitCylinder(play, &this->bombCollider); + Collider_InitJntSph(play, &this->explosionCollider); + Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); + Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); if (thisx->params == BOMBFLOWER_BODY) { shapeUnk10 = 1000.0f; @@ -104,7 +104,7 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&thisx->shape, shapeUnk10, ActorShadow_DrawCircle, 12.0f); thisx->focus.pos = thisx->world.pos; - if (Actor_FindNearby(globalCtx, thisx, ACTOR_BG_DDAN_KD, ACTORCAT_BG, 10000.0f) != NULL) { + if (Actor_FindNearby(play, thisx, ACTOR_BG_DDAN_KD, ACTORCAT_BG, 10000.0f) != NULL) { thisx->flags |= ACTOR_FLAG_5; } @@ -116,7 +116,7 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { this->timer = 140; this->flashSpeedScale = 15; thisx->gravity = -1.5f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_EXPLOSIVE); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_EXPLOSIVE); thisx->colChkInfo.mass = 200; thisx->flags &= ~ACTOR_FLAG_0; EnBombf_SetupAction(this, EnBombf_Move); @@ -131,30 +131,30 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->uncullZoneForward += 31000.0f; } -void EnBombf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Destroy(Actor* thisx, PlayState* play) { EnBombf* this = (EnBombf*)thisx; - Collider_DestroyCylinder(globalCtx, &this->bombCollider); - Collider_DestroyJntSph(globalCtx, &this->explosionCollider); + Collider_DestroyCylinder(play, &this->bombCollider); + Collider_DestroyJntSph(play, &this->explosionCollider); } void EnBombf_SetupGrowBomb(EnBombf* this, s16 params) { EnBombf_SetupAction(this, EnBombf_GrowBomb); } -void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { +void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { EnBombf* bombFlower; s32 pad; s32 pad1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; if (this->flowerBombScale >= 1.0f) { - if (Actor_HasParent(&this->actor, globalCtx)) { - bombFlower = (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, + if (Actor_HasParent(&this->actor, play)) { + bombFlower = (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bombFlower != NULL) { - func_8002F5C4(&this->actor, &bombFlower->actor, globalCtx); + func_8002F5C4(&this->actor, &bombFlower->actor, play); this->timer = 180; this->flowerBombScale = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_PL_PULL_UP_ROCK); @@ -171,7 +171,7 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { if (this->bombCollider.base.ac->category != ACTORCAT_BOSS) { bombFlower = - (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, + (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bombFlower != NULL) { bombFlower->unk_200 = 1; @@ -182,9 +182,9 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { } } } else { - if (Player_IsBurningStickInRange(globalCtx, &this->actor.world.pos, 30.0f, 50.0f)) { + if (Player_IsBurningStickInRange(play, &this->actor.world.pos, 30.0f, 50.0f)) { bombFlower = - (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, + (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bombFlower != NULL) { bombFlower->timer = 100; @@ -193,8 +193,8 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { this->flowerBombScale = 0.0f; } } else { - if (!Actor_HasParent(&this->actor, globalCtx)) { - func_8002F580(&this->actor, globalCtx); + if (!Actor_HasParent(&this->actor, play)) { + func_8002F580(&this->actor, play); } else { player->actor.child = NULL; player->heldActor = NULL; @@ -213,7 +213,7 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { } } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { player->actor.child = NULL; player->heldActor = NULL; player->interactRangeActor = NULL; @@ -224,8 +224,8 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { } } -void EnBombf_Move(EnBombf* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnBombf_Move(EnBombf* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { // setting flowerBombScale does not do anything in the context of a bomb that link picks up // this and the assignment below are probably left overs this->flowerBombScale = 0.0f; @@ -241,25 +241,25 @@ void EnBombf_Move(EnBombf* this, GlobalContext* globalCtx) { } else { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); if ((this->actor.bgCheckFlags & 2) && (this->actor.velocity.y < -6.0f)) { - func_8002F850(globalCtx, &this->actor); + func_8002F850(play, &this->actor); this->actor.velocity.y *= -0.5f; } else if (this->timer >= 4) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } -void EnBombf_WaitForRelease(EnBombf* this, GlobalContext* globalCtx) { +void EnBombf_WaitForRelease(EnBombf* this, PlayState* play) { // if parent is NULL bomb has been released - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { EnBombf_SetupAction(this, EnBombf_Move); - EnBombf_Move(this, globalCtx); + EnBombf_Move(this, play); } else { this->actor.velocity.y = 0.0f; } } -void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) { +void EnBombf_Explode(EnBombf* this, PlayState* play) { Player* player; if (this->explosionCollider.elements[0].dim.modelSphere.radius == 0) { @@ -272,35 +272,35 @@ void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) { this->explosionCollider.elements[0].dim.modelSphere.radius; if (this->actor.params == BOMBFLOWER_EXPLOSION) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->explosionCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->explosionCollider.base); } - if (globalCtx->envCtx.adjLight1Color[0] != 0) { - globalCtx->envCtx.adjLight1Color[0] -= 25; + if (play->envCtx.adjLight1Color[0] != 0) { + play->envCtx.adjLight1Color[0] -= 25; } - if (globalCtx->envCtx.adjLight1Color[1] != 0) { - globalCtx->envCtx.adjLight1Color[1] -= 25; + if (play->envCtx.adjLight1Color[1] != 0) { + play->envCtx.adjLight1Color[1] -= 25; } - if (globalCtx->envCtx.adjLight1Color[2] != 0) { - globalCtx->envCtx.adjLight1Color[2] -= 25; + if (play->envCtx.adjLight1Color[2] != 0) { + play->envCtx.adjLight1Color[2] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[0] != 0) { - globalCtx->envCtx.adjAmbientColor[0] -= 25; + if (play->envCtx.adjAmbientColor[0] != 0) { + play->envCtx.adjAmbientColor[0] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[1] != 0) { - globalCtx->envCtx.adjAmbientColor[1] -= 25; + if (play->envCtx.adjAmbientColor[1] != 0) { + play->envCtx.adjAmbientColor[1] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[2] != 0) { - globalCtx->envCtx.adjAmbientColor[2] -= 25; + if (play->envCtx.adjAmbientColor[2] != 0) { + play->envCtx.adjAmbientColor[2] -= 25; } if (this->timer == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((player->stateFlags1 & 0x800) && (player->heldActor == &this->actor)) { player->actor.child = NULL; @@ -313,7 +313,7 @@ void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) { } } -void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Update(Actor* thisx, PlayState* play) { Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f bomb2Accel = { 0.0f, 0.1f, 0.0f }; Vec3f effAccel = { 0.0f, 0.0f, 0.0f }; @@ -327,12 +327,12 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer--; } - if ((!this->bumpOn) && (!Actor_HasParent(thisx, globalCtx)) && + if ((!this->bumpOn) && (!Actor_HasParent(thisx, play)) && ((thisx->xzDistToPlayer >= 20.0f) || (ABS(thisx->yDistToPlayer) >= 80.0f))) { this->bumpOn = true; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (thisx->params == BOMBFLOWER_BODY) { Actor_MoveForward(thisx); @@ -340,7 +340,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->gravity != 0.0f) { DREG(6) = 1; - Actor_UpdateBgCheckInfo(globalCtx, thisx, 5.0f, 10.0f, 0.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, thisx, 5.0f, 10.0f, 0.0f, 0x1F); DREG(6) = 0; } @@ -359,7 +359,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Audio_PlayActorSound2(thisx, NA_SE_EV_BOMB_BOUND); Actor_MoveForward(thisx); DREG(6) = 1; - Actor_UpdateBgCheckInfo(globalCtx, thisx, 5.0f, 10.0f, 0.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, thisx, 5.0f, 10.0f, 0.0f, 0x1F); DREG(6) = 0; thisx->speedXZ *= 0.7f; thisx->bgCheckFlags &= ~8; @@ -371,7 +371,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer = 0; } else { // if a lit stick touches the bomb, set timer to 100 - if ((this->timer > 100) && Player_IsBurningStickInRange(globalCtx, &thisx->world.pos, 30.0f, 50.0f)) { + if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) { this->timer = 100; } } @@ -382,13 +382,13 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { effPos.y += 25.0f; if (this->timer < 127) { // spawn spark effect on even frames - if ((globalCtx->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(globalCtx, thisx, &effPos, &effVelocity, &effAccel); + if ((play->gameplayFrames % 2) == 0) { + EffectSsGSpk_SpawnFuse(play, thisx, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); effPos.y += 3.0f; - func_8002829C(globalCtx, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); + func_8002829C(play, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); } // double bomb flash speed and adjust red color at certain times during the countdown @@ -411,23 +411,23 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { effPos.y += 10.0f; - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(thisx, play)) { effPos.y += 30.0f; } - EffectSsBomb2_SpawnLayered(globalCtx, &effPos, &effVelocity, &bomb2Accel, 100, 19); + EffectSsBomb2_SpawnLayered(play, &effPos, &effVelocity, &bomb2Accel, 100, 19); effPos.y = thisx->floorHeight; if (thisx->floorHeight > BGCHECK_Y_MIN) { - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &effPos, &effVelocity, &effAccel); + EffectSsBlast_SpawnWhiteShockwave(play, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_EXPLOSION); - globalCtx->envCtx.adjLight1Color[0] = globalCtx->envCtx.adjLight1Color[1] = - globalCtx->envCtx.adjLight1Color[2] = 250; - globalCtx->envCtx.adjAmbientColor[0] = globalCtx->envCtx.adjAmbientColor[1] = - globalCtx->envCtx.adjAmbientColor[2] = 250; - Camera_AddQuake(&globalCtx->mainCamera, 2, 0xB, 8); + play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = + play->envCtx.adjLight1Color[2] = 250; + play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = + play->envCtx.adjAmbientColor[2] = 250; + Camera_AddQuake(&play->mainCamera, 2, 0xB, 8); thisx->params = BOMBFLOWER_EXPLOSION; this->timer = 10; thisx->flags |= ACTOR_FLAG_5; @@ -444,15 +444,15 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(thisx, &this->bombCollider); if ((this->flowerBombScale >= 1.0f) && (this->bumpOn)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bombCollider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bombCollider.base); } if ((thisx->scale.x >= 0.01f) && (thisx->params != BOMBFLOWER_EXPLOSION)) { if (thisx->yDistToWater >= 20.0f) { - EffectSsDeadSound_SpawnStationary(globalCtx, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, + EffectSsDeadSound_SpawnStationary(play, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, DEADSOUND_REPEAT_MODE_OFF, 10); Actor_Kill(thisx); return; @@ -464,30 +464,30 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, GlobalContext* globalCtx) { +Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, PlayState* play) { Gfx* displayList; Gfx* displayListHead; displayList = Graph_Alloc(gfxCtx, 5 * sizeof(Gfx)); displayListHead = displayList; - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(displayListHead++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPEndDisplayList(displayListHead); return displayList; } -void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBombf* this = (EnBombf*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (thisx->params <= BOMBFLOWER_BODY) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (thisx->params != BOMBFLOWER_BODY) { - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombFlowerLeavesDL); gSPDisplayList(POLY_OPA_DISP++, gBombFlowerBaseLeavesDL); @@ -499,14 +499,14 @@ void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 255, 200, 255); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->flashIntensity, 20, 10, 0); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, - SEGMENTED_TO_VIRTUAL(EnBombf_NewMtxDList(globalCtx->state.gfxCtx, globalCtx))); + SEGMENTED_TO_VIRTUAL(EnBombf_NewMtxDList(play->state.gfxCtx, play))); gSPDisplayList(POLY_OPA_DISP++, gBombFlowerBombAndSparkDL); } else { Collider_UpdateSpheres(0, &this->explosionCollider); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h index e33880451..7822098d0 100644 --- a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h +++ b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h @@ -6,7 +6,7 @@ struct EnBombf; -typedef void (*EnBombfActionFunc)(struct EnBombf*, struct GlobalContext*); +typedef void (*EnBombfActionFunc)(struct EnBombf*, struct PlayState*); typedef struct EnBombf { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 0d4303f3f..d1eafd600 100644 --- a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBoom_Init(Actor* thisx, PlayState* play); +void EnBoom_Destroy(Actor* thisx, PlayState* play); +void EnBoom_Update(Actor* thisx, PlayState* play); +void EnBoom_Draw(Actor* thisx, PlayState* play); -void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx); +void EnBoom_Fly(EnBoom* this, PlayState* play); const ActorInit En_Boom_InitVars = { ACTOR_EN_BOOM, @@ -58,7 +58,7 @@ void EnBoom_SetupAction(EnBoom* this, EnBoomActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Init(Actor* thisx, PlayState* play) { EnBoom* this = (EnBoom*)thisx; EffectBlureInit1 blure; @@ -91,22 +91,22 @@ void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) { blure.calcMode = 0; blure.trailType = 2; - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &blure); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE1, 0, 0, &blure); - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit); EnBoom_SetupAction(this, EnBoom_Fly); } -void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Destroy(Actor* thisx, PlayState* play) { EnBoom* this = (EnBoom*)thisx; - Effect_Delete(globalCtx, this->effectIndex); - Collider_DestroyQuad(globalCtx, &this->collider); + Effect_Delete(play, this->effectIndex); + Collider_DestroyQuad(play, &this->collider); } -void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { +void EnBoom_Fly(EnBoom* this, PlayState* play) { Actor* target; Player* player; s32 collided; @@ -122,7 +122,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { Vec3f hitPoint; s32 pad2; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); target = this->moveTo; // If the boomerang is moving toward a targeted actor, handle setting the proper x and y angle to fly toward it. @@ -199,20 +199,20 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { // Copy the position from the prevous frame to the boomerang to start the bounce back. Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); } else { - collided = BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, + collided = BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint, &this->actor.wallPoly, true, true, true, true, &hitDynaID); if (collided) { // If the boomerang collides with something and it's is a Jabu Object actor with params equal to 0, then // set collided to 0 so that the boomerang will go through the wall. // Otherwise play a clank sound and keep collided set to bounce back. - if (func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 || + if (func_8002F9EC(play, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 || (hitDynaID != BGCHECK_SCENE && - ((hitActor = DynaPoly_GetActor(&globalCtx->colCtx, hitDynaID)) != NULL) && + ((hitActor = DynaPoly_GetActor(&play->colCtx, hitDynaID)) != NULL) && hitActor->actor.id == ACTOR_BG_BDAN_OBJECTS && hitActor->actor.params == 0)) { collided = false; } else { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &hitPoint); + CollisionCheck_SpawnShieldParticlesMetal(play, &hitPoint); } } } @@ -239,25 +239,25 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { } } -void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Update(Actor* thisx, PlayState* play) { EnBoom* this = (EnBoom*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x20000000)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 0.0f); this->activeTimer = this->activeTimer + 1; } } -void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Draw(Actor* thisx, PlayState* play) { static Vec3f sMultVec1 = { -960.0f, 0.0f, 0.0f }; static Vec3f sMultVec2 = { 960.0f, 0.0f, 0.0f }; EnBoom* this = (EnBoom*)thisx; Vec3f vec1; Vec3f vec2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_RotateY(this->actor.world.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(0x1F40 * (M_PI / 0x8000), MTXMODE_APPLY); @@ -265,16 +265,16 @@ void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&sMultVec1, &vec1); Matrix_MultVec3f(&sMultVec2, &vec2); - if (func_80090480(globalCtx, &this->collider, &this->boomerangInfo, &vec1, &vec2) != 0) { + if (func_80090480(play, &this->collider, &this->boomerangInfo, &vec1, &vec2) != 0) { EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &vec1, &vec2); } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_RotateY((this->activeTimer * 12000) * (M_PI / 0x8000), 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++, gBoomerangRefDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.h b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.h index cb93b27dd..428406372 100644 --- a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -6,7 +6,7 @@ struct EnBoom; -typedef void (*EnBoomActionFunc)(struct EnBoom*, GlobalContext*); +typedef void (*EnBoomActionFunc)(struct EnBoom*, PlayState*); typedef struct EnBoom { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index 67c714df5..b81313878 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -35,21 +35,21 @@ typedef enum { ENBOX_STATE_2 // waiting for something message context-related } EnBoxStateUnk1FB; -void EnBox_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBox_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBox_Init(Actor* thisx, PlayState* play); +void EnBox_Destroy(Actor* thisx, PlayState* play); +void EnBox_Update(Actor* thisx, PlayState* play); +void EnBox_Draw(Actor* thisx, PlayState* play); -void EnBox_FallOnSwitchFlag(EnBox*, GlobalContext*); -void func_809C9700(EnBox*, GlobalContext*); -void EnBox_AppearOnSwitchFlag(EnBox*, GlobalContext*); -void EnBox_AppearOnRoomClear(EnBox*, GlobalContext*); -void EnBox_AppearInit(EnBox*, GlobalContext*); -void EnBox_AppearAnimation(EnBox*, GlobalContext*); -void EnBox_WaitOpen(EnBox*, GlobalContext*); -void EnBox_Open(EnBox*, GlobalContext*); +void EnBox_FallOnSwitchFlag(EnBox*, PlayState*); +void func_809C9700(EnBox*, PlayState*); +void EnBox_AppearOnSwitchFlag(EnBox*, PlayState*); +void EnBox_AppearOnRoomClear(EnBox*, PlayState*); +void EnBox_AppearInit(EnBox*, PlayState*); +void EnBox_AppearAnimation(EnBox*, PlayState*); +void EnBox_WaitOpen(EnBox*, PlayState*); +void EnBox_Open(EnBox*, PlayState*); void EnBox_CreateExtraChestTextures(); -void EnBox_UpdateSizeAndTexture(EnBox*, GlobalContext*); +void EnBox_UpdateSizeAndTexture(EnBox*, PlayState*); const ActorInit En_Box_InitVars = { ACTOR_EN_BOX, @@ -86,7 +86,7 @@ void EnBox_SetupAction(EnBox* this, EnBoxActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { +void EnBox_ClipToGround(EnBox* this, PlayState* play) { f32 newY; CollisionPoly* poly; s32 bgId; @@ -94,14 +94,14 @@ void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { pos = this->dyna.actor.world.pos; pos.y += 1.0f; - newY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &poly, &bgId, &this->dyna.actor, &pos); + newY = BgCheck_EntityRaycastFloor4(&play->colCtx, &poly, &bgId, &this->dyna.actor, &pos); if (newY != BGCHECK_Y_MIN) { this->dyna.actor.world.pos.y = newY; } } -void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBox_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBox* this = (EnBox*)thisx; AnimationHeader* anim; CollisionHeader* colHeader; @@ -116,8 +116,8 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gTreasureChestCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags = 0; this->type = thisx->params >> 12 & 0xF; @@ -127,17 +127,17 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { this->switchFlag = this->dyna.actor.world.rot.z; this->dyna.actor.minVelocityY = -50.0f; - if (globalCtx) {} // helps the compiler store globalCtx2 into s1 + if (play) {} // helps the compiler store play2 into s1 - if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { + if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) { this->alpha = 255; this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; animFrameStart = endFrame; } else if ((this->type == ENBOX_TYPE_SWITCH_FLAG_FALL_BIG || this->type == ENBOX_TYPE_SWITCH_FLAG_FALL_SMALL) && - !Flags_GetSwitch(globalCtx, this->switchFlag)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + !Flags_GetSwitch(play, this->switchFlag)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); if (Rand_ZeroOne() < 0.5f) { this->movementFlags |= ENBOX_MOVE_FALL_ANGLE_SIDE; } @@ -147,9 +147,9 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.flags |= ACTOR_FLAG_4; } else if ((this->type == ENBOX_TYPE_ROOM_CLEAR_BIG || this->type == ENBOX_TYPE_ROOM_CLEAR_SMALL) && - !Flags_GetClear(globalCtx, this->dyna.actor.room)) { + !Flags_GetClear(play, this->dyna.actor.room)) { EnBox_SetupAction(this, EnBox_AppearOnRoomClear); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; this->alpha = 0; @@ -157,14 +157,14 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { } else if (this->type == ENBOX_TYPE_9 || this->type == ENBOX_TYPE_10) { EnBox_SetupAction(this, func_809C9700); this->dyna.actor.flags |= ACTOR_FLAG_25; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; this->alpha = 0; this->dyna.actor.flags |= ACTOR_FLAG_4; - } else if (this->type == ENBOX_TYPE_SWITCH_FLAG_BIG && !Flags_GetSwitch(globalCtx, this->switchFlag)) { + } else if (this->type == ENBOX_TYPE_SWITCH_FLAG_BIG && !Flags_GetSwitch(play, this->switchFlag)) { EnBox_SetupAction(this, EnBox_AppearOnSwitchFlag); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; this->alpha = 0; @@ -181,27 +181,27 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { this->dyna.actor.world.rot.y += 0x8000; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0; - SkelAnime_Init(globalCtx, &this->skelanime, &gTreasureChestSkel, anim, this->jointTable, this->morphTable, 5); + SkelAnime_Init(play, &this->skelanime, &gTreasureChestSkel, anim, this->jointTable, this->morphTable, 5); Animation_Change(&this->skelanime, anim, 1.5f, animFrameStart, endFrame, ANIMMODE_ONCE, 0.0f); if (gSaveContext.n64ddFlag) { - this->getItemEntry = Randomizer_GetItemFromActor(this->dyna.actor.id, globalCtx->sceneNum, this->dyna.actor.params, this->dyna.actor.params >> 5 & 0x7F); + this->getItemEntry = Randomizer_GetItemFromActor(this->dyna.actor.id, play->sceneNum, this->dyna.actor.params, this->dyna.actor.params >> 5 & 0x7F); } else { this->getItemEntry = ItemTable_RetrieveEntry(MOD_NONE, this->dyna.actor.params >> 5 & 0x7F); } - EnBox_UpdateSizeAndTexture(this, globalCtx); + EnBox_UpdateSizeAndTexture(this, play); // For SOH we spawn a chest actor instead of rendering the object from scratch for forest boss // key chest, and it's up on the wall so disable gravity for it. - if (globalCtx->sceneNum == SCENE_BMORI1 && this->dyna.actor.params == 10222) { + if (play->sceneNum == SCENE_BMORI1 && this->dyna.actor.params == 10222) { this->movementFlags = ENBOX_MOVE_IMMOBILE; } } -void EnBox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Destroy(Actor* thisx, PlayState* play) { EnBox* this = (EnBox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void EnBox_RandomDustKinematic(EnBox* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { @@ -224,7 +224,7 @@ void EnBox_RandomDustKinematic(EnBox* this, Vec3f* pos, Vec3f* velocity, Vec3f* /** * Spawns dust randomly around the chest when the chest hits the ground after falling (FALL types) */ -void EnBox_SpawnDust(EnBox* this, GlobalContext* globalCtx) { +void EnBox_SpawnDust(EnBox* this, PlayState* play) { s32 i; Vec3f pos; Vec3f velocity; @@ -232,14 +232,14 @@ void EnBox_SpawnDust(EnBox* this, GlobalContext* globalCtx) { for (i = 0; i < 20; i++) { EnBox_RandomDustKinematic(this, &pos, &velocity, &accel); - func_8002873C(globalCtx, &pos, &velocity, &accel, 100, 30, 15); + func_8002873C(play, &pos, &velocity, &accel, 100, 30, 15); } } /** * Used while the chest is falling (FALL types) */ -void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { +void EnBox_Fall(EnBox* this, PlayState* play) { f32 yDiff; this->alpha = 255; @@ -260,11 +260,11 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; EnBox_SetupAction(this, EnBox_WaitOpen); - OnePointCutscene_EndCutscene(globalCtx, this->unk_1AC); + OnePointCutscene_EndCutscene(play, this->unk_1AC); } Audio_PlaySoundGeneral(NA_SE_EV_COFFIN_CAP_BOUND, &this->dyna.actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); - 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) { @@ -274,31 +274,31 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) { +void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } if (this->unk_1A8 >= 0) { EnBox_SetupAction(this, EnBox_Fall); - this->unk_1AC = OnePointCutscene_Init(globalCtx, 4500, 9999, &this->dyna.actor, MAIN_CAM); - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->unk_1AC = OnePointCutscene_Init(play, 4500, 9999, &this->dyna.actor, MAIN_CAM); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } else if (this->unk_1A8 >= -11) { this->unk_1A8++; - } else if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + } else if (Flags_GetSwitch(play, this->switchFlag)) { this->unk_1A8++; } } // used for types 9, 10 -void func_809C9700(EnBox* this, GlobalContext* globalCtx) { +void func_809C9700(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &player->actor.world.pos) > 22500.0f) { @@ -313,14 +313,14 @@ void func_809C9700(EnBox* this, GlobalContext* globalCtx) { } if (this->unk_1FB == ENBOX_STATE_1) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->unk_1FB = ENBOX_STATE_2; - } else if (this->unk_1FB == ENBOX_STATE_2 && globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - if ((globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) || - (globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS && this->type == ENBOX_TYPE_10)) { + } else if (this->unk_1FB == ENBOX_STATE_2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) || + (play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS && this->type == ENBOX_TYPE_10)) { this->dyna.actor.flags &= ~ACTOR_FLAG_25; EnBox_SetupAction(this, EnBox_AppearInit); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_1A8 = 0; this->unk_1FB = ENBOX_STATE_0; } else { @@ -330,32 +330,32 @@ void func_809C9700(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_AppearOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) { +void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + if (Flags_GetSwitch(play, this->switchFlag)) { + OnePointCutscene_Attention(play, &this->dyna.actor); EnBox_SetupAction(this, EnBox_AppearInit); this->unk_1A8 = -30; } } -void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx) { +void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } - if (Flags_GetTempClear(globalCtx, this->dyna.actor.room) && !Player_InCsMode(globalCtx)) { - Flags_SetClear(globalCtx, this->dyna.actor.room); + if (Flags_GetTempClear(play, this->dyna.actor.room) && !Player_InCsMode(play)) { + Flags_SetClear(play, this->dyna.actor.room); EnBox_SetupAction(this, EnBox_AppearInit); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); - if (OnePointCutscene_CheckForCategory(globalCtx, this->dyna.actor.category)) { + OnePointCutscene_Attention(play, &this->dyna.actor); + if (OnePointCutscene_CheckForCategory(play, this->dyna.actor.category)) { this->unk_1A8 = 0; } else { this->unk_1A8 = -30; @@ -366,19 +366,19 @@ void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx) { /** * The chest is ready to appear, possibly waiting for camera/cutscene-related stuff to happen */ -void EnBox_AppearInit(EnBox* this, GlobalContext* globalCtx) { +void EnBox_AppearInit(EnBox* this, PlayState* play) { if (func_8005B198() == this->dyna.actor.category || this->unk_1A8 != 0) { EnBox_SetupAction(this, EnBox_AppearAnimation); this->unk_1A8 = 0; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, this->dyna.actor.home.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, 0, 0, 0, 0x0011); Audio_PlaySoundGeneral(NA_SE_EV_TRE_BOX_APPEAR, &this->dyna.actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } -void EnBox_AppearAnimation(EnBox* this, GlobalContext* globalCtx) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void EnBox_AppearAnimation(EnBox* this, PlayState* play) { + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); if (this->unk_1A8 < 0) { this->unk_1A8++; @@ -397,7 +397,7 @@ void EnBox_AppearAnimation(EnBox* this, GlobalContext* globalCtx) { /** * Chest is ready to be open */ -void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { +void EnBox_WaitOpen(EnBox* this, PlayState* play) { f32 frameCount; AnimationHeader* anim; s32 linkAge; @@ -421,7 +421,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { case ENBOX_TYPE_SWITCH_FLAG_FALL_SMALL: break; default: - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_DEMO_TRE_LGT, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_DEMO_TRE_LGT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 0xFFFF); @@ -429,61 +429,61 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { } } osSyncPrintf("Actor_Environment_Tbox_On() %d\n", this->dyna.actor.params & 0x1F); - Flags_SetTreasure(globalCtx, this->dyna.actor.params & 0x1F); + Flags_SetTreasure(play, this->dyna.actor.params & 0x1F); // treasure chest game rando if (Randomizer_GetSettingValue(RSK_SHUFFLE_CHEST_MINIGAME)) { - if (gSaveContext.n64ddFlag && globalCtx->sceneNum == 16 && (this->dyna.actor.params & 0x60) != 0x20) { + if (gSaveContext.n64ddFlag && play->sceneNum == 16 && (this->dyna.actor.params & 0x60) != 0x20) { if((this->dyna.actor.params & 0xF) < 2) { - Flags_SetCollectible(globalCtx, 0x1B); + Flags_SetCollectible(play, 0x1B); } if((this->dyna.actor.params & 0xF) >= 2 && (this->dyna.actor.params & 0xF) < 4) { - Flags_SetCollectible(globalCtx, 0x1C); + Flags_SetCollectible(play, 0x1C); } if((this->dyna.actor.params & 0xF) >= 4 && (this->dyna.actor.params & 0xF) < 6) { - Flags_SetCollectible(globalCtx, 0x1D); + Flags_SetCollectible(play, 0x1D); } if((this->dyna.actor.params & 0xF) >= 6 && (this->dyna.actor.params & 0xF) < 8) { - Flags_SetCollectible(globalCtx, 0x1E); + Flags_SetCollectible(play, 0x1E); } if((this->dyna.actor.params & 0xF) >= 8 && (this->dyna.actor.params & 0xF) < 10) { - Flags_SetCollectible(globalCtx, 0x1F); + Flags_SetCollectible(play, 0x1F); } } } } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); func_8002DBD0(&this->dyna.actor, &sp4C, &player->actor.world.pos); if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f && - Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) { - sItem = Randomizer_GetItemFromActor(this->dyna.actor.id, globalCtx->sceneNum, this->dyna.actor.params, this->dyna.actor.params >> 5 & 0x7F); + Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) { + sItem = Randomizer_GetItemFromActor(this->dyna.actor.id, play->sceneNum, this->dyna.actor.params, this->dyna.actor.params >> 5 & 0x7F); GetItemEntry blueRupee = ItemTable_RetrieveEntry(MOD_NONE, GI_RUPEE_BLUE); // RANDOTODO treasure chest game rando if (Randomizer_GetSettingValue(RSK_SHUFFLE_CHEST_MINIGAME)) { - if (gSaveContext.n64ddFlag && globalCtx->sceneNum == 16 && (this->dyna.actor.params & 0x60) != 0x20) { + if (gSaveContext.n64ddFlag && play->sceneNum == 16 && (this->dyna.actor.params & 0x60) != 0x20) { if((this->dyna.actor.params & 0xF) < 2) { - if(Flags_GetCollectible(globalCtx, 0x1B)) { + if(Flags_GetCollectible(play, 0x1B)) { sItem = blueRupee; } } if((this->dyna.actor.params & 0xF) >= 2 && (this->dyna.actor.params & 0xF) < 4) { - if(Flags_GetCollectible(globalCtx, 0x1C)) { + if(Flags_GetCollectible(play, 0x1C)) { sItem = blueRupee; } } if((this->dyna.actor.params & 0xF) >= 4 && (this->dyna.actor.params & 0xF) < 6) { - if(Flags_GetCollectible(globalCtx, 0x1D)) { + if(Flags_GetCollectible(play, 0x1D)) { sItem = blueRupee; } } if((this->dyna.actor.params & 0xF) >= 6 && (this->dyna.actor.params & 0xF) < 8) { - if(Flags_GetCollectible(globalCtx, 0x1E)) { + if(Flags_GetCollectible(play, 0x1E)) { sItem = blueRupee; } } if((this->dyna.actor.params & 0xF) >= 8 && (this->dyna.actor.params & 0xF) < 10) { - if(Flags_GetCollectible(globalCtx, 0x1F)) { + if(Flags_GetCollectible(play, 0x1F)) { sItem = blueRupee; } } @@ -494,12 +494,12 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { if (gSaveContext.n64ddFlag) { sItem.getItemId = 0 - sItem.getItemId; sItem.getItemFrom = ITEM_FROM_CHEST; - GiveItemEntryFromActorWithFixedRange(&this->dyna.actor, globalCtx, sItem); + GiveItemEntryFromActorWithFixedRange(&this->dyna.actor, play, sItem); } else { - func_8002F554(&this->dyna.actor, globalCtx, -(this->dyna.actor.params >> 5 & 0x7F)); + func_8002F554(&this->dyna.actor, play, -(this->dyna.actor.params >> 5 & 0x7F)); } } - if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { + if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) { EnBox_SetupAction(this, EnBox_Open); } } @@ -508,7 +508,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { /** * Plays an animation to its end, playing sounds at key points */ -void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { +void EnBox_Open(EnBox* this, PlayState* play) { u16 sfxId; this->dyna.actor.flags &= ~ACTOR_FLAG_7; @@ -551,7 +551,7 @@ void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_SpawnIceSmoke(EnBox* this, GlobalContext* globalCtx) { +void EnBox_SpawnIceSmoke(EnBox* this, PlayState* play) { Vec3f pos; Vec3f vel = { 0.0f, 1.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -578,25 +578,25 @@ void EnBox_SpawnIceSmoke(EnBox* this, GlobalContext* globalCtx) { vel.y = 1.8f; vel.z = f0 * 1.6f * Math_CosS(this->dyna.actor.world.rot.y); } - EffectSsIceSmoke_Spawn(globalCtx, &pos, &vel, &accel, 150); + EffectSsIceSmoke_Spawn(play, &pos, &vel, &accel, 150); } } -void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Update(Actor* thisx, PlayState* play) { EnBox* this = (EnBox*)thisx; - EnBox_UpdateSizeAndTexture(this, globalCtx); + EnBox_UpdateSizeAndTexture(this, play); if (this->movementFlags & ENBOX_MOVE_STICK_TO_GROUND) { this->movementFlags &= ~ENBOX_MOVE_STICK_TO_GROUND; - EnBox_ClipToGround(this, globalCtx); + EnBox_ClipToGround(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->movementFlags & ENBOX_MOVE_IMMOBILE)) { Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); } switch (this->type) { @@ -613,15 +613,15 @@ void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { if (((!gSaveContext.n64ddFlag && ((this->dyna.actor.params >> 5 & 0x7F) == 0x7C)) || (gSaveContext.n64ddFlag && ABS(sItem.getItemId) == RG_ICE_TRAP)) && this->actionFunc == EnBox_Open && this->skelanime.curFrame > 45 && - this->iceSmokeTimer < 100) EnBox_SpawnIceSmoke(this, globalCtx); + this->iceSmokeTimer < 100) EnBox_SpawnIceSmoke(this, play); } -void EnBox_UpdateSizeAndTexture(EnBox* this, GlobalContext* globalCtx) { +void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { EnBox_CreateExtraChestTextures(); int cvar = CVar_GetS32("gChestSizeAndTextureMatchesContents", 0); GetItemCategory getItemCategory; - if (globalCtx->sceneNum != SCENE_TAKARAYA && cvar > 0) { + if (play->sceneNum != SCENE_TAKARAYA && cvar > 0) { getItemCategory = this->getItemEntry.getItemCategory; // If they don't have bombchu's yet consider the bombchu item major if (this->getItemEntry.gid == GID_BOMBCHU && INV_CONTENT(ITEM_BOMBCHU) != ITEM_BOMBCHU) { @@ -637,7 +637,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, GlobalContext* globalCtx) { } } - if (globalCtx->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 3)) { + if (play->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 3)) { switch (getItemCategory) { case ITEM_CATEGORY_JUNK: case ITEM_CATEGORY_SMALL_KEY: @@ -665,7 +665,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, GlobalContext* globalCtx) { } } - if (globalCtx->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 2)) { + if (play->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 2)) { switch (getItemCategory) { case ITEM_CATEGORY_MAJOR: this->boxBodyDL = gGoldTreasureChestChestFrontDL; @@ -764,16 +764,16 @@ void EnBox_CreateExtraChestTextures() { hasCreatedRandoChestTextures = 1; } -void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnBox_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnBox* this = (EnBox*)thisx; s32 pad; if (limbIndex == 1) { - gSPMatrix((*gfx)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfx)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, this->boxBodyDL); } else if (limbIndex == 3) { - gSPMatrix((*gfx)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfx)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, this->boxLidDL); } @@ -828,10 +828,10 @@ Gfx* func_809CA518(GraphicsContext* gfxCtx) { return dList; } -void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Draw(Actor* thisx, PlayState* play) { EnBox* this = (EnBox*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); /* this->dyna.actor.flags & ACTOR_FLAG_7 is set by Init (if type is 4 or 6) @@ -842,22 +842,22 @@ void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6))) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_EmptyDList(globalCtx->state.gfxCtx)); - func_80093D18(globalCtx->state.gfxCtx); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, NULL, + gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_EmptyDList(play->state.gfxCtx)); + func_80093D18(play->state.gfxCtx); + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, NULL, EnBox_PostLimbDraw, this, POLY_OPA_DISP); } else if (this->alpha != 0) { gDPPipeSync(POLY_XLU_DISP++); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); if (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6) { - gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA518(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA518(play->state.gfxCtx)); } else { - gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA4A0(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA4A0(play->state.gfxCtx)); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, NULL, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, NULL, EnBox_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.h b/soh/src/overlays/actors/ovl_En_Box/z_en_box.h index 423f10e4d..2437ddd74 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -9,7 +9,7 @@ struct EnBox; -typedef void (*EnBoxActionFunc)(struct EnBox*, GlobalContext*); +typedef void (*EnBoxActionFunc)(struct EnBox*, PlayState*); typedef enum { /* diff --git a/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.c index 8b105fd30..1ef081fd8 100644 --- a/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -9,18 +9,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnBrob_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBrob_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBrob_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBrob_Init(Actor* thisx, PlayState* play); +void EnBrob_Destroy(Actor* thisx, PlayState* play); +void EnBrob_Update(Actor* thisx, PlayState* play); +void EnBrob_Draw(Actor* thisx, PlayState* play); -void func_809CADDC(EnBrob* this, GlobalContext* globalCtx); -void func_809CB054(EnBrob* this, GlobalContext* globalCtx); -void func_809CB114(EnBrob* this, GlobalContext* globalCtx); -void func_809CB218(EnBrob* this, GlobalContext* globalCtx); -void func_809CB2B8(EnBrob* this, GlobalContext* globalCtx); -void func_809CB354(EnBrob* this, GlobalContext* globalCtx); -void func_809CB458(EnBrob* this, GlobalContext* globalCtx); +void func_809CADDC(EnBrob* this, PlayState* play); +void func_809CB054(EnBrob* this, PlayState* play); +void func_809CB114(EnBrob* this, PlayState* play); +void func_809CB218(EnBrob* this, PlayState* play); +void func_809CB2B8(EnBrob* this, PlayState* play); +void func_809CB354(EnBrob* this, PlayState* play); +void func_809CB458(EnBrob* this, PlayState* play); const ActorInit En_Brob_InitVars = { ACTOR_EN_BROB, @@ -57,20 +57,20 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 0, 60, 120, MASS_IMMOVABLE }; -void EnBrob_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBrob_Init(Actor* thisx, PlayState* play) { s32 pad; EnBrob* this = (EnBrob*)thisx; CollisionHeader* colHeader = NULL; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_brob_Skel_0015D8, &object_brob_Anim_001750, + SkelAnime_InitFlex(play, &this->skelAnime, &object_brob_Skel_0015D8, &object_brob_Anim_001750, this->jointTable, this->morphTable, 10); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&object_brob_Col_001A70, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - Collider_InitCylinder(globalCtx, &this->colliders[0]); - Collider_SetCylinder(globalCtx, &this->colliders[0], &this->dyna.actor, &sCylinderInit); - Collider_InitCylinder(globalCtx, &this->colliders[1]); - Collider_SetCylinder(globalCtx, &this->colliders[1], &this->dyna.actor, &sCylinderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + Collider_InitCylinder(play, &this->colliders[0]); + Collider_SetCylinder(play, &this->colliders[0], &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliders[1]); + Collider_SetCylinder(play, &this->colliders[1], &this->dyna.actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); if (((thisx->params >> 8) & 0xFF) == 0) { Actor_SetScale(&this->dyna.actor, 0.01f); @@ -93,27 +93,27 @@ void EnBrob_Init(Actor* thisx, GlobalContext* globalCtx) { this->colliders[1].dim.yShift *= thisx->scale.y; this->actionFunc = NULL; thisx->flags &= ~ACTOR_FLAG_0; - func_809CADDC(this, globalCtx); + func_809CADDC(this, play); } -void EnBrob_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBrob_Destroy(Actor* thisx, PlayState* play) { EnBrob* this = (EnBrob*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->colliders[0]); - Collider_DestroyCylinder(globalCtx, &this->colliders[1]); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->colliders[0]); + Collider_DestroyCylinder(play, &this->colliders[1]); } -void func_809CADDC(EnBrob* this, GlobalContext* globalCtx) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void func_809CADDC(EnBrob* this, PlayState* play) { + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->timer = this->actionFunc == func_809CB2B8 ? 200 : 0; this->unk_1AE = 0; this->actionFunc = func_809CB054; } -void func_809CAE44(EnBrob* this, GlobalContext* globalCtx) { +void func_809CAE44(EnBrob* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &object_brob_Anim_001750); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_1AE = 1000; this->actionFunc = func_809CB114; } @@ -146,23 +146,23 @@ void func_809CB008(EnBrob* this) { this->actionFunc = func_809CB458; } -void func_809CB054(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB054(EnBrob* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { if (func_8004356C(&this->dyna) != 0) { - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); - func_809CAE44(this, globalCtx); + func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); + func_809CAE44(this, play); } else if (this->dyna.actor.xzDistToPlayer < 300.0f) { - func_809CAE44(this, globalCtx); + func_809CAE44(this, play); } } else if (this->timer >= 81) { this->dyna.actor.colorFilterTimer = 80; } } -void func_809CB114(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB114(EnBrob* this, PlayState* play) { f32 curFrame; if (SkelAnime_Update(&this->skelAnime)) { @@ -179,7 +179,7 @@ void func_809CB114(EnBrob* this, GlobalContext* globalCtx) { } } -void func_809CB218(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB218(EnBrob* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_BROB_WAVE); @@ -192,20 +192,20 @@ void func_809CB218(EnBrob* this, GlobalContext* globalCtx) { } } -void func_809CB2B8(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB2B8(EnBrob* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_809CADDC(this, globalCtx); + func_809CADDC(this, play); } else if (this->skelAnime.curFrame < 8.0f) { this->unk_1AE -= 1250.0f; } this->dyna.actor.colorFilterTimer = 0x50; } -void func_809CB354(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB354(EnBrob* this, PlayState* play) { f32 curFrame; if (SkelAnime_Update(&this->skelAnime)) { - func_809CADDC(this, globalCtx); + func_809CADDC(this, play); } else { curFrame = this->skelAnime.curFrame; if (curFrame < 8.0f) { @@ -218,7 +218,7 @@ void func_809CB354(EnBrob* this, GlobalContext* globalCtx) { } } -void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB458(EnBrob* this, PlayState* play) { Vec3f pos; f32 dist1; f32 dist2; @@ -229,7 +229,7 @@ void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { this->timer--; } - dist1 = globalCtx->gameplayFrames % 2 ? 0.0f : this->dyna.actor.scale.x * 5500.0f; + dist1 = play->gameplayFrames % 2 ? 0.0f : this->dyna.actor.scale.x * 5500.0f; dist2 = this->dyna.actor.scale.x * 5500.0f; for (i = 0; i < 4; i++) { @@ -246,7 +246,7 @@ void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { dist2 = -dist2; } pos.y = (((Rand_ZeroOne() * 15000.0f) + 1000.0f) * this->dyna.actor.scale.y) + this->dyna.actor.world.pos.y; - EffectSsLightning_Spawn(globalCtx, &pos, &primColor, &envColor, this->dyna.actor.scale.y * 8000.0f, + EffectSsLightning_Spawn(play, &pos, &primColor, &envColor, this->dyna.actor.scale.y * 8000.0f, Rand_ZeroOne() * 65536.0f, 4, 1); } @@ -255,8 +255,8 @@ void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { } } -void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBrob_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBrob* this = (EnBrob*)thisx; s32 i; s32 acHits[2]; @@ -278,7 +278,7 @@ void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->actionFunc == func_809CB114 && !(this->colliders[0].base.atFlags & AT_BOUNCED) && !(this->colliders[1].base.atFlags & AT_BOUNCED)) { - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); + func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); } else if (this->actionFunc != func_809CB114) { func_809CB008(this); } @@ -288,22 +288,22 @@ void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx2) { this->colliders[i].base.acFlags &= ~AC_HIT; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_809CB054 && this->actionFunc != func_809CB354) { if (this->actionFunc != func_809CB2B8) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders[1].base); if (this->actionFunc != func_809CB114) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders[1].base); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[1].base); } } -void EnBrob_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnBrob_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnBrob* this = (EnBrob*)thisx; MtxF mtx; @@ -319,11 +319,11 @@ void EnBrob_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnBrob_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBrob_Draw(Actor* thisx, PlayState* play) { EnBrob* this = (EnBrob*)thisx; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(0.0f, this->unk_1AE, 0.0f, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnBrob_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.h b/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.h index 4f71d489e..2e54a46d8 100644 --- a/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.h +++ b/soh/src/overlays/actors/ovl_En_Brob/z_en_brob.h @@ -6,7 +6,7 @@ struct EnBrob; -typedef void (*EnBrobActionFunc)(struct EnBrob* this, GlobalContext* globalCtx); +typedef void (*EnBrobActionFunc)(struct EnBrob* this, PlayState* play); typedef struct EnBrob { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 7c2b32ee6..84d602202 100644 --- a/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -3,14 +3,14 @@ #define FLAGS ACTOR_FLAG_0 -void EnBubble_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBubble_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBubble_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBubble_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBubble_Init(Actor* thisx, PlayState* play); +void EnBubble_Destroy(Actor* thisx, PlayState* play); +void EnBubble_Update(Actor* thisx, PlayState* play); +void EnBubble_Draw(Actor* thisx, PlayState* play); -void EnBubble_Wait(EnBubble* this, GlobalContext* globalCtx); -void EnBubble_Pop(EnBubble* this, GlobalContext* globalCtx); -void EnBubble_Regrow(EnBubble* this, GlobalContext* globalCtx); +void EnBubble_Wait(EnBubble* this, PlayState* play); +void EnBubble_Pop(EnBubble* this, PlayState* play); +void EnBubble_Regrow(EnBubble* this, PlayState* play); const ActorInit En_Bubble_InitVars = { ACTOR_EN_BUBBLE, @@ -114,14 +114,14 @@ u32 func_809CBCEC(EnBubble* this) { return 12; } -void EnBubble_DamagePlayer(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) { s32 damage = -this->colliderSphere.elements[0].info.toucher.damage; - globalCtx->damagePlayer(globalCtx, damage); - func_8002F7A0(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, damage); + func_8002F7A0(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); } -s32 EnBubble_Explosion(EnBubble* this, GlobalContext* globalCtx) { +s32 EnBubble_Explosion(EnBubble* this, PlayState* play) { u32 i; Vec3f effectAccel; Vec3f effectVel; @@ -144,10 +144,10 @@ s32 EnBubble_Explosion(EnBubble* this, GlobalContext* globalCtx) { effectVel.x = (Rand_ZeroOne() - 0.5f) * 7.0f; effectVel.y = Rand_ZeroOne() * 7.0f; effectVel.z = (Rand_ZeroOne() - 0.5f) * 7.0f; - EffectSsDtBubble_SpawnCustomColor(globalCtx, &effectPos, &effectVel, &effectAccel, &sEffectPrimColor, + EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &effectVel, &effectAccel, &sEffectPrimColor, &sEffectEnvColor, Rand_S16Offset(100, 50), 0x19, 0); } - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x50); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x50); this->actor.flags &= ~ACTOR_FLAG_0; return Rand_S16Offset(90, 60); } @@ -197,7 +197,7 @@ void EnBubble_Vec3fNormalize(Vec3f* vec) { } } -void EnBubble_Fly(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_Fly(EnBubble* this, PlayState* play) { CollisionPoly* sp94; Actor* bumpActor; Vec3f sp84; @@ -234,7 +234,7 @@ void EnBubble_Fly(EnBubble* this, GlobalContext* globalCtx) { sp6C.x += (sp54.x * 24.0f); sp6C.y += (sp54.y * 24.0f); sp6C.z += (sp54.z * 24.0f); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp78, &sp6C, &sp84, &sp94, true, true, true, false, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp78, &sp6C, &sp84, &sp94, true, true, true, false, &bgId)) { sp60.x = COLPOLY_GET_NORMAL(sp94->normal.x); sp60.y = COLPOLY_GET_NORMAL(sp94->normal.y); sp60.z = COLPOLY_GET_NORMAL(sp94->normal.z); @@ -299,13 +299,13 @@ u32 func_809CC648(EnBubble* this) { return true; } -u32 EnBubble_DetectPop(EnBubble* this, GlobalContext* globalCtx) { +u32 EnBubble_DetectPop(EnBubble* this, PlayState* play) { if (DECR(this->unk_208) != 0 || this->actionFunc == EnBubble_Pop) { return false; } if (this->colliderSphere.base.ocFlags2 & OC2_HIT_PLAYER) { this->colliderSphere.base.ocFlags2 &= ~OC2_HIT_PLAYER; - EnBubble_DamagePlayer(this, globalCtx); + EnBubble_DamagePlayer(this, play); this->unk_208 = 8; return true; } @@ -330,13 +330,13 @@ void func_809CC774(EnBubble* this) { this->colliderSphere.elements[1].dim = *dim; } -void EnBubble_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Init(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; u32 pad; ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f); - Collider_InitJntSph(globalCtx, &this->colliderSphere); - Collider_SetJntSph(globalCtx, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderSphereItems); + Collider_InitJntSph(play, &this->colliderSphere); + Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderSphereItems); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit2); this->actor.naviEnemyId = 0x16; this->bounceDirection.x = Rand_ZeroOne(); @@ -350,33 +350,33 @@ void EnBubble_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnBubble_Wait; } -void EnBubble_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Destroy(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; - Collider_DestroyJntSph(globalCtx, &this->colliderSphere); + Collider_DestroyJntSph(play, &this->colliderSphere); } -void EnBubble_Wait(EnBubble* this, GlobalContext* globalCtx) { - if (EnBubble_DetectPop(this, globalCtx)) { +void EnBubble_Wait(EnBubble* this, PlayState* play) { + if (EnBubble_DetectPop(this, play)) { this->explosionCountdown = func_809CBCBC(this); this->actionFunc = EnBubble_Pop; } else { - EnBubble_Fly(this, globalCtx); + EnBubble_Fly(this, play); this->actor.shape.yOffset = ((this->expansionHeight + 1.0f) * 16.0f); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } } -void EnBubble_Pop(EnBubble* this, GlobalContext* globalCtx) { - if (EnBubble_Explosion(this, globalCtx) >= 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); +void EnBubble_Pop(EnBubble* this, PlayState* play) { + if (EnBubble_Explosion(this, play) >= 0) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); Actor_Kill(&this->actor); } } // unused -void EnBubble_Disappear(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_Disappear(EnBubble* this, PlayState* play) { s32 temp_v0; temp_v0 = func_809CBFD4(this); @@ -388,46 +388,46 @@ void EnBubble_Disappear(EnBubble* this, GlobalContext* globalCtx) { } // unused -void EnBubble_Regrow(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_Regrow(EnBubble* this, PlayState* play) { if (func_809CC020(this)) { this->actionFunc = EnBubble_Wait; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } -void EnBubble_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Update(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 16.0f, 16.0f, 0.0f, 7); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 16.0f, 16.0f, 0.0f, 7); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->actor.shape.yOffset); } -void EnBubble_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Draw(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; u32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc != EnBubble_Disappear) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Math_SmoothStepToF(&this->graphicRotSpeed, 16.0f, 0.2f, 1000.0f, 0.0f); Math_SmoothStepToF(&this->graphicEccentricity, 0.08f, 0.2f, 1000.0f, 0.0f); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->expansionWidth + 1.0f, this->expansionHeight + 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateZ(((f32)globalCtx->state.frames * (M_PI / 180.0f)) * this->graphicRotSpeed, MTXMODE_APPLY); + Matrix_RotateZ(((f32)play->state.frames * (M_PI / 180.0f)) * this->graphicRotSpeed, MTXMODE_APPLY); Matrix_Scale(this->graphicEccentricity + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateZ((-(f32)globalCtx->state.frames * (M_PI / 180.0f)) * this->graphicRotSpeed, MTXMODE_APPLY); + Matrix_RotateZ((-(f32)play->state.frames * (M_PI / 180.0f)) * this->graphicRotSpeed, 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++, gBubbleDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->actionFunc != EnBubble_Disappear) { this->actor.shape.shadowScale = (f32)((this->expansionWidth + 1.0f) * 0.2f); diff --git a/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h b/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h index 37594d694..938d1b2fd 100644 --- a/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h +++ b/soh/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h @@ -6,7 +6,7 @@ struct EnBubble; -typedef void (*EnBubbleActionFunc)(struct EnBubble*, GlobalContext*); +typedef void (*EnBubbleActionFunc)(struct EnBubble*, PlayState*); typedef struct EnBubble { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.c index e42aeceed..6368ef19c 100644 --- a/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -11,19 +11,19 @@ #define FLAGS 0 -void EnButte_Init(Actor* thisx, GlobalContext* globalCtx); -void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnButte_Update(Actor* thisx, GlobalContext* globalCtx); -void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnButte_Init(Actor* thisx, PlayState* play); +void EnButte_Destroy(Actor* thisx, PlayState* play); +void EnButte_Update(Actor* thisx, PlayState* play); +void EnButte_Draw(Actor* thisx, PlayState* play); void EnButte_SetupFlyAround(EnButte* this); -void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx); +void EnButte_FlyAround(EnButte* this, PlayState* play); void EnButte_SetupFollowLink(EnButte* this); -void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx); +void EnButte_FollowLink(EnButte* this, PlayState* play); void EnButte_SetupTransformIntoFairy(EnButte* this); -void EnButte_TransformIntoFairy(EnButte* this, GlobalContext* globalCtx); +void EnButte_TransformIntoFairy(EnButte* this, PlayState* play); void EnButte_SetupWaitToDie(EnButte* this); -void EnButte_WaitToDie(EnButte* this, GlobalContext* globalCtx); +void EnButte_WaitToDie(EnButte* this, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[] = { { { @@ -109,20 +109,20 @@ void EnButte_UpdateTransformationEffect(void) { sTransformationEffectAlpha += 4000; } -void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) { +void EnButte_DrawTransformationEffect(EnButte* this, PlayState* play) { static Vec3f D_809CE3C4 = { 0.0f, 0.0f, -3.0f }; Vec3f sp5C; s32 alpha; Vec3s camDir; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093C14(globalCtx->state.gfxCtx); + func_80093C14(play->state.gfxCtx); alpha = Math_SinS(sTransformationEffectAlpha) * 250; alpha = CLAMP(alpha, 0, 255); - Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(globalCtx)); + Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(play)); Matrix_RotateY(camDir.y * (M_PI / 0x8000), MTXMODE_NEW); Matrix_RotateX(camDir.x * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(camDir.z * (M_PI / 0x8000), MTXMODE_APPLY); @@ -130,13 +130,13 @@ void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(this->actor.focus.pos.x + sp5C.x, this->actor.focus.pos.y + sp5C.y, this->actor.focus.pos.z + sp5C.z, &camDir); Matrix_Scale(sTransformationEffectScale, sTransformationEffectScale, sTransformationEffectScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, alpha); gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 210, 255); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffFlash1DL)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static InitChainEntry sInitChain[] = { @@ -146,7 +146,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_STOP), }; -void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Init(Actor* thisx, PlayState* play) { EnButte* this = (EnButte*)thisx; if (this->actor.params == -1) { @@ -159,10 +159,10 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.uncullZoneScale = 200.0f; } - SkelAnime_Init(globalCtx, &this->skelAnime, &gButterflySkel, &gButterflyAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gButterflySkel, &gButterflyAnim, this->jointTable, this->morphTable, 8); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->colliderItems); this->actor.colChkInfo.mass = 0; this->unk_25C = Rand_ZeroOne() * 0xFFFF; this->unk_25E = Rand_ZeroOne() * 0xFFFF; @@ -175,11 +175,11 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(field keep 蝶)(%x)(arg_data 0x%04x)\n", this, this->actor.params); } -void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnButte_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnButte* this = (EnButte*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_809CD56C(EnButte* this) { @@ -213,10 +213,10 @@ void EnButte_SetupFlyAround(EnButte* this) { this->actionFunc = EnButte_FlyAround; } -void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) { +void EnButte_FlyAround(EnButte* this, PlayState* play) { EnButteFlightParams* flightParams = &sFlyAroundParams[this->flightParamsIdx]; s16 yaw; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distSqFromHome; f32 maxDistSqFromHome; f32 minAnimSpeed; @@ -289,10 +289,10 @@ void EnButte_SetupFollowLink(EnButte* this) { this->actionFunc = EnButte_FollowLink; } -void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) { +void EnButte_FollowLink(EnButte* this, PlayState* play) { static s32 D_809CE410 = 1500; EnButteFlightParams* flightParams = &sFollowLinkParams[this->flightParamsIdx]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distSqFromHome; Vec3f swordTip; f32 animSpeed; @@ -312,7 +312,7 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &swordTip) + (s16)(Rand_ZeroOne() * D_809CE410); if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000) != 0) { - if (globalCtx->gameplayFrames % 2) { + if (play->gameplayFrames % 2) { this->actor.world.rot.y += (s16)(sinf(this->unk_25C) * 60.0f); } } else { @@ -356,14 +356,14 @@ void EnButte_SetupTransformIntoFairy(EnButte* this) { this->actionFunc = EnButte_TransformIntoFairy; } -void EnButte_TransformIntoFairy(EnButte* this, GlobalContext* globalCtx) { +void EnButte_TransformIntoFairy(EnButte* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnButte_UpdateTransformationEffect(); if (this->timer == 5) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY); } else if (this->timer == 4) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, FAIRY_HEAL_TIMED); this->drawSkelAnime = false; } else if (this->timer <= 0) { @@ -377,13 +377,13 @@ void EnButte_SetupWaitToDie(EnButte* this) { this->actor.draw = NULL; } -void EnButte_WaitToDie(EnButte* this, GlobalContext* globalCtx) { +void EnButte_WaitToDie(EnButte* this, PlayState* play) { if (this->timer <= 0) { Actor_Kill(&this->actor); } } -void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Update(Actor* thisx, PlayState* play) { EnButte* this = (EnButte*)thisx; if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) { @@ -399,7 +399,7 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_260 += 0x600; if ((this->actor.params & 1) == 1) { - if (GET_PLAYER(globalCtx)->swordState == 0) { + if (GET_PLAYER(play)->swordState == 0) { if (this->swordDownTimer > 0) { this->swordDownTimer--; } @@ -408,28 +408,28 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { Actor_MoveForward(&this->actor); Math_StepToF(&this->actor.world.pos.y, this->posYTarget, 0.6f); if (this->actor.xyzDistToPlayerSq < 5000.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, this->actor.shape.yOffset * this->actor.scale.y); } } -void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Draw(Actor* thisx, PlayState* play) { EnButte* this = (EnButte*)thisx; if (this->drawSkelAnime) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); Collider_UpdateSpheres(0, &this->collider); } if (((this->actor.params & 1) == 1) && (this->actionFunc == EnButte_TransformIntoFairy)) { - EnButte_DrawTransformationEffect(this, globalCtx); + EnButte_DrawTransformationEffect(this, play); } } diff --git a/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.h b/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.h index 9443e5081..1a34747db 100644 --- a/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/soh/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -6,7 +6,7 @@ struct EnButte; -typedef void (*EnButteActionFunc)(struct EnButte*, GlobalContext*); +typedef void (*EnButteActionFunc)(struct EnButte*, PlayState*); typedef struct EnButte { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c index bf1d125dc..2b303d7ec 100644 --- a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -10,29 +10,29 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnBw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBw_Init(Actor* thisx, PlayState* play); +void EnBw_Destroy(Actor* thisx, PlayState* play); +void EnBw_Update(Actor* thisx, PlayState* play); +void EnBw_Draw(Actor* thisx, PlayState* play); void EnBw_Reset(void); -void func_809CE884(EnBw* this, GlobalContext* globalCtx); +void func_809CE884(EnBw* this, PlayState* play); void func_809CE9A8(EnBw* this); -void func_809CEA24(EnBw* this, GlobalContext* globalCtx); +void func_809CEA24(EnBw* this, PlayState* play); void func_809CF72C(EnBw* this); -void func_809CF7AC(EnBw* this, GlobalContext* globalCtx); +void func_809CF7AC(EnBw* this, PlayState* play); void func_809CF8F0(EnBw* this); -void func_809CF984(EnBw* this, GlobalContext* globalCtx); +void func_809CF984(EnBw* this, PlayState* play); void func_809CFBA8(EnBw* this); -void func_809CFC4C(EnBw* this, GlobalContext* globalCtx); +void func_809CFC4C(EnBw* this, PlayState* play); void func_809CFF10(EnBw* this); -void func_809CFF98(EnBw* this, GlobalContext* globalCtx); +void func_809CFF98(EnBw* this, PlayState* play); void func_809D00F4(EnBw* this); -void func_809D014C(EnBw* this, GlobalContext* globalCtx); +void func_809D014C(EnBw* this, PlayState* play); void func_809D01CC(EnBw* this); -void func_809D0268(EnBw* this, GlobalContext* globalCtx); +void func_809D0268(EnBw* this, PlayState* play); void func_809D03CC(EnBw* this); -void func_809D0424(EnBw* this, GlobalContext* globalCtx); +void func_809D0424(EnBw* this, PlayState* play); const ActorInit En_Bw_InitVars = { ACTOR_EN_BW, @@ -128,13 +128,13 @@ void EnBw_SetupAction(EnBw* this, EnBwActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBw_Init(Actor* thisx, PlayState* play) { EnBw* this = (EnBw*)thisx; Actor_SetScale(&this->actor, 0.012999999f); this->actor.naviEnemyId = 0x23; this->actor.gravity = -2.0f; - SkelAnime_Init(globalCtx, &this->skelAnime, &object_bw_Skel_0020F0, &object_bw_Anim_000228, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_bw_Skel_0020F0, &object_bw_Anim_000228, this->jointTable, this->morphTable, 12); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); this->actor.colChkInfo.damageTable = &sDamageTable; @@ -146,24 +146,24 @@ void EnBw_Init(Actor* thisx, GlobalContext* globalCtx) { this->color1.g = this->color1.b = 0; this->unk_248 = 0.6f; this->unk_221 = 3; - Collider_InitCylinder(globalCtx, &this->collider1); + Collider_InitCylinder(play, &this->collider1); //! this->collider2 should have Init called on it, but it doesn't matter since the heap is zeroed before use. - Collider_SetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_SetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_SetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); this->unk_236 = this->actor.world.rot.y; this->actor.params = sSlugGroup; sSlugGroup = (sSlugGroup + 1) & 3; } -void EnBw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBw_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnBw* this = (EnBw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } -void func_809CE884(EnBw* this, GlobalContext* globalCtx) { +void func_809CE884(EnBw* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); this->unk_222 -= 250; this->actor.scale.x = 0.013f + Math_SinF(this->unk_222 * 0.001f) * 0.0069999998f; @@ -184,7 +184,7 @@ void func_809CE9A8(EnBw* this) { EnBw_SetupAction(this, func_809CEA24); } -void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { +void func_809CEA24(EnBw* this, PlayState* play) { CollisionPoly* sp74 = NULL; Vec3f sp68; u32 sp64 = 0; @@ -192,8 +192,8 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { s16 sp60; f32 sp5C; f32 sp58; - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); this->unk_244 = this->unk_250 + 0.1f; @@ -223,8 +223,8 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { sp60 = ABS(sp58) * 85.0f; this->color1.g = sp60; } - if ((((globalCtx->gameplayFrames % 4) == (u32)this->actor.params) && (this->actor.speedXZ != 0.0f) && - (sp64 = BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_264, &sp68, &sp74, 1, 0, 0, + if ((((play->gameplayFrames % 4) == (u32)this->actor.params) && (this->actor.speedXZ != 0.0f) && + (sp64 = BgCheck_AnyLineTest2(&play->colCtx, &this->actor.world.pos, &this->unk_264, &sp68, &sp74, 1, 0, 0, 1))) || (this->unk_222 == 0)) { if (sp74 != NULL) { @@ -234,10 +234,10 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { sp62 = this->actor.world.rot.y + 0x8000; } if ((this->unk_236 != sp62) || (sp64 == 0)) { - if (BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->unk_270, &this->unk_288, &sp68, &sp74, 1, 0, 0, 1)) { + if (BgCheck_AnyLineTest2(&play->colCtx, &this->unk_270, &this->unk_288, &sp68, &sp74, 1, 0, 0, 1)) { sp64 |= 2; } - if (BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->unk_270, &this->unk_27C, &sp68, &sp74, 1, 0, 0, 1)) { + if (BgCheck_AnyLineTest2(&play->colCtx, &this->unk_270, &this->unk_27C, &sp68, &sp74, 1, 0, 0, 1)) { sp64 |= 4; } switch (sp64) { @@ -245,7 +245,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { this->unk_236 += this->unk_238; case 1: if (this->unk_221 == 3) { - if (globalCtx->gameplayFrames & 2) { + if (play->gameplayFrames & 2) { this->unk_238 = 0x4000; } else { this->unk_238 = -0x4000; @@ -285,7 +285,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { sp64 = 1; this->unk_236 = this->actor.wallYaw; if (this->unk_221 == 3) { - if (globalCtx->gameplayFrames & 0x20) { + if (play->gameplayFrames & 0x20) { this->unk_238 = 0x4000; } else { this->unk_238 = -0x4000; @@ -303,7 +303,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { } } } else if (this->unk_221 == 0) { - sp64 = BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp68, + sp64 = BgCheck_AnyLineTest2(&play->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp68, &sp74, 1, 0, 0, 1); if (sp64 != 0) { sp74 = SEGMENTED_TO_VIRTUAL(sp74); @@ -324,7 +324,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { this->unk_224--; } if ((this->unk_234 == 0) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, 50.0f, this->unk_236 + this->unk_238)) { + !Actor_TestFloorInDirection(&this->actor, play, 50.0f, this->unk_236 + this->unk_238)) { if (this->unk_238 != 0x4000) { this->unk_238 = 0x4000; } else { @@ -349,7 +349,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { this->actor.speedXZ * 1000.0f, 0); if ((this->actor.xzDistToPlayer < 90.0f) && (this->actor.yDistToPlayer < 50.0f) && Actor_IsFacingPlayer(&this->actor, 0x1554) && - Actor_TestFloorInDirection(&this->actor, globalCtx, 71.24802f, this->actor.yawTowardsPlayer)) { + Actor_TestFloorInDirection(&this->actor, play, 71.24802f, this->actor.yawTowardsPlayer)) { func_809CF8F0(this); } } else { @@ -402,7 +402,7 @@ void func_809CF72C(EnBw* this) { EnBw_SetupAction(this, func_809CF7AC); } -void func_809CF7AC(EnBw* this, GlobalContext* globalCtx) { +void func_809CF7AC(EnBw* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_222 > 0) { this->unk_222--; @@ -434,8 +434,8 @@ void func_809CF8F0(EnBw* this) { EnBw_SetupAction(this, func_809CF984); } -void func_809CF984(EnBw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809CF984(EnBw* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 floorPolyType; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -453,12 +453,12 @@ void func_809CF984(EnBw* this, GlobalContext* globalCtx) { } SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 3) { - floorPolyType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + floorPolyType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorPolyType == 2) || (floorPolyType == 3) || (floorPolyType == 9)) { Actor_Kill(&this->actor); return; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 3000; this->actor.flags &= ~ACTOR_FLAG_24; this->actor.speedXZ = 0.0f; @@ -480,19 +480,19 @@ void func_809CFBA8(EnBw* this) { EnBw_SetupAction(this, func_809CFC4C); } -void func_809CFC4C(EnBw* this, GlobalContext* globalCtx) { +void func_809CFC4C(EnBw* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0x7FFF, 1, 0xFA0, 0); Math_SmoothStepToF(&this->unk_248, 0.0f, 1.0f, 0.05f, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 3) { - if ((globalCtx->gameplayFrames % 0x80) == 0) { + if ((play->gameplayFrames % 0x80) == 0) { this->unk_25C = (Rand_ZeroOne() * 0.25f) + 0.7f; } this->unk_221 = 4; this->unk_258 += this->unk_25C; Math_SmoothStepToF(&this->unk_260, 0.075f, 1.0f, 0.005f, 0.0f); if (this->actor.bgCheckFlags & 2) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } if (this->unk_224 != 0) { @@ -537,12 +537,12 @@ void func_809CFF10(EnBw* this) { EnBw_SetupAction(this, func_809CFF98); } -void func_809CFF98(EnBw* this, GlobalContext* globalCtx) { +void func_809CFF98(EnBw* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0xFA0, 0); Math_SmoothStepToF(&this->unk_248, 0.6f, 1.0f, 0.05f, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 3) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 0xBB8; this->unk_250 = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); @@ -577,7 +577,7 @@ void func_809D00F4(EnBw* this) { EnBw_SetupAction(this, func_809D014C); } -void func_809D014C(EnBw* this, GlobalContext* globalCtx) { +void func_809D014C(EnBw* this, PlayState* play) { if (this->unk_230) { this->actor.scale.x += 0.0002f; this->actor.scale.y -= 0.0002f; @@ -602,7 +602,7 @@ void func_809D01CC(EnBw* this) { EnBw_SetupAction(this, func_809D0268); } -void func_809D0268(EnBw* this, GlobalContext* globalCtx) { +void func_809D0268(EnBw* this, PlayState* play) { this->color1.r -= 1; this->color1.g += 4; this->color1.b += 5; @@ -616,7 +616,7 @@ void func_809D0268(EnBw* this, GlobalContext* globalCtx) { this->color1.b = 230; } if (this->actor.colorFilterParams & 0x4000) { - if ((globalCtx->gameplayFrames % 0x80) == 0) { + if ((play->gameplayFrames % 0x80) == 0) { this->unk_25C = 0.5f + Rand_ZeroOne() * 0.25f; } this->unk_258 += this->unk_25C; @@ -644,7 +644,7 @@ void func_809D03CC(EnBw* this) { EnBw_SetupAction(this, func_809D0424); } -void func_809D0424(EnBw* this, GlobalContext* globalCtx) { +void func_809D0424(EnBw* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { this->unk_23C = 0; if (this->actor.colChkInfo.health != 0) { @@ -662,24 +662,24 @@ void func_809D0424(EnBw* this, GlobalContext* globalCtx) { func_809CFF10(this); } } else { - if (func_800355E4(globalCtx, &this->collider2.base)) { + if (func_800355E4(play, &this->collider2.base)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); } else { this->unk_230 = 1; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); func_809D00F4(this); } } } -void func_809D0584(EnBw* this, GlobalContext* globalCtx) { +void func_809D0584(EnBw* this, PlayState* play) { if ((this->actor.bgCheckFlags & 0x10) && (this->actor.bgCheckFlags & 1)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); func_809D00F4(this); } else { if (this->collider2.base.acFlags & AC_HIT) { @@ -704,15 +704,15 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { if (((this->unk_221 == 1) || (this->unk_221 == 4)) && (this->actor.colChkInfo.health == 0)) { if (this->unk_220 != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); - if (func_800355E4(globalCtx, &this->collider2.base)) { + if (func_800355E4(play, &this->collider2.base)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); } else { this->unk_230 = 1; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); func_809D00F4(this); } } else if ((this->unk_220 != 1) && (this->unk_220 != 6)) { @@ -724,7 +724,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { this->unk_248 = 0.0f; } } - if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xzDistToPlayer <= 400.0f) && + if ((play->actorCtx.unk_02 != 0) && (this->actor.xzDistToPlayer <= 400.0f) && (this->actor.bgCheckFlags & 1)) { if (this->unk_220 == 5) { this->unk_23C = 0; @@ -737,8 +737,8 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { } } -void EnBw_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBw_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBw* this = (EnBw*)thisx; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -748,24 +748,24 @@ void EnBw_Update(Actor* thisx, GlobalContext* globalCtx2) { Color_RGBA8 sp48 = { 0, 0, 0, 255 }; Color_RGBA8 sp44 = { 0, 0, 0, 220 }; - func_809D0584(this, globalCtx); + func_809D0584(this, play); if (thisx->colChkInfo.damageEffect != 6) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_23C == 0) { this->unk_23A = (this->unk_23A + 4) & 0x7F; } - if ((globalCtx->gameplayFrames & this->unk_221) == 0) { + if ((play->gameplayFrames & this->unk_221) == 0) { accel.y = -3.0f; velocity.x = Rand_CenteredFloat(this->unk_248 * 24.0f); velocity.y = this->unk_248 * 30.0f; velocity.z = Rand_CenteredFloat(this->unk_248 * 24.0f); accel.x = velocity.x * -0.075f; accel.z = velocity.z * -0.075f; - func_8002836C(globalCtx, &thisx->world.pos, &velocity, &accel, &sp50, &sp4C, 0x3C, 0, 0x14); + func_8002836C(play, &thisx->world.pos, &velocity, &accel, &sp50, &sp4C, 0x3C, 0, 0x14); } if (this->unk_248 <= 0.4f) { this->collider1.info.toucher.effect = 0; - if (((globalCtx->gameplayFrames & 1) == 0) && (this->unk_220 < 5) && (this->unk_23C == 0)) { + if (((play->gameplayFrames & 1) == 0) && (this->unk_220 < 5) && (this->unk_23C == 0)) { accel.y = -0.1f; velocity.x = Rand_CenteredFloat(4.0f); velocity.y = Rand_CenteredFloat(2.0f) + 6.0f; @@ -780,40 +780,40 @@ void EnBw_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { sp44.a = 0; } - func_8002836C(globalCtx, &thisx->world.pos, &velocity, &accel, &sp48, &sp44, 0xB4, 0x28, + func_8002836C(play, &thisx->world.pos, &velocity, &accel, &sp48, &sp44, 0xB4, 0x28, 20.0f - (this->unk_248 * 40.0f)); } } else { this->collider1.info.toucher.effect = 1; } - this->unk_234 = Actor_TestFloorInDirection(thisx, globalCtx, 50.0f, thisx->world.rot.y); + this->unk_234 = Actor_TestFloorInDirection(thisx, play, 50.0f, thisx->world.rot.y); if ((this->unk_220 == 4) || (this->unk_220 == 6) || (this->unk_220 == 5) || (this->unk_220 == 1) || (this->unk_234 != 0)) { Actor_MoveForward(thisx); } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 20.0f, 30.0f, 21.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 30.0f, 21.0f, 0x1F); } Collider_UpdateCylinder(thisx, &this->collider2); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); if ((this->unk_220 != 0) && ((thisx->colorFilterTimer == 0) || !(thisx->colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); } if ((this->unk_221 != 1) && (this->unk_220 < 5) && (this->unk_248 > 0.4f)) { Collider_UpdateCylinder(thisx, &this->collider1); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } thisx->focus.pos = thisx->world.pos; thisx->focus.pos.y += 5.0f; } -s32 EnBw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnBw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnBw* this = (EnBw*)thisx; if (limbIndex == 1) { gSPSegment((*gfx)++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_23A, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_23A, 0x20, 0x20)); if ((this->unk_220 == 1) || (this->unk_220 == 5)) { Matrix_Push(); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); @@ -824,7 +824,7 @@ s32 EnBw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Matrix_RotateZ(-(this->unk_258 * 0.1f), MTXMODE_APPLY); Matrix_RotateY(-(this->unk_258 * 0.13f), MTXMODE_APPLY); Matrix_RotateX(-(this->unk_258 * 0.115f), MTXMODE_APPLY); - gSPMatrix((*gfx)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfx)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, *dList); Matrix_Pop(); @@ -839,32 +839,32 @@ static Vec3f sIceOffsets[] = { { 10.0f, 0.0f, -15.0f }, { 0.0f, 10.0f, 25.0f }, { -10.0f, 0.0f, 15.0f }, { -10.0f, 0.0f, -15.0f }, }; -void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnBw_Draw(Actor* thisx, PlayState* play2) { Vec3f spAC = { 0.0f, 0.0f, 0.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBw* this = (EnBw*)thisx; Vec3f icePos; s32 iceIndex; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->color1.a == 0xFF) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, this->color1.r, this->color1.g, this->color1.b, this->color1.a); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBw_OverrideLimbDraw, NULL, this, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 0, 0, this->color1.a); gDPSetEnvColor(POLY_XLU_DISP++, this->color1.r, this->color1.g, this->color1.b, this->color1.a); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBw_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); } - if (((globalCtx->gameplayFrames + 1) % 4) == (u32)thisx->params) { + if (((play->gameplayFrames + 1) % 4) == (u32)thisx->params) { spAC.z = thisx->scale.z * 375000.0f; Matrix_MultVec3f(&spAC, &this->unk_264); spAC.z = thisx->scale.z * 150000.0f; @@ -877,16 +877,16 @@ void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + ((thisx->scale.y - 0.013f) * 1000.0f), thisx->world.pos.z, MTXMODE_NEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (globalCtx->gameplayFrames * -20) % 0x200, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + (play->gameplayFrames * -20) % 0x200, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); Matrix_Scale(this->unk_248 * 0.01f, this->unk_248 * 0.01f, this->unk_248 * 0.01f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, gEffFire1DL); @@ -899,10 +899,10 @@ void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { icePos.x = sIceOffsets[iceIndex].x + thisx->world.pos.x; icePos.y = sIceOffsets[iceIndex].y + thisx->world.pos.y; icePos.z = sIceOffsets[iceIndex].z + thisx->world.pos.z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, 0xFF, 1.3f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, 0xFF, 1.3f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnBw_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.h b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.h index 3f0ae5ea9..ffdc3bba4 100644 --- a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.h +++ b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.h @@ -5,7 +5,7 @@ #include "global.h" struct EnBw; -typedef void (*EnBwActionFunc)(struct EnBw*, GlobalContext*); +typedef void (*EnBwActionFunc)(struct EnBw*, PlayState*); typedef struct EnBw { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 7c9749dd3..b6969d743 100644 --- a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -10,10 +10,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnBx_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBx_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBx_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBx_Init(Actor* thisx, PlayState* play); +void EnBx_Destroy(Actor* thisx, PlayState* play); +void EnBx_Update(Actor* thisx, PlayState* play); +void EnBx_Draw(Actor* thisx, PlayState* play); const ActorInit En_Bx_InitVars = { ACTOR_EN_BX, @@ -68,7 +68,7 @@ static ColliderQuadInit sQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -void EnBx_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Init(Actor* thisx, PlayState* play) { EnBx* this = (EnBx*)thisx; Vec3f sp48 = { 0.015f, 0.015f, 0.015f }; Vec3f sp3C = { 0.0f, 0.0f, 0.0f }; @@ -93,27 +93,27 @@ void EnBx_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 48.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - Collider_InitQuad(globalCtx, &this->colliderQuad); - Collider_SetQuad(globalCtx, &this->colliderQuad, &this->actor, &sQuadInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + Collider_InitQuad(play, &this->colliderQuad); + Collider_SetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; this->unk_14C = 0; thisx->uncullZoneDownward = 2000.0f; - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) { Actor_Kill(&this->actor); } thisx->params &= 0xFF; this->epoch++; } -void EnBx_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Destroy(Actor* thisx, PlayState* play) { EnBx* this = (EnBx*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_809D1D0C(Actor* thisx, GlobalContext* globalCtx) { +void func_809D1D0C(Actor* thisx, PlayState* play) { Vec3f sp5C = { 8000.0f, 15000.0f, 2500.0f }; Vec3f sp50 = { 8000.0f, 10000.0f, 2500.0f }; static Vec3f D_809D2540 = { -8000.0f, 15000.0f, 2500.0f }; @@ -130,9 +130,9 @@ void func_809D1D0C(Actor* thisx, GlobalContext* globalCtx) { &this->colliderQuad.dim.quad[1]); } -void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Update(Actor* thisx, PlayState* play) { EnBx* this = (EnBx*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; s16 tmp32; s32 tmp33; @@ -152,10 +152,10 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -4); + play->damagePlayer(play, -4); } } - func_8002F71C(globalCtx, &this->actor, 6.0f, tmp32, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, tmp32, 6.0f); player->invincibilityTimer = tmp33; } @@ -182,7 +182,7 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(5.0f) + thisx->world.pos.x; pos.y = Rand_CenteredFloat(30.0f) + thisx->world.pos.y + 170.0f; pos.z = Rand_CenteredFloat(5.0f) + thisx->world.pos.z; - EffectSsLightning_Spawn(globalCtx, &pos, &primColor, &envColor, 230, yaw, 6, 0); + EffectSsLightning_Spawn(play, &pos, &primColor, &envColor, 230, yaw, 6, 0); } } @@ -190,14 +190,14 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { } thisx->focus.pos = thisx->world.pos; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); if (thisx->params & 0x80) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderQuad.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); } } -void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Draw(Actor* thisx, PlayState* play) { static void* D_809D2560[] = { object_bxa_Tex_0024F0, object_bxa_Tex_0027F0, @@ -205,23 +205,23 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnBx* this = (EnBx*)thisx; s32 pad; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Mtx)); s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, mtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[this->actor.params & 0x7F])); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (globalCtx->gameplayFrames * -10) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (play->gameplayFrames * -10) % 128, 32, 32)); - 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); if (this->actor.params & 0x80) { - func_809D1D0C(&this->actor, globalCtx); + func_809D1D0C(&this->actor, play); } this->unk_14E -= 0xBB8; @@ -249,5 +249,5 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, object_bxa_DL_0022F0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.c b/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.c index c729fcc76..9b97e52c4 100644 --- a/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -16,13 +16,13 @@ typedef enum { /* 1 */ CHEST_RIGHT } ChangerChestSide; -void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx); -void EnChanger_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnChanger_Update(Actor* thisx, GlobalContext* globalCtx); +void EnChanger_Init(Actor* thisx, PlayState* play); +void EnChanger_Destroy(Actor* thisx, PlayState* play); +void EnChanger_Update(Actor* thisx, PlayState* play); -void EnChanger_Wait(EnChanger* this, GlobalContext* globalCtx); -void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx); -void EnChanger_SetHeartPieceFlag(EnChanger* this, GlobalContext* globalCtx); +void EnChanger_Wait(EnChanger* this, PlayState* play); +void EnChanger_OpenChests(EnChanger* this, PlayState* play); +void EnChanger_SetHeartPieceFlag(EnChanger* this, PlayState* play); const ActorInit En_Changer_InitVars = { ACTOR_EN_CHANGER, @@ -62,12 +62,12 @@ static s32 sItemEtcTypes[] = { static s32 sTreasureFlags[] = { 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000A }; -void EnChanger_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnChanger_Destroy(Actor* thisx, PlayState* play) { } -void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnChanger_Init(Actor* thisx, PlayState* play2) { EnChanger* this = (EnChanger*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 leftChestParams; s16 rightChestParams; s16 rewardChestParams; @@ -78,19 +78,19 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { s16 new_var; s32 rewardParams; - minigameRoomNum = globalCtx->roomCtx.curRoom.num - 1; + minigameRoomNum = play->roomCtx.curRoom.num - 1; if (minigameRoomNum < 0) { minigameRoomNum = 0; } - if (Flags_GetTreasure(globalCtx, sTreasureFlags[minigameRoomNum])) { + if (Flags_GetTreasure(play, sTreasureFlags[minigameRoomNum])) { this->roomChestsOpened = true; } osSyncPrintf("\n\n"); // "Treasure generation (which room is it?)" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n" VT_RST, globalCtx->roomCtx.curRoom.num); + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n" VT_RST, play->roomCtx.curRoom.num); // "How is the Bit?" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ビットは? \t %x\n" VT_RST, globalCtx->actorCtx.flags.chest); + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ビットは? \t %x\n" VT_RST, play->actorCtx.flags.chest); // "How is the Save BIT?" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セーブBITは? %x\n" VT_RST, sTreasureFlags[minigameRoomNum]); // "Is it already a zombie?" @@ -99,21 +99,21 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { minigameRoomNum *= 2; // Spawn Heart Piece in chest (or Purple Rupee if won Heart Piece) - if (globalCtx->roomCtx.curRoom.num >= 6) { + if (play->roomCtx.curRoom.num >= 6) { rewardChestParams = ((gSaveContext.itemGetInf[1] & 0x800) ? (0x4EA0) : (0x4EC0)); rewardChestParams = sTreasureFlags[5] | rewardChestParams; - this->finalChest = (EnBox*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOX, + this->finalChest = (EnBox*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOX, 20.0f, 20.0f, -2500.0f, 0, 0x7FFF, 0, rewardChestParams); if (this->finalChest != NULL) { if (this->roomChestsOpened) { - Flags_SetTreasure(globalCtx, rewardChestParams & 0x1F); + Flags_SetTreasure(play, rewardChestParams & 0x1F); Actor_Kill(&this->actor); return; } else { rewardParams = ((gSaveContext.itemGetInf[1] & 0x800) ? (ITEM_ETC_RUPEE_PURPLE_CHEST_GAME) : (ITEM_ETC_HEART_PIECE_CHEST_GAME)) & 0xFF; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, 20.0f, 20.0f, -2500.0f, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 20.0f, 20.0f, -2500.0f, 0, 0, 0, ((sTreasureFlags[5] & 0x1F) << 8) + rewardParams); // "Central treasure instance/occurrence (GREAT)" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 中央宝発生(GREAT) ☆☆☆☆☆ %x\n" VT_RST, rewardChestParams); @@ -125,11 +125,11 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { temp_v1_3 = minigameRoomNum; // Set up items in chests, swap them round with probability 1/2 - leftChestParams = (sLoserGetItemIds[globalCtx->roomCtx.curRoom.num] << 5) | 0x4000; + leftChestParams = (sLoserGetItemIds[play->roomCtx.curRoom.num] << 5) | 0x4000; new_var = temp_v1_3; this->leftChestNum = new_var; - this->leftChestGetItemId = sLoserGetItemIds[globalCtx->roomCtx.curRoom.num]; - leftChestItem = sItemEtcTypes[globalCtx->roomCtx.curRoom.num]; + this->leftChestGetItemId = sLoserGetItemIds[play->roomCtx.curRoom.num]; + leftChestItem = sItemEtcTypes[play->roomCtx.curRoom.num]; leftChestParams |= new_var; rightChestParams = new_var | 0x4E21; this->rightChestNum = new_var | 1; @@ -137,10 +137,10 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { rightChestItem = ITEM_ETC_KEY_SMALL_CHEST_GAME; if (Rand_ZeroFloat(1.99f) < 1.0f) { - rightChestParams = (sLoserGetItemIds[globalCtx->roomCtx.curRoom.num] << 5) | 0x4000; + rightChestParams = (sLoserGetItemIds[play->roomCtx.curRoom.num] << 5) | 0x4000; this->rightChestNum = new_var; - this->rightChestGetItemId = sLoserGetItemIds[globalCtx->roomCtx.curRoom.num]; - rightChestItem = sItemEtcTypes[globalCtx->roomCtx.curRoom.num]; + this->rightChestGetItemId = sLoserGetItemIds[play->roomCtx.curRoom.num]; + rightChestItem = sItemEtcTypes[play->roomCtx.curRoom.num]; leftChestParams = new_var | 0x4E21; rightChestParams |= new_var; this->leftChestNum = temp_v1_3 | 1; @@ -149,40 +149,40 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->leftChest = (EnBox*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOX, sLeftChestPos[globalCtx->roomCtx.curRoom.num].x, - sLeftChestPos[globalCtx->roomCtx.curRoom.num].y, sLeftChestPos[globalCtx->roomCtx.curRoom.num].z, 0, -0x3FFF, 0, + &play->actorCtx, &this->actor, play, ACTOR_EN_BOX, sLeftChestPos[play->roomCtx.curRoom.num].x, + sLeftChestPos[play->roomCtx.curRoom.num].y, sLeftChestPos[play->roomCtx.curRoom.num].z, 0, -0x3FFF, 0, leftChestParams); if (this->leftChest != NULL) { // "Left treasure generation (what does it contain?)" osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 左宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n" VT_RST, leftChestParams); // "What is the room number?" - osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 部屋番号は? %x\n" VT_RST, globalCtx->roomCtx.curRoom.num); + osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 部屋番号は? %x\n" VT_RST, play->roomCtx.curRoom.num); // "What is the bit?" osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ ビットはなぁに? %x\n" VT_RST, this->rightChestNum); // "Sukesuke-kun" (something to do with being invisible) osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ すけすけ君? %x\n" VT_RST, rightChestItem); osSyncPrintf("\n\n"); if (this->roomChestsOpened) { - Flags_SetTreasure(globalCtx, this->leftChestNum & 0x1F); + Flags_SetTreasure(play, this->leftChestNum & 0x1F); } else { Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, sLeftChestPos[globalCtx->roomCtx.curRoom.num].x, - sLeftChestPos[globalCtx->roomCtx.curRoom.num].y, sLeftChestPos[globalCtx->roomCtx.curRoom.num].z, 0, 0, + &play->actorCtx, play, ACTOR_ITEM_ETCETERA, sLeftChestPos[play->roomCtx.curRoom.num].x, + sLeftChestPos[play->roomCtx.curRoom.num].y, sLeftChestPos[play->roomCtx.curRoom.num].z, 0, 0, 0, ((this->leftChestNum & 0x1F) << 8) + (leftChestItem & 0xFF)); } } this->rightChest = (EnBox*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOX, sRightChestPos[globalCtx->roomCtx.curRoom.num].x, - sRightChestPos[globalCtx->roomCtx.curRoom.num].y, sRightChestPos[globalCtx->roomCtx.curRoom.num].z, 0, 0x3FFF, + &play->actorCtx, &this->actor, play, ACTOR_EN_BOX, sRightChestPos[play->roomCtx.curRoom.num].x, + sRightChestPos[play->roomCtx.curRoom.num].y, sRightChestPos[play->roomCtx.curRoom.num].z, 0, 0x3FFF, 0, rightChestParams); if (this->rightChest != NULL) { // "Right treasure generation (what does it contain?)" osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 右宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n" VT_RST, rightChestParams); // "What is the room number?" - osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 部屋番号は? %d\n" VT_RST, globalCtx->roomCtx.curRoom.num); + osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 部屋番号は? %d\n" VT_RST, play->roomCtx.curRoom.num); // "What is the bit?" osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ ビットはなぁに? %x\n" VT_RST, this->leftChestNum); // "Sukesuke-kun" (something to do with being invisible) @@ -190,14 +190,14 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { osSyncPrintf("\n\n"); if (this->roomChestsOpened) { - Flags_SetTreasure(globalCtx, this->rightChestNum & 0x1F); + Flags_SetTreasure(play, this->rightChestNum & 0x1F); Actor_Kill(&this->actor); return; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, - sRightChestPos[globalCtx->roomCtx.curRoom.num].x, sRightChestPos[globalCtx->roomCtx.curRoom.num].y, - sRightChestPos[globalCtx->roomCtx.curRoom.num].z, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, + sRightChestPos[play->roomCtx.curRoom.num].x, sRightChestPos[play->roomCtx.curRoom.num].y, + sRightChestPos[play->roomCtx.curRoom.num].z, 0, 0, 0, ((this->rightChestNum & 0x1F) << 8) + (rightChestItem & 0xFF)); } @@ -205,21 +205,21 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnChanger_Wait; } -void EnChanger_Wait(EnChanger* this, GlobalContext* globalCtx) { +void EnChanger_Wait(EnChanger* this, PlayState* play) { if (this->leftChest->unk_1F4 != 0) { this->timer = 80; - Flags_SetTreasure(globalCtx, this->rightChestNum & 0x1F); + Flags_SetTreasure(play, this->rightChestNum & 0x1F); this->actionFunc = EnChanger_OpenChests; } else if (this->rightChest->unk_1F4 != 0) { this->chestOpened = CHEST_RIGHT; this->timer = 80; - Flags_SetTreasure(globalCtx, this->leftChestNum & 0x1F); + Flags_SetTreasure(play, this->leftChestNum & 0x1F); this->actionFunc = EnChanger_OpenChests; } } // Spawns the EnExItem showing what was in the other chest -void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { +void EnChanger_OpenChests(EnChanger* this, PlayState* play) { f32 zPos; f32 yPos; f32 xPos; @@ -241,13 +241,13 @@ void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { zPos = right->dyna.actor.world.pos.z; if (this->rightChestGetItemId == GI_DOOR_KEY) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); - Flags_SetSwitch(globalCtx, 0x32); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); + Flags_SetSwitch(play, 0x32); } else { temp_s0_2 = (s16)(this->rightChestGetItemId - GI_RUPEE_GREEN_LOSE) + EXITEM_CHEST; // "Open right treasure (chest)" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0_2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, temp_s0_2); } break; @@ -257,13 +257,13 @@ void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { zPos = left->dyna.actor.world.pos.z; if (this->leftChestGetItemId == GI_DOOR_KEY) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); - Flags_SetSwitch(globalCtx, 0x32); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); + Flags_SetSwitch(play, 0x32); } else { temp_s0_2 = (s16)(this->leftChestGetItemId - 0x72) + 0xA; // "Open left treasure (chest)" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0_2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, temp_s0_2); } break; @@ -273,7 +273,7 @@ void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { } } -void EnChanger_SetHeartPieceFlag(EnChanger* this, GlobalContext* globalCtx) { +void EnChanger_SetHeartPieceFlag(EnChanger* this, PlayState* play) { if (this->finalChest->unk_1F4 != 0) { if (!(gSaveContext.itemGetInf[1] & 0x800)) { gSaveContext.itemGetInf[1] |= 0x800; @@ -282,10 +282,10 @@ void EnChanger_SetHeartPieceFlag(EnChanger* this, GlobalContext* globalCtx) { } } -void EnChanger_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnChanger_Update(Actor* thisx, PlayState* play) { EnChanger* this = (EnChanger*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer != 0) { this->timer--; @@ -294,6 +294,6 @@ void EnChanger_Update(Actor* thisx, GlobalContext* globalCtx) { if (BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.h b/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.h index 6b5560e56..b5209109e 100644 --- a/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.h +++ b/soh/src/overlays/actors/ovl_En_Changer/z_en_changer.h @@ -7,7 +7,7 @@ struct EnChanger; -typedef void (*EnChangerActionFunc)(struct EnChanger*, GlobalContext*); +typedef void (*EnChangerActionFunc)(struct EnChanger*, PlayState*); typedef struct EnChanger { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 097250ff5..f3923dbba 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -6,20 +6,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnClearTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx); -void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnClearTag_Init(Actor* thisx, PlayState* play); +void EnClearTag_Destroy(Actor* thisx, PlayState* play); +void EnClearTag_Update(Actor* thisx, PlayState* play); +void EnClearTag_Draw(Actor* thisx, PlayState* play); void EnClearTag_Reset(void); -void EnClearTag_UpdateEffects(GlobalContext* globalCtx); -void EnClearTag_DrawEffects(GlobalContext* globalCtx); +void EnClearTag_UpdateEffects(PlayState* play); +void EnClearTag_DrawEffects(PlayState* play); -void EnClearTag_CreateDebrisEffect(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, +void EnClearTag_CreateDebrisEffect(PlayState* play, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, f32 floorHeight); -void EnClearTag_CreateFireEffect(GlobalContext* globalCtx, Vec3f* pos, f32 scale); -void EnClearTag_CreateSmokeEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale); -void EnClearTag_CreateFlashEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale, f32 floorHeight, +void EnClearTag_CreateFireEffect(PlayState* play, Vec3f* pos, f32 scale); +void EnClearTag_CreateSmokeEffect(PlayState* play, Vec3f* position, f32 scale); +void EnClearTag_CreateFlashEffect(PlayState* play, Vec3f* position, f32 scale, f32 floorHeight, Vec3f* floorTangent); void EnClearTag_CalculateFloorTangent(EnClearTag* this); @@ -92,10 +92,10 @@ EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT]; * Creates a debris effect. * Debris effects are spawned when the Arwing dies. It spawns fire effects. */ -void EnClearTag_CreateDebrisEffect(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, +void EnClearTag_CreateDebrisEffect(PlayState* play, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, f32 floorHeight) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a Debris effect to. for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { @@ -127,9 +127,9 @@ void EnClearTag_CreateDebrisEffect(GlobalContext* globalCtx, Vec3f* position, Ve * Creates a fire effect. * Fire effects are spawned by debris effects. Fire effects spawn smoke effects */ -void EnClearTag_CreateFireEffect(GlobalContext* globalCtx, Vec3f* pos, f32 scale) { +void EnClearTag_CreateFireEffect(PlayState* play, Vec3f* pos, f32 scale) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a fire effect to. for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { @@ -155,9 +155,9 @@ void EnClearTag_CreateFireEffect(GlobalContext* globalCtx, Vec3f* pos, f32 scale * Creates a smoke effect. * Smoke effects are spawned by fire effects. */ -void EnClearTag_CreateSmokeEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale) { +void EnClearTag_CreateSmokeEffect(PlayState* play, Vec3f* position, f32 scale) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a smoke effect to. for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { @@ -190,10 +190,10 @@ void EnClearTag_CreateSmokeEffect(GlobalContext* globalCtx, Vec3f* position, f32 * Flash effects are spawned when the Arwing dies. * Flash effects two components: 1) a billboard flash, and 2) a light effect on the ground. */ -void EnClearTag_CreateFlashEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale, f32 floorHeight, +void EnClearTag_CreateFlashEffect(PlayState* play, Vec3f* position, f32 scale, f32 floorHeight, Vec3f* floorTangent) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a flash effect to. for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { @@ -221,23 +221,23 @@ void EnClearTag_CreateFlashEffect(GlobalContext* globalCtx, Vec3f* position, f32 * EnClear_Tag destructor. * This just destroys the collider. */ -void EnClearTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Destroy(Actor* thisx, PlayState* play) { EnClearTag* this = (EnClearTag*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** * EnClear_Tag constructor. * This allocates a collider, initializes effects, and sets up ClearTag instance data. */ -void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Init(Actor* thisx, PlayState* play) { EnClearTag* this = (EnClearTag*)thisx; s32 defaultCutsceneTimer = 100; s16 i; s16 j; - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); // Initialize the Arwing laser. if (this->actor.params == CLEAR_TAG_LASER) { @@ -255,12 +255,12 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.x = -this->actor.shape.rot.x; func_8002D908(&this->actor); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sLaserCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sLaserCylinderInit); Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_REFLECT_MG); } else { // Initialize the Arwing. this->actor.flags |= ACTOR_FLAG_0; this->actor.targetMode = 5; - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sArwingCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sArwingCylinderInit); this->actor.colChkInfo.health = 3; // Update the Arwing to play the intro cutscene. @@ -277,7 +277,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { // Initialize all effects to available if effects have not been initialized. if (!sClearTagIsEffectsInitialized) { sClearTagIsEffectsInitialized = true; - globalCtx->specialEffects = &sClearTagEffects[0]; + play->specialEffects = &sClearTagEffects[0]; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++) { sClearTagEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE; sClearTagEffects[i].epoch++; @@ -317,14 +317,14 @@ void EnClearTag_CalculateFloorTangent(EnClearTag* this) { * This function controls the cutscene that plays when the Arwing has params for * cutscene. The cutscene stops playing when the Arwing is a specified distance from the starting point. */ -void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnClearTag_Update(Actor* thisx, PlayState* play2) { u8 hasAtHit = false; s16 i; s16 xRotationTarget; s16 rotationScale; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnClearTag* this = (EnClearTag*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->frameCounter++; @@ -493,7 +493,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { // Fire the Arwing laser. if (this->shouldShootLaser) { this->shouldShootLaser = false; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, CLEAR_TAG_STATE_LASER); } @@ -514,17 +514,17 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.dim.yShift = -5; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); if (this->timers[CLEAR_TAG_TIMER_ARWING_UPDATE_BG_INFO] == 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 30.0f, 100.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 30.0f, 100.0f, 5); EnClearTag_CalculateFloorTangent(this); } if (this->state == CLEAR_TAG_STATE_CRASHING) { // Create fire effects while the Arwing crashes. - EnClearTag_CreateFireEffect(globalCtx, &this->actor.world.pos, 1.0f); + EnClearTag_CreateFireEffect(play, &this->actor.world.pos, 1.0f); // Causes the Arwing to roll around seemingly randomly while crashing. this->roll -= 0.5f; @@ -561,8 +561,8 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.dim.height = 25; this->collider.dim.yShift = -10; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 80.0f, 100.0f, 5); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 80.0f, 100.0f, 5); // Check if the laser has hit a target, timed out, or hit the ground. if (this->actor.bgCheckFlags & 9 || hasAtHit || this->timers[CLEAR_TAG_TIMER_LASER_DEATH] == 0) { @@ -570,7 +570,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); // Player laser sound effect if the laser did not time out. if (this->timers[CLEAR_TAG_TIMER_LASER_DEATH] != 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_FANTOM_THUNDER_GND); } } @@ -593,10 +593,10 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { case CLEAR_TAG_CUTSCENE_MODE_SETUP: // Initializes Arwing cutscene camera data. this->cutsceneMode = CLEAR_TAG_CUTSCENE_MODE_PLAY; - func_80064520(globalCtx, &globalCtx->csCtx); - this->cameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cameraId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->cameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); case CLEAR_TAG_CUTSCENE_MODE_PLAY: // Update the Arwing cutscene camera to spin around in a circle. cutsceneTimer = this->frameCounter * 128; @@ -617,15 +617,15 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachF(&this->cutsceneCameraEye.x, cutsceneCameraEyeTarget.x, 0.2f, 500.0f); Math_ApproachF(&this->cutsceneCameraEye.y, cutsceneCameraEyeTarget.y, 0.2f, 500.0f); Math_ApproachF(&this->cutsceneCameraEye.z, cutsceneCameraEyeTarget.z, 0.2f, 500.0f); - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->cutsceneCameraEye, + Play_CameraSetAtEye(play, this->cameraId, &this->cutsceneCameraEye, &this->cutsceneCameraAt); } // Cutscene has finished. if (this->cutsceneTimer == 1) { - func_800C08AC(globalCtx, this->cameraId, 0); + func_800C08AC(play, this->cameraId, 0); this->cutsceneMode = this->cameraId = SUBCAM_FREE; - func_80064534(globalCtx, &globalCtx->csCtx); + func_80064534(play, &play->csCtx); } } } @@ -638,18 +638,18 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Vec3f debrisEffectAcceleration; this->shouldExplode = false; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_BOMB_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_IT_BOMB_EXPLOSION); // Spawn flash effect. crashEffectLocation.x = this->actor.world.pos.x; crashEffectLocation.y = (this->actor.world.pos.y + 40.0f) - 30.0f; crashEffectLocation.z = this->actor.world.pos.z; - EnClearTag_CreateFlashEffect(globalCtx, &crashEffectLocation, 6.0f, this->actor.floorHeight, + EnClearTag_CreateFlashEffect(play, &crashEffectLocation, 6.0f, this->actor.floorHeight, &this->floorTangent); // Spawn smoke effect. crashEffectLocation.y = (this->actor.world.pos.y + 30.0f) - 50.0f; - EnClearTag_CreateSmokeEffect(globalCtx, &crashEffectLocation, 3.0f); + EnClearTag_CreateSmokeEffect(play, &crashEffectLocation, 3.0f); crashEffectLocation.y = this->actor.world.pos.y; // Spawn debris effects. @@ -664,7 +664,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { debrisEffectAcceleration.y = -1.0f; debrisEffectAcceleration.z = 0.0f; - EnClearTag_CreateDebrisEffect(globalCtx, &crashEffectLocation, &crashEffectVelocity, + EnClearTag_CreateDebrisEffect(play, &crashEffectLocation, &crashEffectVelocity, &debrisEffectAcceleration, Rand_ZeroFloat(0.15f) + 0.075f, this->actor.floorHeight); } @@ -676,7 +676,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); } - EnClearTag_UpdateEffects(globalCtx); + EnClearTag_UpdateEffects(play); } } @@ -685,30 +685,30 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { * Laser clear tag type will draw two lasers. * Arwing clear tage types will draw the Arwing, the backfire, and a shadow. */ -void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Draw(Actor* thisx, PlayState* play) { s32 pad; EnClearTag* this = (EnClearTag*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->drawMode != CLEAR_TAG_DRAW_MODE_EFFECT) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->state >= CLEAR_TAG_STATE_LASER) { // Draw Arwing lasers. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 255, 0, 255); Matrix_Translate(25.0f, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingLaserDL); Matrix_Translate(-50.0f, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingLaserDL); } else { // Draw the Arwing itself. - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); if (this->crashingTimer != 0) { f32 xRotation; @@ -721,13 +721,13 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(yRotation, MTXMODE_APPLY); } Matrix_RotateZ(this->roll, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gArwingDL); // Draw the Arwing Backfire Matrix_Translate(0.0f, 0.0f, -60.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(2.5f, 1.3f, 0.0f, MTXMODE_APPLY); if ((this->frameCounter % 2) != 0) { Matrix_Scale(1.15f, 1.15f, 1.15f, MTXMODE_APPLY); @@ -735,7 +735,7 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, 155); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingBackfireDL); @@ -759,17 +759,17 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(yRotation, MTXMODE_APPLY); } Matrix_RotateZ(this->roll, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingShadowDL); } } if (this->drawMode != CLEAR_TAG_DRAW_MODE_ARWING) { - EnClearTag_DrawEffects(globalCtx); + EnClearTag_DrawEffects(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -778,8 +778,8 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { * Moves and bounces debris effects. * Fades most effects out of view. When effects are completely faded away they are removed. */ -void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; +void EnClearTag_UpdateEffects(PlayState* play) { + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; s16 i; f32 originalYPosition; Vec3f sphereCenter; @@ -809,7 +809,7 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { sphereCenter.y += 5.0f; // Check if the debris has hit the ground. - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &sphereCenter, 11.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &sphereCenter, 11.0f)) { effect->position.y = originalYPosition; // Bounce the debris effect. @@ -839,7 +839,7 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { // Spawn a fire effect every 3 frames. if (effect->random >= 3) { effect->random = 0; - EnClearTag_CreateFireEffect(globalCtx, &effect->position, effect->scale * 8.0f); + EnClearTag_CreateFireEffect(play, &effect->position, effect->scale * 8.0f); } } else if (effect->type == CLEAR_TAG_EFFECT_FIRE) { // Fade the fire effect. @@ -892,16 +892,16 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { * Each effect type is drawn before the next. The function will apply a material that applies to all effects of that * type while drawing the first effect of that type. */ -void EnClearTag_DrawEffects(GlobalContext* globalCtx) { +void EnClearTag_DrawEffects(PlayState* play) { s16 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 isMaterialApplied = false; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; EnClearTagEffect* firstEffect = effect; OPEN_DISPS(gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); // Draw all Debris effects. for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { @@ -975,9 +975,9 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s8)effect->primColor.r, (s8)effect->primColor.g, (s8)effect->primColor.b, (s8)effect->primColor.a); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, effect->random * -5, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, effect->random * -5, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 20.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), @@ -1005,10 +1005,10 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { // Draw the fire effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s8)effect->primColor.a); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (effect->random * -15) & 0xFF, 32, 64, 1, 0, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (effect->random * -15) & 0xFF, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1035,7 +1035,7 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { // Draw the flash billboard effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)effect->primColor.a); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.c index d7f7d35d9..d7ab361bb 100644 --- a/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -9,22 +9,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnCow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCow_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_809DFE98(Actor* thisx, GlobalContext* globalCtx); -void func_809E0070(Actor* thisx, GlobalContext* globalCtx); +void EnCow_Init(Actor* thisx, PlayState* play); +void EnCow_Destroy(Actor* thisx, PlayState* play); +void EnCow_Update(Actor* thisx, PlayState* play); +void EnCow_Draw(Actor* thisx, PlayState* play); +void func_809DFE98(Actor* thisx, PlayState* play); +void func_809E0070(Actor* thisx, PlayState* play); -void func_809DF494(EnCow* this, GlobalContext* globalCtx); -void func_809DF6BC(EnCow* this, GlobalContext* globalCtx); -void EnCow_MoveForRandomizer(EnCow* this, GlobalContext* globalCtx); -void func_809DF778(EnCow* this, GlobalContext* globalCtx); -void func_809DF7D8(EnCow* this, GlobalContext* globalCtx); -void func_809DF870(EnCow* this, GlobalContext* globalCtx); -void func_809DF8FC(EnCow* this, GlobalContext* globalCtx); -void func_809DF96C(EnCow* this, GlobalContext* globalCtx); -void func_809DFA84(EnCow* this, GlobalContext* globalCtx); +void func_809DF494(EnCow* this, PlayState* play); +void func_809DF6BC(EnCow* this, PlayState* play); +void EnCow_MoveForRandomizer(EnCow* this, PlayState* play); +void func_809DF778(EnCow* this, PlayState* play); +void func_809DF7D8(EnCow* this, PlayState* play); +void func_809DF870(EnCow* this, PlayState* play); +void func_809DF8FC(EnCow* this, PlayState* play); +void func_809DF96C(EnCow* this, PlayState* play); +void func_809DFA84(EnCow* this, PlayState* play); const ActorInit En_Cow_InitVars = { ACTOR_EN_COW, @@ -103,26 +103,26 @@ void func_809DEF94(EnCow* this) { this->actor.world.pos.z += vec.z; } -void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Init(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; s32 pad; if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_COWS)) { - EnCow_MoveForRandomizer(thisx, globalCtx); + EnCow_MoveForRandomizer(thisx, play); } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 72.0f); switch (this->actor.params) { case 0: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowBodySkel, NULL, this->jointTable, this->morphTable, 6); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowBodySkel, NULL, this->jointTable, this->morphTable, 6); Animation_PlayLoop(&this->skelAnime, &gCowBodyChewAnim); - Collider_InitCylinder(globalCtx, &this->colliders[0]); - Collider_SetCylinder(globalCtx, &this->colliders[0], &this->actor, &sCylinderInit); - Collider_InitCylinder(globalCtx, &this->colliders[1]); - Collider_SetCylinder(globalCtx, &this->colliders[1], &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliders[0]); + Collider_SetCylinder(play, &this->colliders[0], &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliders[1]); + Collider_SetCylinder(play, &this->colliders[1], &this->actor, &sCylinderInit); func_809DEE9C(this); this->actionFunc = func_809DF96C; - if (globalCtx->sceneNum == SCENE_LINK_HOME) { + if (play->sceneNum == SCENE_LINK_HOME) { if (!LINK_IS_ADULT && !CVar_GetS32("gCowOfTime", 0)) { Actor_Kill(&this->actor); return; @@ -132,7 +132,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { return; } } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_COW, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_COW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 1); this->unk_278 = Rand_ZeroFloat(1000.0f) + 40.0f; this->unk_27A = 0; @@ -140,7 +140,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { DREG(53) = 0; break; case 1: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, 6); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, 6); Animation_PlayLoop(&this->skelAnime, &gCowTailIdleAnim); this->actor.update = func_809DFE98; this->actor.draw = func_809E0070; @@ -155,16 +155,16 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_276 = 0; } -void EnCow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Destroy(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; if (this->actor.params == 0) { - Collider_DestroyCylinder(globalCtx, &this->colliders[0]); - Collider_DestroyCylinder(globalCtx, &this->colliders[1]); + Collider_DestroyCylinder(play, &this->colliders[0]); + Collider_DestroyCylinder(play, &this->colliders[1]); } } -void func_809DF494(EnCow* this, GlobalContext* globalCtx) { +void func_809DF494(EnCow* this, PlayState* play) { if (this->unk_278 > 0) { this->unk_278 -= 1; } else { @@ -199,96 +199,96 @@ void func_809DF494(EnCow* this, GlobalContext* globalCtx) { } } -void func_809DF6BC(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_809DF6BC(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_16; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_809DF96C; } } -void func_809DF730(EnCow* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809DF730(EnCow* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = func_809DF96C; } } -void EnCow_MoveForRandomizer(EnCow* this, GlobalContext* globalCtx) { +void EnCow_MoveForRandomizer(EnCow* this, PlayState* play) { // Only move the cow body (the tail will be moved with the body) if (this->actor.params != 0) { return; } // Move left cow in lon lon tower - if (globalCtx->sceneNum == SCENE_SOUKO && this->actor.world.pos.x == -108 && this->actor.world.pos.z == -65) { + if (play->sceneNum == SCENE_SOUKO && this->actor.world.pos.x == -108 && this->actor.world.pos.z == -65) { this->actor.world.pos.x = -229.0f; this->actor.world.pos.z = 157.0f; this->actor.shape.rot.y = 15783.0f; // Move right cow in lon lon stable - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE && this->actor.world.pos.x == -3 && this->actor.world.pos.z == -254) { + } else if (play->sceneNum == SCENE_MALON_STABLE && this->actor.world.pos.x == -3 && this->actor.world.pos.z == -254) { this->actor.world.pos.x += 119.0f; } } -void EnCow_SetCowMilked(EnCow* this, GlobalContext* globalCtx) { - CowIdentity cowIdentity = Randomizer_IdentifyCow(globalCtx->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z); - Player* player = GET_PLAYER(globalCtx); +void EnCow_SetCowMilked(EnCow* this, PlayState* play) { + CowIdentity cowIdentity = Randomizer_IdentifyCow(play->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z); + Player* player = GET_PLAYER(play); player->pendingFlag.flagID = cowIdentity.randomizerInf; player->pendingFlag.flagType = FLAG_RANDOMIZER_INF; } -void func_809DF778(EnCow* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809DF778(EnCow* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_809DF730; } else { - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } -void func_809DF7D8(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_809DF7D8(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_16; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_809DF778; - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } -void func_809DF870(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_809DF870(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { - Message_ContinueTextbox(globalCtx, 0x2007); + Message_ContinueTextbox(play, 0x2007); this->actionFunc = func_809DF7D8; } else { - Message_ContinueTextbox(globalCtx, 0x2013); + Message_ContinueTextbox(play, 0x2013); this->actionFunc = func_809DF6BC; } } } -void func_809DF8FC(EnCow* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_809DF8FC(EnCow* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_809DF870; } else { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 170.0f); + func_8002F2CC(&this->actor, play, 170.0f); this->actor.textId = 0x2006; } - func_809DF494(this, globalCtx); + func_809DF494(this, play); } -bool EnCow_HasBeenMilked(EnCow* this, GlobalContext* globalCtx) { - CowIdentity cowIdentity = Randomizer_IdentifyCow(globalCtx->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z); +bool EnCow_HasBeenMilked(EnCow* this, PlayState* play) { + CowIdentity cowIdentity = Randomizer_IdentifyCow(play->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z); return Flags_GetRandomizerInf(cowIdentity.randomizerInf); } -void EnCow_GivePlayerRandomizedItem(EnCow* this, GlobalContext* globalCtx) { - if (!EnCow_HasBeenMilked(this, globalCtx)) { - CowIdentity cowIdentity = Randomizer_IdentifyCow(globalCtx->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z); +void EnCow_GivePlayerRandomizedItem(EnCow* this, PlayState* play) { + if (!EnCow_HasBeenMilked(this, play)) { + CowIdentity cowIdentity = Randomizer_IdentifyCow(play->sceneNum, this->actor.world.pos.x, this->actor.world.pos.z); GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(cowIdentity.randomizerCheck, GI_MILK); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 10000.0f, 100.0f); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 10000.0f, 100.0f); } else { // once we've gotten the rando reward from the cow, // return them to the their default action function @@ -296,8 +296,8 @@ void EnCow_GivePlayerRandomizedItem(EnCow* this, GlobalContext* globalCtx) { } } -void func_809DF96C(EnCow* this, GlobalContext* globalCtx) { - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_00) || (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04)) { +void func_809DF96C(EnCow* this, PlayState* play) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_00) || (play->msgCtx.ocarinaMode == OCARINA_MODE_04)) { if (DREG(53) != 0) { if (this->unk_276 & 4) { this->unk_276 &= ~0x4; @@ -311,17 +311,17 @@ void func_809DF96C(EnCow* this, GlobalContext* globalCtx) { // vanilla cow behavior if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_COWS) && - !EnCow_HasBeenMilked(this, globalCtx)) { - EnCow_SetCowMilked(this, globalCtx); + !EnCow_HasBeenMilked(this, play)) { + EnCow_SetCowMilked(this, play); // setting the ocarina mode here prevents intermittent issues // with the item get not triggering until walking away - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; this->actionFunc = EnCow_GivePlayerRandomizedItem; return; } this->actionFunc = func_809DF8FC; this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 170.0f); + func_8002F2CC(&this->actor, play, 170.0f); this->actor.textId = 0x2006; } else { this->unk_276 |= 4; @@ -331,10 +331,10 @@ void func_809DF96C(EnCow* this, GlobalContext* globalCtx) { this->unk_276 &= ~0x4; } } - func_809DF494(this, globalCtx); + func_809DF494(this, play); } -void func_809DFA84(EnCow* this, GlobalContext* globalCtx) { +void func_809DFA84(EnCow* this, PlayState* play) { if (this->unk_278 > 0) { this->unk_278--; } else { @@ -352,17 +352,17 @@ void func_809DFA84(EnCow* this, GlobalContext* globalCtx) { } } -void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnCow_Update(Actor* thisx, PlayState* play2) { EnCow* this = (EnCow*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 targetX; s16 targetY; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[1].base); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 4); if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->skelAnime.animation == &gCowBodyChewAnim) { Audio_PlayActorSound2(thisx, NA_SE_EV_COW_CRY); @@ -373,7 +373,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { ANIMMODE_LOOP, 1.0f); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((thisx->xzDistToPlayer < 150.0f) && (ABS(Math_Vec3f_Yaw(&thisx->world.pos, &player->actor.world.pos)) < 0xC000)) { targetX = Math_Vec3f_Pitch(&thisx->focus.pos, &player->actor.focus.pos); @@ -399,7 +399,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToS(&this->someRot.y, targetY, 0xA, 0xC8, 0xA); } -void func_809DFE98(Actor* thisx, GlobalContext* globalCtx) { +void func_809DFE98(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; s32 pad; @@ -412,10 +412,10 @@ void func_809DFE98(Actor* thisx, GlobalContext* globalCtx) { ANIMMODE_LOOP, 1.0f); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnCow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnCow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnCow* this = (EnCow*)thisx; if (limbIndex == 2) { @@ -428,7 +428,7 @@ s32 EnCow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnCow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnCow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnCow* this = (EnCow*)thisx; if (limbIndex == 2) { @@ -436,18 +436,18 @@ void EnCow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnCow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Draw(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCow_OverrideLimbDraw, EnCow_PostLimbDraw, this); } -void func_809E0070(Actor* thisx, GlobalContext* globalCtx) { +void func_809E0070(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.h b/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.h index ccb165bf7..9fcc67c79 100644 --- a/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.h +++ b/soh/src/overlays/actors/ovl_En_Cow/z_en_cow.h @@ -6,7 +6,7 @@ struct EnCow; -typedef void (*EnCowActionFunc)(struct EnCow*, GlobalContext*); +typedef void (*EnCowActionFunc)(struct EnCow*, PlayState*); typedef struct EnCow { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c index fb4088156..fd7c1e811 100644 --- a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -3,18 +3,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCrow_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnCrow_Init(Actor* thisx, PlayState* play); +void EnCrow_Destroy(Actor* thisx, PlayState* play); +void EnCrow_Update(Actor* thisx, PlayState* play); +void EnCrow_Draw(Actor* thisx, PlayState* play); void EnCrow_SetupFlyIdle(EnCrow* this); -void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_FlyIdle(EnCrow* this, PlayState* play); +void EnCrow_Respawn(EnCrow* this, PlayState* play); +void EnCrow_DiveAttack(EnCrow* this, PlayState* play); +void EnCrow_Die(EnCrow* this, PlayState* play); +void EnCrow_TurnAway(EnCrow* this, PlayState* play); +void EnCrow_Damaged(EnCrow* this, PlayState* play); static Vec3f sZeroVecAccel = { 0.0f, 0.0f, 0.0f }; @@ -106,13 +106,13 @@ static InitChainEntry sInitChain[] = { static Vec3f sHeadVec = { 2500.0f, 0.0f, 0.0f }; -void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Init(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, 9); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, 9); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); @@ -120,10 +120,10 @@ void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) { EnCrow_SetupFlyIdle(this); } -void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Destroy(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } // Setup Action functions @@ -142,7 +142,7 @@ void EnCrow_SetupDiveAttack(EnCrow* this) { this->actionFunc = EnCrow_DiveAttack; } -void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { s32 i; f32 scale; Vec3f iceParticlePos; @@ -163,14 +163,14 @@ void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.x; iceParticlePos.y = ((i & 2 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.y; iceParticlePos.z = ((i & 4 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, ((Rand_ZeroOne() * 0.15f) + 0.85f) * scale); } } else if (this->actor.colChkInfo.damageEffect == 2) { // Fire arrows and Din's Fire Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); for (i = 0; i < 4; i++) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 50.0f * scale, 0, 0, i); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 50.0f * scale, 0, 0, i); } } else { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); @@ -226,8 +226,8 @@ void EnCrow_SetupRespawn(EnCrow* this) { // Action functions -void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 skelanimeUpdated; s16 var; @@ -278,13 +278,13 @@ void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { this->timer--; } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x00800000) && - (this->actor.yDistToWater < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) { + (this->actor.yDistToWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { EnCrow_SetupDiveAttack(this); } } -void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 facingPlayer; Vec3f pos; s16 target; @@ -313,7 +313,7 @@ void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); } - if ((this->timer == 0) || (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) || + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9) || (player->stateFlags1 & 0x00800000) || (this->actor.yDistToWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { @@ -325,7 +325,7 @@ void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { } } -void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Damaged(EnCrow* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; @@ -335,14 +335,14 @@ void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx) { this->actor.shape.rot.z += 0x1780; } if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &sZeroVecAccel, &sZeroVecAccel, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &sZeroVecAccel, &sZeroVecAccel, this->actor.scale.x * 10000.0f, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); EnCrow_SetupDie(this); } } } -void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Die(EnCrow* this, PlayState* play) { f32 step; if (this->actor.params != 0) { @@ -354,9 +354,9 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->actor.scale.x, 0.0f, step)) { if (this->actor.params == 0) { sDeathCount++; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); } EnCrow_SetupRespawn(this); } @@ -364,7 +364,7 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; } -void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_TurnAway(EnCrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 8) { @@ -384,7 +384,7 @@ void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) { } } -void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Respawn(EnCrow* this, PlayState* play) { f32 target; if (this->timer != 0) { @@ -409,7 +409,7 @@ void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx) { } } -void EnCrow_UpdateDamage(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elements[0].info, 1); @@ -419,21 +419,21 @@ void EnCrow_UpdateDamage(EnCrow* this, GlobalContext* globalCtx) { } else { Actor_ApplyDamage(&this->actor); this->actor.flags &= ~ACTOR_FLAG_0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - EnCrow_SetupDamaged(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + EnCrow_SetupDamaged(this, play); } } } } -void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Update(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; f32 pad; f32 height; f32 scale; - EnCrow_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnCrow_UpdateDamage(this, play); + this->actionFunc(this, play); scale = this->actor.scale.x * 100.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.x = -this->actor.shape.rot.x; @@ -446,7 +446,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { height = 0.0f; Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, 7); } else { height = 0.0f; } @@ -456,15 +456,15 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; if (this->actionFunc == EnCrow_DiveAttack) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnCrow_Respawn) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, height); @@ -474,7 +474,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnCrow* this = (EnCrow*)thisx; if (this->actor.colChkInfo.health != 0) { @@ -487,7 +487,7 @@ s32 EnCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnCrow* this = (EnCrow*)thisx; Vec3f* vec; @@ -501,10 +501,10 @@ void EnCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnCrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Draw(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCrow_OverrideLimbDraw, EnCrow_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.h b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.h index 59447f9ce..87e9ae054 100644 --- a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.h +++ b/soh/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/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 2885bc2a6..4e00d4f73 100644 --- a/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -4,16 +4,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnCs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnCs_Init(Actor* thisx, PlayState* play); +void EnCs_Destroy(Actor* thisx, PlayState* play); +void EnCs_Update(Actor* thisx, PlayState* play); +void EnCs_Draw(Actor* thisx, PlayState* play); -void EnCs_Walk(EnCs* this, GlobalContext* globalCtx); -void EnCs_Talk(EnCs* this, GlobalContext* globalCtx); -void EnCs_Wait(EnCs* this, GlobalContext* globalCtx); -s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnCs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +void EnCs_Walk(EnCs* this, PlayState* play); +void EnCs_Talk(EnCs* this, PlayState* play); +void EnCs_Wait(EnCs* this, PlayState* play); +s32 EnCs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnCs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Cs_InitVars = { ACTOR_EN_CS, @@ -121,7 +121,7 @@ void EnCs_ChangeAnim(EnCs* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Init(Actor* thisx, PlayState* play) { EnCs* this = (EnCs*)thisx; s32 pad; @@ -132,13 +132,13 @@ void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGraveyardKidSkel, NULL, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gGraveyardKidSkel, NULL, this->jointTable, this->morphTable, 16); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, sDamageTable, &sColChkInfoInit2); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); Animation_Change(&this->skelAnime, sAnimationInfo[ENCS_ANIM_0].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[ENCS_ANIM_0].animation), sAnimationInfo[ENCS_ANIM_0].mode, @@ -157,21 +157,21 @@ void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { this->walkSpeed = 1.0f; } -void EnCs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Destroy(Actor* thisx, PlayState* play) { EnCs* this = (EnCs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { +s32 EnCs_GetTalkState(EnCs* this, PlayState* play) { s32 pad; s32 pad2; s32 talkState = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { this->actor.textId = 0x2026; EnCs_ChangeAnim(this, ENCS_ANIM_3, &this->currentAnimIndex); talkState = 2; @@ -183,10 +183,10 @@ s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x2026) { - Player_UnsetMask(globalCtx); - Item_Give(globalCtx, ITEM_SOLD_OUT); + Player_UnsetMask(play); + Item_Give(play, ITEM_SOLD_OUT); gSaveContext.itemGetInf[3] |= 0x400; Rupees_ChangeBy(30); this->actor.textId = 0x2027; @@ -207,9 +207,9 @@ s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { return talkState; } -s32 EnCs_GetTextID(EnCs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 textId = Text_GetFaceReaction(globalCtx, 15); +s32 EnCs_GetTextID(EnCs* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 textId = Text_GetFaceReaction(play, 15); if (gSaveContext.itemGetInf[3] & 0x400) { if (textId == 0) { @@ -226,17 +226,17 @@ s32 EnCs_GetTextID(EnCs* this, GlobalContext* globalCtx) { return textId; } -void EnCs_HandleTalking(EnCs* this, GlobalContext* globalCtx) { +void EnCs_HandleTalking(EnCs* this, PlayState* play) { s32 pad; s16 sp2A; s16 sp28; if (this->talkState == 2) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->talkState = 1; } else if (this->talkState == 1) { - this->talkState = EnCs_GetTalkState(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->talkState = EnCs_GetTalkState(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->actor.textId == 0x2022) || ((this->actor.textId != 0x2022) && (this->actor.textId != 0x2028))) { EnCs_ChangeAnim(this, ENCS_ANIM_3, &this->currentAnimIndex); } @@ -251,11 +251,11 @@ void EnCs_HandleTalking(EnCs* this, GlobalContext* globalCtx) { this->talkState = 1; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp2A, &sp28); + Actor_GetScreenPos(play, &this->actor, &sp2A, &sp28); if ((sp2A >= 0) && (sp2A <= 320) && (sp28 >= 0) && (sp28 <= 240) && - (func_8002F2CC(&this->actor, globalCtx, 100.0f))) { - this->actor.textId = EnCs_GetTextID(this, globalCtx); + (func_8002F2CC(&this->actor, play, 100.0f))) { + this->actor.textId = EnCs_GetTextID(this, play); } } } @@ -280,7 +280,7 @@ s32 EnCs_GetPathPoint(Path* pathList, Vec3f* dest, s32 pathIndex, s32 waypoint) return 0; } -s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { +s32 EnCs_HandleWalking(EnCs* this, PlayState* play) { f32 xDiff; f32 zDiff; Vec3f pathPos; @@ -288,7 +288,7 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { s16 walkAngle1; s16 walkAngle2; - EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint); + EnCs_GetPathPoint(play->setupPathList, &pathPos, this->path, this->waypoint); xDiff = pathPos.x - this->actor.world.pos.x; zDiff = pathPos.z - this->actor.world.pos.z; walkAngle1 = Math_FAtan2F(xDiff, zDiff) * (32768.0f / M_PI); @@ -297,13 +297,13 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { while (this->walkDist <= 10.44f) { this->waypoint++; - waypointCount = EnCs_GetwaypointCount(globalCtx->setupPathList, this->path); + waypointCount = EnCs_GetwaypointCount(play->setupPathList, this->path); if ((this->waypoint < 0) || (!(this->waypoint < waypointCount))) { this->waypoint = 0; } - EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint); + EnCs_GetPathPoint(play->setupPathList, &pathPos, this->path, this->waypoint); xDiff = pathPos.x - this->actor.world.pos.x; zDiff = pathPos.z - this->actor.world.pos.z; walkAngle2 = Math_FAtan2F(xDiff, zDiff) * (32768.0f / M_PI); @@ -315,12 +315,12 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.speedXZ = this->walkSpeed; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); return 0; } -void EnCs_Walk(EnCs* this, GlobalContext* globalCtx) { +void EnCs_Walk(EnCs* this, PlayState* play) { s32 rnd; s32 animIndex; s32 curAnimFrame; @@ -367,11 +367,11 @@ void EnCs_Walk(EnCs* this, GlobalContext* globalCtx) { this->walkSpeed = 1.0f; } - EnCs_HandleWalking(this, globalCtx); + EnCs_HandleWalking(this, play); } } -void EnCs_Wait(EnCs* this, GlobalContext* globalCtx) { +void EnCs_Wait(EnCs* this, PlayState* play) { s32 animIndex; if (this->talkState != 0) { @@ -396,8 +396,8 @@ void EnCs_Wait(EnCs* this, GlobalContext* globalCtx) { } } -void EnCs_Talk(EnCs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCs_Talk(EnCs* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (SkelAnime_Update(&this->skelAnime) != 0) { EnCs_ChangeAnim(this, this->currentAnimIndex, &this->currentAnimIndex); @@ -416,7 +416,7 @@ void EnCs_Talk(EnCs* this, GlobalContext* globalCtx) { } } -void EnCs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Update(Actor* thisx, PlayState* play) { static s32 eyeBlinkFrames[] = { 70, 1, 1 }; EnCs* this = (EnCs*)thisx; s32 pad; @@ -434,11 +434,11 @@ void EnCs_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - EnCs_HandleTalking(this, globalCtx); + EnCs_HandleTalking(this, play); this->eyeBlinkTimer--; @@ -453,7 +453,7 @@ void EnCs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gGraveyardKidEyesOpenTex, gGraveyardKidEyesHalfTex, @@ -462,34 +462,34 @@ void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx) { EnCs* this = (EnCs*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCs_OverrideLimbDraw, EnCs_PostLimbDraw, &this->actor); if (gSaveContext.itemGetInf[3] & 0x400) { - s32 childLinkObjectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_LINK_CHILD); + s32 childLinkObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); // Handle attaching the Spooky Mask to the boy's face if (childLinkObjectIndex >= 0) { Mtx* mtx; Matrix_Put(&this->spookyMaskMtx); - mtx = MATRIX_NEWMTX(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[childLinkObjectIndex].segment); + mtx = MATRIX_NEWMTX(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[childLinkObjectIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx - 7); gSPDisplayList(POLY_OPA_DISP++, gLinkChildSpookyMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnCs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnCs* this = (EnCs*)thisx; if (this->flag & 1) { @@ -508,7 +508,7 @@ s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnCs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnCs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_809E2970 = { 500.0f, 800.0f, 0.0f }; EnCs* this = (EnCs*)thisx; diff --git a/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.h b/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.h index 6b2b0d109..0bc667652 100644 --- a/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.h +++ b/soh/src/overlays/actors/ovl_En_Cs/z_en_cs.h @@ -6,7 +6,7 @@ struct EnCs; -typedef void (*EnCsActionFunc)(struct EnCs*, GlobalContext*); +typedef void (*EnCsActionFunc)(struct EnCs*, PlayState*); typedef struct EnCs { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 86ecaf22b..51125b394 100644 --- a/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -26,20 +26,20 @@ typedef enum { /* 3 */ ENDAIKU_STATE_NO_TALK } EnDaikuTalkState; -void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDaiku_Init(Actor* thisx, PlayState* play); +void EnDaiku_Destroy(Actor* thisx, PlayState* play); +void EnDaiku_Update(Actor* thisx, PlayState* play); +void EnDaiku_Draw(Actor* thisx, PlayState* play); -void EnDaiku_TentIdle(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_Jailed(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_WaitFreedom(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_EscapeRotate(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx); -s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnDaiku_PostLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3s* rot, void* thisx); +void EnDaiku_TentIdle(EnDaiku* this, PlayState* play); +void EnDaiku_Jailed(EnDaiku* this, PlayState* play); +void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play); +void EnDaiku_InitEscape(EnDaiku* this, PlayState* play); +void EnDaiku_EscapeRotate(EnDaiku* this, PlayState* play); +void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play); +void EnDaiku_EscapeRun(EnDaiku* this, PlayState* play); +s32 EnDaiku_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnDaiku_PostLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Daiku_InitVars = { ACTOR_EN_DAIKU, @@ -147,7 +147,7 @@ void EnDaiku_ChangeAnim(EnDaiku* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Init(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; s32 pad; s32 noKill = true; @@ -163,9 +163,9 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { isFree = true; } - if (isFree == true && globalCtx->sceneNum == SCENE_GERUDOWAY) { + if (isFree == true && play->sceneNum == SCENE_GERUDOWAY) { noKill = false; - } else if (isFree == false && globalCtx->sceneNum == SCENE_TENT) { + } else if (isFree == false && play->sceneNum == SCENE_TENT) { noKill = false; } @@ -173,7 +173,7 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = 0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, 17); if (!noKill) { @@ -181,15 +181,15 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); Animation_Change(&this->skelAnime, sAnimationInfo[ENDAIKU_ANIM_SHOUT].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[ENDAIKU_ANIM_SHOUT].animation), sAnimationInfo[ENDAIKU_ANIM_SHOUT].mode, sAnimationInfo[ENDAIKU_ANIM_SHOUT].morphFrames); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.targetMode = 6; this->currentAnimIndex = -1; @@ -197,7 +197,7 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { this->initRot = this->actor.world.rot; this->initPos = this->actor.world.pos; - if (globalCtx->sceneNum == SCENE_GERUDOWAY) { + if (play->sceneNum == SCENE_GERUDOWAY) { EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_STAND, &this->currentAnimIndex); this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; this->actionFunc = EnDaiku_Jailed; @@ -215,28 +215,28 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDaiku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Destroy(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnDaiku_UpdateTalking(EnDaiku* this, GlobalContext* globalCtx) { +s32 EnDaiku_UpdateTalking(EnDaiku* this, PlayState* play) { s32 newTalkState = ENDAIKU_STATE_TALKING; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) { - if (globalCtx->sceneNum == SCENE_GERUDOWAY) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { + if (play->sceneNum == SCENE_GERUDOWAY) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x6007) { - Flags_SetSwitch(globalCtx, this->startFightSwitchFlag); + Flags_SetSwitch(play, this->startFightSwitchFlag); newTalkState = ENDAIKU_STATE_CAN_TALK; } else { this->actionFunc = EnDaiku_InitEscape; newTalkState = ENDAIKU_STATE_NO_TALK; } } - } else if (globalCtx->sceneNum == SCENE_TENT) { - if (Message_ShouldAdvance(globalCtx)) { + } else if (play->sceneNum == SCENE_TENT) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x6061: gSaveContext.infTable[23] |= 0x40; @@ -254,21 +254,21 @@ s32 EnDaiku_UpdateTalking(EnDaiku* this, GlobalContext* globalCtx) { return newTalkState; } -void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) { s32 carpenterType; s32 freedCount; s16 sp2E; s16 sp2C; if (this->talkState == ENDAIKU_STATE_TALKING) { - this->talkState = EnDaiku_UpdateTalking(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->talkState = EnDaiku_UpdateTalking(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->talkState = ENDAIKU_STATE_TALKING; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp2E, &sp2C); + Actor_GetScreenPos(play, &this->actor, &sp2E, &sp2C); if (sp2E >= 0 && sp2E <= 320 && sp2C >= 0 && sp2C <= 240 && this->talkState == ENDAIKU_STATE_CAN_TALK && - func_8002F2CC(&this->actor, globalCtx, 100.0f) == 1) { - if (globalCtx->sceneNum == SCENE_GERUDOWAY) { + func_8002F2CC(&this->actor, play, 100.0f) == 1) { + if (play->sceneNum == SCENE_GERUDOWAY) { if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) { freedCount = 0; for (carpenterType = 0; carpenterType < 4; carpenterType++) { @@ -295,7 +295,7 @@ void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) { (ENDAIKU_STATEFLAG_GERUDOFIGHTING | ENDAIKU_STATEFLAG_GERUDODEFEATED))) { this->actor.textId = 0x6007; } - } else if (globalCtx->sceneNum == SCENE_TENT) { + } else if (play->sceneNum == SCENE_TENT) { switch (this->actor.params & 3) { case 0: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { @@ -342,25 +342,25 @@ void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) { /** * The carpenter is idling in the tent. */ -void EnDaiku_TentIdle(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_TentIdle(EnDaiku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - EnDaiku_UpdateText(this, globalCtx); + EnDaiku_UpdateText(this, play); } /** * The carpenter is jailed in a Gerudo fortress cell, talking to him starts a fight against a gerudo guard */ -void EnDaiku_Jailed(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_Jailed(EnDaiku* this, PlayState* play) { EnGeldB* gerudo; s32 temp_t9; s32 temp_v1; if (!(this->stateFlags & ENDAIKU_STATEFLAG_GERUDOFIGHTING)) { - EnDaiku_UpdateText(this, globalCtx); + EnDaiku_UpdateText(this, play); } SkelAnime_Update(&this->skelAnime); - gerudo = (EnGeldB*)Actor_Find(&globalCtx->actorCtx, ACTOR_EN_GELDB, ACTORCAT_ENEMY); + gerudo = (EnGeldB*)Actor_Find(&play->actorCtx, ACTOR_EN_GELDB, ACTORCAT_ENEMY); if (gerudo == NULL) { this->stateFlags |= ENDAIKU_STATEFLAG_GERUDODEFEATED; this->stateFlags &= ~ENDAIKU_STATEFLAG_GERUDOFIGHTING; @@ -376,19 +376,19 @@ void EnDaiku_Jailed(EnDaiku* this, GlobalContext* globalCtx) { * The player defeated the gerudo guard and the carpenter is waiting for the cell door to be opened, and for the player * to then talk to him */ -void EnDaiku_WaitFreedom(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { + if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - EnDaiku_UpdateText(this, globalCtx); + EnDaiku_UpdateText(this, play); } } /** * The carpenter is free, initializes his running away animation */ -void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) { Path* path; f32 dxz; f32 dx; @@ -404,10 +404,10 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive; - EnDaiku_InitSubCamera(this, globalCtx); + EnDaiku_InitSubCamera(this, play); exitLoop = false; - path = &globalCtx->setupPathList[this->actor.params >> 4 & 0xF]; + path = &play->setupPathList[this->actor.params >> 4 & 0xF]; while (!exitLoop) { pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; @@ -427,18 +427,18 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) { /** * The carpenter is rotating towards where he is going next */ -void EnDaiku_EscapeRotate(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_EscapeRotate(EnDaiku* this, PlayState* play) { s16 diff; diff = Math_SmoothStepToS(&this->actor.shape.rot.y, this->rotYtowardsPath, 1, 0x1388, 0); SkelAnime_Update(&this->skelAnime); if (diff == 0) { this->actionFunc = EnDaiku_EscapeRun; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) { s32 pad; Vec3f eyePosDeltaLocal; Vec3f eyePosDeltaWorld; @@ -460,16 +460,16 @@ void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx) { this->subCamAtTarget.y = this->subCamAt.y = this->actor.world.pos.y + 60.0f; this->subCamAtTarget.z = this->subCamAt.z = this->actor.world.pos.z; - this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); - Gameplay_CameraSetFov(globalCtx, this->subCamId, globalCtx->mainCamera.fov); - func_8002DF54(globalCtx, &this->actor, 1); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetFov(play, this->subCamId, play->mainCamera.fov); + func_8002DF54(play, &this->actor, 1); } -void EnDaiku_UpdateSubCamera(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_UpdateSubCamera(EnDaiku* this, PlayState* play) { s32 pad; this->subCamAtTarget.x = this->actor.world.pos.x; @@ -480,37 +480,37 @@ void EnDaiku_UpdateSubCamera(EnDaiku* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->subCamAt.y, this->subCamAtTarget.y, 1.0f, 1000.0f, 0.0f); Math_SmoothStepToF(&this->subCamAt.z, this->subCamAtTarget.z, 1.0f, 1000.0f, 0.0f); - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } -void EnDaiku_EscapeSuccess(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) { static Vec3f D_809E4148 = { 0.0f, 0.0f, 120.0f }; Actor* gerudoGuard; Vec3f vec; - Gameplay_ClearCamera(globalCtx, this->subCamId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); this->subCamActive = false; if ((gSaveContext.eventChkInf[9] & 0xF) == 0xF) { Matrix_RotateY(this->initRot.y * (M_PI / 0x8000), MTXMODE_NEW); Matrix_MultVec3f(&D_809E4148, &vec); gerudoGuard = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y, this->initPos.z + vec.z, 0, Math_FAtan2F(-vec.x, -vec.z) * (0x8000 / M_PI), 0, 2); if (gerudoGuard == NULL) { Actor_Kill(&this->actor); } } else { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); } } /** * The carpenter is running away */ -void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_EscapeRun(EnDaiku* this, PlayState* play) { s32 pad1; Path* path; s16 ry; @@ -520,7 +520,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { f32 dxz; Vec3s* pointPos; - path = &globalCtx->setupPathList[this->actor.params >> 4 & 0xF]; + path = &play->setupPathList[this->actor.params >> 4 & 0xF]; pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; dz = pointPos->z - this->actor.world.pos.z; @@ -530,7 +530,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { this->waypoint++; if (this->waypoint >= path->count) { if (this->subCamActive) { - EnDaiku_EscapeSuccess(this, globalCtx); + EnDaiku_EscapeSuccess(this, play); } Actor_Kill(&this->actor); return; @@ -541,22 +541,22 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; Math_SmoothStepToF(&this->actor.speedXZ, this->runSpeed, 0.6f, dxz, 0.0f); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (this->subCamActive) { - EnDaiku_UpdateSubCamera(this, globalCtx); + EnDaiku_UpdateSubCamera(this, play); if (this->escapeSubCamTimer-- <= 0) { - EnDaiku_EscapeSuccess(this, globalCtx); + EnDaiku_EscapeSuccess(this, play); } } SkelAnime_Update(&this->skelAnime); } -void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Update(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; s32 curFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->currentAnimIndex == ENDAIKU_ANIM_RUN) { curFrame = this->skelAnime.curFrame; @@ -566,9 +566,9 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->stateFlags & ENDAIKU_STATEFLAG_1) { this->unk_244.unk_18.x = player->actor.focus.pos.x; @@ -583,12 +583,12 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Draw(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((thisx->params & 3) == 0) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); @@ -600,13 +600,13 @@ void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaiku_OverrideLimbDraw, EnDaiku_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDaiku_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDaiku* this = (EnDaiku*)thisx; switch (limb) { @@ -623,18 +623,18 @@ s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Ve return false; } -void EnDaiku_PostLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDaiku_PostLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3s* rot, void* thisx) { static Gfx* hairDLists[] = { object_daiku_DL_005BD0, object_daiku_DL_005AC0, object_daiku_DL_005990, object_daiku_DL_005880 }; static Vec3f targetPosHeadLocal = { 700, 1100, 0 }; EnDaiku* this = (EnDaiku*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limb == 15) { // head Matrix_MultVec3f(&targetPosHeadLocal, &this->actor.focus.pos); gSPDisplayList(POLY_OPA_DISP++, hairDLists[this->actor.params & 3]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index f76c9756c..697376277 100644 --- a/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -6,7 +6,7 @@ struct EnDaiku; -typedef void (*EnDaikuActionFunc)(struct EnDaiku*, GlobalContext*); +typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); typedef struct EnDaiku { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 99cae7589..8d5c6eee0 100644 --- a/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -16,13 +16,13 @@ typedef enum { /* 0x3 */ CARPENTER_SHIRO // Pink and purple pants, two-spiked hair } KakarikoCarpenterType; -void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDaikuKakariko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDaikuKakariko_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDaikuKakariko_Init(Actor* thisx, PlayState* play); +void EnDaikuKakariko_Destroy(Actor* thisx, PlayState* play); +void EnDaikuKakariko_Update(Actor* thisx, PlayState* play); +void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play); -void EnDaikuKakariko_Wait(EnDaikuKakariko* this, GlobalContext* globalCtx); -void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx); +void EnDaikuKakariko_Wait(EnDaikuKakariko* this, PlayState* play); +void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play); const ActorInit En_Daiku_Kakariko_InitVars = { ACTOR_EN_DAIKU_KAKARIKO, @@ -124,13 +124,13 @@ void EnDaikuKakariko_ChangeAnim(EnDaikuKakariko* this, s32 index, s32* currentIn *currentIndex = index; } -void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) { static u16 initFlags[] = { 0x0080, 0x00B0, 0x0070, 0x0470 }; // List of inital values for this->flags EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; s32 pad; if (LINK_AGE_IN_YEARS == YEARS_CHILD) { - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT01: if (IS_DAY) { this->flags |= 1; @@ -158,10 +158,10 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInit); @@ -169,7 +169,7 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { Animation_GetLastFrame(sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].animation), sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].mode, sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].morphFrames); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.gravity = 0.0f; this->runSpeed = 3.0f; @@ -204,16 +204,16 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Destroy(Actor* thisx, PlayState* play) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnDaikuKakariko_GetTalkState(EnDaikuKakariko* this, GlobalContext* globalCtx) { +s32 EnDaikuKakariko_GetTalkState(EnDaikuKakariko* this, PlayState* play) { s32 talkState = 2; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x6061: gSaveContext.infTable[23] |= 0x40; @@ -227,21 +227,21 @@ s32 EnDaikuKakariko_GetTalkState(EnDaikuKakariko* this, GlobalContext* globalCtx return talkState; } -void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, PlayState* play) { static s32 maskReactionSets[] = { 1, 2, 3, 4 }; s16 sp26; s16 sp24; if (this->talkState == 2) { - this->talkState = EnDaikuKakariko_GetTalkState(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->talkState = EnDaikuKakariko_GetTalkState(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->talkState = 2; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); if ((sp26 >= 0) && (sp26 <= 320) && (sp24 >= 0) && (sp24 <= 240) && (this->talkState == 0) && - (func_8002F2CC(&this->actor, globalCtx, 100.0f) == 1)) { - this->actor.textId = Text_GetFaceReaction(globalCtx, maskReactionSets[this->actor.params & 3]); + (func_8002F2CC(&this->actor, play, 100.0f) == 1)) { + this->actor.textId = Text_GetFaceReaction(play, maskReactionSets[this->actor.params & 3]); if (this->actor.textId == 0) { switch (this->actor.params & 3) { @@ -279,12 +279,12 @@ void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, GlobalContext* globalC } } -void EnDaikuKakariko_Talk(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_Talk(EnDaikuKakariko* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_3, &this->currentAnimIndex); } - EnDaikuKakariko_HandleTalking(this, globalCtx); + EnDaikuKakariko_HandleTalking(this, play); if (this->talkState == 0) { if (this->flags & 0x10) { @@ -307,8 +307,8 @@ void EnDaikuKakariko_Talk(EnDaikuKakariko* this, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_Wait(EnDaikuKakariko* this, GlobalContext* globalCtx) { - EnDaikuKakariko_HandleTalking(this, globalCtx); +void EnDaikuKakariko_Wait(EnDaikuKakariko* this, PlayState* play) { + EnDaikuKakariko_HandleTalking(this, play); if (SkelAnime_Update(&this->skelAnime)) { EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_0, &this->currentAnimIndex); @@ -328,7 +328,7 @@ void EnDaikuKakariko_Wait(EnDaikuKakariko* this, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->timer--; @@ -340,7 +340,7 @@ void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx } } - EnDaikuKakariko_HandleTalking(this, globalCtx); + EnDaikuKakariko_HandleTalking(this, play); if (this->talkState != 0) { this->flags |= 0x200; @@ -349,7 +349,7 @@ void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx } } -void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play) { s32 pad; Path* path; Vec3s* pathPos; @@ -361,7 +361,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { s32 run; do { - path = &globalCtx->setupPathList[(this->actor.params >> 8) & 0xFF]; + path = &play->setupPathList[(this->actor.params >> 8) & 0xFF]; pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint]; xDist = pathPos->x - this->actor.world.pos.x; zDist = pathPos->z - this->actor.world.pos.z; @@ -433,17 +433,17 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (this->flags & 0x40) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } else if (this->flags & 0x80) { this->runFlag |= 1; this->flags &= ~0x0080; } else if (this->runFlag & 1) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->runFlag &= ~1; } SkelAnime_Update(&this->skelAnime); - EnDaikuKakariko_HandleTalking(this, globalCtx); + EnDaikuKakariko_HandleTalking(this, play); if (this->talkState != 0) { this->flags |= 0x200; @@ -452,10 +452,10 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Update(Actor* thisx, PlayState* play) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; if (this->currentAnimIndex == 3) { @@ -472,9 +472,9 @@ void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.radius = 63; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->npcInfo.unk_18.x = player->actor.focus.pos.x; this->npcInfo.unk_18.y = player->actor.focus.pos.y; @@ -493,7 +493,7 @@ void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->neckAngle.x, this->neckAngleTarget.x, 1, 1820, 0); } -s32 EnDaikuKakariko_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnDaikuKakariko_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; Vec3s angle; @@ -524,28 +524,28 @@ s32 EnDaikuKakariko_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gf return 0; } -void EnDaikuKakariko_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDaikuKakariko_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Gfx* carpenterHeadDLists[] = { object_daiku_DL_005BD0, object_daiku_DL_005AC0, object_daiku_DL_005990, object_daiku_DL_005880 }; static Vec3f unkVec = { 700.0f, 1100.0f, 0.0f }; EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 15) { Matrix_MultVec3f(&unkVec, &this->actor.focus.pos); gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[this->actor.params & 3]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDaikuKakariko_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((thisx->params & 3) == CARPENTER_ICHIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); @@ -557,8 +557,8 @@ void EnDaikuKakariko_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaikuKakariko_OverrideLimbDraw, EnDaikuKakariko_PostLimbDraw, thisx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h b/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h index ebb5187c2..ad87945ca 100644 --- a/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h +++ b/soh/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h @@ -6,7 +6,7 @@ struct EnDaikuKakariko; -typedef void (*EnDaikuKakarikoActionFunc)(struct EnDaikuKakariko*, GlobalContext*); +typedef void (*EnDaikuKakarikoActionFunc)(struct EnDaikuKakariko*, PlayState*); typedef struct EnDaikuKakariko { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 3605461fd..e87704671 100644 --- a/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -5,28 +5,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnDekubaba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDekubaba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDekubaba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDekubaba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDekubaba_Init(Actor* thisx, PlayState* play); +void EnDekubaba_Destroy(Actor* thisx, PlayState* play); +void EnDekubaba_Update(Actor* thisx, PlayState* play); +void EnDekubaba_Draw(Actor* thisx, PlayState* play); void EnDekuBaba_Reset(void); void EnDekubaba_SetupWait(EnDekubaba* this); void EnDekubaba_SetupGrow(EnDekubaba* this); -void EnDekubaba_Wait(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Retract(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_DecideLunge(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_PrepareLunge(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Recover(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Hit(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_StunnedVertical(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Sway(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_ShrinkDie(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_DeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx); +void EnDekubaba_Wait(EnDekubaba* this, PlayState* play); +void EnDekubaba_Grow(EnDekubaba* this, PlayState* play); +void EnDekubaba_Retract(EnDekubaba* this, PlayState* play); +void EnDekubaba_DecideLunge(EnDekubaba* this, PlayState* play); +void EnDekubaba_Lunge(EnDekubaba* this, PlayState* play); +void EnDekubaba_PrepareLunge(EnDekubaba* this, PlayState* play); +void EnDekubaba_PullBack(EnDekubaba* this, PlayState* play); +void EnDekubaba_Recover(EnDekubaba* this, PlayState* play); +void EnDekubaba_Hit(EnDekubaba* this, PlayState* play); +void EnDekubaba_StunnedVertical(EnDekubaba* this, PlayState* play); +void EnDekubaba_Sway(EnDekubaba* this, PlayState* play); +void EnDekubaba_PrunedSomersault(EnDekubaba* this, PlayState* play); +void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play); +void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play); static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; @@ -222,16 +222,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_STOP), }; -void EnDekubaba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Init(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, this->morphTable, 8); - 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); if (this->actor.params == DEKUBABA_BIG) { this->size = 2.5f; @@ -274,10 +274,10 @@ void EnDekubaba_Init(Actor* thisx, GlobalContext* globalCtx) { this->bodyPartsPos[3] = this->actor.home.pos; } -void EnDekubaba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnDekubaba_DisableHitboxes(EnDekubaba* this) { @@ -449,14 +449,14 @@ void EnDekubaba_SetupSway(EnDekubaba* this) { this->actionFunc = EnDekubaba_Sway; } -void EnDekubaba_SetupDeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_SetupDeadStickDrop(EnDekubaba* this, PlayState* play) { Actor_SetScale(&this->actor, 0.03f); this->actor.shape.rot.x -= 0x4000; this->actor.shape.yOffset = 1000.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.shape.shadowScale = 3.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.flags &= ~ACTOR_FLAG_5; this->timer = 200; this->actionFunc = EnDekubaba_DeadStickDrop; @@ -464,7 +464,7 @@ void EnDekubaba_SetupDeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx) { // Action functions -void EnDekubaba_Wait(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Wait(EnDekubaba* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -479,8 +479,8 @@ void EnDekubaba_Wait(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 headDistHorizontal; f32 headDistVertical; f32 headShiftX; @@ -535,7 +535,7 @@ void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx) { this->actor.world.pos.x = this->actor.home.pos.x + headShiftX; this->actor.world.pos.z = this->actor.home.pos.z + headShiftZ; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); if (this->timer == 0) { @@ -547,7 +547,7 @@ void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Retract(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) { f32 headDistHorizontal; f32 headDistVertical; f32 xShift; @@ -596,7 +596,7 @@ void EnDekubaba_Retract(EnDekubaba* this, GlobalContext* globalCtx) { this->actor.world.pos.x = this->actor.home.pos.x + xShift; this->actor.world.pos.z = this->actor.home.pos.z + zShift; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, 1, HAHEN_OBJECT_DEFAULT, 0xA, NULL); if (this->timer == 0) { @@ -619,8 +619,8 @@ void EnDekubaba_UpdateHeadPosition(EnDekubaba* this) { this->actor.home.pos.z + Math_CosS(this->actor.shape.rot.y) * (horizontalHeadShift * this->size); } -void EnDekubaba_DecideLunge(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDekubaba_DecideLunge(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { @@ -665,7 +665,7 @@ void EnDekubaba_DecideLunge(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Lunge(EnDekubaba* this, PlayState* play) { static Color_RGBA8 primColor = { 105, 255, 105, 255 }; static Color_RGBA8 envColor = { 150, 250, 150, 0 }; s32 allStepsDone; @@ -698,7 +698,7 @@ void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx) { velocity.y = 0.0f; velocity.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; - func_8002829C(globalCtx, &this->actor.world.pos, &velocity, &sZeroVec, &primColor, &envColor, 1, + func_8002829C(play, &this->actor.world.pos, &velocity, &sZeroVec, &primColor, &envColor, 1, this->size * 100.0f); this->timer = 1; this->collider.base.acFlags |= AC_ON; @@ -724,8 +724,8 @@ void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_PrepareLunge(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDekubaba_PrepareLunge(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; @@ -744,7 +744,7 @@ void EnDekubaba_PrepareLunge(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_PullBack(EnDekubaba* this, PlayState* play) { Vec3f dustPos; f32 xIncr; f32 zIncr; @@ -762,7 +762,7 @@ void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx) { dustPos = this->actor.home.pos; for (i = 0; i < 3; i++) { - func_800286CC(globalCtx, &dustPos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 50.0f); + func_800286CC(play, &dustPos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 50.0f); dustPos.x += xIncr; dustPos.z += zIncr; } @@ -829,7 +829,7 @@ void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_Recover(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Recover(EnDekubaba* this, PlayState* play) { s32 anyStepsDone; SkelAnime_Update(&this->skelAnime); @@ -859,7 +859,7 @@ void EnDekubaba_Recover(EnDekubaba* this, GlobalContext* globalCtx) { /** * Hit by a weapon or hit something when lunging. */ -void EnDekubaba_Hit(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Hit(EnDekubaba* this, PlayState* play) { s32 allStepsDone; SkelAnime_Update(&this->skelAnime); @@ -890,7 +890,7 @@ void EnDekubaba_Hit(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_StunnedVertical(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_StunnedVertical(EnDekubaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -911,7 +911,7 @@ void EnDekubaba_StunnedVertical(EnDekubaba* this, GlobalContext* globalCtx) { /** * Sway back and forth with decaying amplitude until close enough to vertical. */ -void EnDekubaba_Sway(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Sway(EnDekubaba* this, PlayState* play) { s16 angleToVertical; SkelAnime_Update(&this->skelAnime); @@ -936,7 +936,7 @@ void EnDekubaba_Sway(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_PrunedSomersault(EnDekubaba* this, PlayState* play) { s32 i; Vec3f dustPos; f32 deltaX; @@ -950,14 +950,14 @@ void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->stemSectionAngle[0], 0x4800, 0x71C); Math_ScaledStepToS(&this->stemSectionAngle[1], 0x4800, 0x71C); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); if ((this->actor.scale.x > 0.005f) && ((this->actor.bgCheckFlags & 2) || (this->actor.bgCheckFlags & 8))) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f; this->actor.speedXZ = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); } @@ -973,60 +973,60 @@ void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { deltaZ = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); for (i = 0; i < 4; i++) { - func_800286CC(globalCtx, &dustPos, &sZeroVec, &sZeroVec, 500, 50); + func_800286CC(play, &dustPos, &sZeroVec, &sZeroVec, 500, 50); dustPos.x += deltaX; dustPos.y += deltaY; dustPos.z += deltaZ; } - func_800286CC(globalCtx, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); - EnDekubaba_SetupDeadStickDrop(this, globalCtx); + func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); + EnDekubaba_SetupDeadStickDrop(this, play); } } /** * Die and drop Deku Nuts (Stick drop is handled elsewhere) */ -void EnDekubaba_ShrinkDie(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play) { Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, this->size * 5.0f); if (Math_StepToF(&this->actor.scale.x, this->size * 0.1f * 0.01f, this->size * 0.1f * 0.01f)) { - func_800286CC(globalCtx, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); + func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); if (this->actor.dropFlag == 0) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); if (this->actor.params == DEKUBABA_BIG) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_NUTS); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); } } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x30); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x30); } Actor_Kill(&this->actor); } this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; this->actor.shape.rot.z += 0x1C70; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void EnDekubaba_DeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play) { if (this->timer != 0) { this->timer--; } - if (Actor_HasParent(&this->actor, globalCtx) || (this->timer == 0)) { + if (Actor_HasParent(&this->actor, play) || (this->timer == 0)) { Actor_Kill(&this->actor); return; } - func_8002F554(&this->actor, globalCtx, GI_STICKS_1); + func_8002F554(&this->actor, play, GI_STICKS_1); } // Update and associated functions -void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_UpdateDamage(EnDekubaba* this, PlayState* play) { Vec3f* firePos; f32 fireScale; s32 phi_s0; // Used for both health and iterator @@ -1077,13 +1077,13 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { fireScale = (this->size * 70.0f); for (phi_s0 = 0; phi_s0 < 4; phi_s0++) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, firePos, fireScale, 0, 0, phi_s0); + EffectSsEnFire_SpawnVec3f(play, &this->actor, firePos, fireScale, 0, 0, phi_s0); } } } else { return; } - } else if ((globalCtx->actorCtx.unk_02 != 0) && (this->collider.base.colType != COLTYPE_HARD) && + } else if ((play->actorCtx.unk_02 != 0) && (this->collider.base.colType != COLTYPE_HARD) && (this->actionFunc != EnDekubaba_StunnedVertical) && (this->actionFunc != EnDekubaba_Hit) && (this->actor.colChkInfo.health != 0)) { this->actor.colChkInfo.health--; @@ -1100,7 +1100,7 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKU_DAMAGE); } } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.params == DEKUBABA_BIG) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKU_DEAD); } else { @@ -1109,7 +1109,7 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Update(Actor* thisx, PlayState* play) { s32 pad; EnDekubaba* this = (EnDekubaba*)thisx; @@ -1118,38 +1118,38 @@ void EnDekubaba_Update(Actor* thisx, GlobalContext* globalCtx) { EnDekubaba_SetupRecover(this); } - EnDekubaba_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnDekubaba_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actionFunc == EnDekubaba_PrunedSomersault) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, this->size * 15.0f, 10.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->size * 15.0f, 10.0f, 5); } else if (this->actionFunc != EnDekubaba_DeadStickDrop) { - 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->boundFloor == NULL) { this->boundFloor = this->actor.floorPoly; } } if (this->actionFunc == EnDekubaba_Lunge) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); this->actor.flags |= ACTOR_FLAG_24; } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnDekubaba_DeadStickDrop) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } // Draw functions -void EnDekubaba_DrawStemRetracted(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DrawStemRetracted(EnDekubaba* this, PlayState* play) { f32 horizontalScale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); horizontalScale = this->size * 0.01f; @@ -1157,16 +1157,16 @@ void EnDekubaba_DrawStemRetracted(EnDekubaba* this, GlobalContext* globalCtx) { MTXMODE_NEW); Matrix_RotateZYX(this->stemSectionAngle[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_Scale(horizontalScale, horizontalScale, horizontalScale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemTopDL); Actor_SetFocus(&this->actor, 0.0f); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DrawStemExtended(EnDekubaba* this, PlayState* play) { static Gfx* stemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; MtxF mtx; s32 i; @@ -1175,7 +1175,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { f32 scale; s32 stemSections; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc == EnDekubaba_PrunedSomersault) { stemSections = 2; @@ -1202,7 +1202,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { Matrix_Put(&mtx); Matrix_RotateZYX(this->stemSectionAngle[i], this->actor.shape.rot.y, 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, stemDLists[i]); @@ -1230,28 +1230,28 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDekubaba_DrawStemBasePruned(EnDekubaba* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnDekubaba_DrawStemBasePruned(EnDekubaba* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); Matrix_RotateZYX(this->stemSectionAngle[2], this->actor.shape.rot.y, 0, 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++, gDekuBabaStemBaseDL); Collider_UpdateSpheres(55, &this->collider); Collider_UpdateSpheres(56, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDekubaba_DrawBaseShadow(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DrawBaseShadow(EnDekubaba* this, PlayState* play) { MtxF mtx; f32 horizontalScale; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80094044(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); @@ -1260,13 +1260,13 @@ void EnDekubaba_DrawBaseShadow(EnDekubaba* this, GlobalContext* globalCtx) { horizontalScale = this->size * 0.15f; Matrix_Scale(horizontalScale, 1.0f, horizontalScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 EnDekubaba_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDekubaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnDekubaba* this = (EnDekubaba*)thisx; if (limbIndex == 1) { @@ -1274,48 +1274,48 @@ void EnDekubaba_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnDekubaba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Draw(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actionFunc != EnDekubaba_DeadStickDrop) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDekubaba_PostLimbDraw, this); if (this->actionFunc == EnDekubaba_Wait) { - EnDekubaba_DrawStemRetracted(this, globalCtx); + EnDekubaba_DrawStemRetracted(this, play); } else { - EnDekubaba_DrawStemExtended(this, globalCtx); + EnDekubaba_DrawStemExtended(this, play); } scale = this->size * 0.01f; Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); Matrix_RotateY(this->actor.home.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(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++, gDekuBabaBaseLeavesDL); if (this->actionFunc == EnDekubaba_PrunedSomersault) { - EnDekubaba_DrawStemBasePruned(this, globalCtx); + EnDekubaba_DrawStemBasePruned(this, play); } if (this->boundFloor != NULL) { - EnDekubaba_DrawBaseShadow(this, globalCtx); + EnDekubaba_DrawBaseShadow(this, play); } // Display solid until 40 frames left, then blink until killed. } else if ((this->timer > 40) || ((this->timer % 2) != 0)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } //OTRTODO fix this one diff --git a/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h b/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h index fa80ce82d..b6e5243e9 100644 --- a/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/soh/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -6,7 +6,7 @@ struct EnDekubaba; -typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, GlobalContext*); +typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, PlayState*); typedef enum { /* 0 */ DEKUBABA_NORMAL, diff --git a/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index e84ee67f3..e468ec7e8 100644 --- a/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -12,23 +12,23 @@ #define DEKUNUTS_FLOWER 10 -void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDekunuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDekunuts_Init(Actor* thisx, PlayState* play); +void EnDekunuts_Destroy(Actor* thisx, PlayState* play); +void EnDekunuts_Update(Actor* thisx, PlayState* play); +void EnDekunuts_Draw(Actor* thisx, PlayState* play); void EnDekunuts_SetupWait(EnDekunuts* this); -void EnDekunuts_Wait(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_LookAround(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Stand(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Burrow(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_BeginRun(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Run(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Gasp(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_BeDamaged(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_BeStunned(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Die(EnDekunuts* this, GlobalContext* globalCtx); +void EnDekunuts_Wait(EnDekunuts* this, PlayState* play); +void EnDekunuts_LookAround(EnDekunuts* this, PlayState* play); +void EnDekunuts_Stand(EnDekunuts* this, PlayState* play); +void EnDekunuts_ThrowNut(EnDekunuts* this, PlayState* play); +void EnDekunuts_Burrow(EnDekunuts* this, PlayState* play); +void EnDekunuts_BeginRun(EnDekunuts* this, PlayState* play); +void EnDekunuts_Run(EnDekunuts* this, PlayState* play); +void EnDekunuts_Gasp(EnDekunuts* this, PlayState* play); +void EnDekunuts_BeDamaged(EnDekunuts* this, PlayState* play); +void EnDekunuts_BeStunned(EnDekunuts* this, PlayState* play); +void EnDekunuts_Die(EnDekunuts* this, PlayState* play); const ActorInit En_Dekunuts_InitVars = { ACTOR_EN_DEKUNUTS, @@ -106,7 +106,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP), }; -void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Init(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; s32 pad; @@ -115,10 +115,10 @@ void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); } else { ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuNutsSkel, &gDekuNutsStandAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gDekuNutsSkel, &gDekuNutsStandAnim, this->jointTable, this->morphTable, 25); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); this->shotsPerRound = ((thisx->params >> 8) & 0xFF); thisx->params &= 0xFF; @@ -126,16 +126,16 @@ void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->shotsPerRound = 1; } EnDekunuts_SetupWait(this); - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_DEKUNUTS, thisx->world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_DEKUNUTS, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, thisx->world.rot.y, 0, DEKUNUTS_FLOWER); } } -void EnDekunuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Destroy(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; if (this->actor.params != DEKUNUTS_FLOWER) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } @@ -235,7 +235,7 @@ void EnDekunuts_SetupDie(EnDekunuts* this) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DEAD); } -void EnDekunuts_Wait(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Wait(EnDekunuts* this, PlayState* play) { s32 hasSlowPlaybackSpeed = false; if (this->skelAnime.playSpeed < 0.5f) { @@ -269,7 +269,7 @@ void EnDekunuts_Wait(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_LookAround(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_LookAround(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -279,7 +279,7 @@ void EnDekunuts_LookAround(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Stand(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Stand(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -298,7 +298,7 @@ void EnDekunuts_Stand(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_ThrowNut(EnDekunuts* this, PlayState* play) { Vec3f spawnPos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -308,7 +308,7 @@ void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx) { spawnPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f); spawnPos.y = this->actor.world.pos.y + 12.0f; spawnPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0) != NULL) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } @@ -320,7 +320,7 @@ void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Burrow(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Burrow(EnDekunuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnDekunuts_SetupWait(this); } else { @@ -333,7 +333,7 @@ void EnDekunuts_Burrow(EnDekunuts* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->actor.home.pos.z, 0.5f, 3.0f); } -void EnDekunuts_BeginRun(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_BeginRun(EnDekunuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->runDirection = this->actor.yawTowardsPlayer + 0x8000; this->runAwayCount = 3; @@ -342,7 +342,7 @@ void EnDekunuts_BeginRun(EnDekunuts* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); } -void EnDekunuts_Run(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Run(EnDekunuts* this, PlayState* play) { s16 diffRotInit; s16 diffRot; f32 phi_f0; @@ -389,7 +389,7 @@ void EnDekunuts_Run(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Gasp(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Gasp(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -399,14 +399,14 @@ void EnDekunuts_Gasp(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_BeDamaged(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_BeDamaged(EnDekunuts* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); if (SkelAnime_Update(&this->skelAnime)) { EnDekunuts_SetupDie(this); } } -void EnDekunuts_BeStunned(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_BeStunned(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->animFlagAndTimer != 0) { @@ -420,7 +420,7 @@ void EnDekunuts_BeStunned(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Die(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Die(EnDekunuts* this, PlayState* play) { static Vec3f effectVelAndAccel = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -430,19 +430,19 @@ void EnDekunuts_Die(EnDekunuts* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x; effectPos.y = this->actor.world.pos.y + 18.0f; effectPos.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &effectPos, &effectVelAndAccel, &effectVelAndAccel, 200, 0, 255, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &effectPos, &effectVelAndAccel, &effectVelAndAccel, 200, 0, 255, 255, 255, 255, 150, 150, 150, 1, 13, 1); effectPos.y = this->actor.world.pos.y + 10.0f; - EffectSsHahen_SpawnBurst(globalCtx, &effectPos, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x30); + EffectSsHahen_SpawnBurst(play, &effectPos, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x30); if (this->actor.child != NULL) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, this->actor.child, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, this->actor.child, ACTORCAT_PROP); } Actor_Kill(&this->actor); } } -void EnDekunuts_ColliderCheck(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_ColliderCheck(EnDekunuts* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, 1); @@ -450,11 +450,11 @@ void EnDekunuts_ColliderCheck(EnDekunuts* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (this->actor.colChkInfo.damageEffect != 1) { if (this->actor.colChkInfo.damageEffect == 2) { - EffectSsFCircle_Spawn(globalCtx, &this->actor, &this->actor.world.pos, 40, 50); + EffectSsFCircle_Spawn(play, &this->actor, &this->actor.world.pos, 40, 50); } EnDekunuts_SetupBeDamaged(this); if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } } else if (this->actionFunc != EnDekunuts_BeStunned) { EnDekunuts_SetupBeStunned(this); @@ -463,26 +463,26 @@ void EnDekunuts_ColliderCheck(EnDekunuts* this, GlobalContext* globalCtx) { } else { EnDekunuts_SetupBeginRun(this); } - } else if ((this->actor.colChkInfo.mass == MASS_IMMOVABLE) && (globalCtx->actorCtx.unk_02 != 0)) { + } else if ((this->actor.colChkInfo.mass == MASS_IMMOVABLE) && (play->actorCtx.unk_02 != 0)) { EnDekunuts_SetupBeginRun(this); } } -void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Update(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; s32 pad; if (this->actor.params != DEKUNUTS_FLOWER) { - EnDekunuts_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnDekunuts_ColliderCheck(this, play); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, 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->actionFunc == EnDekunuts_Wait) { Actor_SetFocus(&this->actor, this->skelAnime.curFrame); } else if (this->actionFunc == EnDekunuts_Burrow) { @@ -494,7 +494,7 @@ void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDekunuts* this = (EnDekunuts*)thisx; f32 x; @@ -525,13 +525,13 @@ s32 EnDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Draw(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; if (this->actor.params == DEKUNUTS_FLOWER) { - Gfx_DrawDListOpa(globalCtx, gDekuNutsFlowerDL); + Gfx_DrawDListOpa(play, gDekuNutsFlowerDL); } else { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDekunuts_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDekunuts_OverrideLimbDraw, NULL, this); } } diff --git a/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index f80727ac7..900305597 100644 --- a/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/soh/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -6,7 +6,7 @@ struct EnDekunuts; -typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, GlobalContext*); +typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, PlayState*); typedef struct EnDekunuts { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c index b1d9252e4..a183d1129 100644 --- a/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -13,23 +13,23 @@ typedef enum { /* 6 */ DH_DAMAGE } EnDhAction; -void EnDh_Init(Actor* this, GlobalContext* globalCtx); -void EnDh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDh_Init(Actor* this, PlayState* play); +void EnDh_Destroy(Actor* thisx, PlayState* play); +void EnDh_Update(Actor* thisx, PlayState* play); +void EnDh_Draw(Actor* thisx, PlayState* play); void EnDh_SetupWait(EnDh* this); void EnDh_SetupWalk(EnDh* this); void EnDh_SetupAttack(EnDh* this); void EnDh_SetupBurrow(EnDh* this); -void EnDh_Wait(EnDh* this, GlobalContext* globalCtx); -void EnDh_Walk(EnDh* this, GlobalContext* globalCtx); -void EnDh_Retreat(EnDh* this, GlobalContext* globalCtx); -void EnDh_Attack(EnDh* this, GlobalContext* globalCtx); -void EnDh_Burrow(EnDh* this, GlobalContext* globalCtx); -void EnDh_Damage(EnDh* this, GlobalContext* globalCtx); -void EnDh_Death(EnDh* this, GlobalContext* globalCtx); +void EnDh_Wait(EnDh* this, PlayState* play); +void EnDh_Walk(EnDh* this, PlayState* play); +void EnDh_Retreat(EnDh* this, PlayState* play); +void EnDh_Attack(EnDh* this, PlayState* play); +void EnDh_Burrow(EnDh* this, PlayState* play); +void EnDh_Damage(EnDh* this, PlayState* play); +void EnDh_Death(EnDh* this, PlayState* play); const ActorInit En_Dh_InitVars = { ACTOR_EN_DH, @@ -137,12 +137,12 @@ void EnDh_SetupAction(EnDh* this, EnDhActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnDh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Init(Actor* thisx, PlayState* play) { EnDh* this = (EnDh*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &D_809EC620; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dh_Skel_007E88, &object_dh_Anim_005880, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dh_Skel_007E88, &object_dh_Anim_005880, this->jointTable, this->limbRotTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 64.0f); this->actor.params = ENDH_WAIT_UNDERGROUND; @@ -150,23 +150,23 @@ void EnDh_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = LINK_IS_ADULT ? 14 : 20; this->alpha = this->unk_258 = 255; this->actor.flags &= ~ACTOR_FLAG_0; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->collider2); - Collider_SetJntSph(globalCtx, &this->collider2, &this->actor, &sJntSphInit, this->elements); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->collider2); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit, this->elements); EnDh_SetupWait(this); } -void EnDh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDh* this = (EnDh*)thisx; func_800F5B58(); - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyJntSph(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyJntSph(play, &this->collider2); } -void EnDh_SpawnDebris(GlobalContext* globalCtx, EnDh* this, Vec3f* spawnPos, f32 spread, s32 arg4, f32 accelXZ, +void EnDh_SpawnDebris(PlayState* play, EnDh* this, Vec3f* spawnPos, f32 spread, s32 arg4, f32 accelXZ, f32 scale) { Vec3f pos; Vec3f vel = { 0.0f, 8.0f, 0.0f }; @@ -182,7 +182,7 @@ void EnDh_SpawnDebris(GlobalContext* globalCtx, EnDh* this, Vec3f* spawnPos, f32 accel.z = (Rand_ZeroOne() - 0.5f) * accelXZ; vel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; scaleMod = (Rand_ZeroOne() * 5.0f) + 12.0f; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, arg4, scaleMod * scale, -1, 10, NULL); + EffectSsHahen_Spawn(play, &pos, &vel, &accel, arg4, scaleMod * scale, -1, 10, NULL); } void EnDh_SetupWait(EnDh* this) { @@ -198,11 +198,11 @@ void EnDh_SetupWait(EnDh* this) { EnDh_SetupAction(this, EnDh_Wait); } -void EnDh_Wait(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Wait(EnDh* this, PlayState* play) { if ((s32)this->skelAnime.curFrame == 5) { func_800F5ACC(NA_BGM_MINI_BOSS); } - if (Actor_GetCollidedExplosive(globalCtx, &this->collider1.base)) { + if (Actor_GetCollidedExplosive(play, &this->collider1.base)) { this->actor.params = ENDH_START_ATTACK_BOMB; } if ((this->actor.params >= ENDH_START_ATTACK_GRAB) || (this->actor.params <= ENDH_HANDS_KILLED_4)) { @@ -219,7 +219,7 @@ void EnDh_Wait(EnDh* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->dirtWaveSpread, 300.0f, 1.0f, 5.0f, 0.0f); this->dirtWaveHeight = Math_SinS(this->dirtWavePhase) * 55.0f; this->dirtWaveAlpha = (s16)(Math_SinS(this->dirtWavePhase) * 255.0f); - EnDh_SpawnDebris(globalCtx, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); + EnDh_SpawnDebris(play, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); if (this->actor.shape.yOffset == 0.0f) { this->drawDirtWave = false; this->actionState++; @@ -234,7 +234,7 @@ void EnDh_Wait(EnDh* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x7D0, 0); SkelAnime_Update(&this->skelAnime); if (this->actor.params != ENDH_START_ATTACK_BOMB) { - func_8008EEAC(globalCtx, &this->actor); + func_8008EEAC(play, &this->actor); } } } @@ -248,14 +248,14 @@ void EnDh_SetupWalk(EnDh* this) { EnDh_SetupAction(this, EnDh_Walk); } -void EnDh_Walk(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Walk(EnDh* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA, 0); this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); if (((s32)this->skelAnime.curFrame % 8) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_WALK); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_LAUGH); } if (this->actor.xzDistToPlayer <= 100.0f) { @@ -268,7 +268,7 @@ void EnDh_Walk(EnDh* this, GlobalContext* globalCtx) { } } -void EnDh_SetupRetreat(EnDh* this, GlobalContext* globalCtx) { +void EnDh_SetupRetreat(EnDh* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &object_dh_Anim_005880, -4.0f); this->curAction = DH_RETREAT; this->timer = 70; @@ -276,7 +276,7 @@ void EnDh_SetupRetreat(EnDh* this, GlobalContext* globalCtx) { EnDh_SetupAction(this, EnDh_Retreat); } -void EnDh_Retreat(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Retreat(EnDh* this, PlayState* play) { this->timer--; if (this->timer == 0) { this->retreat = false; @@ -296,7 +296,7 @@ void EnDh_SetupAttack(EnDh* this) { EnDh_SetupAction(this, EnDh_Attack); } -void EnDh_Attack(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Attack(EnDh* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -331,7 +331,7 @@ void EnDh_Attack(EnDh* this, GlobalContext* globalCtx) { this->actionState++; } else if (this->collider2.base.atFlags & AT_HIT) { this->collider2.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f); } break; case 3: @@ -369,7 +369,7 @@ void EnDh_SetupBurrow(EnDh* this) { EnDh_SetupAction(this, EnDh_Burrow); } -void EnDh_Burrow(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Burrow(EnDh* this, PlayState* play) { switch (this->actionState) { case 0: this->actionState++; @@ -383,7 +383,7 @@ void EnDh_Burrow(EnDh* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->dirtWaveSpread, 300.0f, 1.0f, 8.0f, 0.0f); this->dirtWaveHeight = Math_SinS(this->dirtWavePhase) * 55.0f; this->dirtWaveAlpha = (s16)(Math_SinS(this->dirtWavePhase) * 255.0f); - EnDh_SpawnDebris(globalCtx, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); + EnDh_SpawnDebris(play, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); this->collider1.dim.radius = this->dirtWaveSpread * 0.6f; if (SkelAnime_Update(&this->skelAnime)) { this->actionState++; @@ -409,7 +409,7 @@ void EnDh_SetupDamage(EnDh* this) { EnDh_SetupAction(this, EnDh_Damage); } -void EnDh_Damage(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Damage(EnDh* this, PlayState* play) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; } @@ -417,7 +417,7 @@ void EnDh_Damage(EnDh* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = this->actor.shape.rot.y; if (this->retreat) { - EnDh_SetupRetreat(this, globalCtx); + EnDh_SetupRetreat(this, play); } else if ((this->actor.xzDistToPlayer <= 105.0f) && Actor_IsFacingPlayer(&this->actor, 60 * 0x10000 / 360)) { f32 frames = Animation_GetLastFrame(&object_dh_Anim_004658); @@ -442,7 +442,7 @@ void EnDh_SetupDeath(EnDh* this) { EnDh_SetupAction(this, EnDh_Death); } -void EnDh_Death(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Death(EnDh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) || (this->timer != 300)) { if (this->timer == 300) { Animation_PlayLoop(&this->skelAnime, &object_dh_Anim_00375C); @@ -463,14 +463,14 @@ void EnDh_Death(EnDh* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); } if ((s32)this->skelAnime.curFrame == 61) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } } } -void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { +void EnDh_CollisionCheck(EnDh* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 lastHealth; if ((this->collider2.base.acFlags & AC_HIT) && !this->retreat) { @@ -485,7 +485,7 @@ void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { lastHealth = this->actor.colChkInfo.health; if (Actor_ApplyDamage(&this->actor) == 0) { EnDh_SetupDeath(this); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); } else { if (((lastHealth >= 15) && (this->actor.colChkInfo.health < 15)) || ((lastHealth >= 9) && (this->actor.colChkInfo.health < 9)) || @@ -499,38 +499,38 @@ void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { } } -void EnDh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Update(Actor* thisx, PlayState* play) { s32 pad; EnDh* this = (EnDh*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad40; - EnDh_CollisionCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnDh_CollisionCheck(this, play); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 45.0f, 45.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 45.0f, 45.0f, 0x1D); this->actor.focus.pos = this->headPos; Collider_UpdateCylinder(&this->actor, &this->collider1); if (this->actor.colChkInfo.health > 0) { if (this->curAction == DH_WAIT) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } if (((this->curAction != DH_DAMAGE) && (this->actor.shape.yOffset == 0.0f)) || ((player->unk_844 != 0) && (player->unk_845 != this->unk_258))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } } -void EnDh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnDh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Vec3f headOffset = { 2000.0f, 1000.0f, 0.0f }; EnDh* this = (EnDh*)thisx; @@ -543,40 +543,40 @@ void EnDh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnDh_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Draw(Actor* thisx, PlayState* play) { s32 pad; EnDh* this = (EnDh*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha == 255) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); POLY_OPA_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnDh_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor, POLY_XLU_DISP); } if (this->drawDirtWave) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 85, 55, 0, 130); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * -3) % 0x80, 0, 0x20, 0x40, 1, - (globalCtx->state.frames * -10) % 0x80, (globalCtx->state.frames * -20) % 0x100, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->state.frames * -3) % 0x80, 0, 0x20, 0x40, 1, + (play->state.frames * -10) % 0x80, (play->state.frames * -20) % 0x100, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 0, 0, this->dirtWaveAlpha); Matrix_Translate(0.0f, -this->actor.shape.yOffset, 0.0f, MTXMODE_APPLY); Matrix_Scale(this->dirtWaveSpread * 0.01f, this->dirtWaveHeight * 0.01f, this->dirtWaveSpread * 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_dh_DL_007FC0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.h b/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.h index 2e8265447..21db0fd38 100644 --- a/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.h +++ b/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.h @@ -6,7 +6,7 @@ struct EnDh; -typedef void (*EnDhActionFunc)(struct EnDh*, GlobalContext*); +typedef void (*EnDhActionFunc)(struct EnDh*, PlayState*); typedef struct EnDh { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 491a752b0..11ec20512 100644 --- a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnDha_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDha_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDha_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDha_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDha_Init(Actor* thisx, PlayState* play); +void EnDha_Destroy(Actor* thisx, PlayState* play); +void EnDha_Update(Actor* thisx, PlayState* play); +void EnDha_Draw(Actor* thisx, PlayState* play); void EnDha_SetupWait(EnDha* this); -void EnDha_Wait(EnDha* this, GlobalContext* globalCtx); +void EnDha_Wait(EnDha* this, PlayState* play); void EnDha_SetupTakeDamage(EnDha* this); -void EnDha_TakeDamage(EnDha* this, GlobalContext* globalCtx); +void EnDha_TakeDamage(EnDha* this, PlayState* play); void EnDha_SetupDeath(EnDha* this); -void EnDha_Die(EnDha* this, GlobalContext* globalCtx); -void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx); +void EnDha_Die(EnDha* this, PlayState* play); +void EnDha_UpdateHealth(EnDha* this, PlayState* play); const ActorInit En_Dha_InitVars = { ACTOR_EN_DHA, @@ -152,12 +152,12 @@ void EnDha_SetupAction(EnDha* this, EnDhaActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnDha_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Init(Actor* thisx, PlayState* play) { EnDha* this = (EnDha*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dh_Skel_000BD8, &object_dh_Anim_0015B0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dh_Skel_000BD8, &object_dh_Anim_0015B0, this->jointTable, this->morphTable, 4); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawFeet, 90.0f); this->actor.focus.pos = this->actor.world.pos; @@ -165,18 +165,18 @@ void EnDha_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 8; this->limbAngleX[0] = -0x4000; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); this->actor.flags &= ~ACTOR_FLAG_0; EnDha_SetupWait(this); } -void EnDha_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDha* this = (EnDha*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnDha_SetupWait(EnDha* this) { @@ -189,11 +189,11 @@ void EnDha_SetupWait(EnDha* this) { EnDha_SetupAction(this, EnDha_Wait); } -void EnDha_Wait(EnDha* this, GlobalContext* globalCtx) { +void EnDha_Wait(EnDha* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; // unused Vec3f armPosMultiplier1 = { 0.0f, 0.0f, 55.0f }; Vec3f armPosMultiplier2 = { 0.0f, 0.0f, -54.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; s32 pad2; Vec3f playerPos = player->actor.world.pos; @@ -214,7 +214,7 @@ void EnDha_Wait(EnDha* this, GlobalContext* globalCtx) { if (Math_Vec3f_DistXYZ(&playerPos, &this->handPos[0]) <= 12.0f) { if (this->unk_1CC == 0) { - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { this->timer = 0; this->unk_1CC++; @@ -301,8 +301,8 @@ void EnDha_SetupTakeDamage(EnDha* this) { EnDha_SetupAction(this, EnDha_TakeDamage); } -void EnDha_TakeDamage(EnDha* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDha_TakeDamage(EnDha* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~0x80; @@ -337,10 +337,10 @@ void EnDha_SetupDeath(EnDha* this) { EnDha_SetupAction(this, EnDha_Die); } -void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { +void EnDha_Die(EnDha* this, PlayState* play) { s16 angle; Vec3f vec; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~0x80; @@ -358,7 +358,7 @@ void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { if (this->actionTimer != 0) { if (-12000.0f < this->actor.shape.yOffset) { this->actor.shape.yOffset -= 1000.0f; - func_80033480(globalCtx, &vec, 7.0f, 1, 0x5A, 0x14, 1); + func_80033480(play, &vec, 7.0f, 1, 0x5A, 0x14, 1); } else { this->actionTimer--; @@ -368,7 +368,7 @@ void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { } } else { this->actor.shape.yOffset += 500.0f; - func_80033480(globalCtx, &vec, 7.0f, 1, 0x5A, 0x14, 1); + func_80033480(play, &vec, 7.0f, 1, 0x5A, 0x14, 1); if (this->actor.shape.yOffset == 0.0f) { EnDha_SetupWait(this); @@ -377,7 +377,7 @@ void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { } } -void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx) { +void EnDha_UpdateHealth(EnDha* this, PlayState* play) { if (!((this->unk_1C0 >= 8) || !(this->collider.base.acFlags & AC_HIT))) { this->collider.base.acFlags &= ~AC_HIT; @@ -388,7 +388,7 @@ void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor) == 0) { EnDha_SetupDeath(this); this->actor.colChkInfo.health = 8; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_DAMAGE); this->unk_1C0 = 9; @@ -402,21 +402,21 @@ void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx) { } } -void EnDha_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Update(Actor* thisx, PlayState* play) { s32 pad; EnDha* this = (EnDha*)thisx; if (this->actor.parent == NULL) { - this->actor.parent = Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_DH, ACTORCAT_ENEMY, 10000.0f); + this->actor.parent = Actor_FindNearby(play, &this->actor, ACTOR_EN_DH, ACTORCAT_ENEMY, 10000.0f); } - EnDha_UpdateHealth(this, globalCtx); - this->actionFunc(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + EnDha_UpdateHealth(this, play); + this->actionFunc(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnDha_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDha_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDha* this = (EnDha*)thisx; if (limbIndex == 1) { @@ -433,7 +433,7 @@ s32 EnDha_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDha_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDha_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f handVec = { 1100.0f, 0.0f, 0.0f }; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnDha* this = (EnDha*)thisx; @@ -456,11 +456,11 @@ void EnDha_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnDha_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Draw(Actor* thisx, PlayState* play) { s32 pad; EnDha* this = (EnDha*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDha_OverrideLimbDraw, EnDha_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.h b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.h index 7bc146f92..2ef37c54c 100644 --- a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.h +++ b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.h @@ -6,7 +6,7 @@ struct EnDha; -typedef void (*EnDhaActionFunc)(struct EnDha*, GlobalContext*); +typedef void (*EnDhaActionFunc)(struct EnDha*, PlayState*); typedef struct EnDha { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 1f0d47d7a..57f110124 100644 --- a/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -11,27 +11,27 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnDivingGame_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDivingGame_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDivingGame_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDivingGame_Init(Actor* thisx, PlayState* play); +void EnDivingGame_Destroy(Actor* thisx, PlayState* play); +void EnDivingGame_Update(Actor* thisx, PlayState* play); +void EnDivingGame_Draw(Actor* thisx, PlayState* play); -void func_809EDCB0(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_HandlePlayChoice(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE048(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE0FC(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE194(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE780(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE800(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE8F0(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE96C(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EEA00(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EEA90(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EEAF8(EnDivingGame* this, GlobalContext* globalCtx); +void func_809EDCB0(EnDivingGame* this, PlayState* play); +void EnDivingGame_Talk(EnDivingGame* this, PlayState* play); +void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play); +void func_809EE048(EnDivingGame* this, PlayState* play); +void func_809EE0FC(EnDivingGame* this, PlayState* play); +void func_809EE194(EnDivingGame* this, PlayState* play); +void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play); +void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play); +void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, PlayState* play); +void func_809EE780(EnDivingGame* this, PlayState* play); +void func_809EE800(EnDivingGame* this, PlayState* play); +void func_809EE8F0(EnDivingGame* this, PlayState* play); +void func_809EE96C(EnDivingGame* this, PlayState* play); +void func_809EEA00(EnDivingGame* this, PlayState* play); +void func_809EEA90(EnDivingGame* this, PlayState* play); +void func_809EEAF8(EnDivingGame* this, PlayState* play); const ActorInit En_Diving_Game_InitVars = { ACTOR_EN_DIVING_GAME, @@ -75,14 +75,14 @@ static void* sEyeTextures[] = { gZoraEyeClosedTex, }; -void EnDivingGame_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDivingGame_Init(Actor* thisx, PlayState* play) { EnDivingGame* this = (EnDivingGame*)thisx; this->actor.gravity = -3.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 素もぐりGO ☆☆☆☆☆ \n" VT_RST); this->actor.room = -1; this->actor.scale.x = 0.01f; @@ -100,24 +100,24 @@ void EnDivingGame_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDivingGame_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDivingGame_Destroy(Actor* thisx, PlayState* play) { EnDivingGame* this = (EnDivingGame*)thisx; if (this->unk_31F == 0) { sHasSpawned = false; gSaveContext.timer1State = 0; } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDivingGame_SpawnRuppy(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_SpawnRuppy(EnDivingGame* this, PlayState* play) { EnExRuppy* rupee; Vec3f rupeePos; rupeePos.x = (Rand_ZeroOne() - 0.5f) * 30.0f + this->actor.world.pos.x; rupeePos.y = (Rand_ZeroOne() - 0.5f) * 20.0f + (this->actor.world.pos.y + 30.0f); rupeePos.z = (Rand_ZeroOne() - 0.5f) * 20.0f + this->actor.world.pos.z; - rupee = (EnExRuppy*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_RUPPY, rupeePos.x, + rupee = (EnExRuppy*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_RUPPY, rupeePos.x, rupeePos.y, rupeePos.z, 0, (s16)Rand_CenteredFloat(3500.0f) - 1000, this->rupeesLeftToThrow, 0); if (rupee != NULL) { @@ -126,17 +126,17 @@ void EnDivingGame_SpawnRuppy(EnDivingGame* this, GlobalContext* globalCtx) { } } -s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, GlobalContext* globalCtx) { - if (gSaveContext.timer1State == 10 && !Gameplay_InCsMode(globalCtx)) { +s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { + if (gSaveContext.timer1State == 10 && !Play_InCsMode(play)) { // Failed. gSaveContext.timer1State = 0; func_800F5B58(); func_80078884(NA_SE_SY_FOUND); this->actor.textId = 0x71AD; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_292 = TEXT_STATE_EVENT; this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_809EE048; return true; } else { @@ -157,11 +157,11 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, GlobalContext* globalCt this->extraWinCount++; } } - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_292 = TEXT_STATE_EVENT; func_800F5B58(); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); if (!(gSaveContext.eventChkInf[3] & 0x100)) { this->actionFunc = func_809EE96C; } else { @@ -174,7 +174,7 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, GlobalContext* globalCt } // EnDivingGame_FinishMinigame ? // Reset probably -void func_809EDCB0(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EDCB0(EnDivingGame* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gZoraIdleAnim); Animation_Change(&this->skelAnime, &gZoraIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -182,14 +182,14 @@ void func_809EDCB0(EnDivingGame* this, GlobalContext* globalCtx) { this->actionFunc = EnDivingGame_Talk; } -void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_Talk(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->state != ENDIVINGGAME_STATE_PLAYING || !EnDivingGame_HasMinigameFinished(this, globalCtx)) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (this->state != ENDIVINGGAME_STATE_PLAYING || !EnDivingGame_HasMinigameFinished(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->unk_292 != TEXT_STATE_DONE) { switch (this->state) { case ENDIVINGGAME_STATE_NOTPLAYING: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = EnDivingGame_HandlePlayChoice; break; case ENDIVINGGAME_STATE_AWARDPRIZE: @@ -201,8 +201,8 @@ void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx) { } } } else { - if (Text_GetFaceReaction(globalCtx, 0x1D) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1D); + if (Text_GetFaceReaction(play, 0x1D) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 0x1D); this->unk_292 = TEXT_STATE_DONE; } else { switch (this->state) { @@ -226,16 +226,16 @@ void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx) { break; } } - func_8002F2CC(&this->actor, globalCtx, 80.0f); + func_8002F2CC(&this->actor, play, 80.0f); } } } -void EnDivingGame_HandlePlayChoice(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&globalCtx->msgCtx) && - Message_ShouldAdvance(globalCtx)) { // Did player selected an answer? - switch (globalCtx->msgCtx.choiceIndex) { + if (this->unk_292 == Message_GetState(&play->msgCtx) && + Message_ShouldAdvance(play)) { // Did player selected an answer? + switch (play->msgCtx.choiceIndex) { case 0: // Yes if (gSaveContext.rupees >= 20) { Rupees_ChangeBy(-20); @@ -251,35 +251,35 @@ void EnDivingGame_HandlePlayChoice(EnDivingGame* this, GlobalContext* globalCtx) break; } if (!(gSaveContext.eventChkInf[3] & 0x100) || this->actor.textId == 0x85 || this->actor.textId == 0x2D) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_292 = TEXT_STATE_EVENT; this->actionFunc = func_809EE048; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(globalCtx, NULL, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8002DF54(play, NULL, 8); this->actionFunc = func_809EE0FC; } } } // Waits for the message to close -void func_809EE048(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE048(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { + if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->phase == ENDIVINGGAME_PHASE_ENDED) { - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actionFunc = func_809EDCB0; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(globalCtx, NULL, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8002DF54(play, NULL, 8); this->actionFunc = func_809EE0FC; } } } // another "start minigame" step -void func_809EE0FC(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE0FC(EnDivingGame* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gZoraThrowRupeesAnim); Animation_Change(&this->skelAnime, &gZoraThrowRupeesAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_ONCE, -10.0f); @@ -288,7 +288,7 @@ void func_809EE0FC(EnDivingGame* this, GlobalContext* globalCtx) { } // Wait a bit before start throwing the rupees. -void func_809EE194(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE194(EnDivingGame* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -297,11 +297,11 @@ void func_809EE194(EnDivingGame* this, GlobalContext* globalCtx) { } } -void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, 0, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->spawnRuppyTimer = 10; this->unk_2F4.x = -210.0f; this->unk_2F4.y = -80.0f; @@ -315,29 +315,29 @@ void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) this->rupeesLeftToThrow = 10; } this->unk_2DC.x = this->unk_2DC.y = this->unk_2DC.z = this->unk_300.x = this->unk_300.y = this->unk_300.z = 0.1f; - this->camLookAt.x = globalCtx->view.lookAt.x; - this->camLookAt.y = globalCtx->view.lookAt.y; - this->camLookAt.z = globalCtx->view.lookAt.z; - this->camEye.x = globalCtx->view.eye.x; - this->camEye.y = globalCtx->view.eye.y + 80.0f; - this->camEye.z = globalCtx->view.eye.z + 250.0f; + this->camLookAt.x = play->view.lookAt.x; + this->camLookAt.y = play->view.lookAt.y; + this->camLookAt.z = play->view.lookAt.z; + this->camEye.x = play->view.eye.x; + this->camEye.y = play->view.eye.y + 80.0f; + this->camEye.z = play->view.eye.z + 250.0f; this->unk_2E8.x = fabsf(this->camEye.x - this->unk_2D0.x) * 0.04f; this->unk_2E8.y = fabsf(this->camEye.y - this->unk_2D0.y) * 0.04f; this->unk_2E8.z = fabsf(this->camEye.z - this->unk_2D0.z) * 0.04f; this->unk_30C.x = fabsf(this->camLookAt.x - this->unk_2F4.x) * 0.04f; this->unk_30C.y = fabsf(this->camLookAt.y - this->unk_2F4.y) * 0.04f; this->unk_30C.z = fabsf(this->camLookAt.z - this->unk_2F4.z) * 0.04f; - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->camLookAt, &this->camEye); - Gameplay_CameraSetFov(globalCtx, this->subCamId, globalCtx->mainCamera.fov); + Play_CameraSetAtEye(play, this->subCamId, &this->camLookAt, &this->camEye); + Play_CameraSetFov(play, this->subCamId, play->mainCamera.fov); this->csCameraTimer = 60; this->actionFunc = EnDivingGame_RupeeThrow; this->unk_318 = 0.0f; } // Throws rupee when this->spawnRuppyTimer == 0 -void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (func_800C0DB4(globalCtx, &this->actor.projectedPos)) { + if (func_800C0DB4(play, &this->actor.projectedPos)) { Audio_SetExtraFilter(0); } if (this->subCamId != 0) { @@ -348,10 +348,10 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { Math_ApproachF(&this->camLookAt.z, this->unk_2F4.z, this->unk_300.z, this->unk_30C.z * this->unk_318); Math_ApproachF(&this->unk_318, 1.0f, 1.0f, 0.02f); } - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->camLookAt, &this->camEye); + Play_CameraSetAtEye(play, this->subCamId, &this->camLookAt, &this->camEye); if (!this->allRupeesThrown && this->spawnRuppyTimer == 0) { this->spawnRuppyTimer = 5; - EnDivingGame_SpawnRuppy(this, globalCtx); + EnDivingGame_SpawnRuppy(this, play); this->rupeesLeftToThrow--; if (!(gSaveContext.eventChkInf[3] & 0x100)) { this->unk_296 = 30; @@ -378,7 +378,7 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { } // Called just before changing the camera to focus the underwater rupees. -void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_296 == 0) { this->unk_2A2 = 1; @@ -394,30 +394,30 @@ void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, GlobalContext* globa } // EnDivingGame_SayStartAndWait ? -void func_809EE780(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE780(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->csCameraTimer == 0) { - Gameplay_ClearCamera(globalCtx, this->subCamId); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); + Play_ChangeCameraStatus(play, 0, CAM_STAT_ACTIVE); this->actor.textId = 0x405A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_292 = TEXT_STATE_EVENT; this->actionFunc = func_809EE800; } } // EnDivingGame_TalkDuringMinigame -void func_809EE800(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE800(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (!(gSaveContext.eventChkInf[3] & 0x100)) { func_80088B34(BREG(2) + 50); } else { func_80088B34(BREG(2) + 50); } func_800F5ACC(NA_BGM_TIMED_MINI_GAME); - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actor.textId = 0x405B; this->unk_292 = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_PLAYING; @@ -425,22 +425,22 @@ void func_809EE800(EnDivingGame* this, GlobalContext* globalCtx) { } } -void func_809EE8F0(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE8F0(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx))) { - Message_CloseTextbox(globalCtx); + if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + Message_CloseTextbox(play); this->actionFunc = EnDivingGame_Talk; } else { - EnDivingGame_HasMinigameFinished(this, globalCtx); + EnDivingGame_HasMinigameFinished(this, play); } } // EnDivingGame_SayCongratsAndWait ? // EnDivingGame_PlayerWonPhase1 -void func_809EE96C(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE96C(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx))) { - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actor.textId = 0x4056; this->unk_292 = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_AWARDPRIZE; @@ -448,39 +448,39 @@ void func_809EE96C(EnDivingGame* this, GlobalContext* globalCtx) { } } -void func_809EEA00(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EEA00(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx))) { - Message_CloseTextbox(globalCtx); + if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + Message_CloseTextbox(play); this->actor.parent = NULL; if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_SCALE_SILVER, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SCALE_SILVER, 90.0f, 10.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_ZD_DIVING_MINIGAME, GI_SCALE_SILVER); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 90.0f, 10.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 90.0f, 10.0f); } this->actionFunc = func_809EEA90; } } -void func_809EEA90(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EEA90(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_809EEAF8; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_SCALE_SILVER, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SCALE_SILVER, 90.0f, 10.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_ZD_DIVING_MINIGAME, GI_SCALE_SILVER); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 90.0f, 10.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 90.0f, 10.0f); } } } // Award the scale? -void func_809EEAF8(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EEAF8(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { // "Successful completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; @@ -489,10 +489,10 @@ void func_809EEAF8(EnDivingGame* this, GlobalContext* globalCtx) { } } -void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDivingGame_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDivingGame* this = (EnDivingGame*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f pos; if (this->csCameraTimer != 0) { @@ -519,22 +519,22 @@ void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx2) { this->eyeTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 80.0f); this->unk_324.unk_18 = player->actor.world.pos; this->unk_324.unk_18.y = player->actor.world.pos.y; func_80034A14(&this->actor, &this->unk_324, 2, 4); this->vec_284 = this->unk_324.unk_08; this->vec_28A = this->unk_324.unk_0E; - if ((globalCtx->gameplayFrames % 16) == 0) { + if ((play->gameplayFrames % 16) == 0) { pos = this->actor.world.pos; pos.y += 20.0f; - EffectSsGRipple_Spawn(globalCtx, &pos, 100, 500, 30); + EffectSsGRipple_Spawn(play, &pos, 100, 500, 30); } this->unk_290++; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 29); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 29); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Gfx* EnDivingGame_EmptyDList(GraphicsContext* gfxCtx) { @@ -544,7 +544,7 @@ Gfx* EnDivingGame_EmptyDList(GraphicsContext* gfxCtx) { return displayList; } -s32 EnDivingGame_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDivingGame* this = (EnDivingGame*)thisx; s32 pad; @@ -559,24 +559,24 @@ s32 EnDivingGame_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** } if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) { - rot->y += Math_SinS((globalCtx->state.frames * (limbIndex * 50 + 0x814))) * 200.0f; - rot->z += Math_CosS((globalCtx->state.frames * (limbIndex * 50 + 0x940))) * 200.0f; + rot->y += Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f; + rot->z += Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f; } return 0; } -void EnDivingGame_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDivingGame_Draw(Actor* thisx, PlayState* play) { EnDivingGame* this = (EnDivingGame*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnDivingGame_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnDivingGame_EmptyDList(play->state.gfxCtx)); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDivingGame_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h b/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h index ee361adaa..5cabd5428 100644 --- a/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h +++ b/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h @@ -6,7 +6,7 @@ struct EnDivingGame; -typedef void (*EnDivingGameActionFunc)(struct EnDivingGame*, GlobalContext*); +typedef void (*EnDivingGameActionFunc)(struct EnDivingGame*, PlayState*); typedef struct EnDivingGame { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 865da6807..6f77ee380 100644 --- a/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -10,10 +10,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnDns_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDns_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDns_Init(Actor* thisx, PlayState* play); +void EnDns_Destroy(Actor* thisx, PlayState* play); +void EnDns_Update(Actor* thisx, PlayState* play); +void EnDns_Draw(Actor* thisx, PlayState* play); u32 EnDns_RandomizerPurchaseableCheck(EnDns* this); u32 func_809EF5A4(EnDns* this); @@ -34,16 +34,16 @@ void func_809EFACC(EnDns* this); void func_809EFAFC(EnDns* this); void func_809EFB40(EnDns* this); -void EnDns_SetupWait(EnDns* this, GlobalContext* globalCtx); -void EnDns_Wait(EnDns* this, GlobalContext* globalCtx); -void EnDns_Talk(EnDns* this, GlobalContext* globalCtx); -void func_809EFDD0(EnDns* this, GlobalContext* globalCtx); -void func_809EFEE8(EnDns* this, GlobalContext* globalCtx); -void func_809EFF50(EnDns* this, GlobalContext* globalCtx); -void func_809EFF98(EnDns* this, GlobalContext* globalCtx); -void func_809F008C(EnDns* this, GlobalContext* globalCtx); -void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx); -void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx); +void EnDns_SetupWait(EnDns* this, PlayState* play); +void EnDns_Wait(EnDns* this, PlayState* play); +void EnDns_Talk(EnDns* this, PlayState* play); +void func_809EFDD0(EnDns* this, PlayState* play); +void func_809EFEE8(EnDns* this, PlayState* play); +void func_809EFF50(EnDns* this, PlayState* play); +void func_809EFF98(EnDns* this, PlayState* play); +void func_809F008C(EnDns* this, PlayState* play); +void EnDns_SetupBurrow(EnDns* this, PlayState* play); +void EnDns_Burrow(EnDns* this, PlayState* play); const ActorInit En_Dns_InitVars = { ACTOR_EN_DNS, @@ -135,7 +135,7 @@ static AnimationMinimalInfo sAnimationInfo[] = { { &gBusinessScrubNervousTransitionAnim, ANIMMODE_ONCE, 0.0f }, }; -void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Init(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; if (this->actor.params < 0) { @@ -152,10 +152,10 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", D_809F0424[this->actor.params], this->actor.params); Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->jointTable, this->morphTable, 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -170,7 +170,7 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.n64ddFlag) { // Ugly, but the best way we can identify which grotto we are in, same method 3DRando uses, but we'll need to account for entrance rando s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); - this->scrubIdentity = Randomizer_IdentifyScrub(globalCtx->sceneNum, this->actor.params, respawnData); + this->scrubIdentity = Randomizer_IdentifyScrub(play->sceneNum, this->actor.params, respawnData); if ((Randomizer_GetSettingValue(RSK_SHUFFLE_SCRUBS) == 1 || Randomizer_GetSettingValue(RSK_SHUFFLE_SCRUBS) == 3) && this->scrubIdentity.itemPrice != -1) { this->dnsItemEntry->itemPrice = this->scrubIdentity.itemPrice; @@ -187,10 +187,10 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnDns_SetupWait; } -void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Destroy(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnDns_ChangeAnim(EnDns* this, u8 index) { @@ -343,17 +343,17 @@ void func_809EFB40(EnDns* this) { Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void EnDns_SetupWait(EnDns* this, GlobalContext* globalCtx) { +void EnDns_SetupWait(EnDns* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = EnDns_Wait; EnDns_ChangeAnim(this, ENDNS_ANIM_0); } } -void EnDns_Wait(EnDns* this, GlobalContext* globalCtx) { +void EnDns_Wait(EnDns* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 2000, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDns_Talk; } else { if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isTargeted) { @@ -362,87 +362,87 @@ void EnDns_Wait(EnDns* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_16; } if (this->actor.xzDistToPlayer < 130.0f) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } -void EnDns_Talk(EnDns* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnDns_Talk(EnDns* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // OK switch (this->dnsItemEntry->purchaseableCheck(this)) { case 0: - Message_ContinueTextbox(globalCtx, 0x10A5); + Message_ContinueTextbox(play, 0x10A5); this->actionFunc = func_809F008C; break; case 1: - Message_ContinueTextbox(globalCtx, 0x10A6); + Message_ContinueTextbox(play, 0x10A6); this->actionFunc = func_809F008C; break; case 3: - Message_ContinueTextbox(globalCtx, 0x10DE); + Message_ContinueTextbox(play, 0x10DE); this->actionFunc = func_809F008C; break; case 2: case 4: - Message_ContinueTextbox(globalCtx, 0x10A7); + Message_ContinueTextbox(play, 0x10A7); this->actionFunc = func_809EFEE8; break; } break; case 1: // No way - Message_ContinueTextbox(globalCtx, 0x10A4); + Message_ContinueTextbox(play, 0x10A4); this->actionFunc = func_809F008C; } } } -void func_809EFDD0(EnDns* this, GlobalContext* globalCtx) { +void func_809EFDD0(EnDns* this, PlayState* play) { if (!gSaveContext.n64ddFlag || !this->scrubIdentity.isShuffled) { if (this->actor.params == 0x9) { if (CUR_UPG_VALUE(UPG_STICKS) < 2) { - func_8002F434(&this->actor, globalCtx, GI_STICK_UPGRADE_20, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_STICK_UPGRADE_20, 130.0f, 100.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_STICK_UPGRADE_30, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_STICK_UPGRADE_30, 130.0f, 100.0f); } } else if (this->actor.params == 0xA) { if (CUR_UPG_VALUE(UPG_NUTS) < 2) { - func_8002F434(&this->actor, globalCtx, GI_NUT_UPGRADE_30, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_NUT_UPGRADE_30, 130.0f, 100.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_NUT_UPGRADE_40, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_NUT_UPGRADE_40, 130.0f, 100.0f); } } else { - func_8002F434(&this->actor, globalCtx, this->dnsItemEntry->getItemId, 130.0f, 100.0f); + func_8002F434(&this->actor, play, this->dnsItemEntry->getItemId, 130.0f, 100.0f); } } else { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(this->scrubIdentity.randomizerCheck, this->scrubIdentity.getItemId); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 130.0f, 100.0f); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 130.0f, 100.0f); } } -void func_809EFEE8(EnDns* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_809EFDD0(this, globalCtx); +void func_809EFEE8(EnDns* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_809EFDD0(this, play); this->actionFunc = func_809EFF50; } } -void func_809EFF50(EnDns* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809EFF50(EnDns* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_809EFF98; } else { - func_809EFDD0(this, globalCtx); + func_809EFDD0(this, play); } } -void func_809EFF98(EnDns* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809EFF98(EnDns* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x400) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->dnsItemEntry->setRupeesAndFlags(this); this->dropCollectible = 1; this->maintainCollider = 0; @@ -460,8 +460,8 @@ void func_809EFF98(EnDns* this, GlobalContext* globalCtx) { } } -void func_809F008C(EnDns* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_809F008C(EnDns* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->maintainCollider = 0; this->actor.flags &= ~ACTOR_FLAG_0; EnDns_ChangeAnim(this, ENDNS_ANIM_1); @@ -469,7 +469,7 @@ void func_809F008C(EnDns* this, GlobalContext* globalCtx) { } } -void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx) { +void EnDns_SetupBurrow(EnDns* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gBusinessScrubAnim_4404); if (this->skelAnime.curFrame == frameCount) { @@ -480,7 +480,7 @@ void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx) { } } -void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) { +void EnDns_Burrow(EnDns* this, PlayState* play) { f32 depth; Vec3f initPos; s32 i; @@ -490,7 +490,7 @@ void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) { initPos.x = this->actor.world.pos.x; initPos.y = this->yInitPos; initPos.z = this->actor.world.pos.z; - func_80028990(globalCtx, 20.0f, &initPos); + func_80028990(play, 20.0f, &initPos); } this->actor.shape.rot.y += 0x2000; // Drops only if you bought its item @@ -500,14 +500,14 @@ void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) { initPos.y = this->yInitPos; initPos.z = this->actor.world.pos.z; for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &initPos, ITEM00_HEART); + Item_DropCollectible(play, &initPos, ITEM00_HEART); } } Actor_Kill(&this->actor); } } -void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Update(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; s16 pad; @@ -520,20 +520,20 @@ void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->standOnGround) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 4); } if (this->maintainCollider) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Draw(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); } diff --git a/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.h b/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.h index 4dab2bf39..b24c41f0c 100644 --- a/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -6,7 +6,7 @@ struct EnDns; -typedef void (*EnDnsActionFunc)(struct EnDns*, GlobalContext*); +typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*); typedef u32 (*EnDnsPurchaseableCheck)(struct EnDns*); typedef void (*EnDnsSetRupeesAndFlags)(struct EnDns*); diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index c50e1ec77..93eeb9490 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -18,13 +18,13 @@ typedef enum { /* 2 */ DNT_LOVE } EnDntDemoResults; -void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDntDemo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDntDemo_Update(Actor* this, GlobalContext* globalCtx); +void EnDntDemo_Init(Actor* thisx, PlayState* play); +void EnDntDemo_Destroy(Actor* thisx, PlayState* play); +void EnDntDemo_Update(Actor* this, PlayState* play); -void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx); -void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx); -void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx); +void EnDntDemo_Judge(EnDntDemo* this, PlayState* play); +void EnDntDemo_Results(EnDntDemo* this, PlayState* play); +void EnDntDemo_Prize(EnDntDemo* this, PlayState* play); const ActorInit En_Dnt_Demo_InitVars = { ACTOR_EN_DNT_DEMO, @@ -66,11 +66,11 @@ static Vec3f sScrubPos[] = { { 3710.0f, -20.0f, 840.0f }, { 3860.0f, -20.0f, 790.0f }, { 3750.0f, -20.0f, 750.0f }, }; -void EnDntDemo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDntDemo_Destroy(Actor* thisx, PlayState* play) { } -void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDntDemo_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDntDemo* this = (EnDntDemo*)thisx; s32 i; s32 pad; @@ -80,7 +80,7 @@ void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会開始 ☆☆☆☆☆ \n" VT_RST); for (i = 0; i < 9; i++) { this->scrubPos[i] = sScrubPos[i]; - this->scrubs[i] = (EnDntNomal*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + this->scrubs[i] = (EnDntNomal*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DNT_NOMAL, this->scrubPos[i].x, this->scrubPos[i].y, this->scrubPos[i].z, 0, 0, 0, i + ENDNTNOMAL_STAGE); if (this->scrubs[i] != NULL) { @@ -92,7 +92,7 @@ void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->leaderPos.x = 4050.0f; this->leaderPos.y = -20.0f; this->leaderPos.z = 1000.0f; - this->leader = (EnDntJiji*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DNT_JIJI, + this->leader = (EnDntJiji*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DNT_JIJI, this->leaderPos.x, this->leaderPos.y, this->leaderPos.z, 0, 0, 0, 0); if (this->leader != NULL) { // "jiji jiji jiji jiji jiji" [onomatopoeia for the scrub sound?] @@ -103,7 +103,7 @@ void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnDntDemo_Judge; } -void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { +void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) { s16 delay; s16 reaction; s16 rand9; @@ -123,7 +123,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { } this->leaderSignal = DNT_SIGNAL_NONE; this->actionFunc = EnDntDemo_Results; - } else if ((this->actor.xzDistToPlayer > 30.0f) || (Player_GetMask(globalCtx) == 0)) { + } else if ((this->actor.xzDistToPlayer > 30.0f) || (Player_GetMask(play) == 0)) { this->debugArrowTimer++; if (this->subCamera != SUBCAM_FREE) { this->subCamera = SUBCAM_FREE; @@ -136,27 +136,27 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { } } else { if (gSaveContext.n64ddFlag) { - switch (Player_GetMask(globalCtx)) { + switch (Player_GetMask(play)) { case PLAYER_MASK_SKULL: - if (!Flags_GetTreasure(globalCtx, 0x1F)) { + if (!Flags_GetTreasure(play, 0x1F)) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_DEKU_THEATER_SKULL_MASK, GI_STICK_UPGRADE_30); - GiveItemEntryWithoutActor(globalCtx, getItemEntry); - Flags_SetTreasure(globalCtx, 0x1F); + GiveItemEntryWithoutActor(play, getItemEntry); + Flags_SetTreasure(play, 0x1F); } break; case PLAYER_MASK_TRUTH: - if (!Flags_GetTreasure(globalCtx, 0x1E)) { + if (!Flags_GetTreasure(play, 0x1E)) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_DEKU_THEATER_MASK_OF_TRUTH, GI_NUT_UPGRADE_40); - GiveItemEntryWithoutActor(globalCtx, getItemEntry); - Flags_SetTreasure(globalCtx, 0x1E); + GiveItemEntryWithoutActor(play, getItemEntry); + Flags_SetTreasure(play, 0x1E); } break; } return; } - if ((Player_GetMask(globalCtx) != 0) && (this->subCamera == SUBCAM_FREE)) { - this->subCamera = OnePointCutscene_Init(globalCtx, 2220, -99, &this->scrubs[3]->actor, MAIN_CAM); + if ((Player_GetMask(play) != 0) && (this->subCamera == SUBCAM_FREE)) { + this->subCamera = OnePointCutscene_Init(play, 2220, -99, &this->scrubs[3]->actor, MAIN_CAM); } this->debugArrowTimer = 0; if (this->judgeTimer == 40) { @@ -175,7 +175,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { ignore = false; reaction = DNT_SIGNAL_NONE; delay = 0; - switch (Player_GetMask(globalCtx)) { + switch (Player_GetMask(play)) { case PLAYER_MASK_SKULL: if (!(gSaveContext.itemGetInf[1] & 0x4000)) { reaction = DNT_SIGNAL_CELEBRATE; @@ -184,7 +184,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { break; } case PLAYER_MASK_TRUTH: - if (!(gSaveContext.itemGetInf[1] & 0x8000) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) { + if (!(gSaveContext.itemGetInf[1] & 0x8000) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); this->prize = DNT_PRIZE_NUTS; @@ -193,7 +193,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { if (this->subCamera != SUBCAM_FREE) { this->subCamera = SUBCAM_FREE; reaction = DNT_SIGNAL_LOOK; - OnePointCutscene_Init(globalCtx, 2340, -99, &this->leader->actor, MAIN_CAM); + OnePointCutscene_Init(play, 2340, -99, &this->leader->actor, MAIN_CAM); } break; } @@ -204,7 +204,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { case PLAYER_MASK_ZORA: case PLAYER_MASK_GERUDO: rand9 = Rand_ZeroFloat(8.99f); - maskIdx = Player_GetMask(globalCtx); + maskIdx = Player_GetMask(play); maskIdx--; if (rand9 == 8) { ignore = true; @@ -232,7 +232,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { case DNT_ACTION_ATTACK: if (this->subCamera != SUBCAM_FREE) { this->subCamera = SUBCAM_FREE; - OnePointCutscene_Init(globalCtx, 2350, -99, &this->scrubs[3]->actor, MAIN_CAM); + OnePointCutscene_Init(play, 2350, -99, &this->scrubs[3]->actor, MAIN_CAM); } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ENEMY | 0x800); break; @@ -282,7 +282,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { } } -void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx) { +void EnDntDemo_Results(EnDntDemo* this, PlayState* play) { s32 i; if (this->leaderSignal != DNT_SIGNAL_NONE) { @@ -319,7 +319,7 @@ void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx) { } } -void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx) { +void EnDntDemo_Prize(EnDntDemo* this, PlayState* play) { s32 i; if (this->leaderSignal != DNT_SIGNAL_NONE) { @@ -332,7 +332,7 @@ void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx) { } } -void EnDntDemo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDntDemo_Update(Actor* thisx, PlayState* play) { s32 pad; EnDntDemo* this = (EnDntDemo*)thisx; @@ -342,18 +342,18 @@ void EnDntDemo_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unkTimer1 != 0) { this->unkTimer1--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(0)) { if (this->debugArrowTimer != 0) { if (!(this->debugArrowTimer & 1)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 120, 120, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 120, 120, 0, 255, 4, play->state.gfxCtx); } } else { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 255, 255, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 255, 255, 255, 255, 4, play->state.gfxCtx); } } } diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h b/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h index c2f3b9cdc..14da13acc 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h +++ b/soh/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h @@ -6,7 +6,7 @@ struct EnDntDemo; -typedef void (*EnDntDemoActionFunc)(struct EnDntDemo*, GlobalContext*); +typedef void (*EnDntDemoActionFunc)(struct EnDntDemo*, PlayState*); typedef struct EnDntDemo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index bb89376da..daf812a0b 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -12,32 +12,32 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnDntJiji_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDntJiji_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDntJiji_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDntJiji_Init(Actor* thisx, PlayState* play); +void EnDntJiji_Destroy(Actor* thisx, PlayState* play); +void EnDntJiji_Update(Actor* thisx, PlayState* play); +void EnDntJiji_Draw(Actor* thisx, PlayState* play); -void EnDntJiji_SetFlower(EnDntJiji* this, GlobalContext* globalCtx); +void EnDntJiji_SetFlower(EnDntJiji* this, PlayState* play); -void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupUnburrow(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupGivePrize(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupHide(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx); +void EnDntJiji_SetupWait(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupUnburrow(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupWalk(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupCower(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupGivePrize(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupHide(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupReturn(EnDntJiji* this, PlayState* play); -void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Burrow(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Cower(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupTalk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Talk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx); +void EnDntJiji_Wait(EnDntJiji* this, PlayState* play); +void EnDntJiji_Up(EnDntJiji* this, PlayState* play); +void EnDntJiji_Unburrow(EnDntJiji* this, PlayState* play); +void EnDntJiji_Walk(EnDntJiji* this, PlayState* play); +void EnDntJiji_Burrow(EnDntJiji* this, PlayState* play); +void EnDntJiji_Cower(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupTalk(EnDntJiji* this, PlayState* play); +void EnDntJiji_Talk(EnDntJiji* this, PlayState* play); +void EnDntJiji_GivePrize(EnDntJiji* this, PlayState* play); +void EnDntJiji_Hide(EnDntJiji* this, PlayState* play); +void EnDntJiji_Return(EnDntJiji* this, PlayState* play); const ActorInit En_Dnt_Jiji_InitVars = { ACTOR_EN_DNT_JIJI, @@ -72,14 +72,14 @@ static ColliderCylinderInit sCylinderInit = { { 30, 80, 0, { 0, 0, 0 } }, }; -void EnDntJiji_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Init(Actor* thisx, PlayState* play) { EnDntJiji* this = (EnDntJiji*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDntJijiSkel, &gDntJijiBurrowAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gDntJijiSkel, &gDntJijiBurrowAnim, this->jointTable, this->morphTable, 13); - 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->stage = (EnDntDemo*)this->actor.parent; osSyncPrintf("\n\n"); // "Deku Scrub mask show elder" @@ -91,21 +91,21 @@ void EnDntJiji_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -2.0f; } -void EnDntJiji_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDntJiji* this = (EnDntJiji*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDntJiji_SetFlower(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetFlower(EnDntJiji* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { this->flowerPos = this->actor.world.pos; this->actionFunc = EnDntJiji_SetupWait; } } -void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupWait(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiBurrowAnim); Animation_Change(&this->skelAnime, &gDntJijiBurrowAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->skelAnime.curFrame = 8.0f; @@ -113,28 +113,28 @@ void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Wait; } -void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDntJiji_Wait(EnDntJiji* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Gameplay_InCsMode(globalCtx) && + if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Play_InCsMode(play) && !(player->stateFlags1 & 0x800)) { - OnePointCutscene_Init(globalCtx, 2230, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 2230, -99, &this->actor, MAIN_CAM); this->timer = 0; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = EnDntJiji_SetupUnburrow; } } -void EnDntJiji_SetupUp(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupUp(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiUpAnim); Animation_Change(&this->skelAnime, &gDntJijiUpAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntJiji_Up; } -void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Up(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); if (this->actor.xzDistToPlayer < 150.0f) { @@ -142,15 +142,15 @@ void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupUnburrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupUnburrow(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiUnburrowAnim); Animation_Change(&this->skelAnime, &gDntJijiUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntJiji_Unburrow; } -void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Unburrow(EnDntJiji* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -163,7 +163,7 @@ void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupWalk(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiWalkAnim); Animation_Change(&this->skelAnime, &gDntJijiWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 1.0f; @@ -172,7 +172,7 @@ void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Walk; } -void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Walk(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x3E8, 0); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -192,30 +192,30 @@ void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx) { this->getItemId = GI_STICK_UPGRADE_30; } this->actor.textId = 0x104D; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actor.speedXZ = 0.0f; this->unused = 5; this->actionFunc = EnDntJiji_Talk; } } -void EnDntJiji_SetupBurrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupBurrow(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiBurrowAnim); Animation_Change(&this->skelAnime, &gDntJijiBurrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DOWN); this->actionFunc = EnDntJiji_Burrow; } -void EnDntJiji_Burrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Burrow(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupCower(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiCowerAnim); Animation_Change(&this->skelAnime, &gDntJijiCowerAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 9, 3, 10, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 9, 3, 10, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); if ((CUR_UPG_VALUE(UPG_NUTS) == 1) || (CUR_UPG_VALUE(UPG_NUTS) == 0)) { @@ -229,51 +229,51 @@ void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Cower; } -void EnDntJiji_Cower(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Cower(EnDntJiji* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); if (frame >= this->endFrame) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDntJiji_SetupTalk; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } -void EnDntJiji_SetupTalk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupTalk(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiTalkAnim); Animation_Change(&this->skelAnime, &gDntJijiTalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnDntJiji_Talk; } -void EnDntJiji_Talk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Talk(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + func_8005B1A4(GET_ACTIVE_CAM(play)); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, this->getItemId, 400.0f, 200.0f); + func_8002F434(&this->actor, play, this->getItemId, 400.0f, 200.0f); this->actionFunc = EnDntJiji_SetupGivePrize; } } -void EnDntJiji_SetupGivePrize(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupGivePrize(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnDntJiji_GivePrize; } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, 400.0f, 200.0f); + func_8002F434(&this->actor, play, this->getItemId, 400.0f, 200.0f); } } -void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_GivePrize(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if ((this->getItemId == GI_NUT_UPGRADE_30) || (this->getItemId == GI_NUT_UPGRADE_40)) { // "nut" osSyncPrintf("実 \n"); @@ -313,13 +313,13 @@ void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupHide(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupHide(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiHideAnim); Animation_Change(&this->skelAnime, &gDntJijiHideAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->actionFunc = EnDntJiji_Hide; } -void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Hide(EnDntJiji* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -328,7 +328,7 @@ void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupReturn(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiWalkAnim); Animation_Change(&this->skelAnime, &gDntJijiWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 2.0f; @@ -336,7 +336,7 @@ void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Return; } -void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Return(EnDntJiji* this, PlayState* play) { f32 dx; f32 dz; @@ -369,7 +369,7 @@ void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Update(Actor* thisx, PlayState* play) { s32 pad; EnDntJiji* this = (EnDntJiji*)thisx; @@ -418,29 +418,29 @@ void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx) { this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->isSolid != 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void EnDntJiji_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Draw(Actor* thisx, PlayState* play) { static void* blinkTex[] = { gDntJijiEyeOpenTex, gDntJijiEyeHalfTex, gDntJijiEyeShutTex }; EnDntJiji* this = (EnDntJiji*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Push(); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->eyeState])); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this); Matrix_Pop(); Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDntJijiFlowerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h index 1d809c309..20199a7c2 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h +++ b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h @@ -6,7 +6,7 @@ struct EnDntJiji; -typedef void (*EnDntJijiActionFunc)(struct EnDntJiji*, GlobalContext*); +typedef void (*EnDntJijiActionFunc)(struct EnDntJiji*, PlayState*); typedef struct EnDntJiji { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index c3970e2d7..7b1d015d5 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -15,46 +15,46 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_DrawTargetScrub(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_DrawStageScrub(Actor* thisx, GlobalContext* globalCtx); +void EnDntNomal_Init(Actor* thisx, PlayState* play); +void EnDntNomal_Destroy(Actor* thisx, PlayState* play); +void EnDntNomal_Update(Actor* thisx, PlayState* play); +void EnDntNomal_DrawTargetScrub(Actor* thisx, PlayState* play); +void EnDntNomal_DrawStageScrub(Actor* thisx, PlayState* play); -void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetFlower(EnDntNomal* this, PlayState* play); -void EnDntNomal_SetupTargetWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetTalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_SetupTargetWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetWalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetTalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, PlayState* play); -void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetTalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetUnburrow(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetWalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetFacePlayer(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetTalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetGivePrize(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetReturn(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetBurrow(EnDntNomal* this, PlayState* play); -void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageAttack(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_SetupStageWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageDance(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageHide(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageAttack(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageSetupReturn(EnDntNomal* this, PlayState* play); -void EnDntNomal_StageWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageAttackHide(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_StageWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageUp(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageUnburrow(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageCelebrate(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageDance(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageHide(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageAttackHide(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageAttack(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageReturn(EnDntNomal* this, PlayState* play); const ActorInit En_Dnt_Nomal_InitVars = { ACTOR_EN_DNT_NOMAL, @@ -115,7 +115,7 @@ static Color_RGBA8 sLeafColors[] = { { 255, 255, 255, 255 }, { 255, 195, 175, 255 }, { 210, 255, 0, 255 }, }; -void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_Init(Actor* thisx, PlayState* play) { s32 pad; EnDntNomal* this = (EnDntNomal*)thisx; @@ -130,20 +130,20 @@ void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); // "Deku Scrub target" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツ的当て ☆☆☆☆☆ \n" VT_RST); - Collider_InitQuad(globalCtx, &this->targetQuad); - Collider_SetQuad(globalCtx, &this->targetQuad, &this->actor, &sTargetQuadInit); + Collider_InitQuad(play, &this->targetQuad); + Collider_SetQuad(play, &this->targetQuad, &this->actor, &sTargetQuadInit); this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->objId = OBJECT_HINTNUTS; } else { osSyncPrintf("\n\n"); // "Deku Scrub mask show audience" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会一般人 ☆☆☆☆☆ \n" VT_RST); - Collider_InitCylinder(globalCtx, &this->bodyCyl); - Collider_SetCylinder(globalCtx, &this->bodyCyl, &this->actor, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->bodyCyl); + Collider_SetCylinder(play, &this->bodyCyl, &this->actor, &sBodyCylinderInit); this->objId = OBJECT_DNK; } if (this->objId >= 0) { - this->objIndex = Object_GetIndex(&globalCtx->objectCtx, this->objId); + this->objIndex = Object_GetIndex(&play->objectCtx, this->objId); if (this->objIndex < 0) { Actor_Kill(&this->actor); // "What?" @@ -158,30 +158,30 @@ void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_WaitForObject; } -void EnDntNomal_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDntNomal* this = (EnDntNomal*)thisx; if (this->type == ENDNTNOMAL_TARGET) { - Collider_DestroyQuad(globalCtx, &this->targetQuad); + Collider_DestroyQuad(play, &this->targetQuad); } else { - Collider_DestroyCylinder(globalCtx, &this->bodyCyl); + Collider_DestroyCylinder(play, &this->bodyCyl); } } -void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objIndex].segment); +void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objIndex].segment); this->actor.objBankIndex = this->objIndex; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.gravity = -2.0f; Actor_SetScale(&this->actor, 0.01f); if (this->type == ENDNTNOMAL_TARGET) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gHintNutsSkel, &gHintNutsBurrowAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gHintNutsSkel, &gHintNutsBurrowAnim, this->jointTable, this->morphTable, 10); this->actor.draw = EnDntNomal_DrawTargetScrub; } else { - SkelAnime_Init(globalCtx, &this->skelAnime, &gDntStageSkel, &gDntStageHideAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gDntStageSkel, &gDntStageHideAnim, this->jointTable, this->morphTable, 11); this->actor.draw = EnDntNomal_DrawStageScrub; } @@ -189,7 +189,7 @@ void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetFlower(EnDntNomal* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { this->flowerPos = this->actor.world.pos; if (this->type == ENDNTNOMAL_TARGET) { @@ -200,14 +200,14 @@ void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupTargetWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetWait(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsBurrowAnim); Animation_Change(&this->skelAnime, &gHintNutsBurrowAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->skelAnime.curFrame = 8.0f; this->actionFunc = EnDntNomal_TargetWait; } -void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play) { Vec3f scorePos; f32 targetX = 1340.0f; f32 targetY = 50.0f; @@ -242,7 +242,7 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { scorePos.x = this->actor.world.pos.x - 20.0f; scorePos.y = this->actor.world.pos.y + 20.0f; scorePos.z = this->actor.world.pos.z; - EffectSsExtra_Spawn(globalCtx, &scorePos, &scoreVel, &scoreAccel, 4, 2); + EffectSsExtra_Spawn(play, &scorePos, &scoreVel, &scoreAccel, 4, 2); Audio_StopSfxById(NA_SE_SY_TRE_BOX_APPEAR); func_80078884(NA_SE_SY_TRE_BOX_APPEAR); // "Big hit" @@ -253,8 +253,8 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { if(gSaveContext.n64ddFlag) { this->actionFunc = EnDntNomal_TargetGivePrize; } else { - OnePointCutscene_Init(globalCtx, 4140, -99, &this->actor, MAIN_CAM); - func_8002DF54(globalCtx, &this->actor, 1); + OnePointCutscene_Init(play, 4140, -99, &this->actor, MAIN_CAM); + func_8002DF54(play, &this->actor, 1); this->timer4 = 50; this->actionFunc = EnDntNomal_SetupTargetUnburrow; } @@ -264,13 +264,13 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { scorePos.x = this->actor.world.pos.x; scorePos.y = this->actor.world.pos.y + 20.0f; scorePos.z = this->actor.world.pos.z; - EffectSsExtra_Spawn(globalCtx, &scorePos, &scoreVel, &scoreAccel, 4, 0); + EffectSsExtra_Spawn(play, &scorePos, &scoreVel, &scoreAccel, 4, 0); this->hitCounter = 0; } } } -void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, PlayState* play) { Vec3f spawnPos; if (this->timer4 == 0) { @@ -278,13 +278,13 @@ void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) Animation_Change(&this->skelAnime, &gHintNutsUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); spawnPos = this->actor.world.pos; spawnPos.y = this->actor.world.pos.y + 50.0f; - EffectSsHahen_SpawnBurst(globalCtx, &spawnPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &spawnPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntNomal_TargetUnburrow; } } -void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetUnburrow(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -293,7 +293,7 @@ void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetWalk(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsRunAnim); Animation_Change(&this->skelAnime, &gHintNutsRunAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 1.0f; @@ -301,7 +301,7 @@ void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_TargetWalk; } -void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetWalk(EnDntNomal* this, PlayState* play) { f32 dx; f32 dz; @@ -319,7 +319,7 @@ void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetFacePlayer(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { @@ -330,32 +330,32 @@ void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupTargetTalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetTalk(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsTalkAnim); Animation_Change(&this->skelAnime, &gHintNutsTalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0x10AF; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = EnDntNomal_TargetTalk; } -void EnDntNomal_TargetTalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetTalk(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); - GET_ACTIVE_CAM(globalCtx)->csId = 0; - func_8002DF54(globalCtx, NULL, 8); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8005B1A4(GET_ACTIVE_CAM(play)); + GET_ACTIVE_CAM(play)->csId = 0; + func_8002DF54(play, NULL, 8); this->actionFunc = EnDntNomal_SetupTargetGivePrize; } } -void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsSpitAnim); Animation_Change(&this->skelAnime, &gHintNutsSpitAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->actionFunc = EnDntNomal_TargetGivePrize; } -void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetGivePrize(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -364,9 +364,9 @@ void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { f32 itemY = this->mouthPos.y; f32 itemZ = this->mouthPos.z; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, itemX, itemY, itemZ, 0, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemX, itemY, itemZ, 0, 0, 0, EXITEM_BULLET_BAG) == NULL) { - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); Actor_Kill(&this->actor); } this->spawnedItem = true; @@ -379,7 +379,7 @@ void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetReturn(EnDntNomal* this, PlayState* play) { f32 dx; f32 dz; @@ -404,7 +404,7 @@ void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetBurrow(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -413,7 +413,7 @@ void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageWait(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageHideAnim); Animation_Change(&this->skelAnime, &gDntStageHideAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); @@ -423,25 +423,25 @@ void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageWait(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnDntNomal_SetupStageUp(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageUp(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageUpAnim); Animation_Change(&this->skelAnime, &gDntStageUpAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); if (this->action != DNT_ACTION_ATTACK) { this->rotDirection = -1; } - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->isSolid = true; this->actionFunc = EnDntNomal_StageUp; } } -void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageUp(EnDntNomal* this, PlayState* play) { s16 rotTarget; f32 frame = this->skelAnime.curFrame; f32 turnMod; @@ -484,18 +484,18 @@ void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageUnburrow(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageUnburrowAnim); Animation_Change(&this->skelAnime, &gDntStageUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->isSolid = false; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntNomal_StageUnburrow; } } -void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageUnburrow(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -510,7 +510,7 @@ void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageWalkAnim); Animation_Change(&this->skelAnime, &gDntStageWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 3.0f; @@ -518,13 +518,13 @@ void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) this->actionFunc = EnDntNomal_StageCelebrate; } -void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageCelebrate(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->timer1 == 0) && (this->timer3 == 0)) { f32 dx = this->targetPos.x - this->actor.world.pos.x; f32 dz = this->targetPos.z - this->actor.world.pos.z; - if ((fabsf(dx) < 10.0f) && (fabsf(dz) < 10.0f) && (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((fabsf(dx) < 10.0f) && (fabsf(dz) < 10.0f) && (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { this->action = DNT_ACTION_PRIZE; this->actionFunc = EnDntNomal_SetupStageDance; this->actor.speedXZ = 0.0f; @@ -552,7 +552,7 @@ void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageDance(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageDanceAnim); Animation_Change(&this->skelAnime, &gDntStageDanceAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->isSolid = true; @@ -564,7 +564,7 @@ void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_StageDance; } -void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageDance(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer2 == 0) { if (this->action == DNT_ACTION_DANCE) { @@ -588,7 +588,7 @@ void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageHide(EnDntNomal* this, PlayState* play) { if (this->timer3 != 0) { if ((this->timer3 == 1) && (this->ignore == 1)) { func_80078884(NA_SE_SY_ERROR); @@ -602,14 +602,14 @@ void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageHide(EnDntNomal* this, PlayState* play) { EnExRuppy* rupee; f32 frame = this->skelAnime.curFrame; s16 rupeeColor; SkelAnime_Update(&this->skelAnime); if (frame >= this->endFrame) { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); switch (this->action) { case DNT_ACTION_NONE: @@ -621,7 +621,7 @@ void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx) { case DNT_ACTION_LOW_RUPEES: case DNT_ACTION_HIGH_RUPEES: rupee = - (EnExRuppy*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_RUPPY, this->actor.world.pos.x, + (EnExRuppy*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_RUPPY, this->actor.world.pos.x, this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0, 0, 0, 3); if (rupee != NULL) { rupeeColor = this->action - DNT_ACTION_LOW_RUPEES; @@ -642,26 +642,26 @@ void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageAttackHide(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageAttackHide(EnDntNomal* this, PlayState* play) { if (this->actor.xzDistToPlayer > 70.0f) { this->actionFunc = EnDntNomal_SetupStageUp; } } -void EnDntNomal_SetupStageAttack(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageAttack(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageSpitAnim); Animation_Change(&this->skelAnime, &gDntStageSpitAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->actor.colChkInfo.mass = 0xFF; this->isSolid = true; this->timer2 = 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actionFunc = EnDntNomal_StageAttack; } } -void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDntNomal_StageAttack(EnDntNomal* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* nut; f32 frame = this->skelAnime.curFrame; f32 dz; @@ -701,7 +701,7 @@ void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) { spawnY = this->mouthPos.y + spawnOffset.y; spawnZ = this->mouthPos.z + spawnOffset.z; - nut = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, spawnX, spawnY, spawnZ, + nut = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnX, spawnY, spawnZ, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 4); if (nut != NULL) { nut->velocity.y = spawnOffset.y * 0.5f; @@ -711,7 +711,7 @@ void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageSetupReturn(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageWalkAnim); Animation_Change(&this->skelAnime, &gDntStageWalkAnim, 1.5f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 4.0f; @@ -719,7 +719,7 @@ void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_StageReturn; } -void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageReturn(EnDntNomal* this, PlayState* play) { f32 sp2C; f32 sp28; @@ -740,7 +740,7 @@ void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_Update(Actor* thisx, PlayState* play) { s32 pad; EnDntNomal* this = (EnDntNomal*)thisx; @@ -809,36 +809,36 @@ void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx) { this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); if (this->type == ENDNTNOMAL_TARGET) { Collider_SetQuadVertices(&this->targetQuad, &this->targetVtx[0], &this->targetVtx[1], &this->targetVtx[2], &this->targetVtx[3]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->targetQuad.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->targetQuad.base); } else { Collider_UpdateCylinder(&this->actor, &this->bodyCyl); if (this->isSolid) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCyl.base); } } } -s32 EnDntNomal_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnDntNomal_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDntNomal* this = (EnDntNomal*)thisx; if ((limbIndex == 1) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sLeafColors[this->type - ENDNTNOMAL_STAGE].r, sLeafColors[this->type - ENDNTNOMAL_STAGE].g, sLeafColors[this->type - ENDNTNOMAL_STAGE].b, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } return false; } -void EnDntNomal_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDntNomal_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnDntNomal* this = (EnDntNomal*)thisx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -851,42 +851,42 @@ void EnDntNomal_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnDntNomal_DrawStageScrub(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_DrawStageScrub(Actor* thisx, PlayState* play) { static void* blinkTex[] = { gDntStageEyeOpenTex, gDntStageEyeHalfTex, gDntStageEyeShutTex }; EnDntNomal* this = (EnDntNomal*)thisx; Vec3f dustScale = { 0.25f, 0.25f, 0.25f }; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->eyeState])); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDntNomal_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDntNomal_OverrideLimbDraw, EnDntNomal_PostLimbDraw, this); Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sLeafColors[this->type - ENDNTNOMAL_STAGE].r, sLeafColors[this->type - ENDNTNOMAL_STAGE].g, sLeafColors[this->type - ENDNTNOMAL_STAGE].b, 255); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDntStageFlowerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->actionFunc == EnDntNomal_StageCelebrate) { - func_80033C30(&this->actor.world.pos, &dustScale, 255, globalCtx); + func_80033C30(&this->actor.world.pos, &dustScale, 255, play); } } -void EnDntNomal_DrawTargetScrub(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_DrawTargetScrub(Actor* thisx, PlayState* play) { EnDntNomal* this = (EnDntNomal*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDntNomal_PostLimbDraw, + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDntNomal_PostLimbDraw, this); Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gHintNutsFlowerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h b/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h index d94da9e10..0b5c6f12e 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h +++ b/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h @@ -6,7 +6,7 @@ struct EnDntNomal; -typedef void (*EnDntNomalActionFunc)(struct EnDntNomal*, GlobalContext*); +typedef void (*EnDntNomalActionFunc)(struct EnDntNomal*, PlayState*); typedef struct EnDntNomal { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index 6b95bd2e5..5e4c6907f 100644 --- a/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -10,26 +10,26 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDodojr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDodojr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDodojr_Init(Actor* thisx, PlayState* play); +void EnDodojr_Destroy(Actor* thisx, PlayState* play); +void EnDodojr_Update(Actor* thisx, PlayState* play); +void EnDodojr_Draw(Actor* thisx, PlayState* play); -void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7BE4(EnDodojr* this, GlobalContext* globalCtx); -void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx); -void func_809F758C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F786C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F799C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx); -void func_809F773C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx); -void func_809F784C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7C48(EnDodojr* this, GlobalContext* globalCtx); -void func_809F768C(EnDodojr* this, GlobalContext* globalCtx); +void func_809F73AC(EnDodojr* this, PlayState* play); +void func_809F7BE4(EnDodojr* this, PlayState* play); +void func_809F74C4(EnDodojr* this, PlayState* play); +void func_809F758C(EnDodojr* this, PlayState* play); +void func_809F786C(EnDodojr* this, PlayState* play); +void func_809F799C(EnDodojr* this, PlayState* play); +void func_809F78EC(EnDodojr* this, PlayState* play); +void func_809F773C(EnDodojr* this, PlayState* play); +void func_809F77AC(EnDodojr* this, PlayState* play); +void func_809F784C(EnDodojr* this, PlayState* play); +void func_809F7AB8(EnDodojr* this, PlayState* play); +void func_809F7A00(EnDodojr* this, PlayState* play); +void func_809F7B3C(EnDodojr* this, PlayState* play); +void func_809F7C48(EnDodojr* this, PlayState* play); +void func_809F768C(EnDodojr* this, PlayState* play); const ActorInit En_Dodojr_InitVars = { ACTOR_EN_DODOJR, @@ -66,14 +66,14 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInit = { 1, 2, 25, 25, 0xFF }; -void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Init(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_dodojr_Skel_0020E0, &object_dodojr_Anim_0009D4, + SkelAnime_Init(play, &this->skelAnime, &object_dodojr_Skel_0020E0, &object_dodojr_Anim_0009D4, this->jointTable, this->morphTable, 15); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(4), &sColChkInit); this->actor.naviEnemyId = 0xE; @@ -84,10 +84,10 @@ void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_809F73AC; } -void EnDodojr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Destroy(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_809F64D0(EnDodojr* this) { @@ -95,7 +95,7 @@ void func_809F64D0(EnDodojr* this) { Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, 8); } -void func_809F6510(EnDodojr* this, GlobalContext* globalCtx, s32 count) { +void func_809F6510(EnDodojr* this, PlayState* play, s32 count) { Color_RGBA8 prim = { 170, 130, 90, 255 }; Color_RGBA8 env = { 100, 60, 20, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -113,11 +113,11 @@ void func_809F6510(EnDodojr* this, GlobalContext* globalCtx, s32 count) { pos.x = (Math_SinS(angle) * 22.0f) + this->dustPos.x; pos.z = (Math_CosS(angle) * 22.0f) + this->dustPos.z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &prim, &env, 120, 40, 10); + func_8002836C(play, &pos, &velocity, &accel, &prim, &env, 120, 40, 10); } } -void func_809F6730(EnDodojr* this, GlobalContext* globalCtx, Vec3f* arg2) { +void func_809F6730(EnDodojr* this, PlayState* play, Vec3f* arg2) { Color_RGBA8 prim = { 170, 130, 90, 255 }; Color_RGBA8 env = { 100, 60, 20, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -133,10 +133,10 @@ void func_809F6730(EnDodojr* this, GlobalContext* globalCtx, Vec3f* arg2) { pos.x = (Math_SinS(angle) * 11.0f) + arg2->x; pos.z = (Math_CosS(angle) * 11.0f) + arg2->z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &prim, &env, 100, 60, 8); + func_8002836C(play, &pos, &velocity, &accel, &prim, &env, 100, 60, 8); } -s32 func_809F68B0(EnDodojr* this, GlobalContext* globalCtx) { +s32 func_809F68B0(EnDodojr* this, PlayState* play) { if (this->actor.velocity.y >= 0.0f) { return 0; } @@ -148,7 +148,7 @@ s32 func_809F68B0(EnDodojr* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); this->dustPos = this->actor.world.pos; - func_809F6510(this, globalCtx, 10); + func_809F6510(this, play, 10); this->actor.velocity.y = 10.0f / (4 - this->unk_1FC); this->unk_1FC--; @@ -221,7 +221,7 @@ void func_809F6C24(EnDodojr* this) { this->actor.gravity = -0.8f; } -s32 func_809F6CA4(EnDodojr* this, GlobalContext* globalCtx) { +s32 func_809F6CA4(EnDodojr* this, PlayState* play) { Actor* bomb; Vec3f unkVec = { 99999.0f, 99999.0f, 99999.0f }; s32 retVar = 0; @@ -229,7 +229,7 @@ s32 func_809F6CA4(EnDodojr* this, GlobalContext* globalCtx) { f32 yDist; f32 zDist; - bomb = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + bomb = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; this->bomb = NULL; while (bomb != NULL) { @@ -275,16 +275,16 @@ s32 func_809F6DD0(EnDodojr* this) { } } -void func_809F6E54(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F6E54(EnDodojr* this, PlayState* play) { f32 angles[] = { 0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f }; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f pos; s16 angleIndex; if ((this->bomb == NULL) || (this->bomb->update == NULL) || ((this->bomb != NULL) && (this->bomb->parent != NULL))) { - func_809F6CA4(this, globalCtx); + func_809F6CA4(this, play); } if (this->bomb != NULL) { @@ -295,7 +295,7 @@ void func_809F6E54(EnDodojr* this, GlobalContext* globalCtx) { if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &pos) > 80.0f) { angleIndex = (s16)(this->actor.home.pos.x + this->actor.home.pos.y + this->actor.home.pos.z + - globalCtx->state.frames / 30) % + play->state.frames / 30) % 12; angleIndex = ABS(angleIndex); pos.x += 80.0f * sinf(angles[angleIndex]); @@ -321,7 +321,7 @@ void func_809F709C(EnDodojr* this) { this->actionFunc = func_809F7AB8; } -s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { +s32 func_809F70E8(EnDodojr* this, PlayState* play) { if ((this->actionFunc == func_809F773C) || (this->actionFunc == func_809F77AC) || (this->actionFunc == func_809F784C) || (this->actionFunc == func_809F7A00) || (this->actionFunc == func_809F7AB8) || (this->actionFunc == func_809F7B3C) || @@ -329,7 +329,7 @@ s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { return 0; } - if (globalCtx->actorCtx.unk_02 != 0) { + if (play->actorCtx.unk_02 != 0) { if (this->actionFunc != func_809F73AC) { if (this->actionFunc == func_809F74C4) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; @@ -350,7 +350,7 @@ s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { } if ((this->actor.colChkInfo.damageEffect == 0) && (this->actor.colChkInfo.damage != 0)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->timer2 = 2; this->actionFunc = func_809F7C48; return 1; @@ -369,28 +369,28 @@ s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F72A4(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F72A4(EnDodojr* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) { if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) || (this->actionFunc == func_809F799C)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) || (this->actionFunc == func_809F786C) || (this->actionFunc == func_809F78EC) || (this->actionFunc == func_809F799C)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F73AC(EnDodojr* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_000860); - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 dist; if (!(this->actor.xzDistToPlayer >= 320.0f)) { @@ -411,14 +411,14 @@ void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F74C4(EnDodojr* this, PlayState* play) { f32 sp2C; Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 4, 0x3E8, 0x64); sp2C = this->actor.shape.rot.x; sp2C /= 16384.0f; this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * sp2C); - func_809F6510(this, globalCtx, 3); + func_809F6510(this, play, 3); if (sp2C == 0.0f) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; @@ -428,9 +428,9 @@ void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F758C(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); - func_809F6730(this, globalCtx, &this->actor.world.pos); + func_809F6730(this, play, &this->actor.world.pos); if (DECR(this->timer4) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_MOVE); @@ -443,7 +443,7 @@ void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) { return; } - func_809F6E54(this, globalCtx); + func_809F6E54(this, play); if (func_809F706C(this) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_CRY); @@ -458,7 +458,7 @@ void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F768C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F768C(EnDodojr* this, PlayState* play) { EnBom* bomb; if (((s16)this->skelAnime.curFrame - 8) < 4) { @@ -474,7 +474,7 @@ void func_809F768C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F773C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F773C(EnDodojr* this, PlayState* play) { if (DECR(this->timer3) == 0) { func_809F64D0(this); this->actor.flags &= ~ACTOR_FLAG_0; @@ -483,12 +483,12 @@ void func_809F773C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F77AC(EnDodojr* this, PlayState* play) { this->rootScale = 1.2f; this->rootScale *= ((f32)this->actor.colorFilterTimer / 8); func_8002D868(&this->actor); - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { this->timer3 = 60; func_809F6AC4(this); this->unk_1FC = 7; @@ -496,14 +496,14 @@ void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F784C(EnDodojr* this, GlobalContext* globalCtx) { - func_809F7B3C(this, globalCtx); +void func_809F784C(EnDodojr* this, PlayState* play) { + func_809F7B3C(this, play); } -void func_809F786C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F786C(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { func_809F6AC4(this); this->actionFunc = func_809F78EC; } @@ -513,7 +513,7 @@ void func_809F786C(EnDodojr* this, GlobalContext* globalCtx) { this->actor.colorFilterTimer = this->timer1; } -void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F78EC(EnDodojr* this, PlayState* play) { if (DECR(this->timer1) != 0) { if (this->timer1 < 30) { if ((this->timer1 & 1) != 0) { @@ -532,17 +532,17 @@ void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F799C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F799C(EnDodojr* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_24; func_8002D868(&this->actor); - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { func_809F6994(this); this->actionFunc = func_809F758C; } } -void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7A00(EnDodojr* this, PlayState* play) { f32 tmp; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x4000, 4, 1000, 100); @@ -554,15 +554,15 @@ void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } - func_809F6510(this, globalCtx, 3); + func_809F6510(this, play, 3); } -void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7AB8(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10); this->actor.world.rot.x = this->actor.shape.rot.x; - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { this->timer3 = 60; func_809F6AC4(this); this->unk_1FC = 7; @@ -570,7 +570,7 @@ void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7B3C(EnDodojr* this, PlayState* play) { EnBom* bomb; if (this->unk_1FC != 0) { @@ -579,7 +579,7 @@ void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) { this->unk_1FC--; } } else { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_BODY); if (bomb != NULL) { @@ -591,36 +591,36 @@ void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F7BE4(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7BE4(EnDodojr* this, PlayState* play) { if (DECR(this->timer3) == 0) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x40); Actor_Kill(&this->actor); } } -void func_809F7C48(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7C48(EnDodojr* this, PlayState* play) { if (DECR(this->timer2) == 0) { func_809F709C(this); } } -void EnDodojr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Update(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - func_809F70E8(this, globalCtx); + func_809F70E8(this, play); if (this->actionFunc != func_809F73AC) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, this->collider.dim.radius, this->collider.dim.height, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.radius, this->collider.dim.height, 0.0f, 5); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 10.0f); - func_809F72A4(this, globalCtx); + func_809F72A4(this, play); } -s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_809F7D50(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDodojr* this = (EnDodojr*)thisx; Vec3f D_809F7F64 = { 480.0f, 620.0f, 0.0f }; @@ -636,15 +636,15 @@ s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_809F7DFC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void func_809F7DFC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Draw(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_809F7D50, func_809F7DFC, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_809F7D50, func_809F7DFC, &this->actor); } } diff --git a/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h b/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h index 2ca10bd5f..e20209598 100644 --- a/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h +++ b/soh/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h @@ -6,7 +6,7 @@ struct EnDodojr; -typedef void (*EnDodojrActionFunc)(struct EnDodojr*, GlobalContext*); +typedef void (*EnDodojrActionFunc)(struct EnDodojr*, PlayState*); typedef struct EnDodojr { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index feb889b1c..406684ca2 100644 --- a/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -17,24 +17,24 @@ typedef enum { DODONGO_WALK } EnDodongoActionState; -void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDodongo_Init(Actor* thisx, PlayState* play); +void EnDodongo_Destroy(Actor* thisx, PlayState* play); +void EnDodongo_Update(Actor* thisx, PlayState* play); +void EnDodongo_Draw(Actor* thisx, PlayState* play); -void EnDodongo_SetupDeath(EnDodongo* this, GlobalContext* globalCtx); +void EnDodongo_SetupDeath(EnDodongo* this, PlayState* play); void EnDodongo_ShiftVecRadial(s16 yaw, f32 radius, Vec3f* vec); -s32 EnDodongo_AteBomb(EnDodongo* this, GlobalContext* globalCtx); +s32 EnDodongo_AteBomb(EnDodongo* this, PlayState* play); void EnDodongo_SetupIdle(EnDodongo* this); -void EnDodongo_Idle(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_EndBreatheFire(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_Stunned(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_Death(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx); +void EnDodongo_Idle(EnDodongo* this, PlayState* play); +void EnDodongo_EndBreatheFire(EnDodongo* this, PlayState* play); +void EnDodongo_BreatheFire(EnDodongo* this, PlayState* play); +void EnDodongo_SwallowBomb(EnDodongo* this, PlayState* play); +void EnDodongo_Walk(EnDodongo* this, PlayState* play); +void EnDodongo_Stunned(EnDodongo* this, PlayState* play); +void EnDodongo_Death(EnDodongo* this, PlayState* play); +void EnDodongo_SweepTail(EnDodongo* this, PlayState* play); const ActorInit En_Dodongo_InitVars = { ACTOR_EN_DODONGO, @@ -239,7 +239,7 @@ void EnDodongo_SetupAction(EnDodongo* this, EnDodongoActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SpawnBombSmoke(EnDodongo* this, PlayState* play) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.3f, 0.0f }; @@ -271,7 +271,7 @@ void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { velocity.z = randCos * 3.5f; accel.x = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randSin; accel.z = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randCos; - func_8002836C(globalCtx, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); + func_8002836C(play, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); randAngle = Rand_ZeroOne() * 0x2000; randCos = Math_CosS(this->actor.shape.rot.y + randAngle); @@ -283,7 +283,7 @@ void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { velocity.z = randSin * 3.5f; accel.x = ((Rand_ZeroOne() * 0.1f) + 0.15f) * randCos; accel.z = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randSin; - func_8002836C(globalCtx, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); + func_8002836C(play, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); randAngle = Rand_ZeroOne() * 0x2000; randCos = Math_CosS(this->actor.shape.rot.y + randAngle); @@ -296,7 +296,7 @@ void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { velocity.z = -randSin * 3.5f; accel.x = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randCos; accel.z = ((Rand_ZeroOne() * 0.1f) + 0.15f) * randSin; - func_8002836C(globalCtx, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); + func_8002836C(play, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); } static InitChainEntry sInitChain[] = { @@ -305,7 +305,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2800, ICHAIN_STOP), }; -void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Init(Actor* thisx, PlayState* play) { EnDodongo* this = (EnDodongo*)thisx; EffectBlureInit1 blureInit; @@ -317,17 +317,17 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { this->bodyScale.x = this->bodyScale.y = this->bodyScale.z = 1.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f); Actor_SetScale(&this->actor, 0.01875f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDodongoSkel, &gDodongoWaitAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gDodongoSkel, &gDodongoWaitAnim, this->jointTable, this->morphTable, 31); this->actor.colChkInfo.health = 4; this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.damageTable = &sDamageTable; - Collider_InitQuad(globalCtx, &this->colliderAT); - Collider_InitTris(globalCtx, &this->colliderHard); - Collider_InitJntSph(globalCtx, &this->colliderBody); - Collider_SetQuad(globalCtx, &this->colliderAT, &this->actor, &sAttackQuadInit); - Collider_SetTris(globalCtx, &this->colliderHard, &this->actor, &sHardTrisInit, this->trisElements); - Collider_SetJntSph(globalCtx, &this->colliderBody, &this->actor, &sBodyJntSphInit, this->sphElements); + Collider_InitQuad(play, &this->colliderAT); + Collider_InitTris(play, &this->colliderHard); + Collider_InitJntSph(play, &this->colliderBody); + Collider_SetQuad(play, &this->colliderAT, &this->actor, &sAttackQuadInit); + Collider_SetTris(play, &this->colliderHard, &this->actor, &sHardTrisInit, this->trisElements); + Collider_SetJntSph(play, &this->colliderBody, &this->actor, &sBodyJntSphInit, this->sphElements); blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = blureInit.p1EndColor[0] = @@ -340,19 +340,19 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = false; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); + Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); EnDodongo_SetupIdle(this); } -void EnDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDodongo* this = (EnDodongo*)thisx; - Effect_Delete(globalCtx, this->blureIdx); - Collider_DestroyTris(globalCtx, &this->colliderHard); - Collider_DestroyJntSph(globalCtx, &this->colliderBody); - Collider_DestroyQuad(globalCtx, &this->colliderAT); + Effect_Delete(play, this->blureIdx); + Collider_DestroyTris(play, &this->colliderHard); + Collider_DestroyJntSph(play, &this->colliderBody); + Collider_DestroyQuad(play, &this->colliderAT); } void EnDodongo_SetupIdle(EnDodongo* this) { @@ -407,21 +407,21 @@ void EnDodongo_SetupStunned(EnDodongo* this) { EnDodongo_SetupAction(this, EnDodongo_Stunned); } -void EnDodongo_Idle(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Idle(EnDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((DECR(this->timer) == 0) && Animation_OnFrame(&this->skelAnime, 0.0f)) { EnDodongo_SetupWalk(this); } } -void EnDodongo_EndBreatheFire(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_EndBreatheFire(EnDodongo* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnDodongo_SetupIdle(this); this->timer = Rand_S16Offset(10, 20); } } -void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_BreatheFire(EnDodongo* this, PlayState* play) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -439,7 +439,7 @@ void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx) { pos.y += 35.0f; EnDodongo_ShiftVecRadial(this->actor.world.rot.y, 30.0f, &pos); EnDodongo_ShiftVecRadial(this->actor.world.rot.y, 2.5f, &accel); - EffectSsDFire_SpawnFixedScale(globalCtx, &pos, &velocity, &accel, 255 - (fireFrame * 10), fireFrame + 3); + EffectSsDFire_SpawnFixedScale(play, &pos, &velocity, &accel, 255 - (fireFrame * 10), fireFrame + 3); } else if ((2.0f <= this->skelAnime.curFrame) && (this->skelAnime.curFrame <= 20.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_BREATH - SFX_FLAG); } @@ -448,7 +448,7 @@ void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx) { } } -void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SwallowBomb(EnDodongo* this, PlayState* play) { Vec3f smokeVel = { 0.0f, 0.0f, 0.0f }; Vec3f smokeAccel = { 0.0f, 0.6f, 0.0f }; Color_RGBA8 white = { 255, 255, 255, 255 }; @@ -493,7 +493,7 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { pos.x = this->sphElements[0].dim.worldSphere.center.x + deathFireVel.x; pos.y = this->sphElements[0].dim.worldSphere.center.y + deathFireVel.y; pos.z = this->sphElements[0].dim.worldSphere.center.z + deathFireVel.z; - func_8002836C(globalCtx, &pos, &deathFireVel, &deathFireAccel, &this->bombSmokePrimColor, + func_8002836C(play, &pos, &deathFireVel, &deathFireAccel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 400, 10, 10); } Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); @@ -503,16 +503,16 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { } if ((s32)this->skelAnime.curFrame < 28) { if (((s32)this->skelAnime.curFrame < 26) && (this->timer <= 10)) { - EnDodongo_SpawnBombSmoke(this, globalCtx); + EnDodongo_SpawnBombSmoke(this, play); } else { pos = this->headPos; - func_8002829C(globalCtx, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); + func_8002829C(play, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); pos.x -= (Math_CosS(this->actor.shape.rot.y) * 6.0f); pos.z += (Math_SinS(this->actor.shape.rot.y) * 6.0f); - func_8002829C(globalCtx, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); + func_8002829C(play, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); pos.x = this->headPos.x + (Math_CosS(this->actor.shape.rot.y) * 6.0f); pos.z = this->headPos.z - (Math_SinS(this->actor.shape.rot.y) * 6.0f); - func_8002829C(globalCtx, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); + func_8002829C(play, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); } } this->bodyScale.y = this->bodyScale.z = (Math_SinS(this->actor.colorFilterTimer * 0x1000) * 0.5f) + 1.0f; @@ -520,14 +520,14 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (this->timer == 0) { - EnDodongo_SetupDeath(this, globalCtx); + EnDodongo_SetupDeath(this, play); } } -void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Walk(EnDodongo* this, PlayState* play) { s32 pad; f32 playbackSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yawDiff = (s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y); yawDiff = ABS(yawDiff); @@ -550,13 +550,13 @@ void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx) { if ((s32)this->skelAnime.curFrame < 21) { if (!this->rightFootStep) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 10.0f, 3, 2.0f, 200, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 10.0f, 3, 2.0f, 200, 15, false); this->rightFootStep = true; } } else { if (this->rightFootStep) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 10.0f, 3, 2.0f, 200, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 10.0f, 3, 2.0f, 200, 15, false); this->rightFootStep = false; } } @@ -600,7 +600,7 @@ void EnDodongo_SetupSweepTail(EnDodongo* this) { EnDodongo_SetupAction(this, EnDodongo_SweepTail); } -void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SweepTail(EnDodongo* this, PlayState* play) { s16 yawDiff1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -641,24 +641,24 @@ void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx) { tailPos.x = this->sphElements[1].dim.worldSphere.center.x; tailPos.y = this->sphElements[1].dim.worldSphere.center.y; tailPos.z = this->sphElements[1].dim.worldSphere.center.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); tailPos.x = this->sphElements[2].dim.worldSphere.center.x; tailPos.y = this->sphElements[2].dim.worldSphere.center.y; tailPos.z = this->sphElements[2].dim.worldSphere.center.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); if (this->colliderBody.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->colliderBody.base.at == &player->actor) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); } } -void EnDodongo_SetupDeath(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SetupDeath(EnDodongo* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gDodongoDieAnim, -8.0f); this->timer = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_DEAD); @@ -668,19 +668,19 @@ void EnDodongo_SetupDeath(EnDodongo* this, GlobalContext* globalCtx) { EnDodongo_SetupAction(this, EnDodongo_Death); } -void EnDodongo_Death(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Death(EnDodongo* this, PlayState* play) { EnBom* bomb; if (this->skelAnime.curFrame < 35.0f) { if (this->actor.params == EN_DODONGO_SMOKE_DEATH) { - EnDodongo_SpawnBombSmoke(this, globalCtx); + EnDodongo_SpawnBombSmoke(this, play); } } else if (this->actor.colorFilterTimer == 0) { Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 4); } if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->timer == 0) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 6, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; @@ -693,24 +693,24 @@ void EnDodongo_Death(EnDodongo* this, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; if (this->timer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); Actor_Kill(&this->actor); } } } -void EnDodongo_Stunned(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Stunned(EnDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { - EnDodongo_SetupDeath(this, globalCtx); + EnDodongo_SetupDeath(this, play); } else { EnDodongo_SetupIdle(this); } } } -void EnDodongo_CollisionCheck(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_CollisionCheck(EnDodongo* this, PlayState* play) { if (this->colliderHard.base.acFlags & AC_BOUNCED) { this->colliderHard.base.acFlags &= ~AC_BOUNCED; this->colliderBody.base.acFlags &= ~AC_HIT; @@ -728,7 +728,7 @@ void EnDodongo_CollisionCheck(EnDodongo* this, GlobalContext* globalCtx) { } else { Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 8); if (Actor_ApplyDamage(&this->actor) == 0) { - EnDodongo_SetupDeath(this, globalCtx); + EnDodongo_SetupDeath(this, play); } else { EnDodongo_SetupSweepTail(this); } @@ -737,7 +737,7 @@ void EnDodongo_CollisionCheck(EnDodongo* this, GlobalContext* globalCtx) { } } -void EnDodongo_UpdateQuad(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_UpdateQuad(EnDodongo* this, PlayState* play) { Vec3f sp94 = { -1000.0f, -1500.0f, 0.0f }; Vec3f sp88 = { -1000.0f, -200.0f, 1500.0f }; Vec3f sp7C = { -1000.0f, -200.0f, -1500.0f }; @@ -762,32 +762,32 @@ void EnDodongo_UpdateQuad(EnDodongo* this, GlobalContext* globalCtx) { &this->colliderAT.dim.quad[c], &this->colliderAT.dim.quad[d]); } -void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Update(Actor* thisx, PlayState* play) { s32 pad; EnDodongo* this = (EnDodongo*)thisx; - EnDodongo_CollisionCheck(this, globalCtx); + EnDodongo_CollisionCheck(this, play); if (this->actor.colChkInfo.damageEffect != 0xE) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); if (this->actor.bgCheckFlags & 2) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); if (this->actionState != DODONGO_DEATH) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderHard.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderHard.base); } if (this->actionState > DODONGO_DEATH) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } - if ((this->actionState >= DODONGO_IDLE) && EnDodongo_AteBomb(this, globalCtx)) { + if ((this->actionState >= DODONGO_IDLE) && EnDodongo_AteBomb(this, play)) { EnDodongo_SetupSwallowBomb(this); } if (this->actionState == DODONGO_BREATHE_FIRE) { if ((29.0f < this->skelAnime.curFrame) && (this->skelAnime.curFrame < 43.0f)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderAT.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderAT.base); } } this->actor.focus.pos.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y) * -30.0f; @@ -795,7 +795,7 @@ void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y) * -30.0f; } -s32 EnDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDodongo* this = (EnDodongo*)thisx; @@ -805,7 +805,7 @@ s32 EnDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f legOffsets[3] = { { 1100.0f, -700.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, @@ -844,7 +844,7 @@ void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList case 2: if ((this->actionState == DODONGO_BREATHE_FIRE) && (29.0f < this->skelAnime.curFrame) && (this->skelAnime.curFrame < 43.0f)) { - EnDodongo_UpdateQuad(this, globalCtx); + EnDodongo_UpdateQuad(this, play); } break; case 7: @@ -913,13 +913,13 @@ void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDodongo_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDodongo* this = (EnDodongo*)thisx; s32 index; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, EnDodongo_PostLimbDraw, this); if (this->iceTimer != 0) { @@ -927,7 +927,7 @@ void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx2) { this->iceTimer--; if ((this->iceTimer % 4) == 0) { index = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &this->icePos[index], 150, 150, 150, 250, 235, 245, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &this->icePos[index], 150, 150, 150, 250, 235, 245, 255, 1.8f); } } @@ -938,8 +938,8 @@ void EnDodongo_ShiftVecRadial(s16 yaw, f32 radius, Vec3f* vec) { vec->z += Math_CosS(yaw) * radius; } -s32 EnDodongo_AteBomb(EnDodongo* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +s32 EnDodongo_AteBomb(EnDodongo* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; f32 dx; f32 dy; f32 dz; diff --git a/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h b/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h index 31fb24501..a5436d627 100644 --- a/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h +++ b/soh/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h @@ -6,7 +6,7 @@ struct EnDodongo; -typedef void (*EnDodongoActionFunc)(struct EnDodongo*, GlobalContext*); +typedef void (*EnDodongoActionFunc)(struct EnDodongo*, PlayState*); typedef struct EnDodongo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 199e8cafd..11544025c 100644 --- a/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void EnDog_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDog_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDog_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDog_Init(Actor* thisx, PlayState* play); +void EnDog_Destroy(Actor* thisx, PlayState* play); +void EnDog_Update(Actor* thisx, PlayState* play); +void EnDog_Draw(Actor* thisx, PlayState* play); -void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx); -void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx); -void EnDog_FollowPlayer(EnDog* this, GlobalContext* globalCtx); -void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx); -void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx); -void EnDog_Wait(EnDog* this, GlobalContext* globalCtx); +void EnDog_FollowPath(EnDog* this, PlayState* play); +void EnDog_ChooseMovement(EnDog* this, PlayState* play); +void EnDog_FollowPlayer(EnDog* this, PlayState* play); +void EnDog_RunAway(EnDog* this, PlayState* play); +void EnDog_FaceLink(EnDog* this, PlayState* play); +void EnDog_Wait(EnDog* this, PlayState* play); const ActorInit En_Dog_InitVars = { ACTOR_EN_DOG, @@ -176,13 +176,13 @@ s32 EnDog_PlayAnimAndSFX(EnDog* this) { return 0; } -s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) { +s8 EnDog_CanFollow(EnDog* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; return 2; } - if (globalCtx->sceneNum == SCENE_MARKET_DAY) { + if (play->sceneNum == SCENE_MARKET_DAY) { return 0; } @@ -198,7 +198,7 @@ s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) { return 0; } -s32 EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) { +s32 EnDog_UpdateWaypoint(EnDog* this, PlayState* play) { s32 change; if (this->path == NULL) { @@ -226,7 +226,7 @@ s32 EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) { return 1; } -s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx) { +s32 EnDog_Orient(EnDog* this, PlayState* play) { s16 targetYaw; f32 waypointDistSq; @@ -234,19 +234,19 @@ s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, targetYaw, 10, 1000, 1); if ((waypointDistSq > 0.0f) && (waypointDistSq < 1000.0f)) { - return EnDog_UpdateWaypoint(this, globalCtx); + return EnDog_UpdateWaypoint(this, play); } else { return 0; } } -void EnDog_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Init(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; s16 followingDog; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, 13); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, 13); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDOG_ANIM_0); if ((this->actor.params & 0x8000) == 0) { @@ -259,15 +259,15 @@ void EnDog_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, 0, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.0075f); this->waypoint = 0; this->actor.gravity = -1.0f; - this->path = Path_GetByIndex(globalCtx, (this->actor.params & 0x00F0) >> 4, 0xF); + this->path = Path_GetByIndex(play, (this->actor.params & 0x00F0) >> 4, 0xF); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_MARKET_NIGHT: if ((!gSaveContext.dogIsLost) && (((this->actor.params & 0x0F00) >> 8) == 1)) { Actor_Kill(&this->actor); @@ -297,18 +297,18 @@ void EnDog_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDog_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Destroy(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { +void EnDog_FollowPath(EnDog* this, PlayState* play) { s32 behaviors[] = { DOG_SIT, DOG_BOW, DOG_BARK }; s32 unused[] = { 40, 80, 20 }; f32 speed; s32 frame; - if (EnDog_CanFollow(this, globalCtx) == 1) { + if (EnDog_CanFollow(this, play) == 1) { this->actionFunc = EnDog_FollowPlayer; } @@ -319,7 +319,7 @@ void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { speed = 4.0f; } Math_SmoothStepToF(&this->actor.speedXZ, speed, 0.4f, 1.0f, 0.0f); - EnDog_Orient(this, globalCtx); + EnDog_Orient(this, play); this->actor.shape.rot = this->actor.world.rot; // Used to change between two text boxes for Richard's owner in the Market Day scene @@ -332,7 +332,7 @@ void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { gSaveContext.eventInf[3] &= ~1; } } else { - frame = globalCtx->state.frames % 3; + frame = play->state.frames % 3; this->nextBehavior = behaviors[frame]; // no clue why they're using the behavior id to calculate timer. possibly meant to use the unused array? this->behaviorTimer = Rand_S16Offset(60, behaviors[frame]); @@ -340,14 +340,14 @@ void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { } } -void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx) { - if (EnDog_CanFollow(this, globalCtx) == 1) { +void EnDog_ChooseMovement(EnDog* this, PlayState* play) { + if (EnDog_CanFollow(this, play) == 1) { this->actionFunc = EnDog_FollowPlayer; } if (DECR(this->behaviorTimer) == 0) { this->behaviorTimer = Rand_S16Offset(200, 100); - if (globalCtx->state.frames % 2) { + if (play->state.frames % 2) { this->nextBehavior = DOG_WALK; } else { this->nextBehavior = DOG_RUN; @@ -361,7 +361,7 @@ void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.4f, 1.0f, 0.0f); } -void EnDog_FollowPlayer(EnDog* this, GlobalContext* globalCtx) { +void EnDog_FollowPlayer(EnDog* this, PlayState* play) { f32 speed; if (gSaveContext.dogParams == 0) { @@ -398,7 +398,7 @@ void EnDog_FollowPlayer(EnDog* this, GlobalContext* globalCtx) { } } -void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx) { +void EnDog_RunAway(EnDog* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f) { Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.6f, 1.0f); Math_SmoothStepToS(&this->actor.world.rot.y, (this->actor.yawTowardsPlayer ^ 0x8000), 10, 1000, 1); @@ -408,7 +408,7 @@ void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; } -void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) { +void EnDog_FaceLink(EnDog* this, PlayState* play) { s16 rotTowardLink; s16 prevRotY; f32 absAngleDiff; @@ -438,7 +438,7 @@ void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; } -void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) { +void EnDog_Wait(EnDog* this, PlayState* play) { this->unusedAngle = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y); // If another dog is following Link and he gets within 200 units of waiting dog, run away @@ -448,28 +448,28 @@ void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) { } } -void EnDog_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Update(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; s32 pad; EnDog_PlayAnimAndSFX(this); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, this->collider.dim.radius, this->collider.dim.height * 0.5f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.radius, this->collider.dim.height * 0.5f, 0.0f, 5); Actor_MoveForward(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnDog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return false; } -void EnDog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Draw(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; Color_RGBA8 colors[] = { { 255, 255, 200, 0 }, { 150, 100, 50, 0 } }; Color_RGB8 Dog1_ori = {colors[0].r, colors[0].g, colors[0].b}; @@ -477,9 +477,9 @@ void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) { Color_RGB8 Dog1 = CVar_GetRGB("gDog1Col", Dog1_ori); Color_RGB8 Dog2 = CVar_GetRGB("gDog2Col", Dog2_ori); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); if (CVar_GetS32("gUseDogsCol",0)) { @@ -500,8 +500,8 @@ void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDog_OverrideLimbDraw, EnDog_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.h b/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.h index afaf027aa..b8da73258 100644 --- a/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.h +++ b/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.h @@ -6,7 +6,7 @@ struct EnDog; -typedef void (*EnDogActionFunc)(struct EnDog*, GlobalContext*); +typedef void (*EnDogActionFunc)(struct EnDog*, PlayState*); typedef struct EnDog { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Door/z_en_door.c b/soh/src/overlays/actors/ovl_En_Door/z_en_door.c index ea76f68e7..2f316e719 100644 --- a/soh/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/soh/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -18,19 +18,19 @@ #define DOOR_CHECK_RANGE 40.0f -void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDoor_Init(Actor* thisx, PlayState* play); +void EnDoor_Destroy(Actor* thisx, PlayState* play); +void EnDoor_Update(Actor* thisx, PlayState* play); +void EnDoor_Draw(Actor* thisx, PlayState* play); -void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_WaitForCheck(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_Check(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_AjarWait(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_AjarClose(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx); +void EnDoor_SetupType(EnDoor* this, PlayState* play); +void EnDoor_Idle(EnDoor* this, PlayState* play); +void EnDoor_WaitForCheck(EnDoor* this, PlayState* play); +void EnDoor_Check(EnDoor* this, PlayState* play); +void EnDoor_AjarWait(EnDoor* this, PlayState* play); +void EnDoor_AjarOpen(EnDoor* this, PlayState* play); +void EnDoor_AjarClose(EnDoor* this, PlayState* play); +void EnDoor_Open(EnDoor* this, PlayState* play); const ActorInit En_Door_InitVars = { ACTOR_EN_DOOR, @@ -78,8 +78,8 @@ static Gfx* D_809FCEE4[5][2] = { { gFieldDoorLeftDL, gFieldDoorRightDL }, }; -void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDoor_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDoor* this = (EnDoor*)thisx; EnDoorInfo* objectInfo; s32 i; @@ -89,20 +89,20 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { objectInfo = &sDoorInfo[0]; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDoorSkel, &gDoorAdultOpeningLeftAnim, this->jointTable, this->morphTable, 5); + SkelAnime_Init(play, &this->skelAnime, &gDoorSkel, &gDoorAdultOpeningLeftAnim, this->jointTable, this->morphTable, 5); for (i = 0; i < ARRAY_COUNT(sDoorInfo) - 2; i++, objectInfo++) { - if (globalCtx->sceneNum == objectInfo->sceneNum) { + if (play->sceneNum == objectInfo->sceneNum) { break; } } // Due to Object_GetIndex always returning 0, doors always use the OBJECT_GAMEPLAY_FIELD_KEEP door. - if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) { + if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) { objectInfo++; } this->dListIndex = objectInfo->dListIndex; - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectInfo->objectId); + objBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); if (objBankIndex < 0) { Actor_Kill(&this->actor); return; @@ -111,7 +111,7 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { this->requiredObjBankIndex = objBankIndex; this->dListIndex = objectInfo->dListIndex; if (this->actor.objBankIndex == this->requiredObjBankIndex) { - EnDoor_SetupType(this, globalCtx); + EnDoor_SetupType(this, play); } else { this->actionFunc = EnDoor_SetupType; } @@ -122,7 +122,7 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { xOffset = Math_CosS(this->actor.shape.rot.y) * 30.0f; zOffset = Math_SinS(this->actor.shape.rot.y) * 30.0f; - other = (EnDoor*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DOOR, + other = (EnDoor*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DOOR, this->actor.world.pos.x + xOffset, this->actor.world.pos.y, this->actor.world.pos.z - zOffset, 0, this->actor.shape.rot.y + 0x8000, 0, this->actor.params & ~0x40); @@ -135,20 +135,20 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetFocus(&this->actor, 70.0f); } -void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Destroy(Actor* thisx, PlayState* play) { TransitionActorEntry* transitionEntry; EnDoor* this = (EnDoor*)thisx; - transitionEntry = &globalCtx->transiActorCtx.list[(u16)this->actor.params >> 0xA]; + transitionEntry = &play->transiActorCtx.list[(u16)this->actor.params >> 0xA]; if (transitionEntry->id < 0) { transitionEntry->id = -transitionEntry->id; } } -void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_SetupType(EnDoor* this, PlayState* play) { s32 doorType; - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { doorType = this->actor.params >> 7 & 7; this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->requiredObjBankIndex; @@ -161,16 +161,16 @@ void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { if (doorType == DOOR_LOCKED) { // unlock the door behind the hammer blocks // in the fire temple entryway when rando'd - if (gSaveContext.n64ddFlag && globalCtx->sceneNum == 4) { + if (gSaveContext.n64ddFlag && play->sceneNum == 4) { // RANDOTODO don't do this when keysanity is enabled - Flags_SetSwitch(globalCtx, 0x17); + Flags_SetSwitch(play, 0x17); } - if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params & 0x3F)) { this->lockTimer = 10; } } else if (doorType == DOOR_AJAR) { - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) > DOOR_AJAR_SLAM_RANGE) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) > DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarWait; this->actor.world.rot.y = -0x1800; } @@ -192,8 +192,8 @@ void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { } } -void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDoor_Idle(EnDoor* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 doorType; Vec3f playerPosRelToDoor; s16 phi_v0; @@ -206,10 +206,10 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { (player->stateFlags1 & 0x8000000) ? 0.75f : 1.5f); if (this->lockTimer != 0) { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--; - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); + Flags_SetSwitch(play, this->actor.params & 0x3F); Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } - } else if (!Player_InCsMode(globalCtx)) { + } else if (!Player_InCsMode(play)) { if (fabsf(playerPosRelToDoor.y) < 20.0f && fabsf(playerPosRelToDoor.x) < 20.0f && fabsf(playerPosRelToDoor.z) < 50.0f) { phi_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -219,7 +219,7 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { if (ABS(phi_v0) < 0x3000) { if (this->lockTimer != 0) { if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) { - Player* player2 = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(play); player2->naviTextId = -0x203; return; @@ -237,27 +237,27 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { } } -void EnDoor_WaitForCheck(EnDoor* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnDoor_WaitForCheck(EnDoor* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDoor_Check; } else { - func_8002F2CC(&this->actor, globalCtx, DOOR_CHECK_RANGE); + func_8002F2CC(&this->actor, play, DOOR_CHECK_RANGE); } } -void EnDoor_Check(EnDoor* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnDoor_Check(EnDoor* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnDoor_WaitForCheck; } } -void EnDoor_AjarWait(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_AjarWait(EnDoor* this, PlayState* play) { if (this->actor.xzDistToPlayer < DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarClose; } } -void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_AjarOpen(EnDoor* this, PlayState* play) { if (this->actor.xzDistToPlayer < DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarClose; } else if (Math_ScaledStepToS(&this->actor.world.rot.y, -0x1800, 0x100)) { @@ -265,13 +265,13 @@ void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx) { } } -void EnDoor_AjarClose(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_AjarClose(EnDoor* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.world.rot.y, 0, 0x700)) { this->actionFunc = EnDoor_Idle; } } -void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_Open(EnDoor* this, PlayState* play) { s32 i; s32 numEffects; @@ -281,33 +281,33 @@ void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx) { this->playerIsOpening = 0; } else if (Animation_OnFrame(&this->skelAnime, sDoorAnimOpenFrames[this->animStyle])) { Audio_PlayActorSound2(&this->actor, - (globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH || - globalCtx->sceneNum == SCENE_HIDAN) + (play->sceneNum == SCENE_HAKADAN || play->sceneNum == SCENE_HAKADANCH || + play->sceneNum == SCENE_HIDAN) ? NA_SE_EV_IRON_DOOR_OPEN : NA_SE_OC_DOOR_OPEN); if (this->skelAnime.playSpeed < 1.5f) { numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; for (i = 0; i < numEffects; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 60.0f, 100.0f, 50.0f, 0.15f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 60.0f, 100.0f, 50.0f, 0.15f); } } } else if (Animation_OnFrame(&this->skelAnime, sDoorAnimCloseFrames[this->animStyle])) { Audio_PlayActorSound2(&this->actor, - (globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH || - globalCtx->sceneNum == SCENE_HIDAN) + (play->sceneNum == SCENE_HAKADAN || play->sceneNum == SCENE_HAKADANCH || + play->sceneNum == SCENE_HIDAN) ? NA_SE_EV_IRON_DOOR_CLOSE : NA_SE_EV_DOOR_CLOSE); } } } -void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Update(Actor* thisx, PlayState* play) { EnDoor* this = (EnDoor*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 pad; TransitionActorEntry* transitionEntry; Gfx** temp_a2; @@ -318,12 +318,12 @@ s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList if (limbIndex == 4) { temp_a2 = D_809FCEE4[this->dListIndex]; - transitionEntry = &globalCtx->transiActorCtx.list[(u16)this->actor.params >> 0xA]; + transitionEntry = &play->transiActorCtx.list[(u16)this->actor.params >> 0xA]; rot->z += this->actor.world.rot.y; - if ((globalCtx->roomCtx.prevRoom.num >= 0) || + if ((play->roomCtx.prevRoom.num >= 0) || (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { phi_v0_2 = ((this->actor.shape.rot.y + this->skelAnime.jointTable[3].z) + rot->z) - - Math_Vec3f_Yaw(&globalCtx->view.eye, &this->actor.world.pos); + Math_Vec3f_Yaw(&play->view.eye, &this->actor.world.pos); *dList = (ABS(phi_v0_2) < 0x4000) ? temp_a2[0] : temp_a2[1]; } else { phi_v0 = this->unk_192; @@ -336,14 +336,14 @@ s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Draw(Actor* thisx, PlayState* play) { EnDoor* this = (EnDoor*)thisx; if (this->actor.objBankIndex == this->requiredObjBankIndex) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDoor_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDoor_OverrideLimbDraw, NULL, &this->actor); if (this->actor.world.rot.y != 0) { if (this->actor.world.rot.y > 0) { @@ -353,9 +353,9 @@ void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx) { } } if (this->lockTimer != 0) { - Actor_DrawDoorLock(globalCtx, this->lockTimer, DOORLOCK_NORMAL); + Actor_DrawDoorLock(play, this->lockTimer, DOORLOCK_NORMAL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Door/z_en_door.h b/soh/src/overlays/actors/ovl_En_Door/z_en_door.h index 94909cb36..b7e3d5d2f 100644 --- a/soh/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/soh/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -41,7 +41,7 @@ typedef enum { struct EnDoor; -typedef void (*EnDoorActionFunc)(struct EnDoor*, GlobalContext*); +typedef void (*EnDoorActionFunc)(struct EnDoor*, PlayState*); typedef struct EnDoor { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 331677c6d..af4abac1a 100644 --- a/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -10,12 +10,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnDs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDs_Init(Actor* thisx, PlayState* play); +void EnDs_Destroy(Actor* thisx, PlayState* play); +void EnDs_Update(Actor* thisx, PlayState* play); +void EnDs_Draw(Actor* thisx, PlayState* play); -void EnDs_Wait(EnDs* this, GlobalContext* globalCtx); +void EnDs_Wait(EnDs* this, PlayState* play); const ActorInit En_Ds_InitVars = { ACTOR_EN_DS, @@ -30,11 +30,11 @@ const ActorInit En_Ds_InitVars = { NULL, }; -void EnDs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Init(Actor* thisx, PlayState* play) { EnDs* this = (EnDs*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gPotionShopLadySkel, &gPotionShopLadyAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gPotionShopLadySkel, &gPotionShopLadyAnim, this->jointTable, this->morphTable, 6); Animation_PlayOnce(&this->skelAnime, &gPotionShopLadyAnim); @@ -49,36 +49,36 @@ void EnDs_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1E4 = 0.0f; } -void EnDs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Destroy(Actor* thisx, PlayState* play) { } -void EnDs_Talk(EnDs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnDs_Talk(EnDs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnDs_Wait; this->actor.flags &= ~ACTOR_FLAG_16; } this->unk_1E8 |= 1; } -void EnDs_TalkNoEmptyBottle(EnDs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnDs_TalkNoEmptyBottle(EnDs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnDs_Wait; } this->unk_1E8 |= 1; } -void EnDs_TalkAfterGiveOddPotion(EnDs* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnDs_TalkAfterGiveOddPotion(EnDs* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDs_Talk; } else { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } } -void EnDs_DisplayOddPotionText(EnDs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnDs_DisplayOddPotionText(EnDs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.textId = 0x504F; this->actionFunc = EnDs_TalkAfterGiveOddPotion; this->actor.flags &= ~ACTOR_FLAG_8; @@ -86,8 +86,8 @@ void EnDs_DisplayOddPotionText(EnDs* this, GlobalContext* globalCtx) { } } -void EnDs_GiveOddPotion(EnDs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnDs_GiveOddPotion(EnDs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnDs_DisplayOddPotionText; gSaveContext.timer2State = 0; @@ -95,52 +95,52 @@ void EnDs_GiveOddPotion(EnDs* this, GlobalContext* globalCtx) { u32 itemId = GI_ODD_POTION; if (gSaveContext.n64ddFlag) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_TRADE_ODD_MUSHROOM, GI_ODD_POTION); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 10000.0f, 50.0f); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_ODD_MUSHROOM); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 10000.0f, 50.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_ODD_MUSHROOM); return; } - func_8002F434(&this->actor, globalCtx, itemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, itemId, 10000.0f, 50.0f); } } -void EnDs_TalkAfterBrewOddPotion(EnDs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnDs_TalkAfterBrewOddPotion(EnDs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnDs_GiveOddPotion; u32 itemId = GI_ODD_POTION; if (gSaveContext.n64ddFlag) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_TRADE_ODD_MUSHROOM, GI_ODD_POTION); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 10000.0f, 50.0f); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_ODD_MUSHROOM); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 10000.0f, 50.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_ODD_MUSHROOM); return; } - func_8002F434(&this->actor, globalCtx, itemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, itemId, 10000.0f, 50.0f); } } -void EnDs_BrewOddPotion3(EnDs* this, GlobalContext* globalCtx) { +void EnDs_BrewOddPotion3(EnDs* this, PlayState* play) { if (this->brewTimer > 0) { this->brewTimer -= 1; } else { this->actionFunc = EnDs_TalkAfterBrewOddPotion; - Message_ContinueTextbox(globalCtx, 0x504D); + Message_ContinueTextbox(play, 0x504D); } Math_StepToF(&this->unk_1E4, 0, 0.03f); - Environment_AdjustLights(globalCtx, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); + Environment_AdjustLights(play, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); } -void EnDs_BrewOddPotion2(EnDs* this, GlobalContext* globalCtx) { +void EnDs_BrewOddPotion2(EnDs* this, PlayState* play) { if (this->brewTimer > 0) { this->brewTimer -= 1; } else { this->actionFunc = EnDs_BrewOddPotion3; this->brewTimer = gSaveContext.n64ddFlag ? 0 : 60; - Flags_UnsetSwitch(globalCtx, 0x3F); + Flags_UnsetSwitch(play, 0x3F); } } -void EnDs_BrewOddPotion1(EnDs* this, GlobalContext* globalCtx) { +void EnDs_BrewOddPotion1(EnDs* this, PlayState* play) { if (this->brewTimer > 0) { this->brewTimer -= 1; } else { @@ -149,23 +149,23 @@ void EnDs_BrewOddPotion1(EnDs* this, GlobalContext* globalCtx) { } Math_StepToF(&this->unk_1E4, 1.0f, 0.01f); - Environment_AdjustLights(globalCtx, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); + Environment_AdjustLights(play, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); } -void EnDs_OfferOddPotion(EnDs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDs_OfferOddPotion(EnDs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes this->actionFunc = EnDs_BrewOddPotion1; this->brewTimer = gSaveContext.n64ddFlag ? 0 : 60; - Flags_SetSwitch(globalCtx, 0x3F); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + Flags_SetSwitch(play, 0x3F); + play->msgCtx.msgMode = MSGMODE_PAUSED; player->exchangeItemId = EXCH_ITEM_NONE; break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x504C); + Message_ContinueTextbox(play, 0x504C); this->actionFunc = EnDs_Talk; } } @@ -181,48 +181,48 @@ s32 EnDs_CheckRupeesAndBottle() { } } -void EnDs_GiveBluePotion(EnDs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnDs_GiveBluePotion(EnDs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnDs_Talk; } else { - func_8002F434(&this->actor, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_POTION_BLUE, 10000.0f, 50.0f); } } -void EnDs_OfferBluePotion(EnDs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnDs_OfferBluePotion(EnDs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes switch (EnDs_CheckRupeesAndBottle()) { case 0: // have less than 100 rupees - Message_ContinueTextbox(globalCtx, 0x500E); + Message_ContinueTextbox(play, 0x500E); break; case 1: // have 100 rupees but no empty bottle - Message_ContinueTextbox(globalCtx, 0x96); + Message_ContinueTextbox(play, 0x96); this->actionFunc = EnDs_TalkNoEmptyBottle; return; case 2: // have 100 rupees and empty bottle Rupees_ChangeBy(-100); this->actor.flags &= ~ACTOR_FLAG_16; - func_8002F434(&this->actor, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_POTION_BLUE, 10000.0f, 50.0f); this->actionFunc = EnDs_GiveBluePotion; return; } break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x500D); + Message_ContinueTextbox(play, 0x500D); } this->actionFunc = EnDs_Talk; } } -void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDs_Wait(EnDs* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_ODD_MUSHROOM) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { + if (func_8002F368(play) == EXCH_ITEM_ODD_MUSHROOM) { Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); player->actor.textId = 0x504A; this->actionFunc = EnDs_OfferOddPotion; @@ -242,23 +242,23 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) { this->actor.textId = 0x5048; if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistToPlayer < 200.0f)) { - func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_ODD_MUSHROOM); + func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_ODD_MUSHROOM); this->unk_1E8 |= 1; } } } -void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Update(Actor* thisx, PlayState* play) { EnDs* this = (EnDs*)thisx; if (SkelAnime_Update(&this->skelAnime) != 0) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1E8 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_1D8.x, 0, 6, 0x1838, 100); Math_SmoothStepToS(&this->unk_1D8.y, 0, 6, 0x1838, 100); @@ -267,7 +267,7 @@ void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnDs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDs* this = (EnDs*)thisx; if (limbIndex == 5) { @@ -277,7 +277,7 @@ s32 EnDs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f sMultVec = { 1100.0f, 500.0f, 0.0f }; EnDs* this = (EnDs*)thisx; @@ -286,10 +286,10 @@ void EnDs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnDs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Draw(Actor* thisx, PlayState* play) { EnDs* this = (EnDs*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDs_OverrideLimbDraw, EnDs_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.h b/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.h index 035332f48..8f10ce828 100644 --- a/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.h +++ b/soh/src/overlays/actors/ovl_En_Ds/z_en_ds.h @@ -6,7 +6,7 @@ struct EnDs; -typedef void (*EnDsActionFunc)(struct EnDs*, GlobalContext*); +typedef void (*EnDsActionFunc)(struct EnDs*, PlayState*); typedef struct EnDs { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c index b1953bc74..8f8ff7f36 100644 --- a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -4,23 +4,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnDu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDu_Init(Actor* thisx, PlayState* play); +void EnDu_Destroy(Actor* thisx, PlayState* play); +void EnDu_Update(Actor* thisx, PlayState* play); +void EnDu_Draw(Actor* thisx, PlayState* play); -void func_809FE3B4(EnDu* this, GlobalContext* globalCtx); -void func_809FE3C0(EnDu* this, GlobalContext* globalCtx); -void func_809FE638(EnDu* this, GlobalContext* globalCtx); -void func_809FE890(EnDu* this, GlobalContext* globalCtx); -void func_809FE4A4(EnDu* this, GlobalContext* globalCtx); -void func_809FE6CC(EnDu* this, GlobalContext* globalCtx); -void func_809FE740(EnDu* this, GlobalContext* globalCtx); -void func_809FE798(EnDu* this, GlobalContext* globalCtx); -void func_809FEC14(EnDu* this, GlobalContext* globalCtx); -void func_809FEC70(EnDu* this, GlobalContext* globalCtx); -void func_809FECE4(EnDu* this, GlobalContext* globalCtx); -void func_809FEB08(EnDu* this, GlobalContext* globalCtx); +void func_809FE3B4(EnDu* this, PlayState* play); +void func_809FE3C0(EnDu* this, PlayState* play); +void func_809FE638(EnDu* this, PlayState* play); +void func_809FE890(EnDu* this, PlayState* play); +void func_809FE4A4(EnDu* this, PlayState* play); +void func_809FE6CC(EnDu* this, PlayState* play); +void func_809FE740(EnDu* this, PlayState* play); +void func_809FE798(EnDu* this, PlayState* play); +void func_809FEC14(EnDu* this, PlayState* play); +void func_809FEC70(EnDu* this, PlayState* play); +void func_809FECE4(EnDu* this, PlayState* play); +void func_809FEB08(EnDu* this, PlayState* play); const ActorInit En_Du_InitVars = { ACTOR_EN_DU, @@ -99,8 +99,8 @@ void EnDu_SetupAction(EnDu* this, EnDuActionFunc actionFunc) { this->actionFunc = actionFunc; } -u16 func_809FDC38(GlobalContext* globalCtx, Actor* actor) { - u16 reaction = Text_GetFaceReaction(globalCtx, 0x21); +u16 func_809FDC38(PlayState* play, Actor* actor) { + u16 reaction = Text_GetFaceReaction(play, 0x21); if (reaction != 0) { return reaction; @@ -119,8 +119,8 @@ u16 func_809FDC38(GlobalContext* globalCtx, Actor* actor) { } } -s16 func_809FDCDC(GlobalContext* globalCtx, Actor* actor) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 func_809FDCDC(PlayState* play, Actor* actor) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: break; @@ -142,7 +142,7 @@ s16 func_809FDCDC(GlobalContext* globalCtx, Actor* actor) { case TEXT_STATE_EVENT: break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { return 3; } break; @@ -154,17 +154,17 @@ s16 func_809FDCDC(GlobalContext* globalCtx, Actor* actor) { return 1; } -s32 func_809FDDB4(EnDu* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD) { +s32 func_809FDDB4(EnDu* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD) { return 1; - } else if (globalCtx->sceneNum == SCENE_HIDAN && !(gSaveContext.infTable[0x11] & 0x400) && LINK_IS_ADULT) { + } else if (play->sceneNum == SCENE_HIDAN && !(gSaveContext.infTable[0x11] & 0x400) && LINK_IS_ADULT) { return 1; } return 0; } -void func_809FDE24(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FDE24(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3 = 0; if (this->unk_1F4.unk_00 == 0) { @@ -277,16 +277,16 @@ void func_809FE104(EnDu* this) { } } -void EnDu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Init(Actor* thisx, PlayState* play) { EnDu* this = (EnDu*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, NULL, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, NULL, 0, 0, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - if (func_809FDDB4(this, globalCtx) == 0) { + if (func_809FDDB4(this, play) == 0) { Actor_Kill(&this->actor); return; } @@ -296,10 +296,10 @@ void EnDu_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1F4.unk_00 = 0; if (gSaveContext.cutsceneIndex >= 0xFFF0) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); gSaveContext.cutsceneTrigger = 1; EnDu_SetupAction(this, func_809FE890); - } else if (globalCtx->sceneNum == 4) { + } else if (play->sceneNum == 4) { EnDu_SetupAction(this, func_809FE638); } else if (!LINK_IS_ADULT) { EnDu_SetupAction(this, func_809FE3C0); @@ -308,28 +308,28 @@ void EnDu_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Destroy(Actor* thisx, PlayState* play) { EnDu* this = (EnDu*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_809FE3B4(EnDu* this, GlobalContext* globalCtx) { +void func_809FE3B4(EnDu* this, PlayState* play) { } -void func_809FE3C0(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FE3C0(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & 0x1000000) { - func_8010BD88(globalCtx, OCARINA_ACTION_CHECK_SARIA); + func_8010BD88(play, OCARINA_ACTION_CHECK_SARIA); player->stateFlags2 |= 0x2000000; player->unk_6A8 = &this->actor; EnDu_SetupAction(this, func_809FE4A4); return; } if (this->unk_1F4.unk_00 == 2) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); this->unk_1F4.unk_00 = 0; } if (this->actor.xzDistToPlayer < 116.0f + this->collider.dim.radius) { @@ -337,39 +337,39 @@ void func_809FE3C0(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FE4A4(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FE4A4(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + play->msgCtx.ocarinaMode = OCARINA_MODE_00; EnDu_SetupAction(this, func_809FE3C0); - } else if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_06) { + } else if (play->msgCtx.ocarinaMode >= OCARINA_MODE_06) { if (!gSaveContext.n64ddFlag) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaWrongCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaWrongCs); gSaveContext.cutsceneTrigger = 1; } this->unk_1E8 = 1; EnDu_SetupAction(this, func_809FE890); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); if (!gSaveContext.n64ddFlag) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaCorrectCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaCorrectCs); gSaveContext.cutsceneTrigger = 1; } this->unk_1E8 = 0; EnDu_SetupAction(this, func_809FE890); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { player->stateFlags2 |= 0x800000; } } -void func_809FE638(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FE638(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x20000000)) { - OnePointCutscene_Init(globalCtx, 3330, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3330, -99, &this->actor, MAIN_CAM); player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; Audio_PlayFanfare(NA_BGM_APPEAR); EnDu_SetupAction(this, func_809FE6CC); @@ -377,7 +377,7 @@ void func_809FE638(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FE6CC(EnDu* this, GlobalContext* globalCtx) { +void func_809FE6CC(EnDu* this, PlayState* play) { s16 phi_v1; if (this->unk_1E2 == 0) { @@ -388,21 +388,21 @@ void func_809FE6CC(EnDu* this, GlobalContext* globalCtx) { } if (phi_v1 == 0) { this->actor.textId = 0x3039; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1F4.unk_00 = 1; EnDu_SetupAction(this, func_809FE740); } } -void func_809FE740(EnDu* this, GlobalContext* globalCtx) { +void func_809FE740(EnDu* this, PlayState* play) { if (this->unk_1F4.unk_00 == 0) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); this->unk_1E2 = 0x5A; EnDu_SetupAction(this, func_809FE798); } } -void func_809FE798(EnDu* this, GlobalContext* globalCtx) { +void func_809FE798(EnDu* this, PlayState* play) { s32 phi_v0; if (this->unk_1E2 == 0) { @@ -435,22 +435,22 @@ void func_809FE798(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FE890(EnDu* this, GlobalContext* globalCtx) { +void func_809FE890(EnDu* this, PlayState* play) { f32 frame; Vec3f startPos; Vec3f endPos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; CsCmdActorAction* csAction; - if (globalCtx->csCtx.state == CS_STATE_IDLE || gSaveContext.n64ddFlag) { + if (play->csCtx.state == CS_STATE_IDLE || gSaveContext.n64ddFlag) { if (gSaveContext.n64ddFlag) { - globalCtx->csCtx.state = CS_STATE_IDLE; + play->csCtx.state = CS_STATE_IDLE; } - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); EnDu_SetupAction(this, func_809FEB08); return; } - csAction = globalCtx->csCtx.npcActions[2]; + csAction = play->csCtx.npcActions[2]; if (csAction != NULL) { func_809FDFC0(csAction, &startPos); @@ -492,7 +492,7 @@ void func_809FE890(EnDu* this, GlobalContext* globalCtx) { this->actor.shape.rot.z = csAction->urot.z; this->actor.velocity = velocity; - if (globalCtx->csCtx.frames < csAction->endFrame) { + if (play->csCtx.frames < csAction->endFrame) { frame = csAction->endFrame - csAction->startFrame; this->actor.velocity.x = (endPos.x - startPos.x) / frame; @@ -506,22 +506,22 @@ void func_809FE890(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FEB08(EnDu* this, GlobalContext* globalCtx) { +void func_809FEB08(EnDu* this, PlayState* play) { this->blinkTimer = 11; this->unk_1EC = 0; this->unk_1ED = 0; this->unk_1EE = 0; if (this->unk_1E8 == 1) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_1); EnDu_SetupAction(this, func_809FE3C0); return; } if ((!gSaveContext.n64ddFlag && CUR_UPG_VALUE(UPG_STRENGTH) <= 0) || - (gSaveContext.n64ddFlag && !Flags_GetTreasure(globalCtx, 0x1E))) { + (gSaveContext.n64ddFlag && !Flags_GetTreasure(play, 0x1E))) { if (gSaveContext.n64ddFlag) { - Flags_SetTreasure(globalCtx, 0x1E); + Flags_SetTreasure(play, 0x1E); } this->actor.textId = 0x301C; EnDu_SetupAction(this, func_809FEC14); @@ -529,47 +529,47 @@ void func_809FEB08(EnDu* this, GlobalContext* globalCtx) { this->actor.textId = 0x301F; EnDu_SetupAction(this, func_809FE3C0); } - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_14); this->unk_1F4.unk_00 = 1; } -void func_809FEC14(EnDu* this, GlobalContext* globalCtx) { +void func_809FEC14(EnDu* this, PlayState* play) { if (this->unk_1F4.unk_00 == 2) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); EnDu_SetupAction(this, func_809FEC70); - func_809FEC70(this, globalCtx); + func_809FEC70(this, play); } } -void func_809FEC70(EnDu* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809FEC70(EnDu* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnDu_SetupAction(this, func_809FECE4); } else { f32 xzRange = this->actor.xzDistToPlayer + 1.0f; if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_BRACELET, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); + func_8002F434(&this->actor, play, GI_BRACELET, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GC_DARUNIAS_JOY, GI_BRACELET); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); } } } -void func_809FECE4(EnDu* this, GlobalContext* globalCtx) { +void func_809FECE4(EnDu* this, PlayState* play) { if (this->unk_1F4.unk_00 == 3) { this->unk_1F4.unk_00 = 0; EnDu_SetupAction(this, func_809FE3C0); } } -void EnDu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Update(Actor* thisx, PlayState* play) { EnDu* this = (EnDu*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->skelAnime.animation == &gDaruniaDancingEndAnim && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -578,7 +578,7 @@ void EnDu_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); func_809FDE9C(this); - func_809FDE24(this, globalCtx); + func_809FDE24(this, play); if (this->actionFunc == func_809FE890) { this->actor.world.pos.x += this->actor.velocity.x; @@ -588,16 +588,16 @@ void EnDu_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D7EC(&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->actionFunc != func_809FE4A4) { - func_800343CC(globalCtx, &this->actor, &this->unk_1F4.unk_00, this->collider.dim.radius + 116.0f, func_809FDC38, + func_800343CC(play, &this->actor, &this->unk_1F4.unk_00, this->collider.dim.radius + 116.0f, func_809FDC38, func_809FDCDC); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnDu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnDu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnDu* this = (EnDu*)thisx; Vec3s sp1C; @@ -617,7 +617,7 @@ s32 EnDu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnDu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnDu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnDu* this = (EnDu*)thisx; Vec3f D_809FF40C = { 0.0f, -1000.0f, 0.0f }; @@ -626,7 +626,7 @@ void EnDu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnDu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gDaruniaEyeOpenTex, gDaruniaEyeOpeningTex, @@ -645,13 +645,13 @@ void EnDu_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnDu* this = (EnDu*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(noseTextures[this->noseTexIndex])); - func_80034BA0(globalCtx, &this->skelAnime, EnDu_OverrideLimbDraw, EnDu_PostLimbDraw, &this->actor, 255); + func_80034BA0(play, &this->skelAnime, EnDu_OverrideLimbDraw, EnDu_PostLimbDraw, &this->actor, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Du/z_en_du.h b/soh/src/overlays/actors/ovl_En_Du/z_en_du.h index b5045b5ab..c7a3ec69c 100644 --- a/soh/src/overlays/actors/ovl_En_Du/z_en_du.h +++ b/soh/src/overlays/actors/ovl_En_Du/z_en_du.h @@ -6,7 +6,7 @@ struct EnDu; -typedef void (*EnDuActionFunc)(struct EnDu*, GlobalContext*); +typedef void (*EnDuActionFunc)(struct EnDu*, PlayState*); typedef struct EnDu { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index e866ef129..cc58afb91 100644 --- a/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -10,13 +10,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDyExtra_Init(Actor* thisx, PlayState* play); +void EnDyExtra_Destroy(Actor* thisx, PlayState* play); +void EnDyExtra_Update(Actor* thisx, PlayState* play); +void EnDyExtra_Draw(Actor* thisx, PlayState* play); -void EnDyExtra_WaitForTrigger(EnDyExtra* this, GlobalContext* globalCtx); -void EnDyExtra_FallAndKill(EnDyExtra* this, GlobalContext* globalCtx); +void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play); +void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play); const ActorInit En_Dy_Extra_InitVars = { ACTOR_EN_DY_EXTRA, @@ -31,10 +31,10 @@ const ActorInit En_Dy_Extra_InitVars = { NULL, }; -void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Destroy(Actor* thisx, PlayState* play) { } -void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Init(Actor* thisx, PlayState* play) { EnDyExtra* this = (EnDyExtra*)thisx; osSyncPrintf("\n\n"); @@ -51,7 +51,7 @@ void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnDyExtra_WaitForTrigger; } -void EnDyExtra_WaitForTrigger(EnDyExtra* this, GlobalContext* globalCtx) { +void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->actor.world.pos.y < -55.0f) { this->actor.velocity.y = 0.0f; @@ -62,7 +62,7 @@ void EnDyExtra_WaitForTrigger(EnDyExtra* this, GlobalContext* globalCtx) { } } -void EnDyExtra_FallAndKill(EnDyExtra* this, GlobalContext* globalCtx) { +void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->timer == 0 || this->unk_158 < 0.02f) { Actor_Kill(&this->actor); @@ -74,7 +74,7 @@ void EnDyExtra_FallAndKill(EnDyExtra* this, GlobalContext* globalCtx) { } } -void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Update(Actor* thisx, PlayState* play) { EnDyExtra* this = (EnDyExtra*)thisx; if (this->timer != 0) { @@ -84,18 +84,18 @@ void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.y = this->scale.y; this->actor.scale.z = this->scale.z; Audio_PlayActorSound2(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); } -void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Draw(Actor* thisx, PlayState* play) { static Color_RGBA8 primColors[] = { { 255, 255, 170, 255 }, { 255, 255, 170, 255 } }; static Color_RGBA8 envColors[] = { { 255, 100, 255, 255 }, { 100, 255, 255, 255 } }; static u8 D_809FFC50[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02 }; EnDyExtra* this = (EnDyExtra*)thisx; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vtx* vertices = ResourceMgr_LoadVtxByName(SEGMENTED_TO_VIRTUAL(gGreatFairySpiralBeamVtx)); s32 i; u8 unk[3]; @@ -112,12 +112,12 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 2, 0, 0x20, 0x40, 1, - globalCtx->state.frames, globalCtx->state.frames * -8, 0x10, 0x10)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->state.frames * 2, 0, 0x20, 0x40, 1, + play->state.frames, play->state.frames * -8, 0x10, 0x10)); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColors[this->type].r, primColors[this->type].g, primColors[this->type].b, 255); diff --git a/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h b/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h index 4cb282ac6..0a6ce3c3a 100644 --- a/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h +++ b/soh/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h @@ -6,7 +6,7 @@ struct EnDyExtra; -typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, GlobalContext*); +typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, PlayState*); typedef struct EnDyExtra { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.c b/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.c index 8cc0628a5..e950b9db3 100644 --- a/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_4 -void EnEg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEg_Init(Actor* thisx, PlayState* play); +void EnEg_Destroy(Actor* thisx, PlayState* play); +void EnEg_Update(Actor* thisx, PlayState* play); +void EnEg_Draw(Actor* thisx, PlayState* play); -void func_809FFDC8(EnEg* this, GlobalContext* globalCtx); +void func_809FFDC8(EnEg* this, PlayState* play); static s32 voided = false; @@ -39,29 +39,29 @@ void EnEg_PlayVoidOutSFX() { func_800788CC(NA_SE_OC_ABYSS); } -void EnEg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Destroy(Actor* thisx, PlayState* play) { voided = false; } -void EnEg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Init(Actor* thisx, PlayState* play) { EnEg* this = (EnEg*)thisx; this->action = 0; } -void func_809FFDC8(EnEg* this, GlobalContext* globalCtx) { - if (!voided && (gSaveContext.timer2Value < 1) && Flags_GetSwitch(globalCtx, 0x36) && (kREG(0) == 0)) { +void func_809FFDC8(EnEg* this, PlayState* play) { + if (!voided && (gSaveContext.timer2Value < 1) && Flags_GetSwitch(play, 0x36) && (kREG(0) == 0)) { // Void the player out - Gameplay_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP); - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; EnEg_PlayVoidOutSFX(); voided = true; } } -void EnEg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Update(Actor* thisx, PlayState* play) { EnEg* this = (EnEg*)thisx; s32 action = this->action; @@ -69,9 +69,9 @@ void EnEg_Update(Actor* thisx, GlobalContext* globalCtx) { // "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[action](this, globalCtx); + sActionFuncs[action](this, play); } } -void EnEg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Draw(Actor* thisx, PlayState* play) { } diff --git a/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.h b/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.h index 86b3898ce..ad02d8a6b 100644 --- a/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.h +++ b/soh/src/overlays/actors/ovl_En_Eg/z_en_eg.h @@ -6,7 +6,7 @@ struct EnEg; -typedef void (*EnEgActionFunc)(struct EnEg*, GlobalContext*); +typedef void (*EnEgActionFunc)(struct EnEg*, PlayState*); typedef struct EnEg { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c index 408390871..6822ca6b7 100644 --- a/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -3,37 +3,37 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnEiyer_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEiyer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEiyer_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEiyer_Init(Actor* thisx, PlayState* play); +void EnEiyer_Destroy(Actor* thisx, PlayState* play); +void EnEiyer_Update(Actor* thisx, PlayState* play); +void EnEiyer_Draw(Actor* thisx, PlayState* play); void EnEiyer_SetupAppearFromGround(EnEiyer* this); void EnEiyer_SetupUnderground(EnEiyer* this); void EnEiyer_SetupInactive(EnEiyer* this); -void EnEiyer_SetupAmbush(EnEiyer* this, GlobalContext* globalCtx); +void EnEiyer_SetupAmbush(EnEiyer* this, PlayState* play); void EnEiyer_SetupGlide(EnEiyer* this); void EnEiyer_SetupStartAttack(EnEiyer* this); -void EnEiyer_SetupDiveAttack(EnEiyer* this, GlobalContext* globalCtx); +void EnEiyer_SetupDiveAttack(EnEiyer* this, PlayState* play); void EnEiyer_SetupLand(EnEiyer* this); void EnEiyer_SetupHurt(EnEiyer* this); void EnEiyer_SetupDie(EnEiyer* this); void EnEiyer_SetupDead(EnEiyer* this); void EnEiyer_SetupStunned(EnEiyer* this); -void EnEiyer_AppearFromGround(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_WanderUnderground(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_CircleUnderground(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Inactive(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Ambush(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_DiveAttack(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Hurt(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Die(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Dead(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Stunned(EnEiyer* this, GlobalContext* globalCtx); +void EnEiyer_AppearFromGround(EnEiyer* this, PlayState* play); +void EnEiyer_WanderUnderground(EnEiyer* this, PlayState* play); +void EnEiyer_CircleUnderground(EnEiyer* this, PlayState* play); +void EnEiyer_Inactive(EnEiyer* this, PlayState* play); +void EnEiyer_Ambush(EnEiyer* this, PlayState* play); +void EnEiyer_Glide(EnEiyer* this, PlayState* play); +void EnEiyer_StartAttack(EnEiyer* this, PlayState* play); +void EnEiyer_DiveAttack(EnEiyer* this, PlayState* play); +void EnEiyer_Land(EnEiyer* this, PlayState* play); +void EnEiyer_Hurt(EnEiyer* this, PlayState* play); +void EnEiyer_Die(EnEiyer* this, PlayState* play); +void EnEiyer_Dead(EnEiyer* this, PlayState* play); +void EnEiyer_Stunned(EnEiyer* this, PlayState* play); const ActorInit En_Eiyer_InitVars = { ACTOR_EN_EIYER, @@ -116,21 +116,21 @@ static InitChainEntry sInitChain[] = { * params 1-3: Clone, spawn another clone for the main Eiyer if params < 3 * params 10: Normal Eiyer, wander around spawn point */ -void EnEiyer_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Init(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 600.0f, ActorShadow_DrawCircle, 65.0f); - SkelAnime_Init(globalCtx, &this->skelanime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelanime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, 19); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColCylInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (this->actor.params < 3) { // Each clone spawns another clone - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EIYER, this->actor.home.pos.x, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EIYER, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, this->actor.shape.rot.y + 0x4000, 0, this->actor.params + 1) == NULL) { Actor_Kill(&this->actor); @@ -168,9 +168,9 @@ void EnEiyer_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnEiyer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Destroy(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnEiyer_RotateAroundHome(EnEiyer* this) { @@ -227,7 +227,7 @@ void EnEiyer_SetupInactive(EnEiyer* this) { this->actionFunc = EnEiyer_Inactive; } -void EnEiyer_SetupAmbush(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_SetupAmbush(EnEiyer* this, PlayState* play) { this->actor.speedXZ = 0.0f; Animation_PlayOnce(&this->skelanime, &gStingerBackflipAnim); this->collider.info.bumper.dmgFlags = ~0x00300000; @@ -238,7 +238,7 @@ void EnEiyer_SetupAmbush(EnEiyer* this, GlobalContext* globalCtx) { this->actor.shape.shadowScale = 65.0f; this->actor.shape.yOffset = 600.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP); - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 700); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 700); this->actionFunc = EnEiyer_Ambush; } @@ -254,8 +254,8 @@ void EnEiyer_SetupStartAttack(EnEiyer* this) { this->actionFunc = EnEiyer_StartAttack; } -void EnEiyer_SetupDiveAttack(EnEiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEiyer_SetupDiveAttack(EnEiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; this->basePos.y = player->actor.world.pos.y + 15.0f; @@ -325,7 +325,7 @@ void EnEiyer_SetupStunned(EnEiyer* this) { this->actionFunc = EnEiyer_Stunned; } -void EnEiyer_AppearFromGround(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_AppearFromGround(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.75f)) { @@ -333,18 +333,18 @@ void EnEiyer_AppearFromGround(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_CheckPlayerCollision(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_CheckPlayerCollision(EnEiyer* this, PlayState* play) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - EnEiyer_SetupAmbush(this, globalCtx); + EnEiyer_SetupAmbush(this, play); } } -void EnEiyer_CircleUnderground(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_CircleUnderground(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); this->actor.world.rot.y += -0x60; EnEiyer_RotateAroundHome(this); - EnEiyer_CheckPlayerCollision(this, globalCtx); + EnEiyer_CheckPlayerCollision(this, play); // Clones disappear when the main Eiyer leaves the ground if (this->actor.params != 0 && ((EnEiyer*)this->actor.parent)->actionFunc != EnEiyer_CircleUnderground) { @@ -352,7 +352,7 @@ void EnEiyer_CircleUnderground(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_WanderUnderground(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_WanderUnderground(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 100.0f) { @@ -363,10 +363,10 @@ void EnEiyer_WanderUnderground(EnEiyer* this, GlobalContext* globalCtx) { } Math_ScaledStepToS(&this->actor.world.rot.y, this->targetYaw, 0xB6); - EnEiyer_CheckPlayerCollision(this, globalCtx); + EnEiyer_CheckPlayerCollision(this, play); } -void EnEiyer_Inactive(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Inactive(EnEiyer* this, PlayState* play) { EnEiyer* parent; if (this->actor.home.pos.y - 50.0f < this->actor.world.pos.y) { @@ -381,7 +381,7 @@ void EnEiyer_Inactive(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Ambush(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Ambush(EnEiyer* this, PlayState* play) { s32 animFinished; f32 curFrame; f32 xzOffset; @@ -404,12 +404,12 @@ void EnEiyer_Ambush(EnEiyer* this, GlobalContext* globalCtx) { this->collider.base.acFlags |= AC_ON; EnEiyer_SetupGlide(this); } else { - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); } } -void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Glide(EnEiyer* this, PlayState* play) { f32 curFrame; s32 pad; s16 yawChange; @@ -450,8 +450,8 @@ void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_EIER_FLY - SFX_FLAG); } -void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEiyer_StartAttack(EnEiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f focus; SkelAnime_Update(&this->skelanime); @@ -462,7 +462,7 @@ void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx) { focus.z = player->actor.world.pos.z; if (Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &focus), 0x1000)) { - EnEiyer_SetupDiveAttack(this, globalCtx); + EnEiyer_SetupDiveAttack(this, play); } } else { this->actor.shape.rot.x -= 0x1000; @@ -474,7 +474,7 @@ void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_EIER_FLY - SFX_FLAG); } -void EnEiyer_DiveAttack(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_DiveAttack(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); this->actor.speedXZ *= 1.1f; @@ -489,7 +489,7 @@ void EnEiyer_DiveAttack(EnEiyer* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_EIER_FLY - SFX_FLAG); } -void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Land(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ScaledStepToS(&this->actor.world.rot.x, -0x4000, 0x450); Math_StepToF(&this->actor.speedXZ, 7.0f, 1.0f); @@ -497,10 +497,10 @@ void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx) { if (this->timer == -1) { if (this->actor.bgCheckFlags & 8 || this->actor.bgCheckFlags & 1) { this->timer = 10; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_SINK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_SINK); if (this->actor.bgCheckFlags & 1) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 700); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 700); } } } else { @@ -516,7 +516,7 @@ void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Hurt(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Hurt(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->timer != 0) { @@ -545,7 +545,7 @@ void EnEiyer_Hurt(EnEiyer* this, GlobalContext* globalCtx) { this->actor.world.rot.x = -this->actor.shape.rot.x; } -void EnEiyer_Die(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Die(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.speedXZ > 0.0f) { @@ -567,17 +567,17 @@ void EnEiyer_Die(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Dead(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Dead(EnEiyer* this, PlayState* play) { this->actor.shape.shadowAlpha = CLAMP_MIN((s16)(this->actor.shape.shadowAlpha - 5), 0); this->actor.world.pos.y -= 2.0f; if (this->actor.shape.shadowAlpha == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 80); Actor_Kill(&this->actor); } } -void EnEiyer_Stunned(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Stunned(EnEiyer* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -601,14 +601,14 @@ void EnEiyer_Stunned(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_UpdateDamage(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_UpdateDamage(EnEiyer* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, 1); if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_DEAD); this->actor.flags &= ~ACTOR_FLAG_0; } @@ -616,7 +616,7 @@ void EnEiyer_UpdateDamage(EnEiyer* this, GlobalContext* globalCtx) { // If underground, one hit kill if (this->collider.info.bumper.dmgFlags == 0x19) { if (this->actor.colChkInfo.damage == 0) { - EnEiyer_SetupAmbush(this, globalCtx); + EnEiyer_SetupAmbush(this, play); } else { EnEiyer_SetupDie(this); } @@ -635,12 +635,12 @@ void EnEiyer_UpdateDamage(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Update(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; s32 pad; - EnEiyer_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnEiyer_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actor.world.rot.x == 0 || this->actionFunc == EnEiyer_Stunned) { Actor_MoveForward(&this->actor); @@ -651,7 +651,7 @@ void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc == EnEiyer_Glide || this->actionFunc == EnEiyer_DiveAttack || this->actionFunc == EnEiyer_Stunned || this->actionFunc == EnEiyer_Die || this->actionFunc == EnEiyer_Hurt || (this->actionFunc == EnEiyer_Land && this->timer == -1)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 27.0f, 30.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 27.0f, 30.0f, 7); } if (this->actor.params == 0xA || @@ -663,13 +663,13 @@ void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 0 || this->actor.params == 0xA) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnEiyer_Ambush) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -680,7 +680,7 @@ void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnEiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnEiyer_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnEiyer* this = (EnEiyer*)thisx; @@ -694,25 +694,25 @@ s32 EnEiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return 0; } -void EnEiyer_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Draw(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc != EnEiyer_Dead) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, EnEiyer_OverrideLimbDraw, NULL, this, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, D_80116280); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->actor.shape.shadowAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, EnEiyer_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h b/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h index fbd152996..7f756596a 100644 --- a/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h +++ b/soh/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h @@ -6,7 +6,7 @@ struct EnEiyer; -typedef void (*EnEiyerActionFunc)(struct EnEiyer*, GlobalContext*); +typedef void (*EnEiyerActionFunc)(struct EnEiyer*, PlayState*); typedef struct EnEiyer { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c index ff9e37e52..25ce77a30 100644 --- a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -12,47 +12,47 @@ #define FAIRY_FLAG_TIMED (1 << 8) #define FAIRY_FLAG_BIG (1 << 9) -void EnElf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnElf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnElf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80A053F0(Actor* thisx, GlobalContext* globalCtx); -void func_80A052F4(Actor* thisx, GlobalContext* globalCtx); -void func_80A05208(Actor* thisx, GlobalContext* globalCtx); -void func_80A05188(Actor* thisx, GlobalContext* globalCtx); -void func_80A05114(Actor* thisx, GlobalContext* globalCtx); -void func_80A05040(Actor* thisx, GlobalContext* globalCtx); +void EnElf_Init(Actor* thisx, PlayState* play); +void EnElf_Destroy(Actor* thisx, PlayState* play); +void EnElf_Update(Actor* thisx, PlayState* play); +void EnElf_Draw(Actor* thisx, PlayState* play); +void func_80A053F0(Actor* thisx, PlayState* play); +void func_80A052F4(Actor* thisx, PlayState* play); +void func_80A05208(Actor* thisx, PlayState* play); +void func_80A05188(Actor* thisx, PlayState* play); +void func_80A05114(Actor* thisx, PlayState* play); +void func_80A05040(Actor* thisx, PlayState* play); // Navi -void func_80A03CF8(EnElf* this, GlobalContext* globalCtx); +void func_80A03CF8(EnElf* this, PlayState* play); // Healing Fairies -void func_80A0329C(EnElf* this, GlobalContext* globalCtx); -void func_80A03610(EnElf* this, GlobalContext* globalCtx); +void func_80A0329C(EnElf* this, PlayState* play); +void func_80A03610(EnElf* this, PlayState* play); // Healing Fairies Revive From Death -void func_80A03990(EnElf* this, GlobalContext* globalCtx); -void func_80A03814(EnElf* this, GlobalContext* globalCtx); +void func_80A03990(EnElf* this, PlayState* play); +void func_80A03814(EnElf* this, PlayState* play); // Kokiri Fairies -void func_80A0353C(EnElf* this, GlobalContext* globalCtx); +void func_80A0353C(EnElf* this, PlayState* play); // Fairy Spawner -void func_80A03604(EnElf* this, GlobalContext* globalCtx); +void func_80A03604(EnElf* this, PlayState* play); // Move(?) functions -void func_80A0214C(EnElf* this, GlobalContext* globalCtx); -void func_80A02AA4(EnElf* this, GlobalContext* globalCtx); -void func_80A02A20(EnElf* this, GlobalContext* globalCtx); -void func_80A02B38(EnElf* this, GlobalContext* globalCtx); -void func_80A020A4(EnElf* this, GlobalContext* globalCtx); -void func_80A01FE0(EnElf* this, GlobalContext* globalCtx); +void func_80A0214C(EnElf* this, PlayState* play); +void func_80A02AA4(EnElf* this, PlayState* play); +void func_80A02A20(EnElf* this, PlayState* play); +void func_80A02B38(EnElf* this, PlayState* play); +void func_80A020A4(EnElf* this, PlayState* play); +void func_80A01FE0(EnElf* this, PlayState* play); // misc -void func_80A04414(EnElf* this, GlobalContext* globalCtx); -void func_80A0461C(EnElf* this, GlobalContext* globalCtx); -void EnElf_SpawnSparkles(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife); -void EnElf_GetCutsceneNextPos(Vec3f* vec, GlobalContext* globalCtx, s32 action); +void func_80A04414(EnElf* this, PlayState* play); +void func_80A0461C(EnElf* this, PlayState* play); +void EnElf_SpawnSparkles(EnElf* this, PlayState* play, s32 sparkleLife); +void EnElf_GetCutsceneNextPos(Vec3f* vec, PlayState* play, s32 action); const ActorInit En_Elf_InitVars = { ACTOR_EN_ELF, @@ -209,8 +209,8 @@ s32 func_80A01F90(Vec3f* this, Vec3f* arg1, f32 arg2) { return SQ(arg2) < (SQ(arg1->x - this->x) + SQ(arg1->z - this->z)); } -void func_80A01FE0(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A01FE0(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!func_80A01F90(&this->actor.world.pos, &player->actor.world.pos, 30.0f)) { this->unk_2B8 = 0.5f; @@ -229,8 +229,8 @@ void func_80A01FE0(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A020A4(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A020A4(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (func_80A01F90(&this->actor.world.pos, &player->actor.world.pos, 50.0f)) { if (this->unk_2C0 > 0) { @@ -245,7 +245,7 @@ void func_80A020A4(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A0214C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0214C(EnElf* this, PlayState* play) { f32 xzDistToPlayer; if (this->unk_2C0 > 0) { @@ -290,14 +290,14 @@ void func_80A0214C(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A0232C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0232C(EnElf* this, PlayState* play) { if (func_80A01F90(&this->unk_28C, &this->actor.world.pos, 100.0f)) { this->unk_2A8 = 0; this->unk_2AC = 0x200; this->func_2C8 = func_80A0214C; this->unk_2B8 = 1.5f; } else { - this->func_2C8(this, globalCtx); + this->func_2C8(this, play); } } @@ -312,25 +312,25 @@ f32 EnElf_GetColorValue(s32 colorFlag) { } } -void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Init(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 colorConfig; s32 i; Actor_ProcessInitChain(thisx, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gFairySkel, &gFairyAnim, this->jointTable, this->morphTable, 15); + SkelAnime_Init(play, &this->skelAnime, &gFairySkel, &gFairyAnim, this->jointTable, this->morphTable, 15); ActorShape_Init(&thisx->shape, 0.0f, NULL, 15.0f); thisx->shape.shadowAlpha = 0xFF; Lights_PointGlowSetInfo(&this->lightInfoGlow, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 255, 255, 255, 0); - this->lightNodeGlow = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfoGlow); + this->lightNodeGlow = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfoGlow); Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 255, 255, 255, 0); - this->lightNodeNoGlow = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfoNoGlow); + this->lightNodeNoGlow = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfoNoGlow); this->fairyFlags = 0; this->disappearTimer = 600; @@ -385,7 +385,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_28C = thisx->world.pos; this->unk_2BC = Rand_CenteredFloat(32767.0f); this->func_2C8 = func_80A0214C; - func_80A0232C(this, globalCtx); + func_80A0232C(this, play); this->unk_2C0 = 0; this->disappearTimer = 240; break; @@ -399,7 +399,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A01C38(this, 8); for (i = 0; i < 8; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, thisx->world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, thisx->world.pos.x, thisx->world.pos.y - 30.0f, thisx->world.pos.z, 0, 0, 0, FAIRY_HEAL); } break; @@ -431,15 +431,15 @@ void func_80A029A8(EnElf* this, s16 increment) { } } -void EnElf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnElf* this = (EnElf*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNodeGlow); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNodeNoGlow); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNodeGlow); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNodeNoGlow); } -void func_80A02A20(EnElf* this, GlobalContext* globalCtx) { +void func_80A02A20(EnElf* this, PlayState* play) { this->unk_28C.x = Math_SinS(this->unk_2AC) * this->unk_2B8; this->unk_28C.y = Math_SinS(this->unk_2AA) * this->unk_2B4; this->unk_28C.z = Math_CosS(this->unk_2AC) * this->unk_2B8; @@ -447,7 +447,7 @@ void func_80A02A20(EnElf* this, GlobalContext* globalCtx) { this->unk_2AA += this->unk_2AE; } -void func_80A02AA4(EnElf* this, GlobalContext* globalCtx) { +void func_80A02AA4(EnElf* this, PlayState* play) { f32 xzScale; xzScale = (Math_CosS(this->unk_2AA) * this->unk_2B4) + this->unk_2B8; @@ -460,8 +460,8 @@ void func_80A02AA4(EnElf* this, GlobalContext* globalCtx) { this->unk_2AA += this->unk_2AE; } -void func_80A02B38(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A02B38(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_2AA = (this->unk_2AC * 2) & 0xFFFF; this->unk_28C.x = Math_SinS(this->unk_2AC) * this->unk_2B8; @@ -535,9 +535,9 @@ void func_80A02F2C(EnElf* this, Vec3f* targetPos) { Math_StepToF(&this->actor.velocity.y, yVelTarget, 1.5f); } -void func_80A03018(EnElf* this, GlobalContext* globalCtx) { +void func_80A03018(EnElf* this, PlayState* play) { s32 pad[2]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 targetYaw; Vec3f* unk_28C = &this->unk_28C; @@ -596,10 +596,10 @@ void func_80A03148(EnElf* this, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { func_8002D7EC(&this->actor); } -void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { - Player* refActor = GET_PLAYER(globalCtx); +void func_80A0329C(EnElf* this, PlayState* play) { + Player* refActor = GET_PLAYER(play); s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 heightDiff; SkelAnime_Update(&this->skelAnime); @@ -609,21 +609,21 @@ void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { this->unk_2AE = (s16)(Rand_ZeroFloat(1024.0f)) + 0x200; } - func_80A0232C(this, globalCtx); + func_80A0232C(this, play); this->unk_28C.y = player->bodyPartsPos[0].y; func_80A02F2C(this, &this->unk_28C); - func_80A03018(this, globalCtx); + func_80A03018(this, play); if ((this->unk_2A8 == 2) || (this->unk_2A8 == 3)) { - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Actor_Kill(&this->actor); return; } - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { heightDiff = this->actor.world.pos.y - refActor->actor.world.pos.y; if ((heightDiff > 0.0f) && (heightDiff < 60.0f)) { @@ -632,19 +632,19 @@ void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { { if (CVar_GetS32("gFairyPercentRestore", 0)) { - Health_ChangeBy(globalCtx, (gSaveContext.healthCapacity * CVar_GetS32("gFairyHealth", 100) / 100 + 15) / 16 * 16); + Health_ChangeBy(play, (gSaveContext.healthCapacity * CVar_GetS32("gFairyHealth", 100) / 100 + 15) / 16 * 16); } else { - Health_ChangeBy(globalCtx, CVar_GetS32("gFairyHealth", 8) * 16); + Health_ChangeBy(play, CVar_GetS32("gFairyHealth", 8) * 16); } } else { - Health_ChangeBy(globalCtx, 128); + Health_ChangeBy(play, 128); } if (this->fairyFlags & FAIRY_FLAG_BIG) { - Magic_Fill(globalCtx); + Magic_Fill(play); } this->unk_2B8 = 50.0f; this->unk_2AC = refActor->actor.shape.rot.y; @@ -674,17 +674,17 @@ void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { if (!(this->fairyFlags & FAIRY_FLAG_BIG)) { // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 80.0f, 60.0f); + func_8002F434(&this->actor, play, GI_MAX, 80.0f, 60.0f); } } } -void func_80A0353C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0353C(EnElf* this, PlayState* play) { Vec3f parentPos; Actor* parent; SkelAnime_Update(&this->skelAnime); - func_80A02A20(this, globalCtx); + func_80A02A20(this, play); parent = this->actor.parent; if ((parent != NULL) && (parent->update != NULL)) { @@ -698,11 +698,11 @@ void func_80A0353C(EnElf* this, GlobalContext* globalCtx) { this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); } -void func_80A03604(EnElf* this, GlobalContext* globalCtx) { +void func_80A03604(EnElf* this, PlayState* play) { } -void func_80A03610(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A03610(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->unk_2B8, 30.0f, 0.1f, 4.0f, 1.0f); @@ -740,12 +740,12 @@ void func_80A03610(EnElf* this, GlobalContext* globalCtx) { } this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); - EnElf_SpawnSparkles(this, globalCtx, 32); + EnElf_SpawnSparkles(this, play, 32); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_80A03814(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A03814(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -775,12 +775,12 @@ void func_80A03814(EnElf* this, GlobalContext* globalCtx) { this->unk_2AC += this->unk_2B0; func_80A02E30(this, &player->bodyPartsPos[0]); this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); - EnElf_SpawnSparkles(this, globalCtx, 32); + EnElf_SpawnSparkles(this, play, 32); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_80A03990(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A03990(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -800,13 +800,13 @@ void func_80A03990(EnElf* this, GlobalContext* globalCtx) { func_80A02E30(this, &player->bodyPartsPos[0]); Actor_SetScale(&this->actor, (1.0f - (SQ(this->unk_2B4) * SQ(1.0f / 9.0f))) * 0.008f); this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); - EnElf_SpawnSparkles(this, globalCtx, 32); + EnElf_SpawnSparkles(this, play, 32); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_80A03AB0(EnElf* this, GlobalContext* globalCtx) { +void func_80A03AB0(EnElf* this, PlayState* play) { if (this->fairyFlags & 4) { - func_80A04414(this, globalCtx); + func_80A04414(this, play); } SkelAnime_Update(&this->skelAnime); @@ -815,10 +815,10 @@ void func_80A03AB0(EnElf* this, GlobalContext* globalCtx) { ASSERT(this->func_2C8 == NULL); } - this->func_2C8(this, globalCtx); + this->func_2C8(this, play); } -void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { +void EnElf_UpdateLights(EnElf* this, PlayState* play) { s16 glowLightRadius; Player* player; @@ -829,7 +829,7 @@ void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { } if (this->fairyFlags & 0x20) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, player->actor.world.pos.x, (s16)(player->actor.world.pos.y) + 60.0f, player->actor.world.pos.z, 255, 255, 255, 200); @@ -846,24 +846,24 @@ void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); } -void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { +void func_80A03CF8(EnElf* this, PlayState* play) { Vec3f nextPos; Vec3f prevPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* arrowPointedActor; f32 xScale; f32 distFromLinksHead; - func_80A0461C(this, globalCtx); - func_80A03AB0(this, globalCtx); + func_80A0461C(this, play); + func_80A03AB0(this, play); xScale = 0.0f; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[8] != NULL)) { - EnElf_GetCutsceneNextPos(&nextPos, globalCtx, 8); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[8] != NULL)) { + EnElf_GetCutsceneNextPos(&nextPos, play, 8); - if (globalCtx->csCtx.npcActions[8]->action == 5) { - EnElf_SpawnSparkles(this, globalCtx, 16); + if (play->csCtx.npcActions[8]->action == 5) { + EnElf_SpawnSparkles(this, play, 16); } prevPos = this->actor.world.pos; @@ -874,9 +874,9 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { func_80A02C98(this, &nextPos, 0.2f); } - if ((globalCtx->sceneNum == SCENE_LINK_HOME) && (gSaveContext.sceneSetupIndex == 4)) { + if ((play->sceneNum == SCENE_LINK_HOME) && (gSaveContext.sceneSetupIndex == 4)) { // play dash sound as Navi enters Links house in the intro - if (globalCtx->csCtx.frames == 55) { + if (play->csCtx.frames == 55) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_FAIRY_DASH); } @@ -912,7 +912,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { } else { xScale = 0.008f; } - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); break; case 8: func_80A02C98(this, &player->bodyPartsPos[8], 0.2f); @@ -923,7 +923,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { nextPos = player->bodyPartsPos[8]; nextPos.y += 1500.0f * this->actor.scale.y; func_80A02E30(this, &nextPos); - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); if (this->unk_2B8 <= 19.0f) { this->unk_2B8 += 1.0f; @@ -939,21 +939,21 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { } break; case 12: - nextPos = GET_ACTIVE_CAM(globalCtx)->eye; + nextPos = GET_ACTIVE_CAM(play)->eye; nextPos.y += (-2000.0f * this->actor.scale.y); func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); break; default: func_80A029A8(this, 1); - nextPos = globalCtx->actorCtx.targetCtx.naviRefPos; + nextPos = play->actorCtx.targetCtx.naviRefPos; nextPos.y += (1500.0f * this->actor.scale.y); - arrowPointedActor = globalCtx->actorCtx.targetCtx.arrowPointedActor; + arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; if (arrowPointedActor != NULL) { func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); if (this->actor.speedXZ >= 5.0f) { - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } } else { if ((this->timer % 32) == 0) { @@ -966,7 +966,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { } func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } else { if (distFromLinksHead > 100.0f) { this->fairyFlags |= 2; @@ -992,7 +992,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.scale.x, 0.008f, 0.3f, 0.00080000004f, 0.000080000005f); } - EnElf_UpdateLights(this, globalCtx); + EnElf_UpdateLights(this, play); } void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* curColor, f32 rate) { @@ -1009,13 +1009,13 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu dest->a += (rgbaDiff.a * rate); } -void func_80A04414(EnElf* this, GlobalContext* globalCtx) { - Actor* arrowPointedActor = globalCtx->actorCtx.targetCtx.arrowPointedActor; - Player* player = GET_PLAYER(globalCtx); +void func_80A04414(EnElf* this, PlayState* play) { + Actor* arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; + Player* player = GET_PLAYER(play); f32 transitionRate; u16 targetSound; - if (globalCtx->actorCtx.targetCtx.unk_40 != 0.0f) { + if (play->actorCtx.targetCtx.unk_40 != 0.0f) { this->unk_2C6 = 0; this->unk_29C = 1.0f; @@ -1026,18 +1026,18 @@ void func_80A04414(EnElf* this, GlobalContext* globalCtx) { } else { if (this->unk_2C6 == 0) { if ((arrowPointedActor == NULL) || - (Math_Vec3f_DistXYZ(&this->actor.world.pos, &globalCtx->actorCtx.targetCtx.naviRefPos) < 50.0f)) { + (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.naviRefPos) < 50.0f)) { this->unk_2C6 = 1; } } else if (this->unk_29C != 0.0f) { if (Math_StepToF(&this->unk_29C, 0.0f, 0.25f) != 0) { - this->innerColor = globalCtx->actorCtx.targetCtx.naviInner; - this->outerColor = globalCtx->actorCtx.targetCtx.naviOuter; + this->innerColor = play->actorCtx.targetCtx.naviInner; + this->outerColor = play->actorCtx.targetCtx.naviOuter; } else { transitionRate = 0.25f / this->unk_29C; - EnElf_ChangeColor(&this->innerColor, &globalCtx->actorCtx.targetCtx.naviInner, &this->innerColor, + EnElf_ChangeColor(&this->innerColor, &play->actorCtx.targetCtx.naviInner, &this->innerColor, transitionRate); - EnElf_ChangeColor(&this->outerColor, &globalCtx->actorCtx.targetCtx.naviOuter, &this->outerColor, + EnElf_ChangeColor(&this->outerColor, &play->actorCtx.targetCtx.naviOuter, &this->outerColor, transitionRate); } } @@ -1065,14 +1065,14 @@ void func_80A04414(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A0461C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0461C(EnElf* this, PlayState* play) { s32 temp; Actor* arrowPointedActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[8] != NULL) { - switch (globalCtx->csCtx.npcActions[8]->action) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[8] != NULL) { + switch (play->csCtx.npcActions[8]->action) { case 4: temp = 9; break; @@ -1092,9 +1092,9 @@ void func_80A0461C(EnElf* this, GlobalContext* globalCtx) { } } else { - arrowPointedActor = globalCtx->actorCtx.targetCtx.arrowPointedActor; + arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; - if ((player->stateFlags1 & 0x400) || ((YREG(15) & 0x10) && func_800BC56C(globalCtx, 2))) { + if ((player->stateFlags1 & 0x400) || ((YREG(15) & 0x10) && func_800BC56C(play, 2))) { temp = 12; this->unk_2C0 = 100; } else if (arrowPointedActor == NULL || arrowPointedActor->category == ACTORCAT_NPC) { @@ -1187,7 +1187,7 @@ void func_80A0461C(EnElf* this, GlobalContext* globalCtx) { } } -void EnElf_SpawnSparkles(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife) { +void EnElf_SpawnSparkles(EnElf* this, PlayState* play, s32 sparkleLife) { static Vec3f sparkleVelocity = { 0.0f, -0.05f, 0.0f }; static Vec3f sparkleAccel = { 0.0f, -0.025f, 0.0f }; s32 pad; @@ -1207,27 +1207,27 @@ void EnElf_SpawnSparkles(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife) envColor.g = this->outerColor.g; envColor.b = this->outerColor.b; - EffectSsKiraKira_SpawnDispersed(globalCtx, &sparklePos, &sparkleVelocity, &sparkleAccel, &primColor, &envColor, + EffectSsKiraKira_SpawnDispersed(play, &sparklePos, &sparkleVelocity, &sparkleAccel, &primColor, &envColor, 1000, sparkleLife); } -void func_80A04D90(EnElf* this, GlobalContext* globalCtx) { +void func_80A04D90(EnElf* this, PlayState* play) { s32 pad; s32 bgId; - this->actor.floorHeight = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.floorHeight = BgCheck_EntityRaycastFloor5(play, &play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); this->actor.shape.shadowAlpha = 0x32; } // move to talk to player -void func_80A04DE4(EnElf* this, GlobalContext* globalCtx) { +void func_80A04DE4(EnElf* this, PlayState* play) { Vec3f headCopy; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f naviRefPos; if (this->fairyFlags & 0x10) { - naviRefPos = globalCtx->actorCtx.targetCtx.naviRefPos; + naviRefPos = play->actorCtx.targetCtx.naviRefPos; if ((player->unk_664 == NULL) || (&player->actor == player->unk_664) || (&this->actor == player->unk_664)) { naviRefPos.x = player->bodyPartsPos[7].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); @@ -1239,43 +1239,43 @@ void func_80A04DE4(EnElf* this, GlobalContext* globalCtx) { this->fairyFlags &= ~0x10; } - func_80A03AB0(this, globalCtx); + func_80A03AB0(this, play); headCopy = this->actor.focus.pos; func_80A03148(this, &headCopy, 0, 20.0f, 0.2f); if (this->actor.speedXZ >= 5.0f) { - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } Math_SmoothStepToF(&this->actor.scale.x, 0.008f, 0.3f, 0.00080000004f, 0.000080000005f); - EnElf_UpdateLights(this, globalCtx); + EnElf_UpdateLights(this, play); } // move after talking to player -void func_80A04F94(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A04F94(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_2BC, 5, 0x1000, 0x400); this->timer++; Math_StepToF(&this->unk_2A4, 1.0f, 0.05f); - Environment_AdjustLights(globalCtx, SQ(this->unk_2A4), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); + Environment_AdjustLights(play, SQ(this->unk_2A4), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); } // ask to talk to saria again -void func_80A05040(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05040(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes - Message_ContinueTextbox(globalCtx, ElfMessage_GetSariaText(globalCtx)); + Message_ContinueTextbox(play, ElfMessage_GetSariaText(play)); this->actor.update = func_80A05114; break; case 1: // no - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.update = func_80A053F0; func_80A01C38(this, 0); this->fairyFlags &= ~0x20; @@ -1283,57 +1283,57 @@ void func_80A05040(Actor* thisx, GlobalContext* globalCtx) { } } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } -void func_80A05114(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05114(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0xE3); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0xE3); this->actor.update = func_80A05040; } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } -void func_80A05188(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05188(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, ElfMessage_GetSariaText(globalCtx)); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, ElfMessage_GetSariaText(play)); this->actor.update = func_80A05114; } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } // ask to talk to navi -void func_80A05208(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05208(Actor* thisx, PlayState* play) { s32 naviCUpText; EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes - naviCUpText = ElfMessage_GetCUpText(globalCtx); + naviCUpText = ElfMessage_GetCUpText(play); if (naviCUpText != 0) { - Message_ContinueTextbox(globalCtx, naviCUpText); + Message_ContinueTextbox(play, naviCUpText); } else { - Message_ContinueTextbox(globalCtx, 0x15F); + Message_ContinueTextbox(play, 0x15F); } this->actor.update = func_80A052F4; break; case 1: // no - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.update = func_80A053F0; func_80A01C38(this, 0); this->fairyFlags &= ~0x20; @@ -1341,49 +1341,49 @@ void func_80A05208(Actor* thisx, GlobalContext* globalCtx) { } } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } // ask to talk to saria -void func_80A052F4(Actor* thisx, GlobalContext* globalCtx) { +void func_80A052F4(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.unk_E3F2 = 0xFF; + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { + play->msgCtx.unk_E3F2 = 0xFF; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: // yes this->actor.update = func_80A05188; - Message_ContinueTextbox(globalCtx, 0xE2); + Message_ContinueTextbox(play, 0xE2); break; case 1: // no this->actor.update = func_80A05208; - Message_ContinueTextbox(globalCtx, 0xE1); + Message_ContinueTextbox(play, 0xE1); break; } } - } else if (Actor_TextboxIsClosing(thisx, globalCtx)) { + } else if (Actor_TextboxIsClosing(thisx, play)) { this->actor.update = func_80A053F0; func_80A01C38(this, 0); this->fairyFlags &= ~0x20; } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } -void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { +void func_80A053F0(Actor* thisx, PlayState* play) { u8 unk2C7; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnElf* this = (EnElf*)thisx; if (player->naviTextId == 0) { if (player->unk_664 == NULL) { if (((gSaveContext.naviTimer >= 600) && (gSaveContext.naviTimer <= 3000)) || (nREG(89) != 0)) { - player->naviTextId = ElfMessage_GetCUpText(globalCtx); + player->naviTextId = ElfMessage_GetCUpText(play); if (player->naviTextId == 0x15F) { player->naviTextId = 0; @@ -1395,11 +1395,11 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { thisx->flags |= ACTOR_FLAG_16; } - if (Actor_ProcessTalkRequest(thisx, globalCtx)) { + if (Actor_ProcessTalkRequest(thisx, play)) { func_800F4524(&D_801333D4, NA_SE_VO_SK_LAUGH, 0x20); thisx->focus.pos = thisx->world.pos; - if (thisx->textId == ElfMessage_GetCUpText(globalCtx)) { + if (thisx->textId == ElfMessage_GetCUpText(play)) { this->fairyFlags |= 0x80; gSaveContext.naviTimer = 3001; } @@ -1415,7 +1415,7 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { thisx->flags &= ~ACTOR_FLAG_16; } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); thisx->shape.rot.y = this->unk_2BC; nREG(80) = gSaveContext.sceneFlags[127].chest; @@ -1425,7 +1425,7 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { } } - if (!Gameplay_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { if (gSaveContext.naviTimer < 25800) { gSaveContext.naviTimer++; } else if (!(this->fairyFlags & 0x80)) { @@ -1439,7 +1439,7 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_2A4 > 0.0f) { Math_StepToF(&this->unk_2A4, 0.0f, 0.05f); - Environment_AdjustLights(globalCtx, SQ(this->unk_2A4) * this->unk_2A4, player->actor.projectedPos.z + 780.0f, + Environment_AdjustLights(play, SQ(this->unk_2A4) * this->unk_2A4, player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); } @@ -1449,27 +1449,27 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { this->unk_2C7--; } - if ((this->unk_2C7 == 0) && (globalCtx->csCtx.state != CS_STATE_IDLE)) { + if ((this->unk_2C7 == 0) && (play->csCtx.state != CS_STATE_IDLE)) { this->unk_2C7 = 1; } - func_80A04D90(this, globalCtx); + func_80A04D90(this, play); } -void EnElf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Update(Actor* thisx, PlayState* play) { s32 pad; EnElf* this = (EnElf*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.y = this->unk_2BC; this->timer++; if (this->fairyFlags & FAIRY_FLAG_BIG) { - func_80A04D90(this, globalCtx); + func_80A04D90(this, play); } } -s32 EnElf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -1500,22 +1500,22 @@ s32 EnElf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Draw(Actor* thisx, PlayState* play) { s32 pad; f32 alphaScale; s32 envAlpha; EnElf* this = (EnElf*)thisx; s32 pad1; Gfx* dListHead; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk_2A8 != 8) && !(this->fairyFlags & 8)) { if (!(player->stateFlags1 & 0x100000) || (kREG(90) < this->actor.projectedPos.z)) { - dListHead = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Gfx) * 4); + dListHead = Graph_Alloc(play->state.gfxCtx, sizeof(Gfx) * 4); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80094B58(globalCtx->state.gfxCtx); + func_80094B58(play->state.gfxCtx); envAlpha = (this->timer * 50) & 0x1FF; envAlpha = (envAlpha > 255) ? 511 - envAlpha : envAlpha; @@ -1536,18 +1536,18 @@ void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPEndDisplayList(dListHead++); gDPSetEnvColor(POLY_XLU_DISP++, (u8)this->outerColor.r, (u8)this->outerColor.g, (u8)this->outerColor.b, (u8)(envAlpha * alphaScale)); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnElf_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void EnElf_GetCutsceneNextPos(Vec3f* vec, GlobalContext* globalCtx, s32 action) { +void EnElf_GetCutsceneNextPos(Vec3f* vec, PlayState* play, s32 action) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[action]; + CsCmdActorAction* npcAction = play->csCtx.npcActions[action]; f32 lerp; startPos.x = npcAction->startPos.x; @@ -1558,7 +1558,7 @@ void EnElf_GetCutsceneNextPos(Vec3f* vec, GlobalContext* globalCtx, s32 action) endPos.y = npcAction->endPos.y; endPos.z = npcAction->endPos.z; - lerp = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames); + lerp = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames); vec->x = ((endPos.x - startPos.x) * lerp) + startPos.x; vec->y = ((endPos.y - startPos.y) * lerp) + startPos.y; diff --git a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.h b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.h index 1aaa029c7..cc2bfd396 100644 --- a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -7,8 +7,8 @@ struct EnElf; -typedef void (*EnElfActionFunc)(struct EnElf*, GlobalContext*); -typedef void (*EnElfUnkFunc)(struct EnElf*, GlobalContext*); +typedef void (*EnElfActionFunc)(struct EnElf*, PlayState*); +typedef void (*EnElfUnkFunc)(struct EnElf*, PlayState*); typedef struct EnElf { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index fc2f8fe1a..cfd68efcf 100644 --- a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -4,12 +4,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_27) -void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx); +void EnEncount1_Init(Actor* thisx, PlayState* play); +void EnEncount1_Update(Actor* thisx, PlayState* play); -void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx); -void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx); -void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCtx); +void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play); +void EnEncount1_SpawnTektites(EnEncount1* this, PlayState* play); +void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play); static s16 sLeeverAngles[] = { 0x0000, 0x2710, 0x7148, 0x8EB8, 0xD8F0 }; static f32 sLeeverDists[] = { 200.0f, 170.0f, 120.0f, 120.0f, 170.0f }; @@ -27,7 +27,7 @@ const ActorInit En_Encount1_InitVars = { NULL, }; -void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount1_Init(Actor* thisx, PlayState* play) { s32 pad; EnEncount1* this = (EnEncount1*)thisx; f32 spawnRange; @@ -70,7 +70,7 @@ void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { case SPAWNER_LEEVER: this->timer = 30; this->maxCurSpawns = 5; - if (globalCtx->sceneNum == SCENE_SPOT13) { // Haunted Wasteland + if (play->sceneNum == SCENE_SPOT13) { // Haunted Wasteland this->reduceLeevers = true; this->maxCurSpawns = 3; } @@ -82,7 +82,7 @@ void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { break; case SPAWNER_STALCHILDREN: case SPAWNER_WOLFOS: - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field this->maxTotalSpawns = 10000; } this->updateFunc = EnEncount1_SpawnStalchildOrWolfos; @@ -90,8 +90,8 @@ void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 floorType; f32 spawnDist; s32 spawnParams; @@ -106,9 +106,9 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { this->outOfRangeTimer = 0; spawnPos = this->actor.world.pos; - if ((this->timer == 0) && (globalCtx->csCtx.state == CS_STATE_IDLE) && (this->curNumSpawn <= this->maxCurSpawns) && + if ((this->timer == 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->curNumSpawn <= this->maxCurSpawns) && (this->curNumSpawn < 5)) { - floorType = func_80041D4C(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId); + floorType = func_80041D4C(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId); if ((floorType != 4) && (floorType != 7) && (floorType != 12)) { this->numLeeverSpawns = 0; } else if (!(this->reduceLeevers && (this->actor.xzDistToPlayer > 1300.0f))) { @@ -132,13 +132,13 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { spawnPos.y = player->actor.floorHeight + 120.0f; spawnPos.z = player->actor.world.pos.z + Math_CosS(spawnAngle) * spawnDist; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if (floorY <= BGCHECK_Y_MIN) { break; } spawnPos.y = floorY; - leever = (EnReeba*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_REEBA, + leever = (EnReeba*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_REEBA, spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0, spawnParams); if (leever != NULL) { @@ -173,8 +173,8 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { } } -void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount1_SpawnTektites(EnEncount1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 bgId; CollisionPoly* floorPoly; Vec3f spawnPos; @@ -191,12 +191,12 @@ void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { spawnPos.x = this->actor.world.pos.x + Rand_CenteredFloat(50.0f); spawnPos.y = this->actor.world.pos.y + 120.0f; spawnPos.z = this->actor.world.pos.z + Rand_CenteredFloat(50.0f); - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if (floorY <= BGCHECK_Y_MIN) { return; } spawnPos.y = floorY; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TITE, spawnPos.x, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TITE, spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0, TEKTITE_RED) != NULL) { // Red tektite this->curNumSpawn++; this->totalNumSpawn++; @@ -211,8 +211,8 @@ void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { } } -void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 spawnDist; s16 spawnAngle; s16 spawnId; @@ -224,13 +224,13 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt s32 bgId; f32 floorY; - if (globalCtx->sceneNum != SCENE_SPOT00) { + if (play->sceneNum != SCENE_SPOT00) { if ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 100.0f) || (this->actor.xzDistToPlayer > this->spawnRange)) { this->outOfRangeTimer++; return; } - } else if (IS_DAY || (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY)) { + } else if (IS_DAY || (Player_GetMask(play) == PLAYER_MASK_BUNNY)) { this->killCount = 0; return; } @@ -239,7 +239,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt spawnPos = this->actor.world.pos; if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { - if (globalCtx->sceneNum == SCENE_SPOT00) { + if (play->sceneNum == SCENE_SPOT00) { if ((player->unk_89E == 0) || (player->actor.floorBgId != BGCHECK_SCENE) || !(player->actor.bgCheckFlags & 1) || (player->stateFlags1 & 0x08000000)) { @@ -265,7 +265,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt spawnPos.y = player->actor.floorHeight + 120.0f; spawnPos.z = player->actor.world.pos.z + (Math_CosS(spawnAngle) * spawnDist) + Rand_CenteredFloat(40.0f); - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if (floorY <= BGCHECK_Y_MIN) { break; } @@ -291,13 +291,13 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt } this->killCount++; } - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, spawnId, spawnPos.x, spawnPos.y, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, spawnId, spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0, spawnParams) != NULL) { this->curNumSpawn++; if (this->curNumSpawn >= this->maxCurSpawns) { this->fieldSpawnTimer = 100; } - if (globalCtx->sceneNum != SCENE_SPOT00) { + if (play->sceneNum != SCENE_SPOT00) { this->totalNumSpawn++; } } else { @@ -311,7 +311,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt } } -void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount1_Update(Actor* thisx, PlayState* play) { s32 pad; EnEncount1* this = (EnEncount1*)thisx; @@ -319,19 +319,19 @@ void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer--; } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); if (BREG(0) != 0) { if (this->outOfRangeTimer != 0) { if ((this->outOfRangeTimer & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 120, 120, 120, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 120, 120, 120, 255, 4, play->state.gfxCtx); } } else { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 255, 0, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } } } diff --git a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h index 2df4b11b4..efd770f26 100644 --- a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h +++ b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h @@ -9,7 +9,7 @@ struct EnEncount1; -typedef void (*EnEncount1UpdateFunc)(struct EnEncount1*, GlobalContext*); +typedef void (*EnEncount1UpdateFunc)(struct EnEncount1*, PlayState*); typedef struct EnEncount1 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 7543ade93..ca6713870 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -12,16 +12,16 @@ typedef enum { /* 0x2 */ ENCOUNT2_ACTIVE_GANONS_TOWER } Encount2State; -void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEncount2_Init(Actor* thisx, PlayState* play); +void EnEncount2_Update(Actor* thisx, PlayState* play); +void EnEncount2_Draw(Actor* thisx, PlayState* play); -void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx); -void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_Wait(EnEncount2* this, PlayState* play); +void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play); void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale); -void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx); -void EnEncount2_ParticleUpdate(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_ParticleDraw(Actor* thisx, PlayState* play); +void EnEncount2_ParticleUpdate(EnEncount2* this, PlayState* play); const ActorInit En_Encount2_InitVars = { ACTOR_EN_ENCOUNT2, @@ -36,10 +36,10 @@ const ActorInit En_Encount2_InitVars = { NULL, }; -void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Init(Actor* thisx, PlayState* play) { EnEncount2* this = (EnEncount2*)thisx; - if (globalCtx->sceneNum != SCENE_SPOT16) { + if (play->sceneNum != SCENE_SPOT16) { this->isNotDeathMountain = true; } @@ -61,11 +61,11 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnEncount2_Wait; } -void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_Wait(EnEncount2* this, PlayState* play) { s32 pad; s16 quakeIndex; s16 spawnerState; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); spawnerState = ENCOUNT2_INACTIVE; if (!this->isNotDeathMountain) { @@ -74,8 +74,8 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { (player->actor.world.pos.z > -3600.0f)) { spawnerState = ENCOUNT2_ACTIVE_DEATH_MOUNTAIN; } - } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(globalCtx, 0x37))) { - s16 scene = globalCtx->sceneNum; + } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(play, 0x37))) { + s16 scene = play->sceneNum; if (((scene == SCENE_GANON_DEMO) || (scene == SCENE_GANON_FINAL) || (scene == SCENE_GANON_SONOGO) || (scene == SCENE_GANONTIKA_SONOGO)) && @@ -94,7 +94,7 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { break; case ENCOUNT2_ACTIVE_DEATH_MOUNTAIN: if ((this->deathMountainSpawnerTimer == 1) || (!this->isQuaking)) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 50, 0, 0, 0); Quake_SetCountdown(quakeIndex, 300); @@ -115,8 +115,8 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { return; } -void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnFireRock* spawnedRock; f32 tempVec1X; f32 tempVec1Y; @@ -154,8 +154,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EV_VOLCANO - SFX_FLAG); - } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(globalCtx, 0x37) != 0)) { - s16 scene = globalCtx->sceneNum; + } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(play, 0x37) != 0)) { + s16 scene = play->sceneNum; if (((scene == SCENE_GANON_DEMO) || (scene == SCENE_GANON_FINAL) || (scene == SCENE_GANON_SONOGO) || (scene == SCENE_GANONTIKA_SONOGO)) && @@ -166,9 +166,9 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { } if (spawnerState != ENCOUNT2_INACTIVE) { // Direction vector for the direction the camera is facing - tempVec1X = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - tempVec1Y = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - tempVec1Z = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + tempVec1X = play->view.lookAt.x - play->view.eye.x; + tempVec1Y = play->view.lookAt.y - play->view.eye.y; + tempVec1Z = play->view.lookAt.z - play->view.eye.z; // Normalised direction vector for the direction the camera is facing magnitude = sqrtf(SQ(tempVec1X) + SQ(tempVec1Y) + SQ(tempVec1Z)); @@ -177,15 +177,15 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { tempVec2Z = tempVec1Z / magnitude; // Position between 160 and 300 units ahead of camera depending on camera pitch, plus a 400 unit offset in +y - tempVec1X = globalCtx->view.eye.x + (tempVec2X * 300.0f); - tempVec1Y = globalCtx->view.eye.y + (tempVec2Y * 160.0f) + 400.0f; - tempVec1Z = globalCtx->view.eye.z + (tempVec2Z * 300.0f); + tempVec1X = play->view.eye.x + (tempVec2X * 300.0f); + tempVec1Y = play->view.eye.y + (tempVec2Y * 160.0f) + 400.0f; + tempVec1Z = play->view.eye.z + (tempVec2Z * 300.0f); // Position between 160 and 200 units ahead of camera depending on camera pitch, plus a 400 unit offset in +y // (plus some random variation) - particlePos.x = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 200.0f)); + particlePos.x = Rand_CenteredFloat(200.0f) + (play->view.eye.x + (tempVec2X * 200.0f)); particlePos.y = Rand_CenteredFloat(50.0f) + tempVec1Y; - particlePos.z = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.z + (tempVec2Z * 200.0f)); + particlePos.z = Rand_CenteredFloat(200.0f) + (play->view.eye.z + (tempVec2Z * 200.0f)); particleScale = Rand_CenteredFloat(0.005f) + 0.007f; if (spawnerState == ENCOUNT2_ACTIVE_DEATH_MOUNTAIN) { @@ -207,8 +207,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { if (player->linearVelocity != 0.0f) { // rock spawn pos is between 300 and 600 units from the camera depending on the camera yaw. // Rocks will generally spawn closer to the camera in the X axis than in the Z axis. - tempVec2X = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 300.0f)); - tempVec2Z = Rand_CenteredFloat(50.0f) + (globalCtx->view.eye.z + (tempVec2Z * 600.0f)); + tempVec2X = Rand_CenteredFloat(200.0f) + (play->view.eye.x + (tempVec2X * 300.0f)); + tempVec2Z = Rand_CenteredFloat(50.0f) + (play->view.eye.z + (tempVec2Z * 600.0f)); } else { // rock spawn pos X, Z near player tempVec2X = Rand_CenteredFloat(10.0f) + player->actor.world.pos.x; @@ -230,7 +230,7 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { } } spawnedRock = - (EnFireRock*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FIRE_ROCK, + (EnFireRock*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FIRE_ROCK, tempVec2X, tempVec1Y, tempVec2Z, 0, 0, 0, spawnedRockType); if (spawnedRock != NULL) { spawnedRock->spawner = this; @@ -247,9 +247,9 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { } } -void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnEncount2_Update(Actor* thisx, PlayState* play2) { EnEncount2* this = (EnEncount2*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->deathMountainSpawnerTimer != 0) { this->deathMountainSpawnerTimer--; @@ -263,30 +263,30 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->particleSpawnTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - EnEncount2_ParticleUpdate(this, globalCtx); + EnEncount2_ParticleUpdate(this, play); if (!this->isNotDeathMountain) { this->unk_17C = this->envEffectsTimer / 60.0f; this->unk_160 = this->unk_17C * -50.0f; - globalCtx->envCtx.adjAmbientColor[0] = (s16)this->unk_160 * -1.5f; - globalCtx->envCtx.adjAmbientColor[1] = globalCtx->envCtx.adjAmbientColor[2] = this->unk_160; + play->envCtx.adjAmbientColor[0] = (s16)this->unk_160 * -1.5f; + play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] = this->unk_160; this->unk_168 = this->unk_17C * -20.0f; - globalCtx->envCtx.adjLight1Color[0] = (s16)this->unk_168 * -1.5f; - globalCtx->envCtx.adjLight1Color[1] = globalCtx->envCtx.adjLight1Color[2] = this->unk_168; + play->envCtx.adjLight1Color[0] = (s16)this->unk_168 * -1.5f; + play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = this->unk_168; this->unk_170 = this->unk_17C * -50.0f; - globalCtx->envCtx.adjFogNear = this->unk_170; - globalCtx->envCtx.adjFogColor[0] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[0]) * this->unk_17C); - globalCtx->envCtx.adjFogColor[1] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[1]) * this->unk_17C); - globalCtx->envCtx.adjFogColor[2] = (u8)((150.0f - globalCtx->envCtx.lightSettings.fogColor[2]) * this->unk_17C); + play->envCtx.adjFogNear = this->unk_170; + play->envCtx.adjFogColor[0] = (u8)((160.0f - play->envCtx.lightSettings.fogColor[0]) * this->unk_17C); + play->envCtx.adjFogColor[1] = (u8)((160.0f - play->envCtx.lightSettings.fogColor[1]) * this->unk_17C); + play->envCtx.adjFogColor[2] = (u8)((150.0f - play->envCtx.lightSettings.fogColor[2]) * this->unk_17C); } } -void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Draw(Actor* thisx, PlayState* play) { EnEncount2* this = (EnEncount2*)thisx; - EnEncount2_ParticleDraw(&this->actor, globalCtx); + EnEncount2_ParticleDraw(&this->actor, play); } void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale) { @@ -310,10 +310,10 @@ void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale) { } } -void EnEncount2_ParticleUpdate(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_ParticleUpdate(EnEncount2* this, PlayState* play) { s16 i; EnEncount2Particle* particle = this->particles; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f targetPos; for (i = 0; i < ARRAY_COUNT(this->particles); particle++, i++) { @@ -329,7 +329,7 @@ void EnEncount2_ParticleUpdate(EnEncount2* this, GlobalContext* globalCtx) { Math_ApproachF(&particle->pos.z, targetPos.z, 0.3f, 30.0f); Math_ApproachF(&particle->moveDirection.y, -20.0f, 0.9f, 1.0f); - if (globalCtx->sceneNum != SCENE_SPOT16) { + if (play->sceneNum != SCENE_SPOT16) { if (particle->pos.y < (player->actor.floorHeight - 50.0f)) { particle->isAlive = 0; } @@ -340,20 +340,20 @@ void EnEncount2_ParticleUpdate(EnEncount2* this, GlobalContext* globalCtx) { } } -void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_ParticleDraw(Actor* thisx, PlayState* play) { EnEncount2* this = (EnEncount2*)thisx; EnEncount2Particle* particle = this->particles; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; s32 objBankIndex; OPEN_DISPS(gfxCtx); - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_EFC_STAR_FIELD); + objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_EFC_STAR_FIELD); if (objBankIndex >= 0) { gDPPipeSync(POLY_XLU_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment); for (i = 0; i < ARRAY_COUNT(this->particles); particle++, i++) { FrameInterpolation_RecordOpenChild(particle, particle->epoch); @@ -366,7 +366,7 @@ void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(particle->scale, particle->scale, particle->scale, MTXMODE_APPLY); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255); gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); } diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index 8f900ef85..d6f56c1e6 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -6,7 +6,7 @@ struct EnEncount2; -typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, GlobalContext*); +typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, PlayState*); typedef struct { /* 0x0000 */ Vec3f pos; diff --git a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 299346370..69e915610 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -11,26 +11,26 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx); -void EnExItem_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnExItem_Update(Actor* thisx, GlobalContext* globalCtx); -void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnExItem_Init(Actor* thisx, PlayState* play); +void EnExItem_Destroy(Actor* thisx, PlayState* play); +void EnExItem_Update(Actor* thisx, PlayState* play); +void EnExItem_Draw(Actor* thisx, PlayState* play); -void EnExItem_DrawItems(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_DrawHeartPiece(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_DrawRupee(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_DrawKey(EnExItem* this, GlobalContext* globalCtx, s32 index); -void EnExItem_DrawMagic(EnExItem* this, GlobalContext* globalCtx, s16 magicIndex); +void EnExItem_DrawItems(EnExItem* this, PlayState* play); +void EnExItem_DrawHeartPiece(EnExItem* this, PlayState* play); +void EnExItem_DrawRupee(EnExItem* this, PlayState* play); +void EnExItem_DrawKey(EnExItem* this, PlayState* play, s32 index); +void EnExItem_DrawMagic(EnExItem* this, PlayState* play, s16 magicIndex); -void EnExItem_WaitForObject(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_SetupBowlCounter(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_BowlCounter(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_ExitChest(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_FairyMagic(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_TargetPrizeGive(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_TargetPrizeFinish(EnExItem* this, GlobalContext* globalCtx); +void EnExItem_WaitForObject(EnExItem* this, PlayState* play); +void EnExItem_BowlPrize(EnExItem* this, PlayState* play); +void EnExItem_SetupBowlCounter(EnExItem* this, PlayState* play); +void EnExItem_BowlCounter(EnExItem* this, PlayState* play); +void EnExItem_ExitChest(EnExItem* this, PlayState* play); +void EnExItem_FairyMagic(EnExItem* this, PlayState* play); +void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play); +void EnExItem_TargetPrizeGive(EnExItem* this, PlayState* play); +void EnExItem_TargetPrizeFinish(EnExItem* this, PlayState* play); const ActorInit En_Ex_Item_InitVars = { ACTOR_EN_EX_ITEM, @@ -45,10 +45,10 @@ const ActorInit En_Ex_Item_InitVars = { NULL, }; -void EnExItem_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Destroy(Actor* thisx, PlayState* play) { } -void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Init(Actor* thisx, PlayState* play) { s32 pad; EnExItem* this = (EnExItem*)thisx; @@ -104,7 +104,7 @@ void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->getItemObjId >= 0) { - this->objectIdx = Object_GetIndex(&globalCtx->objectCtx, this->getItemObjId); + this->objectIdx = Object_GetIndex(&play->objectCtx, this->getItemObjId); this->actor.draw = NULL; if (this->objectIdx < 0) { Actor_Kill(&this->actor); @@ -118,10 +118,10 @@ void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnExItem_WaitForObject(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_WaitForObject(EnExItem* this, PlayState* play) { s32 onCounter; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectIdx)) { + if (Object_IsLoaded(&play->objectCtx, this->objectIdx)) { // "End of transfer" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); @@ -244,8 +244,8 @@ void EnExItem_WaitForObject(EnExItem* this, GlobalContext* globalCtx) { break; } } else { - if (globalCtx->sceneNum == 16) { - this->giDrawId = GetChestGameRandoGiDrawId(globalCtx->roomCtx.curRoom.num, GID_RUPEE_GREEN, globalCtx); + if (play->sceneNum == 16) { + this->giDrawId = GetChestGameRandoGiDrawId(play->roomCtx.curRoom.num, GID_RUPEE_GREEN, play); } } this->actionFunc = EnExItem_ExitChest; @@ -270,7 +270,7 @@ void EnExItem_WaitForObject(EnExItem* this, GlobalContext* globalCtx) { } } -void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_BowlPrize(EnExItem* this, PlayState* play) { s32 pad; f32 tmpf1; f32 tmpf2; @@ -295,18 +295,18 @@ void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx) { if (this->type == EXITEM_BOMBCHUS_BOWLING) { sp3C = 220.0f; } - tmpf1 = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - tmpf2 = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - tmpf3 = globalCtx->view.lookAt.z + sp3C - globalCtx->view.eye.z; + tmpf1 = play->view.lookAt.x - play->view.eye.x; + tmpf2 = play->view.lookAt.y - play->view.eye.y; + tmpf3 = play->view.lookAt.z + sp3C - play->view.eye.z; tmpf4 = sqrtf(SQ(tmpf1) + SQ(tmpf2) + SQ(tmpf3)); tmpf5 = (tmpf1 / tmpf4) * 5.0f; tmpf6 = (tmpf2 / tmpf4) * 5.0f; tmpf7 = (tmpf3 / tmpf4) * 5.0f; - tmpf1 = globalCtx->view.eye.x + tmpf5 - this->actor.world.pos.x; - tmpf2 = globalCtx->view.eye.y + tmpf6 - this->actor.world.pos.y; - tmpf3 = globalCtx->view.eye.z + tmpf7 - this->actor.world.pos.z; + tmpf1 = play->view.eye.x + tmpf5 - this->actor.world.pos.x; + tmpf2 = play->view.eye.y + tmpf6 - this->actor.world.pos.y; + tmpf3 = play->view.eye.z + tmpf7 - this->actor.world.pos.z; this->actor.world.pos.x += (tmpf1 / tmpf4) * 5.0f; this->actor.world.pos.y += (tmpf2 / tmpf4) * 5.0f; @@ -326,19 +326,19 @@ void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx) { } } -void EnExItem_SetupBowlCounter(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_SetupBowlCounter(EnExItem* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y = 0x4268; this->actionFunc = EnExItem_BowlCounter; } -void EnExItem_BowlCounter(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_BowlCounter(EnExItem* this, PlayState* play) { this->actor.shape.rot.y += 0x800; if (this->killItem) { Actor_Kill(&this->actor); } } -void EnExItem_ExitChest(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_ExitChest(EnExItem* this, PlayState* play) { this->actor.shape.rot.y += 0x1000; if (this->timer != 0) { if (this->timer == 1) { @@ -353,11 +353,11 @@ void EnExItem_ExitChest(EnExItem* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } -void EnExItem_FairyMagic(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_FairyMagic(EnExItem* this, PlayState* play) { this->actor.shape.rot.y += 0x800; } -void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play) { f32 tmpf1; f32 tmpf2; f32 tmpf3; @@ -378,18 +378,18 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) { if (!gSaveContext.n64ddFlag && this->timer != 0) { if (this->prizeRotateTimer != 0) { - tmpf1 = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - tmpf2 = globalCtx->view.lookAt.y - 10.0f - globalCtx->view.eye.y; - tmpf3 = globalCtx->view.lookAt.z + 10.0f - globalCtx->view.eye.z; + tmpf1 = play->view.lookAt.x - play->view.eye.x; + tmpf2 = play->view.lookAt.y - 10.0f - play->view.eye.y; + tmpf3 = play->view.lookAt.z + 10.0f - play->view.eye.z; tmpf4 = sqrtf(SQ(tmpf1) + SQ(tmpf2) + SQ(tmpf3)); tmpf5 = (tmpf1 / tmpf4) * 5.0f; tmpf6 = (tmpf2 / tmpf4) * 5.0f; tmpf7 = (tmpf3 / tmpf4) * 5.0f; - tmpf1 = globalCtx->view.eye.x + tmpf5 - this->actor.world.pos.x; - tmpf2 = globalCtx->view.eye.y - 10.0f + tmpf6 - this->actor.world.pos.y; - tmpf3 = globalCtx->view.eye.z + 10.0f + tmpf7 - this->actor.world.pos.z; + tmpf1 = play->view.eye.x + tmpf5 - this->actor.world.pos.x; + tmpf2 = play->view.eye.y - 10.0f + tmpf6 - this->actor.world.pos.y; + tmpf3 = play->view.eye.z + 10.0f + tmpf7 - this->actor.world.pos.z; this->actor.world.pos.x += (tmpf1 / tmpf4) * 5.0f; this->actor.world.pos.y += (tmpf2 / tmpf4) * 5.0f; @@ -400,10 +400,10 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) { s32 getItemId; this->actor.draw = NULL; - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actor.parent = NULL; if (gSaveContext.n64ddFlag) { - GET_PLAYER(globalCtx)->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); + GET_PLAYER(play)->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50); getItemId = getItemEntry.getItemId; } else { @@ -415,31 +415,31 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) { } if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, getItemId, 2000.0f, 1000.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); } this->actionFunc = EnExItem_TargetPrizeGive; } } -void EnExItem_TargetPrizeGive(EnExItem* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnExItem_TargetPrizeGive(EnExItem* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnExItem_TargetPrizeFinish; } else { if (!gSaveContext.n64ddFlag) { s32 getItemId = (CUR_UPG_VALUE(UPG_BULLET_BAG) == 2) ? GI_BULLET_BAG_50 : GI_BULLET_BAG_40; - func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, getItemId, 2000.0f, 1000.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); } } } -void EnExItem_TargetPrizeFinish(EnExItem* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnExItem_TargetPrizeFinish(EnExItem* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // "Successful completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); gSaveContext.itemGetInf[1] |= 0x2000; @@ -447,7 +447,7 @@ void EnExItem_TargetPrizeFinish(EnExItem* this, GlobalContext* globalCtx) { } } -void EnExItem_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Update(Actor* thisx, PlayState* play) { s32 pad; EnExItem* this = (EnExItem*)thisx; @@ -460,10 +460,10 @@ void EnExItem_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->prizeRotateTimer != 0) { this->prizeRotateTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Draw(Actor* thisx, PlayState* play) { s32 pad; EnExItem* this = (EnExItem*)thisx; s32 magicType; @@ -477,11 +477,11 @@ void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx) { case EXITEM_BOMBCHUS_COUNTER: case EXITEM_BOMBS_COUNTER: case EXITEM_BULLET_BAG: - EnExItem_DrawItems(this, globalCtx); + EnExItem_DrawItems(this, play); break; case EXITEM_HEART_PIECE_BOWLING: case EXITEM_HEART_PIECE_COUNTER: - EnExItem_DrawHeartPiece(this, globalCtx); + EnExItem_DrawHeartPiece(this, play); break; case EXITEM_PURPLE_RUPEE_BOWLING: case EXITEM_PURPLE_RUPEE_COUNTER: @@ -490,26 +490,26 @@ void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx) { case EXITEM_RED_RUPEE_CHEST: case EXITEM_13: case EXITEM_14: - EnExItem_DrawRupee(this, globalCtx); + EnExItem_DrawRupee(this, play); break; case EXITEM_SMALL_KEY_CHEST: - EnExItem_DrawKey(this, globalCtx, 0); + EnExItem_DrawKey(this, play, 0); break; case EXITEM_MAGIC_FIRE: case EXITEM_MAGIC_WIND: case EXITEM_MAGIC_DARK: magicType = this->type - EXITEM_MAGIC_FIRE; - EnExItem_DrawMagic(this, globalCtx, magicType); + EnExItem_DrawMagic(this, play, magicType); break; } } -void EnExItem_DrawItems(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_DrawItems(EnExItem* this, PlayState* play) { if (this->unk_17C != NULL) { - this->unk_17C(&this->actor, globalCtx, 0); + this->unk_17C(&this->actor, play, 0); } if (this) {} - func_8002ED80(&this->actor, globalCtx, 0); + func_8002ED80(&this->actor, play, 0); if (gSaveContext.n64ddFlag) { GetItemEntry randoGetItem = (GetItemEntry)GET_ITEM_NONE; switch (this->type) { @@ -527,55 +527,55 @@ void EnExItem_DrawItems(EnExItem* this, GlobalContext* globalCtx) { } if (randoGetItem.getItemId != GI_NONE) { - EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItem); - GetItemEntry_Draw(globalCtx, randoGetItem); + EnItem00_CustomItemsParticles(&this->actor, play, randoGetItem); + GetItemEntry_Draw(play, randoGetItem); return; } } - GetItem_Draw(globalCtx, this->giDrawId); + GetItem_Draw(play, this->giDrawId); } -void EnExItem_DrawHeartPiece(EnExItem* this, GlobalContext* globalCtx) { - func_8002ED80(&this->actor, globalCtx, 0); +void EnExItem_DrawHeartPiece(EnExItem* this, PlayState* play) { + func_8002ED80(&this->actor, play, 0); if (gSaveContext.n64ddFlag) { GetItemEntry randoGetItem = Randomizer_GetItemFromKnownCheck(RC_MARKET_BOMBCHU_BOWLING_SECOND_PRIZE, GI_HEART_PIECE); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItem); - GetItemEntry_Draw(globalCtx, randoGetItem); + EnItem00_CustomItemsParticles(&this->actor, play, randoGetItem); + GetItemEntry_Draw(play, randoGetItem); } else { - GetItem_Draw(globalCtx, GID_HEART_PIECE); + GetItem_Draw(play, GID_HEART_PIECE); } } -void EnExItem_DrawMagic(EnExItem* this, GlobalContext* globalCtx, s16 magicIndex) { +void EnExItem_DrawMagic(EnExItem* this, PlayState* play, s16 magicIndex) { static s16 giDrawIds[] = { GID_DINS_FIRE, GID_FARORES_WIND, GID_NAYRUS_LOVE }; - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, giDrawIds[magicIndex]); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, giDrawIds[magicIndex]); } -void EnExItem_DrawKey(EnExItem* this, GlobalContext* globalCtx, s32 index) { +void EnExItem_DrawKey(EnExItem* this, PlayState* play, s32 index) { static void* keySegments[] = { gDropKeySmallTex }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8009460C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_8009460C(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, SEGMENTED_TO_VIRTUAL(keySegments[index])); gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnExItem_DrawRupee(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_DrawRupee(EnExItem* this, PlayState* play) { if (this->unk_17C != NULL) { - this->unk_17C(&this->actor, globalCtx, 0); + this->unk_17C(&this->actor, play, 0); } if (this->unk_180 != NULL) { - this->unk_180(&this->actor, globalCtx, 0); + this->unk_180(&this->actor, play, 0); } - GetItem_Draw(globalCtx, this->giDrawId); + GetItem_Draw(play, this->giDrawId); } diff --git a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h index 5dff36859..b8e4d2712 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h +++ b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h @@ -6,8 +6,8 @@ struct EnExItem; -typedef void (*EnExItemActionFunc)(struct EnExItem* this, GlobalContext* globalCtx); -typedef void (*EnExItemLightFunc)(Actor*, GlobalContext*, s32); +typedef void (*EnExItemActionFunc)(struct EnExItem* this, PlayState* play); +typedef void (*EnExItemLightFunc)(Actor*, PlayState*, s32); typedef struct EnExItem { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 8808b27e9..ae7258cbb 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -5,19 +5,19 @@ #define FLAGS ACTOR_FLAG_4 -void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnExRuppy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnExRuppy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnExRuppy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnExRuppy_Init(Actor* thisx, PlayState* play); +void EnExRuppy_Destroy(Actor* thisx, PlayState* play); +void EnExRuppy_Update(Actor* thisx, PlayState* play); +void EnExRuppy_Draw(Actor* thisx, PlayState* play); -void EnExRuppy_DropIntoWater(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_WaitAsCollectible(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_GalleryTarget(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_EnterWater(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_Kill(EnExRuppy* this, GlobalContext* globalCtx); +void EnExRuppy_DropIntoWater(EnExRuppy* this, PlayState* play); +void EnExRuppy_WaitToBlowUp(EnExRuppy* this, PlayState* play); +void EnExRuppy_WaitAsCollectible(EnExRuppy* this, PlayState* play); +void EnExRuppy_GalleryTarget(EnExRuppy* this, PlayState* play); +void EnExRuppy_EnterWater(EnExRuppy* this, PlayState* play); +void EnExRuppy_Sink(EnExRuppy* this, PlayState* play); +void EnExRuppy_WaitInGame(EnExRuppy* this, PlayState* play); +void EnExRuppy_Kill(EnExRuppy* this, PlayState* play); static s16 sEnExRuppyCollectibleTypes[] = { ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_RUPEE_ORANGE, ITEM00_RUPEE_PURPLE, @@ -41,7 +41,7 @@ const ActorInit En_Ex_Ruppy_InitVars = { NULL, }; -void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Init(Actor* thisx, PlayState* play) { EnExRuppy* this = (EnExRuppy*)thisx; EnDivingGame* divingGame; f32 temp1; @@ -199,10 +199,10 @@ void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnExRuppy_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Destroy(Actor* thisx, PlayState* play) { } -void EnExRuppy_SpawnSparkles(EnExRuppy* this, GlobalContext* globalCtx, s16 numSparkles, s32 movementType) { +void EnExRuppy_SpawnSparkles(EnExRuppy* this, PlayState* play, s16 numSparkles, s32 movementType) { static Vec3f velocities[] = { { 0.0f, 0.1f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; static Vec3f accelerations[] = { { 0.0f, 0.01f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; Vec3f pos; @@ -239,16 +239,16 @@ void EnExRuppy_SpawnSparkles(EnExRuppy* this, GlobalContext* globalCtx, s16 numS pos.x = (Rand_ZeroOne() - 0.5f) * 10.0f + this->actor.world.pos.x; pos.y = (Rand_ZeroOne() - 0.5f) * 10.0f + (this->actor.world.pos.y + this->unk_160 * 600.0f); pos.z = (Rand_ZeroOne() - 0.5f) * 10.0f + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, life); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, scale, life); } } -void EnExRuppy_DropIntoWater(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_DropIntoWater(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame; this->actor.shape.rot.y += 0x7A8; Math_ApproachF(&this->actor.gravity, -2.0f, 0.3f, 1.0f); - EnExRuppy_SpawnSparkles(this, globalCtx, 2, 0); + EnExRuppy_SpawnSparkles(this, play, 2, 0); func_80078884(NA_SE_EV_RAINBOW_SHOWER - SFX_FLAG); divingGame = (EnDivingGame*)this->actor.parent; if ((divingGame != NULL) && (divingGame->actor.update != NULL) && @@ -262,7 +262,7 @@ void EnExRuppy_DropIntoWater(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_EnterWater(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_EnterWater(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame = (EnDivingGame*)this->actor.parent; f32 temp_f2; @@ -283,7 +283,7 @@ void EnExRuppy_EnterWater(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_Sink(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame; Vec3f pos; s32 pad; @@ -293,7 +293,7 @@ void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) { pos.y += this->actor.yDistToWater; this->actor.velocity.y = -1.0f; this->actor.gravity = -0.2f; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 800); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 0, 800); func_80078914(&this->actor.projectedPos, NA_SE_EV_BOMB_DROP_WATER); this->actionFunc = EnExRuppy_WaitInGame; } @@ -304,7 +304,7 @@ void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_WaitInGame(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame; Vec3f D_80A0B388 = { 0.0f, 0.1f, 0.0f }; Vec3f D_80A0B394 = { 0.0f, 0.0f, 0.0f }; @@ -312,7 +312,7 @@ void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->timer = 10; - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } if (this->actor.parent != NULL) { divingGame = (EnDivingGame*)this->actor.parent; @@ -332,7 +332,7 @@ void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_Kill(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_Kill(EnExRuppy* this, PlayState* play) { this->invisible += 1; this->invisible &= 1; // Net effect is this->invisible = !this->invisible; if (this->timer == 0) { @@ -346,7 +346,7 @@ typedef struct { /* 0x226 */ s16 unk_226; } EnExRuppyParentActor; // Unclear what actor was intended to spawn this. -void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_WaitToBlowUp(EnExRuppy* this, PlayState* play) { EnExRuppyParentActor* parent; Vec3f accel = { 0.0f, 0.1f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -374,25 +374,25 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx) { explosionScale = 20; explosionScaleStep = 6; } - EffectSsBomb2_SpawnLayered(globalCtx, &this->actor.world.pos, &velocity, &accel, explosionScale, + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, explosionScale, explosionScaleStep); - func_8002F71C(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f); + func_8002F71C(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f); Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_Kill(&this->actor); } } -void EnExRuppy_WaitAsCollectible(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_WaitAsCollectible(EnExRuppy* this, PlayState* play) { f32 localConst = 30.0f; if (this->actor.xyzDistToPlayerSq < SQ(localConst)) { func_80078884(NA_SE_SY_GET_RUPY); - Item_DropCollectible(globalCtx, &this->actor.world.pos, (sEnExRuppyCollectibleTypes[this->colorIdx] | 0x8000)); + Item_DropCollectible(play, &this->actor.world.pos, (sEnExRuppyCollectibleTypes[this->colorIdx] | 0x8000)); Actor_Kill(&this->actor); } } -void EnExRuppy_GalleryTarget(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_GalleryTarget(EnExRuppy* this, PlayState* play) { if (CVar_GetS32("gNewDrops", 0) !=0) { if (this->galleryFlag) { Math_ApproachF(&this->actor.shape.yOffset, 35.0f, 0.5f, 200.0f); @@ -408,19 +408,19 @@ void EnExRuppy_GalleryTarget(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Update(Actor* thisx, PlayState* play) { EnExRuppy* this = (EnExRuppy*)thisx; this->actor.shape.rot.y += 1960; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer != 0) { this->timer--; } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1C); } -void EnExRuppy_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Draw(Actor* thisx, PlayState* play) { static void* rupeeTextures[] = { gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeePinkTex, gRupeeOrangeTex, }; @@ -431,23 +431,23 @@ void EnExRuppy_Draw(Actor* thisx, GlobalContext* globalCtx) { EnExRuppy* this = (EnExRuppy*)thisx; if (!this->invisible) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(thisx, globalCtx, 0); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(thisx, play, 0); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (CVar_GetS32("gNewDrops", 0) !=0) { if (this->type == 4 && this->colorIdx >= 3) { //For some reason the red rupee target become purple. //when using new drops it will show as Gold and that wrong it need to be red. this->colorIdx = 2; } - GetItem_Draw(globalCtx, rupeeTexturesNew[this->colorIdx]); + GetItem_Draw(play, rupeeTexturesNew[this->colorIdx]); } else { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(rupeeTextures[this->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h b/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h index 2625aa3b6..07bd80fa9 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h +++ b/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h @@ -6,7 +6,7 @@ struct EnExRuppy; -typedef void (*EnExRuppyActionFunc)(struct EnExRuppy*, GlobalContext*); +typedef void (*EnExRuppyActionFunc)(struct EnExRuppy*, PlayState*); typedef struct EnExRuppy { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 0cc83f4e0..977fc1662 100644 --- a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -14,22 +14,22 @@ #define FLG_COREDEAD (0x4000) #define FLG_COREDONE (0x8000) -void EnFd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Run(EnFd* this, GlobalContext* globalCtx); -void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx); -void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx); -void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx); -void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx); -void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx); +void EnFd_Init(Actor* thisx, PlayState* play); +void EnFd_Destroy(Actor* thisx, PlayState* play); +void EnFd_Update(Actor* thisx, PlayState* play); +void EnFd_Draw(Actor* thisx, PlayState* play); +void EnFd_Run(EnFd* this, PlayState* play); +void EnFd_SpinAndSpawnFire(EnFd* this, PlayState* play); +void EnFd_Reappear(EnFd* this, PlayState* play); +void EnFd_SpinAndGrow(EnFd* this, PlayState* play); +void EnFd_JumpToGround(EnFd* this, PlayState* play); +void EnFd_WaitForCore(EnFd* this, PlayState* play); void EnFd_UpdateFlames(EnFd* this); void EnFd_UpdateDots(EnFd* this); void EnFd_AddEffect(EnFd*, u8, Vec3f*, Vec3f*, Vec3f*, u8, f32, f32); -void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx); -void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx); -void EnFd_Land(EnFd* this, GlobalContext* globalCtx); +void EnFd_DrawDots(EnFd* this, PlayState* play); +void EnFd_DrawFlames(EnFd* this, PlayState* play); +void EnFd_Land(EnFd* this, PlayState* play); const ActorInit En_Fd_InitVars = { ACTOR_EN_FD, @@ -210,12 +210,12 @@ static AnimationInfo sAnimationInfo[] = { { &gFlareDancerTwirlAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -10.0f }, }; -s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) { +s32 EnFd_SpawnCore(EnFd* this, PlayState* play) { if (this->invincibilityTimer != 0) { return false; } - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FW, this->corePos.x, this->corePos.y, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FW, this->corePos.x, this->corePos.y, this->corePos.z, 0, this->actor.shape.rot.y, 0, this->runDir) == NULL) { return false; } @@ -227,7 +227,7 @@ s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) { } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { - func_8002DE04(globalCtx, &this->actor, this->actor.child); + func_8002DE04(play, &this->actor, this->actor.child); } this->coreActive = true; @@ -235,17 +235,17 @@ s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) { return true; } -void EnFd_SpawnChildFire(EnFd* this, GlobalContext* globalCtx, s16 fireCnt, s16 color) { +void EnFd_SpawnChildFire(EnFd* this, PlayState* play, s16 fireCnt, s16 color) { s32 i; for (i = 0; i < fireCnt; i++) { s16 angle = (s16)((((i * 360.0f) / fireCnt) * (0x10000 / 360.0f))) + this->actor.yawTowardsPlayer; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FD_FIRE, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FD_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, angle, 0, (color << 0xF) | i); } } -void EnFd_SpawnDot(EnFd* this, GlobalContext* globalCtx) { +void EnFd_SpawnDot(EnFd* this, PlayState* play) { Vec3f pos = { 0.0f, 0.0f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -264,11 +264,11 @@ void EnFd_SpawnDot(EnFd* this, GlobalContext* globalCtx) { /** * Checks to see if the hammer effect is active, and if it should be applied */ -s32 EnFd_CheckHammer(EnFd* this, GlobalContext* globalCtx) { +s32 EnFd_CheckHammer(EnFd* this, PlayState* play) { if (this->actionFunc == EnFd_Reappear || this->actionFunc == EnFd_SpinAndGrow || this->actionFunc == EnFd_JumpToGround || this->actionFunc == EnFd_WaitForCore) { return false; - } else if (globalCtx->actorCtx.unk_02 != 0 && this->actor.xzDistToPlayer < 300.0f && + } else if (play->actorCtx.unk_02 != 0 && this->actor.xzDistToPlayer < 300.0f && this->actor.yDistToPlayer < 60.0f) { return true; } else { @@ -276,11 +276,11 @@ s32 EnFd_CheckHammer(EnFd* this, GlobalContext* globalCtx) { } } -s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnFd_ColliderCheck(EnFd* this, PlayState* play) { + Player* player = GET_PLAYER(play); ColliderInfo* info; - if (this->collider.base.acFlags & AC_HIT || EnFd_CheckHammer(this, globalCtx)) { + if (this->collider.base.acFlags & AC_HIT || EnFd_CheckHammer(this, play)) { this->collider.base.acFlags &= ~AC_HIT; if (this->invincibilityTimer != 0) { return false; @@ -290,13 +290,13 @@ s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { return false; } - if (!EnFd_SpawnCore(this, globalCtx)) { + if (!EnFd_SpawnCore(this, play)) { return false; } this->invincibilityTimer = 30; this->actor.flags &= ~ACTOR_FLAG_0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_DAMAGE); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return true; } else if (DECR(this->attackTimer) == 0 && this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -309,7 +309,7 @@ s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { } this->attackTimer = 30; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(globalCtx, &this->actor, this->actor.speedXZ + 2.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, this->actor.speedXZ + 2.0f, this->actor.yawTowardsPlayer, 6.0f); } return false; } @@ -319,7 +319,7 @@ s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { * `actor` must be within 400 units of `this`, `actor` must be within +/- 40 degrees facing angle * towards `actor`, and there must not be a collision poly between `this` and `actor` */ -s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) { +s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, PlayState* play) { CollisionPoly* colPoly; s32 bgId; Vec3f colPoint; @@ -338,7 +338,7 @@ s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) { } // check to see if the line between `this` and `actor` does not intersect a collision poly - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &actor->world.pos, &colPoint, &colPoly, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &actor->world.pos, &colPoint, &colPoly, true, false, false, true, &bgId)) { return false; } @@ -346,8 +346,8 @@ s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) { return true; } -Actor* EnFd_FindBomb(EnFd* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +Actor* EnFd_FindBomb(EnFd* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (actor != NULL) { if (actor->params != 0 || actor->parent != NULL) { @@ -360,7 +360,7 @@ Actor* EnFd_FindBomb(EnFd* this, GlobalContext* globalCtx) { continue; } - if (EnFd_CanSeeActor(this, actor, globalCtx) != 1) { + if (EnFd_CanSeeActor(this, actor, play) != 1) { actor = actor->next; continue; } @@ -370,9 +370,9 @@ Actor* EnFd_FindBomb(EnFd* this, GlobalContext* globalCtx) { return NULL; } -Actor* EnFd_FindPotentialTheat(EnFd* this, GlobalContext* globalCtx) { +Actor* EnFd_FindPotentialTheat(EnFd* this, PlayState* play) { Player* player; - Actor* bomb = EnFd_FindBomb(this, globalCtx); + Actor* bomb = EnFd_FindBomb(this, play); if (bomb != NULL) { return bomb; @@ -382,8 +382,8 @@ Actor* EnFd_FindPotentialTheat(EnFd* this, GlobalContext* globalCtx) { return NULL; } - player = GET_PLAYER(globalCtx); - if (!EnFd_CanSeeActor(this, &player->actor, globalCtx)) { + player = GET_PLAYER(play); + if (!EnFd_CanSeeActor(this, &player->actor, play)) { return NULL; } @@ -407,7 +407,7 @@ Vec3f* EnFd_GetPosAdjAroundCircle(Vec3f* dst, EnFd* this, f32 radius, s16 dir) { return dst; } -s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16* runDir) { +s32 EnFd_ShouldStopRunning(EnFd* this, PlayState* play, f32 radius, s16* runDir) { CollisionPoly* poly; s32 bgId; Vec3f colPoint; @@ -421,7 +421,7 @@ s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16 pos.y = this->actor.world.pos.y; pos.z += this->actor.world.pos.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &pos, &colPoint, &poly, true, false, false, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &pos, &colPoint, &poly, true, false, false, true, &bgId)) { *runDir = -*runDir; return true; @@ -437,7 +437,7 @@ s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16 return true; } -void EnFd_Fade(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Fade(EnFd* this, PlayState* play) { if (this->invincibilityTimer != 0) { Math_SmoothStepToF(&this->fadeAlpha, 0.0f, 0.3f, 10.0f, 0.0f); this->actor.shape.shadowAlpha = this->fadeAlpha; @@ -450,13 +450,13 @@ void EnFd_Fade(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Init(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFlareDancerSkel, NULL, this->jointTable, this->morphTable, 27); + SkelAnime_InitFlex(play, &this->skelAnime, &gFlareDancerSkel, NULL, this->jointTable, this->morphTable, 27); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 32.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colSphs); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colSphs); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xF), &sColChkInit); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.flags |= ACTOR_FLAG_24; @@ -468,13 +468,13 @@ void EnFd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnFd_Reappear; } -void EnFd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Destroy(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Reappear(EnFd* this, PlayState* play) { this->actor.world.pos = this->actor.home.pos; this->actor.params = 0; this->actor.shape.shadowAlpha = 0xFF; @@ -486,7 +486,7 @@ void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx) { this->actionFunc = EnFd_SpinAndGrow; } -void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx) { +void EnFd_SpinAndGrow(EnFd* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.velocity.y = 6.0f; this->actor.scale.y = 0.01f; @@ -502,7 +502,7 @@ void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx) { +void EnFd_JumpToGround(EnFd* this, PlayState* play) { if ((this->actor.bgCheckFlags & 1) && !(this->actor.velocity.y > 0.0f)) { this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; @@ -512,7 +512,7 @@ void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_Land(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Land(EnFd* this, PlayState* play) { Vec3f adjPos; Math_SmoothStepToF(&this->skelAnime.playSpeed, 1.0f, 0.1f, 1.0f, 0.0f); @@ -526,7 +526,7 @@ void EnFd_Land(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { +void EnFd_SpinAndSpawnFire(EnFd* this, PlayState* play) { f32 deceleration; f32 tgtSpeed; f32 rotSpeed; @@ -542,10 +542,10 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { if (this->spinTimer == 30 && this->invincibilityTimer == 0) { if (this->actor.xzDistToPlayer > 160.0f) { // orange flames - EnFd_SpawnChildFire(this, globalCtx, 8, 0); + EnFd_SpawnChildFire(this, play, 8, 0); } else { // blue flames - EnFd_SpawnChildFire(this, globalCtx, 8, 1); + EnFd_SpawnChildFire(this, play, 8, 1); } } } else { @@ -567,7 +567,7 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { if (this->actor.shape.rot.y == this->actor.world.rot.y) { this->initYawToInitPos = Math_Vec3f_Yaw(&this->actor.home.pos, &this->actor.world.pos); this->curYawToInitPos = this->runDir < 0 ? 0xFFFF : 0; - this->circlesToComplete = (globalCtx->state.frames & 7) + 2; + this->circlesToComplete = (play->state.frames & 7) + 2; this->spinTimer = Rand_S16Offset(30, 120); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_3); this->actionFunc = EnFd_Run; @@ -580,13 +580,13 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { * the radius being the distance from the initial position to the nearest * threat (bomb or player). */ -void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Run(EnFd* this, PlayState* play) { Actor* potentialThreat; s16 yawToYawTarget; f32 runRadiusTarget; Vec3f adjPos; - if (EnFd_ShouldStopRunning(this, globalCtx, this->runRadius, &this->runDir)) { + if (EnFd_ShouldStopRunning(this, play, this->runRadius, &this->runDir)) { if (this->invincibilityTimer == 0) { this->actor.world.rot.y ^= 0x8000; this->actor.velocity.y = 6.0f; @@ -613,7 +613,7 @@ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { // If there is a bomb out, or if the player exists, set radius to // the distance to that threat, otherwise default to 200. - potentialThreat = EnFd_FindPotentialTheat(this, globalCtx); + potentialThreat = EnFd_FindPotentialTheat(this, play); if ((potentialThreat != NULL) && (this->invincibilityTimer == 0)) { runRadiusTarget = Math_Vec3f_DistXYZ(&this->actor.home.pos, &potentialThreat->world.pos); } else { @@ -635,7 +635,7 @@ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { * It will set FLG_COREDONE when the core has returned to `this`'s initial * position, and FLG_COREDEAD when there is no health left */ -void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx) { +void EnFd_WaitForCore(EnFd* this, PlayState* play) { if (this->spinTimer != 0) { this->spinTimer--; if (this->spinTimer == 0) { @@ -649,7 +649,7 @@ void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Update(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; s32 pad; @@ -660,42 +660,42 @@ void EnFd_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc != EnFd_Reappear) { SkelAnime_Update(&this->skelAnime); - EnFd_SpawnDot(this, globalCtx); + EnFd_SpawnDot(this, play); } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { // has been hookshoted - if (EnFd_SpawnCore(this, globalCtx)) { + if (EnFd_SpawnCore(this, play)) { this->actor.flags &= ~ACTOR_FLAG_0; this->invincibilityTimer = 30; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_DAMAGE); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { this->actor.flags &= ~ACTOR_FLAG_13; } } else if (this->actionFunc != EnFd_WaitForCore) { - EnFd_ColliderCheck(this, globalCtx); + EnFd_ColliderCheck(this, play); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - EnFd_Fade(this, globalCtx); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + EnFd_Fade(this, play); + this->actionFunc(this, play); EnFd_UpdateDots(this); EnFd_UpdateFlames(this); if (this->actionFunc != EnFd_Reappear && this->actionFunc != EnFd_SpinAndGrow && this->actionFunc != EnFd_WaitForCore) { if (this->attackTimer == 0 && this->invincibilityTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc == EnFd_Run) || (this->actionFunc == EnFd_SpinAndSpawnFire)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 EnFd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnFd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { EnFd* this = (EnFd*)thisx; @@ -711,7 +711,7 @@ s32 EnFd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { +void EnFd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnFd* this = (EnFd*)thisx; Vec3f unused0 = { 6800.0f, 0.0f, 0.0f }; Vec3f unused1 = { 6800.0f, 0.0f, 0.0f }; @@ -732,7 +732,7 @@ void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if (limbIndex == 3 || limbIndex == 6 || limbIndex == 7 || limbIndex == 10 || limbIndex == 14 || limbIndex == 15 || limbIndex == 17 || limbIndex == 18 || limbIndex == 20 || limbIndex == 22 || limbIndex == 23 || limbIndex == 24 || limbIndex == 25 || limbIndex == 26) { - if ((globalCtx->state.frames % 2) != 0) { + if ((play->state.frames % 2) != 0) { for (i = 0; i < 1; i++) { Matrix_MultVec3f(&initialPos, &pos); pos.x += (Rand_ZeroOne() - 0.5f) * 20.0f; @@ -749,7 +749,7 @@ void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Collider_UpdateSpheres(limbIndex, &this->collider); } -void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Draw(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; s32 clampedHealth; Color_RGBA8 primColors[] = { @@ -765,16 +765,16 @@ void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) { u32 frames; s32 pad; - frames = globalCtx->state.frames; + frames = play->state.frames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - EnFd_DrawDots(this, globalCtx); - EnFd_DrawFlames(this, globalCtx); + EnFd_DrawDots(this, play); + EnFd_DrawFlames(this, play); Matrix_Pop(); if (this->actionFunc != EnFd_Reappear && !(this->fadeAlpha < 0.9f)) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth / 8].r, primColors[clampedHealth / 8].g, primColors[clampedHealth / 8].b, (u8)this->fadeAlpha); @@ -782,15 +782,15 @@ void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) { envColors[clampedHealth / 8].b, (u8)this->fadeAlpha); gSPSegment( POLY_XLU_DISP++, 0x8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0xFF - (u8)(frames * 6), 8, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0xFF - (u8)(frames * 6), 8, 0x40)); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x9, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFd_OverrideLimbDraw, EnFd_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnFd_AddEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 timer, f32 scale, @@ -874,7 +874,7 @@ void EnFd_UpdateDots(EnFd* this) { } } -void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { +void EnFd_DrawFlames(EnFd* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; @@ -883,9 +883,9 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { s16 idx; EnFdEffect* eff = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); firstDone = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { if (eff->type == FD_EFFECT_FLAME) { FrameInterpolation_RecordOpenChild(eff, eff->epoch); @@ -899,9 +899,9 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (u8)((this->fadeAlpha / 255.0f) * 255)); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = eff->timer * (8.0f / eff->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); @@ -911,25 +911,25 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { +void EnFd_DrawDots(EnFd* this, PlayState* play) { s16 i; s16 firstDone; EnFdEffect* eff = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); firstDone = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { if (eff->type == FD_EFFECT_DOT) { FrameInterpolation_RecordOpenChild(eff, eff->epoch); if (!firstDone) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_79F8); firstDone = true; } @@ -937,9 +937,9 @@ void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { (u8)(eff->color.a * (this->fadeAlpha / 255.0f))); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerTriangleParticleDL); @@ -947,5 +947,5 @@ void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h index 0ee372369..c141df42e 100644 --- a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h +++ b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h @@ -6,7 +6,7 @@ struct EnFd; -typedef void (*EnFdActionFunc)(struct EnFd* this, GlobalContext* globalCtx); +typedef void (*EnFdActionFunc)(struct EnFd* this, PlayState* play); typedef enum { FD_EFFECT_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index c69f4fb9a..5f4a6524d 100644 --- a/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -3,14 +3,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx); -void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx); -void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx); -void EnFdFire_WaitToDie(EnFdFire* this, GlobalContext* globalCtx); +void EnFdFire_Init(Actor* thisx, PlayState* play); +void EnFdFire_Destroy(Actor* thisx, PlayState* play); +void EnFdFire_Update(Actor* thisx, PlayState* play); +void EnFdFire_Draw(Actor* thisx, PlayState* play); +void EnFdFire_Disappear(EnFdFire* this, PlayState* play); +void func_80A0E70C(EnFdFire* this, PlayState* play); +void EnFdFire_DanceTowardsPlayer(EnFdFire* this, PlayState* play); +void EnFdFire_WaitToDie(EnFdFire* this, PlayState* play); const ActorInit En_Fd_Fire_InitVars = { ACTOR_EN_FD_FIRE, @@ -103,7 +103,7 @@ void EnFdFire_UpdatePos(EnFdFire* this, Vec3f* targetPos) { } } -s32 EnFdFire_CheckCollider(EnFdFire* this, GlobalContext* globalCtx) { +s32 EnFdFire_CheckCollider(EnFdFire* this, PlayState* play) { if (this->actionFunc == EnFdFire_Disappear) { return false; } @@ -120,14 +120,14 @@ s32 EnFdFire_CheckCollider(EnFdFire* this, GlobalContext* globalCtx) { return false; } -void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Init(Actor* thisx, PlayState* play) { EnFdFire* this = (EnFdFire*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInit); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.gravity = -0.6f; @@ -139,13 +139,13 @@ void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A0E70C; } -void EnFdFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Destroy(Actor* thisx, PlayState* play) { EnFdFire* this = (EnFdFire*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx) { +void func_80A0E70C(EnFdFire* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f targetPos = this->actor.parent->world.pos; @@ -166,21 +166,21 @@ void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx) { } } -void EnFdFire_WaitToDie(EnFdFire* this, GlobalContext* globalCtx) { +void EnFdFire_WaitToDie(EnFdFire* this, PlayState* play) { if (DECR(this->deathTimer) == 0) { this->actionFunc = EnFdFire_Disappear; } } -void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFdFire_DanceTowardsPlayer(EnFdFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 angles[] = { 0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f, }; Vec3f pos; s16 idx; - idx = ((globalCtx->state.frames / 10) + (this->actor.params & 0x7FFF)) % ARRAY_COUNT(angles); + idx = ((play->state.frames / 10) + (this->actor.params & 0x7FFF)) % ARRAY_COUNT(angles); pos = player->actor.world.pos; pos.x += 120.0f * sinf(angles[idx]); pos.z += 120.0f * cosf(angles[idx]); @@ -197,7 +197,7 @@ void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx) { } } -void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx) { +void EnFdFire_Disappear(EnFdFire* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.6f, 9.0f, 0.0f); func_8002D868(&this->actor); Math_SmoothStepToF(&this->scale, 0.0f, 0.3f, 0.1f, 0.0f); @@ -208,28 +208,28 @@ void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx) { } } -void EnFdFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Update(Actor* thisx, PlayState* play) { EnFdFire* this = (EnFdFire*)thisx; s32 pad; if (this->actionFunc != EnFdFire_Disappear) { - if ((this->actor.parent->update == NULL) || EnFdFire_CheckCollider(this, globalCtx)) { + if ((this->actor.parent->update == NULL) || EnFdFire_CheckCollider(this, play)) { this->actionFunc = EnFdFire_Disappear; } } func_8002D7EC(&this->actor); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f, 10.0f, 0.0f, 5); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 10.0f, 0.0f, 5); if (this->actionFunc != EnFdFire_Disappear) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Draw(Actor* thisx, PlayState* play) { Color_RGBA8 primColors[] = { { 255, 255, 0, 255 }, { 255, 255, 255, 255 }, @@ -247,14 +247,14 @@ void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp84; f32 sp80; - 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); - sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); sp84 = fabsf(Math_CosS(sp8E)); sp88 = Math_SinS(sp8E); sp80 = Math_Vec3f_DistXZ(&scale, &this->actor.velocity) / 1.5f; - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(((sp88 * -10.0f) * sp80) * (M_PI / 180.0f), MTXMODE_APPLY); scale.x = scale.y = scale.z = this->scale * 0.001f; Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); @@ -263,12 +263,12 @@ void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { sp84 = 0.1f; } Matrix_Scale(1.0f, sp84, 1.0f / sp84, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - globalCtx->state.frames * this->tile2Y, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + play->state.frames * this->tile2Y, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, primColors[((this->actor.params & 0x8000) >> 0xF)].r, primColors[((this->actor.params & 0x8000) >> 0xF)].g, primColors[((this->actor.params & 0x8000) >> 0xF)].b, @@ -280,5 +280,5 @@ void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h b/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h index 7de1c53fe..414fdf997 100644 --- a/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h +++ b/soh/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h @@ -6,7 +6,7 @@ struct EnFdFire; -typedef void (*EnFdFireActionFunc)(struct EnFdFire* this, GlobalContext* globalCtx); +typedef void (*EnFdFireActionFunc)(struct EnFdFire* this, PlayState* play); typedef struct EnFdFire { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index 53b0326a5..3e85b72a8 100644 --- a/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -31,18 +31,18 @@ typedef enum { /* 2 */ BALL_IMPACT } BallKillMode; -void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFhgFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFhgFire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFhgFire_Init(Actor* thisx, PlayState* play); +void EnFhgFire_Destroy(Actor* thisx, PlayState* play); +void EnFhgFire_Update(Actor* thisx, PlayState* play); +void EnFhgFire_Draw(Actor* thisx, PlayState* play); -void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_LightningTrail(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_PhantomWarp(EnFhgFire* this, GlobalContext* globalCtx); +void EnFhgFire_LightningStrike(EnFhgFire* this, PlayState* play); +void EnFhgFire_LightningTrail(EnFhgFire* this, PlayState* play); +void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play); +void EnFhgFire_LightningBurst(EnFhgFire* this, PlayState* play); +void EnFhgFire_SpearLight(EnFhgFire* this, PlayState* play); +void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play); +void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play); const ActorInit En_Fhg_Fire_InitVars = { 0, @@ -81,16 +81,16 @@ void EnFhgFire_SetUpdate(EnFhgFire* this, EnFhgFireUpdateFunc updateFunc) { this->updateFunc = updateFunc; } -void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Init(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); if ((this->actor.params == FHGFIRE_LIGHTNING_SHOCK) || (this->actor.params == FHGFIRE_LIGHTNING_BURST) || (this->actor.params == FHGFIRE_ENERGY_BALL)) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } this->fwork[FHGFIRE_ALPHA] = 200.0f; Actor_SetScale(&this->actor, 0.0f); @@ -157,28 +157,28 @@ void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.radius = 40; this->collider.dim.height = 50; this->collider.dim.yShift = -25; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 255); } } -void EnFhgFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; if ((this->actor.params == FHGFIRE_LIGHTNING_SHOCK) || (this->actor.params == FHGFIRE_LIGHTNING_BURST) || (this->actor.params == FHGFIRE_ENERGY_BALL)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } if (this->actor.params == FHGFIRE_ENERGY_BALL) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } } -void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { - Camera* camera = Gameplay_GetCamera(globalCtx, 0); +void EnFhgFire_LightningStrike(EnFhgFire* this, PlayState* play) { + Camera* camera = Play_GetCamera(play, 0); s16 i; switch (this->work[FHGFIRE_FIRE_MODE]) { @@ -197,7 +197,7 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { this->work[FHGFIRE_TIMER] = 37; this->actor.world.pos.y -= 200.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 500, 0, 0, FHGFIRE_LIGHTNING_BURST); { @@ -209,11 +209,11 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { sp7C.y = Rand_ZeroFloat(5.0f) + 3.0f; sp7C.z = Rand_CenteredFloat(30.f); sp70.y = -0.2f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp7C, &sp70, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &sp7C, &sp70, (s16)(Rand_ZeroOne() * 100.0f) + 240, FHGFLASH_LIGHTBALL_GREEN); } } - func_80033E88(&this->actor, globalCtx, 4, 10); + func_80033E88(&this->actor, play, 4, 10); } break; @@ -226,13 +226,13 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { s16 randY = (Rand_ZeroOne() < 0.5f) ? 0x1000 : 0; for (i = 0; i < 8; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, (i * 0x2000) + randY, 0x4000, FHGFIRE_LIGHTNING_TRAIL + i); } for (i = 0; i < 8; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, (i * 0x2000) + randY, 0, FHGFIRE_LIGHTNING_SHOCK); } @@ -246,7 +246,7 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->fwork[FHGFIRE_SCALE]); } -void EnFhgFire_LightningTrail(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_LightningTrail(EnFhgFire* this, PlayState* play) { osSyncPrintf("FF MOVE 1\n"); this->actor.shape.rot.x += (s16)(Rand_ZeroOne() * 4000.0f) + 0x4000; @@ -281,8 +281,8 @@ void EnFhgFire_LightningTrail(EnFhgFire* this, GlobalContext* globalCtx) { osSyncPrintf("FF MOVE 2\n"); } -void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f pos; if (this->collider.base.atFlags & AT_HIT) { @@ -293,46 +293,46 @@ void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.5f) { pos = this->actor.world.pos; pos.y -= 20.0f; - EffectSsFhgFlash_SpawnShock(globalCtx, &this->actor, &pos, 200, FHGFLASH_SHOCK_NO_ACTOR); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, 200, FHGFLASH_SHOCK_NO_ACTOR); } Actor_MoveForward(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); if (player->invincibilityTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 1); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 1); if (this->actor.bgCheckFlags & 8) { Actor_Kill(&this->actor); } } -void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFhgFire_LightningBurst(EnFhgFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; this->actor.shape.rot.y += 0x1000; if (this->work[FHGFIRE_FX_TIMER] == 49) { - globalCtx->envCtx.unk_BF = 1; - globalCtx->envCtx.unk_D6 = 0xFF; + play->envCtx.unk_BF = 1; + play->envCtx.unk_D6 = 0xFF; } if (this->work[FHGFIRE_FX_TIMER] == 31) { - globalCtx->envCtx.unk_BF = 0x00; - globalCtx->envCtx.unk_D6 = 0x14; + play->envCtx.unk_BF = 0x00; + play->envCtx.unk_D6 = 0x14; } if (this->work[FHGFIRE_FX_TIMER] >= 48) { - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = + play->envCtx.screenFillColor[2] = 255; if ((this->work[FHGFIRE_TIMER] % 2) != 0) { - globalCtx->envCtx.screenFillColor[3] = 70; + play->envCtx.screenFillColor[3] = 70; } else { - globalCtx->envCtx.screenFillColor[3] = 0; + play->envCtx.screenFillColor[3] = 0; } } else { - globalCtx->envCtx.screenFillColor[3] = 0; + play->envCtx.screenFillColor[3] = 0; } if (this->work[FHGFIRE_TIMER] <= 20) { @@ -346,13 +346,13 @@ void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx) { if (this->fwork[FHGFIRE_BURST_SCALE] > 3.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); if (player->invincibilityTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } if (this->work[FHGFIRE_TIMER] == 0) { Actor_Kill(&this->actor); - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; } if (this->lensFlareTimer != 0) { @@ -373,7 +373,7 @@ void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx) { gLensFlareScreenFillAlpha = 0; } -void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_SpearLight(EnFhgFire* this, PlayState* play) { BossGanondrof* bossGnd; s16 i; @@ -402,7 +402,7 @@ void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx) { ballPos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; ballAccel.y = -0.08f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &ballPos, &ballVel, &ballAccel, + EffectSsFhgFlash_SpawnLightBall(play, &ballPos, &ballVel, &ballAccel, (s16)(Rand_ZeroOne() * 80.0f) + 150, FHGFLASH_LIGHTBALL_GREEN); } } @@ -412,7 +412,7 @@ void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx) { } } -void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { f32 dxL; f32 dyL; f32 dzL; @@ -422,7 +422,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { f32 dzPG; u8 killMode = BALL_FIZZLE; u8 canBottleReflect1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->work[FHGFIRE_KILL_TIMER] != 0) { this->work[FHGFIRE_KILL_TIMER]--; @@ -463,7 +463,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { spD4.y = Rand_CenteredFloat(20.0f) + this->actor.world.pos.y; spD4.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; spBC.y = -0.08f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &spD4, &spC8, &spBC, (s16)(Rand_ZeroOne() * 80.0f) + 150, + EffectSsFhgFlash_SpawnLightBall(play, &spD4, &spC8, &spBC, (s16)(Rand_ZeroOne() * 80.0f) + 150, lightBallColor1); } } @@ -488,7 +488,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { spA8.x = Rand_CenteredFloat(20.0f); spA8.y = Rand_CenteredFloat(20.0f); spA8.z = Rand_CenteredFloat(20.0f); - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &spA8, &sp9C, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &spA8, &sp9C, (s16)(Rand_ZeroOne() * 25.0f) + 50, FHGFLASH_LIGHTBALL_GREEN); } canBottleReflect2 = canBottleReflect1; @@ -533,7 +533,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { if ((bossGnd->flyMode >= GND_FLY_VOLLEY) && (this->work[FHGFIRE_RETURN_COUNT] >= 2)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_LAUGH); } - func_8002F698(globalCtx, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 3, 0x10); + func_8002F698(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 3, 0x10); } break; case FHGFIRE_LIGHT_BLUE: @@ -572,7 +572,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { sp88.x = Rand_CenteredFloat(20.0f); sp88.y = Rand_CenteredFloat(20.0f); sp88.z = Rand_CenteredFloat(20.0f); - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp88, &sp7C, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &sp88, &sp7C, (s16)(Rand_ZeroOne() * 40.0f) + 80, FHGFLASH_LIGHTBALL_GREEN); } this->actor.world.rot.y = Math_FAtan2F(dxL, dzL) * (0x8000 / M_PI); @@ -588,7 +588,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { osSyncPrintf("F_FIRE_MODE %d\n", this->work[FHGFIRE_FIRE_MODE]); osSyncPrintf("fly_mode %d\n", bossGnd->flyMode); if (this->work[FHGFIRE_FX_TIMER] == 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 7); if ((this->actor.bgCheckFlags & 0x19) || killMode) { u8 lightBallColor2 = FHGFLASH_LIGHTBALL_GREEN; s16 i4; @@ -603,11 +603,11 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { sp6C.y = Rand_CenteredFloat(20.0f); sp6C.z = Rand_CenteredFloat(20.0f); sp60.y = -0.1f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp6C, &sp60, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &sp6C, &sp60, (s16)(Rand_ZeroOne() * 50.0f) + 100, lightBallColor2); } if (killMode == BALL_BURST) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, player->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0xC8, 0, 0, FHGFIRE_LIGHTNING_BURST); } @@ -621,7 +621,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { } else { Collider_UpdateCylinder(&this->actor, &this->collider); osSyncPrintf("BEFORE setAC %d\n", this->collider.base.shape); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); osSyncPrintf("AFTER setAC\n"); } } @@ -636,7 +636,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { } } -void EnFhgFire_PhantomWarp(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { EnfHG* horse = (EnfHG*)this->actor.parent; f32 scrollDirection; @@ -676,7 +676,7 @@ void EnFhgFire_PhantomWarp(EnFhgFire* this, GlobalContext* globalCtx) { osSyncPrintf("EFC 2\n"); } -void EnFhgFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Update(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; @@ -689,31 +689,31 @@ void EnFhgFire_Update(Actor* thisx, GlobalContext* globalCtx) { this->work[FHGFIRE_FX_TIMER]--; } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); } static void* sDustTextures[] = { gDust1Tex, gDust2Tex, gDust3Tex, gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, }; -void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actor.params == FHGFIRE_LIGHTNING_BURST) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 165, 255, 75, 0); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gPhantomLightningBlastDL)); } else if ((this->actor.params == FHGFIRE_SPEAR_LIGHT) || (this->actor.params == FHGFIRE_ENERGY_BALL)) { osSyncPrintf("yari hikari draw 1\n"); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - func_80093D84(globalCtx->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); if (this->work[FHGFIRE_FIRE_MODE] > FHGFIRE_LIGHT_GREEN) { @@ -723,19 +723,19 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { } gDPPipeSync(POLY_XLU_DISP++); Matrix_RotateZ((this->actor.shape.rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPhantomEnergyBallDL); } else if ((this->actor.params == FHGFIRE_WARP_EMERGE) || (this->actor.params == FHGFIRE_WARP_RETREAT) || (this->actor.params == FHGFIRE_WARP_DEATH)) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (u8)this->fwork[FHGFIRE_WARP_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 90, 50, 95, (s8)(this->fwork[FHGFIRE_WARP_ALPHA] * 0.5f)); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, (s16)this->fwork[FHGFIRE_WARP_TEX_1_X], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->fwork[FHGFIRE_WARP_TEX_1_X], (s16)this->fwork[FHGFIRE_WARP_TEX_1_Y], 0x40, 0x40, 1, (s16)this->fwork[FHGFIRE_WARP_TEX_2_X], (s16)this->fwork[FHGFIRE_WARP_TEX_2_Y], 0x40, 0x40)); @@ -743,15 +743,15 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { } else { osSyncPrintf("FF DRAW 1\n"); Matrix_Translate(0.0f, -100.0f, 0.0f, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 30, 0); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPhantomLightningDL); osSyncPrintf("FF DRAW 2\n"); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h b/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h index 8bc564a3f..2f4377077 100644 --- a/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h +++ b/soh/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h @@ -6,7 +6,7 @@ struct EnFhgFire; -typedef void (*EnFhgFireUpdateFunc)(struct EnFhgFire*, GlobalContext*); +typedef void (*EnFhgFireUpdateFunc)(struct EnFhgFire*, PlayState*); typedef enum { /* 1 */ FHGFIRE_LIGHTNING_STRIKE = 1, diff --git a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 683f0c44e..1f8a42059 100644 --- a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -5,15 +5,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFireRock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFireRock_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFireRock_Init(Actor* thisx, PlayState* play); +void EnFireRock_Destroy(Actor* thisx, PlayState* play); +void EnFireRock_Update(Actor* thisx, PlayState* play); +void EnFireRock_Draw(Actor* thisx, PlayState* play); -void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, GlobalContext* globalCtx); -void FireRock_WaitOnFloor(EnFireRock* this, GlobalContext* globalCtx); -void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx); -void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx); +void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, PlayState* play); +void FireRock_WaitOnFloor(EnFireRock* this, PlayState* play); +void EnFireRock_Fall(EnFireRock* this, PlayState* play); +void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, PlayState* play); const ActorInit En_Fire_Rock_InitVars = { ACTOR_EN_FIRE_ROCK, @@ -68,9 +68,9 @@ static ColliderCylinderInit D_80A12CCC = { { 30, 30, -10, { 0, 0, 0 } }, }; -void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { - GlobalContext* globalCtx2 = globalCtx; - Player* player = GET_PLAYER(globalCtx); +void EnFireRock_Init(Actor* thisx, PlayState* play) { + PlayState* play2 = play; + Player* player = GET_PLAYER(play); EnFireRock* this = (EnFireRock*)thisx; s16 temp; @@ -92,14 +92,14 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { break; case FIRE_ROCK_ON_FLOOR: Actor_SetScale(&this->actor, 0.03f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80A12CCC); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80A12CCC); // "☆☆☆☆☆ floor rock ☆☆☆☆☆" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 床岩 ☆☆☆☆☆ \n" VT_RST); this->collider.dim.radius = 23; this->collider.dim.height = 37; this->collider.dim.yShift = -10; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actionFunc = FireRock_WaitOnFloor; break; @@ -110,8 +110,8 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { case FIRE_ROCK_SPAWNED_FALLING2: // spawned by encount2 and by the ceilling spawner this->scale = (Rand_ZeroFloat(2.0f) / 100.0f) + 0.02f; Actor_SetScale(&this->actor, this->scale); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80A12CA0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80A12CA0); this->actor.world.rot.y = this->actor.shape.rot.y = Rand_CenteredFloat(65535.0f); this->actionFunc = EnFireRock_Fall; this->actor.shape.shadowScale = 15.0f; @@ -122,8 +122,8 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = (Rand_ZeroFloat(1.0f) / 100.0f) + 0.02f; Actor_SetScale(&this->actor, this->scale); this->actor.gravity = -1.5f; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80A12CA0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80A12CA0); this->actor.shape.shadowScale = 10.0f; this->actor.world.rot.y = this->actor.shape.rot.y = Rand_CenteredFloat(65535.0f); this->actionFunc = EnFireRock_Fall; @@ -146,7 +146,7 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFireRock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Destroy(Actor* thisx, PlayState* play) { EnFireRock* this = (EnFireRock*)thisx; if ((this->actor.parent != NULL) && (this->actor.parent == &this->spawner->actor)) { @@ -159,15 +159,15 @@ void EnFireRock_Destroy(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); } } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { +void EnFireRock_Fall(EnFireRock* this, PlayState* play) { Player* player; Vec3f flamePos; s32 i; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((this->actor.floorHeight == -10000.0f) || (this->actor.world.pos.y < (player->actor.world.pos.y - 200.0f))) { Actor_Kill(&this->actor); return; @@ -185,10 +185,10 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { flamePos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; flamePos.y = Rand_CenteredFloat(20.0f) + this->actor.world.pos.y; flamePos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 100, 0, 0, -1); break; case FIRE_ROCK_BROKEN_PIECE1: - if ((globalCtx->gameplayFrames & 3) == 0) { + if ((play->gameplayFrames & 3) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_ROCK); } break; @@ -197,22 +197,22 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { switch (this->type) { case FIRE_ROCK_SPAWNED_FALLING1: case FIRE_ROCK_SPAWNED_FALLING2: - func_80033E88(&this->actor, globalCtx, 5, 2); + func_80033E88(&this->actor, play, 5, 2); case FIRE_ROCK_BROKEN_PIECE1: - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, 500, 10, false); for (i = 0; i < 5; i++) { flamePos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; flamePos.y = this->actor.floorHeight; flamePos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 300, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 300, 0, 0, -1); } this->actionFunc = EnFireRock_SpawnMoreBrokenPieces; break; default: - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 3, 8.0f, 200, 10, false); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); Actor_Kill(&this->actor); break; } @@ -223,7 +223,7 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { * After the rock has already hit the ground and started rolling, spawn two more, giving the illusion of breaking into * two pieces. */ -void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx) { +void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, PlayState* play) { EnFireRock* spawnedFireRock; s32 nextRockType; s32 i; @@ -242,7 +242,7 @@ void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx if (nextRockType != FIRE_ROCK_SPAWNED_FALLING1) { for (i = 0; i < 2; i++) { spawnedFireRock = (EnFireRock*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, + &play->actorCtx, play, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, Rand_CenteredFloat(3.0f) + (this->actor.world.pos.y + 10.0f), Rand_CenteredFloat(3.0f) + this->actor.world.pos.z, 0, 0, 0, nextRockType); if (spawnedFireRock != NULL) { @@ -260,14 +260,14 @@ void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx Actor_Kill(&this->actor); } -void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, GlobalContext* globalCtx) { +void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, PlayState* play) { EnFireRock* spawnedFireRock; if (this->actor.xzDistToPlayer < 200.0f) { if ((this->playerNearby == 0) && (this->timer2 == 0)) { this->timer2 = 30; spawnedFireRock = (EnFireRock*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, + &play->actorCtx, play, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, this->actor.world.pos.y + 10.0f, Rand_CenteredFloat(3.0f) + this->actor.world.pos.z, 0, 0, 0, FIRE_ROCK_SPAWNED_FALLING2); if (spawnedFireRock != NULL) { @@ -283,11 +283,11 @@ void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, GlobalContext* globalC if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0, 255, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } -void FireRock_WaitOnFloor(EnFireRock* this, GlobalContext* globalCtx) { +void FireRock_WaitOnFloor(EnFireRock* this, PlayState* play) { Vec3f flamePos; s16 scale; @@ -297,15 +297,15 @@ void FireRock_WaitOnFloor(EnFireRock* this, GlobalContext* globalCtx) { flamePos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; scale = 130 + (s16)Rand_CenteredFloat(60.0f); this->timer2 = 3 + (s16)Rand_ZeroFloat(3.0f); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, scale, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, scale, 0, 0, -1); } } -void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Update(Actor* thisx, PlayState* play) { EnFireRock* this = (EnFireRock*)thisx; s16 setCollision; - Player* player = GET_PLAYER(globalCtx); - Actor* playerActor = &GET_PLAYER(globalCtx)->actor; + Player* player = GET_PLAYER(play); + Actor* playerActor = &GET_PLAYER(play)->actor; if (this->timer2 != 0) { this->timer2--; @@ -313,7 +313,7 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->type != FIRE_ROCK_CEILING_SPOT_SPAWNER) { f32 temp; @@ -337,7 +337,7 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->type != FIRE_ROCK_ON_FLOOR) { Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 50.0f, 50.0f, 100.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, thisx, 50.0f, 50.0f, 100.0f, 0x1C); } setCollision = false; @@ -363,7 +363,7 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~2; if (this->collider.base.at == playerActor) { if (!(player->stateFlags1 & 0x04000000)) { - func_8002F758(globalCtx, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4); + func_8002F758(play, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4); } return; } @@ -372,28 +372,28 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { } if (setCollision) { Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void EnFireRock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Draw(Actor* thisx, PlayState* play) { EnFireRock* this = (EnFireRock*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(thisx->world.pos.x + this->relativePos.x, thisx->world.pos.y + this->relativePos.y, thisx->world.pos.z + this->relativePos.z, MTXMODE_NEW); Matrix_RotateX(DEG_TO_RAD(this->rockRotation.x), MTXMODE_APPLY); Matrix_RotateY(DEG_TO_RAD(this->rockRotation.y), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(this->rockRotation.z), MTXMODE_APPLY); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255); gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h index 9dd7de61f..3530cecb7 100644 --- a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h +++ b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h @@ -17,7 +17,7 @@ typedef enum { struct EnFireRock; -typedef void (*EnFireRockActionFunc)(struct EnFireRock*, GlobalContext*); +typedef void (*EnFireRockActionFunc)(struct EnFireRock*, PlayState*); typedef struct EnFireRock { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 65f16bc3c..17668ff32 100644 --- a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -10,23 +10,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFirefly_Init(Actor* thisx, PlayState* play); +void EnFirefly_Destroy(Actor* thisx, PlayState* play); +void EnFirefly_Update(Actor* thisx, PlayState* play); +void EnFirefly_Draw(Actor* thisx, PlayState* play); -void EnFirefly_DrawInvisible(Actor* thisx, GlobalContext* globalCtx); +void EnFirefly_DrawInvisible(Actor* thisx, PlayState* play); -void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_FrozenFall(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx); +void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play); +void EnFirefly_Fall(EnFirefly* this, PlayState* play); +void EnFirefly_Die(EnFirefly* this, PlayState* play); +void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play); +void EnFirefly_Rebound(EnFirefly* this, PlayState* play); +void EnFirefly_FlyAway(EnFirefly* this, PlayState* play); +void EnFirefly_Stunned(EnFirefly* this, PlayState* play); +void EnFirefly_FrozenFall(EnFirefly* this, PlayState* play); +void EnFirefly_Perch(EnFirefly* this, PlayState* play); +void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play); typedef enum { /* 0 */ KEESE_AURA_NONE, @@ -137,15 +137,15 @@ void EnFirefly_Ignite(EnFirefly* this) { this->actor.naviEnemyId = 0x11; // Fire Keese } -void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Init(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 28); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if ((this->actor.params & 0x8000) != 0) { @@ -194,10 +194,10 @@ void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; } -void EnFirefly_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Destroy(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnFirefly_SetupFlyIdle(EnFirefly* this) { @@ -257,7 +257,7 @@ void EnFirefly_SetupStunned(EnFirefly* this) { this->actionFunc = EnFirefly_Stunned; } -void EnFirefly_SetupFrozenFall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_SetupFrozenFall(EnFirefly* this, PlayState* play) { s32 i; Vec3f iceParticlePos; @@ -271,7 +271,7 @@ void EnFirefly_SetupFrozenFall(EnFirefly* this, GlobalContext* globalCtx) { iceParticlePos.x = (i & 1 ? 7.0f : -7.0f) + this->actor.world.pos.x; iceParticlePos.y = (i & 2 ? 7.0f : -7.0f) + this->actor.world.pos.y; iceParticlePos.z = (i & 4 ? 7.0f : -7.0f) + this->actor.world.pos.z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.15f) + 0.85f); } @@ -293,8 +293,8 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { this->actionFunc = EnFirefly_DisturbDiveAttack; } -s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnFirefly_ReturnToPerch(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 distFromHome; if (this->actor.params != KEESE_NORMAL_PERCH) { @@ -325,14 +325,14 @@ s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) { return 0; } -s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) { +s32 EnFirefly_SeekTorch(EnFirefly* this, PlayState* play) { ObjSyokudai* findTorch; ObjSyokudai* closestTorch; f32 torchDist; f32 currentMinDist; Vec3f flamePos; - findTorch = (ObjSyokudai*)globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + findTorch = (ObjSyokudai*)play->actorCtx.actorLists[ACTORCAT_PROP].head; closestTorch = NULL; currentMinDist = 35000.0f; @@ -365,7 +365,7 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) { return 0; } -void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { s32 skelanimeUpdated; f32 rand; @@ -376,7 +376,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { skelanimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f; if (this->onFire || (this->actor.params == KEESE_ICE_FLY) || - ((EnFirefly_ReturnToPerch(this, globalCtx) == 0) && (EnFirefly_SeekTorch(this, globalCtx) == 0))) { + ((EnFirefly_ReturnToPerch(this, play) == 0) && (EnFirefly_SeekTorch(this, play) == 0))) { if (skelanimeUpdated) { rand = Rand_ZeroOne(); if (rand < 0.5f) { @@ -410,13 +410,13 @@ 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_SKULL)) { + (Player_GetMask(play) != PLAYER_MASK_SKULL)) { EnFirefly_SetupDiveAttack(this); } } // Fall to the ground after being hit -void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Fall(EnFirefly* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 6.0f)) { this->skelAnime.playSpeed = 0.0f; } @@ -438,20 +438,20 @@ void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx) { } // Hit the ground or burn up, spawn drops -void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Die(EnFirefly* this, PlayState* play) { if (this->timer != 0) { this->timer--; } Math_StepToF(&this->actor.scale.x, 0.0f, 0.00034f); this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; if (this->timer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } -void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f preyPos; SkelAnime_Update(&this->skelAnime); @@ -488,13 +488,13 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { } Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } - if ((this->timer == 0) || (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL)) { + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL)) { EnFirefly_SetupFlyAway(this); } } // Knockback after hitting player -void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Rebound(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); Math_StepToF(&this->actor.velocity.y, 0.0f, 0.4f); @@ -508,7 +508,7 @@ void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -536,7 +536,7 @@ void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } -void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1554, 0x100); @@ -553,7 +553,7 @@ void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_FrozenFall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FrozenFall(EnFirefly* this, PlayState* play) { if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { this->actor.colorFilterTimer = 0; EnFirefly_SetupDie(this); @@ -563,7 +563,7 @@ void EnFirefly_FrozenFall(EnFirefly* this, GlobalContext* globalCtx) { } // When perching, sit on collision and flap at random intervals -void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Perch(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); if (this->timer != 0) { @@ -580,8 +580,8 @@ void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f preyPos; SkelAnime_Update(&this->skelAnime); @@ -606,17 +606,17 @@ void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_Combust(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Combust(EnFirefly* this, PlayState* play) { s32 i; for (i = 0; i <= 2; i++) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 40, 0, 0, i); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0, 0, i); } this->auraType = KEESE_AURA_NONE; } -void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { u8 damageEffect; if (this->collider.base.acFlags & AC_HIT) { @@ -625,7 +625,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } @@ -634,8 +634,8 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { if (damageEffect == 2) { // Din's Fire if (this->actor.params == KEESE_ICE_FLY) { this->actor.colChkInfo.health = 0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - EnFirefly_Combust(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + EnFirefly_Combust(this, play); EnFirefly_SetupFall(this); } else if (!this->onFire) { EnFirefly_Ignite(this); @@ -647,7 +647,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { if (this->actor.params == KEESE_ICE_FLY) { EnFirefly_SetupFall(this); } else { - EnFirefly_SetupFrozenFall(this, globalCtx); + EnFirefly_SetupFrozenFall(this, play); } } else if (damageEffect == 1) { // Deku Nuts if (this->actionFunc != EnFirefly_Stunned) { @@ -655,7 +655,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { } } else { // Fire Arrows if ((damageEffect == 0xF) && (this->actor.params == KEESE_ICE_FLY)) { - EnFirefly_Combust(this, globalCtx); + EnFirefly_Combust(this, play); } EnFirefly_SetupFall(this); } @@ -663,9 +663,9 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnFirefly_Update(Actor* thisx, PlayState* play2) { EnFirefly* this = (EnFirefly*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -678,9 +678,9 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - EnFirefly_UpdateDamage(this, globalCtx); + EnFirefly_UpdateDamage(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->actor.flags & ACTOR_FLAG_15)) { if ((this->actor.colChkInfo.health == 0) || (this->actionFunc == EnFirefly_Stunned)) { @@ -693,24 +693,24 @@ 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.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + 10.0f; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; if ((this->actionFunc == EnFirefly_DiveAttack) || (this->actionFunc == EnFirefly_DisturbDiveAttack)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actor.colChkInfo.health != 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); this->actor.world.rot.y = this->actor.shape.rot.y; if (Animation_OnFrame(&this->skelAnime, 5.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FFLY_FLY); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); this->actor.focus.pos.x = (10.0f * Math_SinS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y)) + this->actor.world.pos.x; this->actor.focus.pos.y = (10.0f * Math_CosS(this->actor.shape.rot.x)) + this->actor.world.pos.y; @@ -718,11 +718,11 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { (10.0f * Math_SinS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y)) + this->actor.world.pos.z; } -s32 EnFirefly_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnFirefly_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnFirefly* this = (EnFirefly*)thisx; - if ((this->actor.draw == EnFirefly_DrawInvisible) && !globalCtx->actorCtx.lensActive) { + if ((this->actor.draw == EnFirefly_DrawInvisible) && !play->actorCtx.lensActive) { *dList = NULL; } else if (limbIndex == 1) { pos->y += 2300.0f; @@ -730,7 +730,7 @@ s32 EnFirefly_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { static Color_RGBA8 fireAuraPrimColor = { 255, 255, 100, 255 }; static Color_RGBA8 fireAuraEnvColor = { 255, 50, 0, 0 }; static Color_RGBA8 iceAuraPrimColor = { 100, 200, 255, 255 }; @@ -805,7 +805,7 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList effEnvColor = &iceAuraEnvColor; } - func_8002843C(globalCtx, &effPos, &effVelocity, &effAccel, effPrimColor, effEnvColor, 250, effScaleStep, + func_8002843C(play, &effPos, &effVelocity, &effAccel, effPrimColor, effEnvColor, 250, effScaleStep, effLife); } } @@ -824,11 +824,11 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Draw(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->onFire) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); @@ -836,16 +836,16 @@ void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, &this->actor, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFirefly_DrawInvisible(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_DrawInvisible(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->onFire) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); @@ -853,7 +853,7 @@ void EnFirefly_DrawInvisible(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 255); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h index 0241d4ebd..862779e18 100644 --- a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -6,7 +6,7 @@ struct EnFirefly; -typedef void (*EnFireflyActionFunc)(struct EnFirefly*, GlobalContext*); +typedef void (*EnFireflyActionFunc)(struct EnFirefly*, PlayState*); typedef struct EnFirefly { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 42b069b49..9306c4cdc 100644 --- a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -10,27 +10,27 @@ #define FLAGS 0 -void EnFish_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFish_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFish_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFish_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFish_Init(Actor* thisx, PlayState* play); +void EnFish_Destroy(Actor* thisx, PlayState* play); +void EnFish_Update(Actor* thisx, PlayState* play); +void EnFish_Draw(Actor* thisx, PlayState* play); void EnFish_Respawning_SetupSlowDown(EnFish* this); -void EnFish_Respawning_SlowDown(EnFish* this, GlobalContext* globalCtx); +void EnFish_Respawning_SlowDown(EnFish* this, PlayState* play); void EnFish_Respawning_SetupFollowChild(EnFish* this); -void EnFish_Respawning_FollowChild(EnFish* this, GlobalContext* globalCtx); +void EnFish_Respawning_FollowChild(EnFish* this, PlayState* play); void EnFish_Respawning_SetupFleePlayer(EnFish* this); -void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx); +void EnFish_Respawning_FleePlayer(EnFish* this, PlayState* play); void EnFish_Respawning_SetupApproachPlayer(EnFish* this); -void EnFish_Respawning_ApproachPlayer(EnFish* this, GlobalContext* globalCtx); +void EnFish_Respawning_ApproachPlayer(EnFish* this, PlayState* play); void EnFish_Dropped_SetupFall(EnFish* this); -void EnFish_Dropped_Fall(EnFish* this, GlobalContext* globalCtx); +void EnFish_Dropped_Fall(EnFish* this, PlayState* play); void EnFish_Dropped_SetupFlopOnGround(EnFish* this); -void EnFish_Dropped_FlopOnGround(EnFish* this, GlobalContext* globalCtx); +void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play); void EnFish_Dropped_SetupSwimAway(EnFish* this); -void EnFish_Dropped_SwimAway(EnFish* this, GlobalContext* globalCtx); +void EnFish_Dropped_SwimAway(EnFish* this, PlayState* play); void EnFish_Unique_SetupSwimIdle(EnFish* this); -void EnFish_Unique_SwimIdle(EnFish* this, GlobalContext* globalCtx); +void EnFish_Unique_SwimIdle(EnFish* this, PlayState* play); // Used in the cutscene functions static Actor* D_80A17010 = NULL; @@ -128,15 +128,15 @@ void EnFish_ClearCutsceneData(EnFish* this) { D_80A17018 = 0.0f; } -void EnFish_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Init(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; s16 params = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishSkel, &gFishInWaterAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFishInWaterAnim, this->jointTable, this->morphTable, 7); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); this->actor.colChkInfo.mass = 50; this->slowPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); this->fastPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); @@ -152,11 +152,11 @@ void EnFish_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFish_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFish_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFish* this = (EnFish*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnFish_SetYOffset(EnFish* this) { @@ -164,9 +164,9 @@ void EnFish_SetYOffset(EnFish* this) { this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -200.0f, 200.0f); } -s32 EnFish_InBottleRange(EnFish* this, GlobalContext* globalCtx) { +s32 EnFish_InBottleRange(EnFish* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp1C; if (this->actor.xzDistToPlayer < 32.0f) { @@ -185,7 +185,7 @@ s32 EnFish_InBottleRange(EnFish* this, GlobalContext* globalCtx) { return false; } -s32 EnFish_CheckXZDistanceToPlayer(EnFish* this, GlobalContext* globalCtx) { +s32 EnFish_CheckXZDistanceToPlayer(EnFish* this, PlayState* play) { return (this->actor.xzDistToPlayer < 60.0f); } @@ -200,7 +200,7 @@ void EnFish_Respawning_SetupSlowDown(EnFish* this) { this->actionFunc = EnFish_Respawning_SlowDown; } -void EnFish_Respawning_SlowDown(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_SlowDown(EnFish* this, PlayState* play) { EnFish_SetYOffset(this); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.05f, 0.3f, 0.0f); this->skelAnime.playSpeed = CLAMP_MAX(this->actor.speedXZ * 1.4f + 0.8f, 2.0f); @@ -211,7 +211,7 @@ void EnFish_Respawning_SlowDown(EnFish* this, GlobalContext* globalCtx) { EnFish_Respawning_SetupFollowChild(this); } else if (&this->actor == this->actor.child) { EnFish_Respawning_SetupApproachPlayer(this); - } else if (EnFish_CheckXZDistanceToPlayer(this, globalCtx)) { + } else if (EnFish_CheckXZDistanceToPlayer(this, play)) { EnFish_Respawning_SetupFleePlayer(this); } } @@ -227,7 +227,7 @@ void EnFish_Respawning_SetupFollowChild(EnFish* this) { this->actionFunc = EnFish_Respawning_FollowChild; } -void EnFish_Respawning_FollowChild(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_FollowChild(EnFish* this, PlayState* play) { s32 pad; EnFish_SetYOffset(this); @@ -249,7 +249,7 @@ void EnFish_Respawning_FollowChild(EnFish* this, GlobalContext* globalCtx) { EnFish_Respawning_SetupSlowDown(this); } else if (&this->actor == this->actor.child) { EnFish_Respawning_SetupApproachPlayer(this); - } else if (EnFish_CheckXZDistanceToPlayer(this, globalCtx)) { + } else if (EnFish_CheckXZDistanceToPlayer(this, play)) { EnFish_Respawning_SetupFleePlayer(this); } } @@ -263,7 +263,7 @@ void EnFish_Respawning_SetupFleePlayer(EnFish* this) { this->actionFunc = EnFish_Respawning_FleePlayer; } -void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_FleePlayer(EnFish* this, PlayState* play) { s32 pad; s16 pad2; s16 frames; @@ -271,7 +271,7 @@ void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { s16 playerClose; EnFish_SetYOffset(this); - playerClose = EnFish_CheckXZDistanceToPlayer(this, globalCtx); + playerClose = EnFish_CheckXZDistanceToPlayer(this, play); Math_SmoothStepToF(&this->actor.speedXZ, 4.2f, 0.08f, 1.4f, 0.0f); if (EnFish_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) { @@ -282,7 +282,7 @@ void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { Math_StepToAngleS(&this->actor.world.rot.y, yaw, 2000); } else if (playerClose) { yaw = this->actor.yawTowardsPlayer + 0x8000; - frames = globalCtx->state.frames; + frames = play->state.frames; if (frames & 0x10) { if (frames & 0x20) { @@ -293,7 +293,7 @@ void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { yaw -= 0x2000; } } - if (globalCtx) {} + if (play) {} Math_StepToAngleS(&this->actor.world.rot.y, yaw, 2000); } @@ -318,9 +318,9 @@ void EnFish_Respawning_SetupApproachPlayer(EnFish* this) { this->actionFunc = EnFish_Respawning_ApproachPlayer; } -void EnFish_Respawning_ApproachPlayer(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_ApproachPlayer(EnFish* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; Vec3f sp38; s16 yaw; @@ -333,7 +333,7 @@ void EnFish_Respawning_ApproachPlayer(EnFish* this, GlobalContext* globalCtx) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); Math_StepToAngleS(&this->actor.world.rot.y, yaw, 3000); } else { - if ((s16)globalCtx->state.frames & 0x40) { + if ((s16)play->state.frames & 0x40) { temp_a0_2 = (this->actor.yawTowardsPlayer + 0x9000); } else { temp_a0_2 = (this->actor.yawTowardsPlayer + 0x7000); @@ -369,7 +369,7 @@ void EnFish_Dropped_SetupFall(EnFish* this) { this->timer = 300; } -void EnFish_Dropped_Fall(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Dropped_Fall(EnFish* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 0.1f, 0.0f); Math_StepToAngleS(&this->actor.world.rot.x, 0x4000, 100); Math_StepToAngleS(&this->actor.world.rot.z, -0x4000, 100); @@ -432,9 +432,9 @@ void EnFish_Dropped_SetupFlopOnGround(EnFish* this) { } } -void EnFish_Dropped_FlopOnGround(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play) { s32 pad; - s16 frames = globalCtx->state.frames; + s16 frames = play->state.frames; s16 targetXRot; Math_SmoothStepToF(&this->actor.speedXZ, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); @@ -484,7 +484,7 @@ void EnFish_Dropped_SetupSwimAway(EnFish* this) { this->unk_250 = 5; } -void EnFish_Dropped_SwimAway(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Dropped_SwimAway(EnFish* this, PlayState* play) { s32 pad; Math_SmoothStepToF(&this->actor.speedXZ, 2.8f, 0.1f, 0.4f, 0.0f); @@ -532,11 +532,11 @@ void EnFish_Unique_SetupSwimIdle(EnFish* this) { this->actionFunc = EnFish_Unique_SwimIdle; } -void EnFish_Unique_SwimIdle(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Unique_SwimIdle(EnFish* this, PlayState* play) { static f32 speedStopping[] = { 0.0f, 0.04f, 0.09f }; static f32 speedMoving[] = { 0.5f, 0.1f, 0.15f }; f32 playSpeed; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; f32* speed; s32 pad2; f32 extraPlaySpeed; @@ -582,7 +582,7 @@ void EnFish_Unique_SwimIdle(EnFish* this, GlobalContext* globalCtx) { // Cutscene functions -void EnFish_Cutscene_FlopOnGround(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Cutscene_FlopOnGround(EnFish* this, PlayState* play) { f32 sp24 = Math_SinS(this->slowPhase); f32 sp20 = Math_SinS(this->fastPhase); @@ -605,7 +605,7 @@ void EnFish_Cutscene_FlopOnGround(EnFish* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } -void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, PlayState* play) { s32 pad; f32 sp28 = Math_SinS(this->slowPhase); f32 sp24 = Math_SinS(this->fastPhase); @@ -617,10 +617,10 @@ void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, GlobalContext* globalC SkelAnime_Update(&this->skelAnime); } -void EnFish_UpdateCutscene(EnFish* this, GlobalContext* globalCtx) { +void EnFish_UpdateCutscene(EnFish* this, PlayState* play) { s32 pad; s32 pad2; - CsCmdActorAction* csAction = globalCtx->csCtx.npcActions[1]; + CsCmdActorAction* csAction = play->csCtx.npcActions[1]; Vec3f startPos; Vec3f endPos; f32 progress; @@ -640,10 +640,10 @@ void EnFish_UpdateCutscene(EnFish* this, GlobalContext* globalCtx) { switch (csAction->action) { case 1: - EnFish_Cutscene_FlopOnGround(this, globalCtx); + EnFish_Cutscene_FlopOnGround(this, play); break; case 2: - EnFish_Cutscene_WiggleFlyingThroughAir(this, globalCtx); + EnFish_Cutscene_WiggleFlyingThroughAir(this, play); break; case 3: // "DEMO fish termination" @@ -664,19 +664,19 @@ void EnFish_UpdateCutscene(EnFish* this, GlobalContext* globalCtx) { endPos.y = csAction->endPos.y; endPos.z = csAction->endPos.z; - progress = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, globalCtx->csCtx.frames); + progress = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, play->csCtx.frames); this->actor.world.pos.x = (endPos.x - startPos.x) * progress + startPos.x; this->actor.world.pos.y = (endPos.y - startPos.y) * progress + startPos.y + D_80A17014; this->actor.world.pos.z = (endPos.z - startPos.z) * progress + startPos.z; - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); } // Update functions and Draw -void EnFish_OrdinaryUpdate(EnFish* this, GlobalContext* globalCtx) { +void EnFish_OrdinaryUpdate(EnFish* this, PlayState* play) { if (this->timer > 0) { this->timer--; } @@ -688,20 +688,20 @@ void EnFish_OrdinaryUpdate(EnFish* this, GlobalContext* globalCtx) { this->actor.child = NULL; } - if ((this->actionFunc == NULL) || (this->actionFunc(this, globalCtx), (this->actor.update != NULL))) { + if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { Actor_MoveForward(&this->actor); if (this->unk_250 != 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 17.5f, 4.0f, 0.0f, this->unk_250); + Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, 4.0f, 0.0f, this->unk_250); } if (this->actor.xzDistToPlayer < 70.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, this->actor.shape.yOffset * 0.01f); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (this->actor.params == FISH_DROPPED) { @@ -710,14 +710,14 @@ void EnFish_OrdinaryUpdate(EnFish* this, GlobalContext* globalCtx) { } EnFish_BeginRespawn(this); - } else if (EnFish_InBottleRange(this, globalCtx)) { + } else if (EnFish_InBottleRange(this, play)) { // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 80.0f, 20.0f); + func_8002F434(&this->actor, play, GI_MAX, 80.0f, 20.0f); } } } -void EnFish_RespawningUpdate(EnFish* this, GlobalContext* globalCtx) { +void EnFish_RespawningUpdate(EnFish* this, PlayState* play) { if (this->actor.params == FISH_SWIMMING_UNIQUE) { Actor_Kill(&this->actor); return; @@ -727,7 +727,7 @@ void EnFish_RespawningUpdate(EnFish* this, GlobalContext* globalCtx) { this->actor.child = NULL; } - if ((this->actionFunc == NULL) || (this->actionFunc(this, globalCtx), (this->actor.update != NULL))) { + if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { Actor_MoveForward(&this->actor); if (this->respawnTimer == 20) { @@ -740,29 +740,29 @@ void EnFish_RespawningUpdate(EnFish* this, GlobalContext* globalCtx) { } } -void EnFish_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Update(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - if ((D_80A17010 == NULL) && (this->actor.params == FISH_DROPPED) && (globalCtx->csCtx.state != 0) && - (globalCtx->csCtx.npcActions[1] != NULL)) { + if ((D_80A17010 == NULL) && (this->actor.params == FISH_DROPPED) && (play->csCtx.state != 0) && + (play->csCtx.npcActions[1] != NULL)) { EnFish_SetCutsceneData(this); } if ((D_80A17010 != NULL) && (&this->actor == D_80A17010)) { - EnFish_UpdateCutscene(this, globalCtx); + EnFish_UpdateCutscene(this, play); } else if (this->respawnTimer > 0) { this->respawnTimer--; - EnFish_RespawningUpdate(this, globalCtx); + EnFish_RespawningUpdate(this, play); } else { - EnFish_OrdinaryUpdate(this, globalCtx); + EnFish_OrdinaryUpdate(this, play); } } -void EnFish_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Draw(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, NULL); Collider_UpdateSpheres(0, &this->collider); } diff --git a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.h b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.h index 911f79a45..7169077b5 100644 --- a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -6,7 +6,7 @@ struct EnFish; -typedef void (*EnFishActionFunc)(struct EnFish*, GlobalContext*); +typedef void (*EnFishActionFunc)(struct EnFish*, PlayState*); typedef struct EnFish { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index d457b2b03..a0dda1ddd 100644 --- a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -15,34 +15,34 @@ #define MERGE_MASTER 0x40 #define MERGE_SLAVE 0x20 -void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFloormas_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFloormas_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFloormas_Init(Actor* thisx, PlayState* play); +void EnFloormas_Destroy(Actor* thisx, PlayState* play); +void EnFloormas_Update(Actor* thisx, PlayState* play); +void EnFloormas_Draw(Actor* thisx, PlayState* play); -void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Recover(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_DrawHighlighted(Actor* this, GlobalContext* globalCtx); -void EnFloormas_SmWait(EnFloormas* this, GlobalContext* globalCtx); +void EnFloormas_GrabLink(EnFloormas* this, PlayState* play); +void EnFloormas_Split(EnFloormas* this, PlayState* play); +void EnFloormas_Recover(EnFloormas* this, PlayState* play); +void EnFloormas_DrawHighlighted(Actor* this, PlayState* play); +void EnFloormas_SmWait(EnFloormas* this, PlayState* play); void EnFloormas_SetupBigDecideAction(EnFloormas* this); -void EnFloormas_Freeze(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_TakeDamage(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmShrink(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Turn(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_BigStopWalk(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Stand(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx); +void EnFloormas_Freeze(EnFloormas* this, PlayState* play); +void EnFloormas_TakeDamage(EnFloormas* this, PlayState* play); +void EnFloormas_Merge(EnFloormas* this, PlayState* play); +void EnFloormas_JumpAtLink(EnFloormas* this, PlayState* play); +void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, PlayState* play); +void EnFloormas_SmShrink(EnFloormas* this, PlayState* play); +void EnFloormas_SmDecideAction(EnFloormas* this, PlayState* play); +void EnFloormas_SmWalk(EnFloormas* this, PlayState* play); +void EnFloormas_Land(EnFloormas* this, PlayState* play); +void EnFloormas_Hover(EnFloormas* this, PlayState* play); +void EnFloormas_Turn(EnFloormas* this, PlayState* play); +void EnFloormas_Run(EnFloormas* this, PlayState* play); +void EnFloormas_BigStopWalk(EnFloormas* this, PlayState* play); +void EnFloormas_BigWalk(EnFloormas* this, PlayState* play); +void EnFloormas_Stand(EnFloormas* this, PlayState* play); +void EnFloormas_BigDecideAction(EnFloormas* this, PlayState* play); +void EnFloormas_Charge(EnFloormas* this, PlayState* play); const ActorInit En_Floormas_InitVars = { ACTOR_EN_FLOORMAS, @@ -120,18 +120,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnFloormas_Init(Actor* thisx, PlayState* play2) { EnFloormas* this = (EnFloormas*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 invisble; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, this->morphTable, 25); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->zOffset = -1600; invisble = this->actor.params & SPAWN_INVISIBLE; @@ -150,7 +150,7 @@ void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { } else { // spawn first small floormaster this->actor.parent = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, invisble + SPAWN_SMALL); if (this->actor.parent == NULL) { Actor_Kill(&this->actor); @@ -158,7 +158,7 @@ void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { } // spawn 2nd small floormaster this->actor.child = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, invisble + SPAWN_SMALL); if (this->actor.child == NULL) { Actor_Kill(this->actor.parent); @@ -175,10 +175,10 @@ void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnFloormas_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Destroy(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; ColliderCylinder* col = &this->collider; - Collider_DestroyCylinder(globalCtx, col); + Collider_DestroyCylinder(play, col); } void EnFloormas_MakeInvulnerable(EnFloormas* this) { @@ -249,13 +249,13 @@ void EnFloormas_SetupTurn(EnFloormas* this) { this->actionFunc = EnFloormas_Turn; } -void EnFloormas_SetupHover(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SetupHover(EnFloormas* this, PlayState* play) { Animation_Change(&this->skelAnime, &gWallmasterHoverAnim, 3.0f, 0, Animation_GetLastFrame(&gWallmasterHoverAnim), ANIMMODE_ONCE, -3.0f); this->actor.speedXZ = 0.0f; this->actor.gravity = 0.0f; EnFloormas_MakeInvulnerable(this); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_ATTACK); this->actionFunc = EnFloormas_Hover; } @@ -316,7 +316,7 @@ void EnFloormas_SetupSmDecideAction(EnFloormas* this) { this->actor.speedXZ = 5.0f; } -void EnFloormas_SetupSmShrink(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SetupSmShrink(EnFloormas* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f pos; @@ -326,7 +326,7 @@ void EnFloormas_SetupSmShrink(EnFloormas* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 15.0f; pos.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velocity, &accel, 150, -10, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &velocity, &accel, 150, -10, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); this->actionFunc = EnFloormas_SmShrink; } @@ -426,7 +426,7 @@ void EnFloormas_SetupFreeze(EnFloormas* this) { this->actionFunc = EnFloormas_Freeze; } -void EnFloormas_Die(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Die(EnFloormas* this, PlayState* play) { //Originally was doing > 0.004f, better fix thanks Gary :D if (this->actor.scale.x > (f32)0.004f) { // split @@ -437,12 +437,12 @@ void EnFloormas_Die(EnFloormas* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SPLIT); } else { // Die - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); - EnFloormas_SetupSmShrink(this, globalCtx); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); + EnFloormas_SetupSmShrink(this, play); } } -void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_BigDecideAction(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { // within 400 units of link and within 90 degrees rotation of him if (this->actor.xzDistToPlayer < 400.0f && !Actor_IsFacingPlayer(&this->actor, 0x4000)) { @@ -450,14 +450,14 @@ void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx) { EnFloormas_SetupTurn(this); // within 280 units of link and within 45 degrees rotation of him } else if (this->actor.xzDistToPlayer < 280.0f && Actor_IsFacingPlayer(&this->actor, 0x2000)) { - EnFloormas_SetupHover(this, globalCtx); + EnFloormas_SetupHover(this, play); } else { EnFloormas_SetupStand(this); } } } -void EnFloormas_Stand(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Stand(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.scale.x > 0.004f) { EnFloormas_SetupBigWalk(this); @@ -469,7 +469,7 @@ void EnFloormas_Stand(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_BigWalk(EnFloormas* this, PlayState* play) { s32 animPastFrame; SkelAnime_Update(&this->skelAnime); @@ -500,13 +500,13 @@ void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_BigStopWalk(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_BigStopWalk(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnFloormas_SetupBigDecideAction(this); } } -void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Run(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 24.0f) || Animation_OnFrame(&this->skelAnime, 36.0f)) { @@ -517,13 +517,13 @@ void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 280.0f) && Actor_IsFacingPlayer(&this->actor, 0x2000) && !(this->actor.bgCheckFlags & 8)) { - EnFloormas_SetupHover(this, globalCtx); + EnFloormas_SetupHover(this, play); } else if (this->actor.xzDistToPlayer > 400.0f) { EnFloormas_SetupBigWalk(this); } } -void EnFloormas_Turn(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Turn(EnFloormas* this, PlayState* play) { char pad[4]; f32 sp30; f32 sp2C; @@ -553,7 +553,7 @@ void EnFloormas_Turn(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Hover(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnFloormas_SetupCharge(this); } @@ -563,7 +563,7 @@ void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToS(&this->zOffset, 1200, 100); } -void EnFloormas_Slide(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Slide(EnFloormas* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f pos; Vec3f velocity; @@ -576,17 +576,17 @@ void EnFloormas_Slide(EnFloormas* this, GlobalContext* globalCtx) { velocity.x = Math_SinS(this->actor.shape.rot.y + 0x6000) * 7.0f; velocity.z = Math_CosS(this->actor.shape.rot.y + 0x6000) * 7.0f; - func_800286CC(globalCtx, &pos, &velocity, &accel, 450, 100); + func_800286CC(play, &pos, &velocity, &accel, 450, 100); velocity.x = Math_SinS(this->actor.shape.rot.y - 0x6000) * 7.0f; velocity.z = Math_CosS(this->actor.shape.rot.y - 0x6000) * 7.0f; - func_800286CC(globalCtx, &pos, &velocity, &accel, 450, 100); + func_800286CC(play, &pos, &velocity, &accel, 450, 100); func_8002F974(&this->actor, NA_SE_EN_FLOORMASTER_SLIDING); } -void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Charge(EnFloormas* this, PlayState* play) { f32 distFromGround; if (this->actionTimer != 0) { @@ -604,7 +604,7 @@ void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { } if (distFromGround < 12.0f) { - EnFloormas_Slide(this, globalCtx); + EnFloormas_Slide(this, play); } if ((this->actor.bgCheckFlags & 8) || (this->actionTimer == 0)) { @@ -612,7 +612,7 @@ void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Land(EnFloormas* this, PlayState* play) { s32 isOnGround; isOnGround = this->actor.bgCheckFlags & 1; @@ -638,7 +638,7 @@ void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { } if ((this->actor.speedXZ > 0.0f) && ((this->actor.world.pos.y - this->actor.floorHeight) < 12.0f)) { - EnFloormas_Slide(this, globalCtx); + EnFloormas_Slide(this, play); } if (SkelAnime_Update(&this->skelAnime)) { @@ -662,7 +662,7 @@ void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToS(&this->zOffset, -1600, 100); } -void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Split(EnFloormas* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.flags |= ACTOR_FLAG_0; @@ -677,7 +677,7 @@ void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmWalk(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); DECR(this->smActionTimer); @@ -695,7 +695,7 @@ void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmDecideAction(EnFloormas* this, PlayState* play) { Actor* primaryFloormas; s32 isAgainstWall; @@ -732,7 +732,7 @@ void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_SmShrink(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmShrink(EnFloormas* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0015f)) { EnFloormas_SetupSmWait(this); } @@ -740,8 +740,8 @@ void EnFloormas_SmShrink(EnFloormas* this, GlobalContext* globalCtx) { this->actor.scale.y = this->actor.scale.x; } -void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFloormas_JumpAtLink(EnFloormas* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame < 20.0f) { @@ -756,13 +756,13 @@ void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { EnFloormas_SetupLand(this); } else if ((this->actor.yDistToPlayer < -10.0f) && (this->collider.base.ocFlags1 & OC1_HIT) && (&player->actor == this->collider.base.oc)) { - globalCtx->grabPlayer(globalCtx, player); + play->grabPlayer(play, player); EnFloormas_SetupGrabLink(this, player); } } -void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFloormas_GrabLink(EnFloormas* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnFloormas* parent; EnFloormas* child; f32 yDelta; @@ -818,14 +818,14 @@ void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) { } else { func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S); } - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_STICK); } -void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, PlayState* play) { Actor* primFloormas; SkelAnime_Update(&this->skelAnime); @@ -862,7 +862,7 @@ void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx) } } -void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Merge(EnFloormas* this, PlayState* play) { EnFloormas* parent; EnFloormas* child; s32 mergeCnt; @@ -878,11 +878,11 @@ void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx) { if (this->smActionTimer == 0) { if (parent->actionFunc != EnFloormas_SmWait) { - EnFloormas_SetupSmShrink(parent, globalCtx); + EnFloormas_SetupSmShrink(parent, play); } if (child->actionFunc != EnFloormas_SmWait) { - EnFloormas_SetupSmShrink(child, globalCtx); + EnFloormas_SetupSmShrink(child, play); } } else { if ((parent->actionFunc != EnFloormas_SmWait) && (parent->actionFunc != EnFloormas_SmShrink)) { @@ -933,13 +933,13 @@ void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_FLOORMASTER_RESTORE - SFX_FLAG); } -void EnFloormas_SmWait(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmWait(EnFloormas* this, PlayState* play) { } -void EnFloormas_TakeDamage(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_TakeDamage(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->actor.colChkInfo.health == 0) { - EnFloormas_Die(this, globalCtx); + EnFloormas_Die(this, play); } else { EnFloormas_SetupRecover(this); } @@ -955,27 +955,27 @@ void EnFloormas_TakeDamage(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); } -void EnFloormas_Recover(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Recover(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnFloormas_SetupStand(this); } } -void EnFloormas_Freeze(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Freeze(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actionTimer != 0) { this->actionTimer--; } if (this->actionTimer == 0) { if (this->actor.colChkInfo.health == 0) { - EnFloormas_Die(this, globalCtx); + EnFloormas_Die(this, play); return; } EnFloormas_SetupStand(this); } } -void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_ColliderCheck(EnFloormas* this, PlayState* play) { s32 pad; s32 isSmall; @@ -998,7 +998,7 @@ void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DEAD); } - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } else if (this->actor.colChkInfo.damage != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DAMAGE); @@ -1010,7 +1010,7 @@ void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { } } else { if (this->actor.colChkInfo.damageEffect == 2) { - EffectSsFCircle_Spawn(globalCtx, &this->actor, &this->actor.world.pos, + EffectSsFCircle_Spawn(play, &this->actor, &this->actor.world.pos, this->actor.scale.x * 4000.0f, this->actor.scale.x * 4000.0f); } EnFloormas_SetupTakeDamage(this); @@ -1020,7 +1020,7 @@ void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Update(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; s32 pad; @@ -1039,8 +1039,8 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { EnFloormas_SetupLand(this); } - EnFloormas_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnFloormas_ColliderCheck(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnFloormas_TakeDamage) { this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1050,20 +1050,20 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->actor.scale.x * 3000.0f, 0.0f, 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 == EnFloormas_Charge) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnFloormas_GrabLink) { if (this->actionFunc != EnFloormas_Split && this->actionFunc != EnFloormas_TakeDamage && this->actor.freezeTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc != EnFloormas_SmSlaveJumpAtMaster) || (this->skelAnime.curFrame < 20.0f)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1081,7 +1081,7 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnFloormas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnFloormas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnFloormas* this = (EnFloormas*)thisx; @@ -1091,14 +1091,14 @@ s32 EnFloormas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { if (limbIndex == 2) { Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); Matrix_RotateY(DEGTORAD(60.0f), MTXMODE_APPLY); Matrix_RotateZ(DEGTORAD(15.0f), MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix((*gfx)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix((*gfx)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList((*gfx)++, gWallmasterFingerDL); Matrix_Pop(); } @@ -1106,41 +1106,41 @@ void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis static Color_RGBA8 sMergeColor = { 0, 255, 0, 0 }; -void EnFloormas_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Draw(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026230(globalCtx, &sMergeColor, this->actionTarget % 0x28, 0x28); + func_80026230(play, &sMergeColor, this->actionTarget % 0x28, 0x28); } POLY_OPA_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, this, POLY_OPA_DISP); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026608(globalCtx); + func_80026608(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFloormas_DrawHighlighted(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_DrawHighlighted(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026690(globalCtx, &sMergeColor, this->actionTarget % 0x28, 0x28); + func_80026690(play, &sMergeColor, this->actionTarget % 0x28, 0x28); } POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, this, POLY_XLU_DISP); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026A6C(globalCtx); + func_80026A6C(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h index 52f98fc9f..c4233bf2a 100644 --- a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h +++ b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h @@ -6,7 +6,7 @@ typedef struct EnFloormas EnFloormas; -typedef void (*EnFloormasActionFunc)(EnFloormas* this, GlobalContext* globalCtx); +typedef void (*EnFloormasActionFunc)(EnFloormas* this, PlayState* play); struct EnFloormas{ /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 251edce48..33abfa39c 100644 --- a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -5,51 +5,51 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnFr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFr_UpdateIdle(Actor* thisx, GlobalContext* globalCtx); -void EnFr_UpdateActive(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFr_Init(Actor* thisx, PlayState* play); +void EnFr_Destroy(Actor* thisx, PlayState* play); +void EnFr_Update(Actor* thisx, PlayState* play); +void EnFr_UpdateIdle(Actor* thisx, PlayState* play); +void EnFr_UpdateActive(Actor* thisx, PlayState* play); +void EnFr_Draw(Actor* thisx, PlayState* play); void EnFr_Reset(void); // Animation Functions -void EnFr_SetupJumpingOutOfWater(EnFr* this, GlobalContext* globalCtx); -void EnFr_JumpingOutOfWater(EnFr* this, GlobalContext* globalCtx); -void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx); -void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx); -void EnFr_JumpingUp(EnFr* this, GlobalContext* globalCtx); -void EnFr_JumpingBackIntoWater(EnFr* this, GlobalContext* globalCtx); +void EnFr_SetupJumpingOutOfWater(EnFr* this, PlayState* play); +void EnFr_JumpingOutOfWater(EnFr* this, PlayState* play); +void EnFr_OrientOnLogSpot(EnFr* this, PlayState* play); +void EnFr_ChooseJumpFromLogSpot(EnFr* this, PlayState* play); +void EnFr_JumpingUp(EnFr* this, PlayState* play); +void EnFr_JumpingBackIntoWater(EnFr* this, PlayState* play); void EnFr_DecrementBlinkTimerUpdate(EnFr* this); // Activation -void EnFr_Idle(EnFr* this, GlobalContext* globalCtx); -void EnFr_Activate(EnFr* this, GlobalContext* globalCtx); -void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx); +void EnFr_Idle(EnFr* this, PlayState* play); +void EnFr_Activate(EnFr* this, PlayState* play); +void EnFr_ActivateCheckFrogSong(EnFr* this, PlayState* play); // Listening for Child Songs -void func_80A1BE98(EnFr* this, GlobalContext* globalCtx); -void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx); -void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_ChildSongFirstTime(EnFr* this, GlobalContext* globalCtx); +void func_80A1BE98(EnFr* this, PlayState* play); +void EnFr_ListeningToOcarinaNotes(EnFr* this, PlayState* play); +void EnFr_ChildSong(EnFr* this, PlayState* play); +void EnFr_ChildSongFirstTime(EnFr* this, PlayState* play); // Frog Song for HP Functions -void EnFr_TalkBeforeFrogSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_SetupFrogSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx); +void EnFr_TalkBeforeFrogSong(EnFr* this, PlayState* play); +void EnFr_SetupFrogSong(EnFr* this, PlayState* play); +void EnFr_ContinueFrogSong(EnFr* this, PlayState* play); +void EnFr_OcarinaMistake(EnFr* this, PlayState* play); // Reward Functions -void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition); -void EnFr_PrintTextBox(EnFr* this, GlobalContext* globalCtx); -void EnFr_TalkBeforeReward(EnFr* this, GlobalContext* globalCtx); +void EnFr_SetupReward(EnFr* this, PlayState* play, u8 unkCondition); +void EnFr_PrintTextBox(EnFr* this, PlayState* play); +void EnFr_TalkBeforeReward(EnFr* this, PlayState* play); RandomizerCheck EnFr_RandomizerCheckFromSongIndex(u16 songIndex); -void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx); +void EnFr_SetReward(EnFr* this, PlayState* play); // Deactivate -void EnFr_Deactivate(EnFr* this, GlobalContext* globalCtx); -void EnFr_GiveReward(EnFr* this, GlobalContext* globalCtx); -void EnFr_SetIdle(EnFr* this, GlobalContext* globalCtx); +void EnFr_Deactivate(EnFr* this, PlayState* play); +void EnFr_GiveReward(EnFr* this, PlayState* play); +void EnFr_SetIdle(EnFr* this, PlayState* play); /* Frogs params WIP docs @@ -209,7 +209,7 @@ void EnFr_OrientUnderwater(EnFr* this) { this->actor.gravity = 0.0f; } -void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Init(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; if (this->actor.params == 0) { @@ -218,7 +218,7 @@ void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.update = EnFr_UpdateIdle; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_4); this->actor.flags &= ~0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.textId = 0x40AC; this->actionFunc = EnFr_Idle; } else { @@ -230,7 +230,7 @@ void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { ASSERT((this->actor.params >= 6) || (this->actor.params < 0)); } - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); + this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); if (this->objBankIndex < 0) { Actor_Kill(&this->actor); osSyncPrintf(VT_COL(RED, WHITE)); @@ -251,25 +251,25 @@ void EnFr_DrawActive(EnFr* this) { this->actor.draw = EnFr_Draw; } -void EnFr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Update(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; s32 pad; s32 frogIndex; s32 pad2; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; frogIndex = this->actor.params - 1; sEnFrPointers.frogs[frogIndex] = this; Actor_ProcessInitChain(&this->actor, sInitChain); // frog - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_fr_Skel_00B498, &object_fr_Anim_001534, + SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B498, &object_fr_Anim_001534, this->jointTable, this->morphTable, 24); // butterfly - SkelAnime_Init(globalCtx, &this->skelAnimeButterfly, &gButterflySkel, &gButterflyAnim, + SkelAnime_Init(play, &this->skelAnimeButterfly, &gButterflySkel, &gButterflyAnim, this->jointTableButterfly, this->morphTableButterfly, 8); // When playing the song for the HP, the frog with the next note and the butterfly turns on its lightsource - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, -1); // Check to see if the song for a particular frog has been played. @@ -305,24 +305,24 @@ void EnFr_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Destroy(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void EnFr_IsDivingIntoWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_IsDivingIntoWater(EnFr* this, PlayState* play) { WaterBox* waterBox; f32 waterSurface; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, &waterBox)) { this->isBelowWaterSurfacePrevious = this->isBelowWaterSurfaceCurrent; this->isBelowWaterSurfaceCurrent = this->actor.world.pos.y <= waterSurface ? true : false; } } -void EnFr_DivingIntoWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_DivingIntoWater(EnFr* this, PlayState* play) { Vec3f vec; // Jumping into or out of water @@ -330,7 +330,7 @@ void EnFr_DivingIntoWater(EnFr* this, GlobalContext* globalCtx) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y - 10.0f; vec.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &vec, NULL, NULL, 1, 1); + EffectSsGSplash_Spawn(play, &vec, NULL, NULL, 1, 1); if (this->isBelowWaterSurfaceCurrent == false) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); @@ -380,7 +380,7 @@ void EnFr_DecrementBlinkTimerUpdate(EnFr* this) { } } -void EnFr_SetupJumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetupJumpingOutOfWater(EnFr* this, PlayState* play) { if (sEnFrPointers.flags == sTimerJumpingOutOfWater[this->actor.params - 1]) { Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f, Animation_GetLastFrame(&object_fr_Anim_0007BC), ANIMMODE_ONCE, 0.0f); @@ -389,7 +389,7 @@ void EnFr_SetupJumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_JumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_JumpingOutOfWater(EnFr* this, PlayState* play) { Vec3f vec1; Vec3f vec2; @@ -423,7 +423,7 @@ void EnFr_JumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx) { +void EnFr_OrientOnLogSpot(EnFr* this, PlayState* play) { s16 rotYRemaining = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 10000, 100); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -436,7 +436,7 @@ void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ChooseJumpFromLogSpot(EnFr* this, PlayState* play) { if (sEnFrPointers.flags == 12) { this->actor.world.rot.y = ((f32)0x8000 / M_PI) * sLogSpotToFromWater[this->actor.params].yaw; Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f, @@ -449,7 +449,7 @@ void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_JumpingUp(EnFr* this, GlobalContext* globalCtx) { +void EnFr_JumpingUp(EnFr* this, PlayState* play) { f32 yDistToLogSpot; if (this->skelAnime.curFrame == 6.0f) { @@ -474,7 +474,7 @@ void EnFr_JumpingUp(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_JumpingBackIntoWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_JumpingBackIntoWater(EnFr* this, PlayState* play) { f32 yUnderwater = sLogSpotToFromWater[this->actor.params].yDist + this->posLogSpot.y; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 10000, 100); @@ -497,7 +497,7 @@ void EnFr_JumpingBackIntoWater(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_SetScaleActive(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetScaleActive(EnFr* this, PlayState* play) { switch (this->isGrowing) { case false: Math_ApproachF(&this->scale, sGrowingScale[this->growingScaleIndex], 2.0f, 25.0f); @@ -525,7 +525,7 @@ void EnFr_SetScaleActive(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_ButterflyPath(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ButterflyPath(EnFr* this, PlayState* play) { s16 rotY = this->actor.shape.rot.y; f32 sin; Vec3f vec1; @@ -549,23 +549,23 @@ void EnFr_ButterflyPath(EnFr* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&vec1, &this->posButterflyLight); } -void EnFr_UpdateActive(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_UpdateActive(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; this->jumpCounter++; Actor_SetScale(&this->actor, this->scale * 0.0001f); if (this->isActive) { - EnFr_SetScaleActive(this, globalCtx); + EnFr_SetScaleActive(this, play); } else { Actor_SetFocus(&this->actor, 10.0f); this->blinkFunc(this); - this->actionFunc(this, globalCtx); - EnFr_IsDivingIntoWater(this, globalCtx); - EnFr_DivingIntoWater(this, globalCtx); + this->actionFunc(this, play); + EnFr_IsDivingIntoWater(this, play); + EnFr_DivingIntoWater(this, play); SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnimeButterfly); - EnFr_ButterflyPath(this, globalCtx); + EnFr_ButterflyPath(this, play); Actor_MoveForward(&this->actor); } } @@ -587,16 +587,16 @@ s32 EnFr_SetupJumpingUp(EnFr* this, s32 frogIndex) { } } -void EnFr_Idle(EnFr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFr_Idle(EnFr* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & 0x2000000) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + play->msgCtx.ocarinaMode = OCARINA_MODE_00; } - OnePointCutscene_Init(globalCtx, 4110, ~0x62, &this->actor, MAIN_CAM); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + OnePointCutscene_Init(play, 4110, ~0x62, &this->actor, MAIN_CAM); + play->msgCtx.msgMode = MSGMODE_PAUSED; player->actor.world.pos.x = this->actor.world.pos.x; // x = 990.0f player->actor.world.pos.y = this->actor.world.pos.y; // y = 205.0f player->actor.world.pos.z = this->actor.world.pos.z; // z = -1220.0f @@ -609,18 +609,18 @@ void EnFr_Idle(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_Activate(EnFr* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_PLAYING) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; +void EnFr_Activate(EnFr* this, PlayState* play) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_PLAYING) { + play->msgCtx.msgMode = MSGMODE_PAUSED; sEnFrPointers.flags = 1; this->actionFunc = EnFr_ActivateCheckFrogSong; - } else if (globalCtx->msgCtx.msgMode == MSGMODE_PAUSED) { // Goes to Frogs 2 Song + } else if (play->msgCtx.msgMode == MSGMODE_PAUSED) { // Goes to Frogs 2 Song sEnFrPointers.flags = 1; this->actionFunc = EnFr_ActivateCheckFrogSong; } } -void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ActivateCheckFrogSong(EnFr* this, PlayState* play) { if (sEnFrPointers.flags == 11) { // Check if all 6 child songs have been played for the frogs if ((gSaveContext.eventChkInf[13] & 0x2) // ZL @@ -631,7 +631,7 @@ void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx) { && (gSaveContext.eventChkInf[13] & 0x40)) { // SoS this->actionFunc = EnFr_TalkBeforeFrogSong; this->songIndex = FROG_CHOIR_SONG; - Message_StartTextbox(globalCtx, 0x40AB, &this->actor); + Message_StartTextbox(play, 0x40AB, &this->actor); } else { this->songIndex = FROG_ZL; this->actionFunc = func_80A1BE98; @@ -639,7 +639,7 @@ void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx) { } } -void func_80A1BE98(EnFr* this, GlobalContext* globalCtx) { +void func_80A1BE98(EnFr* this, PlayState* play) { EnFr* frog; s32 frogIndex; @@ -652,13 +652,13 @@ void func_80A1BE98(EnFr* this, GlobalContext* globalCtx) { } } - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_NOWARP); + func_8010BD58(play, OCARINA_ACTION_CHECK_NOWARP); this->actionFunc = EnFr_ListeningToOcarinaNotes; } -void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ListeningToOcarinaNotes(EnFr* this, PlayState* play) { this->songIndex = FROG_NO_SONG; - switch (globalCtx->msgCtx.ocarinaMode) { // Ocarina Song played + switch (play->msgCtx.ocarinaMode) { // Ocarina Song played case OCARINA_MODE_07: this->songIndex = FROG_ZL; break; @@ -678,10 +678,10 @@ void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) { this->songIndex = FROG_STORMS; break; case OCARINA_MODE_04: - EnFr_OcarinaMistake(this, globalCtx); + EnFr_OcarinaMistake(this, play); break; case OCARINA_MODE_01: // Ocarina note played, but no song played - switch (globalCtx->msgCtx.lastOcaNoteIdx) { // Jumping frogs in open ocarina based on ocarina note played + switch (play->msgCtx.lastOcaNoteIdx) { // Jumping frogs in open ocarina based on ocarina note played case OCARINA_NOTE_D4: EnFr_SetupJumpingUp(this, FROG_BLUE); break; @@ -705,7 +705,7 @@ void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ChildSong(EnFr* this, PlayState* play) { EnFr* frog; u8 songIndex; @@ -717,7 +717,7 @@ void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx) { songIndex = this->songIndex; if (songIndex == FROG_STORMS) { this->actor.textId = 0x40AA; - EnFr_SetupReward(this, globalCtx, false); + EnFr_SetupReward(this, play, false); } else if (!(gSaveContext.eventChkInf[13] & sSongIndex[songIndex])) { frog = sEnFrPointers.frogs[sSongToFrog[songIndex]]; func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -731,23 +731,23 @@ void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx) { } } else { this->actor.textId = 0x40A9; - EnFr_SetupReward(this, globalCtx, true); + EnFr_SetupReward(this, play, true); } } } -void EnFr_ChildSongFirstTime(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ChildSongFirstTime(EnFr* this, PlayState* play) { EnFr* frog = sEnFrPointers.frogs[sSongToFrog[this->songIndex]]; if (frog->isActive == false) { this->actor.textId = 0x40A9; - EnFr_SetupReward(this, globalCtx, true); + EnFr_SetupReward(this, play, true); } } -void EnFr_TalkBeforeFrogSong(EnFr* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnFr_TalkBeforeFrogSong(EnFr* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->frogSongTimer = 2; this->actionFunc = EnFr_SetupFrogSong; } @@ -799,23 +799,23 @@ u8 EnFr_GetNextNoteFrogSong(u8 ocarinaNoteIndex) { } } -void EnFr_SetupFrogSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetupFrogSong(EnFr* this, PlayState* play) { if (this->frogSongTimer != 0) { this->frogSongTimer--; } else { this->frogSongTimer = 40; this->ocarinaNoteIndex = 0; - func_8010BD58(globalCtx, OCARINA_ACTION_FROGS); + func_8010BD58(play, OCARINA_ACTION_FROGS); this->ocarinaNote = EnFr_GetNextNoteFrogSong(this->ocarinaNoteIndex); EnFr_CheckOcarinaInputFrogSong(this->ocarinaNote); this->actionFunc = EnFr_ContinueFrogSong; } } -s32 EnFr_IsFrogSongComplete(EnFr* this, GlobalContext* globalCtx) { +s32 EnFr_IsFrogSongComplete(EnFr* this, PlayState* play) { u8 index; u8 ocarinaNote; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; u8 ocarinaNoteIndex; if (this->ocarinaNote == (*msgCtx).lastOcaNoteIdx) { // required to match, possibly an array? @@ -835,8 +835,8 @@ s32 EnFr_IsFrogSongComplete(EnFr* this, GlobalContext* globalCtx) { return false; } -void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) { - Message_CloseTextbox(globalCtx); +void EnFr_OcarinaMistake(EnFr* this, PlayState* play) { + Message_CloseTextbox(play); this->reward = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; func_80078884(NA_SE_SY_OCARINA_ERROR); @@ -846,16 +846,16 @@ void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) { this->actionFunc = EnFr_Deactivate; } -void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ContinueFrogSong(EnFr* this, PlayState* play) { s32 counter; EnFr* frog; s32 i; if (this->frogSongTimer == 0) { - EnFr_OcarinaMistake(this, globalCtx); + EnFr_OcarinaMistake(this, play); } else { this->frogSongTimer--; - if (globalCtx->msgCtx.msgMode == MSGMODE_FROGS_PLAYING) { + if (play->msgCtx.msgMode == MSGMODE_FROGS_PLAYING) { counter = 0; for (i = 0; i < ARRAY_COUNT(sEnFrPointers.frogs); i++) { frog = sEnFrPointers.frogs[i]; @@ -865,15 +865,15 @@ void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) { counter++; } } - if (counter == 0 && CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { - EnFr_OcarinaMistake(this, globalCtx); + if (counter == 0 && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { + EnFr_OcarinaMistake(this, play); return; } } - if (globalCtx->msgCtx.msgMode == MSGMODE_FROGS_WAITING) { - globalCtx->msgCtx.msgMode = MSGMODE_FROGS_START; - switch (globalCtx->msgCtx.lastOcaNoteIdx) { + if (play->msgCtx.msgMode == MSGMODE_FROGS_WAITING) { + play->msgCtx.msgMode = MSGMODE_FROGS_START; + switch (play->msgCtx.lastOcaNoteIdx) { case OCARINA_NOTE_D4: EnFr_SetupJumpingUp(this, FROG_BLUE); break; @@ -889,15 +889,15 @@ void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) { case OCARINA_NOTE_D5: EnFr_SetupJumpingUp(this, FROG_WHITE); } - if (EnFr_IsFrogSongComplete(this, globalCtx)) { + if (EnFr_IsFrogSongComplete(this, play)) { this->actor.textId = 0x40AC; - EnFr_SetupReward(this, globalCtx, false); + EnFr_SetupReward(this, play, false); } } } } -void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition) { +void EnFr_SetupReward(EnFr* this, PlayState* play, u8 unkCondition) { EnFr_DeactivateButterfly(); if (unkCondition) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); @@ -906,19 +906,19 @@ void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition) { } Audio_OcaSetInstrument(0); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = EnFr_PrintTextBox; } -void EnFr_PrintTextBox(EnFr* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); +void EnFr_PrintTextBox(EnFr* this, PlayState* play) { + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFr_TalkBeforeReward; } -void EnFr_TalkBeforeReward(EnFr* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void EnFr_TalkBeforeReward(EnFr* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->frogSongTimer = 100; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = EnFr_SetReward; } } @@ -940,7 +940,7 @@ RandomizerCheck EnFr_RandomizerCheckFromSongIndex(u16 songIndex) { } } -void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetReward(EnFr* this, PlayState* play) { u16 songIndex; sEnFrPointers.flags = 12; @@ -987,7 +987,7 @@ void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_Deactivate(EnFr* this, GlobalContext* globalCtx) { +void EnFr_Deactivate(EnFr* this, PlayState* play) { EnFr* frogLoop1; EnFr* frogLoop2; s32 frogIndex; @@ -1024,74 +1024,74 @@ void EnFr_Deactivate(EnFr* this, GlobalContext* globalCtx) { frogLoop2->isDeactivating = false; } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; Audio_PlayActorSound2(&this->actor, NA_SE_EV_FROG_CRY_0); if (this->reward == GI_NONE) { this->actionFunc = EnFr_Idle; } else { this->actionFunc = EnFr_GiveReward; if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f); + func_8002F434(&this->actor, play, this->reward, 30.0f, 100.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 30.0f, 100.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 30.0f, 100.0f); } } } -void EnFr_GiveReward(EnFr* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnFr_GiveReward(EnFr* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnFr_SetIdle; } else { if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f); + func_8002F434(&this->actor, play, this->reward, 30.0f, 100.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 30.0f, 100.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 30.0f, 100.0f); } } } -void EnFr_SetIdle(EnFr* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx) || (gSaveContext.n64ddFlag && this->reward == RG_ICE_TRAP)) { +void EnFr_SetIdle(EnFr* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play) || (gSaveContext.n64ddFlag && this->reward == RG_ICE_TRAP)) { this->actionFunc = EnFr_Idle; } } -void EnFr_UpdateIdle(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_UpdateIdle(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; if (BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } this->jumpCounter++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnFr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnFr_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if ((limbIndex == 7) || (limbIndex == 8)) { *dList = NULL; } return 0; } -void EnFr_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnFr_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnFr* this = (EnFr*)thisx; if ((limbIndex == 7) || (limbIndex == 8)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->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); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { object_fr_Tex_0059A0, object_fr_Tex_005BA0, @@ -1100,8 +1100,8 @@ void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx) { EnFr* this = (EnFr*)thisx; s16 frogIndex = this->actor.params - 1; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); // For the frogs 2 HP, the frog with the next note and the butterfly lights up lightRadius = this->isButterflyDrawn ? 95 : -1; gDPPipeSync(POLY_OPA_DISP++); @@ -1111,16 +1111,16 @@ void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, sEnFrColor[frogIndex].r, sEnFrColor[frogIndex].g, sEnFrColor[frogIndex].b, 255); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFr_OverrideLimbDraw, EnFr_PostLimbDraw, this); if (this->isButterflyDrawn) { Matrix_Translate(this->posButterfly.x, this->posButterfly.y, this->posButterfly.z, MTXMODE_NEW); Matrix_Scale(0.015f, 0.015f, 0.015f, MTXMODE_APPLY); Matrix_RotateZYX(this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeButterfly.skeleton, this->skelAnimeButterfly.jointTable, NULL, NULL, + SkelAnime_DrawOpa(play, this->skelAnimeButterfly.skeleton, this->skelAnimeButterfly.jointTable, NULL, NULL, NULL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnFr_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.h b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.h index 972c32e49..789b5e453 100644 --- a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.h +++ b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.h @@ -6,7 +6,7 @@ struct EnFr; -typedef void (*EnFrActionFunc)(struct EnFr*, GlobalContext*); +typedef void (*EnFrActionFunc)(struct EnFr*, PlayState*); typedef void (*EnFrBlinkFunc)(struct EnFr*); typedef enum { diff --git a/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 28aa94c0e..57b049270 100644 --- a/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -13,20 +13,20 @@ #define FU_RESET_LOOK_ANGLE (1 << 0) #define FU_WAIT (1 << 1) -void EnFu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFu_Init(Actor* thisx, PlayState* play); +void EnFu_Destroy(Actor* thisx, PlayState* play); +void EnFu_Update(Actor* thisx, PlayState* play); +void EnFu_Draw(Actor* thisx, PlayState* play); -void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx); -void func_80A1DA04(EnFu* this, GlobalContext* globalCtx); +void EnFu_WaitChild(EnFu* this, PlayState* play); +void func_80A1DA04(EnFu* this, PlayState* play); -void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx); -void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx); -void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx); -void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx); -void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx); -void func_80A1DB60(EnFu* this, GlobalContext* globalCtx); +void EnFu_WaitAdult(EnFu* this, PlayState* play); +void EnFu_TeachSong(EnFu* this, PlayState* play); +void EnFu_WaitForPlayback(EnFu* this, PlayState* play); +void func_80A1DBA0(EnFu* this, PlayState* play); +void func_80A1DBD4(EnFu* this, PlayState* play); +void func_80A1DB60(EnFu* this, PlayState* play); const ActorInit En_Fu_InitVars = { ACTOR_EN_FU, @@ -72,16 +72,16 @@ typedef enum { /* 0x01 */ FU_FACE_MAD } EnFuFace; -void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Init(Actor* thisx, PlayState* play) { s32 pad; EnFu* this = (EnFu*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelanime, &gWindmillManSkel, &gWindmillManPlayStillAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelanime, &gWindmillManSkel, &gWindmillManPlayStillAnim, this->jointTable, this->morphTable, FU_LIMB_MAX); Animation_PlayLoop(&this->skelanime, &gWindmillManPlayStillAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); if (!LINK_IS_ADULT) { @@ -96,15 +96,15 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Destroy(Actor* thisx, PlayState* play) { EnFu* this = (EnFu*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFunc actionFunc) { +s32 func_80A1D94C(EnFu* this, PlayState* play, u16 textID, EnFuActionFunc actionFunc) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; return true; } @@ -112,15 +112,15 @@ s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFu yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) < 0x2301) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } else { this->behaviorFlags |= FU_RESET_LOOK_ANGLE; } return false; } -void func_80A1DA04(EnFu* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A1DA04(EnFu* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->behaviorFlags &= ~FU_WAIT; this->actionFunc = EnFu_WaitChild; @@ -131,8 +131,8 @@ void func_80A1DA04(EnFu* this, GlobalContext* globalCtx) { } } -void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { - u16 textID = Text_GetFaceReaction(globalCtx, 0xB); +void EnFu_WaitChild(EnFu* this, PlayState* play) { + u16 textID = Text_GetFaceReaction(play, 0xB); if (textID == 0) { textID = (gSaveContext.eventChkInf[6] & 0x80) ? 0x5033 : 0x5032; @@ -140,7 +140,7 @@ void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { // if ACTOR_FLAG_8 is set and textID is 0x5033, change animation // if func_80A1D94C returns 1, actionFunc is set to func_80A1DA04 - if (func_80A1D94C(this, globalCtx, textID, func_80A1DA04)) { + if (func_80A1D94C(this, play, textID, func_80A1DA04)) { if (textID == 0x5033) { Animation_Change(&this->skelanime, &gWindmillManPlayAndMoveHeadAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gWindmillManPlayAndMoveHeadAnim), ANIMMODE_ONCE, -4.0f); @@ -148,26 +148,26 @@ void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { } } -void GivePlayerRandoRewardSongOfStorms(EnFu* windmillGuy, GlobalContext* globalCtx, RandomizerCheck check) { - if (windmillGuy->actor.parent != NULL && windmillGuy->actor.parent->id == GET_PLAYER(globalCtx)->actor.id && - !Flags_GetTreasure(globalCtx, 0x1F)) { - Flags_SetTreasure(globalCtx, 0x1F); +void GivePlayerRandoRewardSongOfStorms(EnFu* windmillGuy, PlayState* play, RandomizerCheck check) { + if (windmillGuy->actor.parent != NULL && windmillGuy->actor.parent->id == GET_PLAYER(play)->actor.id && + !Flags_GetTreasure(play, 0x1F)) { + Flags_SetTreasure(play, 0x1F); windmillGuy->actionFunc = func_80A1DBD4; - } else if (!Flags_GetTreasure(globalCtx, 0x1F)) { + } else if (!Flags_GetTreasure(play, 0x1F)) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_SONG_OF_STORMS); - GiveItemEntryFromActor(&windmillGuy->actor, globalCtx, getItemEntry, 10000.0f, 100.0f); + GiveItemEntryFromActor(&windmillGuy->actor, play, getItemEntry, 10000.0f, 100.0f); } } -void func_WaitForSongGive(EnFu* this, GlobalContext* globalCtx) { - GivePlayerRandoRewardSongOfStorms(this, globalCtx, RC_SONG_FROM_WINDMILL); +void func_WaitForSongGive(EnFu* this, PlayState* play) { + GivePlayerRandoRewardSongOfStorms(this, play, RC_SONG_FROM_WINDMILL); } -void func_80A1DB60(EnFu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +void func_80A1DB60(EnFu* this, PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = EnFu_WaitAdult; gSaveContext.eventChkInf[5] |= 0x800; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } if (gSaveContext.n64ddFlag) { @@ -175,104 +175,104 @@ void func_80A1DB60(EnFu* this, GlobalContext* globalCtx) { } } -void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A1DBA0(EnFu* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnFu_WaitAdult; } } -void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A1DBD4(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (gSaveContext.n64ddFlag && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + if (gSaveContext.n64ddFlag && (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { this->actionFunc = EnFu_WaitAdult; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actor.flags &= ~ACTOR_FLAG_16; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_80A1DB60; this->actor.flags &= ~ACTOR_FLAG_16; if (!gSaveContext.n64ddFlag) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSongOfStormsCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSongOfStormsCs); gSaveContext.cutsceneTrigger = 1; - Item_Give(globalCtx, ITEM_SONG_STORMS); + Item_Give(play, ITEM_SONG_STORMS); } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; gSaveContext.eventChkInf[6] |= 0x20; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_02) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { player->stateFlags2 &= ~0x1000000; this->actionFunc = EnFu_WaitAdult; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= 0x800000; } } -void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFu_WaitForPlayback(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags2 |= 0x800000; // if dialog state is 7, player has played back the song - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { - func_8010BD58(globalCtx, OCARINA_ACTION_PLAYBACK_STORMS); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { + func_8010BD58(play, OCARINA_ACTION_PLAYBACK_STORMS); this->actionFunc = func_80A1DBD4; } } -void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFu_TeachSong(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags2 |= 0x800000; // if dialog state is 2, start song demonstration - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->behaviorFlags &= ~FU_WAIT; Audio_OcaSetInstrument(4); // seems to be related to setting instrument type - func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_STORMS); + func_8010BD58(play, OCARINA_ACTION_TEACH_STORMS); this->actionFunc = EnFu_WaitForPlayback; } } -void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) { +void EnFu_WaitAdult(EnFu* this, PlayState* play) { static s16 yawDiff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((gSaveContext.eventChkInf[5] & 0x800)) { - func_80A1D94C(this, globalCtx, 0x508E, func_80A1DBA0); + func_80A1D94C(this, play, 0x508E, func_80A1DBA0); } else if (player->stateFlags2 & 0x1000000) { this->actor.textId = 0x5035; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = gSaveContext.n64ddFlag ? func_80A1DBD4 : EnFu_TeachSong; this->behaviorFlags |= FU_WAIT; - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80A1DBA0; } else if (ABS(yawDiff) < 0x2301) { if (this->actor.xzDistToPlayer < 100.0f) { this->actor.textId = 0x5034; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); player->stateFlags2 |= 0x800000; } } } -void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Update(Actor* thisx, PlayState* play) { s32 pad; EnFu* this = (EnFu*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if ((!(this->behaviorFlags & FU_WAIT)) && (SkelAnime_Update(&this->skelanime) != 0)) { Animation_Change(&this->skelanime, this->skelanime.animation, 1.0f, 0.0f, Animation_GetLastFrame(this->skelanime.animation), ANIMMODE_ONCE, 0.0f); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->behaviorFlags & FU_RESET_LOOK_ANGLE)) { Math_SmoothStepToS(&this->lookAngleOffset.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->lookAngleOffset.y, 0, 6, 6200, 100); @@ -280,11 +280,11 @@ void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_2A2.y, 0, 6, 6200, 100); this->behaviorFlags &= ~FU_RESET_LOOK_ANGLE; } else { - func_80038290(globalCtx, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos); } } -s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnFu* this = (EnFu*)thisx; s32 pad; @@ -305,13 +305,13 @@ s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) { - rot->y += (Math_SinS((globalCtx->state.frames * (limbIndex * 50 + 0x814))) * 200.0f); - rot->z += (Math_CosS((globalCtx->state.frames * (limbIndex * 50 + 0x940))) * 200.0f); + rot->y += (Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f); + rot->z += (Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f); } return false; } -void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnFu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnFu* this = (EnFu*)thisx; if (limbIndex == FU_LIMB_HEAD) { @@ -319,19 +319,19 @@ void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Draw(Actor* thisx, PlayState* play) { static void* sEyesSegments[] = { gWindmillManEyeClosedTex, gWindmillManEyeAngryTex }; static void* sMouthSegments[] = { gWindmillManMouthOpenTex, gWindmillManMouthAngryTex }; s32 pad; EnFu* this = (EnFu*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->facialExpression])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthSegments[this->facialExpression])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, EnFu_OverrideLimbDraw, EnFu_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.h index b9de1a1cf..3c27e82d3 100644 --- a/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -6,7 +6,7 @@ struct EnFu; -typedef void (*EnFuActionFunc)(struct EnFu*, GlobalContext*); +typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*); typedef enum { /* 0x00 */ FU_LIMB_ROOT, diff --git a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 23073ed1a..43adc01f8 100644 --- a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -12,18 +12,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9) -void EnFw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFw_Init(Actor* thisx, PlayState* play); +void EnFw_Destroy(Actor* thisx, PlayState* play); +void EnFw_Update(Actor* thisx, PlayState* play); +void EnFw_Draw(Actor* thisx, PlayState* play); void EnFw_UpdateDust(EnFw* this); -void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx); +void EnFw_DrawDust(EnFw* this, PlayState* play); void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep); -void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx); -void EnFw_Run(EnFw* this, GlobalContext* globalCtx); -void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx); -void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx); +void EnFw_Bounce(EnFw* this, PlayState* play); +void EnFw_Run(EnFw* this, PlayState* play); +void EnFw_JumpToParentInitPos(EnFw* this, PlayState* play); +void EnFw_TurnToParentInitPos(EnFw* this, PlayState* play); const ActorInit En_Fw_InitVars = { ACTOR_EN_FW, @@ -102,8 +102,8 @@ s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) { return 1; } -s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnFw_PlayerInRange(EnFw* this, PlayState* play) { + Player* player = GET_PLAYER(play); CollisionPoly* poly; s32 bgId; Vec3f collisionPos; @@ -116,7 +116,7 @@ s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) { return false; } - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &player->actor.world.pos, &collisionPos, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &player->actor.world.pos, &collisionPos, &poly, true, false, false, true, &bgId)) { return false; } @@ -138,7 +138,7 @@ Vec3f* EnFw_GetPosAdjAroundCircle(Vec3f* dst, EnFw* this, f32 radius, s16 dir) { return dst; } -s32 EnFw_CheckCollider(EnFw* this, GlobalContext* globalCtx) { +s32 EnFw_CheckCollider(EnFw* this, PlayState* play) { ColliderInfo* info; s32 phi_return; @@ -152,7 +152,7 @@ s32 EnFw_CheckCollider(EnFw* this, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; if (Actor_ApplyDamage(&this->actor) <= 0) { if (this->actor.parent->colChkInfo.health <= 8) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.parent->colChkInfo.health = 0; } else { this->actor.parent->colChkInfo.health -= 8; @@ -189,15 +189,15 @@ s32 EnFw_SpawnDust(EnFw* this, u8 timer, f32 scale, f32 scaleStep, s32 dustCnt, return 0; } -void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Init(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFlareDancerCoreSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gFlareDancerCoreSkel, NULL, this->jointTable, this->morphTable, 11); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFW_ANIM_0); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->sphs); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x10), &D_80A1FB94); Actor_SetScale(&this->actor, 0.01f); this->runDirection = -this->actor.params; @@ -205,19 +205,19 @@ void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } -void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Destroy(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx) { +void EnFw_Bounce(EnFw* this, PlayState* play) { if (EnFw_DoBounce(this, 3, 8.0f) && this->bounceCnt == 0) { this->returnToParentTimer = Rand_S16Offset(300, 150); this->actionFunc = EnFw_Run; } } -void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { +void EnFw_Run(EnFw* this, PlayState* play) { f32 tmpAngle; s16 phi_v0; f32 facingDir; @@ -233,7 +233,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { return; } - if (this->damageTimer == 0 && this->explosionTimer == 0 && EnFw_CheckCollider(this, globalCtx)) { + if (this->damageTimer == 0 && this->explosionTimer == 0 && EnFw_CheckCollider(this, play)) { if (this->actor.parent->colChkInfo.health > 0) { if (!this->lastDmgHook) { this->actor.velocity.y = 6.0f; @@ -257,14 +257,14 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { } if (this->explosionTimer == 0) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->bompPos.x, this->bompPos.y, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->bompPos.x, this->bompPos.y, this->bompPos.z, 0, 0, 0x600, 0); if (bomb != NULL) { bomb->timer = 0; } flareDancer = this->actor.parent; flareDancer->params |= 0x4000; - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xA0); Actor_Kill(&this->actor); return; } @@ -303,7 +303,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { this->actor.world.rot = this->actor.shape.rot; - if (this->slideTimer == 0 && EnFw_PlayerInRange(this, globalCtx)) { + if (this->slideTimer == 0 && EnFw_PlayerInRange(this, play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_SURP); this->slideSfxTimer = 8; this->slideTimer = 8; @@ -333,7 +333,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { } } -void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) { +void EnFw_TurnToParentInitPos(EnFw* this, PlayState* play) { s16 angleToParentInit; angleToParentInit = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.parent->home.pos); @@ -349,7 +349,7 @@ void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) { } } -void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) { +void EnFw_JumpToParentInitPos(EnFw* this, PlayState* play) { if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y <= 0.0f) { this->actor.parent->params |= 0x8000; Actor_Kill(&this->actor); @@ -359,27 +359,27 @@ void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) { } } -void EnFw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Update(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; SkelAnime_Update(&this->skelAnime); if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { // not attached to hookshot. Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 20.0f, 0.0f, 5); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 20.0f, 0.0f, 5); + this->actionFunc(this, play); if (this->damageTimer == 0 && this->explosionTimer == 0 && this->actionFunc == EnFw_Run) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 EnFw_OverrideLimbDraw(GlobalContext* globalContext, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnFw_OverrideLimbDraw(PlayState* playState, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return false; } -void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnFw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnFw* this = (EnFw*)thisx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -396,15 +396,15 @@ void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Collider_UpdateSpheres(limbIndex, &this->collider); } -void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Draw(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; EnFw_UpdateDust(this); Matrix_Push(); - EnFw_DrawDust(this, globalCtx); + EnFw_DrawDust(this, play); Matrix_Pop(); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFw_OverrideLimbDraw, EnFw_PostLimbDraw, this); } @@ -450,7 +450,7 @@ void EnFw_UpdateDust(EnFw* this) { } } -void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { +void EnFw_DrawDust(EnFw* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; @@ -460,10 +460,10 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { s16 i; s16 idx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); firstDone = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { FrameInterpolation_RecordOpenChild(eff, eff->epoch); @@ -480,9 +480,9 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = eff->timer * (8.0f / eff->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); @@ -492,5 +492,5 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h index 79279a71f..47f213ea3 100644 --- a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h +++ b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h @@ -6,7 +6,7 @@ struct EnFw; -typedef void (*EnFwActionFunc)(struct EnFw* this, GlobalContext* globalCtx); +typedef void (*EnFwActionFunc)(struct EnFw* this, PlayState* play); typedef struct { /* 0x0000 */ u8 type; diff --git a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 7ee3412b6..982dd1e94 100644 --- a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -4,47 +4,47 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_10) -void EnFz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFz_Init(Actor* thisx, PlayState* play); +void EnFz_Destroy(Actor* thisx, PlayState* play); +void EnFz_Update(Actor* thisx, PlayState* play); +void EnFz_Draw(Actor* thisx, PlayState* play); -void EnFz_UpdateTargetPos(EnFz* this, GlobalContext* globalCtx); +void EnFz_UpdateTargetPos(EnFz* this, PlayState* play); // Stationary Freezard void EnFz_SetupBlowSmokeStationary(EnFz* this); -void EnFz_BlowSmokeStationary(EnFz* this, GlobalContext* globalCtx); +void EnFz_BlowSmokeStationary(EnFz* this, PlayState* play); // Moving Freezard that can vanish and reappear -void EnFz_Wait(EnFz* this, GlobalContext* globalCtx); +void EnFz_Wait(EnFz* this, PlayState* play); void EnFz_SetupAppear(EnFz* this); -void EnFz_Appear(EnFz* this, GlobalContext* globalCtx); +void EnFz_Appear(EnFz* this, PlayState* play); void EnFz_SetupAimForMove(EnFz* this); -void EnFz_AimForMove(EnFz* this, GlobalContext* globalCtx); +void EnFz_AimForMove(EnFz* this, PlayState* play); void EnFz_SetupMoveTowardsPlayer(EnFz* this); -void EnFz_MoveTowardsPlayer(EnFz* this, GlobalContext* globalCtx); +void EnFz_MoveTowardsPlayer(EnFz* this, PlayState* play); void EnFz_SetupAimForFreeze(EnFz* this); -void EnFz_AimForFreeze(EnFz* this, GlobalContext* globalCtx); -void EnFz_SetupBlowSmoke(EnFz* this, GlobalContext* globalCtx); -void EnFz_BlowSmoke(EnFz* this, GlobalContext* globalCtx); +void EnFz_AimForFreeze(EnFz* this, PlayState* play); +void EnFz_SetupBlowSmoke(EnFz* this, PlayState* play); +void EnFz_BlowSmoke(EnFz* this, PlayState* play); void EnFz_SetupDisappear(EnFz* this); -void EnFz_Disappear(EnFz* this, GlobalContext* globalCtx); +void EnFz_Disappear(EnFz* this, PlayState* play); void EnFz_SetupWait(EnFz* this); // Killed with fire source void EnFz_SetupMelt(EnFz* this); -void EnFz_Melt(EnFz* this, GlobalContext* globalCtx); +void EnFz_Melt(EnFz* this, PlayState* play); // Death -void EnFz_SetupDespawn(EnFz* this, GlobalContext* globalCtx); -void EnFz_Despawn(EnFz* this, GlobalContext* globalCtx); +void EnFz_SetupDespawn(EnFz* this, PlayState* play); +void EnFz_Despawn(EnFz* this, PlayState* play); // Ice Smoke Effects void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale); void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale, f32 xyScaleTarget, s16 primAlpha, u8 isTimerMod8); -void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx); -void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx); +void EnFz_UpdateIceSmoke(EnFz* this, PlayState* play); +void EnFz_DrawIceSmoke(EnFz* this, PlayState* play); const ActorInit En_Fz_InitVars = { ACTOR_EN_FZ, @@ -157,21 +157,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnFz_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Init(Actor* thisx, PlayState* play) { EnFz* this = (EnFz*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 6; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinderType1(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinderType1(play, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinderType1(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinderType1(play, &this->collider2, &this->actor, &sCylinderInit2); - Collider_InitCylinder(globalCtx, &this->collider3); - Collider_SetCylinderType1(globalCtx, &this->collider3, &this->actor, &sCylinderInit3); + Collider_InitCylinder(play, &this->collider3); + Collider_SetCylinderType1(play, &this->collider3, &this->actor, &sCylinderInit3); Actor_SetScale(&this->actor, 0.008f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -201,18 +201,18 @@ void EnFz_Init(Actor* thisx, GlobalContext* globalCtx) { EnFz_SetupBlowSmokeStationary(this); } - EnFz_UpdateTargetPos(this, globalCtx); + EnFz_UpdateTargetPos(this, play); } -void EnFz_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Destroy(Actor* thisx, PlayState* play) { EnFz* this = (EnFz*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); - Collider_DestroyCylinder(globalCtx, &this->collider3); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); + Collider_DestroyCylinder(play, &this->collider3); } -void EnFz_UpdateTargetPos(EnFz* this, GlobalContext* globalCtx) { +void EnFz_UpdateTargetPos(EnFz* this, PlayState* play) { Vec3f pos; Vec3f hitPos; Vec3f vec1; @@ -229,7 +229,7 @@ void EnFz_UpdateTargetPos(EnFz* this, GlobalContext* globalCtx) { vec1.z = 220.0f; Matrix_MultVec3f(&vec1, &this->wallHitPos); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &pos, &this->wallHitPos, &hitPos, &hitPoly, true, false, false, + if (BgCheck_EntityLineTest1(&play->colCtx, &pos, &this->wallHitPos, &hitPos, &hitPoly, true, false, false, true, &bgId)) { Math_Vec3f_Copy(&this->wallHitPos, &hitPos); } @@ -248,7 +248,7 @@ s32 EnFz_ReachedTarget(EnFz* this, Vec3f* vec) { } } -void EnFz_Damaged(EnFz* this, GlobalContext* globalCtx, Vec3f* vec, s32 numEffects, f32 unkFloat) { +void EnFz_Damaged(EnFz* this, PlayState* play, Vec3f* vec, s32 numEffects, f32 unkFloat) { s32 i; Vec3f pos; Vec3f vel; @@ -277,10 +277,10 @@ void EnFz_Damaged(EnFz* this, GlobalContext* globalCtx, Vec3f* vec, s32 numEffec vel.x = Rand_CenteredFloat(10.0f); vel.y = Rand_ZeroFloat(10.0f) + 2.0f; vel.z = Rand_CenteredFloat(10.0f); - EffectSsEnIce_Spawn(globalCtx, &pos, scale, &vel, &accel, &primColor, &envColor, life); + EffectSsEnIce_Spawn(play, &pos, scale, &vel, &accel, &primColor, &envColor, life); } - CollisionCheck_SpawnShieldParticles(globalCtx, vec); + CollisionCheck_SpawnShieldParticles(play, vec); } void EnFz_SpawnIceSmokeHiddenState(EnFz* this) { @@ -320,12 +320,12 @@ void EnFz_SpawnIceSmokeActiveState(EnFz* this) { } } -void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) { +void EnFz_ApplyDamage(EnFz* this, PlayState* play) { Vec3f vec; if (this->isMoving && ((this->actor.bgCheckFlags & 8) || - (Actor_TestFloorInDirection(&this->actor, globalCtx, 60.0f, this->actor.world.rot.y) == 0))) { + (Actor_TestFloorInDirection(&this->actor, play, 60.0f, this->actor.world.rot.y) == 0))) { this->actor.bgCheckFlags &= ~8; this->isMoving = false; this->speedXZ = 0.0f; @@ -353,7 +353,7 @@ void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y; vec.z = this->actor.world.pos.z; - EnFz_Damaged(this, globalCtx, &vec, 10, 0.0f); + EnFz_Damaged(this, play, &vec, 10, 0.0f); this->unusedCounter++; } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FREEZAD_DEAD); @@ -361,8 +361,8 @@ void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y; vec.z = this->actor.world.pos.z; - EnFz_Damaged(this, globalCtx, &vec, 30, 10.0f); - EnFz_SetupDespawn(this, globalCtx); + EnFz_Damaged(this, play, &vec, 30, 10.0f); + EnFz_SetupDespawn(this, play); } } } else { @@ -391,7 +391,7 @@ void EnFz_SetupDisappear(EnFz* this) { this->actionFunc = EnFz_Disappear; } -void EnFz_Disappear(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Disappear(EnFz* this, PlayState* play) { this->envAlpha -= 16; if (this->envAlpha > 255) { @@ -414,7 +414,7 @@ void EnFz_SetupWait(EnFz* this) { this->actor.world.pos.z = this->posOrigin.z; } -void EnFz_Wait(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Wait(EnFz* this, PlayState* play) { if ((this->timer == 0) && (this->actor.xzDistToPlayer < 400.0f)) { EnFz_SetupAppear(this); } @@ -427,7 +427,7 @@ void EnFz_SetupAppear(EnFz* this) { this->actionFunc = EnFz_Appear; } -void EnFz_Appear(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Appear(EnFz* this, PlayState* play) { if (this->timer == 0) { this->envAlpha += 8; if (this->envAlpha > 255) { @@ -450,7 +450,7 @@ void EnFz_SetupAimForMove(EnFz* this) { this->actor.gravity = -1.0f; } -void EnFz_AimForMove(EnFz* this, GlobalContext* globalCtx) { +void EnFz_AimForMove(EnFz* this, PlayState* play) { EnFz_SetYawTowardsPlayer(this); if (this->timer == 0) { @@ -466,7 +466,7 @@ void EnFz_SetupMoveTowardsPlayer(EnFz* this) { this->speedXZ = 4.0f; } -void EnFz_MoveTowardsPlayer(EnFz* this, GlobalContext* globalCtx) { +void EnFz_MoveTowardsPlayer(EnFz* this, PlayState* play) { if ((this->timer == 0) || !this->isMoving) { EnFz_SetupAimForFreeze(this); } @@ -480,22 +480,22 @@ void EnFz_SetupAimForFreeze(EnFz* this) { this->actor.speedXZ = 0.0f; } -void EnFz_AimForFreeze(EnFz* this, GlobalContext* globalCtx) { +void EnFz_AimForFreeze(EnFz* this, PlayState* play) { EnFz_SetYawTowardsPlayer(this); if (this->timer == 0) { - EnFz_SetupBlowSmoke(this, globalCtx); + EnFz_SetupBlowSmoke(this, play); } } -void EnFz_SetupBlowSmoke(EnFz* this, GlobalContext* globalCtx) { +void EnFz_SetupBlowSmoke(EnFz* this, PlayState* play) { this->state = 1; this->timer = 80; this->actionFunc = EnFz_BlowSmoke; - EnFz_UpdateTargetPos(this, globalCtx); + EnFz_UpdateTargetPos(this, play); } -void EnFz_BlowSmoke(EnFz* this, GlobalContext* globalCtx) { +void EnFz_BlowSmoke(EnFz* this, PlayState* play) { Vec3f vec1; Vec3f pos; Vec3f velocity; @@ -543,7 +543,7 @@ void EnFz_BlowSmoke(EnFz* this, GlobalContext* globalCtx) { } } -void EnFz_SetupDespawn(EnFz* this, GlobalContext* globalCtx) { +void EnFz_SetupDespawn(EnFz* this, PlayState* play) { this->state = 0; this->updateBgInfo = true; this->isFreezing = false; @@ -555,12 +555,12 @@ void EnFz_SetupDespawn(EnFz* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x60); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); this->actionFunc = EnFz_Despawn; } -void EnFz_Despawn(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Despawn(EnFz* this, PlayState* play) { if (this->timer == 0) { Actor_Kill(&this->actor); } @@ -576,7 +576,7 @@ void EnFz_SetupMelt(EnFz* this) { this->speedXZ = 0.0f; } -void EnFz_Melt(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Melt(EnFz* this, PlayState* play) { Math_StepToF(&this->actor.scale.y, 0.0006f, 0.0002f); if (this->actor.scale.y < 0.006f) { @@ -592,7 +592,7 @@ void EnFz_Melt(EnFz* this, GlobalContext* globalCtx) { } if (this->envAlpha == 0) { - EnFz_SetupDespawn(this, globalCtx); + EnFz_SetupDespawn(this, play); } } @@ -606,7 +606,7 @@ void EnFz_SetupBlowSmokeStationary(EnFz* this) { this->actor.gravity = -1.0f; } -void EnFz_BlowSmokeStationary(EnFz* this, GlobalContext* globalCtx) { +void EnFz_BlowSmokeStationary(EnFz* this, PlayState* play) { Vec3f vec1; Vec3f pos; Vec3f velocity; @@ -616,7 +616,7 @@ void EnFz_BlowSmokeStationary(EnFz* this, GlobalContext* globalCtx) { if (this->counter & 0xC0) { EnFz_SetYawTowardsPlayer(this); - EnFz_UpdateTargetPos(this, globalCtx); + EnFz_UpdateTargetPos(this, play); } else { isTimerMod8 = false; primAlpha = 150; @@ -662,7 +662,7 @@ static EnFzSpawnIceSmokeFunc iceSmokeSpawnFuncs[] = { EnFz_SpawnIceSmokeActiveState, }; -void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Update(Actor* thisx, PlayState* play) { EnFz* this = (EnFz*)thisx; s32 pad; @@ -681,17 +681,17 @@ void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 50.0f); - EnFz_ApplyDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnFz_ApplyDamage(this, play); + this->actionFunc(this, play); if (this->isDespawning == false) { Collider_UpdateCylinder(&this->actor, &this->collider1); Collider_UpdateCylinder(&this->actor, &this->collider2); if (this->isFreezing) { if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } } @@ -699,14 +699,14 @@ void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (this->updateBgInfo) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); } iceSmokeSpawnFuncs[this->state](this); - EnFz_UpdateIceSmoke(this, globalCtx); + EnFz_UpdateIceSmoke(this, play); } -void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { gFreezardIntactDL, // Body fully intact (5 or 6 health) gFreezardTopRightHornChippedDL, // Top right horn chipped off (from Freezards perspective) (3 or 4 health) @@ -718,19 +718,19 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { index = (6 - this->actor.colChkInfo.health) >> 1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actor.colChkInfo.health == 0) { index = 2; } if (this->isActive) { - func_8002ED80(&this->actor, globalCtx, 0); - func_80093D84(globalCtx->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->state.frames & 0x7F, 32, 32, 1, 0, - (2 * globalCtx->state.frames) & 0x7F, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->state.frames & 0x7F, 32, 32, 1, 0, + (2 * play->state.frames) & 0x7F, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), 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); @@ -739,8 +739,8 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, displayLists[index]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); - EnFz_DrawIceSmoke(this, globalCtx); + CLOSE_DISPS(play->state.gfxCtx); + EnFz_DrawIceSmoke(this, play); } void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale) { @@ -790,7 +790,7 @@ void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* ac } } -void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx) { +void EnFz_UpdateIceSmoke(EnFz* this, PlayState* play) { EnFzEffectSsIceSmoke* iceSmoke = this->iceSmoke; s16 i; Vec3f pos; @@ -838,7 +838,7 @@ void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx) { this->collider3.dim.pos.x = (s16)iceSmoke->pos.x; this->collider3.dim.pos.y = (s16)iceSmoke->pos.y; this->collider3.dim.pos.z = (s16)iceSmoke->pos.z; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider3.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider3.base); } pos.x = iceSmoke->pos.x; @@ -856,15 +856,15 @@ void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx) { } } -void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) { +void EnFz_DrawIceSmoke(EnFz* this, PlayState* play) { EnFzEffectSsIceSmoke* iceSmoke = this->iceSmoke; s16 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 texLoaded = false; OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->iceSmoke); i++) { FrameInterpolation_RecordOpenChild(iceSmoke, iceSmoke->epoch); @@ -879,10 +879,10 @@ void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, iceSmoke->primAlpha); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 3 * (iceSmoke->timer + (3 * i)), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 3 * (iceSmoke->timer + (3 * i)), 15 * (iceSmoke->timer + (3 * i)), 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(iceSmoke->pos.x, iceSmoke->pos.y, iceSmoke->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(iceSmoke->xyScale, iceSmoke->xyScale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h index 7dab02bbc..f2374c316 100644 --- a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -6,7 +6,7 @@ struct EnFz; -typedef void (*EnFzActionFunc)(struct EnFz*, GlobalContext*); +typedef void (*EnFzActionFunc)(struct EnFz*, PlayState*); typedef void (*EnFzSpawnIceSmokeFunc)(struct EnFz*); typedef struct { diff --git a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index f4740dbb3..548b3412e 100644 --- a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -21,23 +21,23 @@ typedef enum { /* 1 */ MOVE_HOME } GSwitchMoveState; -void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_DrawRupee(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_DrawPot(Actor* thisx, GlobalContext* globalCtx); +void EnGSwitch_Init(Actor* thisx, PlayState* play); +void EnGSwitch_Destroy(Actor* thisx, PlayState* play); +void EnGSwitch_Update(Actor* thisx, PlayState* play); +void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play); +void EnGSwitch_DrawPot(Actor* thisx, PlayState* play); -void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_WaitForObject(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_ArcheryPot(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_Kill(EnGSwitch* this, GlobalContext* globalCtx); +void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, PlayState* play); +void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, PlayState* play); +void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play); +void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, PlayState* play); +void EnGSwitch_GalleryRupee(EnGSwitch* this, PlayState* play); +void EnGSwitch_ArcheryPot(EnGSwitch* this, PlayState* play); +void EnGSwitch_Kill(EnGSwitch* this, PlayState* play); void EnGSwitch_SpawnEffects(EnGSwitch* this, Vec3f* pos, s16 scale, s16 colorIdx); -void EnGSwitch_UpdateEffects(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx); +void EnGSwitch_UpdateEffects(EnGSwitch* this, PlayState* play); +void EnGSwitch_DrawEffects(EnGSwitch* this, PlayState* play); static s16 sCollectedCount = 0; @@ -79,7 +79,7 @@ const ActorInit En_G_Switch_InitVars = { NULL, }; -void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_Init(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; @@ -101,7 +101,7 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { // "maximum number of checks" osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 最大チェック数 ☆☆☆☆☆ %d\n" VT_RST, this->silverCount); osSyncPrintf("\n\n"); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { // This is a reference to Hokuto no Ken osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); @@ -115,8 +115,8 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 子スイッチ発生 ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); this->colorIdx = 5; this->numEffects = 20; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.draw = EnGSwitch_DrawRupee; this->actor.shape.yOffset = 700.0f; @@ -126,7 +126,7 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 700.0f; } - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); } else { @@ -144,14 +144,14 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ やぶさめぶち抜き壷 ☆☆☆☆☆ \n" VT_RST); this->actor.gravity = -3.0f; this->colorIdx = Rand_ZeroFloat(2.99f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.scale.x = 0.25f; this->actor.scale.y = 0.45f; this->actor.scale.z = 0.25f; this->collider.info.bumper.dmgFlags = 0x1F820; this->objId = OBJECT_TSUBO; - this->objIndex = Object_GetIndex(&globalCtx->objectCtx, this->objId); + this->objIndex = Object_GetIndex(&play->objectCtx, this->objId); if (this->objIndex < 0) { Actor_Kill(&this->actor); // "what?" @@ -173,8 +173,8 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.05f); } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.draw = EnGSwitch_DrawRupee; this->collider.dim.radius = 20; this->collider.dim.height = 60; @@ -184,14 +184,14 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGSwitch_Break(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_Break(EnGSwitch* this, PlayState* play) { Vec3f randPos; Vec3f hitPos; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -204,10 +204,10 @@ void EnGSwitch_Break(EnGSwitch* this, GlobalContext* globalCtx) { hitPos.x = this->collider.info.bumper.hitPos.x; hitPos.y = this->collider.info.bumper.hitPos.y; hitPos.z = this->collider.info.bumper.hitPos.z; - EffectSsHitMark_SpawnCustomScale(globalCtx, EFFECT_HITMARK_WHITE, 700, &hitPos); + EffectSsHitMark_SpawnCustomScale(play, EFFECT_HITMARK_WHITE, 700, &hitPos); if (this->type == ENGSWITCH_ARCHERY_POT) { velocity.y = 15.0f; - EffectSsExtra_Spawn(globalCtx, &hitPos, &velocity, &accel, 5, 2); + EffectSsExtra_Spawn(play, &hitPos, &velocity, &accel, 5, 2); } if (this->type == ENGSWITCH_TARGET_RUPEE) { for (i = 0; i < this->numEffects; i++) { @@ -216,16 +216,16 @@ void EnGSwitch_Break(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_WaitForObject(EnGSwitch* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objIndex].segment); +void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objIndex].segment); this->actor.objBankIndex = this->objIndex; this->actor.draw = EnGSwitch_DrawPot; this->actionFunc = EnGSwitch_ArcheryPot; } } -void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, PlayState* play) { static s8 majorScale[] = { 0, 2, 4, 5, 7 }; if (this->noteIndex < sCollectedCount) { @@ -242,19 +242,19 @@ void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 時はまさに世紀末〜 ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); // "Last!" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ らすとぉ! ☆☆☆☆☆ \n" VT_RST); - if ((globalCtx->sceneNum == SCENE_MEN) && (this->actor.room == 2)) { - Flags_SetTempClear(globalCtx, this->actor.room); + if ((play->sceneNum == SCENE_MEN) && (this->actor.room == 2)) { + Flags_SetTempClear(play, this->actor.room); } else { func_80078884(NA_SE_SY_CORRECT_CHIME); - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } func_80078884(NA_SE_SY_GET_RUPY); Actor_Kill(&this->actor); } } -void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.shape.rot.y += 0x800; if (this->actor.xyzDistToPlayerSq < 900.0f) { @@ -272,8 +272,8 @@ void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.shape.rot.y += 0x3C0; if (this->killTimer == 0) { @@ -288,7 +288,7 @@ void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_GalleryRupee(EnGSwitch* this, PlayState* play) { EnSyatekiItm* gallery; this->actor.shape.rot.y += 0x3C0; @@ -366,7 +366,7 @@ void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_GET_RUPY); // "Yeah !" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ いぇぇーす!HIT!! ☆☆☆☆☆ %d\n" VT_RST, gallery->hitCount); - EnGSwitch_Break(this, globalCtx); + EnGSwitch_Break(this, play); this->killTimer = 50; this->broken = true; this->actionFunc = EnGSwitch_Kill; @@ -375,7 +375,7 @@ void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_ArcheryPot(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_ArcheryPot(EnGSwitch* this, PlayState* play) { s32 i; s16 angle; Vec3f* thisPos = &this->actor.world.pos; @@ -416,29 +416,29 @@ void EnGSwitch_ArcheryPot(EnGSwitch* this, GlobalContext* globalCtx) { scale = 30.0f + Rand_ZeroOne() * 130.0f; - EffectSsKakera_Spawn(globalCtx, &pos, &vel, thisPos, -240, phi_s0, 10, 10, 0, scale, 0, 0x20, 60, + EffectSsKakera_Spawn(play, &pos, &vel, thisPos, -240, phi_s0, 10, 10, 0, scale, 0, 0x20, 60, KAKERA_COLOR_NONE, OBJECT_TSUBO, object_tsubo_DL_001960); } - func_80033480(globalCtx, thisPos, 30.0f, 4, 20, 50, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, thisPos, 40, NA_SE_EV_POT_BROKEN); - EnGSwitch_Break(this, globalCtx); + func_80033480(play, thisPos, 30.0f, 4, 20, 50, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, thisPos, 40, NA_SE_EV_POT_BROKEN); + EnGSwitch_Break(this, play); this->killTimer = 50; this->broken = true; this->actionFunc = EnGSwitch_Kill; } } -void EnGSwitch_Kill(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_Kill(EnGSwitch* this, PlayState* play) { if (this->killTimer == 0) { Actor_Kill(&this->actor); } } -void EnGSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_Update(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->killTimer != 0) { this->killTimer--; } @@ -451,35 +451,35 @@ void EnGSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->type != ENGSWITCH_SILVER_TRACKER) && (this->type != ENGSWITCH_SILVER_RUPEE) && (this->type != ENGSWITCH_TARGET_RUPEE)) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 0x1C); } if (this->actor.draw != NULL) { if (this->type == ENGSWITCH_TARGET_RUPEE) { - EnGSwitch_UpdateEffects(this, globalCtx); + EnGSwitch_UpdateEffects(this, play); } if ((this->actionFunc != EnGSwitch_Kill) && (this->actionFunc != EnGSwitch_SilverRupeeIdle)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } if (BREG(0) && (this->type == ENGSWITCH_SILVER_TRACKER)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } -void EnGSwitch_DrawPot(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_DrawPot(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; if (!this->broken) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(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_tsubo_DL_0017C0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -489,26 +489,26 @@ static void* sRupeeTextures[] = { static void* sRupeeTexturesNew[] = { GID_RUPEE_GREEN, GID_RUPEE_BLUE, GID_RUPEE_RED, GID_RUPEE_PURPLE, GID_RUPEE_GOLD, }; -void EnGSwitch_DrawRupee(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; if (!this->broken) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (CVar_GetS32("gNewDrops", 0) !=0) { - 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); if (this->type == ENGSWITCH_TARGET_RUPEE) { - GetItem_Draw(globalCtx, sRupeeTexturesNew[this->colorIdx]); + GetItem_Draw(play, sRupeeTexturesNew[this->colorIdx]); } else { gsDPSetGrayscaleColor(POLY_OPA_DISP++, 255, 255, 255, 255); gsSPGrayscale(POLY_OPA_DISP++, true); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gGiRupeeInnerDL); gSPDisplayList(POLY_OPA_DISP++, gGiGoldRupeeInnerColorDL); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gGiRupeeOuterDL); gSPDisplayList(POLY_OPA_DISP++, gGiGoldRupeeOuterColorDL); gsSPGrayscale(POLY_OPA_DISP++, false); @@ -517,10 +517,10 @@ void EnGSwitch_DrawRupee(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTextures[this->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (this->type == ENGSWITCH_TARGET_RUPEE) { - EnGSwitch_DrawEffects(this, globalCtx); + EnGSwitch_DrawEffects(this, play); } } @@ -553,7 +553,7 @@ void EnGSwitch_SpawnEffects(EnGSwitch* this, Vec3f* pos, s16 scale, s16 colorIdx } } -void EnGSwitch_UpdateEffects(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_UpdateEffects(EnGSwitch* this, PlayState* play) { Vec3f temp; s16 i; EnGSwitchEffect* effect = this->effects; @@ -581,15 +581,15 @@ void EnGSwitch_UpdateEffects(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnGSwitch_DrawEffects(EnGSwitch* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; EnGSwitchEffect* effect = this->effects; s16 i; f32 scale; s32 pad; OPEN_DISPS(gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); for (i = 0; i < this->numEffects; i++, effect++) { if (effect->flag) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); @@ -599,7 +599,7 @@ void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { Matrix_RotateX(effect->rot.x, MTXMODE_APPLY); Matrix_RotateY(effect->rot.y, MTXMODE_APPLY); Matrix_RotateZ(effect->rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTextures[effect->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); diff --git a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h index 38b6de292..d2fb4b38d 100644 --- a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h +++ b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h @@ -6,7 +6,7 @@ struct EnGSwitch; -typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, GlobalContext*); +typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, PlayState*); typedef enum { /* 0 */ GSWITCH_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index 849ea96c1..2ae39f4d6 100644 --- a/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/soh/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGanonMant_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGanonMant_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGanonMant_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGanonMant_Init(Actor* thisx, PlayState* play); +void EnGanonMant_Destroy(Actor* thisx, PlayState* play); +void EnGanonMant_Update(Actor* thisx, PlayState* play); +void EnGanonMant_Draw(Actor* thisx, PlayState* play); const ActorInit En_Ganon_Mant_InitVars = { ACTOR_EN_GANON_MANT, @@ -100,13 +100,13 @@ static u16 sVerticesMap[GANON_MANT_NUM_STRANDS * GANON_MANT_NUM_JOINTS] = { #include "overlays/ovl_En_Ganon_Mant/ovl_En_Ganon_Mant.h" -void EnGanonMant_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Init(Actor* thisx, PlayState* play) { EnGanonMant* this = (EnGanonMant*)thisx; this->actor.flags &= ~ACTOR_FLAG_0; } -void EnGanonMant_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Destroy(Actor* thisx, PlayState* play) { } /** @@ -154,7 +154,7 @@ void EnGanonMant_Tear(EnGanonMant* this) { /** * Updates the dynamic strands that control the shape and motion of the cloak */ -void EnGanonMant_UpdateStrand(GlobalContext* globalCtx, EnGanonMant* this, Vec3f* root, Vec3f* pos, Vec3f* nextPos, +void EnGanonMant_UpdateStrand(PlayState* play, EnGanonMant* this, Vec3f* root, Vec3f* pos, Vec3f* nextPos, Vec3f* rot, Vec3f* vel, s16 strandNum) { f32 xDiff; f32 zDiff; @@ -334,7 +334,7 @@ void EnGanonMant_UpdateVertices(EnGanonMant* this) { } } -void EnGanonMant_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Update(Actor* thisx, PlayState* play) { EnGanonMant* this = (EnGanonMant*)thisx; BossGanon* ganon = (BossGanon*)this->actor.parent; @@ -360,17 +360,17 @@ void EnGanonMant_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGanonMant_DrawCloak(GlobalContext* globalCtx, EnGanonMant* this) { +void EnGanonMant_DrawCloak(PlayState* play, EnGanonMant* this) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // Invalidate cape texture as it may have been torn gSPInvalidateTexCache(POLY_OPA_DISP++, gMantTex); Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); - 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); // set texture @@ -387,10 +387,10 @@ void EnGanonMant_DrawCloak(GlobalContext* globalCtx, EnGanonMant* this) { // draw cloak gSPDisplayList(POLY_OPA_DISP++, gMantDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Draw(Actor* thisx, PlayState* play) { EnGanonMant* this = (EnGanonMant*)thisx; f32 xDiff; f32 pitch; @@ -462,7 +462,7 @@ void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx) { } // Update the strand joints - EnGanonMant_UpdateStrand(globalCtx, this, &this->strands[strandIdx].root, this->strands[strandIdx].joints, + EnGanonMant_UpdateStrand(play, this, &this->strands[strandIdx].root, this->strands[strandIdx].joints, this->strands[nextStrandIdx].joints, this->strands[strandIdx].rotations, this->strands[strandIdx].velocities, strandIdx); Matrix_Pop(); @@ -471,5 +471,5 @@ void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx) { this->updateHasRun = false; } - EnGanonMant_DrawCloak(globalCtx, this); + EnGanonMant_DrawCloak(play, this); } diff --git a/soh/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c b/soh/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c index 8e3d3206d..c1598f60c 100644 --- a/soh/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c +++ b/soh/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGanonOrgan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGanonOrgan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGanonOrgan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGanonOrgan_Init(Actor* thisx, PlayState* play); +void EnGanonOrgan_Destroy(Actor* thisx, PlayState* play); +void EnGanonOrgan_Update(Actor* thisx, PlayState* play); +void EnGanonOrgan_Draw(Actor* thisx, PlayState* play); const ActorInit En_Ganon_Organ_InitVars = { ACTOR_EN_GANON_ORGAN, @@ -31,14 +31,14 @@ const ActorInit En_Ganon_Organ_InitVars = { #include "overlays/ovl_En_Ganon_Organ/ovl_En_Ganon_Organ.h" -void EnGanonOrgan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Init(Actor* thisx, PlayState* play) { thisx->flags &= ~ACTOR_FLAG_0; } -void EnGanonOrgan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Destroy(Actor* thisx, PlayState* play) { } -void EnGanonOrgan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Update(Actor* thisx, PlayState* play) { BossGanon* dorf; osSyncPrintf("ORGAN MOVE 1\n"); @@ -86,22 +86,22 @@ Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) { return displayList; } -void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Draw(Actor* thisx, PlayState* play) { BossGanon* dorf = (BossGanon*)thisx->parent; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); osSyncPrintf("ORGAN DRAW 1\n"); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((thisx->params == 1) && (dorf->organAlpha != 255)) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A280BC(globalCtx->state.gfxCtx, dorf)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A28148(globalCtx->state.gfxCtx, dorf)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A280BC(play->state.gfxCtx, dorf)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A28148(play->state.gfxCtx, dorf)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, EnGanonOrgan_EmptyDList(play->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnGanonOrgan_EmptyDList(play->state.gfxCtx)); } Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sRoomOrganAndFloorDL); @@ -109,5 +109,5 @@ void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("ORGAN DRAW 2\n"); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c index f2b6c8638..dff83254f 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -10,22 +10,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnGb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGb_Init(Actor* thisx, PlayState* play); +void EnGb_Destroy(Actor* thisx, PlayState* play); +void EnGb_Update(Actor* thisx, PlayState* play); +void EnGb_Draw(Actor* thisx, PlayState* play); -void func_80A2F83C(EnGb* this, GlobalContext* globalCtx); -void func_80A2FC70(EnGb* this, GlobalContext* globalCtx); -void func_80A2FA50(EnGb* this, GlobalContext* globalCtx); -void func_80A2F9C0(EnGb* this, GlobalContext* globalCtx); -void func_80A2F94C(EnGb* this, GlobalContext* globalCtx); -void func_80A2FB40(EnGb* this, GlobalContext* globalCtx); -void func_80A2FBB0(EnGb* this, GlobalContext* globalCtx); -void func_80A2FC0C(EnGb* this, GlobalContext* globalCtx); +void func_80A2F83C(EnGb* this, PlayState* play); +void func_80A2FC70(EnGb* this, PlayState* play); +void func_80A2FA50(EnGb* this, PlayState* play); +void func_80A2F9C0(EnGb* this, PlayState* play); +void func_80A2F94C(EnGb* this, PlayState* play); +void func_80A2FB40(EnGb* this, PlayState* play); +void func_80A2FBB0(EnGb* this, PlayState* play); +void func_80A2FC0C(EnGb* this, PlayState* play); -void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx); -void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx); +void EnGb_DrawCagedSouls(EnGb* this, PlayState* play); +void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play); const ActorInit En_Gb_InitVars = { ACTOR_EN_GB, @@ -150,7 +150,7 @@ void func_80A2F180(EnGb* this) { } } -void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGb_Init(Actor* thisx, PlayState* play) { EnGb* this = (EnGb*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -161,18 +161,18 @@ void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gPoeSellerCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gPoeSellerSkel, &gPoeSellerIdleAnim, this->jointTable, + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + SkelAnime_InitFlex(play, &this->skelAnime, &gPoeSellerSkel, &gPoeSellerIdleAnim, this->jointTable, this->morphTable, 12); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->dyna.actor, &sCylinderInit); for (i = 0; i < ARRAY_COUNT(sBottlesCylindersInit); i++) { - Collider_InitCylinder(globalCtx, &this->bottlesColliders[i]); - Collider_SetCylinderType1(globalCtx, &this->bottlesColliders[i], &this->dyna.actor, &sBottlesCylindersInit[i]); + Collider_InitCylinder(play, &this->bottlesColliders[i]); + Collider_SetCylinderType1(play, &this->bottlesColliders[i], &this->dyna.actor, &sBottlesCylindersInit[i]); } - this->light = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->light = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, 255, 255, 255, 200); @@ -218,12 +218,12 @@ void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A2F83C; } -void EnGb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGb_Destroy(Actor* thisx, PlayState* play) { EnGb* this = (EnGb*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->light); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->light); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80A2F608(EnGb* this) { @@ -271,8 +271,8 @@ void func_80A2F7C0(EnGb* this) { this->actionFunc = func_80A2FC70; } -void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2F83C(EnGb* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!func_80A2F760(this)) { if (this->actionTimer != 0) { @@ -282,8 +282,8 @@ void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) { return; } } - if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) { - switch (func_8002F368(globalCtx)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { + switch (func_8002F368(play)) { case EXCH_ITEM_NONE: func_80A2F180(this); this->actionFunc = func_80A2F94C; @@ -300,12 +300,12 @@ void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) { return; } if (this->dyna.actor.xzDistToPlayer < 100.0f) { - func_8002F298(&this->dyna.actor, globalCtx, 100.0f, EXCH_ITEM_POE); + func_8002F298(&this->dyna.actor, play, 100.0f, EXCH_ITEM_POE); } } -void func_80A2F94C(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80A2F94C(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { if (!(gSaveContext.infTable[0xB] & 0x40)) { gSaveContext.infTable[0xB] |= 0x40; } @@ -314,25 +314,25 @@ void func_80A2F94C(EnGb* this, GlobalContext* globalCtx) { } } -void func_80A2F9C0(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80A2F9C0(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { if (!(gSaveContext.infTable[0xB] & 0x40)) { gSaveContext.infTable[0xB] |= 0x40; } func_80A2F180(this); - Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); Rupees_ChangeBy(10); this->actionFunc = func_80A2F83C; } } -void func_80A2FA50(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80A2FA50(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { if (!(gSaveContext.infTable[0xB] & 0x40)) { gSaveContext.infTable[0xB] |= 0x40; } func_80A2F180(this); - Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); Rupees_ChangeBy(50); HIGH_SCORE(HS_POE_POINTS) += 100; if (HIGH_SCORE(HS_POE_POINTS) != 1000) { @@ -341,51 +341,51 @@ void func_80A2FA50(EnGb* this, GlobalContext* globalCtx) { } this->actionFunc = func_80A2F83C; } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->exchangeItemId = EXCH_ITEM_NONE; this->textId = 0x70F8; - Message_ContinueTextbox(globalCtx, this->textId); + Message_ContinueTextbox(play, this->textId); this->actionFunc = func_80A2FB40; } } } -void func_80A2FB40(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80A2FB40(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->dyna.actor, globalCtx, GI_BOTTLE, 100.0f, 10.0f); + func_8002F434(&this->dyna.actor, play, GI_BOTTLE, 100.0f, 10.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_10_BIG_POES, GI_BOTTLE); - GiveItemEntryFromActor(&this->dyna.actor, globalCtx, getItemEntry, 100.0f, 10.0f); + GiveItemEntryFromActor(&this->dyna.actor, play, getItemEntry, 100.0f, 10.0f); } this->actionFunc = func_80A2FBB0; } } -void func_80A2FBB0(EnGb* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->dyna.actor, globalCtx)) { +void func_80A2FBB0(EnGb* this, PlayState* play) { + if (Actor_HasParent(&this->dyna.actor, play)) { this->dyna.actor.parent = NULL; this->actionFunc = func_80A2FC0C; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->dyna.actor, globalCtx, GI_BOTTLE, 100.0f, 10.0f); + func_8002F434(&this->dyna.actor, play, GI_BOTTLE, 100.0f, 10.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_10_BIG_POES, GI_BOTTLE); - GiveItemEntryFromActor(&this->dyna.actor, globalCtx, getItemEntry, 100.0f, 10.0f); + GiveItemEntryFromActor(&this->dyna.actor, play, getItemEntry, 100.0f, 10.0f); } } } -void func_80A2FC0C(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { - Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx); +void func_80A2FC0C(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { + Actor_ProcessTalkRequest(&this->dyna.actor, play); func_80A2F180(this); this->actionFunc = func_80A2F83C; } } -void func_80A2FC70(EnGb* this, GlobalContext* globalCtx) { +void func_80A2FC70(EnGb* this, PlayState* play) { if (this->skelAnime.curFrame == Animation_GetLastFrame(&gPoeSellerSwingStickAnim)) { Animation_Change(&this->skelAnime, &gPoeSellerIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gPoeSellerIdleAnim), ANIMMODE_LOOP, 0.0f); @@ -406,21 +406,21 @@ void func_80A2FC70(EnGb* this, GlobalContext* globalCtx) { } } -void EnGb_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnGb_Update(Actor* thisx, PlayState* play2) { EnGb* this = (EnGb*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 i; f32 rand; this->frameTimer++; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->dyna.actor.textId = this->textId; func_80A2F608(this); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); for (i = 0; i < ARRAY_COUNT(this->bottlesColliders); i++) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bottlesColliders[i].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bottlesColliders[i].base); } rand = Rand_ZeroOne(); @@ -428,16 +428,16 @@ void EnGb_Update(Actor* thisx, GlobalContext* globalCtx2) { this->lightColor.g = (s8)(rand * 100.0f) + 155; this->lightColor.b = (s8)(rand * 160.0f) + 95; this->lightColor.a = 200; - EnGb_UpdateCagedSouls(this, globalCtx); + EnGb_UpdateCagedSouls(this, play); } -void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGb_Draw(Actor* thisx, PlayState* play) { EnGb* this = (EnGb*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); @@ -445,13 +445,13 @@ void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->dyna.actor); - EnGb_DrawCagedSouls(this, globalCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + EnGb_DrawCagedSouls(this, play); + CLOSE_DISPS(play->state.gfxCtx); } -void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx) { +void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play) { f32 temp_f20; s16 rot; s32 i; @@ -525,20 +525,20 @@ void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx) { } } -void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { +void EnGb_DrawCagedSouls(EnGb* this, PlayState* play) { s32 pad; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < 4; i++) { s32 idx = this->cagedSouls[i].infoIdx; FrameInterpolation_RecordOpenChild(&this->cagedSouls[i], this->cagedSouls[i].epoch); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (u32)(sCagedSoulInfo[idx].timerMultiplier * this->frameTimer) % 512, 32, 128)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sCagedSoulInfo[idx].texture)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, sCagedSoulInfo[idx].prim.r, sCagedSoulInfo[idx].prim.g, @@ -549,14 +549,14 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(this->cagedSouls[i].translation.x, this->cagedSouls[i].translation.y, this->cagedSouls[i].translation.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if (this->cagedSouls[i].rotate180) { Matrix_RotateZYX(0, -0x8000, 0, MTXMODE_APPLY); } Matrix_Scale(0.007f, 0.007f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPoeSellerCagedSoulDL); @@ -564,5 +564,5 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h index e72a33f14..7552aba8e 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -6,7 +6,7 @@ struct EnGb; -typedef void (*EnGbActionFunc)(struct EnGb*, GlobalContext*); +typedef void (*EnGbActionFunc)(struct EnGb*, PlayState*); typedef struct { /* 0x00 */ Color_RGBA8 prim; diff --git a/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 407c43100..ddaa79292 100644 --- a/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -21,24 +21,24 @@ typedef enum { /* 02 */ GE1_HAIR_SPIKY } EnGe1Hairstyle; -void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGe1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGe1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGe1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGe1_Init(Actor* thisx, PlayState* play); +void EnGe1_Destroy(Actor* thisx, PlayState* play); +void EnGe1_Update(Actor* thisx, PlayState* play); +void EnGe1_Draw(Actor* thisx, PlayState* play); -void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx); +void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, PlayState* play); +void EnGe1_BeginGiveItem_Archery(EnGe1* this, PlayState* play); s32 EnGe1_CheckCarpentersFreed(void); -void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_SetNormalText(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_WatchForAndSensePlayer(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_GetReaction_ValleyFloor(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_CheckForCard_GTGGuard(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_CheckGate_GateOp(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_GetReaction_GateGuard(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_Wait_Archery(EnGe1* this, GlobalContext* globalCtx); +void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, PlayState* play); +void EnGe1_SetNormalText(EnGe1* this, PlayState* play); +void EnGe1_WatchForAndSensePlayer(EnGe1* this, PlayState* play); +void EnGe1_GetReaction_ValleyFloor(EnGe1* this, PlayState* play); +void EnGe1_CheckForCard_GTGGuard(EnGe1* this, PlayState* play); +void EnGe1_CheckGate_GateOp(EnGe1* this, PlayState* play); +void EnGe1_GetReaction_GateGuard(EnGe1* this, PlayState* play); +void EnGe1_TalkAfterGame_Archery(EnGe1* this, PlayState* play); +void EnGe1_Wait_Archery(EnGe1* this, PlayState* play); void EnGe1_CueUpAnimation(EnGe1* this); void EnGe1_StopFidget(EnGe1* this); @@ -89,16 +89,16 @@ static void* sEyeTextures[] = { gGerudoWhiteEyeClosedTex, }; -void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Init(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteIdleAnim, this->jointTable, this->morphTable, GE1_LIMB_MAX); Animation_PlayOnce(&this->skelAnime, &gGerudoWhiteIdleAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->animation = &gGerudoWhiteIdleAnim; this->animFunc = EnGe1_CueUpAnimation; @@ -106,7 +106,7 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); // In Gerudo Valley - this->actor.uncullZoneForward = ((globalCtx->sceneNum == SCENE_SPOT09) ? 1000.0f : 1200.0f); + this->actor.uncullZoneForward = ((play->sceneNum == SCENE_SPOT09) ? 1000.0f : 1200.0f); switch (this->actor.params & 0xFF) { @@ -179,14 +179,14 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { this->stateFlags = 0; } -void EnGe1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Destroy(Actor* thisx, PlayState* play) { EnGe1* this = (EnGe1*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnGe1_SetTalkAction(EnGe1* this, GlobalContext* globalCtx, u16 textId, f32 arg3, EnGe1ActionFunc actionFunc) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 EnGe1_SetTalkAction(EnGe1* this, PlayState* play, u16 textId, f32 arg3, EnGe1ActionFunc actionFunc) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; this->animFunc = EnGe1_StopFidget; this->stateFlags &= ~GE1_STATE_IDLE_ANIM; @@ -199,7 +199,7 @@ s32 EnGe1_SetTalkAction(EnGe1* this, GlobalContext* globalCtx, u16 textId, f32 a this->actor.textId = textId; if (this->actor.xzDistToPlayer < arg3) { - func_8002F2CC(&this->actor, globalCtx, arg3); + func_8002F2CC(&this->actor, play, arg3); } return false; @@ -231,53 +231,53 @@ s32 EnGe1_CheckCarpentersFreed(void) { /** * Sends player to different places depending on if has hookshot, and if this is the first time captured */ -void EnGe1_KickPlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_KickPlayer(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; if (this->cutsceneTimer > 0) { this->cutsceneTimer--; } else { - func_8006D074(globalCtx); + func_8006D074(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = 0x1A5; + play->nextEntranceIndex = 0x1A5; } else if (gSaveContext.eventChkInf[12] & 0x80) { // Caught previously - globalCtx->nextEntranceIndex = 0x5F8; + play->nextEntranceIndex = 0x5F8; } else { - globalCtx->nextEntranceIndex = 0x3B4; + play->nextEntranceIndex = 0x3B4; } - globalCtx->fadeTransition = 0x26; - globalCtx->sceneLoadFlag = 0x14; + play->fadeTransition = 0x26; + play->sceneLoadFlag = 0x14; } } -void EnGe1_SpotPlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_SpotPlayer(EnGe1* this, PlayState* play) { this->cutsceneTimer = 30; this->actionFunc = EnGe1_KickPlayer; - func_8002DF54(globalCtx, &this->actor, 0x5F); + func_8002DF54(play, &this->actor, 0x5F); func_80078884(NA_SE_SY_FOUND); - Message_StartTextbox(globalCtx, 0x6000, &this->actor); + Message_StartTextbox(play, 0x6000, &this->actor); } -void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } if (this->collider.base.acFlags & AC_HIT) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnGe1_ChooseActionFromTextId(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_ChooseActionFromTextId(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { switch (this->actor.textId) { case 0x6001: this->actionFunc = EnGe1_SetNormalText; @@ -299,36 +299,36 @@ void EnGe1_ChooseActionFromTextId(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_SetNormalText(EnGe1* this, GlobalContext* globalCtx) { - EnGe1_SetTalkAction(this, globalCtx, 0x6001, 100.0f, EnGe1_ChooseActionFromTextId); +void EnGe1_SetNormalText(EnGe1* this, PlayState* play) { + EnGe1_SetTalkAction(this, play, 0x6001, 100.0f, EnGe1_ChooseActionFromTextId); } -void EnGe1_WatchForAndSensePlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WatchForAndSensePlayer(EnGe1* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 400.0f))) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } if (this->collider.base.acFlags & AC_HIT) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnGe1_GetReaction_ValleyFloor(EnGe1* this, GlobalContext* globalCtx) { - u16 reactionText = Text_GetFaceReaction(globalCtx, 0x22); +void EnGe1_GetReaction_ValleyFloor(EnGe1* this, PlayState* play) { + u16 reactionText = Text_GetFaceReaction(play, 0x22); if (reactionText == 0) { reactionText = 0x6019; } - EnGe1_SetTalkAction(this, globalCtx, reactionText, 100.0f, EnGe1_ChooseActionFromTextId); + EnGe1_SetTalkAction(this, play, reactionText, 100.0f, EnGe1_ChooseActionFromTextId); } // Gerudo Training Ground Guard functions -void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, PlayState* play) { if (this->cutsceneTimer > 0) { this->cutsceneTimer--; } else { @@ -339,19 +339,19 @@ void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { this->stateFlags |= GE1_STATE_STOP_FIDGET; } -void EnGe1_Open_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_Open_GTGGuard(EnGe1* this, PlayState* play) { if (this->stateFlags & GE1_STATE_IDLE_ANIM) { this->actionFunc = EnGe1_WaitTillOpened_GTGGuard; - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); this->cutsceneTimer = 50; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_HAND_CLAP); } } -void EnGe1_SetupOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void EnGe1_SetupOpen_GTGGuard(EnGe1* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actionFunc = EnGe1_Open_GTGGuard; Animation_Change(&this->skelAnime, &gGerudoWhiteClapAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGerudoWhiteClapAnim), ANIMMODE_ONCE, -3.0f); @@ -361,26 +361,26 @@ void EnGe1_SetupOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_RefuseEntryTooPoor_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void EnGe1_RefuseEntryTooPoor_GTGGuard(EnGe1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actionFunc = EnGe1_CheckForCard_GTGGuard; EnGe1_SetAnimationIdle(this); } } -void EnGe1_OfferOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_OfferOpen_GTGGuard(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees < 10) { - Message_ContinueTextbox(globalCtx, 0x6016); + Message_ContinueTextbox(play, 0x6016); this->actionFunc = EnGe1_RefuseEntryTooPoor_GTGGuard; } else { Rupees_ChangeBy(-10); - Message_ContinueTextbox(globalCtx, 0x6015); + Message_ContinueTextbox(play, 0x6015); this->actionFunc = EnGe1_SetupOpen_GTGGuard; } break; @@ -392,37 +392,37 @@ void EnGe1_OfferOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_RefuseOpenNoCard_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_RefuseOpenNoCard_GTGGuard(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_CheckForCard_GTGGuard; EnGe1_SetAnimationIdle(this); } } -void EnGe1_CheckForCard_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_CheckForCard_GTGGuard(EnGe1* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_GERUDO_CARD)) { - EnGe1_SetTalkAction(this, globalCtx, 0x6014, 100.0f, EnGe1_OfferOpen_GTGGuard); + EnGe1_SetTalkAction(this, play, 0x6014, 100.0f, EnGe1_OfferOpen_GTGGuard); } else { //! @bug This outcome is inaccessible in normal gameplay since this function it is unreachable without //! obtaining the card in the first place. - EnGe1_SetTalkAction(this, globalCtx, 0x6013, 100.0f, EnGe1_RefuseOpenNoCard_GTGGuard); + EnGe1_SetTalkAction(this, play, 0x6013, 100.0f, EnGe1_RefuseOpenNoCard_GTGGuard); } } // Gate Operator functions -void EnGe1_WaitGateOpen_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitGateOpen_GateOp(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnGe1_CheckGate_GateOp; EnGe1_SetAnimationIdle(this); } } -void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, PlayState* play) { if (this->cutsceneTimer > 0) { this->cutsceneTimer--; } else { @@ -432,21 +432,21 @@ void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, GlobalContext* globalCtx) { this->stateFlags |= GE1_STATE_STOP_FIDGET; } -void EnGe1_OpenGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_OpenGate_GateOp(EnGe1* this, PlayState* play) { if (this->stateFlags & GE1_STATE_IDLE_ANIM) { this->actionFunc = EnGe1_WaitUntilGateOpened_GateOp; - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); this->cutsceneTimer = 50; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_HAND_CLAP); } } -void EnGe1_SetupOpenGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_SetupOpenGate_GateOp(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actionFunc = EnGe1_OpenGate_GateOp; Animation_Change(&this->skelAnime, &gGerudoWhiteClapAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGerudoWhiteClapAnim), ANIMMODE_ONCE, -3.0f); @@ -456,35 +456,35 @@ void EnGe1_SetupOpenGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_CheckGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { - EnGe1_SetTalkAction(this, globalCtx, 0x6018, 100.0f, EnGe1_WaitGateOpen_GateOp); +void EnGe1_CheckGate_GateOp(EnGe1* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + EnGe1_SetTalkAction(this, play, 0x6018, 100.0f, EnGe1_WaitGateOpen_GateOp); } else { - EnGe1_SetTalkAction(this, globalCtx, 0x6017, 100.0f, EnGe1_SetupOpenGate_GateOp); + EnGe1_SetTalkAction(this, play, 0x6017, 100.0f, EnGe1_SetupOpenGate_GateOp); } } // Gate guard functions -void EnGe1_Talk_GateGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_Talk_GateGuard(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_GetReaction_GateGuard; EnGe1_SetAnimationIdle(this); } } -void EnGe1_GetReaction_GateGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_GetReaction_GateGuard(EnGe1* this, PlayState* play) { u16 reactionText; - reactionText = Text_GetFaceReaction(globalCtx, 0x22); + reactionText = Text_GetFaceReaction(play, 0x22); if (reactionText == 0) { reactionText = 0x6069; } - if (EnGe1_SetTalkAction(this, globalCtx, reactionText, 100.0f, EnGe1_Talk_GateGuard)) { + if (EnGe1_SetTalkAction(this, play, reactionText, 100.0f, EnGe1_Talk_GateGuard)) { this->animFunc = EnGe1_CueUpAnimation; this->animation = &gGerudoWhiteDismissiveAnim; Animation_Change(&this->skelAnime, &gGerudoWhiteDismissiveAnim, 1.0f, 0.0f, @@ -494,18 +494,18 @@ void EnGe1_GetReaction_GateGuard(EnGe1* this, GlobalContext* globalCtx) { // Archery functions -void EnGe1_SetupWait_Archery(EnGe1* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnGe1_SetupWait_Archery(EnGe1* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_Wait_Archery; EnGe1_SetAnimationIdle(this); } } -void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, PlayState* play) { GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; s32 getItemId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { if (gSaveContext.n64ddFlag && gSaveContext.minigameScore >= 1500 && !(gSaveContext.infTable[25] & 1)) { gSaveContext.itemGetInf[0] |= 0x8000; gSaveContext.infTable[25] |= 1; @@ -547,18 +547,18 @@ void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) { } if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemId, 10000.0f, 50.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } } -void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_BeginGiveItem_Archery(EnGe1* this, PlayState* play) { GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; s32 getItemId; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnGe1_WaitTillItemGiven_Archery; } @@ -588,57 +588,57 @@ void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) { } if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemId, 10000.0f, 50.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } -void EnGe1_TalkWinPrize_Archery(EnGe1* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnGe1_TalkWinPrize_Archery(EnGe1* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe1_BeginGiveItem_Archery; this->actor.flags &= ~ACTOR_FLAG_16; } else { - func_8002F2CC(&this->actor, globalCtx, 200.0f); + func_8002F2CC(&this->actor, play, 200.0f); } } -void EnGe1_TalkTooPoor_Archery(EnGe1* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnGe1_TalkTooPoor_Archery(EnGe1* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnGe1_Wait_Archery; EnGe1_SetAnimationIdle(this); } } -void EnGe1_WaitDoNothing(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitDoNothing(EnGe1* this, PlayState* play) { } -void EnGe1_BeginGame_Archery(EnGe1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* horse; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_16; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees < 20) { - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); this->actionFunc = EnGe1_TalkTooPoor_Archery; } else { Rupees_ChangeBy(-20); - globalCtx->nextEntranceIndex = 0x129; + play->nextEntranceIndex = 0x129; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 0x26; - globalCtx->sceneLoadFlag = 0x14; + play->fadeTransition = 0x26; + play->sceneLoadFlag = 0x14; gSaveContext.eventInf[0] |= 0x100; gSaveContext.eventChkInf[6] |= 0x100; if (!(player->stateFlags1 & 0x800000)) { - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); } else { - horse = Actor_FindNearby(globalCtx, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); + horse = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); player->actor.freezeTimer = 1200; if (horse != NULL) { @@ -652,28 +652,28 @@ void EnGe1_BeginGame_Archery(EnGe1* this, GlobalContext* globalCtx) { case 1: this->actionFunc = EnGe1_Wait_Archery; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); break; } } } -void EnGe1_TalkOfferPlay_Archery(EnGe1* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x6041); +void EnGe1_TalkOfferPlay_Archery(EnGe1* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x6041); this->actionFunc = EnGe1_BeginGame_Archery; } } -void EnGe1_TalkNoPrize_Archery(EnGe1* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnGe1_TalkNoPrize_Archery(EnGe1* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe1_TalkOfferPlay_Archery; } else { - func_8002F2CC(&this->actor, globalCtx, 300.0f); + func_8002F2CC(&this->actor, play, 300.0f); } } -void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_TalkAfterGame_Archery(EnGe1* this, PlayState* play) { gSaveContext.eventInf[0] &= ~0x100; LOG_NUM("z_common_data.yabusame_total", gSaveContext.minigameScore); LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", HIGH_SCORE(HS_HBA)); @@ -703,20 +703,20 @@ void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_TalkNoHorse_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_TalkNoHorse_Archery(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_Wait_Archery; EnGe1_SetAnimationIdle(this); } } -void EnGe1_Wait_Archery(EnGe1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGe1_Wait_Archery(EnGe1* this, PlayState* play) { + Player* player = GET_PLAYER(play); u16 textId; if (!(player->stateFlags1 & 0x800000)) { - EnGe1_SetTalkAction(this, globalCtx, 0x603F, 100.0f, EnGe1_TalkNoHorse_Archery); + EnGe1_SetTalkAction(this, play, 0x603F, 100.0f, EnGe1_TalkNoHorse_Archery); } else { if (gSaveContext.eventChkInf[6] & 0x100) { if (gSaveContext.infTable[25] & 1) { @@ -727,20 +727,20 @@ void EnGe1_Wait_Archery(EnGe1* this, GlobalContext* globalCtx) { } else { textId = 0x6040; } - EnGe1_SetTalkAction(this, globalCtx, textId, 200.0f, EnGe1_TalkOfferPlay_Archery); + EnGe1_SetTalkAction(this, play, textId, 200.0f, EnGe1_TalkOfferPlay_Archery); } } // General functions -void EnGe1_TurnToFacePlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_TurnToFacePlayer(EnGe1* this, PlayState* play) { s32 pad; s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(angleDiff) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); } else { if (angleDiff < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); @@ -753,33 +753,33 @@ void EnGe1_TurnToFacePlayer(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_LookAtPlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_LookAtPlayer(EnGe1* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); } } -void EnGe1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Update(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); this->animFunc(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->stateFlags & GE1_STATE_TALKING) { - EnGe1_TurnToFacePlayer(this, globalCtx); + EnGe1_TurnToFacePlayer(this, play); this->stateFlags &= ~GE1_STATE_TALKING; } else { - EnGe1_LookAtPlayer(this, globalCtx); + EnGe1_LookAtPlayer(this, play); } this->unk_2A2.x = this->unk_2A2.y = this->unk_2A2.z = 0; @@ -810,7 +810,7 @@ void EnGe1_StopFidget(EnGe1* this) { } } -s32 EnGe1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 pad; EnGe1* this = (EnGe1*)thisx; @@ -827,35 +827,35 @@ s32 EnGe1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, // The purpose of the state flag GE1_STATE_STOP_FIDGET is to skip this code, which this actor has in lieu of an idle // animation. if ((limbIndex == GE1_LIMB_TORSO) || (limbIndex == GE1_LIMB_L_FOREARM) || (limbIndex == GE1_LIMB_R_FOREARM)) { - rot->y += Math_SinS(globalCtx->state.frames * (limbIndex * 50 + 0x814)) * 200.0f; - rot->z += Math_CosS(globalCtx->state.frames * (limbIndex * 50 + 0x940)) * 200.0f; + rot->y += Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f; + rot->z += Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f; } return 0; } -void EnGe1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGe1* this = (EnGe1*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == GE1_LIMB_HEAD) { gSPDisplayList(POLY_OPA_DISP++, sHairstyleDLists[this->hairstyle]); Matrix_MultVec3f(&D_80A327A8, &this->actor.focus.pos); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnGe1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Draw(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index 84a96be51..f286ce314 100644 --- a/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -7,7 +7,7 @@ struct EnGe1; typedef void (*EnGe1AnimFunc)(struct EnGe1*); -typedef void (*EnGe1ActionFunc)(struct EnGe1*, GlobalContext*); +typedef void (*EnGe1ActionFunc)(struct EnGe1*, PlayState*); typedef enum { /* 0x00 */ GE1_TYPE_GATE_GUARD, diff --git a/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 9fc4ce295..3cfe4b51f 100644 --- a/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -33,27 +33,27 @@ typedef enum { /* 8 */ GE2_ACTION_WAITLOOKATPLAYER } EnGe2Action; -void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGe2_Init(Actor* thisx, PlayState* play); +void EnGe2_Destroy(Actor* thisx, PlayState* play); +void EnGe2_Update(Actor* thisx, PlayState* play); +void EnGe2_Draw(Actor* thisx, PlayState* play); s32 EnGe2_CheckCarpentersFreed(void); -void EnGe2_CaptureClose(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_Stand(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_WaitLookAtPlayer(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_ForceTalk(EnGe2* this, GlobalContext* globalCtx); +void EnGe2_CaptureClose(EnGe2* this, PlayState* play); +void EnGe2_CaptureCharge(EnGe2* this, PlayState* play); +void EnGe2_CaptureTurn(EnGe2* this, PlayState* play); +void EnGe2_KnockedOut(EnGe2* this, PlayState* play); +void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play); +void EnGe2_AboutTurn(EnGe2* this, PlayState* play); +void EnGe2_Walk(EnGe2* this, PlayState* play); +void EnGe2_Stand(EnGe2* this, PlayState* play); +void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play); +void EnGe2_ForceTalk(EnGe2* this, PlayState* play); // Update functions -void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_UpdateAfterTalk(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx); +void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play); +void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play); +void EnGe2_UpdateStunned(Actor* thisx, PlayState* play); const ActorInit En_Ge2_InitVars = { ACTOR_EN_GE2, @@ -112,19 +112,19 @@ void EnGe2_ChangeAction(EnGe2* this, s32 i) { this->stateFlags &= ~GE2_STATE_ANIMCOMPLETE; } -void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Init(Actor* thisx, PlayState* play) { s32 pad; EnGe2* this = (EnGe2*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &gGerudoPurpleWalkingAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - if (globalCtx->sceneNum == SCENE_SPOT09) { + if (play->sceneNum == SCENE_SPOT09) { this->actor.uncullZoneForward = 1000.0f; } else { this->actor.uncullZoneForward = 1200.0f; @@ -169,15 +169,15 @@ void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) { this->walkDuration = ((this->actor.params & 0xFF00) >> 8) * 10; } -void EnGe2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Destroy(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } // Detection/check functions -s32 Ge2_DetectPlayerInAction(GlobalContext* globalCtx, EnGe2* this) { +s32 Ge2_DetectPlayerInAction(PlayState* play, EnGe2* this) { f32 visionScale; visionScale = (!IS_DAY ? 0.75f : 1.5f); @@ -190,14 +190,14 @@ s32 Ge2_DetectPlayerInAction(GlobalContext* globalCtx, EnGe2* this) { return 2; } - if (func_8002DDE4(globalCtx)) { + if (func_8002DDE4(play)) { return 1; } return 0; } -s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) { - Player* player = GET_PLAYER(globalCtx); +s32 Ge2_DetectPlayerInUpdate(PlayState* play, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) { + Player* player = GET_PLAYER(play); Vec3f posResult; CollisionPoly* outPoly; f32 visionScale; @@ -216,7 +216,7 @@ s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos, return 0; } - if (BgCheck_AnyLineTest1(&globalCtx->colCtx, pos, &player->bodyPartsPos[7], &posResult, &outPoly, 0)) { + if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[7], &posResult, &outPoly, 0)) { return 0; } return 1; @@ -239,26 +239,26 @@ s32 EnGe2_CheckCarpentersFreed(void) { // Actions -void EnGe2_CaptureClose(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_CaptureClose(EnGe2* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { - func_8006D074(globalCtx); + func_8006D074(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = 0x1A5; + play->nextEntranceIndex = 0x1A5; } else if (gSaveContext.eventChkInf[12] & 0x80) { - globalCtx->nextEntranceIndex = 0x5F8; + play->nextEntranceIndex = 0x5F8; } else { - globalCtx->nextEntranceIndex = 0x3B4; + play->nextEntranceIndex = 0x3B4; } - globalCtx->fadeTransition = 0x26; - globalCtx->sceneLoadFlag = 0x14; + play->fadeTransition = 0x26; + play->sceneLoadFlag = 0x14; } } -void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_CaptureCharge(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.xzDistToPlayer < 50.0f) { @@ -269,22 +269,22 @@ void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx) { if (this->timer > 0) { this->timer--; } else { - func_8006D074(globalCtx); + func_8006D074(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = 0x1A5; + play->nextEntranceIndex = 0x1A5; } else if (gSaveContext.eventChkInf[12] & 0x80) { - globalCtx->nextEntranceIndex = 0x5F8; + play->nextEntranceIndex = 0x5F8; } else { - globalCtx->nextEntranceIndex = 0x3B4; + play->nextEntranceIndex = 0x3B4; } - globalCtx->fadeTransition = 0x26; - globalCtx->sceneLoadFlag = 0x14; + play->fadeTransition = 0x26; + play->sceneLoadFlag = 0x14; } } -void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_CaptureTurn(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -295,7 +295,7 @@ void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_KnockedOut(EnGe2* this, PlayState* play) { static Vec3f effectVelocity = { 0.0f, -0.05f, 0.0f }; static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f }; static Color_RGBA8 effectPrimColor = { 255, 255, 255, 0 }; @@ -305,16 +305,16 @@ void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; if (this->stateFlags & GE2_STATE_ANIMCOMPLETE) { - effectAngle = (globalCtx->state.frames) * 0x2800; + effectAngle = (play->state.frames) * 0x2800; effectPos.x = this->actor.focus.pos.x + (Math_CosS(effectAngle) * 5.0f); effectPos.y = this->actor.focus.pos.y + 10.0f; effectPos.z = this->actor.focus.pos.z + (Math_SinS(effectAngle) * 5.0f); - EffectSsKiraKira_SpawnDispersed(globalCtx, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, + EffectSsKiraKira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, &effectEnvColor, 1000, 16); } } -void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play) { s32 playerSpotted; this->actor.speedXZ = 0.0f; @@ -322,7 +322,7 @@ void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) { if (this->stateFlags & GE2_STATE_TALKED) { this->stateFlags &= ~GE2_STATE_TALKED; } else { - playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this); + playerSpotted = Ge2_DetectPlayerInAction(play, this); if (playerSpotted != 0) { this->timer = 100; @@ -350,11 +350,11 @@ void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_AboutTurn(EnGe2* this, PlayState* play) { s32 playerSpotted; this->actor.speedXZ = 0.0f; - playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this); + playerSpotted = Ge2_DetectPlayerInAction(play, this); if (playerSpotted != 0) { EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED); @@ -371,10 +371,10 @@ void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_Walk(EnGe2* this, PlayState* play) { u8 playerSpotted; - playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this); + playerSpotted = Ge2_DetectPlayerInAction(play, this); if (playerSpotted != 0) { this->actor.speedXZ = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED); @@ -392,18 +392,18 @@ void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_Stand(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_Stand(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->walkDirection, 2, 0x400, 0x200); } -void EnGe2_TurnToFacePlayer(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_TurnToFacePlayer(EnGe2* this, PlayState* play) { s32 pad; s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(angleDiff) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); } else { if (angleDiff < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); @@ -416,10 +416,10 @@ void EnGe2_TurnToFacePlayer(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_LookAtPlayer(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) && (this->actor.xzDistToPlayer < 200.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); @@ -428,8 +428,8 @@ void EnGe2_LookAtPlayer(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_SetActionAfterTalk(EnGe2* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnGe2_SetActionAfterTalk(EnGe2* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { switch (this->actor.params & 0xFF) { case GE2_TYPE_PATROLLING: @@ -445,76 +445,76 @@ void EnGe2_SetActionAfterTalk(EnGe2* this, GlobalContext* globalCtx) { this->actor.update = EnGe2_UpdateFriendly; this->actor.flags &= ~ACTOR_FLAG_16; } - EnGe2_TurnToFacePlayer(this, globalCtx); + EnGe2_TurnToFacePlayer(this, play); } -void EnGe2_WaitLookAtPlayer(EnGe2* this, GlobalContext* globalCtx) { - EnGe2_LookAtPlayer(this, globalCtx); +void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play) { + EnGe2_LookAtPlayer(this, play); } -void EnGe2_WaitTillCardGiven(EnGe2* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnGe2_WaitTillCardGiven(EnGe2* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnGe2_SetActionAfterTalk; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_GERUDO_MEMBERSHIP_CARD, GI_GERUDO_CARD); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } } -void EnGe2_GiveCard(EnGe2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnGe2_GiveCard(EnGe2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnGe2_WaitTillCardGiven; if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_GERUDO_MEMBERSHIP_CARD, GI_GERUDO_CARD); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } } -void EnGe2_ForceTalk(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_ForceTalk(EnGe2* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe2_GiveCard; } else { this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_16; - func_8002F1C4(&this->actor, globalCtx, 300.0f, 300.0f, 0); + func_8002F1C4(&this->actor, play, 300.0f, 300.0f, 0); } - EnGe2_LookAtPlayer(this, globalCtx); + EnGe2_LookAtPlayer(this, play); } -void EnGe2_SetupCapturePlayer(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_SetupCapturePlayer(EnGe2* this, PlayState* play) { this->stateFlags |= GE2_STATE_CAPTURING; this->actor.speedXZ = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_CAPTURETURN); - func_8002DF54(globalCtx, &this->actor, 95); + func_8002DF54(play, &this->actor, 95); func_80078884(NA_SE_SY_FOUND); - Message_StartTextbox(globalCtx, 0x6000, &this->actor); + Message_StartTextbox(play, 0x6000, &this->actor); } -void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, PlayState* play) { s32 pad; s32 pad2; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); if (!(this->stateFlags & GE2_STATE_ANIMCOMPLETE) && SkelAnime_Update(&this->skelAnime)) { this->stateFlags |= GE2_STATE_ANIMCOMPLETE; } } -void EnGe2_MoveAndBlink(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_MoveAndBlink(EnGe2* this, PlayState* play) { Actor_MoveForward(&this->actor); if (DECR(this->blinkTimer) == 0) { @@ -529,13 +529,13 @@ void EnGe2_MoveAndBlink(EnGe2* this, GlobalContext* globalCtx) { // Update functions -void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - EnGe2_MaintainColliderAndSetAnimState(this, globalCtx); - this->actionFunc(this, globalCtx); + EnGe2_MaintainColliderAndSetAnimState(this, play); + this->actionFunc(this, play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->actor.params & 0xFF) == GE2_TYPE_PATROLLING) { this->actor.speedXZ = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER); @@ -546,29 +546,29 @@ void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx) { this->actor.textId = 0x6005; if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnGe2_MoveAndBlink(this, globalCtx); + EnGe2_MoveAndBlink(this, play); } -void EnGe2_UpdateAfterTalk(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; this->stateFlags |= GE2_STATE_TALKED; - EnGe2_MaintainColliderAndSetAnimState(this, globalCtx); - this->actionFunc(this, globalCtx); - EnGe2_MoveAndBlink(this, globalCtx); + EnGe2_MaintainColliderAndSetAnimState(this, play); + this->actionFunc(this, play); + EnGe2_MoveAndBlink(this, play); } -void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Update(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; s32 paramsType; - EnGe2_MaintainColliderAndSetAnimState(this, globalCtx); + EnGe2_MaintainColliderAndSetAnimState(this, play); if ((this->stateFlags & GE2_STATE_KO) || (this->stateFlags & GE2_STATE_CAPTURING)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } else if (this->collider.base.acFlags & 2) { if ((this->collider.info.acHitInfo != NULL) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80)) { Actor_SetColorFilter(&this->actor, 0, 120, 0, 400); @@ -582,29 +582,29 @@ void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_VO_SK_CRASH); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (Ge2_DetectPlayerInUpdate(globalCtx, this, &this->actor.focus.pos, this->actor.shape.rot.y, + if (Ge2_DetectPlayerInUpdate(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->yDetectRange)) { // "Discovered!" osSyncPrintf(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST); - EnGe2_SetupCapturePlayer(this, globalCtx); + EnGe2_SetupCapturePlayer(this, play); } if (((this->actor.params & 0xFF) == GE2_TYPE_STATIONARY) && (this->actor.xzDistToPlayer < 100.0f)) { // "Discovered!" osSyncPrintf(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST); - EnGe2_SetupCapturePlayer(this, globalCtx); + EnGe2_SetupCapturePlayer(this, play); } } if (!(this->stateFlags & GE2_STATE_KO)) { paramsType = this->actor.params & 0xFF; // Not necessary, but looks a bit nicer if ((paramsType == GE2_TYPE_PATROLLING) || (paramsType == GE2_TYPE_STATIONARY)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } - EnGe2_MoveAndBlink(this, globalCtx); + EnGe2_MoveAndBlink(this, play); if (EnGe2_CheckCarpentersFreed() && !(this->stateFlags & GE2_STATE_KO)) { this->actor.update = EnGe2_UpdateFriendly; @@ -612,13 +612,13 @@ void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGe2* this = (EnGe2*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); if ((this->collider.base.acFlags & 2) && ((this->collider.info.acHitInfo == NULL) || !(this->collider.info.acHitInfo->toucher.dmgFlags & 0x80))) { @@ -629,7 +629,7 @@ void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) { this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_VO_SK_CRASH); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (EnGe2_CheckCarpentersFreed()) { this->actor.update = EnGe2_UpdateFriendly; @@ -640,7 +640,7 @@ void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnGe2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGe2* this = (EnGe2*)thisx; if (limbIndex == 3) { @@ -650,7 +650,7 @@ s32 EnGe2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnGe2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGe2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80A343B0 = { 600.0f, 700.0f, 0.0f }; EnGe2* this = (EnGe2*)thisx; @@ -659,18 +659,18 @@ void EnGe2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGe2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gGerudoPurpleEyeOpenTex, gGerudoPurpleEyeHalfTex, gGerudoPurpleEyeClosedTex }; s32 pad; EnGe2* this = (EnGe2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe2_OverrideLimbDraw, EnGe2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index b9d08f0bb..7c78ad91a 100644 --- a/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -6,7 +6,7 @@ struct EnGe2; -typedef void (*EnGe2ActionFunc)(struct EnGe2*, GlobalContext*); +typedef void (*EnGe2ActionFunc)(struct EnGe2*, PlayState*); typedef struct EnGe2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index e646a95cd..44ae79d9e 100644 --- a/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGe3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGe3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGe3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGe3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGe3_Init(Actor* thisx, PlayState* play); +void EnGe3_Destroy(Actor* thisx, PlayState* play); +void EnGe3_Update(Actor* thisx, PlayState* play); +void EnGe3_Draw(Actor* thisx, PlayState* play); -void EnGe3_WaitLookAtPlayer(EnGe3* this, GlobalContext* globalCtx); -void EnGe3_ForceTalk(EnGe3* this, GlobalContext* globalCtx); -void EnGe3_UpdateWhenNotTalking(Actor* thisx, GlobalContext* globalCtx); +void EnGe3_WaitLookAtPlayer(EnGe3* this, PlayState* play); +void EnGe3_ForceTalk(EnGe3* this, PlayState* play); +void EnGe3_UpdateWhenNotTalking(Actor* thisx, PlayState* play); const ActorInit En_Ge3_InitVars = { ACTOR_EN_GE3, @@ -64,16 +64,16 @@ void EnGe3_ChangeAction(EnGe3* this, s32 i) { this->unk_30C &= ~2; } -void EnGe3_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnGe3_Init(Actor* thisx, PlayState* play2) { EnGe3* this = (EnGe3*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, GELDB_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gGerudoRedStandAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.world.rot.z = 0; @@ -86,20 +86,20 @@ void EnGe3_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.gravity = -1.0f; } -void EnGe3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGe3_Destroy(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGe3_TurnToFacePlayer(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_TurnToFacePlayer(EnGe3* this, PlayState* play) { s32 pad; s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(angleDiff) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); } else { if (angleDiff < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); @@ -112,10 +112,10 @@ void EnGe3_TurnToFacePlayer(EnGe3* this, GlobalContext* globalCtx) { } } -void EnGe3_LookAtPlayer(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_LookAtPlayer(EnGe3* this, PlayState* play) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x2300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); @@ -124,76 +124,76 @@ void EnGe3_LookAtPlayer(EnGe3* this, GlobalContext* globalCtx) { } } -void EnGe3_Wait(EnGe3* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnGe3_Wait(EnGe3* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe3_WaitLookAtPlayer; this->actor.update = EnGe3_UpdateWhenNotTalking; this->actor.flags &= ~ACTOR_FLAG_16; } - EnGe3_TurnToFacePlayer(this, globalCtx); + EnGe3_TurnToFacePlayer(this, play); } -void EnGe3_WaitLookAtPlayer(EnGe3* this, GlobalContext* globalCtx) { - EnGe3_LookAtPlayer(this, globalCtx); +void EnGe3_WaitLookAtPlayer(EnGe3* this, PlayState* play) { + EnGe3_LookAtPlayer(this, play); } -void EnGe3_WaitTillCardGiven(EnGe3* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnGe3_WaitTillCardGiven(EnGe3* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnGe3_Wait; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_GERUDO_MEMBERSHIP_CARD, GI_GERUDO_CARD); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } } -void EnGe3_GiveCard(EnGe3* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnGe3_GiveCard(EnGe3* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnGe3_WaitTillCardGiven; if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_GF_GERUDO_MEMBERSHIP_CARD, GI_GERUDO_CARD); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } } -void EnGe3_ForceTalk(EnGe3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnGe3_ForceTalk(EnGe3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe3_GiveCard; } else { if (!(this->unk_30C & 4)) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); this->unk_30C |= 4; } this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_16; - func_8002F1C4(&this->actor, globalCtx, 300.0f, 300.0f, 0); + func_8002F1C4(&this->actor, play, 300.0f, 300.0f, 0); } - EnGe3_LookAtPlayer(this, globalCtx); + EnGe3_LookAtPlayer(this, play); } -void EnGe3_UpdateCollision(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_UpdateCollision(EnGe3* this, PlayState* play) { s32 pad; s32 pad2; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); if (!(this->unk_30C & 2) && SkelAnime_Update(&this->skelAnime)) { this->unk_30C |= 2; } } -void EnGe3_MoveAndBlink(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_MoveAndBlink(EnGe3* this, PlayState* play) { Actor_MoveForward(&this->actor); @@ -208,34 +208,34 @@ void EnGe3_MoveAndBlink(EnGe3* this, GlobalContext* globalCtx) { } } -void EnGe3_UpdateWhenNotTalking(Actor* thisx, GlobalContext* globalCtx) { +void EnGe3_UpdateWhenNotTalking(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - EnGe3_UpdateCollision(this, globalCtx); - this->actionFunc(this, globalCtx); + EnGe3_UpdateCollision(this, play); + this->actionFunc(this, play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe3_Wait; this->actor.update = EnGe3_Update; } else { this->actor.textId = 0x6005; if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnGe3_MoveAndBlink(this, globalCtx); + EnGe3_MoveAndBlink(this, play); } -void EnGe3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGe3_Update(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - EnGe3_UpdateCollision(this, globalCtx); - this->actionFunc(this, globalCtx); - EnGe3_MoveAndBlink(this, globalCtx); + EnGe3_UpdateCollision(this, play); + this->actionFunc(this, play); + EnGe3_MoveAndBlink(this, play); } -s32 EnGe3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGe3* this = (EnGe3*)thisx; switch (limbIndex) { @@ -252,7 +252,7 @@ s32 EnGe3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, default: if (CVar_GetS32("gGerudoWarriorClothingFix", 0)) { // This is a hack to fix the color-changing clothes this Gerudo has on N64 versions - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (limbIndex) { case GELDB_LIMB_NECK: break; @@ -271,14 +271,14 @@ s32 EnGe3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, gDPSetEnvColor(POLY_OPA_DISP++, 140, 0, 0, 255); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } break; } return false; } -void EnGe3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGe3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGe3* this = (EnGe3*)thisx; Vec3f D_80A351C8 = { 600.0f, 700.0f, 0.0f }; @@ -287,22 +287,22 @@ void EnGe3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGe3_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnGe3_Draw(Actor* thisx, PlayState* play2) { static void* eyeTextures[] = { gGerudoRedEyeOpenTex, gGerudoRedEyeHalfTex, gGerudoRedEyeShutTex, }; EnGe3* this = (EnGe3*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe3_OverrideLimbDraw, EnGe3_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index f292c9968..4bb5c7b3f 100644 --- a/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -7,7 +7,7 @@ struct EnGe3; -typedef void (*EnGe3ActionFunc)(struct EnGe3*, GlobalContext*); +typedef void (*EnGe3ActionFunc)(struct EnGe3*, PlayState*); typedef struct EnGe3 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index 9ce0a0589..647980079 100644 --- a/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -29,45 +29,45 @@ typedef enum { /* 16 */ GELDB_SPIN_DODGE } EnGeldBAction; -void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGeldB_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGeldB_Init(Actor* thisx, PlayState* play); +void EnGeldB_Destroy(Actor* thisx, PlayState* play); +void EnGeldB_Update(Actor* thisx, PlayState* play); +void EnGeldB_Draw(Actor* thisx, PlayState* play); -s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this); +s32 EnGeldB_DodgeRanged(PlayState* play, EnGeldB* this); void EnGeldB_SetupWait(EnGeldB* this); void EnGeldB_SetupReady(EnGeldB* this); -void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_SetupAdvance(EnGeldB* this, PlayState* play); void EnGeldB_SetupPivot(EnGeldB* this); void EnGeldB_SetupRollForward(EnGeldB* this); void EnGeldB_SetupCircle(EnGeldB* this); -void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_SetupSpinDodge(EnGeldB* this, PlayState* play); void EnGeldB_SetupSlash(EnGeldB* this); void EnGeldB_SetupSpinAttack(EnGeldB* this); void EnGeldB_SetupRollBack(EnGeldB* this); void EnGeldB_SetupJump(EnGeldB* this); void EnGeldB_SetupBlock(EnGeldB* this); -void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_SetupSidestep(EnGeldB* this, PlayState* play); void EnGeldB_SetupDefeated(EnGeldB* this); -void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Flee(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_Wait(EnGeldB* this, PlayState* play); +void EnGeldB_Flee(EnGeldB* this, PlayState* play); +void EnGeldB_Ready(EnGeldB* this, PlayState* play); +void EnGeldB_Advance(EnGeldB* this, PlayState* play); +void EnGeldB_RollForward(EnGeldB* this, PlayState* play); +void EnGeldB_Pivot(EnGeldB* this, PlayState* play); +void EnGeldB_Circle(EnGeldB* this, PlayState* play); +void EnGeldB_SpinDodge(EnGeldB* this, PlayState* play); +void EnGeldB_Slash(EnGeldB* this, PlayState* play); +void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play); +void EnGeldB_RollBack(EnGeldB* this, PlayState* play); +void EnGeldB_Stunned(EnGeldB* this, PlayState* play); +void EnGeldB_Damaged(EnGeldB* this, PlayState* play); +void EnGeldB_Jump(EnGeldB* this, PlayState* play); +void EnGeldB_Block(EnGeldB* this, PlayState* play); +void EnGeldB_Sidestep(EnGeldB* this, PlayState* play); +void EnGeldB_Defeated(EnGeldB* this, PlayState* play); const ActorInit En_GeldB_InitVars = { ACTOR_EN_GELDB, @@ -216,7 +216,7 @@ void EnGeldB_SetupAction(EnGeldB* this, EnGeldBActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Init(Actor* thisx, PlayState* play) { s32 pad; EffectBlureInit1 blureInit; EnGeldB* this = (EnGeldB*)thisx; @@ -233,14 +233,14 @@ void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; this->blinkState = 0; this->unkFloat = 10.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable, this->morphTable, GELDB_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, thisx, &sBodyCylInit); - Collider_InitTris(globalCtx, &this->blockCollider); - Collider_SetTris(globalCtx, &this->blockCollider, thisx, &sBlockTrisInit, this->blockElements); - Collider_InitQuad(globalCtx, &this->swordCollider); - Collider_SetQuad(globalCtx, &this->swordCollider, thisx, &sSwordQuadInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, thisx, &sBodyCylInit); + Collider_InitTris(play, &this->blockCollider); + Collider_SetTris(play, &this->blockCollider, thisx, &sBlockTrisInit, this->blockElements); + Collider_InitQuad(play, &this->swordCollider); + Collider_SetQuad(play, &this->swordCollider, thisx, &sSwordQuadInit); blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = blureInit.p1EndColor[0] = blureInit.p1EndColor[1] = blureInit.p1EndColor[2] = blureInit.p2EndColor[0] = blureInit.p2EndColor[1] = @@ -251,27 +251,27 @@ void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); Actor_SetScale(thisx, 0.012499999f); EnGeldB_SetupWait(this); - if ((this->keyFlag != 0) && Flags_GetCollectible(globalCtx, this->keyFlag >> 8)) { + if ((this->keyFlag != 0) && Flags_GetCollectible(play, this->keyFlag >> 8)) { Actor_Kill(thisx); } } -void EnGeldB_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnGeldB* this = (EnGeldB*)thisx; func_800F5B58(); - Effect_Delete(globalCtx, this->blureIndex); - Collider_DestroyTris(globalCtx, &this->blockCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->swordCollider); + Effect_Delete(play, this->blureIndex); + Collider_DestroyTris(play, &this->blockCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->swordCollider); } -s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->actor; s16 angleToWall; s16 angleToLink; @@ -282,31 +282,31 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { angleToLink = thisx->yawTowardsPlayer - thisx->shape.rot.y; angleToLink = ABS(angleToLink); - if (func_800354B4(globalCtx, thisx, 100.0f, 0x2710, 0x3E80, thisx->shape.rot.y)) { + if (func_800354B4(play, thisx, 100.0f, 0x2710, 0x3E80, thisx->shape.rot.y)) { if (player->swordAnimation == 0x11) { - EnGeldB_SetupSpinDodge(this, globalCtx); + EnGeldB_SetupSpinDodge(this, play); return true; - } else if (globalCtx->gameplayFrames & 1) { + } else if (play->gameplayFrames & 1) { EnGeldB_SetupBlock(this); return true; } } - if (func_800354B4(globalCtx, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) { + if (func_800354B4(play, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) { thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; if ((thisx->bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (thisx->xzDistToPlayer < 90.0f)) { EnGeldB_SetupJump(this); return true; } else if (player->swordAnimation == 0x11) { - EnGeldB_SetupSpinDodge(this, globalCtx); + EnGeldB_SetupSpinDodge(this, play); return true; - } else if ((thisx->xzDistToPlayer < 90.0f) && (globalCtx->gameplayFrames & 1)) { + } else if ((thisx->xzDistToPlayer < 90.0f) && (play->gameplayFrames & 1)) { EnGeldB_SetupBlock(this); return true; } else { EnGeldB_SetupRollBack(this); return true; } - } else if ((bomb = Actor_FindNearby(globalCtx, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) { + } else if ((bomb = Actor_FindNearby(play, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) { thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; if (((thisx->bgCheckFlags & 8) && (angleToWall < 0x2EE0)) || (bomb->id == ACTOR_EN_BOM_CHU)) { if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) && @@ -314,7 +314,7 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { EnGeldB_SetupJump(this); return true; } else { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); return true; } } else { @@ -323,13 +323,13 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { } } else if (arg2) { if (angleToLink >= 0x1B58) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); return true; } else { s16 angleToFacingLink = player->actor.shape.rot.y - thisx->shape.rot.y; - if ((thisx->xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, thisx) && - ((globalCtx->gameplayFrames & 7) || (ABS(angleToFacingLink) < 0x38E0))) { + if ((thisx->xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, thisx) && + ((play->gameplayFrames & 7) || (ABS(angleToFacingLink) < 0x38E0))) { EnGeldB_SetupSlash(this); return true; } else { @@ -353,8 +353,8 @@ void EnGeldB_SetupWait(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Wait); } -void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) { - if ((this->invisible && !Flags_GetSwitch(globalCtx, this->actor.home.rot.z)) || +void EnGeldB_Wait(EnGeldB* this, PlayState* play) { + if ((this->invisible && !Flags_GetSwitch(play, this->actor.home.rot.z)) || this->actor.xzDistToPlayer > 300.0f) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.world.pos.y = this->actor.floorHeight + 120.0f; @@ -371,8 +371,8 @@ void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->actor.bgCheckFlags &= ~2; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { EnGeldB_SetupReady(this); @@ -390,14 +390,14 @@ void EnGeldB_SetupFlee(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Flee); } -void EnGeldB_Flee(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Flee(EnGeldB* this, PlayState* play) { if (this->skelAnime.curFrame == 10.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP); } if (this->skelAnime.curFrame == 2.0f) { this->actor.gravity = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 300.0f, 1.0f, 20.5f, 0.0f); @@ -417,8 +417,8 @@ void EnGeldB_SetupReady(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Ready); } -void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_Ready(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 angleToLink; @@ -432,7 +432,7 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { this->lookTimer = 0; } angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (!EnGeldB_DodgeRanged(globalCtx, this)) { + if (!EnGeldB_DodgeRanged(play, this)) { if (this->unkTimer != 0) { this->unkTimer--; @@ -440,7 +440,7 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { return; } this->unkTimer = 0; - } else if (EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + } else if (EnGeldB_ReactToPlayer(play, this, 0)) { return; } angleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -451,28 +451,28 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { if (Actor_IsFacingPlayer(&this->actor, 30 * 0x10000 / 360)) { if ((210.0f > this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 150.0f) && (Rand_ZeroOne() < 0.3f)) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) || + if (Actor_OtherIsTargeted(play, &this->actor) || (Rand_ZeroOne() > 0.5f) || (ABS(angleToLink) < 0x38E0)) { EnGeldB_SetupRollForward(this); } else { EnGeldB_SetupSpinAttack(this); } } else if (Rand_ZeroOne() > 0.3f) { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } else { EnGeldB_SetupCircle(this); } } else { EnGeldB_SetupPivot(this); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } } } -void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SetupAdvance(EnGeldB* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gGerudoRedWalkAnim); Animation_Change(&this->skelAnime, &gGerudoRedWalkAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); @@ -480,14 +480,14 @@ void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupAction(this, EnGeldB_Advance); } -void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Advance(EnGeldB* this, PlayState* play) { s32 thisKeyFrame; s32 prevKeyFrame; s32 playSpeed; s16 facingAngletoLink; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!EnGeldB_DodgeRanged(globalCtx, this)) { + if (!EnGeldB_DodgeRanged(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer <= 40.0f) { @@ -518,19 +518,19 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupReady(this); } } else if (this->actor.xzDistToPlayer < 90.0f) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + if (!Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.03f || (this->actor.xzDistToPlayer <= 45.0f && facingAngletoLink < 0x38E0))) { EnGeldB_SetupSlash(this); - } else if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + } else if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnGeldB_SetupRollBack(this); } else { EnGeldB_SetupCircle(this); } } - if (!EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_ReactToPlayer(play, this, 0)) { if ((210.0f > this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 150.0f) && Actor_IsFacingPlayer(&this->actor, 0x71C)) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { if (Rand_ZeroOne() > 0.5f) { EnGeldB_SetupRollForward(this); } else { @@ -541,7 +541,7 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) { return; } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } if (thisKeyFrame != (s32)this->skelAnime.curFrame) { @@ -568,8 +568,8 @@ void EnGeldB_SetupRollForward(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_RollForward); } -void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_RollForward(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 facingAngleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -581,14 +581,14 @@ void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx) { if (ABS(facingAngleToLink) < 0x38E0) { this->lookTimer = 20; } - } else if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + } else if (!Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f || (ABS(facingAngleToLink) < 0x3FFC))) { EnGeldB_SetupSlash(this); } else { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -599,12 +599,12 @@ void EnGeldB_SetupPivot(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Pivot); } -void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Pivot(EnGeldB* this, PlayState* play) { s16 angleToLink; s16 turnRate; f32 playSpeed; - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) { angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; turnRate = (angleToLink > 0) ? ((angleToLink * 0.25f) + 2000.0f) : ((angleToLink * 0.25f) - 2000.0f); this->actor.world.rot.y = this->actor.shape.rot.y += turnRate; @@ -621,10 +621,10 @@ void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() > 0.8f) { EnGeldB_SetupCircle(this); } else { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -643,17 +643,17 @@ void EnGeldB_SetupCircle(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Circle); } -void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Circle(EnGeldB* this, PlayState* play) { s16 angleBehindLink; s16 phi_v1; s32 nextKeyFrame; s32 thisKeyFrame; s32 pad; s32 prevKeyFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; angleBehindLink = player->actor.shape.rot.y + 0x8000; if (Math_SinS(angleBehindLink - this->actor.shape.rot.y) >= 0.0f) { @@ -667,7 +667,7 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { this->actor.speedXZ = 8.0f; } } - if ((this->actor.bgCheckFlags & 8) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, + if ((this->actor.bgCheckFlags & 8) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { @@ -716,14 +716,14 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { ((prevKeyFrame < 0 && 0 < nextKeyFrame) || (prevKeyFrame < 5 && 5 < nextKeyFrame))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } if ((Math_CosS(angleBehindLink - this->actor.shape.rot.y) < -0.85f) && - !Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer <= 45.0f)) { + !Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 45.0f)) { EnGeldB_SetupSlash(this); } else if (--this->timer == 0) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnGeldB_SetupRollBack(this); } else { EnGeldB_SetupReady(this); @@ -732,9 +732,9 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SetupSpinDodge(EnGeldB* this, PlayState* play) { s16 sp3E; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim); Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f); @@ -758,7 +758,7 @@ void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupAction(this, EnGeldB_SpinDodge); } -void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SpinDodge(EnGeldB* this, PlayState* play) { s16 phi_v1; s32 thisKeyFrame; s32 pad; @@ -767,7 +767,7 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x3A98; if ((this->actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; @@ -809,14 +809,14 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) { ((lastKeyFrame < 0 && 0 < nextKeyFrame) || (lastKeyFrame < 5 && 5 < nextKeyFrame))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } this->timer--; if (this->timer == 0) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - if (!EnGeldB_DodgeRanged(globalCtx, this)) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer <= 70.0f)) { + if (!EnGeldB_DodgeRanged(play, this)) { + if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 70.0f)) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupRollBack(this); @@ -841,8 +841,8 @@ void EnGeldB_SetupSlash(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Slash); } -void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_Slash(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; s16 angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -873,13 +873,13 @@ void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); } else if (angleFacingLink <= 0x2710) { if (angleToLink > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnGeldB_SetupCircle(this); } else { - EnGeldB_ReactToPlayer(globalCtx, this, 1); + EnGeldB_ReactToPlayer(play, this, 1); } } else { EnGeldB_SetupCircle(this); @@ -899,8 +899,8 @@ void EnGeldB_SetupSpinAttack(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_SpinAttack); } -void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 angleFacingLink; s16 angleToLink; @@ -912,10 +912,10 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { } else if (this->swordCollider.base.atFlags & AT_HIT) { this->swordCollider.base.atFlags &= ~AT_HIT; if (&player->actor == this->swordCollider.base.at) { - func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); this->spinAttackState = 2; - func_8002DF54(globalCtx, &this->actor, 0x18); - Message_StartTextbox(globalCtx, 0x6003, &this->actor); + func_8002DF54(play, &this->actor, 0x18); + Message_StartTextbox(play, 0x6003, &this->actor); this->timer = 30; this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_YOUNG_LAUGH); @@ -926,8 +926,8 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { if ((s32)this->skelAnime.curFrame < 9) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else if ((s32)this->skelAnime.curFrame == 13) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); this->swordState = 1; this->actor.speedXZ = 10.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_ATTACK); @@ -949,7 +949,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); } else { angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; angleFacingLink = ABS(angleFacingLink); @@ -960,7 +960,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnGeldB_SetupCircle(this); } else { - EnGeldB_ReactToPlayer(globalCtx, this, 1); + EnGeldB_ReactToPlayer(play, this, 1); } } else { EnGeldB_SetupCircle(this); @@ -981,18 +981,18 @@ void EnGeldB_SetupRollBack(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_RollBack); } -void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_RollBack(EnGeldB* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && + if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { EnGeldB_SetupSpinAttack(this); - } else if (globalCtx->gameplayFrames & 1) { - EnGeldB_SetupSidestep(this, globalCtx); + } else if (play->gameplayFrames & 1) { + EnGeldB_SetupSidestep(this, play); } else { EnGeldB_SetupReady(this); } } - if ((globalCtx->state.frames & 0x5F) == 0) { + if ((play->state.frames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -1012,7 +1012,7 @@ void EnGeldB_SetupStunned(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Stunned); } -void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Stunned(EnGeldB* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; } @@ -1026,7 +1026,7 @@ void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health == 0) { EnGeldB_SetupDefeated(this); } else { - EnGeldB_ReactToPlayer(globalCtx, this, 1); + EnGeldB_ReactToPlayer(play, this, 1); } } } @@ -1046,7 +1046,7 @@ void EnGeldB_SetupDamaged(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Damaged); } -void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Damaged(EnGeldB* this, PlayState* play) { s16 angleToWall; if (this->actor.bgCheckFlags & 2) { @@ -1059,14 +1059,14 @@ void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) { this->invisible = false; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0) && + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { EnGeldB_SetupJump(this); - } else if (!EnGeldB_DodgeRanged(globalCtx, this)) { - if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - (globalCtx->gameplayFrames & 7)) { + } else if (!EnGeldB_DodgeRanged(play, this)) { + if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (play->gameplayFrames & 7)) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupRollBack(this); @@ -1089,11 +1089,11 @@ void EnGeldB_SetupJump(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Jump); } -void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Jump(EnGeldB* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { - func_800355B8(globalCtx, &this->leftFootPos); - func_800355B8(globalCtx, &this->rightFootPos); + func_800355B8(play, &this->leftFootPos); + func_800355B8(play, &this->rightFootPos); } if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 3)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -1101,7 +1101,7 @@ void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!Actor_OtherIsTargeted(play, &this->actor)) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupReady(this); @@ -1122,8 +1122,8 @@ void EnGeldB_SetupBlock(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Block); } -void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_Block(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 angleToLink; s16 angleFacingLink; @@ -1137,18 +1137,18 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angleToLink) <= 0x4000) && (this->actor.xzDistToPlayer < 40.0f) && (ABS(this->actor.yDistToPlayer) < 50.0f)) { - if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->swordAnimation == 0x11) { - EnGeldB_SetupSpinDodge(this, globalCtx); - } else if (globalCtx->gameplayFrames & 1) { + EnGeldB_SetupSpinDodge(this, play); + } else if (play->gameplayFrames & 1) { EnGeldB_SetupBlock(this); } else { EnGeldB_SetupRollBack(this); } } else { angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && - ((globalCtx->gameplayFrames & 1) || (ABS(angleFacingLink) < 0x38E0))) { + if (!Actor_OtherIsTargeted(play, &this->actor) && + ((play->gameplayFrames & 1) || (ABS(angleFacingLink) < 0x38E0))) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupCircle(this); @@ -1158,11 +1158,11 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupCircle(this); } } else if ((this->timer == 0) && - func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { + func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->swordAnimation == 0x11) { - EnGeldB_SetupSpinDodge(this, globalCtx); - } else if (!EnGeldB_DodgeRanged(globalCtx, this)) { - if ((globalCtx->gameplayFrames & 1)) { + EnGeldB_SetupSpinDodge(this, play); + } else if (!EnGeldB_DodgeRanged(play, this)) { + if ((play->gameplayFrames & 1)) { if ((this->actor.xzDistToPlayer < 100.0f) && (Rand_ZeroOne() > 0.7f)) { EnGeldB_SetupJump(this); } else { @@ -1175,13 +1175,13 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SetupSidestep(EnGeldB* this, PlayState* play) { s16 linkAngle; Player* player; f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim); Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); linkAngle = player->actor.shape.rot.y; if (Math_SinS(linkAngle - this->actor.shape.rot.y) > 0.0f) { @@ -1199,10 +1199,10 @@ void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupAction(this, EnGeldB_Sidestep); } -void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Sidestep(EnGeldB* this, PlayState* play) { s16 behindLinkAngle; s16 phi_v1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 thisKeyFrame; s32 prevKeyFrame; f32 playSpeed; @@ -1216,7 +1216,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { } if ((this->actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; @@ -1265,7 +1265,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { playSpeed = ((void)0, ABS(this->skelAnime.playSpeed)); // Needed to match for some reason - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) { if (--this->timer == 0) { s16 angleFacingPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -1274,23 +1274,23 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupReady(this); this->timer = (Rand_ZeroOne() * 5.0f) + 1.0f; } else { - Player* player2 = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(play); s16 angleFacingPlayer2 = player2->actor.shape.rot.y - this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - (!(globalCtx->gameplayFrames & 3) || (ABS(angleFacingPlayer2) < 0x38E0))) { + if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (!(play->gameplayFrames & 3) || (ABS(angleFacingPlayer2) < 0x38E0))) { EnGeldB_SetupSlash(this); } else if ((210.0f > this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 150.0f) && - !(globalCtx->gameplayFrames & 1)) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) || + !(play->gameplayFrames & 1)) { + if (Actor_OtherIsTargeted(play, &this->actor) || (Rand_ZeroOne() > 0.5f) || (ABS(angleFacingPlayer2) < 0x38E0)) { EnGeldB_SetupRollForward(this); } else { EnGeldB_SetupSpinAttack(this); } } else { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } } } @@ -1299,7 +1299,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { ((prevKeyFrame < 5) && (((s32)playSpeed + thisKeyFrame) > 5)))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -1320,7 +1320,7 @@ void EnGeldB_SetupDefeated(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Defeated); } -void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Defeated(EnGeldB* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; } @@ -1336,7 +1336,7 @@ void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_TurnHead(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_TurnHead(EnGeldB* this, PlayState* play) { if ((this->action == GELDB_READY) && (this->lookTimer != 0)) { this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 8920.0f; } else if (this->action != GELDB_STUNNED) { @@ -1349,7 +1349,7 @@ void EnGeldB_TurnHead(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_CollisionCheck(EnGeldB* this, PlayState* play) { s32 pad; EnItem00* key; @@ -1374,7 +1374,7 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); if (Actor_ApplyDamage(&this->actor) == 0) { if (this->keyFlag != 0) { - key = Item_DropCollectible(globalCtx, &this->actor.world.pos, this->keyFlag | ITEM00_SMALL_KEY); + key = Item_DropCollectible(play, &this->actor.world.pos, this->keyFlag | ITEM00_SMALL_KEY); if (key != NULL) { key->actor.world.rot.y = Math_Vec3f_Yaw(&key->actor.world.pos, &this->actor.home.pos); key->actor.speedXZ = 6.0f; @@ -1383,7 +1383,7 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { } } EnGeldB_SetupDefeated(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { EnGeldB_SetupDamaged(this); } @@ -1392,33 +1392,33 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Update(Actor* thisx, PlayState* play) { s32 pad; EnGeldB* this = (EnGeldB*)thisx; - EnGeldB_CollisionCheck(this, globalCtx); + EnGeldB_CollisionCheck(this, play); if (this->actor.colChkInfo.damageEffect != GELDB_DMG_UNK_6) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); + this->actionFunc(this, play); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 40.0f; - EnGeldB_TurnHead(this, globalCtx); + EnGeldB_TurnHead(this, play); } Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if ((this->action >= GELDB_READY) && (this->spinAttackState < 2) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->action == GELDB_BLOCK) && (this->skelAnime.curFrame == 0.0f)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->blockCollider.base); } if (this->swordState > 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->swordCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } if (this->blinkState == 0) { - if ((Rand_ZeroOne() < 0.1f) && ((globalCtx->gameplayFrames % 4) == 0)) { + if ((Rand_ZeroOne() < 0.1f) && ((play->gameplayFrames % 4) == 0)) { this->blinkState++; } } else { @@ -1426,11 +1426,11 @@ void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnGeldB_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnGeldB_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGeldB* this = (EnGeldB*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == GELDB_LIMB_NECK) { rot->z += this->headRot.x; rot->x += this->headRot.y; @@ -1446,11 +1446,11 @@ s32 EnGeldB_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 140, 0, 0, 255); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return false; } -void EnGeldB_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGeldB_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f footOffset = { 300.0f, 0.0f, 0.0f }; static Vec3f swordTipOffset = { 0.0f, -3000.0f, 0.0f }; static Vec3f swordHiltOffset = { 400.0f, 0.0f, 0.0f }; @@ -1535,7 +1535,7 @@ void EnGeldB_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Draw(Actor* thisx, PlayState* play) { static Vec3f blockTrisOffsets0[3] = { { -3000.0f, 6000.0f, 1600.0f }, { -3000.0f, 0.0f, 1600.0f }, @@ -1551,7 +1551,7 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnGeldB* this = (EnGeldB*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->spinAttackState >= 2) && SkelAnime_Update(&this->skelAnime)) { if (this->spinAttackState == 2) { @@ -1563,22 +1563,22 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { this->timer--; if (this->timer == 0) { if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = 0x1A5; + play->nextEntranceIndex = 0x1A5; } else if (gSaveContext.eventChkInf[12] & 0x80) { - globalCtx->nextEntranceIndex = 0x5F8; + play->nextEntranceIndex = 0x5F8; } else { - globalCtx->nextEntranceIndex = 0x3B4; + play->nextEntranceIndex = 0x3B4; } - globalCtx->fadeTransition = 0x26; - globalCtx->sceneLoadFlag = 0x14; + play->fadeTransition = 0x26; + play->sceneLoadFlag = 0x14; } } } if ((this->action != GELDB_WAIT) || !this->invisible) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->blinkState])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGeldB_OverrideLimbDraw, EnGeldB_PostLimbDraw, this); if (this->action == GELDB_BLOCK) { s32 i; @@ -1599,16 +1599,16 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->iceTimer % 4) == 0) { s32 iceIndex = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3s(globalCtx, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, + EffectSsEnIce_SpawnFlyingVec3s(play, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, 245, 255, 1.5f); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this) { - Actor* actor = Actor_GetProjectileActor(globalCtx, &this->actor, 800.0f); +s32 EnGeldB_DodgeRanged(PlayState* play, EnGeldB* this) { + Actor* actor = Actor_GetProjectileActor(play, &this->actor, 800.0f); if (actor != NULL) { s16 angleToFacing; @@ -1630,7 +1630,7 @@ s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this) { } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; if ((ABS(angleToFacing) < 0x2000) || (ABS(angleToFacing) > 0x5FFF)) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); this->actor.speedXZ *= 3.0f; } else if (ABS(angleToFacing) < 0x5FFF) { EnGeldB_SetupRollBack(this); diff --git a/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h b/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h index b4c3c3e84..149f8ac0a 100644 --- a/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h +++ b/soh/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h @@ -34,7 +34,7 @@ typedef enum { /* 0x18 */ GELDB_LIMB_MAX } EnGeldBLimb; -typedef void (*EnGeldBActionFunc)(struct EnGeldB*, GlobalContext*); +typedef void (*EnGeldBActionFunc)(struct EnGeldB*, PlayState*); typedef struct EnGeldB { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 157be5737..7746948c1 100644 --- a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -9,66 +9,66 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGirlA_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGirlA_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGirlA_Update(Actor* thisx, GlobalContext* globalCtx); +void EnGirlA_Init(Actor* thisx, PlayState* play); +void EnGirlA_Destroy(Actor* thisx, PlayState* play); +void EnGirlA_Update(Actor* thisx, PlayState* play); -void EnGirlA_SetItemOutOfStock(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_UpdateStockedItem(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx); -void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx); -void func_80A3C498(Actor* thisx, GlobalContext* globalCtx, s32 flags); -void EnGirlA_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGirlA_SetItemOutOfStock(PlayState* play, EnGirlA* this); +void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this); +void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play); +void EnGirlA_Update2(EnGirlA* this, PlayState* play); +void func_80A3C498(Actor* thisx, PlayState* play, s32 flags); +void EnGirlA_Draw(Actor* thisx, PlayState* play); -s32 EnGirlA_CanBuy_Arrows(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Bombs(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuNuts(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuSticks(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Fish(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_RedPotion(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_GreenPotion(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_BluePotion(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Health(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_MilkBottle(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Unk19(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Unk20(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Bombchus(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_SoldOut(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_BlueFire(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Bugs(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Poe(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Fairy(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Randomizer(GlobalContext* globalCtx, EnGirlA* this); +s32 EnGirlA_CanBuy_Arrows(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Bombs(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuNuts(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuSticks(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Fish(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_RedPotion(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_GreenPotion(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_BluePotion(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Longsword(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_HylianShield(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuShield(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_GoronTunic(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_ZoraTunic(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Health(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_MilkBottle(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_WeirdEgg(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Unk19(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Unk20(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Bombchus(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuSeeds(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_SoldOut(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_BlueFire(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Bugs(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Poe(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Fairy(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Randomizer(PlayState* play, EnGirlA* this); -void EnGirlA_ItemGive_DekuNuts(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Arrows(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Bombs(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_DekuSticks(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_BottledItem(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Longsword(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_HylianShield(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_DekuShield(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_GoronTunic(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Health(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_MilkBottle(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Unk19(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Unk20(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Randomizer(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_ShieldDiscount(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_ObtainBombchuPack(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_GoronTunic(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_Randomizer(GlobalContext* globalCtx, EnGirlA* this); +void EnGirlA_ItemGive_DekuNuts(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Arrows(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Bombs(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_DekuSticks(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_BottledItem(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Longsword(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_HylianShield(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_DekuShield(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_GoronTunic(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_ZoraTunic(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Health(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_MilkBottle(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_WeirdEgg(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Unk19(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Unk20(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_DekuSeeds(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Randomizer(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_ShieldDiscount(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_ObtainBombchuPack(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_GoronTunic(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_ZoraTunic(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_Randomizer(PlayState* play, EnGirlA* this); const ActorInit En_GirlA_InitVars = { ACTOR_EN_GIRLA, @@ -147,15 +147,15 @@ static u16 sMaskShopFreeToBorrowTextIds[5] = { 0x70B6, 0x70B5, 0x70B4, 0x70B7, 0 typedef struct { /* 0x00 */ s16 objID; /* 0x02 */ s16 giDrawId; - /* 0x04 */ void (*hiliteFunc)(Actor*, GlobalContext*, s32); + /* 0x04 */ void (*hiliteFunc)(Actor*, PlayState*, s32); /* 0x08 */ s16 price; /* 0x0A */ s16 count; /* 0x0C */ u16 itemDescTextId; /* 0x0C */ u16 itemBuyPromptTextId; /* 0x10 */ s32 getItemId; - /* 0x14 */ s32 (*canBuyFunc)(GlobalContext*, EnGirlA*); - /* 0x18 */ void (*itemGiveFunc)(GlobalContext*, EnGirlA*); - /* 0x1C */ void (*buyEventFunc)(GlobalContext*, EnGirlA*); + /* 0x14 */ s32 (*canBuyFunc)(PlayState*, EnGirlA*); + /* 0x18 */ void (*itemGiveFunc)(PlayState*, EnGirlA*); + /* 0x1C */ void (*buyEventFunc)(PlayState*, EnGirlA*); } ShopItemEntry; // size = 0x20 static ShopItemEntry shopItemEntries[] = { @@ -321,7 +321,7 @@ void EnGirlA_SetupAction(EnGirlA* this, EnGirlAActionFunc func) { this->actionFunc = func; } -s32 EnGirlA_TryChangeShopItem(EnGirlA* this, GlobalContext* globalCtx) { +s32 EnGirlA_TryChangeShopItem(EnGirlA* this, PlayState* play) { switch (this->actor.params) { case SI_MILK_BOTTLE: if (gSaveContext.itemGetInf[0] & 0x4) { @@ -378,7 +378,7 @@ s32 EnGirlA_TryChangeShopItem(EnGirlA* this, GlobalContext* globalCtx) { } break; case SI_RANDOMIZED_ITEM: { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); if (Flags_GetRandomizerInf(shopItemIdentity.randomizerInf)) { this->actor.params = SI_SOLD_OUT; GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); @@ -396,7 +396,7 @@ s32 EnGirlA_TryChangeShopItem(EnGirlA* this, GlobalContext* globalCtx) { return false; } -void EnGirlA_InitItem(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; osSyncPrintf("%s(%2d)初期設定\n", sShopItemDescriptions[params], params); @@ -411,22 +411,22 @@ void EnGirlA_InitItem(EnGirlA* this, GlobalContext* globalCtx) { } if (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY)) { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, shopItemEntries[params].objID); + this->objBankIndex = Object_GetIndex(&play->objectCtx, shopItemEntries[params].objID); } else { s16 objectId = shopItemEntries[params].objID; if (params == SI_RANDOMIZED_ITEM) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); objectId = getItemEntry.objectId; } // Weird edge case here, sold out object reports as loaded for Kokiri shop but doesn't render so we force it to load here - if (Object_IsLoaded(&globalCtx->objectCtx, objectId) && (params != SI_SOLD_OUT && globalCtx->sceneNum == SCENE_KOKIRI_SHOP)) { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectId); + if (Object_IsLoaded(&play->objectCtx, objectId) && (params != SI_SOLD_OUT && play->sceneNum == SCENE_KOKIRI_SHOP)) { + this->objBankIndex = Object_GetIndex(&play->objectCtx, objectId); } else { - this->objBankIndex = Object_Spawn(&globalCtx->objectCtx, objectId); + this->objBankIndex = Object_Spawn(&play->objectCtx, objectId); } } @@ -443,23 +443,23 @@ void EnGirlA_InitItem(EnGirlA* this, GlobalContext* globalCtx) { this->actionFunc2 = EnGirlA_InitializeItemAction; } -void EnGirlA_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Init(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; - EnGirlA_TryChangeShopItem(this, globalCtx); - EnGirlA_InitItem(this, globalCtx); + EnGirlA_TryChangeShopItem(this, play); + EnGirlA_InitItem(this, play); osSyncPrintf("%s(%2d)初期設定\n", sShopItemDescriptions[this->actor.params], this->actor.params); } -void EnGirlA_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Destroy(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; if (this->isInitialized) { - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } } -s32 EnGirlA_CanBuy_Arrows(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Arrows(PlayState* play, EnGirlA* this) { if (Item_CheckObtainability(ITEM_BOW) == ITEM_NONE) { return CANBUY_RESULT_CANT_GET_NOW_5; } @@ -472,7 +472,7 @@ s32 EnGirlA_CanBuy_Arrows(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Bombs(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Bombs(PlayState* play, EnGirlA* this) { if (!gSaveContext.n64ddFlag && !CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -485,7 +485,7 @@ s32 EnGirlA_CanBuy_Bombs(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuNuts(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuNuts(PlayState* play, EnGirlA* this) { if ((CUR_CAPACITY(UPG_NUTS) != 0) && (AMMO(ITEM_NUT) >= CUR_CAPACITY(UPG_NUTS))) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -498,7 +498,7 @@ s32 EnGirlA_CanBuy_DekuNuts(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuSticks(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuSticks(PlayState* play, EnGirlA* this) { if ((CUR_CAPACITY(UPG_STICKS) != 0) && (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS))) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -511,7 +511,7 @@ s32 EnGirlA_CanBuy_DekuSticks(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Fish(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Fish(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -524,7 +524,7 @@ s32 EnGirlA_CanBuy_Fish(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_RedPotion(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_RedPotion(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -537,7 +537,7 @@ s32 EnGirlA_CanBuy_RedPotion(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_GreenPotion(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_GreenPotion(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -550,7 +550,7 @@ s32 EnGirlA_CanBuy_GreenPotion(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_BluePotion(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_BluePotion(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -563,7 +563,7 @@ s32 EnGirlA_CanBuy_BluePotion(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Longsword(PlayState* play, EnGirlA* this) { if ((gBitFlags[2] & gSaveContext.inventory.equipment) && !(gBitFlags[3] & gSaveContext.inventory.equipment)) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -576,7 +576,7 @@ s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_HylianShield(PlayState* play, EnGirlA* this) { if (gBitFlags[5] & gSaveContext.inventory.equipment) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -589,7 +589,7 @@ s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuShield(PlayState* play, EnGirlA* this) { if (gBitFlags[4] & gSaveContext.inventory.equipment) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -602,7 +602,7 @@ s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_GoronTunic(PlayState* play, EnGirlA* this) { if (LINK_AGE_IN_YEARS == YEARS_CHILD && (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY))) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -618,7 +618,7 @@ s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_ZoraTunic(PlayState* play, EnGirlA* this) { if (LINK_AGE_IN_YEARS == YEARS_CHILD && (!gSaveContext.n64ddFlag || !Randomizer_GetSettingValue(RSK_SHOPSANITY))) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -634,7 +634,7 @@ s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Health(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Health(PlayState* play, EnGirlA* this) { if (gSaveContext.healthCapacity == gSaveContext.health) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -644,7 +644,7 @@ s32 EnGirlA_CanBuy_Health(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_MilkBottle(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_MilkBottle(PlayState* play, EnGirlA* this) { if (gSaveContext.rupees < this->basePrice) { return CANBUY_RESULT_NEED_RUPEES; } @@ -654,7 +654,7 @@ s32 EnGirlA_CanBuy_MilkBottle(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_WeirdEgg(PlayState* play, EnGirlA* this) { if (gSaveContext.rupees < this->basePrice) { return CANBUY_RESULT_NEED_RUPEES; } @@ -664,15 +664,15 @@ s32 EnGirlA_CanBuy_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Unk19(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Unk19(PlayState* play, EnGirlA* this) { return CANBUY_RESULT_NEED_RUPEES; } -s32 EnGirlA_CanBuy_Unk20(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Unk20(PlayState* play, EnGirlA* this) { return CANBUY_RESULT_NEED_RUPEES; } -s32 EnGirlA_CanBuy_Bombchus(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Bombchus(PlayState* play, EnGirlA* this) { // When in rando, don't allow buying bombchus when the player doesn't have required explosives // If bombchus are in logic, the player needs to have bombchus; otherwise they need a bomb bag if (gSaveContext.n64ddFlag) { @@ -694,7 +694,7 @@ s32 EnGirlA_CanBuy_Bombchus(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuSeeds(PlayState* play, EnGirlA* this) { if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -707,11 +707,11 @@ s32 EnGirlA_CanBuy_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_SoldOut(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_SoldOut(PlayState* play, EnGirlA* this) { return CANBUY_RESULT_CANT_GET_NOW_5; } -s32 EnGirlA_CanBuy_BlueFire(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_BlueFire(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -724,7 +724,7 @@ s32 EnGirlA_CanBuy_BlueFire(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Bugs(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Bugs(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -737,7 +737,7 @@ s32 EnGirlA_CanBuy_Bugs(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Poe(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Poe(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -750,7 +750,7 @@ s32 EnGirlA_CanBuy_Poe(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Fairy(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Fairy(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -763,8 +763,8 @@ s32 EnGirlA_CanBuy_Fairy(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Randomizer(GlobalContext* globalCtx, EnGirlA* this) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); +s32 EnGirlA_CanBuy_Randomizer(PlayState* play, EnGirlA* this) { + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); ItemObtainability itemObtainability = Randomizer_GetItemObtainabilityFromRandomizerCheck(shopItemIdentity.randomizerCheck); @@ -791,128 +791,128 @@ s32 EnGirlA_CanBuy_Randomizer(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS_FANFARE; } -void EnGirlA_ItemGive_Arrows(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Arrows(PlayState* play, EnGirlA* this) { Inventory_ChangeAmmo(ITEM_BOW, this->itemCount); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Bombs(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Bombs(PlayState* play, EnGirlA* this) { switch (this->itemCount) { case 5: - Item_Give(globalCtx, ITEM_BOMBS_5); + Item_Give(play, ITEM_BOMBS_5); break; case 10: - Item_Give(globalCtx, ITEM_BOMBS_10); + Item_Give(play, ITEM_BOMBS_10); break; case 20: - Item_Give(globalCtx, ITEM_BOMBS_20); + Item_Give(play, ITEM_BOMBS_20); break; case 30: - Item_Give(globalCtx, ITEM_BOMBS_30); + Item_Give(play, ITEM_BOMBS_30); break; } Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuNuts(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_DekuNuts(PlayState* play, EnGirlA* this) { switch (this->itemCount) { case 5: - Item_Give(globalCtx, ITEM_NUTS_5); + Item_Give(play, ITEM_NUTS_5); break; case 10: - Item_Give(globalCtx, ITEM_NUTS_10); + Item_Give(play, ITEM_NUTS_10); break; } Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuSticks(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_STICK); +void EnGirlA_ItemGive_DekuSticks(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_STICK); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Longsword(GlobalContext* globalCtx, EnGirlA* this) { - func_800849EC(globalCtx); +void EnGirlA_ItemGive_Longsword(PlayState* play, EnGirlA* this) { + func_800849EC(play); gSaveContext.swordHealth = 8; Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_HylianShield(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SHIELD_HYLIAN); +void EnGirlA_ItemGive_HylianShield(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SHIELD_HYLIAN); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuShield(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SHIELD_DEKU); +void EnGirlA_ItemGive_DekuShield(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SHIELD_DEKU); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_TUNIC_GORON); +void EnGirlA_ItemGive_GoronTunic(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_TUNIC_GORON); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_TUNIC_ZORA); +void EnGirlA_ItemGive_ZoraTunic(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_TUNIC_ZORA); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Health(GlobalContext* globalCtx, EnGirlA* this) { - Health_ChangeBy(globalCtx, this->itemCount); +void EnGirlA_ItemGive_Health(PlayState* play, EnGirlA* this) { + Health_ChangeBy(play, this->itemCount); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_MilkBottle(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_MILK_BOTTLE); +void EnGirlA_ItemGive_MilkBottle(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_MILK_BOTTLE); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_WEIRD_EGG); +void EnGirlA_ItemGive_WeirdEgg(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_WEIRD_EGG); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Unk19(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Unk19(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Unk20(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Unk20(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SEEDS_30); +void EnGirlA_ItemGive_DekuSeeds(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SEEDS_30); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_BottledItem(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_BottledItem(PlayState* play, EnGirlA* this) { switch (this->actor.params) { case SI_FISH: - Item_Give(globalCtx, ITEM_FISH); + Item_Give(play, ITEM_FISH); break; case SI_RED_POTION_R30: - Item_Give(globalCtx, ITEM_POTION_RED); + Item_Give(play, ITEM_POTION_RED); break; case SI_GREEN_POTION: - Item_Give(globalCtx, ITEM_POTION_GREEN); + Item_Give(play, ITEM_POTION_GREEN); break; case SI_BLUE_POTION: - Item_Give(globalCtx, ITEM_POTION_BLUE); + Item_Give(play, ITEM_POTION_BLUE); break; case SI_BLUE_FIRE: - Item_Give(globalCtx, ITEM_BLUE_FIRE); + Item_Give(play, ITEM_BLUE_FIRE); break; case SI_BUGS: - Item_Give(globalCtx, ITEM_BUG); + Item_Give(play, ITEM_BUG); break; case SI_BIG_POE: - Item_Give(globalCtx, ITEM_BIG_POE); + Item_Give(play, ITEM_BIG_POE); break; case SI_POE: - Item_Give(globalCtx, ITEM_POE); + Item_Give(play, ITEM_POE); break; case SI_FAIRY: - Item_Give(globalCtx, ITEM_FAIRY); + Item_Give(play, ITEM_FAIRY); break; } Rupees_ChangeBy(-this->basePrice); @@ -920,9 +920,9 @@ void EnGirlA_ItemGive_BottledItem(GlobalContext* globalCtx, EnGirlA* this) { // This is called when EnGirlA_CanBuy_Randomizer returns CANBUY_RESULT_SUCCESS // The giving of the item is handled here, and no fanfare is played -void EnGirlA_ItemGive_Randomizer(GlobalContext* globalCtx, EnGirlA* this) { - Player* player = GET_PLAYER(globalCtx); - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); +void EnGirlA_ItemGive_Randomizer(PlayState* play, EnGirlA* this) { + Player* player = GET_PLAYER(play); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); if (getItemEntry.modIndex == MOD_NONE) { @@ -930,16 +930,16 @@ void EnGirlA_ItemGive_Randomizer(GlobalContext* globalCtx, EnGirlA* this) { if (getItemEntry.getItemId == GI_SWORD_BGS) { gSaveContext.bgsFlag = true; } - Item_Give(globalCtx, getItemEntry.itemId); + Item_Give(play, getItemEntry.itemId); } else if (getItemEntry.modIndex == MOD_RANDOMIZER && getItemEntry.getItemId != RG_ICE_TRAP) { - Randomizer_Item_Give(globalCtx, getItemEntry); + Randomizer_Item_Give(play, getItemEntry); } Flags_SetRandomizerInf(shopItemIdentity.randomizerInf); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_ShieldDiscount(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_ShieldDiscount(PlayState* play, EnGirlA* this) { if (this->actor.params == SI_HYLIAN_SHIELD) { if (gSaveContext.infTable[7] & 0x40) { Rupees_ChangeBy(-(this->basePrice - sShieldDiscounts[(s32)Rand_ZeroFloat(7.9f)])); @@ -949,15 +949,15 @@ void EnGirlA_BuyEvent_ShieldDiscount(GlobalContext* globalCtx, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_GoronTunic(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_ZoraTunic(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_ObtainBombchuPack(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_ObtainBombchuPack(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); // Normally, buying a bombchu pack sets a flag indicating the pack is now sold out @@ -996,16 +996,16 @@ void EnGirlA_BuyEvent_ObtainBombchuPack(GlobalContext* globalCtx, EnGirlA* this) // This is called when EnGirlA_CanBuy_Randomizer returns CANBUY_RESULT_SUCCESS_FANFARE // The giving of the item is handled in ossan.c, and a fanfare is played -void EnGirlA_BuyEvent_Randomizer(GlobalContext* globalCtx, EnGirlA* this) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); +void EnGirlA_BuyEvent_Randomizer(PlayState* play, EnGirlA* this) { + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); Flags_SetRandomizerInf(shopItemIdentity.randomizerInf); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_Noop(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_Noop(EnGirlA* this, PlayState* play) { } -void EnGirlA_SetItemDescription(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_SetItemDescription(PlayState* play, EnGirlA* this) { ShopItemEntry* tmp = &shopItemEntries[this->actor.params]; s32 params = this->actor.params; s32 maskId; @@ -1051,7 +1051,7 @@ void EnGirlA_SetItemDescription(GlobalContext* globalCtx, EnGirlA* this) { } if (params == SI_RANDOMIZED_ITEM) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); } @@ -1059,7 +1059,7 @@ void EnGirlA_SetItemDescription(GlobalContext* globalCtx, EnGirlA* this) { this->actor.draw = EnGirlA_Draw; } -void EnGirlA_SetItemOutOfStock(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_SetItemOutOfStock(PlayState* play, EnGirlA* this) { this->isInvisible = true; this->actor.draw = NULL; if (((this->actor.params >= SI_KEATON_MASK) && (this->actor.params <= SI_GERUDO_MASK)) || this->actor.params == SI_RANDOMIZED_ITEM) { @@ -1067,15 +1067,15 @@ void EnGirlA_SetItemOutOfStock(GlobalContext* globalCtx, EnGirlA* this) { } } -void EnGirlA_UpdateStockedItem(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this) { ShopItemEntry* itemEntry; - if (EnGirlA_TryChangeShopItem(this, globalCtx)) { - EnGirlA_InitItem(this, globalCtx); + if (EnGirlA_TryChangeShopItem(this, play)) { + EnGirlA_InitItem(this, play); itemEntry = &shopItemEntries[this->actor.params]; if (this->actor.params == SI_RANDOMIZED_ITEM) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); } else { this->actor.textId = itemEntry->itemDescTextId; @@ -1086,26 +1086,26 @@ void EnGirlA_UpdateStockedItem(GlobalContext* globalCtx, EnGirlA* this) { } } -s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, GlobalContext* globalCtx) { +s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, PlayState* play) { s32 params; if ((this->actor.params >= SI_KEATON_MASK) && (this->actor.params <= SI_GERUDO_MASK)) { params = this->actor.params - SI_KEATON_MASK; if (INV_CONTENT(ITEM_TRADE_CHILD) == sMaskShopItems[params]) { - EnGirlA_SetItemOutOfStock(globalCtx, this); + EnGirlA_SetItemOutOfStock(play, this); } else { - EnGirlA_SetItemDescription(globalCtx, this); + EnGirlA_SetItemDescription(play, this); } return true; } return false; } -void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; ShopItemEntry* itemEntry = &shopItemEntries[params]; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->objBankIndex; switch (this->actor.params) { @@ -1167,8 +1167,8 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) { this->itemBuyPromptTextId = itemEntry->itemBuyPromptTextId; break; } - if (!EnGirlA_TrySetMaskItemDescription(this, globalCtx)) { - EnGirlA_SetItemDescription(globalCtx, this); + if (!EnGirlA_TrySetMaskItemDescription(this, play)) { + EnGirlA_SetItemDescription(play, this); } this->setOutOfStockFunc = EnGirlA_SetItemOutOfStock; @@ -1202,7 +1202,7 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) { this->yRotationInit = this->actor.shape.rot.y; if (params == SI_RANDOMIZED_ITEM) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); this->itemBuyPromptTextId = 0x9100 + ((shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) + NUM_SHOP_ITEMS); @@ -1218,12 +1218,12 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) { } } -void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_Update2(EnGirlA* this, PlayState* play) { Actor_SetScale(&this->actor, 0.25f); this->actor.shape.yOffset = 24.0f; this->actor.shape.shadowScale = 4.0f; - EnGirlA_TrySetMaskItemDescription(this, globalCtx); - this->actionFunc(this, globalCtx); + EnGirlA_TrySetMaskItemDescription(this, play); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 5.0f); this->actor.shape.rot.x = 0.0f; if (this->actor.params != SI_SOLD_OUT) { @@ -1235,33 +1235,33 @@ void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx) { } } -void EnGirlA_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Update(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; - this->actionFunc2(this, globalCtx); + this->actionFunc2(this, play); } -void func_80A3C498(Actor* thisx, GlobalContext* globalCtx, s32 flags) { - func_8002EBCC(thisx, globalCtx, 0); - func_8002ED80(thisx, globalCtx, 0); +void func_80A3C498(Actor* thisx, PlayState* play, s32 flags) { + func_8002EBCC(thisx, play, 0); + func_8002ED80(thisx, play, 0); } -void EnGirlA_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Draw(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; Matrix_RotateY(((this->yRotation * 360.0f) / 65536.0f) * (M_PI / 180.0f), MTXMODE_APPLY); if (this->hiliteFunc != NULL) { - this->hiliteFunc(thisx, globalCtx, 0); + this->hiliteFunc(thisx, play, 0); } if (this->actor.params == SI_RANDOMIZED_ITEM) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->randoSlotIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, getItemEntry); - GetItemEntry_Draw(globalCtx, getItemEntry); + EnItem00_CustomItemsParticles(&this->actor, play, getItemEntry); + GetItemEntry_Draw(play, getItemEntry); return; } - GetItem_Draw(globalCtx, this->giDrawId); + GetItem_Draw(play, this->giDrawId); } diff --git a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.h b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.h index 51bdbbe05..dc430d500 100644 --- a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.h +++ b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.h @@ -6,10 +6,10 @@ struct EnGirlA; -typedef void (*EnGirlAActionFunc)(struct EnGirlA*, GlobalContext*); -typedef void (*EnGirlA2Func)(GlobalContext*, struct EnGirlA*); -typedef void (*EnGirlA3Func)(Actor*, GlobalContext*, s32); -typedef s32 (*EnGirlA4Func)(GlobalContext*, struct EnGirlA*); +typedef void (*EnGirlAActionFunc)(struct EnGirlA*, PlayState*); +typedef void (*EnGirlA2Func)(PlayState*, struct EnGirlA*); +typedef void (*EnGirlA3Func)(Actor*, PlayState*, s32); +typedef s32 (*EnGirlA4Func)(PlayState*, struct EnGirlA*); typedef struct EnGirlA { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c index fa457b383..b6b8b9acb 100644 --- a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -11,20 +11,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGm_Init(Actor* thisx, PlayState* play); +void EnGm_Destroy(Actor* thisx, PlayState* play); +void EnGm_Update(Actor* thisx, PlayState* play); +void EnGm_Draw(Actor* thisx, PlayState* play); -void func_80A3D838(EnGm* this, GlobalContext* globalCtx); -void func_80A3DFBC(EnGm* this, GlobalContext* globalCtx); -void func_80A3DB04(EnGm* this, GlobalContext* globalCtx); -void func_80A3DC44(EnGm* this, GlobalContext* globalCtx); -void func_80A3DBF4(EnGm* this, GlobalContext* globalCtx); -void func_80A3DD7C(EnGm* this, GlobalContext* globalCtx); -void EnGm_ProcessChoiceIndex(EnGm* this, GlobalContext* globalCtx); -void func_80A3DF00(EnGm* this, GlobalContext* globalCtx); -void func_80A3DF60(EnGm* this, GlobalContext* globalCtx); +void func_80A3D838(EnGm* this, PlayState* play); +void func_80A3DFBC(EnGm* this, PlayState* play); +void func_80A3DB04(EnGm* this, PlayState* play); +void func_80A3DC44(EnGm* this, PlayState* play); +void func_80A3DBF4(EnGm* this, PlayState* play); +void func_80A3DD7C(EnGm* this, PlayState* play); +void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play); +void func_80A3DF00(EnGm* this, PlayState* play); +void func_80A3DF60(EnGm* this, PlayState* play); const ActorInit En_Gm_InitVars = { ACTOR_EN_GM, @@ -63,7 +63,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Init(Actor* thisx, PlayState* play) { EnGm* this = (EnGm*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -71,7 +71,7 @@ void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { // "Medi Goron" osSyncPrintf(VT_FGCOL(GREEN) "%s[%d] : 中ゴロン[%d]" VT_RST "\n", __FILE__, __LINE__, this->actor.params); - this->objGmBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GM); + this->objGmBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GM); if (this->objGmBankIndex < 0) { osSyncPrintf(VT_COL(RED, WHITE)); @@ -84,10 +84,10 @@ void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { this->updateFunc = func_80A3D838; } -void EnGm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Destroy(Actor* thisx, PlayState* play) { EnGm* this = (EnGm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80A3D7C8(void) { @@ -102,16 +102,16 @@ s32 func_80A3D7C8(void) { } } -void func_80A3D838(EnGm* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objGmBankIndex)) { +void func_80A3D838(EnGm* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objGmBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objGmBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment); Animation_Change(&this->skelAnime, &object_gm_Anim_0002B8, 1.0f, 0.0f, Animation_GetLastFrame(&object_gm_Anim_0002B8), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnGm_Draw; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Actor_SetScale(&this->actor, 0.05f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -164,43 +164,43 @@ void EnGm_SetTextID(EnGm* this) { } } -void func_80A3DB04(EnGm* this, GlobalContext* globalCtx) { +void func_80A3DB04(EnGm* this, PlayState* play) { f32 dx; f32 dz; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); dx = this->talkPos.x - player->actor.world.pos.x; dz = this->talkPos.z - player->actor.world.pos.z; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { EnGm_SetTextID(this); this->actionFunc = func_80A3DC44; - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80A3DBF4; } else if ((this->collider.base.ocFlags1 & OC1_HIT) || (SQ(dx) + SQ(dz)) < SQ(100.0f)) { this->collider.base.acFlags &= ~AC_HIT; - func_8002F2CC(&this->actor, globalCtx, 415.0f); + func_8002F2CC(&this->actor, play, 415.0f); } } -void func_80A3DBF4(EnGm* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A3DBF4(EnGm* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actionFunc = func_80A3DB04; } } -void func_80A3DC44(EnGm* this, GlobalContext* globalCtx) { +void func_80A3DC44(EnGm* this, PlayState* play) { f32 dx; f32 dz; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnGm_SetTextID(this); dx = this->talkPos.x - player->actor.world.pos.x; dz = this->talkPos.z - player->actor.world.pos.z; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { switch (func_80A3D7C8()) { case 0: gSaveContext.infTable[11] |= 1; @@ -219,74 +219,74 @@ void func_80A3DC44(EnGm* this, GlobalContext* globalCtx) { } if ((this->collider.base.ocFlags1 & OC1_HIT) || (SQ(dx) + SQ(dz)) < SQ(100.0f)) { this->collider.base.acFlags &= ~AC_HIT; - func_8002F2CC(&this->actor, globalCtx, 415.0f); + func_8002F2CC(&this->actor, play, 415.0f); } } -void func_80A3DD7C(EnGm* this, GlobalContext* globalCtx) { - u8 dialogState = Message_GetState(&globalCtx->msgCtx); +void func_80A3DD7C(EnGm* this, PlayState* play) { + u8 dialogState = Message_GetState(&play->msgCtx); - if ((dialogState == TEXT_STATE_DONE || dialogState == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((dialogState == TEXT_STATE_DONE || dialogState == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actionFunc = func_80A3DC44; if (dialogState == TEXT_STATE_EVENT) { - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; } } } -void EnGm_ProcessChoiceIndex(EnGm* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes if (gSaveContext.rupees < 200) { - Message_ContinueTextbox(globalCtx, 0xC8); + Message_ContinueTextbox(play, 0xC8); this->actionFunc = func_80A3DD7C; } else { - func_8002F434(&this->actor, globalCtx, GI_SWORD_KNIFE, 415.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SWORD_KNIFE, 415.0f, 10.0f); this->actionFunc = func_80A3DF00; } break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x3050); + Message_ContinueTextbox(play, 0x3050); this->actionFunc = func_80A3DD7C; break; } } } -void func_80A3DF00(EnGm* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A3DF00(EnGm* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80A3DF60; } else { - func_8002F434(&this->actor, globalCtx, GI_SWORD_KNIFE, 415.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SWORD_KNIFE, 415.0f, 10.0f); } } -void func_80A3DF60(EnGm* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A3DF60(EnGm* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { Rupees_ChangeBy(-200); this->actionFunc = func_80A3DC44; } } -void func_80A3DFBC(EnGm* this, GlobalContext* globalCtx) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objGmBankIndex].segment); +void func_80A3DFBC(EnGm* this, PlayState* play) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment); this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.focus.rot.x = this->actor.world.rot.x; this->actor.focus.rot.y = this->actor.world.rot.y; this->actor.focus.rot.z = this->actor.world.rot.z; EnGm_UpdateEye(this); SkelAnime_Update(&this->skelAnime); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnGm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Update(Actor* thisx, PlayState* play) { EnGm* this = (EnGm*)thisx; - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); } void func_80A3E090(EnGm* this) { @@ -315,20 +315,20 @@ void func_80A3E090(EnGm* this) { this->actor.focus.pos.y += 100.0f; } -void EnGm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; EnGm* this = (EnGm*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + 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); func_80A3E090(this); } diff --git a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 94e454e4f..fd699d518 100644 --- a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -6,8 +6,8 @@ struct EnGm; -typedef void (*EnGmUpdateFunc)(struct EnGm*, GlobalContext*); -typedef void (*EnGmActionFunc)(struct EnGm*, GlobalContext*); +typedef void (*EnGmUpdateFunc)(struct EnGm*, PlayState*); +typedef void (*EnGmActionFunc)(struct EnGm*, PlayState*); typedef struct EnGm { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Go/z_en_go.c b/soh/src/overlays/actors/ovl_En_Go/z_en_go.c index 4e803af0a..936d7c0cc 100644 --- a/soh/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/soh/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -7,33 +7,33 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGo_Init(Actor* thisx, PlayState* play); +void EnGo_Destroy(Actor* thisx, PlayState* play); +void EnGo_Update(Actor* thisx, PlayState* play); +void EnGo_Draw(Actor* thisx, PlayState* play); -void func_80A3FEB4(EnGo* this, GlobalContext* globalCtx); -void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx); -void func_80A4008C(EnGo* this, GlobalContext* globalCtx); -void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx); -void EnGo_FireGenericActionFunc(EnGo* this, GlobalContext* globalCtx); -void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx); -void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx); +void func_80A3FEB4(EnGo* this, PlayState* play); +void EnGo_StopRolling(EnGo* this, PlayState* play); +void func_80A4008C(EnGo* this, PlayState* play); +void EnGo_GoronLinkRolling(EnGo* this, PlayState* play); +void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play); +void EnGo_CurledUp(EnGo* this, PlayState* play); +void EnGo_WakeUp(EnGo* this, PlayState* play); -void func_80A40494(EnGo* this, GlobalContext* globalCtx); -void func_80A405CC(EnGo* this, GlobalContext* globalCtx); -void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx); -void func_80A408D8(EnGo* this, GlobalContext* globalCtx); +void func_80A40494(EnGo* this, PlayState* play); +void func_80A405CC(EnGo* this, PlayState* play); +void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play); +void func_80A408D8(EnGo* this, PlayState* play); -void func_80A40B1C(EnGo* this, GlobalContext* globalCtx); -void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx); -void func_80A40C78(EnGo* this, GlobalContext* globalCtx); -void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx); -void func_80A40DCC(EnGo* this, GlobalContext* globalCtx); +void func_80A40B1C(EnGo* this, PlayState* play); +void EnGo_GetItem(EnGo* this, PlayState* play); +void func_80A40C78(EnGo* this, PlayState* play); +void EnGo_Eyedrops(EnGo* this, PlayState* play); +void func_80A40DCC(EnGo* this, PlayState* play); void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep); void EnGo_UpdateDust(EnGo* this); -void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx); +void EnGo_DrawDust(EnGo* this, PlayState* play); const ActorInit En_Go_InitVars = { ACTOR_EN_GO, @@ -90,8 +90,8 @@ void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } -u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); switch (thisx->params & 0xF0) { case 0x90: @@ -138,7 +138,7 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { } } case 0x10: - if (Flags_GetSwitch(globalCtx, thisx->params >> 8)) { + if (Flags_GetSwitch(play, thisx->params >> 8)) { return 0x3052; } else { return 0x3051; @@ -198,14 +198,14 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { } } -s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { +s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) { s16 unkState = 1; f32 xzRange; f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f; xzRange = thisx->xzDistToPlayer + 1.0f; - switch (Message_GetState(&globalCtx->msgCtx)) { - if (globalCtx) {} + switch (Message_GetState(&play->msgCtx)) { + if (play) {} case TEXT_STATE_CLOSING: switch (thisx->textId) { case 0x3008: @@ -229,7 +229,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { unkState = 0; break; case 0x3036: - func_8002F434(thisx, globalCtx, GI_TUNIC_GORON, xzRange, yRange); + func_8002F434(thisx, play, GI_TUNIC_GORON, xzRange, yRange); gSaveContext.infTable[16] |= 0x2000; // EnGo exclusive flag unkState = 2; break; @@ -259,10 +259,10 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (thisx->textId) { case 0x300A: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (CUR_UPG_VALUE(UPG_STRENGTH) != 0 || (gSaveContext.infTable[14] & 0x800)) { thisx->textId = 0x300B; } else { @@ -271,11 +271,11 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } else { thisx->textId = 0x300D; } - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; break; case 0x3034: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.infTable[16] & 0x800) { thisx->textId = 0x3033; } else { @@ -286,16 +286,16 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } else { thisx->textId = 0x3033; } - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; break; case 0x3054: case 0x3055: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { unkState = 2; } else { thisx->textId = 0x3056; - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; } gSaveContext.infTable[11] |= 0x10; @@ -304,14 +304,14 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (thisx->textId) { case 0x3035: gSaveContext.infTable[16] |= 0x800; case 0x3032: case 0x3033: thisx->textId = 0x3034; - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; break; default: @@ -321,7 +321,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { unkState = 3; } break; @@ -335,18 +335,18 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { return unkState; } -s32 func_80A3ED24(GlobalContext* globalCtx, EnGo* this, struct_80034A14_arg1* arg2, f32 arg3, - u16 (*getTextId)(GlobalContext*, Actor*), s16 (*unkFunc2)(GlobalContext*, Actor*)) { +s32 func_80A3ED24(PlayState* play, EnGo* this, struct_80034A14_arg1* arg2, f32 arg3, + u16 (*getTextId)(PlayState*, Actor*), s16 (*unkFunc2)(PlayState*, Actor*)) { if (arg2->unk_00) { - arg2->unk_00 = unkFunc2(globalCtx, &this->actor); + arg2->unk_00 = unkFunc2(play, &this->actor); return false; - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { arg2->unk_00 = 1; return true; - } else if (!func_8002F2CC(&this->actor, globalCtx, arg3)) { + } else if (!func_8002F2CC(&this->actor, play, arg3)) { return false; } else { - this->actor.textId = getTextId(globalCtx, &this->actor); + this->actor.textId = getTextId(play, &this->actor); return false; } } @@ -358,19 +358,19 @@ void EnGo_ChangeAnim(EnGo* this, s32 index) { sAnimationInfo[index].morphFrames); } -s32 EnGo_IsActorSpawned(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { if (((this->actor.params) & 0xF0) == 0x90) { return true; - } else if (globalCtx->sceneNum == SCENE_HIDAN && !Flags_GetSwitch(globalCtx, (this->actor.params) >> 8) && + } else if (play->sceneNum == SCENE_HIDAN && !Flags_GetSwitch(play, (this->actor.params) >> 8) && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x10) { return true; - } else if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) { + } else if (play->sceneNum == SCENE_SPOT18 && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) { return true; - } else if (globalCtx->sceneNum == SCENE_SPOT16 && LINK_IS_CHILD && + } else if (play->sceneNum == SCENE_SPOT16 && LINK_IS_CHILD && ((this->actor.params & 0xF0) == 0x20 || (this->actor.params & 0xF0) == 0x30 || (this->actor.params & 0xF0) == 0x40)) { return true; - } else if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD && + } else if (play->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD && ((this->actor.params & 0xF0) == 0x50 || (this->actor.params & 0xF0) == 0x60 || (this->actor.params & 0xF0) == 0x70)) { return true; @@ -396,8 +396,8 @@ f32 EnGo_GetGoronSize(EnGo* this) { } } -void func_80A3F060(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A3F060(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 unkVal; if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc && @@ -420,10 +420,10 @@ void func_80A3F0E4(EnGo* this) { } } -s32 EnGo_IsCameraModified(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) { f32 xyzDist; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - Camera* camera = globalCtx->cameraPtrs[MAIN_CAM]; + Camera* camera = play->cameraPtrs[MAIN_CAM]; if (fabsf(yawDiff) > 10920.0f) { return 0; @@ -465,7 +465,7 @@ void EnGo_UpdateShadow(EnGo* this) { this->actor.shape.shadowAlpha = shadowAlpha; } -s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_FollowPath(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 xDist; @@ -475,7 +475,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { return false; } - path = &globalCtx->setupPathList[this->actor.params & 0xF]; + path = &play->setupPathList[this->actor.params & 0xF]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->unk_218; xDist = pointPos->x - this->actor.world.pos.x; @@ -490,7 +490,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { if ((this->actor.params & 0xF0) != 0x00) { return true; - } else if (Flags_GetSwitch(globalCtx, this->actor.params >> 8)) { + } else if (Flags_GetSwitch(play, this->actor.params >> 8)) { return true; } else if (this->unk_218 >= this->actor.shape.rot.z) { this->unk_218 = 0; @@ -502,14 +502,14 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { return false; } -s32 EnGo_SetMovedPos(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; if ((this->actor.params & 0xF) == 0xF) { return false; } else { - path = &globalCtx->setupPathList[this->actor.params & 0xF]; + path = &play->setupPathList[this->actor.params & 0xF]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += (path->count - 1); this->actor.world.pos.x = pointPos->x; @@ -571,8 +571,8 @@ s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) { } } -void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A3F908(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 float1; s32 isUnkCondition; @@ -589,15 +589,15 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { if ((this->actor.params & 0xF0) == 0x90) { isUnkCondition = - func_80A3ED24(globalCtx, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); + func_80A3ED24(play, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); } else { - isUnkCondition = func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID, + isUnkCondition = func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); } if (((this->actor.params & 0xF0) == 0x90) && (isUnkCondition == true)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_SWORD_BROKEN) { - if (func_8002F368(globalCtx) == EXCH_ITEM_SWORD_BROKEN) { + if (func_8002F368(play) == EXCH_ITEM_SWORD_BROKEN) { if (gSaveContext.infTable[11] & 0x10) { this->actor.textId = 0x3055; } else { @@ -610,7 +610,7 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { } if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYEDROPS) { - if (func_8002F368(globalCtx) == EXCH_ITEM_EYEDROPS) { + if (func_8002F368(play) == EXCH_ITEM_EYEDROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; @@ -621,19 +621,19 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Init(Actor* thisx, PlayState* play) { EnGo* this = (EnGo*)thisx; s32 pad; Vec3f D_80A41B9C = { 0.0f, 0.0f, 0.0f }; // unused Vec3f D_80A41BA8 = { 0.0f, 0.0f, 0.0f }; // unused ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, 0, 0, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - if (!EnGo_IsActorSpawned(this, globalCtx)) { + if (!EnGo_IsActorSpawned(this, play)) { Actor_Kill(&this->actor); return; } @@ -652,7 +652,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { case 0x00: Actor_SetScale(&this->actor, 0.008f); if (CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1)) { - EnGo_SetMovedPos(this, globalCtx); + EnGo_SetMovedPos(this, play); EnGo_SetupAction(this, EnGo_CurledUp); } else { this->actor.shape.yOffset = 1400.0f; @@ -667,7 +667,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 0x40: if (gSaveContext.infTable[14] & 0x800) { - EnGo_SetMovedPos(this, globalCtx); + EnGo_SetMovedPos(this, play); } Actor_SetScale(&this->actor, 0.015f); EnGo_SetupAction(this, EnGo_CurledUp); @@ -694,34 +694,34 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Destroy(Actor* thisx, PlayState* play) { EnGo* this = (EnGo*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A3FEB4(EnGo* this, GlobalContext* globalCtx) { +void func_80A3FEB4(EnGo* this, PlayState* play) { if (!(this->actor.xyzDistToPlayerSq > SQ(1200.0f))) { EnGo_SetupAction(this, EnGo_StopRolling); } } -void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx) { +void EnGo_StopRolling(EnGo* this, PlayState* play) { EnBom* bomb; if (DECR(this->unk_20E) == 0) { if (this->collider.base.ocFlags2 & 1) { this->collider.base.ocFlags2 &= ~1; - globalCtx->damagePlayer(globalCtx, -4); - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, -4); + func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->unk_20E = 0x10; } } this->actor.speedXZ = 3.0f; - if ((EnGo_FollowPath(this, globalCtx) == true) && (this->unk_218 == 0)) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + if ((EnGo_FollowPath(this, play) == true) && (this->unk_218 == 0)) { + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { bomb->timer = 0; @@ -738,7 +738,7 @@ void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A4008C(EnGo* this, GlobalContext* globalCtx) { +void func_80A4008C(EnGo* this, PlayState* play) { if (EnGo_IsRollingOnGround(this, 3, 6.0f)) { if (this->unk_21A == 0) { this->actor.shape.yOffset = 0.0f; @@ -749,8 +749,8 @@ void func_80A4008C(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx) { - if ((EnGo_FollowPath(this, globalCtx) == true) && Flags_GetSwitch(globalCtx, this->actor.params >> 8) && +void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) { + if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, this->actor.params >> 8) && (this->unk_218 == 0)) { this->actor.speedXZ = 0.0f; EnGo_SetupAction(this, func_80A4008C); @@ -764,11 +764,11 @@ void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_FireGenericActionFunc(EnGo* this, GlobalContext* globalCtx) { +void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play) { } -void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx) { - if ((DECR(this->unk_210) == 0) && EnGo_IsCameraModified(this, globalCtx)) { +void EnGo_CurledUp(EnGo* this, PlayState* play) { + if ((DECR(this->unk_210) == 0) && EnGo_IsCameraModified(this, play)) { Audio_PlaySoundGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -777,12 +777,12 @@ void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx) { EnGo_SetupAction(this, EnGo_WakeUp); if ((this->actor.params & 0xF0) == 0x90) { - OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 4200, -99, &this->actor, MAIN_CAM); } } } -void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx) { +void EnGo_WakeUp(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { @@ -807,14 +807,14 @@ void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); EnGo_SetupAction(this, func_80A405CC); - } else if (!EnGo_IsCameraModified(this, globalCtx)) { + } else if (!EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = 0.0f; EnGo_SetupAction(this, func_80A40494); } } -void func_80A40494(EnGo* this, GlobalContext* globalCtx) { +void func_80A40494(EnGo* this, PlayState* play) { f32 frame; Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f, @@ -834,7 +834,7 @@ void func_80A40494(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A405CC(EnGo* this, GlobalContext* globalCtx) { +void func_80A405CC(EnGo* this, PlayState* play) { f32 lastFrame; f32 frame; @@ -857,7 +857,7 @@ void func_80A405CC(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { +void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { if (((this->actor.params & 0xF0) == 0x90) && (this->unk_1E0.unk_00 == 2)) { if (!gSaveContext.n64ddFlag && gSaveContext.bgsFlag) { this->unk_1E0.unk_00 = 0; @@ -867,22 +867,22 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { this->unk_21E = 100; this->unk_1E0.unk_00 = 0; EnGo_SetupAction(this, EnGo_Eyedrops); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; gSaveContext.timer2State = 0; - OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 4190, -99, &this->actor, MAIN_CAM); } else { this->unk_1E0.unk_00 = 0; EnGo_SetupAction(this, EnGo_GetItem); - Message_CloseTextbox(globalCtx); - EnGo_GetItem(this, globalCtx); + Message_CloseTextbox(play); + EnGo_GetItem(this, play); } } } else if (((this->actor.params & 0xF0) == 0) && (this->unk_1E0.unk_00 == 2)) { EnGo_SetupAction(this, EnGo_GetItem); - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else { - if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, globalCtx)) { + if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed *= (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f; @@ -891,7 +891,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A408D8(EnGo* this, GlobalContext* globalCtx) { +void func_80A408D8(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { @@ -913,7 +913,7 @@ void func_80A408D8(EnGo* this, GlobalContext* globalCtx) { if (DECR(this->unk_212) == 0) { EnGo_SetupAction(this, func_80A40494); - } else if (EnGo_IsCameraModified(this, globalCtx)) { + } else if (EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); Audio_PlaySoundGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -922,12 +922,12 @@ void func_80A408D8(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A40A54(EnGo* this, GlobalContext* globalCtx) { +void func_80A40A54(EnGo* this, PlayState* play) { f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronAnim_010590)); f32 float2 = this->skelAnime.curFrame * float1; this->actor.speedXZ = Math_SinS((s16)float2); - if (EnGo_FollowPath(this, globalCtx) && this->unk_218 == 0) { + if (EnGo_FollowPath(this, play) && this->unk_218 == 0) { EnGo_ChangeAnim(this, ENGO_ANIM_1); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); this->actor.speedXZ = 0.0f; @@ -935,22 +935,22 @@ void func_80A40A54(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A40B1C(EnGo* this, GlobalContext* globalCtx) { +void func_80A40B1C(EnGo* this, PlayState* play) { if (gSaveContext.infTable[14] & 0x800) { EnGo_ChangeAnim(this, ENGO_ANIM_3); EnGo_SetupAction(this, func_80A40A54); } else { - EnGo_BiggoronActionFunc(this, globalCtx); + EnGo_BiggoronActionFunc(this, play); } } -void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) { +void EnGo_GetItem(EnGo* this, PlayState* play) { f32 xzDist; f32 yDist; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; s32 getItemId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->unk_1E0.unk_00 = 2; this->actor.parent = NULL; EnGo_SetupAction(this, func_80A40C78); @@ -970,7 +970,7 @@ void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) { if (gSaveContext.n64ddFlag) { getItemEntry = Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_EYEDROPS, GI_CLAIM_CHECK); getItemId = getItemEntry.getItemId; - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_EYEDROPS); + Randomizer_ConsumeAdultTradeItem(play, ITEM_EYEDROPS); } else { getItemId = GI_CLAIM_CHECK; } @@ -978,7 +978,7 @@ void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_SWORD_BROKEN) { if (gSaveContext.n64ddFlag) { getItemEntry = Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_BROKEN_SWORD, GI_PRESCRIPTION); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_SWORD_BROKEN); + Randomizer_ConsumeAdultTradeItem(play, ITEM_SWORD_BROKEN); getItemId = getItemEntry.getItemId; } else { getItemId = GI_PRESCRIPTION; @@ -993,14 +993,14 @@ void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) { yDist = fabsf(this->actor.yDistToPlayer) + 1.0f; xzDist = this->actor.xzDistToPlayer + 1.0f; if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, xzDist, yDist); + func_8002F434(&this->actor, play, getItemId, xzDist, yDist); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, xzDist, yDist); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, xzDist, yDist); } } } -void func_80A40C78(EnGo* this, GlobalContext* globalCtx) { +void func_80A40C78(EnGo* this, PlayState* play) { if (this->unk_1E0.unk_00 == 3) { EnGo_SetupAction(this, EnGo_BiggoronActionFunc); if ((this->actor.params & 0xF0) != 0x90) { @@ -1010,47 +1010,47 @@ void func_80A40C78(EnGo* this, GlobalContext* globalCtx) { gSaveContext.bgsFlag = true; } else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) { this->actor.textId = 0x3058; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E0.unk_00 = 1; } else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) { this->actor.textId = 0x305C; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E0.unk_00 = 1; Environment_ClearBgsDayCount(); } } } -void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx) { +void EnGo_Eyedrops(EnGo* this, PlayState* play) { if (DECR(this->unk_21E) == 0) { this->actor.textId = 0x305A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E0.unk_00 = 1; EnGo_SetupAction(this, func_80A40DCC); } } -void func_80A40DCC(EnGo* this, GlobalContext* globalCtx) { +void func_80A40DCC(EnGo* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { EnGo_ChangeAnim(this, ENGO_ANIM_1); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); EnGo_SetupAction(this, EnGo_GetItem); - EnGo_GetItem(this, globalCtx); + EnGo_GetItem(this, play); } } -void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Update(Actor* thisx, PlayState* play) { s32 pad; EnGo* this = (EnGo*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == func_80A40B1C) { - func_80034F54(globalCtx, this->jointTable, this->morphTable, 18); + func_80034F54(play, this->jointTable, this->morphTable, 18); } EnGo_UpdateShadow(this); @@ -1059,22 +1059,22 @@ void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&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); func_80A3F0E4(this); - func_80A3F908(this, globalCtx); - this->actionFunc(this, globalCtx); - func_80A3F060(this, globalCtx); + func_80A3F908(this, play); + this->actionFunc(this, play); + func_80A3F060(this, play); } -void EnGo_DrawCurledUp(EnGo* this, GlobalContext* globalCtx) { +void EnGo_DrawCurledUp(EnGo* this, PlayState* play) { Vec3f D_80A41BB4 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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++, gGoronDL_00BD80); @@ -1082,28 +1082,28 @@ void EnGo_DrawCurledUp(EnGo* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80A41BB4, &this->actor.focus.pos); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnGo_DrawRolling(EnGo* this, GlobalContext* globalCtx) { +void EnGo_DrawRolling(EnGo* this, PlayState* play) { Vec3f D_80A41BC0 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - func_80093D18(globalCtx->state.gfxCtx); - Matrix_RotateZYX((s16)(globalCtx->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z, + func_80093D18(play->state.gfxCtx); + Matrix_RotateZYX((s16)(play->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140); Matrix_MultVec3f(&D_80A41BC0, &this->actor.focus.pos); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGo* this = (EnGo*)thisx; Vec3s vec1; f32 float1; @@ -1136,7 +1136,7 @@ s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f return 0; } -void EnGo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGo* this = (EnGo*)thisx; Vec3f D_80A41BCC = { 600.0f, 0.0f, 0.0f }; @@ -1145,32 +1145,32 @@ void EnGo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Draw(Actor* thisx, PlayState* play) { EnGo* this = (EnGo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); EnGo_UpdateDust(this); Matrix_Push(); - EnGo_DrawDust(this, globalCtx); + EnGo_DrawDust(this, play); Matrix_Pop(); if (this->actionFunc == EnGo_CurledUp) { - EnGo_DrawCurledUp(this, globalCtx); + EnGo_DrawCurledUp(this, play); } else if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 || this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) { - EnGo_DrawRolling(this, globalCtx); + EnGo_DrawRolling(this, play); } else { - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGoronCsEyeOpenTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor); - EnGo_DrawDust(this, globalCtx); + EnGo_DrawDust(this, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep) { @@ -1221,7 +1221,7 @@ void EnGo_UpdateDust(EnGo* this) { } } -void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { +void EnGo_DrawDust(EnGo* this, PlayState* play) { static void* dustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex }; EnGoEffect* dustEffect = this->dustEffects; s16 alpha; @@ -1229,9 +1229,9 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { s16 index; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); firstDone = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) { if (dustEffect->type) { if (!firstDone) { @@ -1246,9 +1246,9 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); index = dustEffect->timer * (8.0f / dustEffect->initialTimer); @@ -1257,5 +1257,5 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { FrameInterpolation_RecordCloseChild(); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Go/z_en_go.h b/soh/src/overlays/actors/ovl_En_Go/z_en_go.h index e54d45bfc..1d5d58813 100644 --- a/soh/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/soh/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -6,9 +6,9 @@ struct EnGo; -typedef void (*EnGoActionFunc)(struct EnGo*, GlobalContext*); -typedef u16 (*callback1_80A3ED24)(GlobalContext*, struct EnGo*); -typedef s16 (*callback2_80A3ED24)(GlobalContext*, struct EnGo*); +typedef void (*EnGoActionFunc)(struct EnGo*, PlayState*); +typedef u16 (*callback1_80A3ED24)(PlayState*, struct EnGo*); +typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); // WIP type docs // /* 0x00 */ GORON1_CITY_LINK, diff --git a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 781125cda..c2620fa82 100644 --- a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -44,27 +44,27 @@ this->actor.params & 0x1F Gorons only move when this->unk_194.unk_00 == 0 */ -void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGo2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGo2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGo2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGo2_Init(Actor* thisx, PlayState* play); +void EnGo2_Destroy(Actor* thisx, PlayState* play); +void EnGo2_Update(Actor* thisx, PlayState* play); +void EnGo2_Draw(Actor* thisx, PlayState* play); -void EnGo2_StopRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_CurledUp(EnGo2* this, GlobalContext* globalCtx); +void EnGo2_StopRolling(EnGo2* this, PlayState* play); +void EnGo2_CurledUp(EnGo2* this, PlayState* play); -void func_80A46B40(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_ContinueRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx); +void func_80A46B40(EnGo2* this, PlayState* play); +void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, PlayState* play); +void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play); +void EnGo2_ContinueRolling(EnGo2* this, PlayState* play); +void EnGo2_SlowRolling(EnGo2* this, PlayState* play); +void EnGo2_GroundRolling(EnGo2* this, PlayState* play); -void EnGo2_ReverseRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_SetupGetItem(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx); +void EnGo2_ReverseRolling(EnGo2* this, PlayState* play); +void EnGo2_SetupGetItem(EnGo2* this, PlayState* play); +void EnGo2_SetGetItem(EnGo2* this, PlayState* play); +void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play); +void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play); +void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play); static void* sDustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex }; @@ -219,17 +219,17 @@ void EnGo2_UpdateDust(EnGo2* this) { } } -void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_DrawDust(EnGo2* this, PlayState* play) { EnGoEffect* dustEffect = this->dustEffects; s16 alpha; s16 firstDone; s16 index; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); firstDone = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) { if (dustEffect->type) { @@ -245,9 +245,9 @@ void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); @@ -256,7 +256,7 @@ void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s32 EnGo2_SpawnDust(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 numDustEffects, f32 radius, @@ -282,21 +282,21 @@ s32 EnGo2_SpawnDust(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 return 0; } -void EnGo2_GetItem(EnGo2* this, GlobalContext* globalCtx, s32 getItemId) { +void EnGo2_GetItem(EnGo2* this, PlayState* play, s32 getItemId) { this->getItemId = getItemId; - func_8002F434(&this->actor, globalCtx, getItemId, this->actor.xzDistToPlayer + 1.0f, + func_8002F434(&this->actor, play, getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } -void EnGo2_GetItemEntry(EnGo2* this, GlobalContext* globalCtx, GetItemEntry getItemEntry) { +void EnGo2_GetItemEntry(EnGo2* this, PlayState* play, GetItemEntry getItemEntry) { this->getItemId = getItemEntry.getItemId; this->getItemEntry = getItemEntry; - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, this->actor.xzDistToPlayer + 1.0f, + GiveItemEntryFromActor(&this->actor, play, getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } -s32 EnGo2_GetDialogState(EnGo2* this, GlobalContext* globalCtx) { - s16 dialogState = Message_GetState(&globalCtx->msgCtx); +s32 EnGo2_GetDialogState(EnGo2* this, PlayState* play) { + s16 dialogState = Message_GetState(&play->msgCtx); if ((this->dialogState == TEXT_STATE_AWAITING_NEXT) || (this->dialogState == TEXT_STATE_EVENT) || (this->dialogState == TEXT_STATE_CLOSING) || (this->dialogState == TEXT_STATE_DONE_HAS_NEXT)) { @@ -332,7 +332,7 @@ u16 EnGo2_GoronFireGenericGetTextId(EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityRollingBig(PlayState* play, EnGo2* this) { if (gSaveContext.infTable[17] & 0x4000) { return 0x3013; } else if ((CUR_CAPACITY(UPG_BOMB_BAG) >= 20 || gSaveContext.n64ddFlag) && this->waypoint > 7 && this->waypoint < 12) { @@ -342,20 +342,20 @@ u16 EnGo2_GetTextIdGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 EnGo2_GetStateGoronCityRollingBig(PlayState* play, EnGo2* this) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: return 2; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3012) { this->actionFunc = EnGo2_SetupGetItem; if(!gSaveContext.n64ddFlag) { - EnGo2_GetItem(this, globalCtx, CUR_CAPACITY(UPG_BOMB_BAG) == 30 ? GI_BOMB_BAG_40 : GI_BOMB_BAG_30); + EnGo2_GetItem(this, play, CUR_CAPACITY(UPG_BOMB_BAG) == 30 ? GI_BOMB_BAG_40 : GI_BOMB_BAG_30); } else { - EnGo2_GetItemEntry(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_CHILD, GI_BOMB_BAG_40)); + EnGo2_GetItemEntry(this, play, Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_CHILD, GI_BOMB_BAG_40)); } - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gSaveContext.infTable[17] |= 0x4000; return 2; } else { @@ -367,13 +367,13 @@ s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtBombFlower(PlayState* play, EnGo2* this) { return CHECK_QUEST_ITEM(QUEST_GORON_RUBY) ? 0x3027 : 0x300A; } // DMT Goron by Bomb Flower Choice -s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 EnGo2_GetStateGoronDmtBombFlower(PlayState* play, EnGo2* this) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: if ((this->actor.textId == 0x300B) && (gSaveContext.infTable[14] & 0x800) == 0) { gSaveContext.infTable[14] |= 0x800; @@ -382,15 +382,15 @@ s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { return 0; } case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { // Ask question to DMT Goron by bomb flower if (this->actor.textId == 0x300A) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { this->actor.textId = CUR_UPG_VALUE(UPG_STRENGTH) != 0 ? 0x300B : 0x300C; } else { this->actor.textId = 0x300D; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } return 1; } @@ -399,7 +399,7 @@ s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtRollingSmall(PlayState* play, EnGo2* this) { if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else { @@ -407,15 +407,15 @@ u16 EnGo2_GetTextIdGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronDmtRollingSmall(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 0; } else { return 1; } } -u16 EnGo2_GetTextIdGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtDcEntrance(PlayState* play, EnGo2* this) { if (((!gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) || (gSaveContext.n64ddFlag && Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_FIRE_TEMPLE))) && LINK_IS_ADULT) { return 0x3043; @@ -427,8 +427,8 @@ u16 EnGo2_GetTextIdGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronDmtDcEntrance(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3008) { gSaveContext.infTable[14] |= 0x1; } @@ -438,7 +438,7 @@ s16 EnGo2_GetStateGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityEntrance(PlayState* play, EnGo2* this) { if (((!gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) || (gSaveContext.n64ddFlag && Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_FIRE_TEMPLE))) && LINK_IS_ADULT) { return 0x3043; @@ -450,8 +450,8 @@ u16 EnGo2_GetTextIdGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityEntrance(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3014) { gSaveContext.infTable[15] |= 0x1; } @@ -461,7 +461,7 @@ s16 EnGo2_GetStateGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityIsland(PlayState* play, EnGo2* this) { if (((!gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) || (gSaveContext.n64ddFlag && Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_FIRE_TEMPLE))) && LINK_IS_ADULT) { return 0x3043; @@ -473,8 +473,8 @@ u16 EnGo2_GetTextIdGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityIsland(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3016) { gSaveContext.infTable[15] |= 0x10; } @@ -484,7 +484,7 @@ s16 EnGo2_GetStateGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityLowestFloor(PlayState* play, EnGo2* this) { if (((!gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) || (gSaveContext.n64ddFlag && Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_FIRE_TEMPLE))) && LINK_IS_ADULT) { return 0x3043; @@ -493,14 +493,14 @@ u16 EnGo2_GetTextIdGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { return 0x3027; } else { return CUR_UPG_VALUE(UPG_STRENGTH) != 0 ? 0x302C - : !Flags_GetSwitch(globalCtx, 0x1B) ? 0x3017 + : !Flags_GetSwitch(play, 0x1B) ? 0x3017 : gSaveContext.infTable[15] & 0x100 ? 0x3019 : 0x3018; } } -s16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityLowestFloor(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3018) { gSaveContext.infTable[15] |= 0x100; } @@ -510,7 +510,7 @@ s16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityLink(PlayState* play, EnGo2* this) { if(gSaveContext.n64ddFlag) { return 0x3036; } @@ -528,13 +528,13 @@ u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { - switch (EnGo2_GetDialogState(this, globalCtx)) { +s16 EnGo2_GetStateGoronCityLink(PlayState* play, EnGo2* this) { + switch (EnGo2_GetDialogState(this, play)) { case TEXT_STATE_CLOSING: if(!gSaveContext.n64ddFlag) { switch (this->actor.textId) { case 0x3036: - EnGo2_GetItem(this, globalCtx, GI_TUNIC_GORON); + EnGo2_GetItem(this, play, GI_TUNIC_GORON); this->actionFunc = EnGo2_SetupGetItem; return 2; case 0x3037: @@ -543,21 +543,21 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { return 0; } } else { - if (Flags_GetTreasure(globalCtx, 0x1F)) { + if (Flags_GetTreasure(play, 0x1F)) { return 0; } gSaveContext.infTable[16] |= 0x200; - EnGo2_GetItemEntry(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_ADULT, GI_TUNIC_GORON)); + EnGo2_GetItemEntry(this, play, Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_ADULT, GI_TUNIC_GORON)); this->actionFunc = EnGo2_SetupGetItem; - Flags_SetTreasure(globalCtx, 0x1F); + Flags_SetTreasure(play, 0x1F); return 2; } case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3034) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { this->actor.textId = gSaveContext.infTable[16] & 0x800 ? 0x3033 : 0x3035; if (this->actor.textId == 0x3035) { Audio_StopSfxById(NA_SE_EN_GOLON_CRY); @@ -568,7 +568,7 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { Audio_StopSfxById(NA_SE_EN_GOLON_CRY); } } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_20C = 0; } } else { @@ -576,14 +576,14 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { } return 1; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x3035: gSaveContext.infTable[16] |= 0x800; case 0x3032: case 0x3033: this->actor.textId = 0x3034; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); return 1; default: return 2; @@ -593,8 +593,8 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { return 1; } -u16 EnGo2_GetTextIdGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { - Player* player = GET_PLAYER(globalCtx); +u16 EnGo2_GetTextIdGoronDmtBiggoron(PlayState* play, EnGo2* this) { + Player* player = GET_PLAYER(play); if (!gSaveContext.n64ddFlag && gSaveContext.bgsFlag) { player->exchangeItemId = EXCH_ITEM_CLAIM_CHECK; @@ -611,22 +611,22 @@ u16 EnGo2_GetTextIdGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { +s16 EnGo2_GetStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { s32 unusedPad; u8 dialogState = this->dialogState; - switch (EnGo2_GetDialogState(this, globalCtx)) { + switch (EnGo2_GetDialogState(this, play)) { case TEXT_STATE_DONE: if (this->actor.textId == 0x305E) { - if((!gSaveContext.n64ddFlag && gSaveContext.bgsFlag) || (gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F))) { + if((!gSaveContext.n64ddFlag && gSaveContext.bgsFlag) || (gSaveContext.n64ddFlag && Flags_GetTreasure(play, 0x1F))) { return 0; } if(gSaveContext.n64ddFlag) { - EnGo2_GetItemEntry(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_CLAIM_CHECK, GI_SWORD_BGS)); - Flags_SetTreasure(globalCtx, 0x1F); + EnGo2_GetItemEntry(this, play, Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_CLAIM_CHECK, GI_SWORD_BGS)); + Flags_SetTreasure(play, 0x1F); } else { - EnGo2_GetItem(this, globalCtx, GI_SWORD_BGS); + EnGo2_GetItem(this, play, GI_SWORD_BGS); } this->actionFunc = EnGo2_SetupGetItem; return 2; @@ -636,7 +636,7 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { case TEXT_STATE_DONE_FADING: switch (this->actor.textId) { case 0x305E: - if (func_8002F368(globalCtx) != EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) != EXCH_ITEM_CLAIM_CHECK) { break; } case 0x3059: @@ -651,30 +651,30 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { } return 1; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if ((this->actor.textId == 0x3054) || (this->actor.textId == 0x3055)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.n64ddFlag) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_BROKEN_SWORD, GI_PRESCRIPTION); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_SWORD_BROKEN); - EnGo2_GetItemEntry(this, globalCtx, getItemEntry); + Randomizer_ConsumeAdultTradeItem(play, ITEM_SWORD_BROKEN); + EnGo2_GetItemEntry(this, play, getItemEntry); } else { u32 getItemId = GI_PRESCRIPTION; - EnGo2_GetItem(this, globalCtx, getItemId); + EnGo2_GetItem(this, play, getItemId); } this->actionFunc = EnGo2_SetupGetItem; return 2; } this->actor.textId = 0x3056; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } return 1; } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3059) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = EnGo2_BiggoronEyedrops; } return 2; @@ -683,23 +683,23 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { return 1; } -u16 EnGo2_GetTextIdGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) { - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0xFC00) >> 0xA)) { +u16 EnGo2_GetTextIdGoronFireGeneric(PlayState* play, EnGo2* this) { + if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { return 0x3071; } else { return 0x3051; } } -s16 EnGo2_GetStateGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 EnGo2_GetStateGoronFireGeneric(PlayState* play, EnGo2* this) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: return 0; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3071) { this->actor.textId = EnGo2_GoronFireGenericGetTextId(this); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } return 1; } @@ -708,12 +708,12 @@ s16 EnGo2_GetStateGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityStairwell(PlayState* play, EnGo2* this) { return !LINK_IS_ADULT ? gSaveContext.infTable[14] & 0x8 ? 0x3022 : 0x300E : 0x3043; } -s16 EnGo2_GetStateGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityStairwell(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x300E) { gSaveContext.infTable[14] |= 0x8; } @@ -724,21 +724,21 @@ s16 EnGo2_GetStateGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { } // Goron in child market bazaar after obtaining Goron Ruby -u16 EnGo2_GetTextIdGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronMarketBazaar(PlayState* play, EnGo2* this) { return 0x7122; } -s16 EnGo2_GetStateGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronMarketBazaar(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 0; } else { return 1; } } -u16 EnGo2_GetTextIdGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityLostWoods(PlayState* play, EnGo2* this) { if (!LINK_IS_ADULT) { - if (Flags_GetSwitch(globalCtx, 0x1C)) { + if (Flags_GetSwitch(play, 0x1C)) { return 0x302F; } else { return gSaveContext.infTable[14] & 0x40 ? 0x3025 : 0x3024; @@ -748,8 +748,8 @@ u16 EnGo2_GetTextIdGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityLostWoods(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3024) { gSaveContext.infTable[14] |= 0x40; } @@ -760,7 +760,7 @@ s16 EnGo2_GetStateGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { } // Goron at base of DMT summit -u16 EnGo2_GetTextIdGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtFairyHint(PlayState* play, EnGo2* this) { if (!LINK_IS_ADULT) { return CHECK_QUEST_ITEM(QUEST_GORON_RUBY) ? 0x3065 : 0x3064; } else { @@ -768,103 +768,103 @@ u16 EnGo2_GetTextIdGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronDmtFairyHint(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 0; } else { return 1; } } -u16 EnGo2_GetTextId(GlobalContext* globalCtx, Actor* thisx) { +u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; - u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x20); + u16 faceReaction = Text_GetFaceReaction(play, 0x20); if (faceReaction) { return faceReaction; } else { switch (this->actor.params & 0x1F) { case GORON_CITY_ROLLING_BIG: - return EnGo2_GetTextIdGoronCityRollingBig(globalCtx, this); + return EnGo2_GetTextIdGoronCityRollingBig(play, this); case GORON_CITY_LINK: - return EnGo2_GetTextIdGoronCityLink(globalCtx, this); + return EnGo2_GetTextIdGoronCityLink(play, this); case GORON_DMT_BIGGORON: - return EnGo2_GetTextIdGoronDmtBiggoron(globalCtx, this); + return EnGo2_GetTextIdGoronDmtBiggoron(play, this); case GORON_FIRE_GENERIC: - return EnGo2_GetTextIdGoronFireGeneric(globalCtx, this); + return EnGo2_GetTextIdGoronFireGeneric(play, this); case GORON_DMT_BOMB_FLOWER: - return EnGo2_GetTextIdGoronDmtBombFlower(globalCtx, this); + return EnGo2_GetTextIdGoronDmtBombFlower(play, this); case GORON_DMT_ROLLING_SMALL: - return EnGo2_GetTextIdGoronDmtRollingSmall(globalCtx, this); + return EnGo2_GetTextIdGoronDmtRollingSmall(play, this); case GORON_DMT_DC_ENTRANCE: - return EnGo2_GetTextIdGoronDmtDcEntrance(globalCtx, this); + return EnGo2_GetTextIdGoronDmtDcEntrance(play, this); case GORON_CITY_ENTRANCE: - return EnGo2_GetTextIdGoronCityEntrance(globalCtx, this); + return EnGo2_GetTextIdGoronCityEntrance(play, this); case GORON_CITY_ISLAND: - return EnGo2_GetTextIdGoronCityIsland(globalCtx, this); + return EnGo2_GetTextIdGoronCityIsland(play, this); case GORON_CITY_LOWEST_FLOOR: - return EnGo2_GetTextIdGoronCityLowestFloor(globalCtx, this); + return EnGo2_GetTextIdGoronCityLowestFloor(play, this); case GORON_CITY_STAIRWELL: - return EnGo2_GetTextIdGoronCityStairwell(globalCtx, this); + return EnGo2_GetTextIdGoronCityStairwell(play, this); case GORON_CITY_LOST_WOODS: - return EnGo2_GetTextIdGoronCityLostWoods(globalCtx, this); + return EnGo2_GetTextIdGoronCityLostWoods(play, this); case GORON_DMT_FAIRY_HINT: - return EnGo2_GetTextIdGoronDmtFairyHint(globalCtx, this); + return EnGo2_GetTextIdGoronDmtFairyHint(play, this); case GORON_MARKET_BAZAAR: - return EnGo2_GetTextIdGoronMarketBazaar(globalCtx, this); + return EnGo2_GetTextIdGoronMarketBazaar(play, this); } } } -s16 EnGo2_GetState(GlobalContext* globalCtx, Actor* thisx) { +s16 EnGo2_GetState(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; switch (this->actor.params & 0x1F) { case GORON_CITY_ROLLING_BIG: - return EnGo2_GetStateGoronCityRollingBig(globalCtx, this); + return EnGo2_GetStateGoronCityRollingBig(play, this); case GORON_CITY_LINK: - return EnGo2_GetStateGoronCityLink(globalCtx, this); + return EnGo2_GetStateGoronCityLink(play, this); case GORON_DMT_BIGGORON: - return EnGo2_GetStateGoronDmtBiggoron(globalCtx, this); + return EnGo2_GetStateGoronDmtBiggoron(play, this); case GORON_FIRE_GENERIC: - return EnGo2_GetStateGoronFireGeneric(globalCtx, this); + return EnGo2_GetStateGoronFireGeneric(play, this); case GORON_DMT_BOMB_FLOWER: - return EnGo2_GetStateGoronDmtBombFlower(globalCtx, this); + return EnGo2_GetStateGoronDmtBombFlower(play, this); case GORON_DMT_ROLLING_SMALL: - return EnGo2_GetStateGoronDmtRollingSmall(globalCtx, this); + return EnGo2_GetStateGoronDmtRollingSmall(play, this); case GORON_DMT_DC_ENTRANCE: - return EnGo2_GetStateGoronDmtDcEntrance(globalCtx, this); + return EnGo2_GetStateGoronDmtDcEntrance(play, this); case GORON_CITY_ENTRANCE: - return EnGo2_GetStateGoronCityEntrance(globalCtx, this); + return EnGo2_GetStateGoronCityEntrance(play, this); case GORON_CITY_ISLAND: - return EnGo2_GetStateGoronCityIsland(globalCtx, this); + return EnGo2_GetStateGoronCityIsland(play, this); case GORON_CITY_LOWEST_FLOOR: - return EnGo2_GetStateGoronCityLowestFloor(globalCtx, this); + return EnGo2_GetStateGoronCityLowestFloor(play, this); case GORON_CITY_STAIRWELL: - return EnGo2_GetStateGoronCityStairwell(globalCtx, this); + return EnGo2_GetStateGoronCityStairwell(play, this); case GORON_CITY_LOST_WOODS: - return EnGo2_GetStateGoronCityLostWoods(globalCtx, this); + return EnGo2_GetStateGoronCityLostWoods(play, this); case GORON_DMT_FAIRY_HINT: - return EnGo2_GetStateGoronDmtFairyHint(globalCtx, this); + return EnGo2_GetStateGoronDmtFairyHint(play, this); case GORON_MARKET_BAZAAR: - return EnGo2_GetStateGoronMarketBazaar(globalCtx, this); + return EnGo2_GetStateGoronMarketBazaar(play, this); } } -s32 func_80A44790(EnGo2* this, GlobalContext* globalCtx) { +s32 func_80A44790(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON && (this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) { - return func_800343CC(globalCtx, &this->actor, &this->unk_194.unk_00, this->unk_218, EnGo2_GetTextId, + return func_800343CC(play, &this->actor, &this->unk_194.unk_00, this->unk_218, EnGo2_GetTextId, EnGo2_GetState); } else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) && ((this->collider.base.ocFlags2 & 1) == 0)) { return false; } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_194.unk_00 = 1; return true; } else if (this->unk_194.unk_00 != 0) { - this->unk_194.unk_00 = EnGo2_GetState(globalCtx, &this->actor); + this->unk_194.unk_00 = EnGo2_GetState(play, &this->actor); return false; - } else if (func_8002F2CC(&this->actor, globalCtx, this->unk_218)) { - this->actor.textId = EnGo2_GetTextId(globalCtx, &this->actor); + } else if (func_8002F2CC(&this->actor, play, this->unk_218)) { + this->actor.textId = EnGo2_GetTextId(play, &this->actor); } return false; } @@ -887,7 +887,7 @@ void EnGo2_SetShape(EnGo2* this) { this->unk_218 += this->collider.dim.radius; } -void EnGo2_CheckCollision(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { Vec3s pos; f32 xzDist; @@ -899,8 +899,8 @@ void EnGo2_CheckCollision(EnGo2* this, GlobalContext* globalCtx) { pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y)); pos.y += D_80A4816C[this->actor.params & 0x1F].yDist; this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { @@ -911,8 +911,8 @@ void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { this->skelAnime.endFrame = initialFrame; } -s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A44AB0(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 arg2; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { @@ -926,7 +926,7 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); this->actor.flags &= ~ACTOR_FLAG_24; this->collider.base.acFlags &= ~0x2; - EnGo2_StopRolling(this, globalCtx); + EnGo2_StopRolling(this, play); return true; } if (player->invincibilityTimer <= 0) { @@ -939,8 +939,8 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { arg2 = this->actionFunc == EnGo2_ContinueRolling ? 1.5f : this->actor.speedXZ * 1.5f; - globalCtx->damagePlayer(globalCtx, -4); - func_8002F71C(globalCtx, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, -4); + func_8002F71C(play, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); this->collider.base.ocFlags1 &= ~0x8; } @@ -949,7 +949,7 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { return false; } -s32 EnGo2_UpdateWaypoint(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_UpdateWaypoint(EnGo2* this, PlayState* play) { s32 change; if (this->path == NULL) { @@ -972,13 +972,13 @@ s32 EnGo2_UpdateWaypoint(EnGo2* this, GlobalContext* globalCtx) { return 1; } -s32 EnGo2_Orient(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_Orient(EnGo2* this, PlayState* play) { s16 targetYaw; f32 waypointDistSq = Path_OrientAndGetDistSq(&this->actor, this->path, this->waypoint, &targetYaw); Math_SmoothStepToS(&this->actor.world.rot.y, targetYaw, 6, 4000, 1); if (waypointDistSq > 0.0f && waypointDistSq < SQ(30.0f)) { - return EnGo2_UpdateWaypoint(this, globalCtx); + return EnGo2_UpdateWaypoint(this, play); } else { return 0; } @@ -1056,12 +1056,12 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 arg1, f32 arg2, s16 arg3) { return true; } -void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* player) { +void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { u16 textId; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { if ((!gSaveContext.n64ddFlag && gSaveContext.bgsFlag)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { this->actor.textId = 0x3003; } else { this->actor.textId = 0x305E; @@ -1069,8 +1069,8 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play player->actor.textId = this->actor.textId; } else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) { - if (func_8002F368(globalCtx) == EXCH_ITEM_CLAIM_CHECK) { - if (gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F)) { + if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { + if (gSaveContext.n64ddFlag && Flags_GetTreasure(play, 0x1F)) { textId = 0x3003; } else if (Environment_GetBgsDayCount() >= CVar_GetS32("gForgeTime", 3)) { textId = 0x305E; @@ -1079,7 +1079,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play } this->actor.textId = textId; } else { - if (gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F)) { + if (gSaveContext.n64ddFlag && Flags_GetTreasure(play, 0x1F)) { textId = 0x305E; } else if (Environment_GetBgsDayCount() >= CVar_GetS32("gForgeTime", 3)) { textId = 0x3002; @@ -1092,7 +1092,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play } else if ((INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_PRESCRIPTION) && (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_CLAIM_CHECK)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_EYEDROPS) { + if (func_8002F368(play) == EXCH_ITEM_EYEDROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; @@ -1103,7 +1103,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play player->actor.textId = this->actor.textId; } else if (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_SWORD_BROKEN) { - if (func_8002F368(globalCtx) == EXCH_ITEM_SWORD_BROKEN) { + if (func_8002F368(play) == EXCH_ITEM_SWORD_BROKEN) { if (gSaveContext.infTable[11] & 0x10) { textId = 0x3055; } else { @@ -1121,8 +1121,8 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play } } -void func_80A45288(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A45288(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 linkAge; if (this->actionFunc != EnGo2_GoronFireGenericAction) { @@ -1132,8 +1132,8 @@ void func_80A45288(EnGo2* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_194, 4, this->unk_26E); } if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) { - if (func_80A44790(this, globalCtx)) { - EnGo2_BiggoronSetTextId(this, globalCtx, player); + if (func_80A44790(this, play)) { + EnGo2_BiggoronSetTextId(this, play, player); } } } @@ -1192,8 +1192,8 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { } } -s32 EnGo2_IsCameraModified(EnGo2* this, GlobalContext* globalCtx) { - Camera* camera = globalCtx->cameraPtrs[MAIN_CAM]; +s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) { + Camera* camera = play->cameraPtrs[MAIN_CAM]; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { if (EnGo2_IsWakingUp(this)) { @@ -1332,7 +1332,7 @@ void EnGo2_GetDustData(EnGo2* this, s32 index2) { dustEffectData->numDustEffects, dustEffectData->radius, dustEffectData->yAccel); } -void EnGo2_RollingAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_0; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); @@ -1348,7 +1348,7 @@ void EnGo2_RollingAnimation(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = EnGo2_CurledUp; } -void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_WakeUp(EnGo2* this, PlayState* play) { if (CVar_GetS32("gUnfixGoronSpin", 0)) { // Trick SkelAnime into thinking the current animation is changing so that it morphs between the same position, // making the goron do a spin @@ -1362,7 +1362,7 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { } } if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { - OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 4200, -99, &this->actor, MAIN_CAM); // There is an issue interpolating between ENGO2_ANIM_0 and ENGO2_ANIM_1/10, the goron // is technically in the same position at the end of ANIM_0 and beginning of ANIM_1/10 // but something isn't getting translated correctly causing the 360 degree spin before @@ -1387,7 +1387,7 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A46B40; } -void EnGo2_GetItemAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->unk_211 = true; this->actionFunc = func_80A46B40; @@ -1396,7 +1396,7 @@ void EnGo2_GetItemAnimation(EnGo2* this, GlobalContext* globalCtx) { this->skelAnime.curFrame = this->skelAnime.endFrame; } -void EnGo2_SetupRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG || (this->actor.params & 0x1F) == GORON_CITY_LINK) { this->collider.info.bumperFlags = 1; this->actor.speedXZ = gSaveContext.infTable[17] & 0x4000 ? 6.0f : 3.6000001f; @@ -1410,12 +1410,12 @@ void EnGo2_SetupRolling(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = EnGo2_ContinueRolling; } -void EnGo2_StopRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_StopRolling(EnGo2* this, PlayState* play) { EnBom* bomb; if (((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) && ((this->actor.params & 0x1F) != GORON_CITY_LINK)) { if ((this->actor.params & 0x1F) == GORON_DMT_ROLLING_SMALL) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { bomb->timer = 0; @@ -1433,14 +1433,14 @@ void EnGo2_StopRolling(EnGo2* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } -s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) != GORON_FIRE_GENERIC) { return false; } // shaking curled up - this->actor.world.pos.x += (globalCtx->state.frames & 1) ? 1.0f : -1.0f; - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0xFC00) >> 0xA)) { + this->actor.world.pos.x += (play->state.frames & 1) ? 1.0f : -1.0f; + if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { return true; } return false; @@ -1459,12 +1459,12 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { return true; } -s32 EnGo2_IsGoronRollingBig(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG || (this->unk_194.unk_00 != 2)) { return false; } this->unk_194.unk_00 = 0; - EnGo2_RollingAnimation(this, globalCtx); + EnGo2_RollingAnimation(this, play); this->actionFunc = EnGo2_GoronRollingBigContinueRolling; return true; } @@ -1498,7 +1498,7 @@ s32 EnGo2_IsRolling(EnGo2* this) { return true; } -void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { s32 animation = ARRAY_COUNT(sAnimationInfo); if ((this->actor.params & 0x1F) == GORON_CITY_LINK) { @@ -1530,12 +1530,12 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GoronFireCamera(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronFireCamera(EnGo2* this, PlayState* play) { s16 yaw; - this->camId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); + this->camId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->camId, CAM_STAT_ACTIVE); Path_CopyLastPoint(this->path, &this->at); yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->at) + 0xE38; this->eye.x = Math_SinS(yaw) * 100.0f + this->actor.world.pos.x; @@ -1544,12 +1544,12 @@ void EnGo2_GoronFireCamera(EnGo2* this, GlobalContext* globalCtx) { this->at.x = this->actor.world.pos.x; this->at.y = this->actor.world.pos.y + 40.0f; this->at.z = this->actor.world.pos.z; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &this->at, &this->eye); + Play_CameraSetAtEye(play, this->camId, &this->at, &this->eye); } -void EnGo2_GoronFireClearCamera(EnGo2* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->camId); +void EnGo2_GoronFireClearCamera(EnGo2* this, PlayState* play) { + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->camId); } void EnGo2_BiggoronAnimation(EnGo2* this) { @@ -1562,14 +1562,14 @@ void EnGo2_BiggoronAnimation(EnGo2* this) { } } -void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Init(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); // Not GORON_CITY_ROLLING_BIG, GORON_CITY_LINK, GORON_DMT_BIGGORON @@ -1601,7 +1601,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { this->waypoint = 0; this->unk_216 = this->actor.shape.rot.z; this->unk_26E = 1; - this->path = Path_GetByIndex(globalCtx, (this->actor.params & 0x3E0) >> 5, 0x1F); + this->path = Path_GetByIndex(play, (this->actor.params & 0x3E0) >> 5, 0x1F); this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; switch (this->actor.params & 0x1F) { case GORON_CITY_ENTRANCE: @@ -1619,31 +1619,31 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { if ((LINK_IS_ADULT) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { Actor_Kill(&this->actor); } - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); break; case GORON_CITY_LINK: if ((gSaveContext.infTable[16] & 0x200)) { Path_CopyLastPoint(this->path, &this->actor.world.pos); this->actor.home.pos = this->actor.world.pos; if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1)) { - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); } else { this->actionFunc = EnGo2_CurledUp; } } else { gSaveContext.infTable[16] &= ~0x1000; this->collider.dim.height = (D_80A4816C[this->actor.params & 0x1F].height * 0.6f); - EnGo2_SetupRolling(this, globalCtx); + EnGo2_SetupRolling(this, play); this->isAwake = true; } break; case GORON_CITY_ROLLING_BIG: case GORON_DMT_ROLLING_SMALL: this->collider.dim.height = (D_80A4816C[this->actor.params & 0x1F].height * 0.6f); - EnGo2_SetupRolling(this, globalCtx); + EnGo2_SetupRolling(this, play); break; case GORON_FIRE_GENERIC: - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0xFC00) >> 0xA)) { + if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { Actor_Kill(&this->actor); } else { this->isAwake = true; @@ -1673,17 +1673,17 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGo2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Destroy(Actor* thisx, PlayState* play) { } -void EnGo2_CurledUp(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_CurledUp(EnGo2* this, PlayState* play) { u8 index = this->actor.params & 0x1F; s16 height; s32 quake; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, -0x3CB0); Quake_SetQuakeValues(quake, 8, 0, 0, 0); Quake_SetCountdown(quake, 16); @@ -1701,25 +1701,25 @@ void EnGo2_CurledUp(EnGo2* this, GlobalContext* globalCtx) { ((D_80A4816C[index].height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.startFrame)) + (height * 0.6f)); } - if (EnGo2_IsFreeingGoronInFire(this, globalCtx)) { + if (EnGo2_IsFreeingGoronInFire(this, play)) { this->isAwake = false; - EnGo2_WakeUp(this, globalCtx); + EnGo2_WakeUp(this, play); } if (((this->actor.params & 0x1F) != GORON_FIRE_GENERIC) && EnGo2_IsWakingUp(this)) { - EnGo2_WakeUp(this, globalCtx); + EnGo2_WakeUp(this, play); } } -void func_80A46B40(EnGo2* this, GlobalContext* globalCtx) { +void func_80A46B40(EnGo2* this, PlayState* play) { u8 index = (this->actor.params & 0x1F); f32 height; if (this->unk_211 == true) { EnGo2_BiggoronAnimation(this); - EnGo2_GoronLinkAnimation(this, globalCtx); + EnGo2_GoronLinkAnimation(this, play); EnGo2_SelectGoronWakingUp(this); - if (!EnGo2_IsGoronRollingBig(this, globalCtx) && !EnGo2_IsGoronFireGeneric(this)) { + if (!EnGo2_IsGoronRollingBig(this, play) && !EnGo2_IsGoronFireGeneric(this)) { if (EnGo2_IsGoronDmtBombFlower(this)) { return; } @@ -1740,30 +1740,30 @@ void func_80A46B40(EnGo2* this, GlobalContext* globalCtx) { (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); } } - if ((!EnGo2_IsCameraModified(this, globalCtx)) && (!EnGo2_IsWakingUp(this))) { - EnGo2_RollingAnimation(this, globalCtx); + if ((!EnGo2_IsCameraModified(this, play)) && (!EnGo2_IsWakingUp(this))) { + EnGo2_RollingAnimation(this, play); } } -void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, PlayState* play) { f32 float1 = this->skelAnime.endFrame; f32 float2 = this->skelAnime.curFrame * ((f32)0x8000 / float1); this->actor.speedXZ = Math_SinS(float2); - if ((EnGo2_Orient(this, globalCtx)) && (this->waypoint == 0)) { - EnGo2_GetItemAnimation(this, globalCtx); + if ((EnGo2_Orient(this, play)) && (this->waypoint == 0)) { + EnGo2_GetItemAnimation(this, play); } } -void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnGo2_GetDustData(this, 1); this->skelAnime.playSpeed = 0.0f; - EnGo2_SetupRolling(this, globalCtx); + EnGo2_SetupRolling(this, play); } } -void EnGo2_ContinueRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_ContinueRolling(EnGo2* this, PlayState* play) { f32 float1 = 1000.0f; if (((this->actor.params & 0x1F) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(float1))) && @@ -1774,7 +1774,7 @@ void EnGo2_ContinueRolling(EnGo2* this, GlobalContext* globalCtx) { EnGo2_GetDustData(this, 2); } -void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_SlowRolling(EnGo2* this, PlayState* play) { s32 orientation; s32 index; @@ -1786,15 +1786,15 @@ void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx) { } EnGo2_GetDustData(this, 3); } - orientation = EnGo2_Orient(this, globalCtx); + orientation = EnGo2_Orient(this, play); index = this->actor.params & 0x1F; if (index != GORON_CITY_LINK) { if ((index == GORON_DMT_ROLLING_SMALL) && (orientation == 1) && (this->waypoint == 0)) { - EnGo2_StopRolling(this, globalCtx); + EnGo2_StopRolling(this, play); return; } } else if ((orientation == 2) && (this->waypoint == 1)) { - EnGo2_StopRolling(this, globalCtx); + EnGo2_StopRolling(this, play); return; } Math_ApproachF(&this->actor.speedXZ, EnGo2_GetTargetXZSpeed(this), 0.4f, 0.6f); @@ -1802,7 +1802,7 @@ void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 0)) { EnGo2_GetDustData(this, 0); if (this->unk_59C == 0) { @@ -1812,7 +1812,7 @@ void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = EnGo2_GoronLinkStopRolling; break; case GORON_CITY_ROLLING_BIG: - EnGo2_WakeUp(this, globalCtx); + EnGo2_WakeUp(this, play); break; default: this->actionFunc = EnGo2_CurledUp; @@ -1821,7 +1821,7 @@ void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_ReverseRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_ReverseRolling(EnGo2* this, PlayState* play) { if (!EnGo2_IsRolling(this)) { Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.6f, 0.8f); if (this->actor.speedXZ >= 1.0f) { @@ -1831,45 +1831,45 @@ void EnGo2_ReverseRolling(EnGo2* this, GlobalContext* globalCtx) { this->actor.world.rot.y ^= 0x8000; this->actor.shape.rot.y = this->actor.world.rot.y; this->reverse ^= 1; - EnGo2_UpdateWaypoint(this, globalCtx); - EnGo2_SetupRolling(this, globalCtx); + EnGo2_UpdateWaypoint(this, play); + EnGo2_SetupRolling(this, play); } } } -void EnGo2_SetupGetItem(EnGo2* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnGo2_SetupGetItem(EnGo2* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnGo2_SetGetItem; } else { if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + func_8002F434(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } } } -void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnGo2_SetGetItem(EnGo2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->unk_194.unk_00 = 0; switch (this->getItemId) { case GI_CLAIM_CHECK: Environment_ClearBgsDayCount(); - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); return; case GI_TUNIC_GORON: if (!gSaveContext.n64ddFlag) { gSaveContext.infTable[16] |= 0x200; } - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); return; case GI_SWORD_BGS: gSaveContext.bgsFlag = true; break; case GI_BOMB_BAG_30: case GI_BOMB_BAG_40: - EnGo2_RollingAnimation(this, globalCtx); + EnGo2_RollingAnimation(this, play); this->actionFunc = EnGo2_GoronRollingBigContinueRolling; return; } @@ -1884,7 +1884,7 @@ void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { switch (this->goronState) { case 0: Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_5); @@ -1897,19 +1897,19 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { this->goronState++; func_800F483C(0x28, 5); if (!gSaveContext.n64ddFlag) { - OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 4190, -99, &this->actor, MAIN_CAM); } break; case 1: if (DECR(this->animTimer)) { if (this->animTimer == 60 || this->animTimer == 120) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); func_800F4524(&D_801333D4, NA_SE_EV_GORON_WATER_DROP, 60); } } else { func_800F4524(&D_801333D4, NA_SE_EN_GOLON_GOOD_BIG, 60); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_6); - Message_ContinueTextbox(globalCtx, 0x305A); + Message_ContinueTextbox(play, 0x305A); this->eyeMouthTexState = 3; this->goronState++; func_800F483C(0x7F, 5); @@ -1919,7 +1919,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->eyeMouthTexState = 0; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->actor.flags |= ACTOR_FLAG_0; this->unk_26E = 2; @@ -1927,11 +1927,11 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { this->skelAnime.curFrame = this->skelAnime.endFrame; if (gSaveContext.n64ddFlag) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_EYEDROPS, GI_CLAIM_CHECK); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_EYEDROPS); - EnGo2_GetItemEntry(this, globalCtx, getItemEntry); + Randomizer_ConsumeAdultTradeItem(play, ITEM_EYEDROPS); + EnGo2_GetItemEntry(this, play, getItemEntry); } else { u32 getItemId = GI_CLAIM_CHECK; - EnGo2_GetItem(this, globalCtx, getItemId); + EnGo2_GetItem(this, play, getItemId); } this->actionFunc = EnGo2_SetupGetItem; this->goronState = 0; @@ -1940,15 +1940,15 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->goronState) { case 0: - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { return; } else { - Message_StartTextbox(globalCtx, 0x3031, NULL); + Message_StartTextbox(play, 0x3031, NULL); player->actor.freezeTimer = 10; this->goronState++; } @@ -1958,7 +1958,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { return; } - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) { player->actor.freezeTimer = 10; } else { gSaveContext.infTable[16] |= 0x1000; @@ -1969,15 +1969,15 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3s D_80A4854C = { 0x00, 0x00, 0x00 }; switch (this->goronState) { case 0: // Wake up - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { - EnGo2_GoronFireCamera(this, globalCtx); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { + EnGo2_GoronFireCamera(this, play); + play->msgCtx.msgMode = MSGMODE_PAUSED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_2); this->waypoint = 1; this->skelAnime.playSpeed = 2.0f; @@ -1996,7 +1996,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { (f32)((Math_SinS(this->actor.world.rot.y) * -30.0f) + this->actor.world.pos.x); player->actor.world.pos.z = (f32)((Math_CosS(this->actor.world.rot.y) * -30.0f) + this->actor.world.pos.z); - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); Audio_PlayFanfare(NA_BGM_APPEAR); } break; @@ -2026,14 +2026,14 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_IRON_DOOR_OPEN); } if (this->animTimer > 44) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_IRON_DOOR_CLOSE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_IRON_DOOR_CLOSE); } else { break; } case 4: // Finalize walking away - Message_CloseTextbox(globalCtx); - EnGo2_GoronFireClearCamera(this, globalCtx); - func_8002DF54(globalCtx, &this->actor, 7); + Message_CloseTextbox(play); + EnGo2_GoronFireClearCamera(this, play); + func_8002DF54(play, &this->actor, 7); Actor_Kill(&this->actor); break; case 1: @@ -2041,59 +2041,59 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Update(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; func_80A45360(this, &this->alpha); EnGo2_SitDownAnimation(this); SkelAnime_Update(&this->skelAnime); EnGo2_RollForward(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, (f32)this->collider.dim.height * 0.5f, + Actor_UpdateBgCheckInfo(play, &this->actor, (f32)this->collider.dim.height * 0.5f, (f32)this->collider.dim.radius * 0.6f, 0.0f, 5); if (this->unk_194.unk_00 == 0) { - func_80A44AB0(this, globalCtx); + func_80A44AB0(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_211 == true) { - func_80034F54(globalCtx, this->unk_226, this->unk_24A, 18); + func_80034F54(play, this->unk_226, this->unk_24A, 18); } - func_80A45288(this, globalCtx); + func_80A45288(this, play); EnGo2_EyeMouthTexState(this); - EnGo2_CheckCollision(this, globalCtx); + EnGo2_CheckCollision(this, play); } -s32 EnGo2_DrawCurledUp(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_DrawCurledUp(EnGo2* this, PlayState* play) { Vec3f D_80A48554 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(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++, gGoronDL_00BD80); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&D_80A48554, &this->actor.focus.pos); return 1; } -s32 EnGo2_DrawRolling(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { s32 pad; Vec3f D_80A48560 = { 0.0f, 0.0f, 0.0f }; f32 speedXZ; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); speedXZ = this->actionFunc == EnGo2_ReverseRolling ? 0.0f : this->actor.speedXZ; - Matrix_RotateZYX((globalCtx->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_RotateZYX((play->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&D_80A48560, &this->actor.focus.pos); return 1; } -s32 EnGo2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGo2* this = (EnGo2*)thisx; Vec3s vec1; f32 float1; @@ -2123,7 +2123,7 @@ s32 EnGo2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3 return 0; } -void EnGo2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGo2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGo2* this = (EnGo2*)thisx; Vec3f D_80A4856C = { 600.0f, 0.0f, 0.0f }; @@ -2132,31 +2132,31 @@ void EnGo2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGo2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Draw(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; void* eyeTextures[] = { gGoronCsEyeClosed2Tex, gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; void* mouthTextures[] = { gGoronCsMouthNeutralTex, gGoronCsMouthSmileTex }; EnGo2_UpdateDust(this); Matrix_Push(); - EnGo2_DrawDust(this, globalCtx); + EnGo2_DrawDust(this, play); Matrix_Pop(); if ((this->actionFunc == EnGo2_CurledUp) && (this->skelAnime.playSpeed == 0.0f) && (this->skelAnime.curFrame == 0.0f)) { - EnGo2_DrawCurledUp(this, globalCtx); + EnGo2_DrawCurledUp(this, play); } else if (this->actionFunc == EnGo2_SlowRolling || this->actionFunc == EnGo2_ReverseRolling || this->actionFunc == EnGo2_ContinueRolling) { - EnGo2_DrawRolling(this, globalCtx); + EnGo2_DrawRolling(this, play); } else { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGo2_OverrideLimbDraw, EnGo2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 1618005f9..82bd54781 100644 --- a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -7,7 +7,7 @@ struct EnGo2; -typedef void (*EnGo2ActionFunc)(struct EnGo2*, GlobalContext*); +typedef void (*EnGo2ActionFunc)(struct EnGo2*, PlayState*); typedef enum { /* 0x00 */ GORON_CITY_ROLLING_BIG, diff --git a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 179069b45..274f98257 100644 --- a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -6,34 +6,34 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGoma_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGoma_Init(Actor* thisx, PlayState* play); +void EnGoma_Destroy(Actor* thisx, PlayState* play); +void EnGoma_Update(Actor* thisx, PlayState* play); +void EnGoma_Draw(Actor* thisx, PlayState* play); void EnGoma_Reset(void); -void EnGoma_Flee(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Egg(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Hatch(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Hurt(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Die(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_PrepareJump(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Land(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Stand(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_ChasePlayer(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Stunned(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Debris(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_SpawnHatchDebris(EnGoma* this, GlobalContext* globalCtx2); -void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx); +void EnGoma_Flee(EnGoma* this, PlayState* play); +void EnGoma_EggFallToGround(EnGoma* this, PlayState* play); +void EnGoma_Egg(EnGoma* this, PlayState* play); +void EnGoma_Hatch(EnGoma* this, PlayState* play); +void EnGoma_Hurt(EnGoma* this, PlayState* play); +void EnGoma_Die(EnGoma* this, PlayState* play); +void EnGoma_Dead(EnGoma* this, PlayState* play); +void EnGoma_PrepareJump(EnGoma* this, PlayState* play); +void EnGoma_Land(EnGoma* this, PlayState* play); +void EnGoma_Jump(EnGoma* this, PlayState* play); +void EnGoma_Stand(EnGoma* this, PlayState* play); +void EnGoma_ChasePlayer(EnGoma* this, PlayState* play); +void EnGoma_Stunned(EnGoma* this, PlayState* play); +void EnGoma_LookAtPlayer(EnGoma* this, PlayState* play); +void EnGoma_UpdateHit(EnGoma* this, PlayState* play); +void EnGoma_Debris(EnGoma* this, PlayState* play); +void EnGoma_SpawnHatchDebris(EnGoma* this, PlayState* play2); +void EnGoma_BossLimb(EnGoma* this, PlayState* play); void EnGoma_SetupFlee(EnGoma* this); -void EnGoma_SetupHatch(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_SetupHurt(EnGoma* this, GlobalContext* globalCtx); +void EnGoma_SetupHatch(EnGoma* this, PlayState* play); +void EnGoma_SetupHurt(EnGoma* this, PlayState* play); void EnGoma_SetupDie(EnGoma* this); void EnGoma_SetupDead(EnGoma* this); void EnGoma_SetupStand(EnGoma* this); @@ -41,7 +41,7 @@ void EnGoma_SetupChasePlayer(EnGoma* this); void EnGoma_SetupPrepareJump(EnGoma* this); void EnGoma_SetupLand(EnGoma* this); void EnGoma_SetupJump(EnGoma* this); -void EnGoma_SetupStunned(EnGoma* this, GlobalContext* globalCtx); +void EnGoma_SetupStunned(EnGoma* this, PlayState* play); const ActorInit En_Goma_InitVars = { ACTOR_BOSS_GOMA, @@ -106,7 +106,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 20, ICHAIN_STOP), }; -void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Init(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; s16 params; @@ -116,7 +116,7 @@ void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { params = this->actor.params; if (params >= 100) { // piece of boss goma - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); this->actionFunc = EnGoma_BossLimb; this->gomaType = ENGOMA_BOSSLIMB; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); @@ -138,7 +138,7 @@ void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); } else { // Egg ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_Init(globalCtx, &this->skelanime, &gObjectGolSkel, &gObjectGolStandAnim, this->jointTable, + SkelAnime_Init(play, &this->skelanime, &gObjectGolSkel, &gObjectGolStandAnim, this->jointTable, this->morphTable, GOMA_LIMB_MAX); Animation_PlayLoop(&this->skelanime, &gObjectGolStandAnim); this->actor.colChkInfo.health = 2; @@ -164,19 +164,19 @@ void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { this->eggScale = 1.0f; this->eggSquishAngle = Rand_ZeroOne() * 1000.0f; this->actionTimer = 50; - Collider_InitCylinder(globalCtx, &this->colCyl1); - Collider_SetCylinder(globalCtx, &this->colCyl1, &this->actor, &D_80A4B7A0); - Collider_InitCylinder(globalCtx, &this->colCyl2); - Collider_SetCylinder(globalCtx, &this->colCyl2, &this->actor, &D_80A4B7CC); + Collider_InitCylinder(play, &this->colCyl1); + Collider_SetCylinder(play, &this->colCyl1, &this->actor, &D_80A4B7A0); + Collider_InitCylinder(play, &this->colCyl2); + Collider_SetCylinder(play, &this->colCyl2, &this->actor, &D_80A4B7CC); } } -void EnGoma_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Destroy(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; if (this->actor.params < 10) { - Collider_DestroyCylinder(globalCtx, &this->colCyl1); - Collider_DestroyCylinder(globalCtx, &this->colCyl2); + Collider_DestroyCylinder(play, &this->colCyl1); + Collider_DestroyCylinder(play, &this->colCyl2); } } @@ -193,11 +193,11 @@ void EnGoma_SetupFlee(EnGoma* this) { } } -void EnGoma_Flee(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Flee(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachF(&this->actor.speedXZ, 20.0f / 3.0f, 0.5f, 2.0f); Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000, 3, 2000); + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) + 0x8000, 3, 2000); Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 3000); if (this->actionTimer == 0) { @@ -205,7 +205,7 @@ void EnGoma_Flee(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_EggFallToGround(EnGoma* this, PlayState* play) { this->actor.gravity = -1.3f; this->eggSquishAccel += 0.03f; this->eggSquishAngle += 1.0f + this->eggSquishAccel; @@ -222,7 +222,7 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { } if (this->actor.params > 5) { - EnGoma_SetupHatch(this, globalCtx); + EnGoma_SetupHatch(this, play); } else { this->hatchState = 1; this->actionTimer = 3; @@ -255,7 +255,7 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { case 3: Math_ApproachF(&this->eggScale, 1.0f, 0.1f, 0.1f); if (this->actionTimer == 0) { - EnGoma_SetupHatch(this, globalCtx); + EnGoma_SetupHatch(this, play); } break; } @@ -267,8 +267,8 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnGoma_Egg(EnGoma* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGoma_Egg(EnGoma* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; this->eggSquishAngle += 1.0f; @@ -291,41 +291,41 @@ void EnGoma_Egg(EnGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(30.0f) + this->actor.world.pos.x; pos.y = Rand_ZeroFloat(30.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &acc, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, HAHEN_OBJECT_DEFAULT, + EffectSsHahen_Spawn(play, &pos, &vel, &acc, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, HAHEN_OBJECT_DEFAULT, 10, NULL); } } } -void EnGoma_SetupHatch(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_SetupHatch(EnGoma* this, PlayState* play) { Animation_Change(&this->skelanime, &gObjectGolJumpHeadbuttAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGolJumpHeadbuttAnim), ANIMMODE_ONCE, 0.0f); this->actionFunc = EnGoma_Hatch; Actor_SetScale(&this->actor, 0.005f); this->gomaType = ENGOMA_NORMAL; this->actionTimer = 5; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); this->actor.world.rot.y = this->actor.shape.rot.y; - EnGoma_SpawnHatchDebris(this, globalCtx); + EnGoma_SpawnHatchDebris(this, play); this->eggScale = 1.0f; this->actor.speedXZ = 0.0f; } -void EnGoma_Hatch(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Hatch(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actionTimer == 0) { EnGoma_SetupStand(this); } } -void EnGoma_SetupHurt(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_SetupHurt(EnGoma* this, PlayState* play) { Animation_Change(&this->skelanime, &gObjectGolDamagedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGolDamagedAnim), ANIMMODE_ONCE, -2.0f); this->actionFunc = EnGoma_Hurt; if ((s8)this->actor.colChkInfo.health <= 0) { this->actionTimer = 5; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { this->actionTimer = 10; } @@ -339,7 +339,7 @@ void EnGoma_SetupHurt(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_Hurt(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Hurt(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.bgCheckFlags & 1) { @@ -371,7 +371,7 @@ void EnGoma_SetupDie(EnGoma* this) { this->actor.flags &= ~ACTOR_FLAG_0; } -void EnGoma_Die(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Die(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.bgCheckFlags & 1) { @@ -398,7 +398,7 @@ void EnGoma_SetupDead(EnGoma* this) { this->actionTimer = 3; } -void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Dead(EnGoma* this, PlayState* play) { Vec3f accel; Vec3f pos; @@ -411,7 +411,7 @@ void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx) { pos.z = this->actor.world.pos.z; accel = sDeadEffectVel; accel.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &pos, &sDeadEffectVel, &accel, 40, 0); + EffectSsKFire_Spawn(play, &pos, &sDeadEffectVel, &accel, 40, 0); } if (this->actionTimer == 0 && Math_SmoothStepToF(&this->actor.scale.y, 0.0f, 0.5f, 0.00225f, 0.00001f) <= 0.001f) { @@ -422,7 +422,7 @@ void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx) { } Audio_PlaySoundGeneral(NA_SE_EN_EXTINCT, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); Actor_Kill(&this->actor); - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x30); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x30); } this->visualState = 2; } @@ -451,13 +451,13 @@ void EnGoma_SetupPrepareJump(EnGoma* this) { this->actionTimer = 30; } -void EnGoma_PrepareJump(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_PrepareJump(EnGoma* this, PlayState* play) { s16 targetAngle; SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); - targetAngle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + targetAngle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); Math_ApproachS(&this->actor.world.rot.y, targetAngle, 2, 4000); Math_ApproachS(&this->actor.shape.rot.y, targetAngle, 2, 3000); @@ -474,7 +474,7 @@ void EnGoma_SetupLand(EnGoma* this) { this->actionTimer = 10; } -void EnGoma_Land(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Land(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.bgCheckFlags & 1) { @@ -498,7 +498,7 @@ void EnGoma_SetupJump(EnGoma* this) { } } -void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Jump(EnGoma* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_24; SkelAnime_Update(&this->skelanime); Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.5f, 5.0f); @@ -514,10 +514,10 @@ void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx) { this->visualState = 0; } -void EnGoma_Stand(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Stand(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); - Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, + Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 2, 3000); if (this->actionTimer == 0) { @@ -525,7 +525,7 @@ void EnGoma_Stand(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_ChasePlayer(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_ChasePlayer(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 5.0f)) { @@ -548,7 +548,7 @@ void EnGoma_ChasePlayer(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_SetupStunned(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_SetupStunned(EnGoma* this, PlayState* play) { this->actionFunc = EnGoma_Stunned; this->stunTimer = 100; Animation_MorphToLoop(&this->skelanime, &gObjectGolStandAnim, -5.0f); @@ -561,7 +561,7 @@ void EnGoma_SetupStunned(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_Stunned(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Stunned(EnGoma* this, PlayState* play) { Actor_SetColorFilter(&this->actor, 0, 180, 0, 2); this->visualState = 2; @@ -587,12 +587,12 @@ void EnGoma_Stunned(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_LookAtPlayer(EnGoma* this, PlayState* play) { s16 eyePitch; s16 eyeYaw; - eyeYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.y; - eyePitch = Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.x; + eyeYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.y; + eyePitch = Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.x; if (eyeYaw > 6000) { eyeYaw = 6000; @@ -604,9 +604,9 @@ void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->eyePitch, eyePitch, 3, 2000); } -void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { static Vec3f sShieldKnockbackVel = { 0.0f, 0.0f, 20.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->hurtTimer != 0) { this->hurtTimer--; @@ -639,20 +639,20 @@ void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { } } else if (dmgFlags & 1) { // stun if (this->actionFunc != EnGoma_Stunned) { - EnGoma_SetupStunned(this, globalCtx); + EnGoma_SetupStunned(this, play); this->hurtTimer = 8; } } else { swordDamage = CollisionCheck_GetSwordDamage(dmgFlags); if (swordDamage) { - EffectSsSibuki_SpawnBurst(globalCtx, &this->actor.focus.pos); + EffectSsSibuki_SpawnBurst(play, &this->actor.focus.pos); } else { swordDamage = 1; } this->actor.colChkInfo.health -= swordDamage; - EnGoma_SetupHurt(this, globalCtx); + EnGoma_SetupHurt(this, play); Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 5); this->hurtTimer = 13; } @@ -664,7 +664,7 @@ void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { parent->childrenGohmaState[this->actor.params] = -1; } - EnGoma_SpawnHatchDebris(this, globalCtx); + EnGoma_SpawnHatchDebris(this, play); Actor_Kill(&this->actor); } } @@ -697,10 +697,10 @@ void EnGoma_SetFloorRot(EnGoma* this) { } } -void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Update(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->actionTimer != 0) { this->actionTimer--; @@ -709,7 +709,7 @@ void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { this->invincibilityTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); this->actor.world.pos.x = this->actor.world.pos.x + this->shieldKnockbackVel.x; this->actor.world.pos.z = this->actor.world.pos.z + this->shieldKnockbackVel.z; @@ -721,11 +721,11 @@ void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.scale.x, 0.01f, 0.5f, 0.00075f, 0.000001f); Math_SmoothStepToF(&this->actor.scale.y, 0.01f, 0.5f, 0.00075f, 0.000001f); Math_SmoothStepToF(&this->actor.scale.z, 0.01f, 0.5f, 0.00075f, 0.000001f); - EnGoma_UpdateHit(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 5); + EnGoma_UpdateHit(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 5); EnGoma_SetFloorRot(this); Actor_SetFocus(&this->actor, 20.0f); - EnGoma_LookAtPlayer(this, globalCtx); + EnGoma_LookAtPlayer(this, play); EnGoma_UpdateEyeEnvColor(this); this->visualState = 1; if (player->swordState != 0) { @@ -740,17 +740,17 @@ void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->invincibilityTimer == 0) { Collider_UpdateCylinder(&this->actor, &this->colCyl1); Collider_UpdateCylinder(&this->actor, &this->colCyl2); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCyl1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCyl2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colCyl1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCyl1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCyl2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colCyl1.base); } } } -s32 EnGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGoma_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGoma* this = (EnGoma*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->eyeEnvColor[0], (s16)this->eyeEnvColor[1], (s16)this->eyeEnvColor[2], 255); @@ -762,7 +762,7 @@ s32 EnGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList (s16)(Rand_ZeroOne() * 255.0f), 255); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return 0; } @@ -778,20 +778,20 @@ Gfx* EnGoma_NoBackfaceCullingDlist(GraphicsContext* gfxCtx) { return dList; } -void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Draw(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; s32 y; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); switch (this->gomaType) { case ENGOMA_NORMAL: this->actor.naviEnemyId = 0x03; Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + ((this->actor.shape.yOffset * this->actor.scale.y) + - globalCtx->mainCamera.skyboxOffset.y), + play->mainCamera.skyboxOffset.y), this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateX(this->slopePitch / (f32)0x8000 * M_PI, MTXMODE_APPLY); Matrix_RotateZ(this->slopeRoll / (f32)0x8000 * M_PI, MTXMODE_APPLY); @@ -799,7 +799,7 @@ void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(this->actor.shape.rot.x / (f32)0x8000 * M_PI, MTXMODE_APPLY); Matrix_RotateZ(this->actor.shape.rot.z / (f32)0x8000 * M_PI, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, EnGoma_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, EnGoma_OverrideLimbDraw, NULL, this); break; @@ -807,7 +807,7 @@ void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actor.naviEnemyId = 0x02; y = (s16)(sinf((this->eggTimer * 5.0f * 3.1415f) / 180.0f) * 31.9f); y = (s16)(y + 31); - gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(globalCtx->state.gfxCtx, 0, y)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(play->state.gfxCtx, 0, y)); Matrix_Push(); Matrix_Scale(this->eggScale, 1.0f / this->eggScale, this->eggScale, MTXMODE_APPLY); Matrix_RotateY(this->eggSquishAngle * 0.15f, MTXMODE_APPLY); @@ -818,31 +818,31 @@ void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(-(this->eggSquishAngle * 0.15f), MTXMODE_APPLY); Matrix_Translate(0.0f, this->eggYOffset, 0.0f, MTXMODE_APPLY); Matrix_RotateX(this->eggPitch, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gObjectGolEggDL); Matrix_Pop(); break; case ENGOMA_HATCH_DEBRIS: - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBrownFragmentDL); break; case ENGOMA_BOSSLIMB: if (this->bossLimbDL != NULL) { - gSPSegment(POLY_OPA_DISP++, 0x08, EnGoma_NoBackfaceCullingDlist(globalCtx->state.gfxCtx)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPSegment(POLY_OPA_DISP++, 0x08, EnGoma_NoBackfaceCullingDlist(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++, this->bossLimbDL); } break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnGoma_Debris(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Debris(EnGoma* this, PlayState* play) { this->actor.shape.rot.y += 2500; this->actor.shape.rot.x += 3500; if (this->actionTimer == 0) { @@ -850,18 +850,18 @@ void EnGoma_Debris(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_SpawnHatchDebris(EnGoma* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGoma_SpawnHatchDebris(EnGoma* this, PlayState* play2) { + PlayState* play = play2; s16 i; if (this->actor.params < 6) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_GOMA_BJR_EGG2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GOMA_BJR_EGG2); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_GOMA_EGG2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GOMA_EGG2); } for (i = 0; i < 15; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GOMA, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GOMA, Rand_CenteredFloat(10.0f) + this->actor.world.pos.x, Rand_CenteredFloat(10.0f) + this->actor.world.pos.y + 15.0f, Rand_CenteredFloat(10.0f) + this->actor.world.pos.z, 0, Rand_CenteredFloat(0x10000 - 0.01f), @@ -869,7 +869,7 @@ void EnGoma_SpawnHatchDebris(EnGoma* this, GlobalContext* globalCtx2) { } } -void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_BossLimb(EnGoma* this, PlayState* play) { Vec3f vel = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 1.0f, 0.0f }; Color_RGBA8 primColor = { 255, 255, 255, 255 }; @@ -877,7 +877,7 @@ void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx) { Vec3f pos; this->actor.world.pos.y -= 5.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 4); this->actor.world.pos.y += 5.0f; if (this->actor.bgCheckFlags & 1) { @@ -901,7 +901,7 @@ void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - func_8002836C(globalCtx, &pos, &vel, &accel, &primColor, &envColor, 500, 10, 10); + func_8002836C(play, &pos, &vel, &accel, &primColor, &envColor, 500, 10, 10); } } diff --git a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h index bcce4b4d5..b04162aca 100644 --- a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h +++ b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.h @@ -13,7 +13,7 @@ typedef enum { struct EnGoma; -typedef void (*EnGomaActionFunc)(struct EnGoma*, GlobalContext*); +typedef void (*EnGomaActionFunc)(struct EnGoma*, PlayState*); typedef enum { /* 0 */ GOMA_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 978450222..154a12c1f 100644 --- a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -12,7 +12,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef s32 (*EnGoroiwaUnkFunc1)(EnGoroiwa* this, GlobalContext* globalCtx); +typedef s32 (*EnGoroiwaUnkFunc1)(EnGoroiwa* this, PlayState* play); typedef void (*EnGoroiwaUnkFunc2)(EnGoroiwa* this); #define ENGOROIWA_ENABLE_AT (1 << 0) @@ -26,21 +26,21 @@ typedef void (*EnGoroiwaUnkFunc2)(EnGoroiwa* this); #define ENGOROIWA_LOOPMODE_ONEWAY_BREAK 1 #define ENGOROIWA_LOOPMODE_ROUNDTRIP 3 -void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGoroiwa_Init(Actor* thisx, PlayState* play); +void EnGoroiwa_Destroy(Actor* thisx, PlayState* play); +void EnGoroiwa_Update(Actor* thisx, PlayState* play); +void EnGoroiwa_Draw(Actor* thisx, PlayState* play); void EnGoroiwa_SetupRoll(EnGoroiwa* this); -void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupMoveAndFallToGround(EnGoroiwa* this); -void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupWait(EnGoroiwa* this); -void EnGoroiwa_Wait(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_Wait(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupMoveUp(EnGoroiwa* this); -void EnGoroiwa_MoveUp(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_MoveUp(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupMoveDown(EnGoroiwa* this); -void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_MoveDown(EnGoroiwa* this, PlayState* play); const ActorInit En_Goroiwa_InitVars = { ACTOR_EN_GOROIWA, @@ -95,11 +95,11 @@ void EnGoroiwa_UpdateCollider(EnGoroiwa* this) { worldSphere->center.z = this->actor.world.pos.z; } -void EnGoroiwa_InitCollider(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_InitCollider(EnGoroiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); EnGoroiwa_UpdateCollider(this); this->collider.elements[0].dim.worldSphere.radius = 58; } @@ -126,8 +126,8 @@ s32 EnGoroiwa_Vec3fNormalize(Vec3f* ret, Vec3f* a) { return true; } -void EnGoroiwa_SetSpeed(EnGoroiwa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT04) { +void EnGoroiwa_SetSpeed(EnGoroiwa* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT04) { this->isInKokiri = true; R_EN_GOROIWA_SPEED = 920; } else { @@ -136,8 +136,8 @@ void EnGoroiwa_SetSpeed(EnGoroiwa* this, GlobalContext* globalCtx) { } } -void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; +void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3f nextPosF; @@ -148,9 +148,9 @@ void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &nextPosF); } -void EnGoroiwa_GetPrevWaypointDiff(EnGoroiwa* this, GlobalContext* globalCtx, Vec3f* dest) { +void EnGoroiwa_GetPrevWaypointDiff(EnGoroiwa* this, PlayState* play, Vec3f* dest) { s16 loopMode = (this->actor.params >> 8) & 3; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; s16 prevWaypoint = this->currentWaypoint - this->pathDirection; Vec3s* prevPointPos; Vec3s* currentPointPos; @@ -214,15 +214,15 @@ void EnGoroiwa_ReverseDirection(EnGoroiwa* this) { this->nextWaypoint += this->pathDirection; } -void EnGoroiwa_InitPath(EnGoroiwa* this, GlobalContext* globalCtx) { - this->endWaypoint = globalCtx->setupPathList [this->actor.params & 0xFF].count - 1; +void EnGoroiwa_InitPath(EnGoroiwa* this, PlayState* play) { + this->endWaypoint = play->setupPathList [this->actor.params & 0xFF].count - 1; this->currentWaypoint = 0; this->nextWaypoint = 1; this->pathDirection = 1; } -void EnGoroiwa_TeleportToWaypoint(EnGoroiwa* this, GlobalContext* globalCtx, s32 waypoint) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; +void EnGoroiwa_TeleportToWaypoint(EnGoroiwa* this, PlayState* play, s32 waypoint) { + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + waypoint; this->actor.world.pos.x = pointPos->x; @@ -235,9 +235,9 @@ void EnGoroiwa_InitRotation(EnGoroiwa* this) { this->rollRotSpeed = 1.0f; } -s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; @@ -258,7 +258,7 @@ s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, GlobalContext* globalCtx) { return 0; } -void EnGoroiwa_SpawnDust(GlobalContext* globalCtx, Vec3f* pos) { +void EnGoroiwa_SpawnDust(PlayState* play, Vec3f* pos) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.3f, 0.0f }; Vec3f randPos; @@ -270,12 +270,12 @@ void EnGoroiwa_SpawnDust(GlobalContext* globalCtx, Vec3f* pos) { randPos.x = pos->x + (47.0f * (Rand_ZeroOne() * 0.5f + 0.5f)) * Math_SinS(angle); randPos.y = pos->y + (Rand_ZeroOne() - 0.5f) * 40.0f; randPos.z = pos->z + ((47.0f * (Rand_ZeroOne() * 0.5f + 0.5f))) * Math_CosS(angle); - func_800286CC(globalCtx, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 30.0f) + 100, 80); - func_800286CC(globalCtx, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 20.0f) + 80, 80); + func_800286CC(play, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 30.0f) + 100, 80); + func_800286CC(play, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 20.0f) + 80, 80); } } -void EnGoroiwa_SpawnWaterEffects(GlobalContext* globalCtx, Vec3f* contactPos) { +void EnGoroiwa_SpawnWaterEffects(PlayState* play, Vec3f* contactPos) { Vec3f splashPos; s32 i; s16 angle = 0; @@ -285,15 +285,15 @@ void EnGoroiwa_SpawnWaterEffects(GlobalContext* globalCtx, Vec3f* contactPos) { splashPos.x = contactPos->x + (Math_SinS(angle) * 55.0f); splashPos.y = contactPos->y; splashPos.z = contactPos->z + (Math_CosS(angle) * 55.0f); - EffectSsGSplash_Spawn(globalCtx, &splashPos, 0, 0, 0, 350); + EffectSsGSplash_Spawn(play, &splashPos, 0, 0, 0, 350); } - EffectSsGRipple_Spawn(globalCtx, contactPos, 300, 700, 0); - EffectSsGRipple_Spawn(globalCtx, contactPos, 500, 900, 4); - EffectSsGRipple_Spawn(globalCtx, contactPos, 500, 1300, 8); + EffectSsGRipple_Spawn(play, contactPos, 300, 700, 0); + EffectSsGRipple_Spawn(play, contactPos, 500, 900, 4); + EffectSsGRipple_Spawn(play, contactPos, 500, 1300, 8); } -s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, PlayState* play) { Path* path; s32 result; s32 pad; @@ -301,7 +301,7 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, R_EN_GOROIWA_SPEED * 0.01f, 0.3f); func_8002D868(&this->actor); - path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + path = &play->setupPathList[this->actor.params & 0xFF]; nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; result = true; result &= Math_StepToF(&this->actor.world.pos.x, nextPointPos->x, fabsf(this->actor.velocity.x)); @@ -310,8 +310,8 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, GlobalContext* globalCtx) { return result; } -s32 EnGoroiwa_Move(EnGoroiwa* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; +s32 EnGoroiwa_Move(EnGoroiwa* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params & 0xFF]; s32 pad; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; @@ -341,9 +341,9 @@ s32 EnGoroiwa_Move(EnGoroiwa* this, GlobalContext* globalCtx) { return nextPointReached; } -s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Math_StepToF(&this->actor.velocity.y, (R_EN_GOROIWA_SPEED * 0.01f) * 0.5f, 0.18f); @@ -352,9 +352,9 @@ s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { return Math_StepToF(&this->actor.world.pos.y, nextPointPos->y, fabsf(this->actor.velocity.y)); } -s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; f32 nextPointY; f32 thisY; @@ -379,7 +379,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) if (this->actor.velocity.y < 0.0f && this->actor.world.pos.y <= nextPointY) { if (this->bounceCount == 0) { if (this->actor.xzDistToPlayer < 600.0f) { - quakeIdx = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIdx, -0x3CB0); Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0); Quake_SetCountdown(quakeIdx, 7); @@ -389,14 +389,14 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) raycastFrom.x = this->actor.world.pos.x; raycastFrom.y = this->actor.world.pos.y + 50.0f; raycastFrom.z = this->actor.world.pos.z; - floorY = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &floorPoly, &floorBgId, + floorY = BgCheck_EntityRaycastFloor5(play, &play->colCtx, &floorPoly, &floorBgId, &this->actor, &raycastFrom); yDistToFloor = floorY - (this->actor.world.pos.y - 59.5f); if (fabsf(yDistToFloor) < 15.0f) { dustPos.x = this->actor.world.pos.x; dustPos.y = floorY + 10.0f; dustPos.z = this->actor.world.pos.z; - EnGoroiwa_SpawnDust(globalCtx, &dustPos); + EnGoroiwa_SpawnDust(play, &dustPos); } } } @@ -408,7 +408,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) this->actor.world.pos.y = nextPointY - ((this->actor.world.pos.y - nextPointY) * 0.3f); } if (this->bounceCount == 0 && - WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, &waterBox) && this->actor.world.pos.y <= ySurface) { this->stateFlags |= ENGOROIWA_IN_WATER; @@ -416,7 +416,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) waterHitPos.x = this->actor.world.pos.x; waterHitPos.y = ySurface; waterHitPos.z = this->actor.world.pos.z; - EnGoroiwa_SpawnWaterEffects(globalCtx, &waterHitPos); + EnGoroiwa_SpawnWaterEffects(play, &waterHitPos); this->actor.velocity.y *= 0.2f; } if (this->actor.velocity.y < -8.0f) { @@ -426,7 +426,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) return false; } -void EnGoroiwa_UpdateRotation(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_UpdateRotation(EnGoroiwa* this, PlayState* play) { static Vec3f unitY = { 0.0f, 1.0f, 0.0f }; s32 pad; Vec3f* rollAxisPtr; @@ -450,7 +450,7 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, GlobalContext* globalCtx) { * its result was probably meant to be used instead of the actor's velocity in the * Math3D_Vec3f_Cross call. */ - EnGoroiwa_GetPrevWaypointDiff(this, globalCtx, &unusedDiff); + EnGoroiwa_GetPrevWaypointDiff(this, play, &unusedDiff); Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, rollAxisPtr); } else { Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, rollAxisPtr); @@ -470,21 +470,21 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, GlobalContext* globalCtx) { Matrix_MtxFToYXZRotS(&mtx, &this->actor.shape.rot, 0); } -void EnGoroiwa_NextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_NextWaypoint(EnGoroiwa* this, PlayState* play) { s16 loopMode = (this->actor.params >> 8) & 3; EnGoroiwa_SetNextWaypoint(this); if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) { if (this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint) { - EnGoroiwa_TeleportToWaypoint(this, globalCtx, this->currentWaypoint); + EnGoroiwa_TeleportToWaypoint(this, play, this->currentWaypoint); } } - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); } -void EnGoroiwa_SpawnFragments(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_SpawnFragments(EnGoroiwa* this, PlayState* play) { static f32 yOffsets[] = { 0.0f, 59.5f }; s16 angle1; s16 angle2; @@ -510,15 +510,15 @@ void EnGoroiwa_SpawnFragments(EnGoroiwa* this, GlobalContext* globalCtx) { fragmentVelocity.y = Rand_ZeroOne() * 15.0f + 2.0f; fragmentVelocity.z = effectPos.z * 0.2f; Math_Vec3f_Sum(&effectPos, thisPos, &effectPos); - EffectSsKakera_Spawn(globalCtx, &effectPos, &fragmentVelocity, &effectPos, -340, 33, 28, 2, 0, + EffectSsKakera_Spawn(play, &effectPos, &fragmentVelocity, &effectPos, -340, 33, 28, 2, 0, Rand_ZeroOne() * 7.0f + 1.0f, 1, 0, 70, KAKERA_COLOR_NONE, 1, gBoulderFragmentsDL); } effectPos.x = thisPos->x; effectPos.y = thisPos->y + yOffsets[yOffsetIdx]; effectPos.z = thisPos->z; - func_80033480(globalCtx, &effectPos, 80.0f, 5, 70, 110, 1); - func_80033480(globalCtx, &effectPos, 90.0f, 5, 110, 160, 1); + func_80033480(play, &effectPos, 80.0f, 5, 70, 110, 1); + func_80033480(play, &effectPos, 90.0f, 5, 110, 160, 1); } static InitChainEntry sInitChain[] = { @@ -527,13 +527,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 150, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_STOP), }; -void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Init(Actor* thisx, PlayState* play) { static f32 yOffsets[] = { 0.0f, 595.0f }; EnGoroiwa* this = (EnGoroiwa*)thisx; s32 pathIdx; Actor_ProcessInitChain(&this->actor, sInitChain); - EnGoroiwa_InitCollider(this, globalCtx); + EnGoroiwa_InitCollider(this, play); pathIdx = this->actor.params & 0xFF; if (pathIdx == 0xFF) { // "Error: Invalid arg_data" @@ -542,7 +542,7 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - if (globalCtx->setupPathList[pathIdx].count < 2) { + if (play->setupPathList[pathIdx].count < 2) { // "Error: Invalid Path Data" osSyncPrintf("Error : レールデータ が不正(%s %d)\n", __FILE__, __LINE__); Actor_Kill(&this->actor); @@ -551,11 +551,11 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, yOffsets[(this->actor.params >> 10) & 1], ActorShadow_DrawCircle, 9.4f); this->actor.shape.shadowAlpha = 200; - EnGoroiwa_SetSpeed(this, globalCtx); - EnGoroiwa_InitPath(this, globalCtx); - EnGoroiwa_TeleportToWaypoint(this, globalCtx, 0); + EnGoroiwa_SetSpeed(this, play); + EnGoroiwa_InitPath(this, play); + EnGoroiwa_TeleportToWaypoint(this, play, 0); EnGoroiwa_InitRotation(this); - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); EnGoroiwa_SetupRoll(this); // "(Goroiwa)" osSyncPrintf("(ごろ岩)(arg 0x%04x)(rail %d)(end %d)(bgc %d)(hit %d)\n", this->actor.params, @@ -563,11 +563,11 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.z & 1); } -void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGoroiwa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGoroiwa* this = (EnGoroiwa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnGoroiwa_SetupRoll(EnGoroiwa* this) { @@ -576,7 +576,7 @@ void EnGoroiwa_SetupRoll(EnGoroiwa* this) { this->rollRotSpeed = 1.0f; } -void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play) { static EnGoroiwaUnkFunc1 moveFuncs[] = { EnGoroiwa_Move, EnGoroiwa_MoveAndFall }; static EnGoroiwaUnkFunc2 onHitSetupFuncs[] = { EnGoroiwa_SetupWait, EnGoroiwa_SetupMoveAndFallToGround }; @@ -592,31 +592,31 @@ void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx) { this->stateFlags |= ENGOROIWA_PLAYER_IN_THE_WAY; if (((this->actor.params >> 10) & 1) || (this->actor.home.rot.z & 1) != 1) { EnGoroiwa_ReverseDirection(this); - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); } } - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); osSyncPrintf(VT_FGCOL(CYAN)); osSyncPrintf("Player ぶっ飛ばし\n"); // "Player knocked down" osSyncPrintf(VT_RST); onHitSetupFuncs[(this->actor.params >> 10) & 1](this); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } - } else if (moveFuncs[(this->actor.params >> 10) & 1](this, globalCtx)) { + } else if (moveFuncs[(this->actor.params >> 10) & 1](this, play)) { loopMode = (this->actor.params >> 8) & 3; if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK && (this->nextWaypoint == 0 || this->nextWaypoint == this->endWaypoint)) { - EnGoroiwa_SpawnFragments(this, globalCtx); + EnGoroiwa_SpawnFragments(this, play); } - EnGoroiwa_NextWaypoint(this, globalCtx); + EnGoroiwa_NextWaypoint(this, play); if ((loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) && (this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint)) { EnGoroiwa_SetupWait(this); } else if (!((this->actor.params >> 10) & 1) && this->currentWaypoint != 0 && this->currentWaypoint != this->endWaypoint) { - ascendDirection = EnGoroiwa_GetAscendDirection(this, globalCtx); + ascendDirection = EnGoroiwa_GetAscendDirection(this, play); if (ascendDirection > 0) { EnGoroiwa_SetupMoveUp(this); } else if (ascendDirection < 0) { @@ -641,12 +641,12 @@ void EnGoroiwa_SetupMoveAndFallToGround(EnGoroiwa* this) { this->rollRotSpeed = 1.0f; } -void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, GlobalContext* globalCtx) { - EnGoroiwa_MoveAndFall(this, globalCtx); +void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, PlayState* play) { + EnGoroiwa_MoveAndFall(this, play); if ((this->actor.bgCheckFlags & 1) && this->actor.velocity.y < 0.0f) { if ((this->stateFlags & ENGOROIWA_PLAYER_IN_THE_WAY) && (this->actor.home.rot.z & 1) == 1) { EnGoroiwa_ReverseDirection(this); - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); } EnGoroiwa_SetupWait(this); } @@ -662,7 +662,7 @@ void EnGoroiwa_SetupWait(EnGoroiwa* this) { this->rollRotSpeed = 0.0f; } -void EnGoroiwa_Wait(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_Wait(EnGoroiwa* this, PlayState* play) { if (this->waitTimer > 0) { this->waitTimer--; } else { @@ -678,16 +678,16 @@ void EnGoroiwa_SetupMoveUp(EnGoroiwa* this) { this->actor.velocity.y = fabsf(this->actor.speedXZ) * 0.1f; } -void EnGoroiwa_MoveUp(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_MoveUp(EnGoroiwa* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } - } else if (EnGoroiwa_MoveUpToNextWaypoint(this, globalCtx)) { - EnGoroiwa_NextWaypoint(this, globalCtx); + } else if (EnGoroiwa_MoveUpToNextWaypoint(this, play)) { + EnGoroiwa_NextWaypoint(this, play); EnGoroiwa_SetupRoll(this); this->actor.speedXZ = 0.0f; } @@ -703,25 +703,25 @@ void EnGoroiwa_SetupMoveDown(EnGoroiwa* this) { this->stateFlags &= ~ENGOROIWA_IN_WATER; } -void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_MoveDown(EnGoroiwa* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } - } else if (EnGoroiwa_MoveDownToNextWaypoint(this, globalCtx)) { - EnGoroiwa_NextWaypoint(this, globalCtx); + } else if (EnGoroiwa_MoveDownToNextWaypoint(this, play)) { + EnGoroiwa_NextWaypoint(this, play); EnGoroiwa_SetupRoll(this); this->stateFlags &= ~ENGOROIWA_RETAIN_ROT_SPEED; this->actor.speedXZ = 0.0f; } } -void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Update(Actor* thisx, PlayState* play) { EnGoroiwa* this = (EnGoroiwa*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; s32 sp30; @@ -729,29 +729,29 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collisionDisabledTimer > 0) { this->collisionDisabledTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch ((this->actor.params >> 10) & 1) { case 1: - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); break; case 0: - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &sp30, + this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &sp30, &this->actor, &this->actor.world.pos); break; } - EnGoroiwa_UpdateRotation(this, globalCtx); + EnGoroiwa_UpdateRotation(this, play); if (this->actor.xzDistToPlayer < 300.0f) { EnGoroiwa_UpdateCollider(this); if ((this->stateFlags & ENGOROIWA_ENABLE_AT) && this->collisionDisabledTimer <= 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->stateFlags & ENGOROIWA_ENABLE_OC) && this->collisionDisabledTimer <= 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } } -void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gRollingRockDL); +void EnGoroiwa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gRollingRockDL); } diff --git a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h index 0f36f7a42..628543293 100644 --- a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h +++ b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h @@ -6,7 +6,7 @@ struct EnGoroiwa; -typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, GlobalContext*); +typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, PlayState*); typedef struct EnGoroiwa { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 60d8d2fd4..aee0edfc5 100644 --- a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -11,13 +11,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnGs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGs_Init(Actor* thisx, PlayState* play); +void EnGs_Destroy(Actor* thisx, PlayState* play); +void EnGs_Update(Actor* thisx, PlayState* play); +void EnGs_Draw(Actor* thisx, PlayState* play); -void func_80A4F734(EnGs* this, GlobalContext* globalCtx); -void func_80A4F700(EnGs* this, GlobalContext* globalCtx); +void func_80A4F734(EnGs* this, PlayState* play); +void func_80A4F700(EnGs* this, PlayState* play); void func_80A4F77C(EnGs* this); @@ -95,12 +95,12 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Init(Actor* thisx, PlayState* play) { EnGs* this = (EnGs*)thisx; Actor_ProcessInitChain(thisx, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); CollisionCheck_SetInfo2(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); thisx->targetMode = 6; @@ -114,14 +114,14 @@ void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1B4[1].z = 1.0f; } -void EnGs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Destroy(Actor* thisx, PlayState* play) { } -s32 func_80A4E3EC(EnGs* this, GlobalContext* globalCtx) { +s32 func_80A4E3EC(EnGs* this, PlayState* play) { s32 ret = 2; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x2054: this->actor.textId = (this->actor.params & 0xFF) + 0x400; @@ -137,8 +137,8 @@ s32 func_80A4E3EC(EnGs* this, GlobalContext* globalCtx) { return ret; } -void func_80A4E470(EnGs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A4E470(EnGs* this, PlayState* play) { + Player* player = GET_PLAYER(play); bREG(15) = 0; if (this->actor.xzDistToPlayer <= 100.0f) { @@ -146,54 +146,54 @@ void func_80A4E470(EnGs* this, GlobalContext* globalCtx) { if (this->unk_19D == 0) { player->stateFlags2 |= 0x800000; if (player->stateFlags2 & 0x1000000) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->unk_19D |= 1; } } else if (this->unk_19D & 1) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - if ((globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_SARIAS) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_EPONAS) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_SUNS) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_TIME)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if ((play->msgCtx.unk_E3F2 == OCARINA_SONG_SARIAS) || + (play->msgCtx.unk_E3F2 == OCARINA_SONG_EPONAS) || + (play->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY) || + (play->msgCtx.unk_E3F2 == OCARINA_SONG_SUNS) || + (play->msgCtx.unk_E3F2 == OCARINA_SONG_TIME)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, FAIRY_HEAL_TIMED); Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); - } else if (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + } else if (play->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, FAIRY_HEAL_BIG); Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); } this->unk_19D = 0; - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= 0x800000; } } } } -void func_80A4E648(EnGs* this, GlobalContext* globalCtx) { +void func_80A4E648(EnGs* this, PlayState* play) { s16 sp26; s16 sp24; if (this->unk_19C == 1) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_19C = 2; } else if (this->unk_19C == 2) { - this->unk_19C = func_80A4E3EC(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->unk_19C = func_80A4E3EC(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_19C = 2; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); if ((sp26 >= 0) && (sp26 <= SCREEN_WIDTH) && (sp24 >= 0) && (sp24 <= SCREEN_HEIGHT) && (this->unk_19C != 3)) { - if (func_8002F2CC(&this->actor, globalCtx, 40.0f) == 1) { + if (func_8002F2CC(&this->actor, play, 40.0f) == 1) { if (gSaveContext.n64ddFlag) { // if we're rando'd, always use the non-mask text id this->actor.textId = 0x2053; } else { - if (Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) { + if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { this->actor.textId = 0x2054; } else { this->actor.textId = 0x2053; @@ -204,7 +204,7 @@ void func_80A4E648(EnGs* this, GlobalContext* globalCtx) { } } -f32 func_80A4E754(EnGs* this, GlobalContext* globalCtx, f32* arg2, f32* arg3, u16* arg4, f32 arg5, f32 arg6, f32 arg7, +f32 func_80A4E754(EnGs* this, PlayState* play, f32* arg2, f32* arg3, u16* arg4, f32 arg5, f32 arg6, f32 arg7, s32 arg8, s32 arg9) { f32 sp2C = Math_SmoothStepToF(arg2, *arg3, arg5, arg6, arg7); @@ -217,24 +217,24 @@ f32 func_80A4E754(EnGs* this, GlobalContext* globalCtx, f32* arg2, f32* arg3, u1 return sp2C; } -void func_80A4E910(EnGs* this, GlobalContext* globalCtx) { +void func_80A4E910(EnGs* this, PlayState* play) { if (this->unk_19F == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_200 = 0; this->unk_19F = 1; this->unk_1E8 = 0.5f; this->unk_1EC = 0.0f; - } else if ((this->unk_19F == 1) && (func_80A4E754(this, globalCtx, &this->unk_1E8, &this->unk_1EC, &this->unk_200, + } else if ((this->unk_19F == 1) && (func_80A4E754(this, play, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 0.8f, 0.007f, 0.001f, 7, 0) == 0.0f)) { - if (!Gameplay_InCsMode(globalCtx)) { - Message_StartTextbox(globalCtx, 0x71B1, NULL); + if (!Play_InCsMode(play)) { + Message_StartTextbox(play, 0x71B1, NULL); } this->unk_19C = 0; this->actionFunc = func_80A4F734; } } -void func_80A4EA08(EnGs* this, GlobalContext* globalCtx) { +void func_80A4EA08(EnGs* this, PlayState* play) { if (this->unk_19F == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_1E8 = 0.3f; @@ -244,7 +244,7 @@ void func_80A4EA08(EnGs* this, GlobalContext* globalCtx) { } else if (this->unk_19F == 1) { this->unk_1A0[0].z = (((this->unk_200 % 8) / 8.0f) * 360.0f) * (0x10000 / 360.0f); this->unk_1A0[1].z = -this->unk_1A0[0].z; - if (func_80A4E754(this, globalCtx, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 0.8f, 0.005f, 0.001f, 7, + if (func_80A4E754(this, play, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 0.8f, 0.005f, 0.001f, 7, 0) == 0.0f) { this->unk_19C = 0; this->actionFunc = func_80A4F734; @@ -252,7 +252,7 @@ void func_80A4EA08(EnGs* this, GlobalContext* globalCtx) { } } -void func_80A4EB3C(EnGs* this, GlobalContext* globalCtx) { +void func_80A4EB3C(EnGs* this, PlayState* play) { f32 ret; if (this->unk_19F == 0) { @@ -284,7 +284,7 @@ void func_80A4EB3C(EnGs* this, GlobalContext* globalCtx) { this->unk_19F++; } } else if (this->unk_19F == 4) { - if (func_80A4E754(this, globalCtx, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 1.0f, 0.03f, 0.001f, 5, 0) == + if (func_80A4E754(this, play, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 1.0f, 0.03f, 0.001f, 5, 0) == 0.0f) { this->unk_19C = 0; this->actionFunc = func_80A4F734; @@ -292,7 +292,7 @@ void func_80A4EB3C(EnGs* this, GlobalContext* globalCtx) { } } -void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { +void func_80A4ED34(EnGs* this, PlayState* play) { static Color_RGBA8 flashRed = { 255, 50, 50, 0 }; static Color_RGBA8 flashBlue = { 50, 50, 255, 0 }; static Color_RGBA8 baseWhite = { 255, 255, 255, 0 }; @@ -352,7 +352,7 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { dustPos.x = this->actor.world.pos.x + (dustVelocity.x + dustVelocity.x); dustPos.y = this->actor.world.pos.y + 7.0f; dustPos.z = this->actor.world.pos.z + (dustVelocity.z + dustVelocity.z); - func_8002836C(globalCtx, &dustPos, &dustVelocity, &dustAccel, &dustPrim, &dustEnv, + func_8002836C(play, &dustPos, &dustVelocity, &dustAccel, &dustPrim, &dustEnv, (s16)Rand_ZeroFloat(50.0f) + 200, 40, 15); } @@ -368,13 +368,13 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { } if (this->unk_19F == 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 & 0x18) { bomb2Pos.x = this->actor.world.pos.x; bomb2Pos.y = this->actor.world.pos.y; bomb2Pos.z = this->actor.world.pos.z; Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); - EffectSsBomb2_SpawnLayered(globalCtx, &bomb2Pos, &bomb2Velocity, &bomb2Accel, 100, 20); + EffectSsBomb2_SpawnLayered(play, &bomb2Pos, &bomb2Velocity, &bomb2Accel, 100, 20); this->unk_200 = 10; this->unk_19E |= 8; this->actionFunc = func_80A4F700; @@ -389,7 +389,7 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { } } -void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) { +void func_80A4F13C(EnGs* this, PlayState* play) { f32 tmpf1; f32 tmpf2; f32 tmpf3; @@ -491,15 +491,15 @@ void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) { } } -void func_80A4F700(EnGs* this, GlobalContext* globalCtx) { +void func_80A4F700(EnGs* this, PlayState* play) { if (this->unk_200-- <= 0) { Actor_Kill(&this->actor); } } -void func_80A4F734(EnGs* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { - func_80A4E470(this, globalCtx); +void func_80A4F734(EnGs* this, PlayState* play) { + if (!Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + func_80A4E470(this, play); } } @@ -519,8 +519,8 @@ void func_80A4F77C(EnGs* this) { this->unk_19C = 3; } -void EnGs_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGs_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGs* this = (EnGs*)thisx; Actor_SetFocus(&this->actor, 23.0f); @@ -558,23 +558,23 @@ void EnGs_Update(Actor* thisx, GlobalContext* globalCtx2) { } } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - this->actionFunc(this, globalCtx); - func_80A4E648(this, globalCtx); + this->actionFunc(this, play); + func_80A4E648(this, play); } -void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Draw(Actor* thisx, PlayState* play) { EnGs* this = (EnGs*)thisx; s32 tmp; u32 frames; if (!(this->unk_19E & 8)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - frames = globalCtx->gameplayFrames; - func_80093D18(globalCtx->state.gfxCtx); + frames = play->gameplayFrames; + func_80093D18(play->state.gfxCtx); Matrix_Push(); if (this->unk_19E & 1) { Matrix_RotateY(this->unk_1A0[0].y * (M_PI / 0x8000), MTXMODE_APPLY); @@ -586,7 +586,7 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(this->unk_1A0[1].z * (M_PI / 0x8000), 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++, gGossipStoneMaterialDL); @@ -602,20 +602,20 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); if (this->unk_19E & 2) { - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(0.05f, -0.05f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 * 0x14, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 0x14, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.h index cc95e3ee0..47edd278d 100644 --- a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -6,7 +6,7 @@ struct EnGs; -typedef void (*EnGsActionFunc)(struct EnGs*, GlobalContext*); +typedef void (*EnGsActionFunc)(struct EnGs*, PlayState*); typedef struct EnGs { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 6863042e1..a664d4a66 100644 --- a/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -11,14 +11,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGuest_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGuest_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGuest_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGuest_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGuest_Init(Actor* thisx, PlayState* play); +void EnGuest_Destroy(Actor* thisx, PlayState* play); +void EnGuest_Update(Actor* thisx, PlayState* play); +void EnGuest_Draw(Actor* thisx, PlayState* play); -void func_80A50518(EnGuest* this, GlobalContext* globalCtx); -void func_80A5057C(EnGuest* this, GlobalContext* globalCtx); -void func_80A505CC(Actor* thisx, GlobalContext* globalCtx); +void func_80A50518(EnGuest* this, PlayState* play); +void func_80A5057C(EnGuest* this, PlayState* play); +void func_80A505CC(Actor* thisx, PlayState* play); const ActorInit En_Guest_InitVars = { ACTOR_EN_GUEST, @@ -50,13 +50,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -void EnGuest_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Init(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; if (gSaveContext.infTable[7] & 0x40) { Actor_Kill(&this->actor); } else { - this->osAnimeBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); + this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if (this->osAnimeBankIndex < 0) { osSyncPrintf(VT_COL(RED, WHITE)); // "No such bank!!" @@ -67,30 +67,30 @@ void EnGuest_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGuest_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Destroy(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGuest_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Update(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->osAnimeBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_boj_Skel_0000F0, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_0000F0, NULL, this->jointTable, this->morphTable, 16); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); Animation_Change(&this->skelAnime, &gObjOsAnim_42AC, 1.0f, 0.0f, Animation_GetLastFrame(&gObjOsAnim_42AC), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnGuest_Draw; this->actor.update = func_80A505CC; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetFocus(&this->actor, 60.0f); @@ -125,30 +125,30 @@ void func_80A5046C(EnGuest* this) { } } -void func_80A50518(EnGuest* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80A50518(EnGuest* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80A5057C; } else if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void func_80A5057C(EnGuest* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A5057C(EnGuest* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actionFunc = func_80A50518; } } -void func_80A505CC(Actor* thisx, GlobalContext* globalCtx) { +void func_80A505CC(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; s32 pad; Player* player; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_2C8++; func_80A5046C(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_2A0.unk_18 = player->actor.world.pos; if (LINK_IS_ADULT) { @@ -158,15 +158,15 @@ void func_80A505CC(Actor* thisx, GlobalContext* globalCtx) { } func_80034A14(&this->actor, &this->unk_2A0, 6, 2); - func_80034F54(globalCtx, this->unk_2CC, this->unk_2EC, 16); + func_80034F54(play, this->unk_2CC, this->unk_2EC, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); SkelAnime_Update(&this->skelAnime); Actor_SetFocus(&this->actor, 60.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Gfx* func_80A50708(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { @@ -179,12 +179,12 @@ Gfx* func_80A50708(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return dlist; } -s32 EnGuest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnGuest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGuest* this = (EnGuest*)thisx; Vec3s sp3C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 15) { *dList = object_boj_DL_0059B0; @@ -206,12 +206,12 @@ s32 EnGuest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis rot->z += Math_CosS(this->unk_2EC[limbIndex]) * 200.0f; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return false; } -void EnGuest_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Draw(Actor* thisx, PlayState* play) { static void* D_80A50BA4[] = { object_boj_Tex_0005FC, object_boj_Tex_0006FC, @@ -220,16 +220,16 @@ void EnGuest_Draw(Actor* thisx, GlobalContext* globalCtx) { EnGuest* this = (EnGuest*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A50708(globalCtx->state.gfxCtx, 255, 255, 255, 255)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A50708(globalCtx->state.gfxCtx, 160, 60, 220, 255)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A50708(play->state.gfxCtx, 255, 255, 255, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A50708(play->state.gfxCtx, 160, 60, 220, 255)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80A50BA4[this->unk_30E])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGuest_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.h b/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.h index a86caa613..d99514686 100644 --- a/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.h +++ b/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.h @@ -6,7 +6,7 @@ struct EnGuest; -typedef void (*EnGuestActionFunc)(struct EnGuest* this, GlobalContext* globalCtx); +typedef void (*EnGuestActionFunc)(struct EnGuest* this, PlayState* play); typedef struct EnGuest { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Hata/z_en_hata.c b/soh/src/overlays/actors/ovl_En_Hata/z_en_hata.c index 00042e7d3..80ecf983b 100644 --- a/soh/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/soh/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void EnHata_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHata_Init(Actor* thisx, PlayState* play); +void EnHata_Destroy(Actor* thisx, PlayState* play); +void EnHata_Update(Actor* thisx, PlayState* play); +void EnHata_Draw(Actor* thisx, PlayState* play); const ActorInit En_Hata_InitVars = { ACTOR_EN_HATA, @@ -50,18 +50,18 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -void EnHata_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Init(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; s32 pad; CollisionHeader* colHeader = NULL; f32 frameCount = Animation_GetLastFrame(&gFlagpoleFlapAnim); Actor_SetScale(&this->dyna.actor, 1.0f / 75.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gFlagpoleSkel, &gFlagpoleFlapAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gFlagpoleSkel, &gFlagpoleFlapAnim, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gFlagpoleFlapAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFlagpoleCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.uncullZoneScale = 500.0f; this->dyna.actor.uncullZoneDownward = 550.0f; this->dyna.actor.uncullZoneForward = 2200.0f; @@ -71,15 +71,15 @@ void EnHata_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_278 = Rand_ZeroOne() * 0xFFFF; } -void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Destroy(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + SkelAnime_Free(&this->skelAnime, play); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHata_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnHata* this = (EnHata*)thisx; s32 pitch; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -89,16 +89,16 @@ void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) { SkelAnime_Update(&this->skelAnime); // Rotate to hang down by default this->limbs[FLAGPOLE_LIMB_FLAG_1_BASE].y = this->limbs[FLAGPOLE_LIMB_FLAG_2_BASE].y = -0x4000; - windVec.x = globalCtx->envCtx.windDirection.x; - windVec.y = globalCtx->envCtx.windDirection.y; - windVec.z = globalCtx->envCtx.windDirection.z; + windVec.x = play->envCtx.windDirection.x; + windVec.y = play->envCtx.windDirection.y; + windVec.z = play->envCtx.windDirection.z; - if (globalCtx->envCtx.windSpeed > 255.0f) { - globalCtx->envCtx.windSpeed = 255.0f; + if (play->envCtx.windSpeed > 255.0f) { + play->envCtx.windSpeed = 255.0f; } - if (globalCtx->envCtx.windSpeed < 0.0f) { - globalCtx->envCtx.windSpeed = 0.0f; + if (play->envCtx.windSpeed < 0.0f) { + play->envCtx.windSpeed = 0.0f; } if (Rand_ZeroOne() > 0.5f) { @@ -110,16 +110,16 @@ void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) { // Mimic varying wind gusts sin = Math_SinS(this->unk_278) * 80.0f; pitch = -Math_Vec3f_Pitch(&zeroVec, &windVec); - pitch = ((s32)((15000 - pitch) * (1.0f - (globalCtx->envCtx.windSpeed / (255.0f - sin))))) + pitch; + pitch = ((s32)((15000 - pitch) * (1.0f - (play->envCtx.windSpeed / (255.0f - sin))))) + pitch; Math_SmoothStepToS(&this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].y, pitch, this->invScale, this->maxStep, this->minStep); this->limbs[FLAGPOLE_LIMB_FLAG_2_HOIST_END_BASE].y = this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].y; this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].z = -Math_Vec3f_Yaw(&zeroVec, &windVec); this->limbs[FLAGPOLE_LIMB_FLAG_2_HOIST_END_BASE].z = this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].z; - this->skelAnime.playSpeed = (Rand_ZeroFloat(1.25f) + 2.75f) * (globalCtx->envCtx.windSpeed / 255.0f); + this->skelAnime.playSpeed = (Rand_ZeroFloat(1.25f) + 2.75f) * (play->envCtx.windSpeed / 255.0f); } -s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHata_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHata* this = (EnHata*)thisx; Vec3s* limbs; @@ -133,14 +133,14 @@ s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnHata_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHata_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void EnHata_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Draw(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); Matrix_Scale(1.0f, 1.1f, 1.0f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHata_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHata_OverrideLimbDraw, EnHata_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index adafa3674..5e872cff8 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -10,25 +10,25 @@ #define FLAGS ACTOR_FLAG_4 -void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi1_Init(Actor* thisx, PlayState* play); +void EnHeishi1_Destroy(Actor* thisx, PlayState* play); +void EnHeishi1_Update(Actor* thisx, PlayState* play); +void EnHeishi1_Draw(Actor* thisx, PlayState* play); void EnHeishi1_Reset(void); -void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupMoveToLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupKick(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupWaitNight(EnHeishi1* this, GlobalContext* globalCtx); +void EnHeishi1_SetupWait(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupWalk(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupMoveToLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupKick(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupWaitNight(EnHeishi1* this, PlayState* play); -void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_Kick(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_WaitNight(EnHeishi1* this, GlobalContext* globalCtx); +void EnHeishi1_Wait(EnHeishi1* this, PlayState* play); +void EnHeishi1_Walk(EnHeishi1* this, PlayState* play); +void EnHeishi1_MoveToLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_TurnTowardLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_Kick(EnHeishi1* this, PlayState* play); +void EnHeishi1_WaitNight(EnHeishi1* this, PlayState* play); s32 sHeishi1PlayerIsCaught = false; @@ -69,14 +69,14 @@ void EnHeishi1_Reset(void) { sHeishi1PlayerIsCaught = false; } -void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Init(Actor* thisx, PlayState* play) { s32 pad; EnHeishi1* this = (EnHeishi1*)thisx; Vec3f rupeePos; s32 i; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17); this->type = (this->actor.params >> 8) & 0xFF; @@ -112,7 +112,7 @@ void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->path == 3) { for (i = 0; i < ARRAY_COUNT(sRupeePositions); i++) { rupeePos = sRupeePositions[i]; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_RUPPY, rupeePos.x, rupeePos.y, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_RUPPY, rupeePos.x, rupeePos.y, rupeePos.z, 0, 0, 0, 3); } } @@ -141,10 +141,10 @@ void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHeishi1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Destroy(Actor* thisx, PlayState* play) { } -void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupWalk(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiWalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiWalkAnim, this->animSpeed, 0.0f, (s16)frameCount, ANIMMODE_LOOP, @@ -155,7 +155,7 @@ void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx) { this->actionFunc = EnHeishi1_Walk; } -void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_Walk(EnHeishi1* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -169,7 +169,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) { } if (!sHeishi1PlayerIsCaught) { - path = &globalCtx->setupPathList[this->path]; + path = &play->setupPathList[this->path]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -228,19 +228,19 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupMoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupMoveToLink(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiWalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiWalkAnim, 3.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -3.0f); this->bodyTurnSpeed = 0.0f; this->moveSpeed = 0.0f; - Message_StartTextbox(globalCtx, 0x702D, &this->actor); - Interface_SetDoAction(globalCtx, DO_ACTION_STOP); + Message_StartTextbox(play, 0x702D, &this->actor); + Interface_SetDoAction(play, DO_ACTION_STOP); this->actionFunc = EnHeishi1_MoveToLink; } -void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnHeishi1_MoveToLink(EnHeishi1* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.x, player->actor.world.pos.x, 1.0f, this->moveSpeed); @@ -255,7 +255,7 @@ void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupWait(EnHeishi1* this, PlayState* play) { s16 rand; f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); @@ -268,7 +268,7 @@ void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx) { this->actionFunc = EnHeishi1_Wait; } -void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_Wait(EnHeishi1* this, PlayState* play) { s16 randOffset; s32 i; @@ -326,7 +326,7 @@ void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -334,7 +334,7 @@ void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { this->actionFunc = EnHeishi1_TurnTowardLink; } -void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_TurnTowardLink(EnHeishi1* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->type != 5) { @@ -348,57 +348,57 @@ void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupKick(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupKick(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnHeishi1_Kick; } -void EnHeishi1_Kick(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_Kick(EnHeishi1* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (!this->loadStarted) { // if dialog state is 5 and textbox has been advanced, kick player out - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (!this->loadStarted) { gSaveContext.eventChkInf[4] |= 0x4000; - globalCtx->nextEntranceIndex = 0x4FA; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x4FA; + play->sceneLoadFlag = 0x14; this->loadStarted = true; sHeishi1PlayerIsCaught = false; - globalCtx->fadeTransition = 0x2E; + play->fadeTransition = 0x2E; gSaveContext.nextTransition = 0x2E; } } } } -void EnHeishi1_SetupWaitNight(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupWaitNight(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnHeishi1_WaitNight; } -void EnHeishi1_WaitNight(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_WaitNight(EnHeishi1* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.xzDistToPlayer < 100.0f) { - Message_StartTextbox(globalCtx, 0x702D, &this->actor); + Message_StartTextbox(play, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = EnHeishi1_SetupKick; } } -void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Update(Actor* thisx, PlayState* play) { EnHeishi1* this = (EnHeishi1*)thisx; s16 path; u8 i; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; Camera* activeCam; @@ -414,11 +414,11 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { this->waypointTimer--; } - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); if (player->actor.freezeTimer == 0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.uncullZoneForward = 550.0f; this->actor.uncullZoneScale = 350.0f; @@ -444,7 +444,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&searchBallMult, &searchBallVel); Matrix_Pop(); - EffectSsSolderSrchBall_Spawn(globalCtx, &searchBallPos, &searchBallVel, &searchBallAccel, 2, + EffectSsSolderSrchBall_Spawn(play, &searchBallPos, &searchBallVel, &searchBallAccel, 2, &this->linkDetected); if (this->actor.xzDistToPlayer < 60.0f) { @@ -472,7 +472,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_FOUND); // "Discovered!" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); sHeishi1PlayerIsCaught = true; this->actionFunc = EnHeishi1_SetupMoveToLink; } @@ -485,7 +485,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHeishi1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnHeishi1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi1* this = (EnHeishi1*)thisx; @@ -497,19 +497,19 @@ s32 EnHeishi1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnHeishi1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Draw(Actor* thisx, PlayState* play) { s32 pad; EnHeishi1* this = (EnHeishi1*)thisx; Vec3f matrixScale = { 0.3f, 0.3f, 0.3f }; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi1_OverrideLimbDraw, NULL, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi1_OverrideLimbDraw, NULL, this); - func_80033C30(&this->actor.world.pos, &matrixScale, 0xFF, globalCtx); + func_80033C30(&this->actor.world.pos, &matrixScale, 0xFF, play); if ((this->path == BREG(1)) && (BREG(0) != 0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, this->actor.world.pos.z, 17000, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, - 255, 4, globalCtx->state.gfxCtx); + 255, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h b/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h index af1e4c9d0..274570109 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h +++ b/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h @@ -6,7 +6,7 @@ struct EnHeishi1; -typedef void (*EnHeishi1ActionFunc)(struct EnHeishi1*, GlobalContext*); +typedef void (*EnHeishi1ActionFunc)(struct EnHeishi1*, PlayState*); typedef struct EnHeishi1 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 3bc19cc9e..d851deaa2 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -14,41 +14,41 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi2_Init(Actor* thisx, PlayState* play); +void EnHeishi2_Destroy(Actor* thisx, PlayState* play); +void EnHeishi2_Update(Actor* thisx, PlayState* play); +void EnHeishi2_Draw(Actor* thisx, PlayState* play); -void EnHeishi2_DrawKingGuard(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_DoNothing1(EnHeishi2* this, GlobalContext* globalCtx); -void EnHeishi_DoNothing2(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A531E4(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53278(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5344C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A54954(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53538(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53C0C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53C90(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53908(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53F30(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A54038(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5427C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A549E8(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53850(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A546DC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A541FC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx); +void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play); +void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play); +void EnHeishi_DoNothing2(EnHeishi2* this, PlayState* play); +void func_80A531E4(EnHeishi2* this, PlayState* play); +void func_80A53278(EnHeishi2* this, PlayState* play); +void func_80A5344C(EnHeishi2* this, PlayState* play); +void func_80A54954(EnHeishi2* this, PlayState* play); +void func_80A53538(EnHeishi2* this, PlayState* play); +void func_80A535BC(EnHeishi2* this, PlayState* play); +void func_80A5399C(EnHeishi2* this, PlayState* play); +void func_80A53638(EnHeishi2* this, PlayState* play); +void func_80A5372C(EnHeishi2* this, PlayState* play); +void func_80A5475C(EnHeishi2* this, PlayState* play); +void func_80A53AD4(EnHeishi2* this, PlayState* play); +void func_80A53C0C(EnHeishi2* this, PlayState* play); +void func_80A53C90(EnHeishi2* this, PlayState* play); +void func_80A53D0C(EnHeishi2* this, PlayState* play); +void func_80A544AC(EnHeishi2* this, PlayState* play); +void func_80A53908(EnHeishi2* this, PlayState* play); +void func_80A53F30(EnHeishi2* this, PlayState* play); +void func_80A54038(EnHeishi2* this, PlayState* play); +void func_80A5427C(EnHeishi2* this, PlayState* play); +void func_80A549E8(EnHeishi2* this, PlayState* play); +void func_80A53850(EnHeishi2* this, PlayState* play); +void func_80A54320(EnHeishi2* this, PlayState* play); +void func_80A543A0(EnHeishi2* this, PlayState* play); +void func_80A5455C(EnHeishi2* this, PlayState* play); +void func_80A546DC(EnHeishi2* this, PlayState* play); +void func_80A541FC(EnHeishi2* this, PlayState* play); +void func_80A53DF8(EnHeishi2* this, PlayState* play); const ActorInit En_Heishi2_InitVars = { ACTOR_EN_HEISHI2, @@ -83,7 +83,7 @@ static ColliderCylinderInit sCylinderInit = { { 33, 40, 0, { 0, 0, 0 } }, }; -void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Init(Actor* thisx, PlayState* play) { ColliderCylinder* collider; EnHeishi2* this = (EnHeishi2*)thisx; @@ -94,7 +94,7 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { if ((this->type == 6) || (this->type == 9)) { this->actor.draw = EnHeishi2_DrawKingGuard; this->actor.flags &= ~ACTOR_FLAG_0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, 6); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, 6); if (this->type == 6) { this->actionFunc = EnHeishi2_DoNothing1; @@ -111,19 +111,19 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y -= 60.0f; this->actor.world.pos.z += 90.0f; this->actor.shape.rot.y = this->actor.world.rot.y; - Collider_DestroyCylinder(globalCtx, &this->collider); - func_8002DF54(globalCtx, 0, 8); + Collider_DestroyCylinder(play, &this->collider); + func_8002DF54(play, 0, 8); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_4; this->actionFunc = func_80A544AC; } } else { this->unk_2E0 = 60.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17); collider = &this->collider; - Collider_InitCylinder(globalCtx, collider); - Collider_SetCylinder(globalCtx, collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, collider); + Collider_SetCylinder(play, collider, &this->actor, &sCylinderInit); this->collider.dim.yShift = 0; this->collider.dim.radius = 15; this->collider.dim.height = 70; @@ -143,7 +143,7 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); // "Peep hole soldier!" osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 覗き穴奥兵士ふぃ〜 ☆☆☆☆☆ \n" VT_RST); - Collider_DestroyCylinder(globalCtx, collider); + Collider_DestroyCylinder(play, collider); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actionFunc = EnHeishi_DoNothing2; break; @@ -160,32 +160,32 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHeishi2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Destroy(Actor* thisx, PlayState* play) { EnHeishi2* this = (EnHeishi2*)thisx; if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnHeishi2_DoNothing1(EnHeishi2* this, GlobalContext* globalCtx) { +void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play) { } -void EnHeishi_DoNothing2(EnHeishi2* this, GlobalContext* globalCtx) { +void EnHeishi_DoNothing2(EnHeishi2* this, PlayState* play) { } -void func_80A531E4(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A531E4(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A53278; } -void func_80A53278(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53278(EnHeishi2* this, PlayState* play) { this->unk_30B = 0; this->unk_30E = 0; - if (Text_GetFaceReaction(globalCtx, 5) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 5); + if (Text_GetFaceReaction(play, 5) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 5); this->unk_30B = 1; this->unk_300 = TEXT_STATE_DONE; this->actionFunc = func_80A5475C; @@ -232,11 +232,11 @@ void func_80A53278(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A5344C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5344C(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { this->unk_300 = TEXT_STATE_EVENT; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees >= 10) { Rupees_ChangeBy(-10); @@ -256,20 +256,20 @@ void func_80A5344C(EnHeishi2* this, GlobalContext* globalCtx) { default: break; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } -void func_80A53538(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53538(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_300 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, NULL, 8); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if (this->unk_300 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + func_8002DF54(play, NULL, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A535BC; } } -void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A535BC(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim); this->unk_2EC = frameCount; @@ -277,11 +277,11 @@ void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A53638; } -void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53638(EnHeishi2* this, PlayState* play) { s32 pad; f32 frameCount = this->skelAnime.curFrame; - BgSpot15Saku* actor = (BgSpot15Saku*)globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + BgSpot15Saku* actor = (BgSpot15Saku*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; SkelAnime_Update(&this->skelAnime); if ((frameCount >= 12.0f) && (!this->audioFlag)) { @@ -304,14 +304,14 @@ void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5372C(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->unk_2F2[0] = 200; - this->cameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cameraId, CAM_STAT_ACTIVE); + this->cameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); this->unk_280.x = 947.0f; this->unk_280.y = 1195.0f; this->unk_280.z = 2682.0f; @@ -320,41 +320,41 @@ void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx) { this->unk_28C.y = 1145.0f; this->unk_28C.z = 3014.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); this->actionFunc = func_80A53850; } -void func_80A53850(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53850(EnHeishi2* this, PlayState* play) { BgSpot15Saku* gate; SkelAnime_Update(&this->skelAnime); - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); gate = (BgSpot15Saku*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) { - Gameplay_ClearCamera(globalCtx, this->cameraId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Message_CloseTextbox(globalCtx); + Play_ClearCamera(play, this->cameraId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + Message_CloseTextbox(play); this->unk_30C = 1; - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A531E4; } } -void func_80A53908(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53908(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A5399C; } -void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5399C(EnHeishi2* this, PlayState* play) { s16 var; this->unk_30B = 0; var = 0; if (gSaveContext.infTable[7] & 0x40) { if (!(gSaveContext.infTable[7] & 0x80)) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_KEATON) { + if (Player_GetMask(play) == PLAYER_MASK_KEATON) { if (this->unk_309 == 0) { this->actor.textId = 0x200A; } else { @@ -373,9 +373,9 @@ void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) { this->unk_300 = TEXT_STATE_EVENT; this->unk_30E = 0; } - if (Text_GetFaceReaction(globalCtx, 5) != 0) { + if (Text_GetFaceReaction(play, 5) != 0) { if (var == 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 5); + this->actor.textId = Text_GetFaceReaction(play, 5); this->unk_30B = 1; this->unk_300 = TEXT_STATE_DONE; this->unk_30E = 0; @@ -389,21 +389,21 @@ void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A53AD4(EnHeishi2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 exchangeItemId; s16 yawDiffTemp; s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Text_GetFaceReaction(globalCtx, 5) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 5); + if (Text_GetFaceReaction(play, 5) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 5); } else { this->actor.textId = 0x200E; } this->unk_300 = TEXT_STATE_DONE; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - exchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + exchangeItemId = func_8002F368(play); if (exchangeItemId == EXCH_ITEM_LETTER_ZELDA) { func_80078884(NA_SE_SY_CORRECT_CHIME); player->actor.textId = 0x2010; @@ -416,21 +416,21 @@ void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) { yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiff = ABS(yawDiffTemp); if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { - func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_LETTER_ZELDA); + func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_LETTER_ZELDA); } } } -void func_80A53C0C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53C0C(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_300 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, 0, 8); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((this->unk_300 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + func_8002DF54(play, 0, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A53C90; } } -void func_80A53C90(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53C90(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim); this->unk_2EC = frameCount; @@ -438,13 +438,13 @@ void func_80A53C90(EnHeishi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A53D0C; } -void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53D0C(EnHeishi2* this, PlayState* play) { s32 pad; f32 frameCount; BgGateShutter* gate; frameCount = this->skelAnime.curFrame; - gate = (BgGateShutter*)globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + gate = (BgGateShutter*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; SkelAnime_Update(&this->skelAnime); if (12.0f <= frameCount) { if (this->audioFlag == 0) { @@ -468,14 +468,14 @@ void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53DF8(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->unk_2F2[0] = 200; - this->cameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cameraId, CAM_STAT_ACTIVE); + this->cameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); this->unk_2BC.x = -71.0f; this->unk_280.x = -71.0f; this->unk_2BC.y = 571.0f; @@ -488,60 +488,60 @@ void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx) { this->unk_28C.y = 417.0f; this->unk_298.z = -1079.0f; this->unk_28C.z = -1079.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); this->actionFunc = func_80A53F30; } -void func_80A53F30(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53F30(EnHeishi2* this, PlayState* play) { BgGateShutter* gate; SkelAnime_Update(&this->skelAnime); - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); gate = (BgGateShutter*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) { - Gameplay_ClearCamera(globalCtx, this->cameraId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->cameraId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); if ((this->unk_30A != 2)) { if (this->unk_30A == 0) { this->actor.textId = 0x2015; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80A54038; } else { - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A53908; } } else { this->unk_30E = 0; this->actor.textId = 0x2021; Rupees_ChangeBy(15); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80A5427C; } } } -void func_80A54038(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A54038(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { gSaveContext.infTable[7] |= 0x40; - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, 0, 7); + Message_CloseTextbox(play); + func_8002DF54(play, 0, 7); this->actionFunc = func_80A53908; } } -void func_80A540C0(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A540C0(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: this->actor.textId = 0x2020; - Message_ContinueTextbox(globalCtx, this->actor.textId); - Player_UnsetMask(globalCtx); + Message_ContinueTextbox(play, this->actor.textId); + Player_UnsetMask(play); gSaveContext.infTable[7] |= 0x80; gSaveContext.itemGetInf[3] |= 0x100; - Item_Give(globalCtx, ITEM_SOLD_OUT); + Item_Give(play, ITEM_SOLD_OUT); if (this->unk_30A != 0) { this->unk_30A = 2; this->unk_30E = 1; @@ -554,7 +554,7 @@ void func_80A540C0(EnHeishi2* this, GlobalContext* globalCtx) { case 1: this->unk_30E = 1; this->actor.textId = 0x200C; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_300 = TEXT_STATE_EVENT; if (this->unk_30A == 0) { this->actionFunc = func_80A5427C; @@ -565,32 +565,32 @@ void func_80A540C0(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A541FC(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A541FC(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0x2021; Rupees_ChangeBy(15); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80A5427C; } } -void func_80A5427C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5427C(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { if (this->unk_30E == 0) { this->unk_30E = 0; this->unk_30A = this->unk_30E; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_80A53908; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A54320; } } } -void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A54320(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim); this->unk_2EC = frameCount; @@ -599,10 +599,10 @@ void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A543A0; } -void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A543A0(EnHeishi2* this, PlayState* play) { s32 pad; f32 frameCount = this->skelAnime.curFrame; - BgGateShutter* gate = (BgGateShutter*)(globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head); + BgGateShutter* gate = (BgGateShutter*)(play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head); SkelAnime_Update(&this->skelAnime); if ((frameCount >= 12.0f) && (!this->audioFlag)) { @@ -632,33 +632,33 @@ void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A544AC(EnHeishi2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, -6100, 5, this->unk_2E4, 0); Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f); this->actor.world.rot.z = this->actor.shape.rot.z; if (this->actor.shape.rot.z < -6000) { - Message_StartTextbox(globalCtx, 0x708F, NULL); + Message_StartTextbox(play, 0x708F, NULL); this->actor.flags |= ACTOR_FLAG_16; this->actionFunc = func_80A5455C; this->unk_2E4 = 0.0f; } } -void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5455C(EnHeishi2* this, PlayState* play) { s32 pad; Vec3f pos; f32 rotY; EnBom* bomb; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, NULL, 7); - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + func_8002DF54(play, NULL, 7); + Message_CloseTextbox(play); pos.x = Rand_CenteredFloat(20.0f) + this->unk_274.x; pos.y = Rand_CenteredFloat(20.0f) + (this->unk_274.y - 40.0f); pos.z = Rand_CenteredFloat(20.0f) + (this->unk_274.z - 20.0f); rotY = Rand_CenteredFloat(7000.0f) + this->actor.yawTowardsPlayer; - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0); + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0); if (bomb != NULL) { bomb->actor.speedXZ = Rand_CenteredFloat(5.0f) + 10.0f; bomb->actor.velocity.y = Rand_CenteredFloat(5.0f) + 10.0f; @@ -670,7 +670,7 @@ void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A546DC(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A546DC(EnHeishi2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 200, 5, this->unk_2E4, 0); Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f); this->actor.world.rot.z = this->actor.shape.rot.z; @@ -679,12 +679,12 @@ void func_80A546DC(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5475C(EnHeishi2* this, PlayState* play) { s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Text_GetFaceReaction(globalCtx, 5) != 0) { + if (Text_GetFaceReaction(play, 5) != 0) { if (this->unk_30B == 0) { if (this->type == 2) { this->actionFunc = func_80A53278; @@ -706,7 +706,7 @@ void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->type == 2) { if (this->unk_30E == 1) { this->actionFunc = func_80A5344C; @@ -737,21 +737,21 @@ void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) { ((yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)), !(this->actor.xzDistToPlayer > 120.0f)) && (yawDiff < 0x4300))) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void func_80A54954(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A54954(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A549E8; } -void func_80A549E8(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A549E8(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_300 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if (this->unk_300 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (this->type == 2) { this->actionFunc = func_80A531E4; } @@ -761,7 +761,7 @@ void func_80A549E8(EnHeishi2* this, GlobalContext* globalCtx) { } } -void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Update(Actor* thisx, PlayState* play) { s32 pad; EnHeishi2* this = (EnHeishi2*)thisx; s32 i; @@ -770,7 +770,7 @@ void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->type == 2) || (this->type == 5)) { this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); - func_80038290(globalCtx, &this->actor, &this->unk_260, &this->unk_26C, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_260, &this->unk_26C, this->actor.focus.pos); } this->unk_2FC++; @@ -780,7 +780,7 @@ void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2F2[i]--; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); switch (this->type) { case 6: @@ -788,14 +788,14 @@ void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { case 9: break; default: - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 30.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 30.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); break; } } -s32 EnHeishi2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnHeishi2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi2* this = (EnHeishi2*)thisx; @@ -817,7 +817,7 @@ s32 EnHeishi2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnHeishi2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHeishi2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnHeishi2* this = (EnHeishi2*)thisx; if (limbIndex == 16) { @@ -825,41 +825,41 @@ void EnHeishi2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnHeishi2_DrawKingGuard(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) { + 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++, gHeishiKingGuardDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnHeishi2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Draw(Actor* thisx, PlayState* play) { EnHeishi2* this = (EnHeishi2*)thisx; Mtx* mtx; s32 linkObjBankIndex; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi2_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi2_OverrideLimbDraw, EnHeishi2_PostLimbDraw, this); if ((this->type == 5) && (gSaveContext.infTable[7] & 0x80)) { - linkObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_LINK_CHILD); + linkObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); if (linkObjBankIndex >= 0) { Matrix_Put(&this->mtxf_330); Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateZ(DEGTORAD(70.0), MTXMODE_APPLY); - mtx = MATRIX_NEWMTX(globalCtx->state.gfxCtx) - 7; + mtx = MATRIX_NEWMTX(play->state.gfxCtx) - 7; - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[linkObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkObjBankIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); gSPDisplayList(POLY_OPA_DISP++, gLinkChildKeatonMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h index 86a7e0539..2016b5547 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h +++ b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h @@ -7,7 +7,7 @@ struct EnHeishi2; -typedef void (*EnHeishi2ActionFunc)(struct EnHeishi2*, GlobalContext*); +typedef void (*EnHeishi2ActionFunc)(struct EnHeishi2*, PlayState*); typedef struct EnHeishi2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 8e31d5670..768e7ca71 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -10,18 +10,18 @@ #define FLAGS 0 -void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi3_Init(Actor* thisx, PlayState* play); +void EnHeishi3_Destroy(Actor* thisx, PlayState* play); +void EnHeishi3_Update(Actor* thisx, PlayState* play); +void EnHeishi3_Draw(Actor* thisx, PlayState* play); -void EnHeishi3_SetupGuardType(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, GlobalContext* globalCtx); -void func_80A55D00(EnHeishi3* this, GlobalContext* globalCtx); -void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx); +void EnHeishi3_SetupGuardType(EnHeishi3* this, PlayState* play); +void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, PlayState* play); +void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, PlayState* play); +void EnHeishi3_CatchStart(EnHeishi3* this, PlayState* play); +void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, PlayState* play); +void func_80A55D00(EnHeishi3* this, PlayState* play); +void func_80A55BD4(EnHeishi3* this, PlayState* play); static s16 sPlayerCaught = 0; @@ -58,7 +58,7 @@ static ColliderCylinderInit sCylinderInit = { { 15, 70, 0, { 0, 0, 0 } }, }; -void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Init(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; sPlayerCaught = 0; @@ -72,12 +72,12 @@ void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 6; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); // "Castle Gate Soldier - Power Up" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 城門兵パワーアップ ☆☆☆☆☆ \n" VT_RST); @@ -86,13 +86,13 @@ void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnHeishi3_SetupGuardType; } -void EnHeishi3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Destroy(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnHeishi3_SetupGuardType(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_SetupGuardType(EnHeishi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -106,13 +106,13 @@ void EnHeishi3_SetupGuardType(EnHeishi3* this, GlobalContext* globalCtx) { /** * Handles the guards standing on Hyrule Castle Grounds. **/ -void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, PlayState* play) { Player* player; s16 yawDiff; s16 yawDiffNew; f32 sightRange; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiffNew = ABS(yawDiff); @@ -132,10 +132,10 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) if ((this->actor.xzDistToPlayer < sightRange) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f) && (sPlayerCaught == 0)) { sPlayerCaught = 1; - Message_StartTextbox(globalCtx, 0x702D, &this->actor); + Message_StartTextbox(play, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = EnHeishi3_CatchStart; } } @@ -143,8 +143,8 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) /** * Handles the guards standing in front of Hyrule Castle. **/ -void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if ((player->actor.world.pos.x < -190.0f) && (player->actor.world.pos.x > -380.0f) && @@ -160,15 +160,15 @@ void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx) } } sPlayerCaught = 1; - Message_StartTextbox(globalCtx, 0x702D, &this->actor); + Message_StartTextbox(play, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = EnHeishi3_CatchStart; } } -void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_CatchStart(EnHeishi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiWalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiWalkAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -177,7 +177,7 @@ void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx) { this->actor.speedXZ = 2.5f; } -void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx) { +void func_80A55BD4(EnHeishi3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { @@ -191,7 +191,7 @@ void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx) { } } -void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -199,20 +199,20 @@ void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, GlobalContext* globalCtx) { } // This function initiates the respawn after the player gets caught. -void func_80A55D00(EnHeishi3* this, GlobalContext* globalCtx) { +void func_80A55D00(EnHeishi3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx) && + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play) && (this->respawnFlag == 0)) { gSaveContext.eventChkInf[4] |= 0x4000; - globalCtx->nextEntranceIndex = 0x47E; // Hyrule Castle from Guard Capture (outside) - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x47E; // Hyrule Castle from Guard Capture (outside) + play->sceneLoadFlag = 0x14; this->respawnFlag = 1; - globalCtx->fadeTransition = 0x2E; + play->fadeTransition = 0x2E; gSaveContext.nextTransition = 0x2E; } } -void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Update(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; s32 pad; @@ -221,15 +221,15 @@ void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->caughtTimer != 0) { this->caughtTimer -= 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot = this->actor.world.rot; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1C); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnHeishi3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnHeishi3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi3* this = (EnHeishi3*)thisx; @@ -245,10 +245,10 @@ s32 EnHeishi3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnHeishi3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Draw(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi3_OverrideLimbDraw, NULL, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi3_OverrideLimbDraw, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h b/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h index 824e721ca..63b431139 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h +++ b/soh/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h @@ -6,7 +6,7 @@ struct EnHeishi3; -typedef void (*EnHeishi3ActionFunc)(struct EnHeishi3*, GlobalContext*); +typedef void (*EnHeishi3ActionFunc)(struct EnHeishi3*, PlayState*); typedef struct EnHeishi3 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index f13c5c3ef..7bd935df9 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -4,22 +4,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi4_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi4_Init(Actor* thisx, PlayState* play); +void EnHeishi4_Destroy(Actor* thisx, PlayState* play); +void EnHeishi4_Update(Actor* thisx, PlayState* play); +void EnHeishi4_Draw(Actor* thisx, PlayState* play); -void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56328(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56ACC(EnHeishi4* this, GlobalContext* globalCtx); +void func_80A56544(EnHeishi4* this, PlayState* play); +void func_80A5673C(EnHeishi4* this, PlayState* play); +void func_80A56328(EnHeishi4* this, PlayState* play); +void func_80A563BC(EnHeishi4* this, PlayState* play); +void func_80A56B40(EnHeishi4* this, PlayState* play); +void func_80A56614(EnHeishi4* this, PlayState* play); +void func_80A56874(EnHeishi4* this, PlayState* play); +void func_80A56900(EnHeishi4* this, PlayState* play); +void func_80A56994(EnHeishi4* this, PlayState* play); +void func_80A56A50(EnHeishi4* this, PlayState* play); +void func_80A56ACC(EnHeishi4* this, PlayState* play); const ActorInit En_Heishi4_InitVars = { ACTOR_EN_HEISHI4, @@ -56,7 +56,7 @@ static ColliderCylinderInit sCylinderInit = { { 33, 40, 0, { 0, 0, 0 } }, }; -void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Init(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; Actor_SetScale(thisx, 0.01f); @@ -67,16 +67,16 @@ void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->type == HEISHI4_AT_MARKET_DYING) { this->height = 30.0f; ActorShape_Init(&thisx->shape, 0.0f, NULL, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiDyingGuardAnim_00C444, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiDyingGuardAnim_00C444, this->jointTable, this->morphTable, 17); } else { this->height = 60.0f; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17); } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); this->collider.dim.yShift = 0; this->collider.dim.radius = 15; this->collider.dim.height = 70; @@ -102,20 +102,20 @@ void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); } -void EnHeishi4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Destroy(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A56328(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56328(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A563BC; } -void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A563BC(EnHeishi4* this, PlayState* play) { s16 reactionOffset; this->unk_2B4 = 0; @@ -126,8 +126,8 @@ void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx) { if (reactionOffset >= 3) { reactionOffset = 1; } - if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]); + if (Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]) != 0) { + this->actor.textId = Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]); this->unk_2B4 = 1; this->actionFunc = func_80A56B40; } else { @@ -163,7 +163,7 @@ void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx) { } } -void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56544(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); @@ -175,7 +175,7 @@ void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx) { } } -void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56614(EnHeishi4* this, PlayState* play) { s16 reactionOffset; reactionOffset = this->type - 4; @@ -186,19 +186,19 @@ void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx) { if (reactionOffset >= 3) { reactionOffset = 1; } - if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]); + if (Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]) != 0) { + this->actor.textId = Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]); this->unk_2B4 = 1; this->actionFunc = func_80A56B40; return; } - if (globalCtx->sceneNum == SCENE_MIHARIGOYA) { + if (play->sceneNum == SCENE_MIHARIGOYA) { if (IS_DAY) { this->actor.textId = 0x7004; } else { this->actor.textId = 0x709A; } - } else if (globalCtx->sceneNum != SCENE_MARKET_NIGHT) { + } else if (play->sceneNum != SCENE_MARKET_NIGHT) { if (IS_DAY) { this->actor.textId = 0x7002; } else { @@ -211,7 +211,7 @@ void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx) { this->actionFunc = func_80A56B40; } -void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A5673C(EnHeishi4* this, PlayState* play) { if (gSaveContext.eventChkInf[4] & 0x20) { osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ マスターソード祝入手! ☆☆☆☆☆ \n" VT_RST); Actor_Kill(&this->actor); @@ -238,11 +238,11 @@ void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx) { } } -void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56874(EnHeishi4* this, PlayState* play) { if (this->unk_284 != 0) { SkelAnime_Update(&this->skelAnime); } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->unk_284 == 0) { this->actionFunc = func_80A5673C; @@ -250,29 +250,29 @@ void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx) { this->actionFunc = func_80A56900; } } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56900(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardTalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiDyingGuardTalkAnim, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A56994; } -void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56994(EnHeishi4* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - func_80038290(globalCtx, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos); - if ((this->unk_282 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + func_80038290(play, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos); + if ((this->unk_282 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); gSaveContext.infTable[6] |= 0x1000; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A56A50; } } -void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56A50(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardDieAnim); this->unk_288 = frames; @@ -280,17 +280,17 @@ void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx) { this->actionFunc = func_80A56ACC; } -void func_80A56ACC(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56ACC(EnHeishi4* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); if (this->unk_288 <= currentFrame) { - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A5673C; } } -void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56B40(EnHeishi4* this, PlayState* play) { s16 reactionOffset; SkelAnime_Update(&this->skelAnime); @@ -301,7 +301,7 @@ void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { if (reactionOffset >= 3) { reactionOffset = 1; } - if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) { + if (Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]) != 0) { if (this->unk_2B4 == 0) { if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { this->actionFunc = func_80A563BC; @@ -324,7 +324,7 @@ void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { } } } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { this->unk_284 = 1; this->actionFunc = func_80A563BC; @@ -335,13 +335,13 @@ void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { return; } } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } -void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Update(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); thisx->world.pos.x = this->pos.x; thisx->world.pos.y = this->pos.y; @@ -357,14 +357,14 @@ void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_266 = this->unk_28C.unk_0E; } this->unk_27E += 1; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 10.0f, 10.0f, 30.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 10.0f, 30.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 EnHeishi_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnHeishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi4* this = (EnHeishi4*)thisx; @@ -378,10 +378,10 @@ s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void EnHeishi4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Draw(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi_OverrideLimbDraw, NULL, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi_OverrideLimbDraw, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h index 7af01e3fb..0d254f432 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h +++ b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h @@ -13,7 +13,7 @@ typedef enum { struct EnHeishi4; -typedef void (*EnHeishi4ActionFunc)(struct EnHeishi4*, GlobalContext*); +typedef void (*EnHeishi4ActionFunc)(struct EnHeishi4*, PlayState*); typedef struct EnHeishi4 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 2d887de43..7097172f7 100644 --- a/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -9,23 +9,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHintnuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHintnuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHintnuts_Init(Actor* thisx, PlayState* play); +void EnHintnuts_Destroy(Actor* thisx, PlayState* play); +void EnHintnuts_Update(Actor* thisx, PlayState* play); +void EnHintnuts_Draw(Actor* thisx, PlayState* play); void EnHintnuts_SetupWait(EnHintnuts* this); -void EnHintnuts_Wait(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Burrow(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_BeginRun(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_BeginFreeze(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Talk(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx); +void EnHintnuts_Wait(EnHintnuts* this, PlayState* play); +void EnHintnuts_LookAround(EnHintnuts* this, PlayState* play); +void EnHintnuts_Stand(EnHintnuts* this, PlayState* play); +void EnHintnuts_ThrowNut(EnHintnuts* this, PlayState* play); +void EnHintnuts_Burrow(EnHintnuts* this, PlayState* play); +void EnHintnuts_BeginRun(EnHintnuts* this, PlayState* play); +void EnHintnuts_BeginFreeze(EnHintnuts* this, PlayState* play); +void EnHintnuts_Run(EnHintnuts* this, PlayState* play); +void EnHintnuts_Talk(EnHintnuts* this, PlayState* play); +void EnHintnuts_Leave(EnHintnuts* this, PlayState* play); +void EnHintnuts_Freeze(EnHintnuts* this, PlayState* play); const ActorInit En_Hintnuts_InitVars = { ACTOR_EN_HINTNUTS, @@ -70,7 +70,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP), }; -void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Init(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; s32 pad; @@ -79,41 +79,41 @@ void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); } else { ActorShape_Init(&this->actor.shape, 0x0, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gHintNutsSkel, &gHintNutsStandAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gHintNutsSkel, &gHintNutsStandAnim, this->jointTable, this->morphTable, 10); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - Actor_SetTextWithPrefix(globalCtx, &this->actor, (this->actor.params >> 8) & 0xFF); + Actor_SetTextWithPrefix(play, &this->actor, (this->actor.params >> 8) & 0xFF); this->textIdCopy = this->actor.textId; this->actor.params &= 0xFF; sPuzzleCounter = 0; if (this->actor.textId == 0x109B) { - if (Flags_GetClear(globalCtx, 0x9) != 0) { + if (Flags_GetClear(play, 0x9) != 0) { Actor_Kill(&this->actor); return; } } EnHintnuts_SetupWait(this); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_HINTNUTS, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HINTNUTS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0xA); } } -void EnHintnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Destroy(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; if (this->actor.params != 0xA) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnHintnuts_HitByScrubProjectile1(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_HitByScrubProjectile1(EnHintnuts* this, PlayState* play) { if (this->actor.textId != 0 && this->actor.category == ACTORCAT_ENEMY && ((this->actor.params == 0) || (sPuzzleCounter == 2))) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BG); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BG); } } @@ -190,7 +190,7 @@ void EnHintnuts_SetupTalk(EnHintnuts* this) { this->actor.speedXZ = 0.0f; } -void EnHintnuts_SetupLeave(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_SetupLeave(EnHintnuts* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gHintNutsRunAnim, -5.0f); this->actor.speedXZ = 3.0f; this->animFlagAndTimer = 100; @@ -198,7 +198,7 @@ void EnHintnuts_SetupLeave(EnHintnuts* this, GlobalContext* globalCtx) { this->collider.base.ocFlags1 &= ~OC1_ON; this->actor.flags |= ACTOR_FLAG_4; Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DAMAGE); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0x0, 0x0, 0x0, 0x3); // recovery heart this->actionFunc = EnHintnuts_Leave; } @@ -217,7 +217,7 @@ void EnHintnuts_SetupFreeze(EnHintnuts* this) { this->actionFunc = EnHintnuts_Freeze; } -void EnHintnuts_Wait(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Wait(EnHintnuts* this, PlayState* play) { s32 hasSlowPlaybackSpeed = false; if (this->skelAnime.playSpeed < 0.5f) { @@ -250,7 +250,7 @@ void EnHintnuts_Wait(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_LookAround(EnHintnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->animFlagAndTimer != 0) { this->animFlagAndTimer--; @@ -260,7 +260,7 @@ void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Stand(EnHintnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->animFlagAndTimer != 0) { this->animFlagAndTimer--; @@ -275,7 +275,7 @@ void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_ThrowNut(EnHintnuts* this, PlayState* play) { Vec3f nutPos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -287,14 +287,14 @@ void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx) { nutPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f); nutPos.y = this->actor.world.pos.y + 12.0f; nutPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, nutPos.x, nutPos.y, nutPos.z, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, nutPos.x, nutPos.y, nutPos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 1) != NULL) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } } } -void EnHintnuts_Burrow(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Burrow(EnHintnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnHintnuts_SetupWait(this); } else { @@ -308,7 +308,7 @@ void EnHintnuts_Burrow(EnHintnuts* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->actor.home.pos.z, 0.5f, 3.0f); } -void EnHintnuts_BeginRun(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_BeginRun(EnHintnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_196 = this->actor.yawTowardsPlayer + 0x8000; EnHintnuts_SetupRun(this); @@ -316,13 +316,13 @@ void EnHintnuts_BeginRun(EnHintnuts* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); } -void EnHintnuts_BeginFreeze(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_BeginFreeze(EnHintnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnHintnuts_SetupFreeze(this); } } -void EnHintnuts_CheckProximity(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_CheckProximity(EnHintnuts* this, PlayState* play) { if (this->actor.category != ACTORCAT_ENEMY) { if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isTargeted) { this->actor.flags |= ACTOR_FLAG_16; @@ -331,12 +331,12 @@ void EnHintnuts_CheckProximity(EnHintnuts* this, GlobalContext* globalCtx) { } if (this->actor.xzDistToPlayer < 130.0f) { this->actor.textId = this->textIdCopy; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } -void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Run(EnHintnuts* this, PlayState* play) { s32 temp_ret; s16 diffRotInit; s16 diffRot; @@ -372,7 +372,7 @@ void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnHintnuts_SetupTalk(this); } else if (this->animFlagAndTimer == 0 && Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 20.0f && fabsf(this->actor.world.pos.y - this->actor.home.pos.y) < 2.0f) { @@ -380,23 +380,23 @@ void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { if (this->actor.category == ACTORCAT_BG) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_16); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } EnHintnuts_SetupBurrow(this); } else { - EnHintnuts_CheckProximity(this, globalCtx); + EnHintnuts_CheckProximity(this, play); } } -void EnHintnuts_Talk(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Talk(EnHintnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x3, 0x400, 0x100); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - EnHintnuts_SetupLeave(this, globalCtx); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + EnHintnuts_SetupLeave(this, play); } } -void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Leave(EnHintnuts* this, PlayState* play) { s16 temp_a1; SkelAnime_Update(&this->skelAnime); @@ -409,29 +409,29 @@ void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 8) { temp_a1 = this->actor.wallYaw; } else { - temp_a1 = this->actor.yawTowardsPlayer - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 0x8000; + temp_a1 = this->actor.yawTowardsPlayer - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - 0x8000; if (ABS(temp_a1) >= 0x4001) { - temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; } else { - temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - (temp_a1 >> 1) + 0x8000; + temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - (temp_a1 >> 1) + 0x8000; } } Math_ScaledStepToS(&this->actor.shape.rot.y, temp_a1, 0x800); this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->animFlagAndTimer == 0) || (this->actor.projectedPos.z < 0.0f)) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (this->actor.params == 3) { - Flags_SetClear(globalCtx, this->actor.room); + Flags_SetClear(play, this->actor.room); sPuzzleCounter = 3; } if (this->actor.child != NULL) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, this->actor.child, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, this->actor.child, ACTORCAT_PROP); } Actor_Kill(&this->actor); } } -void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Freeze(EnHintnuts* this, PlayState* play) { this->actor.colorFilterTimer = 1; SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -440,7 +440,7 @@ void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { if (this->animFlagAndTimer == 0) { if (sPuzzleCounter == 3) { if (this->actor.child != NULL) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, this->actor.child, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, this->actor.child, ACTORCAT_PROP); } this->animFlagAndTimer = 1; } else if (sPuzzleCounter == -4) { @@ -459,39 +459,39 @@ void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_ColliderCheck(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_ColliderCheck(EnHintnuts* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, 1); if (this->collider.base.ac->id != ACTOR_EN_NUTSBALL) { EnHintnuts_SetupBurrow(this); } else { - EnHintnuts_HitByScrubProjectile1(this, globalCtx); + EnHintnuts_HitByScrubProjectile1(this, play); EnHintnuts_HitByScrubProjectile2(this); } - } else if (globalCtx->actorCtx.unk_02 != 0) { - EnHintnuts_HitByScrubProjectile1(this, globalCtx); + } else if (play->actorCtx.unk_02 != 0) { + EnHintnuts_HitByScrubProjectile1(this, play); EnHintnuts_HitByScrubProjectile2(this); } } -void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Update(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; s32 pad; if (this->actor.params != 0xA) { - EnHintnuts_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnHintnuts_ColliderCheck(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnHintnuts_Freeze && this->actionFunc != EnHintnuts_BeginFreeze) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->collider.dim.radius, + 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->actionFunc == EnHintnuts_Wait) { Actor_SetFocus(&this->actor, this->skelAnime.curFrame); } else if (this->actionFunc == EnHintnuts_Burrow) { @@ -503,7 +503,7 @@ void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHintnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnHintnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Vec3f vec; f32 curFrame; @@ -532,13 +532,13 @@ s32 EnHintnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnHintnuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Draw(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; if (this->actor.params == 0xA) { - Gfx_DrawDListOpa(globalCtx, gHintNutsFlowerDL); + Gfx_DrawDListOpa(play, gHintNutsFlowerDL); } else { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintnuts_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintnuts_OverrideLimbDraw, NULL, this); } } diff --git a/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h b/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h index f474591b3..fcc020165 100644 --- a/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h +++ b/soh/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h @@ -6,7 +6,7 @@ struct EnHintnuts; -typedef void (*EnHintnutsActionFunc)(struct EnHintnuts*, GlobalContext*); +typedef void (*EnHintnutsActionFunc)(struct EnHintnuts*, PlayState*); typedef struct EnHintnuts { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 6e216e6d5..2851efb88 100644 --- a/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -10,18 +10,18 @@ #define PLANE_HALFWIDTH 100.0f #define PLANE_HALFWIDTH_2 200.0f -void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHoll_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHoll_Init(Actor* thisx, PlayState* play); +void EnHoll_Destroy(Actor* thisx, PlayState* play); +void EnHoll_Update(Actor* thisx, PlayState* play); +void EnHoll_Draw(Actor* thisx, PlayState* play); -void EnHoll_NextAction(EnHoll* this, GlobalContext* globalCtx); -void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx); -void func_80A59014(EnHoll* this, GlobalContext* globalCtx); -void func_80A591C0(EnHoll* this, GlobalContext* globalCtx); -void func_80A593A4(EnHoll* this, GlobalContext* globalCtx); -void func_80A59520(EnHoll* this, GlobalContext* globalCtx); -void func_80A59618(EnHoll* this, GlobalContext* globalCtx); +void EnHoll_NextAction(EnHoll* this, PlayState* play); +void func_80A58DD4(EnHoll* this, PlayState* play); +void func_80A59014(EnHoll* this, PlayState* play); +void func_80A591C0(EnHoll* this, PlayState* play); +void func_80A593A4(EnHoll* this, PlayState* play); +void func_80A59520(EnHoll* this, PlayState* play); +void func_80A59618(EnHoll* this, PlayState* play); const ActorInit En_Holl_InitVars = { ACTOR_EN_HOLL, @@ -92,7 +92,7 @@ void EnHoll_ChooseAction(EnHoll* this) { } } -void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Init(Actor* thisx, PlayState* play) { EnHoll* this = (EnHoll*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -100,27 +100,27 @@ void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_14F = 0; } -void EnHoll_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Destroy(Actor* thisx, PlayState* play) { s32 transitionActorIdx = (u16)thisx->params >> 0xA; - TransitionActorEntry* transitionEntry = &globalCtx->transiActorCtx.list[transitionActorIdx]; + TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIdx]; transitionEntry->id = -transitionEntry->id; } -void EnHoll_SwapRooms(GlobalContext* globalCtx) { +void EnHoll_SwapRooms(PlayState* play) { Room tempRoom; - RoomContext* roomCtx = &globalCtx->roomCtx; + RoomContext* roomCtx = &play->roomCtx; tempRoom = roomCtx->curRoom; roomCtx->curRoom = roomCtx->prevRoom; roomCtx->prevRoom = tempRoom; - globalCtx->roomCtx.unk_30 ^= 1; + play->roomCtx.unk_30 ^= 1; } // Horizontal Planes -void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 phi_t0 = ((globalCtx->sceneNum == SCENE_JYASINZOU) ? 1 : 0) & 0xFFFFFFFF; +void func_80A58DD4(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 phi_t0 = ((play->sceneNum == SCENE_JYASINZOU) ? 1 : 0) & 0xFFFFFFFF; Vec3f vec; f32 absZ; s32 transitionActorIdx; @@ -132,21 +132,21 @@ void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { absZ < sHorizTriggerDists[phi_t0][0]) { transitionActorIdx = (u16)this->actor.params >> 0xA; if (absZ > sHorizTriggerDists[phi_t0][1]) { - if (globalCtx->roomCtx.prevRoom.num >= 0 && globalCtx->roomCtx.status == 0) { - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[this->side].room; - EnHoll_SwapRooms(globalCtx); - func_80097534(globalCtx, &globalCtx->roomCtx); + if (play->roomCtx.prevRoom.num >= 0 && play->roomCtx.status == 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[this->side].room; + EnHoll_SwapRooms(play); + func_80097534(play, &play->roomCtx); } } else { - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[this->side ^ 1].room; - if (globalCtx->roomCtx.prevRoom.num < 0) { - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room); + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[this->side ^ 1].room; + if (play->roomCtx.prevRoom.num < 0) { + func_8009728C(play, &play->roomCtx, this->actor.room); } else { this->planeAlpha = (255.0f / (sHorizTriggerDists[phi_t0][2] - sHorizTriggerDists[phi_t0][3])) * (absZ - sHorizTriggerDists[phi_t0][3]); this->planeAlpha = CLAMP(this->planeAlpha, 0, 255); - if (globalCtx->roomCtx.curRoom.num != this->actor.room) { - EnHoll_SwapRooms(globalCtx); + if (play->roomCtx.curRoom.num != this->actor.room) { + EnHoll_SwapRooms(play); } } } @@ -154,15 +154,15 @@ void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { } // Horizontal Planes -void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 useViewEye = gDbgCamEnabled || globalCtx->csCtx.state != CS_STATE_IDLE; +void func_80A59014(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 useViewEye = gDbgCamEnabled || play->csCtx.state != CS_STATE_IDLE; Vec3f vec; s32 temp; f32 planeHalfWidth; f32 absZ; - func_8002DBD0(&this->actor, &vec, (useViewEye) ? &globalCtx->view.eye : &player->actor.world.pos); + func_8002DBD0(&this->actor, &vec, (useViewEye) ? &play->view.eye : &player->actor.world.pos); planeHalfWidth = (((this->actor.params >> 6) & 7) == 6) ? PLANE_HALFWIDTH : PLANE_HALFWIDTH_2; temp = EnHoll_IsKokiriSetup8(); @@ -170,14 +170,14 @@ void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { (absZ = fabsf(vec.z), 100.0f > absZ && absZ > 50.0f))) { s32 transitionActorIdx = (u16)this->actor.params >> 0xA; s32 side = (vec.z < 0.0f) ? 0 : 1; - TransitionActorEntry* transitionEntry = &globalCtx->transiActorCtx.list[transitionActorIdx]; + TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIdx]; s32 room = transitionEntry->sides[side].room; this->actor.room = room; if (temp) {} - if (this->actor.room != globalCtx->roomCtx.curRoom.num) { + if (this->actor.room != play->roomCtx.curRoom.num) { if (room) {} - if (func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room)) { + if (func_8009728C(play, &play->roomCtx, this->actor.room)) { EnHoll_SetupAction(this, EnHoll_NextAction); } } @@ -185,67 +185,67 @@ void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { } // Vertical Planes -void func_80A591C0(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A591C0(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 absY = fabsf(this->actor.yDistToPlayer); s32 transitionActorIdx; if (this->actor.xzDistToPlayer < 500.0f && absY < 700.0f) { transitionActorIdx = (u16)this->actor.params >> 0xA; if (absY < 95.0f) { - globalCtx->unk_11E18 = 0xFF; + play->unk_11E18 = 0xFF; } else if (absY > 605.0f) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; } else { - globalCtx->unk_11E18 = (s16)(605.0f - absY) * 0.5f; + play->unk_11E18 = (s16)(605.0f - absY) * 0.5f; } if (absY < 95.0f) { - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[1].room; + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[1].room; Math_SmoothStepToF(&player->actor.world.pos.x, this->actor.world.pos.x, 1.0f, 50.0f, 10.0f); Math_SmoothStepToF(&player->actor.world.pos.z, this->actor.world.pos.z, 1.0f, 50.0f, 10.0f); - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); this->unk_14F = 1; player->actor.speedXZ = 0.0f; } } } else if (this->unk_14F != 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; this->unk_14F = 0; } } // Vertical Planes -void func_80A593A4(EnHoll* this, GlobalContext* globalCtx) { +void func_80A593A4(EnHoll* this, PlayState* play) { f32 absY; s32 side; s32 transitionActorIdx; if ((this->actor.xzDistToPlayer < 120.0f) && (absY = fabsf(this->actor.yDistToPlayer), absY < 200.0f)) { if (absY < 50.0f) { - globalCtx->unk_11E18 = 0xFF; + play->unk_11E18 = 0xFF; } else { - globalCtx->unk_11E18 = (200.0f - absY) * 1.7f; + play->unk_11E18 = (200.0f - absY) * 1.7f; } if (absY > 50.0f) { transitionActorIdx = (u16)this->actor.params >> 0xA; side = (0.0f < this->actor.yDistToPlayer) ? 0 : 1; - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[side].room; - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room; + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); this->unk_14F = 1; } } } else if (this->unk_14F != 0) { this->unk_14F = 0; - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; } } // Vertical Planes -void func_80A59520(EnHoll* this, GlobalContext* globalCtx) { +void func_80A59520(EnHoll* this, PlayState* play) { f32 absY; s8 side; s32 transitionActorIdx; @@ -255,9 +255,9 @@ void func_80A59520(EnHoll* this, GlobalContext* globalCtx) { if (absY < 200.0f && absY > 50.0f) { transitionActorIdx = (u16)this->actor.params >> 0xA; side = (0.0f < this->actor.yDistToPlayer) ? 0 : 1; - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[side].room; - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room; + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); } } @@ -265,16 +265,16 @@ void func_80A59520(EnHoll* this, GlobalContext* globalCtx) { } // Horizontal Planes -void func_80A59618(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A59618(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f vec; f32 absZ; s32 side; s32 transitionActorIdx; - if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params & 0x3F)) { if (this->unk_14F != 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; this->unk_14F = 0; } } else { @@ -283,53 +283,53 @@ void func_80A59618(EnHoll* this, GlobalContext* globalCtx) { if (PLANE_Y_MIN < vec.y && vec.y < PLANE_Y_MAX && fabsf(vec.x) < PLANE_HALFWIDTH_2 && absZ < 100.0f) { this->unk_14F = 1; transitionActorIdx = (u16)this->actor.params >> 0xA; - globalCtx->unk_11E18 = 0xFF - (s32)((absZ - 50.0f) * 5.9f); - if (globalCtx->unk_11E18 >= 0x100) { - globalCtx->unk_11E18 = 0xFF; - } else if (globalCtx->unk_11E18 < 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0xFF - (s32)((absZ - 50.0f) * 5.9f); + if (play->unk_11E18 >= 0x100) { + play->unk_11E18 = 0xFF; + } else if (play->unk_11E18 < 0) { + play->unk_11E18 = 0; } if (absZ < 50.0f) { side = (vec.z < 0.0f) ? 0 : 1; - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[side].room; - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room; + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); } } } else if (this->unk_14F != 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; this->unk_14F = 0; } } } -void EnHoll_NextAction(EnHoll* this, GlobalContext* globalCtx) { - if (!EnHoll_IsKokiriSetup8() && globalCtx->roomCtx.status == 0) { - func_80097534(globalCtx, &globalCtx->roomCtx); - if (globalCtx->unk_11E18 == 0) { +void EnHoll_NextAction(EnHoll* this, PlayState* play) { + if (!EnHoll_IsKokiriSetup8() && play->roomCtx.status == 0) { + func_80097534(play, &play->roomCtx); + if (play->unk_11E18 == 0) { this->unk_14F = 0; } EnHoll_ChooseAction(this); } } -void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Update(Actor* thisx, PlayState* play) { EnHoll* this = (EnHoll*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } #include "overlays/ovl_En_Holl/ovl_En_Holl.h" -void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Draw(Actor* thisx, PlayState* play) { EnHoll* this = (EnHoll*)thisx; Gfx* gfxP; u32 setupDlIdx; // Only draw the plane if not invisible if (this->planeAlpha != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->planeAlpha == 255) { gfxP = POLY_OPA_DISP; @@ -343,7 +343,7 @@ void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } - gSPMatrix(gfxP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(gfxP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(gfxP++, 0, 0, 0, 0, 0, (u8)this->planeAlpha); gSPDisplayList(gfxP++, sPlaneDL); @@ -354,6 +354,6 @@ void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = gfxP; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.h b/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.h index b163d0fec..452de700a 100644 --- a/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.h +++ b/soh/src/overlays/actors/ovl_En_Holl/z_en_holl.h @@ -6,7 +6,7 @@ struct EnHoll; -typedef void (*EnHollActionFunc)(struct EnHoll*, GlobalContext*); +typedef void (*EnHollActionFunc)(struct EnHoll*, PlayState*); typedef struct EnHoll { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index ebbe3d0b1..be30f0f56 100644 --- a/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -21,31 +21,31 @@ typedef enum { /* 3 */ HONOTRAP_EYE_SHUT } EnHonotrapEyeState; -void EnHonotrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHonotrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHonotrap_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHonotrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHonotrap_Init(Actor* thisx, PlayState* play); +void EnHonotrap_Destroy(Actor* thisx, PlayState* play); +void EnHonotrap_Update(Actor* thisx, PlayState* play); +void EnHonotrap_Draw(Actor* thisx, PlayState* play); void EnHonotrap_SetupEyeIdle(EnHonotrap* this); -void EnHonotrap_EyeIdle(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeIdle(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupEyeOpen(EnHonotrap* this); -void EnHonotrap_EyeOpen(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeOpen(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupEyeAttack(EnHonotrap* this); -void EnHonotrap_EyeAttack(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeAttack(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupEyeClose(EnHonotrap* this); -void EnHonotrap_EyeClose(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeClose(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlame(EnHonotrap* this); -void EnHonotrap_Flame(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_Flame(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameDrop(EnHonotrap* this); -void EnHonotrap_FlameDrop(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameMove(EnHonotrap* this); -void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameMove(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameChase(EnHonotrap* this); -void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameChase(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameVanish(EnHonotrap* this); -void EnHonotrap_FlameVanish(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameVanish(EnHonotrap* this, PlayState* play); const ActorInit En_Honotrap_InitVars = { ACTOR_EN_HONOTRAP, @@ -126,13 +126,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void EnHonotrap_FlameCollisionCheck(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameCollisionCheck(EnHonotrap* this, PlayState* play) { s32 pad[3]; Collider_UpdateCylinder(&this->actor, &this->collider.cyl); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.cyl.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.cyl.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.cyl.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.cyl.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.cyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.cyl.base); this->colChkFlags |= HONOTRAP_AT_ACTIVE; this->colChkFlags |= HONOTRAP_AC_ACTIVE; this->colChkFlags |= HONOTRAP_OC_ACTIVE; @@ -153,7 +153,7 @@ void EnHonotrap_GetNormal(Vec3f* normal, Vec3f* vec) { } } -void EnHonotrap_InitEye(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_InitEye(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; s32 i; @@ -166,8 +166,8 @@ void EnHonotrap_InitEye(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(thisx, 0.1f); sin = Math_SinS(thisx->home.rot.y); cos = Math_CosS(thisx->home.rot.y); - Collider_InitTris(globalCtx, &this->collider.tris); - Collider_SetTris(globalCtx, &this->collider.tris, thisx, &sTrisInit, this->collider.elements); + Collider_InitTris(play, &this->collider.tris); + Collider_SetTris(play, &this->collider.tris, thisx, &sTrisInit, this->collider.elements); for (i = 0; i < 2; i++) { for (j = 0, vtx = triangle; j < 3; j++, vtx++) { @@ -184,19 +184,19 @@ void EnHonotrap_InitEye(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(thisx, 0.0f); } -void EnHonotrap_InitFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_InitFlame(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; Actor_SetScale(&this->actor, 0.0001f); - Collider_InitCylinder(globalCtx, &this->collider.cyl); - Collider_SetCylinder(globalCtx, &this->collider.cyl, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider.cyl); + Collider_SetCylinder(play, &this->collider.cyl, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider.cyl); this->actor.minVelocityY = -1.0f; CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.shape.shadowAlpha = 128; - this->targetPos = GET_PLAYER(globalCtx)->actor.world.pos; + this->targetPos = GET_PLAYER(play)->actor.world.pos; this->targetPos.y += 10.0f; this->flameScroll = Rand_ZeroOne() * 511.0f; EnHonotrap_SetupFlame(this); @@ -209,23 +209,23 @@ void EnHonotrap_InitFlame(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHonotrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); if (thisx->params == HONOTRAP_EYE) { - EnHonotrap_InitEye(thisx, globalCtx); + EnHonotrap_InitEye(thisx, play); } else { - EnHonotrap_InitFlame(thisx, globalCtx); + EnHonotrap_InitFlame(thisx, play); } } -void EnHonotrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; if (this->actor.params == HONOTRAP_EYE) { - Collider_DestroyTris(globalCtx, &this->collider.tris); + Collider_DestroyTris(play, &this->collider.tris); } else { - Collider_DestroyCylinder(globalCtx, &this->collider.cyl); + Collider_DestroyCylinder(play, &this->collider.cyl); } } @@ -234,7 +234,7 @@ void EnHonotrap_SetupEyeIdle(EnHonotrap* this) { this->eyeState = HONOTRAP_EYE_SHUT; } -void EnHonotrap_EyeIdle(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeIdle(EnHonotrap* this, PlayState* play) { if (this->actor.child != NULL) { this->timer = 200; } else if ((this->timer <= 0) && (this->actor.xzDistToPlayer < 750.0f) && (0.0f > this->actor.yDistToPlayer) && @@ -252,7 +252,7 @@ void EnHonotrap_SetupEyeOpen(EnHonotrap* this) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_RED_EYE); } -void EnHonotrap_EyeOpen(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeOpen(EnHonotrap* this, PlayState* play) { f32 cos; f32 sin; @@ -261,7 +261,7 @@ void EnHonotrap_EyeOpen(EnHonotrap* this, GlobalContext* globalCtx) { EnHonotrap_SetupEyeAttack(this); sin = Math_SinS(this->actor.shape.rot.y); cos = Math_CosS(this->actor.shape.rot.y); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_HONOTRAP, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, (sin * 12.0f) + this->actor.home.pos.x, this->actor.home.pos.y - 10.0f, (cos * 12.0f) + this->actor.home.pos.z, this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_FLAME_MOVE); @@ -273,7 +273,7 @@ void EnHonotrap_SetupEyeAttack(EnHonotrap* this) { this->eyeState = HONOTRAP_EYE_OPEN; } -void EnHonotrap_EyeAttack(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeAttack(EnHonotrap* this, PlayState* play) { if (this->timer <= 0) { EnHonotrap_SetupEyeClose(this); } @@ -283,7 +283,7 @@ void EnHonotrap_SetupEyeClose(EnHonotrap* this) { this->actionFunc = EnHonotrap_EyeClose; } -void EnHonotrap_EyeClose(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeClose(EnHonotrap* this, PlayState* play) { this->eyeState++; if (this->eyeState >= HONOTRAP_EYE_SHUT) { EnHonotrap_SetupEyeIdle(this); @@ -295,7 +295,7 @@ void EnHonotrap_SetupFlame(EnHonotrap* this) { this->actionFunc = EnHonotrap_Flame; } -void EnHonotrap_Flame(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_Flame(EnHonotrap* this, PlayState* play) { s32 pad; s32 ready = Math_StepToF(&this->actor.scale.x, (this->actor.params == HONOTRAP_FLAME_MOVE) ? 0.004f : 0.0048f, 0.0006f); @@ -318,10 +318,10 @@ void EnHonotrap_SetupFlameDrop(EnHonotrap* this) { this->actionFunc = EnHonotrap_FlameDrop; } -void EnHonotrap_FlameDrop(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play) { if ((this->collider.cyl.base.atFlags & AT_HIT) || (this->timer <= 0)) { if ((this->collider.cyl.base.atFlags & AT_HIT) && !(this->collider.cyl.base.atFlags & AT_BOUNCED)) { - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; EnHonotrap_SetupFlameVanish(this); @@ -329,14 +329,14 @@ void EnHonotrap_FlameDrop(EnHonotrap* this, GlobalContext* globalCtx) { if (this->actor.velocity.y > 0.0f) { this->actor.world.pos.x += this->actor.velocity.x; this->actor.world.pos.z += this->actor.velocity.z; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 12.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 12.0f, 0.0f, 5); } if (!Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 1.0f, this->actor.velocity.y)) { this->actor.velocity.y += 1.0f; } else { this->actor.velocity.y = 0.0f; } - EnHonotrap_FlameCollisionCheck(this, globalCtx); + EnHonotrap_FlameCollisionCheck(this, play); } } @@ -354,7 +354,7 @@ void EnHonotrap_SetupFlameMove(EnHonotrap* this) { this->timer = 160; } -void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameMove(EnHonotrap* this, PlayState* play) { s32 pad; Vec3f speed; s32 ready; @@ -367,10 +367,10 @@ void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { ready &= Math_StepToF(&this->actor.world.pos.x, this->targetPos.x, speed.x); ready &= Math_StepToF(&this->actor.world.pos.y, this->targetPos.y, speed.y); ready &= Math_StepToF(&this->actor.world.pos.z, this->targetPos.z, speed.z); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); if (this->collider.tris.base.atFlags & AT_BOUNCED) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f shieldNorm; Vec3f tempVel; Vec3f shieldVec; @@ -391,7 +391,7 @@ void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { } else if (this->timer <= 0) { EnHonotrap_SetupFlameVanish(this); } else { - EnHonotrap_FlameCollisionCheck(this, globalCtx); + EnHonotrap_FlameCollisionCheck(this, play); if (ready) { EnHonotrap_SetupFlameChase(this); } @@ -407,7 +407,7 @@ void EnHonotrap_SetupFlameChase(EnHonotrap* this) { this->timer = 100; } -void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameChase(EnHonotrap* this, PlayState* play) { s32 pad; Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x300); @@ -419,9 +419,9 @@ void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { } this->actor.velocity.y *= 0.95f; func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); if (this->collider.cyl.base.atFlags & AT_BOUNCED) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3s shieldRot; Matrix_MtxFToYXZRotS(&player->shieldMf, &shieldRot, false); @@ -434,7 +434,7 @@ void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { } else if ((this->actor.bgCheckFlags & 8) || (this->timer <= 0)) { EnHonotrap_SetupFlameVanish(this); } else { - EnHonotrap_FlameCollisionCheck(this, globalCtx); + EnHonotrap_FlameCollisionCheck(this, play); } } @@ -442,19 +442,19 @@ void EnHonotrap_SetupFlameVanish(EnHonotrap* this) { this->actionFunc = EnHonotrap_FlameVanish; } -void EnHonotrap_FlameVanish(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameVanish(EnHonotrap* this, PlayState* play) { s32 pad; s32 ready = Math_StepToF(&this->actor.scale.x, 0.0001f, 0.00015f); this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); if (ready) { Actor_Kill(&this->actor); } } -void EnHonotrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Update(Actor* thisx, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.1f, 0.0f }; s32 pad; @@ -474,19 +474,19 @@ void EnHonotrap_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 5.0f); Audio_PlayActorSound2(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params == HONOTRAP_EYE) { if (this->collider.tris.base.acFlags & AC_HIT) { - EffectSsBomb2_SpawnLayered(globalCtx, &this->actor.world.pos, &velocity, &accel, 15, 8); + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, 15, 8); Actor_Kill(&this->actor); } else if (this->eyeState < HONOTRAP_EYE_SHUT) { this->collider.tris.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.tris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); } } } -void EnHonotrap_DrawEye(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_DrawEye(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, @@ -495,48 +495,48 @@ void EnHonotrap_DrawEye(Actor* thisx, GlobalContext* globalCtx) { }; EnHonotrap* this = (EnHonotrap*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeState])); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gEyeSwitch2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnHonotrap_DrawFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); this->flameScroll -= 20; this->flameScroll &= 0x1FF; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, this->flameScroll, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, this->flameScroll, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), 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++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnHonotrap_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Draw(Actor* thisx, PlayState* play) { switch (thisx->params) { case HONOTRAP_EYE: - EnHonotrap_DrawEye(thisx, globalCtx); + EnHonotrap_DrawEye(thisx, play); break; case HONOTRAP_FLAME_MOVE: case HONOTRAP_FLAME_DROP: - EnHonotrap_DrawFlame(thisx, globalCtx); + EnHonotrap_DrawFlame(thisx, play); break; } } diff --git a/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h b/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h index 73e3cdf07..f576377b1 100644 --- a/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/soh/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -6,7 +6,7 @@ struct EnHonotrap; -typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, GlobalContext*); +typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, PlayState*); typedef union { struct { diff --git a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c index c1870752c..24240b422 100644 --- a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -12,15 +12,15 @@ #define FLAGS ACTOR_FLAG_4 -typedef void (*EnHorseCsFunc)(EnHorse*, GlobalContext*, CsCmdActorAction*); -typedef void (*EnHorseActionFunc)(EnHorse*, GlobalContext*); +typedef void (*EnHorseCsFunc)(EnHorse*, PlayState*, CsCmdActorAction*); +typedef void (*EnHorseActionFunc)(EnHorse*, PlayState*); -void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorse_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorse_Init(Actor* thisx, PlayState* play); +void EnHorse_Destroy(Actor* thisx, PlayState* play); +void EnHorse_Update(Actor* thisx, PlayState* play); +void EnHorse_Draw(Actor* thisx, PlayState* play); -void EnHorse_InitCutscene(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_InitCutscene(EnHorse* this, PlayState* play); void EnHorse_InitHorsebackArchery(EnHorse* this); void EnHorse_InitFleePlayer(EnHorse* this); void EnHorse_ResetIdleAnimation(EnHorse* this); @@ -28,26 +28,26 @@ void EnHorse_StartIdleRidable(EnHorse* this); void EnHorse_InitInactive(EnHorse* this); void EnHorse_InitIngoHorse(EnHorse* this); -void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Inactive(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Idle(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_UpdateIngoRace(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedIdle(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedIdleWhinneying(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedTrot(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedGallop(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedRearing(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Stopping(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_HighJump(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_BridgeJump(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_Frozen(EnHorse* this, PlayState* play); +void EnHorse_Inactive(EnHorse* this, PlayState* play); +void EnHorse_Idle(EnHorse* this, PlayState* play); +void EnHorse_FollowPlayer(EnHorse* this, PlayState* play); +void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play); +void EnHorse_MountedIdle(EnHorse* this, PlayState* play); +void EnHorse_MountedIdleWhinneying(EnHorse* this, PlayState* play); +void EnHorse_MountedTurn(EnHorse* this, PlayState* play); +void EnHorse_MountedWalk(EnHorse* this, PlayState* play); +void EnHorse_MountedTrot(EnHorse* this, PlayState* play); +void EnHorse_MountedGallop(EnHorse* this, PlayState* play); +void EnHorse_MountedRearing(EnHorse* this, PlayState* play); +void EnHorse_Stopping(EnHorse* this, PlayState* play); +void EnHorse_Reverse(EnHorse* this, PlayState* play); +void EnHorse_LowJump(EnHorse* this, PlayState* play); +void EnHorse_HighJump(EnHorse* this, PlayState* play); +void EnHorse_BridgeJump(EnHorse* this, PlayState* play); +void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play); +void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play); +void EnHorse_FleePlayer(EnHorse* this, PlayState* play); static AnimationHeader* sEponaAnimHeaders[] = { &gEponaIdleAnim, &gEponaWhinnyAnim, &gEponaRefuseAnim, &gEponaRearingAnim, &gEponaWalkingAnim, @@ -387,11 +387,11 @@ static s32 sIdleAnimIds[] = { 1, 3, 0, 3, 1, 0 }; static s16 sIngoAnimations[] = { 7, 6, 2, 2, 1, 1, 0, 0, 0, 0 }; -void EnHorse_CsMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsJumpInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_WarpMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); static EnHorseCsFunc sCutsceneInitFuncs[] = { NULL, @@ -402,11 +402,11 @@ static EnHorseCsFunc sCutsceneInitFuncs[] = { EnHorse_CsWarpRearingInit, }; -void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); static EnHorseCsFunc sCutsceneActionFuncs[] = { NULL, EnHorse_CsMoveToPoint, EnHorse_CsJump, EnHorse_CsRearing, EnHorse_CsWarpMoveToPoint, EnHorse_CsWarpRearing, @@ -451,12 +451,12 @@ static EnHorseActionFunc sActionFuncs[] = { EnHorse_FleePlayer, }; -s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, PlayState* play) { f32 xMin; f32 xMax; s32 i; - if (globalCtx->sceneNum != SCENE_SPOT09) { + if (play->sceneNum != SCENE_SPOT09) { return false; } if (this->actor.speedXZ < 12.8f) { @@ -487,9 +487,9 @@ s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, GlobalContext* globalCtx) { return false; } -void EnHorse_StartBridgeJump(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartBridgeJump(EnHorse* this, PlayState* play); -s32 EnHorse_CheckBridgeJumps(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_CheckBridgeJumps(EnHorse* this, PlayState* play) { f32 xMin; f32 xMax; s32 i; @@ -514,7 +514,7 @@ s32 EnHorse_CheckBridgeJumps(EnHorse* this, GlobalContext* globalCtx) { if (sBridgeJumps[i].angle - sBridgeJumps[i].angleRange < this->actor.world.rot.y && this->actor.world.rot.y < sBridgeJumps[i].angle + sBridgeJumps[i].angleRange) { this->bridgeJumpIdx = i; - EnHorse_StartBridgeJump(this, globalCtx); + EnHorse_StartBridgeJump(this, play); return true; } } @@ -530,11 +530,11 @@ void EnHorse_RaceWaypointPos(RaceWaypoint* waypoints, s32 idx, Vec3f* pos) { pos->z = waypoints[idx].z; } -void EnHorse_RotateToPoint(EnHorse* this, GlobalContext* globalCtx, Vec3f* pos, s16 turnAmount) { +void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnAmount) { func_8006DD9C(&this->actor, pos, turnAmount); } -void EnHorse_UpdateIngoRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* raceInfo) { +void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f curWaypointPos; Vec3f prevWaypointPos; f32 playerDist; @@ -564,7 +564,7 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInf EnHorse_RaceWaypointPos(raceInfo->waypoints, prevWaypoint, &prevWaypointPos); Math3D_PointDistToLine2D(this->actor.world.pos.x, this->actor.world.pos.z, prevWaypointPos.x, prevWaypointPos.z, curWaypointPos.x, curWaypointPos.z, &dist); - EnHorse_RotateToPoint(this, globalCtx, &curWaypointPos, 400); + EnHorse_RotateToPoint(this, play, &curWaypointPos, 400); if (dist < 90000.0f) { playerDist = this->actor.xzDistToPlayer; @@ -584,8 +584,8 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInf this->actor.shape.rot.y = this->actor.world.rot.y; } - sp50 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); - relPlayerYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + sp50 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); + relPlayerYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (sp50 <= 200.0f || (fabsf(Math_SinS(relPlayerYaw)) < 0.8f && Math_CosS(relPlayerYaw) > 0.0f)) { if (this->actor.speedXZ < this->ingoHorseMaxSpeed) { this->actor.speedXZ += 0.47f; @@ -626,7 +626,7 @@ void EnHorse_PlayGallopingSound(EnHorse* this) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_RUN, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } -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) { @@ -635,24 +635,24 @@ f32 EnHorse_SlopeSpeedMultiplier(EnHorse* this, GlobalContext* globalCtx) { return multiplier; } -void func_80A5BB90(GlobalContext* globalCtx, Vec3f* vec, Vec3f* arg2, f32* arg3) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, vec, arg2, arg3); +void func_80A5BB90(PlayState* play, Vec3f* vec, Vec3f* arg2, f32* arg3) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, vec, arg2, arg3); } -s32 func_80A5BBBC(GlobalContext* globalCtx, EnHorse* this, Vec3f* pos) { +s32 func_80A5BBBC(PlayState* play, EnHorse* this, Vec3f* pos) { Vec3f sp24; f32 sp20; f32 eyeDist; - func_80A5BB90(globalCtx, pos, &sp24, &sp20); + func_80A5BB90(play, pos, &sp24, &sp20); if (fabsf(sp20) < 0.008f) { return false; } - eyeDist = Math3D_Vec3f_DistXYZ(pos, &globalCtx->view.eye); - return func_800314D4(globalCtx, &this->actor, &sp24, sp20) || eyeDist < 100.0f; + eyeDist = Math3D_Vec3f_DistXYZ(pos, &play->view.eye); + return func_800314D4(play, &this->actor, &sp24, sp20) || eyeDist < 100.0f; } -void EnHorse_IdleAnimSounds(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) { if (this->animationIdx == ENHORSE_ANIM_IDLE && ((this->curFrame > 35.0f && this->type == HORSE_EPONA) || (this->curFrame > 28.0f && this->type == HORSE_HNI)) && @@ -668,7 +668,7 @@ void EnHorse_IdleAnimSounds(EnHorse* this, GlobalContext* globalCtx) { } } -s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { f32 minDist = 1e38f; s32 spawn = false; f32 dist; @@ -677,9 +677,9 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { Vec3f spawnPos; for (i = 0; i < 169; i++) { - if (sHorseSpawns[i].scene == globalCtx->sceneNum) { - player = GET_PLAYER(globalCtx); - if (globalCtx->sceneNum != SCENE_SPOT20 || + if (sHorseSpawns[i].scene == play->sceneNum) { + player = GET_PLAYER(play); + if (play->sceneNum != SCENE_SPOT20 || //! Same flag checked twice (Flags_GetEventChkInf(0x18) && ((gSaveContext.eventInf[0] & 0xF) != 6 || Flags_GetEventChkInf(0x18))) || // always load two spawns inside lon lon @@ -691,17 +691,17 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { spawnPos.z = sHorseSpawns[i].pos.z; dist = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &spawnPos); - if (globalCtx->sceneNum) {} - if (!(minDist < dist) && !func_80A5BBBC(globalCtx, this, &spawnPos)) { + if (play->sceneNum) {} + if (!(minDist < dist) && !func_80A5BBBC(play, this, &spawnPos)) { minDist = dist; this->actor.world.pos.x = sHorseSpawns[i].pos.x; this->actor.world.pos.y = sHorseSpawns[i].pos.y; this->actor.world.pos.z = sHorseSpawns[i].pos.z; this->actor.prevPos = this->actor.world.pos; this->actor.world.rot.y = sHorseSpawns[i].angle; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); spawn = true; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->actor.world.pos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, &this->actor.projectedW); } } @@ -711,27 +711,27 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { return spawn; } -void EnHorse_ResetCutscene(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_ResetCutscene(EnHorse* this, PlayState* play) { this->cutsceneAction = -1; this->cutsceneFlags = 0; } -void EnHorse_ResetRace(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_ResetRace(EnHorse* this, PlayState* play) { this->inRace = false; } -s32 EnHorse_PlayerCanMove(EnHorse* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & 1) || func_8002DD78(GET_PLAYER(globalCtx)) == 1 || (player->stateFlags1 & 0x100000) || + if ((player->stateFlags1 & 1) || func_8002DD78(GET_PLAYER(play)) == 1 || (player->stateFlags1 & 0x100000) || ((this->stateFlags & ENHORSE_FLAG_19) && !this->inRace) || this->action == ENHORSE_ACT_HBA || - player->actor.flags & ACTOR_FLAG_8 || globalCtx->csCtx.state != 0) { + player->actor.flags & ACTOR_FLAG_8 || play->csCtx.state != 0) { return false; } return true; } -void EnHorse_ResetHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_ResetHorsebackArchery(EnHorse* this, PlayState* play) { this->unk_39C = 0; this->hbaStarted = 0; this->hbaFlags = 0; @@ -741,9 +741,9 @@ void EnHorse_ClearDustFlags(u16* dustFlags) { *dustFlags = 0; } -void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnHorse_Init(Actor* thisx, PlayState* play2) { EnHorse* this = (EnHorse*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; AREG(6) = 0; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -762,16 +762,16 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.params &= ~0x8000; this->type = HORSE_HNI; - if ((this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HNI)) < 0) { + if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HNI)) < 0) { Actor_Kill(&this->actor); return; } do { - } while (!Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)); + } while (!Object_IsLoaded(&play->objectCtx, this->bankIndex)); this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); this->boostSpeed = 12; } else { this->type = HORSE_EPONA; @@ -783,9 +783,9 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.params = 1; } - if (globalCtx->sceneNum == SCENE_SOUKO) { + if (play->sceneNum == SCENE_SOUKO) { this->stateFlags = ENHORSE_UNRIDEABLE; - } else if (globalCtx->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { + } else if (play->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { this->stateFlags = ENHORSE_FLAG_18 | ENHORSE_UNRIDEABLE; } else { if (this->actor.params == 3) { @@ -805,7 +805,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - if (globalCtx->sceneNum == SCENE_SPOT20 && (gSaveContext.eventInf[0] & 0xF) == 6 && + if (play->sceneNum == SCENE_SPOT20 && (gSaveContext.eventInf[0] & 0xF) == 6 && Flags_GetEventChkInf(0x18) == 0 && !DREG(1)) { this->stateFlags |= ENHORSE_FLAG_25; } @@ -815,18 +815,18 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawHorse, 20.0f); this->action = ENHORSE_ACT_IDLE; this->actor.speedXZ = 0.0f; - Collider_InitCylinder(globalCtx, &this->cyl1); - Collider_SetCylinder(globalCtx, &this->cyl1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->cyl2); - Collider_SetCylinder(globalCtx, &this->cyl2, &this->actor, &sCylinderInit2); - Collider_InitJntSph(globalCtx, &this->jntSph); - Collider_SetJntSph(globalCtx, &this->jntSph, &this->actor, &sJntSphInit, &this->jntSphList); + Collider_InitCylinder(play, &this->cyl1); + Collider_SetCylinder(play, &this->cyl1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->cyl2); + Collider_SetCylinder(play, &this->cyl2, &this->actor, &sCylinderInit2); + Collider_InitJntSph(play, &this->jntSph); + Collider_SetJntSph(play, &this->jntSph, &this->actor, &sJntSphInit, &this->jntSphList); CollisionCheck_SetInfo(&this->actor.colChkInfo, DamageTable_Get(0xB), &D_80A65F38); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; this->playerControlled = false; - if ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex < 4)) { + if ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex < 4)) { if (this->type == HORSE_HNI) { if (this->actor.world.rot.z == 0 || !IS_DAY) { Actor_Kill(&this->actor); @@ -844,7 +844,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); return; } - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + } else if (play->sceneNum == SCENE_MALON_STABLE) { if (IS_DAY || Flags_GetEventChkInf(0x18) || DREG(1) != 0 || !LINK_IS_ADULT) { Actor_Kill(&this->actor); return; @@ -852,21 +852,21 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->stateFlags |= ENHORSE_UNRIDEABLE; } - Skin_Init(globalCtx, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][ENHORSE_ANIM_IDLE]); + Skin_Init(play, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][ENHORSE_ANIM_IDLE]); this->animationIdx = ENHORSE_ANIM_IDLE; Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); this->numBoosts = 6; this->blinkTimer = this->postDrawFunc = this->boostRegenTime = 0; - EnHorse_ResetCutscene(this, globalCtx); - EnHorse_ResetRace(this, globalCtx); - EnHorse_ResetHorsebackArchery(this, globalCtx); + EnHorse_ResetCutscene(this, play); + EnHorse_ResetRace(this, play); + EnHorse_ResetHorsebackArchery(this, play); if (this->actor.params == 2) { EnHorse_InitInactive(this); } else if (this->actor.params == 3) { EnHorse_InitIngoHorse(this); this->rider = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, 1, 1); if (this->rider == NULL) { //__assert("this->race.rider != NULL"); @@ -878,16 +878,16 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->ingoHorseMaxSpeed = 12.625f; } } else if (this->actor.params == 7) { - EnHorse_InitCutscene(this, globalCtx); + EnHorse_InitCutscene(this, play); } else if (this->actor.params == 8) { EnHorse_InitHorsebackArchery(this); - Interface_InitHorsebackArchery(globalCtx); - } else if (globalCtx->sceneNum == SCENE_SPOT20 && !Flags_GetEventChkInf(0x18) && !DREG(1)) { + Interface_InitHorsebackArchery(play); + } else if (play->sceneNum == SCENE_SPOT20 && !Flags_GetEventChkInf(0x18) && !DREG(1)) { EnHorse_InitFleePlayer(this); } else { - if (globalCtx->sceneNum == SCENE_SOUKO) { + if (play->sceneNum == SCENE_SOUKO) { EnHorse_ResetIdleAnimation(this); - } else if (globalCtx->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { + } else if (play->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { EnHorse_ResetIdleAnimation(this); } else { EnHorse_StartIdleRidable(this); @@ -896,20 +896,20 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0; } -void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorse_Destroy(Actor* thisx, PlayState* play) { EnHorse* this = (EnHorse*)thisx; if (this->stateFlags & ENHORSE_DRAW) { Audio_StopSfxByPos(&this->unk_21C); } - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->cyl1); - Collider_DestroyCylinder(globalCtx, &this->cyl2); - Collider_DestroyJntSph(globalCtx, &this->jntSph); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->cyl1); + Collider_DestroyCylinder(play, &this->cyl2); + Collider_DestroyJntSph(play, &this->jntSph); } -void EnHorse_RotateToPlayer(EnHorse* this, GlobalContext* globalCtx) { - EnHorse_RotateToPoint(this, globalCtx, &GET_PLAYER(globalCtx)->actor.world.pos, 400); +void EnHorse_RotateToPlayer(EnHorse* this, PlayState* play) { + EnHorse_RotateToPoint(this, play, &GET_PLAYER(play)->actor.world.pos, 400); if (this->stateFlags & ENHORSE_OBSTACLE) { this->actor.world.rot.y += 800.0f; } @@ -936,7 +936,7 @@ void EnHorse_StartMountedIdleResetAnim(EnHorse* this); void EnHorse_StartMountedIdle(EnHorse* this); void EnHorse_StartGalloping(EnHorse* this); -void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Frozen(EnHorse* this, PlayState* play) { this->actor.speedXZ = 0.0f; this->noInputTimer--; if (this->noInputTimer < 0) { @@ -949,7 +949,7 @@ void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StartMountedIdleResetAnim(this); } else if (this->actor.params == 9) { this->actor.params = 5; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { EnHorse_StartMountedIdle(this); } else { this->actor.speedXZ = 8.0f; @@ -980,7 +980,7 @@ void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle); -void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel, f32 brakeAngle, f32 minStickMag, +void EnHorse_UpdateSpeed(EnHorse* this, PlayState* play, f32 brakeDecel, f32 brakeAngle, f32 minStickMag, f32 decel, f32 baseSpeed, s16 turnSpeed) { s16* stickAnglePtr; // probably fake f32 stickMag; @@ -989,7 +989,7 @@ void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel f32 traction; s16 turn; - if (!EnHorse_PlayerCanMove(this, globalCtx)) { + if (!EnHorse_PlayerCanMove(this, play)) { if (this->actor.speedXZ > 8) { this->actor.speedXZ -= decel; } else if (this->actor.speedXZ < 0) { @@ -1001,7 +1001,7 @@ void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel stickAnglePtr = &stickAngle; - baseSpeed *= EnHorse_SlopeSpeedMultiplier(this, globalCtx); + baseSpeed *= EnHorse_SlopeSpeedMultiplier(this, play); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (Math_CosS(stickAngle) <= brakeAngle) { this->actor.speedXZ -= brakeDecel; @@ -1023,14 +1023,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 - 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; } @@ -1094,13 +1094,13 @@ void EnHorse_StartWalkingInterruptable(EnHorse* this); void EnHorse_MountedIdleWhinney(EnHorse* this); void EnHorse_StartWalking(EnHorse* this); -void EnHorse_MountedIdle(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedIdle(EnHorse* this, PlayState* play) { f32 mag; s16 angle = 0; this->actor.speedXZ = 0; EnHorse_StickDirection(&this->curStick, &mag, &angle); - if (mag > 10.0f && EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (mag > 10.0f && EnHorse_PlayerCanMove(this, play) == true) { if (Math_CosS(angle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); } else if (Math_CosS(angle) <= 0.7071) { // cos(45 degrees) @@ -1133,13 +1133,13 @@ void EnHorse_MountedIdleWhinney(EnHorse* this) { } } -void EnHorse_MountedIdleWhinneying(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedIdleWhinneying(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle = 0; this->actor.speedXZ = 0; EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); - if (stickMag > 10.0f && EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (stickMag > 10.0f && EnHorse_PlayerCanMove(this, play) == true) { if (Math_CosS(stickAngle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); } else if (Math_CosS(stickAngle) <= 0.7071) { // cos(45 degrees) @@ -1161,7 +1161,7 @@ void EnHorse_StartTurning(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedTurn(EnHorse* this, PlayState* play) { f32 stickMag; s16 clampedYaw; s16 stickAngle; @@ -1170,7 +1170,7 @@ void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx) { EnHorse_PlayWalkingSound(this); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (stickMag > 10.0f) { - if (!EnHorse_PlayerCanMove(this, globalCtx)) { + if (!EnHorse_PlayerCanMove(this, play)) { EnHorse_StartMountedIdleResetAnim(this); } else if (Math_CosS(stickAngle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); @@ -1228,7 +1228,7 @@ void EnHorse_MountedWalkingReset(EnHorse* this) { void EnHorse_StartTrotting(EnHorse* this); -void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; @@ -1236,7 +1236,7 @@ void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (this->noInputTimerMax == 0.0f || (this->noInputTimer > 0.0f && this->noInputTimer < this->noInputTimerMax - 20.0f)) { - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 3.0f, 400); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 3.0f, 400); } else { this->actor.speedXZ = 3.0f; } @@ -1299,11 +1299,11 @@ void EnHorse_MountedTrotReset(EnHorse* this) { void EnHorse_StartGallopingInterruptable(EnHorse* this); -void EnHorse_MountedTrot(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 6.0f, 400); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 6.0f, 400); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (this->actor.speedXZ < 3.0f) { EnHorse_StartWalkingInterruptable(this); @@ -1346,7 +1346,7 @@ void EnHorse_MountedGallopReset(EnHorse* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); } -void EnHorse_JumpLanding(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_JumpLanding(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; @@ -1359,16 +1359,16 @@ void EnHorse_JumpLanding(EnHorse* this, GlobalContext* globalCtx) { this->postDrawFunc = NULL; } -void EnHorse_StartBraking(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartBraking(EnHorse* this, PlayState* play); -void EnHorse_MountedGallop(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedGallop(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (this->noInputTimer <= 0.0f) { - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 0x190); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 0x190); } else if (this->noInputTimer > 0.0f) { this->noInputTimer -= 1; this->actor.speedXZ = 8.0f; @@ -1381,9 +1381,9 @@ void EnHorse_MountedGallop(EnHorse* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skin.skelAnime)) { EnHorse_PlayGallopingSound(this); func_800AA000(0, 120, 8, 255); - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (stickMag >= 10.0f && Math_CosS(stickAngle) <= -0.5f) { - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } else if (this->actor.speedXZ < 6.0f) { EnHorse_StartTrotting(this); } else { @@ -1408,7 +1408,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; @@ -1424,7 +1424,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; @@ -1446,7 +1446,7 @@ void EnHorse_MountedRearing(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_StartBraking(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartBraking(EnHorse* this, PlayState* play) { this->action = ENHORSE_ACT_STOPPING; this->animationIdx = ENHORSE_ANIM_STOPPING; @@ -1458,7 +1458,7 @@ void EnHorse_StartBraking(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_BOOST; } -void EnHorse_Stopping(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Stopping(EnHorse* this, PlayState* play) { if (this->actor.speedXZ > 0.0f) { this->actor.speedXZ = this->actor.speedXZ - 0.6f; if (this->actor.speedXZ < 0.0f) { @@ -1512,15 +1512,15 @@ void EnHorse_StartReversing(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_LOOP, -3.0f); } -void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Reverse(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; s16 turnAmount; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnHorse_PlayWalkingSound(this); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (this->noInputTimerMax == 0.0f || (this->noInputTimer > 0.0f && this->noInputTimer < this->noInputTimerMax - 20.0f)) { if (stickMag < 10.0f && this->noInputTimer <= 0.0f) { @@ -1561,7 +1561,7 @@ void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { } this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.5f * 1.5f; if (SkelAnime_Update(&this->skin.skelAnime) && (f32)this->noInputTimer <= 0.0f && - EnHorse_PlayerCanMove(this, globalCtx) == true) { + EnHorse_PlayerCanMove(this, play) == true) { if (stickMag > 10.0f && Math_CosS(stickAngle) <= -0.5f) { this->noInputTimerMax = 0; EnHorse_StartReversingInterruptable(this); @@ -1574,14 +1574,14 @@ void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_StartLowJump(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartLowJump(EnHorse* this, PlayState* play); -void EnHorse_LowJumpInit(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_LowJumpInit(EnHorse* this, PlayState* play) { this->skin.skelAnime.curFrame = 0.0f; - EnHorse_StartLowJump(this, globalCtx); + EnHorse_StartLowJump(this, play); } -void EnHorse_StartLowJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartLowJump(EnHorse* this, PlayState* play) { f32 curFrame; Vec3s* jointTable; f32 y; @@ -1609,7 +1609,7 @@ void EnHorse_StartLowJump(EnHorse* this, GlobalContext* globalCtx) { void EnHorse_Stub1(EnHorse* this) { } -void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_LowJump(EnHorse* this, PlayState* play) { Vec3f pad; Vec3s* jointTable; f32 curFrame; @@ -1642,19 +1642,19 @@ void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); - EnHorse_JumpLanding(this, globalCtx); + func_80028A54(play, 25.0f, &this->actor.world.pos); + EnHorse_JumpLanding(this, play); } } -void EnHorse_StartHighJump(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartHighJump(EnHorse* this, PlayState* play); -void EnHorse_HighJumpInit(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_HighJumpInit(EnHorse* this, PlayState* play) { this->skin.skelAnime.curFrame = 0.0f; - EnHorse_StartHighJump(this, globalCtx); + EnHorse_StartHighJump(this, play); } -void EnHorse_StartHighJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartHighJump(EnHorse* this, PlayState* play) { f32 curFrame; Vec3s* jointTable; f32 y; @@ -1683,7 +1683,7 @@ void EnHorse_StartHighJump(EnHorse* this, GlobalContext* globalCtx) { void EnHorse_Stub2(EnHorse* this) { } -void EnHorse_HighJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_HighJump(EnHorse* this, PlayState* play) { Vec3f pad; Vec3s* jointTable; f32 curFrame; @@ -1717,8 +1717,8 @@ void EnHorse_HighJump(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); - EnHorse_JumpLanding(this, globalCtx); + func_80028A54(play, 25.0f, &this->actor.world.pos); + EnHorse_JumpLanding(this, play); } } @@ -1732,28 +1732,28 @@ void EnHorse_InitInactive(EnHorse* this) { this->followTimer = 0; } -void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play); -void EnHorse_Inactive(EnHorse* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHorse_Inactive(EnHorse* this, PlayState* play2) { + PlayState* play = play2; if (DREG(53) != 0 && this->type == HORSE_EPONA) { DREG(53) = 0; - if (EnHorse_Spawn(this, globalCtx) != 0) { + if (EnHorse_Spawn(this, play) != 0) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); this->stateFlags &= ~ENHORSE_INACTIVE; - gSaveContext.horseData.scene = globalCtx->sceneNum; + gSaveContext.horseData.scene = play->sceneNum; // Focus the camera on Epona - Camera_SetParam(globalCtx->cameraPtrs[0], 8, this); - Camera_ChangeSetting(globalCtx->cameraPtrs[0], 0x38); - Camera_SetCameraData(globalCtx->cameraPtrs[0], 4, NULL, NULL, 0x51, 0, 0); + Camera_SetParam(play->cameraPtrs[0], 8, this); + Camera_ChangeSetting(play->cameraPtrs[0], 0x38); + Camera_SetCameraData(play->cameraPtrs[0], 4, NULL, NULL, 0x51, 0, 0); } } if (!(this->stateFlags & ENHORSE_INACTIVE)) { this->followTimer = 0; - EnHorse_SetFollowAnimation(this, globalCtx); + EnHorse_SetFollowAnimation(this, play); this->actor.params = 0; this->cyl1.base.ocFlags1 |= OC1_ON; this->cyl2.base.ocFlags1 |= OC1_ON; @@ -1806,21 +1806,21 @@ void EnHorse_StartIdleRidable(EnHorse* this) { void EnHorse_StartMovingAnimation(EnHorse* this, s32 arg1, f32 arg2, f32 arg3); -void EnHorse_Idle(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Idle(EnHorse* this, PlayState* play) { this->actor.speedXZ = 0.0f; - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); if (DREG(53) && this->type == HORSE_EPONA) { DREG(53) = 0; - if (!func_80A5BBBC(globalCtx, this, &this->actor.world.pos)) { - if (EnHorse_Spawn(this, globalCtx)) { + if (!func_80A5BBBC(play, this, &this->actor.world.pos)) { + if (EnHorse_Spawn(this, play)) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); this->followTimer = 0; - EnHorse_SetFollowAnimation(this, globalCtx); - Camera_SetParam(globalCtx->cameraPtrs[0], 8, this); - Camera_ChangeSetting(globalCtx->cameraPtrs[0], 0x38); - Camera_SetCameraData(globalCtx->cameraPtrs[0], 4, NULL, NULL, 0x51, 0, 0); + EnHorse_SetFollowAnimation(this, play); + Camera_SetParam(play->cameraPtrs[0], 8, this); + Camera_ChangeSetting(play->cameraPtrs[0], 0x38); + Camera_SetCameraData(play->cameraPtrs[0], 4, NULL, NULL, 0x51, 0, 0); } } else { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, @@ -1864,11 +1864,11 @@ void EnHorse_StartMovingAnimation(EnHorse* this, s32 animId, f32 morphFrames, f3 } } -void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { s32 animId = ENHORSE_ANIM_WALK; f32 distToPlayer; - distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (distToPlayer > 400.0f) { animId = ENHORSE_ANIM_GALLOP; } else if (!(distToPlayer <= 300.0f)) { @@ -1901,19 +1901,19 @@ void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StartMovingAnimation(this, animId, -3.0f, 0.0f); } -void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { f32 distToPlayer; f32 angleDiff; DREG(53) = 0; - distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); // First rotate if the player is behind if ((this->playerDir == PLAYER_DIR_BACK_R || this->playerDir == PLAYER_DIR_BACK_L) && (distToPlayer > 300.0f && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER))) { this->animationIdx = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; - this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); angleDiff = (f32)this->angleToPlayer - (f32)this->actor.world.rot.y; if (angleDiff > 32767.f) { angleDiff -= 32767.0f; @@ -1938,7 +1938,7 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { } } } else { - EnHorse_RotateToPlayer(this, globalCtx); + EnHorse_RotateToPlayer(this, play); } if (this->animationIdx == ENHORSE_ANIM_GALLOP) { @@ -1975,7 +1975,7 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { if (distToPlayer < 100.0f) { EnHorse_StartIdleRidable(this); } else { - EnHorse_SetFollowAnimation(this, globalCtx); + EnHorse_SetFollowAnimation(this, play); } } } @@ -2061,16 +2061,16 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { } } -void EnHorse_UpdateIngoRace(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play) { f32 playSpeed; if (this->animationIdx == ENHORSE_ANIM_IDLE || this->animationIdx == ENHORSE_ANIM_WHINNEY) { - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); } else if (this->animationIdx == ENHORSE_ANIM_WALK) { EnHorse_PlayWalkingSound(this); } - EnHorse_UpdateIngoRaceInfo(this, globalCtx, &sIngoRace); + EnHorse_UpdateIngoRaceInfo(this, play, &sIngoRace); if (!this->inRace) { this->actor.speedXZ = 0.0f; this->rider->speedXZ = 0.0f; @@ -2104,16 +2104,16 @@ void EnHorse_UpdateIngoRace(EnHorse* this, GlobalContext* globalCtx) { &((EnIn*)this->rider)->animationIdx, &((EnIn*)this->rider)->unk_1E0); } -void EnHorse_CsMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->animationIdx = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 1; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], this->actor.speedXZ * 0.3f); } -void EnHorse_CsPlayHighJumpAnim(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play); -void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { Vec3f endPos; f32 speed = 8.0f; @@ -2121,7 +2121,7 @@ void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAc endPos.y = action->endPos.y; endPos.z = action->endPos.z; if (Math3D_Vec3f_DistXYZ(&endPos, &this->actor.world.pos) > speed) { - EnHorse_RotateToPoint(this, globalCtx, &endPos, 400); + EnHorse_RotateToPoint(this, play, &endPos, 400); this->actor.speedXZ = speed; this->skin.skelAnime.playSpeed = speed * 0.3f; } else { @@ -2137,12 +2137,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; @@ -2165,17 +2165,17 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, GlobalContext* globalCtx) { func_800AA000(0.0f, 170, 10, 10); } -void EnHorse_CsJumpInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { - EnHorse_CsSetAnimHighJump(this, globalCtx); +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { + EnHorse_CsSetAnimHighJump(this, play); this->cutsceneAction = 2; this->cutsceneFlags &= ~1; } -void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { f32 temp_f2; if (this->cutsceneFlags & 1) { - EnHorse_CsMoveToPoint(this, globalCtx, action); + EnHorse_CsMoveToPoint(this, play, action); return; } temp_f2 = this->skin.skelAnime.curFrame; @@ -2212,7 +2212,7 @@ void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* a this->actor.gravity = -3.5f; this->actor.velocity.y = 0; this->actor.world.pos.y = this->actor.floorHeight; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); + func_80028A54(play, 25.0f, &this->actor.world.pos); this->animationIdx = ENHORSE_ANIM_GALLOP; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], sPlaybackSpeeds[6]); @@ -2223,7 +2223,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; @@ -2236,7 +2236,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)) { @@ -2259,7 +2259,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; @@ -2272,7 +2272,7 @@ void EnHorse_WarpMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAct this->actor.speedXZ * 0.3f); } -void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { Vec3f endPos; f32 speed = 8.0f; @@ -2280,7 +2280,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdAct endPos.y = action->endPos.y; endPos.z = action->endPos.z; if (Math3D_Vec3f_DistXYZ(&endPos, &this->actor.world.pos) > speed) { - EnHorse_RotateToPoint(this, globalCtx, &endPos, 400); + EnHorse_RotateToPoint(this, play, &endPos, 400); this->actor.speedXZ = speed; this->skin.skelAnime.playSpeed = speed * 0.3f; } else { @@ -2296,7 +2296,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; @@ -2315,7 +2315,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)) { @@ -2338,7 +2338,7 @@ void EnHorse_CsWarpRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAc } } -void EnHorse_InitCutscene(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_InitCutscene(EnHorse* this, PlayState* play) { this->playerControlled = false; this->action = ENHORSE_ACT_CS_UPDATE; this->cutsceneAction = 0; @@ -2360,11 +2360,11 @@ s32 EnHorse_GetCutsceneFunctionIndex(s32 csAction) { return 0; } -void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play) { s32 csFunctionIdx; - CsCmdActorAction* linkCsAction = globalCtx->csCtx.linkAction; + CsCmdActorAction* linkCsAction = play->csCtx.linkAction; - if (globalCtx->csCtx.state == 3) { + if (play->csCtx.state == 3) { this->playerControlled = 1; this->actor.params = 10; this->action = ENHORSE_ACT_IDLE; @@ -2384,14 +2384,14 @@ void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) { this->actor.prevPos = this->actor.world.pos; } this->cutsceneAction = csFunctionIdx; - sCutsceneInitFuncs[this->cutsceneAction](this, globalCtx, linkCsAction); + sCutsceneInitFuncs[this->cutsceneAction](this, play, linkCsAction); } - sCutsceneActionFuncs[this->cutsceneAction](this, globalCtx, linkCsAction); + sCutsceneActionFuncs[this->cutsceneAction](this, play, linkCsAction); } } } -s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* raceInfo) { +s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f pos; f32 px; f32 pz; @@ -2414,7 +2414,7 @@ s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* } if (!(this->hbaFlags & 1)) { - EnHorse_RotateToPoint(this, globalCtx, &pos, 800); + EnHorse_RotateToPoint(this, play, &pos, 800); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -2493,29 +2493,29 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { } } -void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { f32 playSpeed; s32 sp20; if (this->animationIdx == ENHORSE_ANIM_WALK) { EnHorse_PlayWalkingSound(this); } - if (globalCtx->interfaceCtx.hbaAmmo == 0) { + if (play->interfaceCtx.hbaAmmo == 0) { this->hbaTimer++; } sp20 = func_800F5A58(NA_BGM_HORSE_GOAL); - EnHorse_UpdateHbaRaceInfo(this, globalCtx, &sHbaInfo); + EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo); if (this->hbaFlags & 1 || this->hbaTimer >= 46) { if (sp20 != 1 && gSaveContext.minigameState != 3) { gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = 0x3B0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 0x20; + play->nextEntranceIndex = 0x3B0; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 0x20; } } - if (globalCtx->interfaceCtx.hbaAmmo != 0) { + if (play->interfaceCtx.hbaAmmo != 0) { if (!(this->hbaFlags & 2)) { if (gSaveContext.infTable[25] & 1) { if ((s32)gSaveContext.minigameScore >= 1500) { @@ -2529,7 +2529,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { } } - if ((globalCtx->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) { + if ((play->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) { if (this->hbaFlags & 4) { this->hbaFlags &= ~4; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL); @@ -2566,8 +2566,8 @@ void EnHorse_InitFleePlayer(EnHorse* this) { this->actor.speedXZ = 0.0f; } -void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 distToHome; f32 playerDistToHome; f32 distToPlayer; @@ -2625,7 +2625,7 @@ void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { EnHorse_PlayWalkingSound(this); } else { // idle nextAnim = Rand_ZeroOne() > 0.5f ? 1 : 0; - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); this->skin.skelAnime.playSpeed = 1.0f; } @@ -2722,10 +2722,10 @@ void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_BridgeJumpInit(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BridgeJumpInit(EnHorse* this, PlayState* play) { f32 y; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); + func_80028A54(play, 25.0f, &this->actor.world.pos); this->action = ENHORSE_ACT_BRIDGE_JUMP; this->stateFlags |= ENHORSE_JUMPING; this->animationIdx = ENHORSE_ANIM_HIGH_JUMP; @@ -2752,18 +2752,18 @@ void EnHorse_BridgeJumpInit(EnHorse* this, GlobalContext* globalCtx) { this->postDrawFunc = NULL; } -void EnHorse_StartBridgeJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartBridgeJump(EnHorse* this, PlayState* play) { this->postDrawFunc = EnHorse_BridgeJumpInit; if (this->bridgeJumpIdx == 0) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFieldFortressCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFieldFortressCs); gSaveContext.cutsceneTrigger = 1; } else { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFortressToFieldCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFortressToFieldCs); gSaveContext.cutsceneTrigger = 1; } } -void EnHorse_BridgeJumpMove(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BridgeJumpMove(EnHorse* this, PlayState* play) { f32 interp; f32 timeSq; @@ -2787,28 +2787,28 @@ void EnHorse_BridgeJumpMove(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_CheckBridgeJumpLanding(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CheckBridgeJumpLanding(EnHorse* this, PlayState* play) { this->actor.speedXZ = 8.0f; this->skin.skelAnime.playSpeed = 1.5f; if (SkelAnime_Update(&this->skin.skelAnime)) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = sBridgeJumps[this->bridgeJumpIdx].pos.y; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); - EnHorse_JumpLanding(this, globalCtx); + func_80028A54(play, 25.0f, &this->actor.world.pos); + EnHorse_JumpLanding(this, play); Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); func_800AA000(0.0f, 255, 10, 80); } } -void EnHorse_BridgeJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BridgeJump(EnHorse* this, PlayState* play) { this->bridgeJumpTimer++; if (this->bridgeJumpTimer < 30) { - EnHorse_BridgeJumpMove(this, globalCtx); + EnHorse_BridgeJumpMove(this, play); return; } - EnHorse_CheckBridgeJumpLanding(this, globalCtx); + EnHorse_CheckBridgeJumpLanding(this, play); } void EnHorse_Vec3fOffset(Vec3f* src, s16 yaw, f32 dist, f32 height, Vec3f* dst) { @@ -2817,27 +2817,27 @@ void EnHorse_Vec3fOffset(Vec3f* src, s16 yaw, f32 dist, f32 height, Vec3f* dst) dst->z = src->z + Math_CosS(yaw) * dist; } -s32 EnHorse_CalcFloorHeight(EnHorse* this, GlobalContext* globalCtx, Vec3f* pos, CollisionPoly** floorPoly, +s32 EnHorse_CalcFloorHeight(EnHorse* this, PlayState* play, Vec3f* pos, CollisionPoly** floorPoly, f32* floorHeight) { s32 bgId; f32 waterY; WaterBox* waterBox; *floorPoly = NULL; - *floorHeight = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, floorPoly, &bgId, pos); + *floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, floorPoly, &bgId, pos); if (*floorHeight == BGCHECK_Y_MIN) { return 1; // No floor } - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, pos->x, pos->z, &waterY, &waterBox) == 1 && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, pos->x, pos->z, &waterY, &waterBox) == 1 && *floorHeight < waterY) { return 2; // Water } if ((*floorPoly)->normal.y * COLPOLY_NORMAL_FRAC < 0.81915206f || // cos(35 degrees) - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, *floorPoly, bgId) || - func_80041D4C(&globalCtx->colCtx, *floorPoly, bgId) == 7) { + SurfaceType_IsHorseBlocked(&play->colCtx, *floorPoly, bgId) || + func_80041D4C(&play->colCtx, *floorPoly, bgId) == 7) { return 3; // Horse blocked surface } return 0; @@ -2851,8 +2851,8 @@ s32 EnHorse_CalcFloorHeight(EnHorse* this, GlobalContext* globalCtx, Vec3f* pos, * 4: Obstructed in front * 5: Obstructed behind */ -void EnHorse_ObstructMovement(EnHorse* this, GlobalContext* globalCtx, s32 obstacleType, s32 galloping) { - if (this->action == ENHORSE_ACT_CS_UPDATE || EnHorse_BgCheckBridgeJumpPoint(this, globalCtx)) { +void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, s32 galloping) { + if (this->action == ENHORSE_ACT_CS_UPDATE || EnHorse_BgCheckBridgeJumpPoint(this, play)) { return; } @@ -2882,7 +2882,7 @@ void EnHorse_ObstructMovement(EnHorse* this, GlobalContext* globalCtx, s32 obsta } } -void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { s32 status; CollisionPoly* frontFloor; CollisionPoly* backFloor; @@ -2899,42 +2899,42 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { WaterBox* waterBox; s32 pad; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterHeight, &waterBox) == 1 && this->actor.floorHeight < waterHeight) { - EnHorse_ObstructMovement(this, globalCtx, 1, galloping); + EnHorse_ObstructMovement(this, play, 1, galloping); return; } EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, 30.0f, 60.0f, &frontPos); - status = EnHorse_CalcFloorHeight(this, globalCtx, &frontPos, &frontFloor, &this->yFront); + status = EnHorse_CalcFloorHeight(this, play, &frontPos, &frontFloor, &this->yFront); if (status == 1) { this->actor.shape.rot.x = 0; - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } if (status == 2) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } if (status == 3) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, -30.0f, 60.0f, &backPos); - status = EnHorse_CalcFloorHeight(this, globalCtx, &backPos, &backFloor, &this->yBack); + status = EnHorse_CalcFloorHeight(this, play, &backPos, &backFloor, &this->yBack); if (status == 1) { this->actor.shape.rot.x = 0; - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } if (status == 2) { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } if (status == 3) { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } @@ -2949,7 +2949,7 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { if ((frontFloor != this->actor.floorPoly) && (this->actor.speedXZ >= 0.0f)) { if ((!(this->stateFlags & ENHORSE_JUMPING) && dist < -40.0f) || (this->stateFlags & ENHORSE_JUMPING && dist < -200.0f)) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } } @@ -2960,17 +2960,17 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { if (((backFloor != this->actor.floorPoly) && (this->actor.speedXZ <= 0.0f) && !(this->stateFlags & ENHORSE_JUMPING) && (dist < -40.0f)) || (this->stateFlags & ENHORSE_JUMPING && dist < -200.0f)) { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } if (ny < 0.81915206f || // cos(35 degrees) - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) || - func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7) { + SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) || + func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7) { if ((this->actor.speedXZ >= 0.0f)) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); } else { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); } return; } @@ -2995,24 +2995,24 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { } } -s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx); +s32 EnHorse_GetMountSide(EnHorse* this, PlayState* play); -void EnHorse_MountDismount(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountDismount(EnHorse* this, PlayState* play) { s32 pad[2]; s32 mountSide; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - mountSide = EnHorse_GetMountSide(this, globalCtx); + mountSide = EnHorse_GetMountSide(this, play); if (mountSide != 0 && !(this->stateFlags & ENHORSE_UNRIDEABLE) && player->rideActor == NULL) { - Actor_SetRideActor(globalCtx, &this->actor, mountSide); + Actor_SetRideActor(play, &this->actor, mountSide); } - if (this->playerControlled == false && Actor_IsMounted(globalCtx, &this->actor) == true) { + if (this->playerControlled == false && Actor_IsMounted(play, &this->actor) == true) { this->noInputTimer = 55; this->noInputTimerMax = 55; this->playerControlled = 1; EnHorse_Freeze(this); - } else if (this->playerControlled == true && Actor_NotMounted(globalCtx, &this->actor) == true) { + } else if (this->playerControlled == true && Actor_NotMounted(play, &this->actor) == true) { this->noInputTimer = 35; this->noInputTimerMax = 35; this->stateFlags &= ~ENHORSE_UNRIDEABLE; @@ -3040,13 +3040,13 @@ void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle) { *angle = Math_FAtan2F(-curStick->x, curStick->y) * (32768.0f / M_PI); } -void EnHorse_UpdateStick(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateStick(EnHorse* this, PlayState* play) { this->lastStick = this->curStick; - this->curStick.x = globalCtx->state.input[0].rel.stick_x; - this->curStick.y = globalCtx->state.input[0].rel.stick_y; + this->curStick.x = play->state.input[0].rel.stick_x; + this->curStick.y = play->state.input[0].rel.stick_y; } -void EnHorse_ResolveCollision(EnHorse* this, GlobalContext* globalCtx, CollisionPoly* colPoly) { +void EnHorse_ResolveCollision(EnHorse* this, PlayState* play, CollisionPoly* colPoly) { f32 dist; f32 nx; f32 ny; @@ -3067,7 +3067,7 @@ void EnHorse_ResolveCollision(EnHorse* this, GlobalContext* globalCtx, Collision } } -void EnHorse_BgCheckSlowMoving(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BgCheckSlowMoving(EnHorse* this, PlayState* play) { f32 yOffset; Vec3f start; Vec3f end; @@ -3075,7 +3075,7 @@ void EnHorse_BgCheckSlowMoving(EnHorse* this, GlobalContext* globalCtx) { CollisionPoly* colPoly; s32 bgId; - if (globalCtx->sceneNum == SCENE_SPOT20) { + if (play->sceneNum == SCENE_SPOT20) { yOffset = 19.0f; } else { yOffset = 40.0f; @@ -3087,16 +3087,16 @@ void EnHorse_BgCheckSlowMoving(EnHorse* this, GlobalContext* globalCtx) { end.x += 30.0f * Math_SinS(this->actor.world.rot.y); end.y += 30.0f * Math_SinS(-this->actor.shape.rot.x); end.z += 30.0f * Math_CosS(this->actor.world.rot.y); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &start, &end, &intersect, &colPoly, 1, 0, 0, 1, &bgId) != 0) { - EnHorse_ResolveCollision(this, globalCtx, colPoly); + if (BgCheck_EntityLineTest1(&play->colCtx, &start, &end, &intersect, &colPoly, 1, 0, 0, 1, &bgId) != 0) { + EnHorse_ResolveCollision(this, play, colPoly); } } -void EnHorse_HighJumpInit(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_HighJumpInit(EnHorse* this, PlayState* play); void EnHorse_Stub2(EnHorse* this); void EnHorse_Stub1(EnHorse* this); -void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { s32 pad; s32 pad2; Vec3f startPos; @@ -3116,10 +3116,10 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { Vec3f intersect; Vec3f obstacleTop; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, globalCtx->sceneNum == SCENE_SPOT20 ? 19.0f : 40.0f, 35.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, play->sceneNum == SCENE_SPOT20 ? 19.0f : 40.0f, 35.0f, 100.0f, 29); - if (EnHorse_BgCheckBridgeJumpPoint(this, globalCtx)) { + if (EnHorse_BgCheckBridgeJumpPoint(this, play)) { return; } @@ -3154,7 +3154,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { movingFast = 1; } } else { - EnHorse_BgCheckSlowMoving(this, globalCtx); + EnHorse_BgCheckSlowMoving(this, play); return; } @@ -3166,18 +3166,18 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { endPos.z += (intersectDist * Math_CosS(this->actor.world.rot.y)); intersect = endPos; wall = NULL; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &startPos, &endPos, &intersect, &wall, 1, 0, 0, 1, &bgId) == 1) { + if (BgCheck_EntityLineTest1(&play->colCtx, &startPos, &endPos, &intersect, &wall, 1, 0, 0, 1, &bgId) == 1) { intersectDist = sqrt(Math3D_Vec3fDistSq(&startPos, &intersect)); this->stateFlags |= ENHORSE_OBSTACLE; } if (wall != NULL) { if (intersectDist < 30.0f) { - EnHorse_ResolveCollision(this, globalCtx, wall); + EnHorse_ResolveCollision(this, play, wall); } if ((Math_CosS(this->actor.world.rot.y - (s16)(Math_FAtan2F(wall->normal.x, wall->normal.z) * (0x8000 / M_PI)) - 0x7FFF) < 0.5f) || - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, wall, bgId) != 0) { + SurfaceType_IsHorseBlocked(&play->colCtx, wall, bgId) != 0) { return; } @@ -3187,18 +3187,18 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags |= ENHORSE_FORCE_REVERSING; } else if (movingFast == true) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } return; } - dynaPoly = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPoly = DynaPoly_GetActor(&play->colCtx, bgId); if ((this->stateFlags & ENHORSE_FLAG_26) && ((dynaPoly && dynaPoly->actor.id != 0x108) || dynaPoly == 0)) { if (movingFast == false) { this->stateFlags |= ENHORSE_FORCE_REVERSING; } else if (movingFast == true) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } return; } @@ -3211,7 +3211,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { obstaclePos.y = this->actor.world.pos.y + 120.0f; obstaclePos.z += intersectDist * Math_CosS(this->actor.world.rot.y); obstacleTop = obstaclePos; - obstacleTop.y = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &obstacleFloor, &bgId, &obstaclePos); + obstacleTop.y = BgCheck_EntityRaycastFloor3(&play->colCtx, &obstacleFloor, &bgId, &obstaclePos); if (obstacleTop.y == BGCHECK_Y_MIN) { return; } @@ -3229,7 +3229,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { obstacleFloor->normal.z * COLPOLY_NORMAL_FRAC, obstacleFloor->dist, &this->actor.world.pos) > 40.0f) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } this->stateFlags |= ENHORSE_OBSTACLE; return; @@ -3237,11 +3237,11 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC; if (ny < 0.81915206f || // cos(35 degrees) - (SurfaceType_IsHorseBlocked(&globalCtx->colCtx, obstacleFloor, bgId) != 0) || - (func_80041D4C(&globalCtx->colCtx, obstacleFloor, bgId) == 7)) { + (SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) != 0) || + (func_80041D4C(&play->colCtx, obstacleFloor, bgId) == 7)) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } return; } @@ -3261,7 +3261,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; } @@ -3274,16 +3274,16 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC; if (ny < 0.81915206f || // cos(35 degrees) - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, obstacleFloor, bgId) || - func_80041D4C(&globalCtx->colCtx, obstacleFloor, bgId) == 7) { + SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || + func_80041D4C(&play->colCtx, obstacleFloor, bgId) == 7) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } } else if (behindObstacleHeight < -DREG(4)) { // -70 if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } } else if (movingFast == false && obstacleHeight > 19.0f && obstacleHeight <= 40.0f) { EnHorse_Stub1(this); @@ -3297,14 +3297,14 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_CheckBoost(EnHorse* thisx, GlobalContext* globalCtx2) { +void EnHorse_CheckBoost(EnHorse* thisx, PlayState* play2) { EnHorse* this = (EnHorse*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 pad; if (this->action == ENHORSE_ACT_MOUNTED_WALK || this->action == ENHORSE_ACT_MOUNTED_TROT || this->action == ENHORSE_ACT_MOUNTED_GALLOP) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) && (globalCtx->interfaceCtx.unk_1EE == 8)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) && (play->interfaceCtx.unk_1EE == 8)) { if (!(this->stateFlags & ENHORSE_BOOST) && !(this->stateFlags & ENHORSE_FLAG_8) && !(this->stateFlags & ENHORSE_FLAG_9)) { if (this->numBoosts > 0) { @@ -3342,7 +3342,7 @@ void EnHorse_CheckBoost(EnHorse* thisx, GlobalContext* globalCtx2) { } } -void EnHorse_RegenBoost(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { if (this->numBoosts < 6 && this->numBoosts > 0) { this->boostRegenTime--; this->boostTimer++; @@ -3378,16 +3378,16 @@ void EnHorse_RegenBoost(EnHorse* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_21C, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } - globalCtx->interfaceCtx.numHorseBoosts = this->numBoosts; + play->interfaceCtx.numHorseBoosts = this->numBoosts; } -void EnHorse_UpdatePlayerDir(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdatePlayerDir(EnHorse* this, PlayState* play) { EnHorse* pad; s16 angle; f32 s; f32 c; - angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; s = Math_SinS(angle); c = Math_CosS(angle); if (s > 0.8660254f) { // sin(60 degrees) @@ -3411,7 +3411,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; @@ -3435,14 +3435,14 @@ void EnHorse_TiltBody(EnHorse* this, GlobalContext* globalCtx) { this->actor.shape.rot.z = this->actor.world.rot.z; } -s32 EnHorse_UpdateConveyors(EnHorse* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnHorse_UpdateConveyors(EnHorse* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 conveyorDir; if ((this->actor.floorPoly == NULL) && (this != (EnHorse*)player->rideActor)) { return 0; } - conveyorDir = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); conveyorDir = (conveyorDir << 10) - this->actor.world.rot.y; if (conveyorDir > 800.0f) { this->actor.world.rot.y += 800.0f; @@ -3460,19 +3460,19 @@ s32 EnHorse_RandInt(f32 range) { return Rand_ZeroOne() * range; } -void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnHorse_Update(Actor* thisx, PlayState* play2) { EnHorse* this = (EnHorse*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Vec3f dustAcc = { 0.0f, 0.0f, 0.0f }; Vec3f dustVel = { 0.0f, 1.0f, 0.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->lastYaw = thisx->shape.rot.y; - EnHorse_UpdateStick(this, globalCtx); - EnHorse_UpdatePlayerDir(this, globalCtx); + EnHorse_UpdateStick(this, play); + EnHorse_UpdatePlayerDir(this, play); if (!(this->stateFlags & ENHORSE_INACTIVE)) { - EnHorse_MountDismount(this, globalCtx); + EnHorse_MountDismount(this, play); } if (this->stateFlags & ENHORSE_FLAG_19) { @@ -3486,17 +3486,17 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); this->stateFlags &= ~ENHORSE_OBSTACLE; this->curFrame = this->skin.skelAnime.curFrame; this->lastPos = thisx->world.pos; if (!(this->stateFlags & ENHORSE_INACTIVE)) { if (this->action == ENHORSE_ACT_MOUNTED_GALLOP || this->action == ENHORSE_ACT_MOUNTED_TROT || this->action == ENHORSE_ACT_MOUNTED_WALK) { - EnHorse_CheckBoost(this, globalCtx); + EnHorse_CheckBoost(this, play); } if (this->playerControlled == true) { - EnHorse_RegenBoost(this, globalCtx); + EnHorse_RegenBoost(this, play); } Actor_MoveForward(thisx); if (this->action == ENHORSE_ACT_INGO_RACE) { @@ -3520,7 +3520,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } } if (this->action != ENHORSE_ACT_INGO_RACE) { - EnHorse_TiltBody(this, globalCtx); + EnHorse_TiltBody(this, play); } Collider_UpdateCylinder(thisx, &this->cyl1); Collider_UpdateCylinder(thisx, &this->cyl2); @@ -3530,18 +3530,18 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { this->cyl1.dim.pos.z = this->cyl1.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * 11.0f); this->cyl2.dim.pos.x = this->cyl2.dim.pos.x + (s16)(Math_SinS(thisx->shape.rot.y) * -18.0f); this->cyl2.dim.pos.z = this->cyl2.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * -18.0f); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cyl1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cyl1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cyl2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cyl1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl2.base); if ((player->stateFlags1 & 1) && player->rideActor != NULL) { - if (globalCtx->sceneNum != SCENE_SPOT20 || - (globalCtx->sceneNum == SCENE_SPOT20 && (thisx->world.pos.z < -2400.0f))) { - EnHorse_UpdateConveyors(this, globalCtx); + if (play->sceneNum != SCENE_SPOT20 || + (play->sceneNum == SCENE_SPOT20 && (thisx->world.pos.z < -2400.0f))) { + EnHorse_UpdateConveyors(this, play); } } if (!(this->stateFlags & ENHORSE_FLAG_24)) { - EnHorse_UpdateBgCheckInfo(this, globalCtx); - EnHorse_CheckFloors(this, globalCtx); + EnHorse_UpdateBgCheckInfo(this, play); + EnHorse_CheckFloors(this, play); if (thisx->world.pos.y < this->yFront && thisx->world.pos.y < this->yBack) { if (this->yBack < this->yFront) { thisx->world.pos.y = this->yBack; @@ -3554,8 +3554,8 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { this->stateFlags &= ~ENHORSE_FLAG_24; } - if (globalCtx->sceneNum == SCENE_SPOT09 && (gSaveContext.eventChkInf[9] & 0xF) != 0xF) { - EnHorse_CheckBridgeJumps(this, globalCtx); + if (play->sceneNum == SCENE_SPOT09 && (gSaveContext.eventChkInf[9] & 0xF) != 0xF) { + EnHorse_CheckBridgeJumps(this, play); } thisx->focus.pos = thisx->world.pos; @@ -3584,19 +3584,19 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { if (gSaveContext.entranceIndex != 343 || gSaveContext.sceneSetupIndex != 9) { if (this->dustFlags & 1) { this->dustFlags &= ~1; - func_800287AC(globalCtx, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } else if (this->dustFlags & 2) { this->dustFlags &= ~2; - func_800287AC(globalCtx, &this->frontLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->frontLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } else if (this->dustFlags & 4) { this->dustFlags &= ~4; - func_800287AC(globalCtx, &this->backRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->backRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } else if (this->dustFlags & 8) { this->dustFlags &= ~8; - func_800287AC(globalCtx, &this->backLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->backLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } } @@ -3604,7 +3604,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnHorse_PlayerDirToMountSide(EnHorse* this, GlobalContext* globalCtx, Player* player) { +s32 EnHorse_PlayerDirToMountSide(EnHorse* this, PlayState* play, Player* player) { if (this->playerDir == PLAYER_DIR_SIDE_L) { return -1; } @@ -3614,7 +3614,7 @@ s32 EnHorse_PlayerDirToMountSide(EnHorse* this, GlobalContext* globalCtx, Player return 0; } -s32 EnHorse_MountSideCheck(EnHorse* this, GlobalContext* globalCtx, Player* player) { +s32 EnHorse_MountSideCheck(EnHorse* this, PlayState* play, Player* player) { s32 mountSide; if (Actor_WorldDistXZToActor(&this->actor, &player->actor) > 75.0f) { @@ -3625,7 +3625,7 @@ s32 EnHorse_MountSideCheck(EnHorse* this, GlobalContext* globalCtx, Player* play 0.17364818f) { // cos(80 degrees) return 0; } else { - mountSide = EnHorse_PlayerDirToMountSide(this, globalCtx, player); + mountSide = EnHorse_PlayerDirToMountSide(this, play, player); if (mountSide == -1) { return -1; } @@ -3636,14 +3636,14 @@ s32 EnHorse_MountSideCheck(EnHorse* this, GlobalContext* globalCtx, Player* play return 0; } -s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_GetMountSide(EnHorse* this, PlayState* play) { if (this->action != ENHORSE_ACT_IDLE) { return 0; } if ((this->animationIdx != ENHORSE_ANIM_IDLE) && (this->animationIdx != ENHORSE_ANIM_WHINNEY)) { return 0; } - return EnHorse_MountSideCheck(this, globalCtx, GET_PLAYER(globalCtx)); + return EnHorse_MountSideCheck(this, play, GET_PLAYER(play)); } void EnHorse_RandomOffset(Vec3f* src, f32 dist, Vec3f* dst) { @@ -3652,7 +3652,7 @@ void EnHorse_RandomOffset(Vec3f* src, f32 dist, Vec3f* dst) { dst->z = (Rand_ZeroOne() * (dist * 2.0f) + src->z) - dist; } -void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { EnHorse* this = (EnHorse*)thisx; s32 pad; Vec3f sp94 = { 0.0f, 0.0f, 0.0f }; @@ -3679,7 +3679,7 @@ void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { } Skin_GetLimbPos(skin, 13, &sp94, &sp2C); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp2C, &this->unk_228, &sp28); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp2C, &this->unk_228, &sp28); if ((this->animationIdx == ENHORSE_ANIM_IDLE && this->action != ENHORSE_ACT_FROZEN) && ((frame > 40.0f && frame < 45.0f && this->type == HORSE_EPONA) || (frame > 28.0f && frame < 33.0f && this->type == HORSE_HNI))) { @@ -3791,14 +3791,14 @@ void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { //! Actors will draw for a couple of frames between the pauses, but some important logic updates will not occur. //! In the case of OC, this can cause unwanted effects such as a very large amount of displacement being applied to //! a colliding actor. - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->jntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.base); } // unused static s32 D_80A667DC[] = { 0, 3, 7, 14 }; -s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbIndex, Skin* arg3) { +s32 EnHorse_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 limbIndex, Skin* arg3) { static void* eyeTextures[] = { gEponaEyeOpenTex, gEponaEyeHalfTex, @@ -3808,32 +3808,32 @@ s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbInd EnHorse* this = (EnHorse*)thisx; s32 drawOriginalLimb = true; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 13 && this->type == HORSE_EPONA) { u8 index = eyeBlinkIndexes[this->blinkTimer]; gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[index])); } else if (this->type == HORSE_HNI && this->stateFlags & ENHORSE_FLAG_18 && limbIndex == 30) { - Skin_DrawLimb(globalCtx->state.gfxCtx, &this->skin, limbIndex, gHorseIngoGerudoSaddleDL, 0); + Skin_DrawLimb(play->state.gfxCtx, &this->skin, limbIndex, gHorseIngoGerudoSaddleDL, 0); drawOriginalLimb = false; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return drawOriginalLimb; } -void EnHorse_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorse_Draw(Actor* thisx, PlayState* play) { EnHorse* this = (EnHorse*)thisx; if (!(this->stateFlags & ENHORSE_INACTIVE)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); this->stateFlags |= ENHORSE_DRAW; if (this->stateFlags & ENHORSE_JUMPING) { - func_800A6360(thisx, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, false); + func_800A6360(thisx, play, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, false); } else { - func_800A6360(thisx, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, true); + func_800A6360(thisx, play, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, true); } if (this->postDrawFunc != NULL) { - this->postDrawFunc(this, globalCtx); + this->postDrawFunc(this, play); } } } diff --git a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 08c1cf226..fb07caa69 100644 --- a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -89,7 +89,7 @@ typedef enum { /* 1 */ HORSE_HNI } HorseType; -typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, GlobalContext*); +typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, PlayState*); typedef struct EnHorse { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 4d1ab707e..c30b6222f 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -43,10 +43,10 @@ typedef enum { /* 4 */ MALONRACE_FAILURE } HorseGameMalonRaceResult; -void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseGameCheck_Init(Actor* thisx, PlayState* play); +void EnHorseGameCheck_Destroy(Actor* thisx, PlayState* play); +void EnHorseGameCheck_Update(Actor* thisx, PlayState* play); +void EnHorseGameCheck_Draw(Actor* thisx, PlayState* play); const ActorInit En_Horse_Game_Check_InitVars = { ACTOR_EN_HORSE_GAME_CHECK, @@ -79,7 +79,7 @@ static Vec3f sFencePos[] = { { -939.0f, 1.0f, 455.0f }, { -1644.0f, -21.0f, -1035.0f }, }; -s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckIngoRace* this = (EnHorseGameCheckIngoRace*)base; s32 i; @@ -89,7 +89,7 @@ s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, GlobalContext* glo this->playerCheck[i] = 0; } this->ingoHorse = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -250.0f, 1.0f, -1650.0f, 0, 0x4000, 0, 0x8003); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -250.0f, 1.0f, -1650.0f, 0, 0x4000, 0, 0x8003); if (this->ingoHorse == NULL) { LOG_HUNGUP_THREAD(); @@ -103,39 +103,39 @@ s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, GlobalContext* glo return true; } -s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, PlayState* play) { return true; } -void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, GlobalContext* globalCtx) { +void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, PlayState* play) { gSaveContext.cutsceneIndex = 0; if (this->result == INGORACE_PLAYER_WIN) { - globalCtx->nextEntranceIndex = 0x4CE; + play->nextEntranceIndex = 0x4CE; if (gSaveContext.eventInf[0] & 0x40) { gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 6; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; - globalCtx->fadeTransition = 3; + play->fadeTransition = 3; Environment_ForcePlaySequence(NA_BGM_INGO); } else { gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 4; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; Environment_ForcePlaySequence(NA_BGM_INGO); - globalCtx->fadeTransition = 0x2E; + play->fadeTransition = 0x2E; } } else { - globalCtx->nextEntranceIndex = 0x558; + play->nextEntranceIndex = 0x558; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 3; - globalCtx->fadeTransition = 0x20; + play->fadeTransition = 0x20; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; } DREG(25) = 0; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; gSaveContext.timer1State = 0; } -s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckIngoRace* this = (EnHorseGameCheckIngoRace*)base; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; EnHorse* ingoHorse; EnHorse* horse; @@ -219,13 +219,13 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, GlobalContext* g if (this->finishTimer > 0) { this->finishTimer--; } else { - EnHorseGameCheck_FinishIngoRace(this, globalCtx); + EnHorseGameCheck_FinishIngoRace(this, play); } } return true; } -s32 EnHorseGameCheck_InitGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitGerudoArchery(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckGerudoArchery* this = (EnHorseGameCheckGerudoArchery*)base; this->base.type = HORSEGAME_GERUDO_ARCHERY; @@ -234,13 +234,13 @@ s32 EnHorseGameCheck_InitGerudoArchery(EnHorseGameCheckBase* base, GlobalContext return true; } -s32 EnHorseGameCheck_DestroyGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyGerudoArchery(EnHorseGameCheckBase* base, PlayState* play) { return true; } -s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckGerudoArchery* this = (EnHorseGameCheckGerudoArchery*)base; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnHorse* horse = (EnHorse*)player->rideActor; if (horse == NULL) { @@ -248,14 +248,14 @@ s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, GlobalConte } if (this->startTimer > 90) { - if (globalCtx) {} + if (play) {} horse->hbaStarted = 1; } this->startTimer++; return true; } -s32 EnHorseGameCheck_InitType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitType3(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheck3* this = (EnHorseGameCheck3*)base; this->base.type = HORSEGAME_TYPE3; @@ -263,15 +263,15 @@ s32 EnHorseGameCheck_InitType3(EnHorseGameCheckBase* base, GlobalContext* global return true; } -s32 EnHorseGameCheck_DestroyType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyType3(EnHorseGameCheckBase* base, PlayState* play) { return true; } -s32 EnHorseGameCheck_UpdateType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateType3(EnHorseGameCheckBase* base, PlayState* play) { return true; } -s32 EnHorseGameCheck_InitMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitMalonRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckMalonRace* this = (EnHorseGameCheckMalonRace*)base; s32 i; @@ -286,37 +286,37 @@ s32 EnHorseGameCheck_InitMalonRace(EnHorseGameCheckBase* base, GlobalContext* gl return true; } -s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, PlayState* play) { return true; } -void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, GlobalContext* globalCtx) { +void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, PlayState* play) { if ((this->result == MALONRACE_SUCCESS) || (this->result == MALONRACE_TIME_UP)) { gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = 0x4CE; - globalCtx->fadeTransition = 0x2E; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x4CE; + play->fadeTransition = 0x2E; + play->sceneLoadFlag = 0x14; } else if (this->result == MALONRACE_FAILURE) { gSaveContext.timer1Value = 240; gSaveContext.timer1State = 0xF; gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = 0x4CE; - globalCtx->fadeTransition = 0x2E; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x4CE; + play->fadeTransition = 0x2E; + play->sceneLoadFlag = 0x14; } else { // "not supported" osSyncPrintf("En_HGC_Spot20_Ta_end():対応せず\n"); gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = 0x157; - globalCtx->fadeTransition = 0x2E; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x157; + play->fadeTransition = 0x2E; + play->sceneLoadFlag = 0x14; } } -s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckMalonRace* this = (EnHorseGameCheckMalonRace*)base; s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnHorse* horse; if (!(this->raceFlags & MALONRACE_PLAYER_ON_MARK) && AT_FINISH_LINE(player->rideActor)) { @@ -360,7 +360,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* if ((this->fenceCheck[i - 1] == 0) && !(this->raceFlags & MALONRACE_BROKE_RULE)) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = 4; this->finishTimer = 30; } @@ -371,7 +371,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* AT_FINISH_LINE(player2->rideActor)) { if ((this->lapCount == 1) && (this->fenceCheck[15] == 0) && (player2->rideActor->prevPos.x < -200.0f)) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = MALONRACE_FAILURE; this->finishTimer = 30; } else if (this->fenceCheck[15] == 1) { @@ -384,15 +384,15 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* } else if ((this->fenceCheck[7] == 1) && !(this->raceFlags & MALONRACE_SECOND_LAP)) { this->lapCount = 1; this->raceFlags |= MALONRACE_SECOND_LAP; - Message_StartTextbox(globalCtx, 0x208D, NULL); + Message_StartTextbox(play, 0x208D, NULL); } else if (this->fenceCheck[7] == 0) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = MALONRACE_FAILURE; this->finishTimer = 30; } else if (player2->rideActor->prevPos.x > 80.0f) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = MALONRACE_FAILURE; this->finishTimer = 30; } @@ -407,7 +407,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* if (this->finishTimer > 0) { this->finishTimer--; } else { - EnHorseGameCheck_FinishMalonRace(this, globalCtx); + EnHorseGameCheck_FinishMalonRace(this, play); } } return true; @@ -437,35 +437,35 @@ static EnHorseGameCheckFunc sUpdateFuncs[] = { EnHorseGameCheck_UpdateMalonRace, }; -void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Init(Actor* thisx, PlayState* play) { s32 pad; EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx; - if ((globalCtx->sceneNum == SCENE_SPOT20) && (Flags_GetEventChkInf(0x18) || DREG(1))) { + if ((play->sceneNum == SCENE_SPOT20) && (Flags_GetEventChkInf(0x18) || DREG(1))) { this->actor.params = HORSEGAME_MALON_RACE; } if (sInitFuncs[this->actor.params] != NULL) { - sInitFuncs[this->actor.params](this, globalCtx); + sInitFuncs[this->actor.params](this, play); } } -void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx; if (sDestroyFuncs[this->actor.params] != NULL) { - sDestroyFuncs[this->actor.params](this, globalCtx); + sDestroyFuncs[this->actor.params](this, play); } } -void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Update(Actor* thisx, PlayState* play) { s32 pad; EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx; if (sUpdateFuncs[this->type] != NULL) { - sUpdateFuncs[this->type](this, globalCtx); + sUpdateFuncs[this->type](this, play); } } -void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Draw(Actor* thisx, PlayState* play) { } diff --git a/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h b/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h index 0828d2705..2ef1d2b9a 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h +++ b/soh/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h @@ -6,7 +6,7 @@ struct EnHorseGameCheckBase; -typedef s32 (*EnHorseGameCheckFunc)(struct EnHorseGameCheckBase* this, GlobalContext* globalCtx); +typedef s32 (*EnHorseGameCheckFunc)(struct EnHorseGameCheckBase* this, PlayState* play); typedef struct EnHorseGameCheckBase { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index 5432e8a36..d256eabfe 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -14,14 +14,14 @@ typedef struct { /* 0x6 */ u8 unk_6; } unk_D_80A69248; // size = 0x8 -void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGanon_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGanon_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseGanon_Init(Actor* thisx, PlayState* play); +void EnHorseGanon_Destroy(Actor* thisx, PlayState* play); +void EnHorseGanon_Update(Actor* thisx, PlayState* play); +void EnHorseGanon_Draw(Actor* thisx, PlayState* play); void func_80A68AC4(EnHorseGanon* this); -void func_80A68AF0(EnHorseGanon* this, GlobalContext* globalCtx); -void func_80A68DB0(EnHorseGanon* this, GlobalContext* globalCtx); +void func_80A68AF0(EnHorseGanon* this, PlayState* play); +void func_80A68DB0(EnHorseGanon* this, PlayState* play); const ActorInit En_Horse_Ganon_InitVars = { ACTOR_EN_HORSE_GANON, @@ -114,7 +114,7 @@ void func_80A68660(unk_D_80A69248* data, s32 index, Vec3f* vec) { vec->z = data[index].unk_0.z; } -void func_80A686A8(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A686A8(EnHorseGanon* this, PlayState* play) { Vec3f* tempPos; Vec3f vec; s16 y; @@ -139,7 +139,7 @@ void func_80A686A8(EnHorseGanon* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) <= 300.0f) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) <= 300.0f) { if (this->actor.speedXZ < 12.0f) { this->actor.speedXZ += 1.0f; } else { @@ -165,7 +165,7 @@ void func_80A68870(EnHorseGanon* this) { } } -void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Init(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -178,25 +178,25 @@ void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->action = 0; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gHorseGanonSkel, &gHorseGanonIdleAnim); + Skin_Init(play, &this->skin, &gHorseGanonSkel, &gHorseGanonIdleAnim); this->currentAnimation = 0; Animation_PlayOnce(&this->skin.skelAnime, sAnimations[0]); - Collider_InitCylinder(globalCtx, &this->colliderBody); - Collider_SetCylinder(globalCtx, &this->colliderBody, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->colliderHead); - Collider_SetJntSph(globalCtx, &this->colliderHead, &this->actor, &sJntSphInit, this->headElements); + Collider_InitCylinder(play, &this->colliderBody); + Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->colliderHead); + Collider_SetJntSph(play, &this->colliderHead, &this->actor, &sJntSphInit, this->headElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, 0, &sColChkInfoInit); func_80A68AC4(this); } -void EnHorseGanon_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Destroy(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->colliderBody); - Collider_DestroyJntSph(globalCtx, &this->colliderHead); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->colliderBody); + Collider_DestroyJntSph(play, &this->colliderHead); } void func_80A68AC4(EnHorseGanon* this) { @@ -204,7 +204,7 @@ void func_80A68AC4(EnHorseGanon* this) { Animation_PlayLoop(&this->skin.skelAnime, sAnimations[4]); } -void func_80A68AF0(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A68AF0(EnHorseGanon* this, PlayState* play) { this->actor.speedXZ = 0.0f; SkelAnime_Update(&this->skin.skelAnime); } @@ -255,19 +255,19 @@ void func_80A68B20(EnHorseGanon* this) { } } -void func_80A68DB0(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A68DB0(EnHorseGanon* this, PlayState* play) { if (this->currentAnimation == 2) { func_80A68870(this); } - func_80A686A8(this, globalCtx); + func_80A686A8(this, play); if (SkelAnime_Update(&this->skin.skelAnime) != 0) { func_80A68B20(this); } } -void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A68E14(EnHorseGanon* this, PlayState* play) { s32 pad; CollisionPoly* col; f32 temp_ret; @@ -278,26 +278,26 @@ void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) { v.y = this->actor.world.pos.y + 60.0f; v.z = Math_CosS(this->actor.shape.rot.y) * 30.0f + this->actor.world.pos.z; - temp_ret = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &col, &temp1, &v); + temp_ret = BgCheck_EntityRaycastFloor3(&play->colCtx, &col, &temp1, &v); this->unk_1F4 = temp_ret; this->actor.shape.rot.x = (0x8000 / M_PI) * Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f); } -void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Update(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 55.0f, 100.0f, 29); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f, 29); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); } -void EnHorseGanon_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseGanon_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f sp4C; Vec3f sp40; EnHorseGanon* this = (EnHorseGanon*)thisx; @@ -319,13 +319,13 @@ void EnHorseGanon_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderHead.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderHead.base); } -void EnHorseGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Draw(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; - func_80A68E14(this, globalCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseGanon_PostDraw, true); + func_80A68E14(this, play); + func_80093D18(play->state.gfxCtx); + func_800A6330(&this->actor, play, &this->skin, EnHorseGanon_PostDraw, true); } diff --git a/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h b/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h index a7fd8378e..8083adeee 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h +++ b/soh/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h @@ -6,7 +6,7 @@ struct EnHorseGanon; -typedef void (*EnHorseGanonActionFunc)(struct EnHorseGanon*, GlobalContext*); +typedef void (*EnHorseGanonActionFunc)(struct EnHorseGanon*, PlayState*); typedef struct EnHorseGanon { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index d538bac31..b9a7120b8 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseLinkChild_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseLinkChild_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseLinkChild_Init(Actor* thisx, PlayState* play); +void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play); +void EnHorseLinkChild_Update(Actor* thisx, PlayState* play); +void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play); void func_80A69B7C(EnHorseLinkChild* this); void func_80A69EC0(EnHorseLinkChild* this); @@ -140,7 +140,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_STOP), }; -void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; s32 pad; @@ -152,20 +152,20 @@ void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { this->action = 1; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gChildEponaSkel, &gChildEponaGallopingAnim); + Skin_Init(play, &this->skin, &gChildEponaSkel, &gChildEponaGallopingAnim); this->animationIdx = 0; Animation_PlayOnce(&this->skin.skelAnime, sAnimations[0]); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinderType1(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->headCollider); - Collider_SetJntSph(globalCtx, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinderType1(play, &this->bodyCollider, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->headCollider); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColCheckInfoInit); this->unk_1F0 = 0; this->eyeTexIndex = 0; if (gSaveContext.sceneSetupIndex > 3) { func_80A69EC0(this); - } else if (globalCtx->sceneNum == SCENE_SPOT20) { + } else if (play->sceneNum == SCENE_SPOT20) { if (!Flags_GetEventChkInf(0x14)) { Actor_Kill(&this->actor); return; @@ -179,12 +179,12 @@ void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0; } -void EnHorseLinkChild_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyJntSph(globalCtx, &this->headCollider); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyJntSph(play, &this->headCollider); } void func_80A6988C(EnHorseLinkChild* this) { @@ -198,7 +198,7 @@ void func_80A6988C(EnHorseLinkChild* this) { this->skin.skelAnime.playSpeed = func_80A695A4(this); } -void func_80A698F4(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A698F4(EnHorseLinkChild* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_80A6988C(this); @@ -220,11 +220,11 @@ void func_80A6993C(EnHorseLinkChild* this, s32 newAnimationIdx) { } } -void func_80A699FC(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A699FC(EnHorseLinkChild* this, PlayState* play) { f32 distFromLink; s32 newAnimationIdx; - distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (SkelAnime_Update(&this->skin.skelAnime)) { if ((distFromLink < 1000.0f) && (distFromLink > 70.0f)) { @@ -251,13 +251,13 @@ void func_80A69B7C(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, -5.0f); } -void func_80A69C18(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A69C18(EnHorseLinkChild* this, PlayState* play) { s16 yawDiff; f32 distFromLink; s32 newAnimationIdx; if ((this->animationIdx == 4) || (this->animationIdx == 3) || (this->animationIdx == 2)) { - yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (yawDiff > 0x12C) { this->actor.world.rot.y += 0x12C; @@ -271,7 +271,7 @@ void func_80A69C18(EnHorseLinkChild* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (distFromLink > 1000.0f) { func_80A6993C(this, 0); @@ -310,14 +310,14 @@ void func_80A69EC0(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, -5.0f); } -void func_80A69F5C(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A69F5C(EnHorseLinkChild* this, PlayState* play) { Player* player; s16 yawDiff; s32 yawSign; s32 yawOffset; if ((this->animationIdx == 4) || (this->animationIdx == 3) || (this->animationIdx == 2)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos) < 250.0f) { yawDiff = player->actor.shape.rot.y; @@ -340,7 +340,7 @@ void func_80A69F5C(EnHorseLinkChild* this, GlobalContext* globalCtx) { } } -void func_80A6A068(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { Player* player; f32 distFromLink; s32 animationEnded; @@ -348,8 +348,8 @@ void func_80A6A068(EnHorseLinkChild* this, GlobalContext* globalCtx) { f32 distFromHome; f32 distLinkFromHome; - func_80A69F5C(this, globalCtx); - player = GET_PLAYER(globalCtx); + func_80A69F5C(this, play); + player = GET_PLAYER(play); distFromLink = Actor_WorldDistXZToActor(&this->actor, &player->actor); if (gSaveContext.entranceIndex == 0x2AE) { @@ -360,7 +360,7 @@ void func_80A6A068(EnHorseLinkChild* this, GlobalContext* globalCtx) { } if (((gSaveContext.eventChkInf[1] & 0x40) && (DREG(53) != 0)) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF1))) { + ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF1))) { func_80A6A4DC(this); } else { this->unk_2A0 = gSaveContext.eventChkInf[1] & 0x40; @@ -440,7 +440,7 @@ void func_80A6A4DC(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void func_80A6A5A4(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A6A5A4(EnHorseLinkChild* this, PlayState* play) { s16 yawDiff; if (DREG(53) != 0) { @@ -450,10 +450,10 @@ void func_80A6A5A4(EnHorseLinkChild* this, GlobalContext* globalCtx) { func_80A6A724(this); } else { this->actor.speedXZ = 0.0f; - yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; // 0.7071 = cos(pi/4) if ((Math_CosS(yawDiff) < 0.7071f) && (this->animationIdx == 2)) { - func_8006DD9C(&this->actor, &GET_PLAYER(globalCtx)->actor.world.pos, 300); + func_8006DD9C(&this->actor, &GET_PLAYER(play)->actor.world.pos, 300); } if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -478,8 +478,8 @@ void func_80A6A724(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, -5.0f); } -void func_80A6A7D0(EnHorseLinkChild* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6A7D0(EnHorseLinkChild* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 dist; s32 newAnimationIdx; @@ -498,7 +498,7 @@ void func_80A6A7D0(EnHorseLinkChild* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skin.skelAnime)) { if (!this->unk_1E8) { - dist = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + dist = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); } else { dist = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); } @@ -550,15 +550,15 @@ static EnHorseLinkChildActionFunc sActionFuncs[] = { static void* sEyeTextures[] = { gChildEponaEyeOpenTex, gChildEponaEyeHalfTex, gChildEponaEyeCloseTex }; static u8 sEyeIndexOrder[] = { 0, 1, 2, 1 }; -void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 55.0f, 100.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f, 0x1D); - if ((globalCtx->sceneNum == SCENE_SPOT20) && (this->actor.world.pos.z < -2400.0f)) { + if ((play->sceneNum == SCENE_SPOT20) && (this->actor.world.pos.z < -2400.0f)) { this->actor.world.pos.z = -2400.0f; } @@ -575,11 +575,11 @@ void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); func_80A6948C(this); } -void EnHorseLinkChild_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseLinkChild_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f center; Vec3f newCenter; EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; @@ -598,13 +598,13 @@ void EnHorseLinkChild_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* ski } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); } -s32 EnHorseLinkChild_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 arg2, Skin* skin) { +s32 EnHorseLinkChild_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 arg2, Skin* skin) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (arg2 == 0xD) { u8 index = sEyeIndexOrder[this->eyeTexIndex]; @@ -612,15 +612,15 @@ s32 EnHorseLinkChild_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s3 gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[index])); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return 1; } -void EnHorseLinkChild_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - func_800A6360(&this->actor, globalCtx, &this->skin, EnHorseLinkChild_PostDraw, EnHorseLinkChild_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + func_800A6360(&this->actor, play, &this->skin, EnHorseLinkChild_PostDraw, EnHorseLinkChild_OverrideLimbDraw, true); } diff --git a/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h b/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h index 6e813173d..a61248c70 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h +++ b/soh/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h @@ -6,7 +6,7 @@ struct EnHorseLinkChild; -typedef void (*EnHorseLinkChildActionFunc)(struct EnHorseLinkChild*, GlobalContext*); +typedef void (*EnHorseLinkChildActionFunc)(struct EnHorseLinkChild*, PlayState*); typedef struct EnHorseLinkChild { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index a21734e4f..582781cd6 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -28,12 +28,12 @@ typedef enum { /* 0x04 */ HORSE_FOLLOW_PATH } EnHorseNormalAction; -void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseNormal_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseNormal_Init(Actor* thisx, PlayState* play); +void EnHorseNormal_Destroy(Actor* thisx, PlayState* play); +void EnHorseNormal_Update(Actor* thisx, PlayState* play); +void EnHorseNormal_Draw(Actor* thisx, PlayState* play); -void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx); +void func_80A6B91C(EnHorseNormal* this, PlayState* play); void func_80A6BC48(EnHorseNormal* this); void func_80A6BCEC(EnHorseNormal* this); void func_80A6C4CC(EnHorseNormal* this); @@ -182,7 +182,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP), }; -void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Init(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; s32 pad; @@ -195,14 +195,14 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 70.0f; this->action = HORSE_CYCLE_ANIMATIONS; this->animationIdx = 0; - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit1); - Collider_InitJntSph(globalCtx, &this->headCollider); - Collider_SetJntSph(globalCtx, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); - Collider_InitCylinder(globalCtx, &this->cloneCollider); - Collider_SetCylinder(globalCtx, &this->cloneCollider, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInit1); + Collider_InitJntSph(play, &this->headCollider); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); + Collider_InitCylinder(play, &this->cloneCollider); + Collider_SetCylinder(play, &this->cloneCollider, &this->actor, &sCylinderInit2); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (globalCtx->sceneNum == SCENE_SPOT20) { + if (play->sceneNum == SCENE_SPOT20) { if (this->actor.world.rot.z == 0 || !IS_DAY) { Actor_Kill(&this->actor); return; @@ -227,7 +227,7 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { return; } this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0; - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); if ((this->actor.world.pos.x == -730.0f && this->actor.world.pos.y == 0.0f && this->actor.world.pos.z == -1100.0f) || @@ -236,47 +236,47 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A6C6B0(this); return; } - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + } else if (play->sceneNum == SCENE_MALON_STABLE) { if (IS_DAY) { Actor_Kill(&this->actor); return; } else { - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); func_80A6C6B0(this); return; } - } else if (globalCtx->sceneNum == SCENE_SPOT12) { + } else if (play->sceneNum == SCENE_SPOT12) { if (this->actor.world.pos.x == 3707.0f && this->actor.world.pos.y == 1413.0f && this->actor.world.pos.z == -665.0f) { - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); func_80A6C4CC(this); return; } - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); } else { - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); } if ((this->actor.params & 0xF0) == 0x10 && (this->actor.params & 0xF) != 0xF) { - func_80A6B91C(this, globalCtx); + func_80A6B91C(this, play); } else { func_80A6BC48(this); } } -void EnHorseNormal_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Destroy(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyCylinder(globalCtx, &this->cloneCollider); - Collider_DestroyJntSph(globalCtx, &this->headCollider); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->cloneCollider); + Collider_DestroyJntSph(play, &this->headCollider); } -void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx) { +void func_80A6B91C(EnHorseNormal* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_4; this->action = HORSE_FOLLOW_PATH; this->animationIdx = 6; @@ -286,8 +286,8 @@ void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void EnHorseNormal_FollowPath(EnHorseNormal* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xF]; +void EnHorseNormal_FollowPath(EnHorseNormal* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params & 0xF]; Vec3s* pointPos = SEGMENTED_TO_VIRTUAL(path->points); f32 dx; f32 dz; @@ -323,7 +323,7 @@ void EnHorseNormal_NextAnimation(EnHorseNormal* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); } -void EnHorseNormal_CycleAnimations(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_CycleAnimations(EnHorseNormal* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -364,7 +364,7 @@ void func_80A6BD7C(EnHorseNormal* this) { } } -void EnHorseNormal_Wander(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_Wander(EnHorseNormal* this, PlayState* play) { static s32 D_80A6D4F4[] = { 0, 1, 4, 5, 6, 2, 3 }; static s32 D_80A6D510[] = { 0, 0, 2, 2, 1, 1, 1, 3, 3 }; s32 phi_t0 = this->animationIdx; @@ -487,7 +487,7 @@ void func_80A6C4CC(EnHorseNormal* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void EnHorseNormal_Wait(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_Wait(EnHorseNormal* this, PlayState* play) { if (SkelAnime_Update(&this->skin.skelAnime)) { f32 rand = Rand_ZeroOne(); @@ -518,7 +518,7 @@ void func_80A6C6B0(EnHorseNormal* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void EnHorseNormal_WaitClone(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_WaitClone(EnHorseNormal* this, PlayState* play) { func_80A6BD7C(this); if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -546,7 +546,7 @@ void EnHorseNormal_WaitClone(EnHorseNormal* this, GlobalContext* globalCtx) { } } -void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) { +void func_80A6C8E0(EnHorseNormal* this, PlayState* play) { s32 pad; CollisionPoly* sp38; s32 pad2; @@ -556,7 +556,7 @@ void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) { sp28.x = (Math_SinS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.x; sp28.y = this->actor.world.pos.y + 60.0f; sp28.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z; - this->unk_220 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp38, &sp24, &sp28); + this->unk_220 = BgCheck_EntityRaycastFloor3(&play->colCtx, &sp38, &sp24, &sp28); this->actor.shape.rot.x = Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f) * (0x8000 / M_PI); } @@ -565,14 +565,14 @@ static EnHorseNormalActionFunc sActionFuncs[] = { EnHorseNormal_WaitClone, EnHorseNormal_FollowPath, }; -void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Update(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 35.0f, 100.0f, 0x1D); - if (globalCtx->sceneNum == SCENE_SPOT20 && this->actor.world.pos.z < -2400.0f) { + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 35.0f, 100.0f, 0x1D); + if (play->sceneNum == SCENE_SPOT20 && this->actor.world.pos.z < -2400.0f) { this->actor.world.pos.z = -2400.0f; } this->actor.focus.pos = this->actor.world.pos; @@ -580,7 +580,7 @@ void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_204 = this->actor.projectedPos; this->unk_204.y += 120.0f; Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if (this->actor.speedXZ == 0.0f) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; } else { @@ -588,7 +588,7 @@ void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHorseNormal_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseNormal_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f sp4C; Vec3f sp40; EnHorseNormal* this = (EnHorseNormal*)thisx; @@ -607,14 +607,14 @@ void EnHorseNormal_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); } -void func_80A6CC88(GlobalContext* globalCtx, EnHorseNormal* this, Vec3f* arg2) { +void func_80A6CC88(PlayState* play, EnHorseNormal* this, Vec3f* arg2) { f32 curFrame = this->skin.skelAnime.curFrame; f32 wDest; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg2, &this->unk_1E8, &wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg2, &this->unk_1E8, &wDest); this->unk_1F4 = this->unk_1E8; this->unk_1F4.y += 120.0f; @@ -633,17 +633,17 @@ void func_80A6CC88(GlobalContext* globalCtx, EnHorseNormal* this, Vec3f* arg2) { } } -void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; Mtx* mtx2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (globalCtx->sceneNum != SCENE_SPOT20 || globalCtx->sceneNum != SCENE_MALON_STABLE) { - func_80A6C8E0(this, globalCtx); + if (play->sceneNum != SCENE_SPOT20 || play->sceneNum != SCENE_MALON_STABLE) { + func_80A6C8E0(this, play); } - func_80093D18(globalCtx->state.gfxCtx); - func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseNormal_PostDraw, true); + func_80093D18(play->state.gfxCtx); + func_800A6330(&this->actor, play, &this->skin, EnHorseNormal_PostDraw, true); if (this->action == HORSE_WAIT_CLONE) { MtxF skinMtx; @@ -653,7 +653,7 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 distFromGround = this->actor.world.pos.y - this->actor.floorHeight; f32 temp_f0_4; - if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + if (play->sceneNum == SCENE_MALON_STABLE) { if (this->actor.world.pos.x == 355.0f && this->actor.world.pos.y == 0.0f && this->actor.world.pos.z == -245.0f) { clonePos.x = 235.0f; @@ -667,7 +667,7 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { clonePos.z = 100.0f; cloneRotY = 0x7FFF; } - } else if (globalCtx->sceneNum == SCENE_SPOT20) { + } else if (play->sceneNum == SCENE_SPOT20) { if (this->actor.world.pos.x == -730.0f && this->actor.world.pos.y == 0.0f && this->actor.world.pos.z == -1100.0f) { clonePos.x = 780.0f; @@ -682,35 +682,35 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { cloneRotY = 0; } } - func_80A6CC88(globalCtx, this, &clonePos); + func_80A6CC88(play, this, &clonePos); SkinMatrix_SetTranslateRotateYXZScale(&skinMtx, this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, this->actor.shape.rot.x, cloneRotY, this->actor.shape.rot.z, clonePos.x, (this->actor.shape.yOffset * this->actor.scale.y) + clonePos.y, clonePos.z); - mtx1 = SkinMatrix_MtxFToNewMtx(globalCtx->state.gfxCtx, &skinMtx); + mtx1 = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); if (mtx1 == NULL) { return; } gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_OPA_DISP++, mtx1, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_800A63CC(&this->actor, globalCtx, &this->skin, NULL, NULL, true, 0, + func_800A63CC(&this->actor, play, &this->skin, NULL, NULL, true, 0, SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS | SKIN_DRAW_FLAG_CUSTOM_MATRIX); this->cloneCollider.dim.pos.x = clonePos.x; this->cloneCollider.dim.pos.y = clonePos.y; this->cloneCollider.dim.pos.z = clonePos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cloneCollider.base); - func_80094044(globalCtx->state.gfxCtx); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cloneCollider.base); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); Matrix_Translate(clonePos.x, clonePos.y, clonePos.z, MTXMODE_NEW); temp_f0_4 = (1.0f - (distFromGround * 0.01f)) * this->actor.shape.shadowScale; Matrix_Scale(this->actor.scale.x * temp_f0_4, 1.0f, this->actor.scale.z * temp_f0_4, MTXMODE_APPLY); Matrix_RotateY(cloneRotY * (2.0f * M_PI / 0x10000), MTXMODE_APPLY); - mtx2 = MATRIX_NEWMTX(globalCtx->state.gfxCtx); + mtx2 = MATRIX_NEWMTX(play->state.gfxCtx); if (mtx2 != NULL) { gSPMatrix(POLY_XLU_DISP++, mtx2, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHorseShadowDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h b/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h index 9c5ffb74c..f9445eb18 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h +++ b/soh/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h @@ -6,7 +6,7 @@ struct EnHorseNormal; -typedef void (*EnHorseNormalActionFunc)(struct EnHorseNormal*, GlobalContext*); +typedef void (*EnHorseNormalActionFunc)(struct EnHorseNormal*, PlayState*); typedef struct EnHorseNormal { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index 0aee97741..925345587 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -9,13 +9,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnHorseZelda_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseZelda_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseZelda_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseZelda_Init(Actor* thisx, PlayState* play); +void EnHorseZelda_Destroy(Actor* thisx, PlayState* play); +void EnHorseZelda_Update(Actor* thisx, PlayState* play); +void EnHorseZelda_Draw(Actor* thisx, PlayState* play); -void func_80A6DCCC(EnHorseZelda* this, GlobalContext* globalCtx); -void func_80A6DDFC(EnHorseZelda* this, GlobalContext* globalCtx); +void func_80A6DCCC(EnHorseZelda* this, PlayState* play); +void func_80A6DDFC(EnHorseZelda* this, PlayState* play); void func_80A6DC7C(EnHorseZelda* this); const ActorInit En_Horse_Zelda_InitVars = { @@ -111,7 +111,7 @@ void func_80A6D8D0(unknownStruct* data, s32 index, Vec3f* vec) { vec->z = data[index].unk_0.z; } -void func_80A6D918(EnHorseZelda* this, GlobalContext* globalCtx) { +void func_80A6D918(EnHorseZelda* this, PlayState* play) { s32 pad; Vec3f sp28; s16 yawDiff; @@ -134,7 +134,7 @@ void func_80A6D918(EnHorseZelda* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) <= 300.0f) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) <= 300.0f) { if (this->actor.speedXZ < 12.0f) { this->actor.speedXZ += 1.0f; } else { @@ -147,7 +147,7 @@ void func_80A6D918(EnHorseZelda* this, GlobalContext* globalCtx) { } } -void EnHorseZelda_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Init(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -158,24 +158,24 @@ void EnHorseZelda_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->action = 0; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gHorseZeldaSkel, &gHorseZeldaGallopingAnim); + Skin_Init(play, &this->skin, &gHorseZeldaSkel, &gHorseZeldaGallopingAnim); this->animationIndex = 0; Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[0]); - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinderType1(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->colliderSphere); - Collider_SetJntSph(globalCtx, &this->colliderSphere, &this->actor, &sJntSphInit, &this->colliderSphereItem); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinderType1(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->colliderSphere); + Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, &this->colliderSphereItem); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->animationIndex = 0; func_80A6DC7C(this); } -void EnHorseZelda_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Destroy(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroyJntSph(globalCtx, &this->colliderSphere); - Skin_Free(globalCtx, &this->skin); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderSphere); + Skin_Free(play, &this->skin); } void func_80A6DC7C(EnHorseZelda* this) { @@ -187,7 +187,7 @@ void func_80A6DC7C(EnHorseZelda* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->animationIndex]); } -void func_80A6DCCC(EnHorseZelda* this, GlobalContext* globalCtx) { +void func_80A6DCCC(EnHorseZelda* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_80A6DC7C(this); @@ -206,14 +206,14 @@ void func_80A6DD14(EnHorseZelda* this) { Animation_GetLastFrame(sAnimationHeaders[this->animationIndex]), ANIMMODE_ONCE, 0.0f); } -void func_80A6DDFC(EnHorseZelda* this, GlobalContext* globalCtx) { - func_80A6D918(this, globalCtx); +void func_80A6DDFC(EnHorseZelda* this, PlayState* play) { + func_80A6D918(this, play); if (SkelAnime_Update(&this->skin.skelAnime)) { func_80A6DD14(this); } } -void func_80A6DE38(EnHorseZelda* this, GlobalContext* globalCtx) { +void func_80A6DE38(EnHorseZelda* this, PlayState* play) { s32 pad; CollisionPoly* poly; s32 pad2; @@ -223,25 +223,25 @@ void func_80A6DE38(EnHorseZelda* this, GlobalContext* globalCtx) { pos.x = (Math_SinS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 60.0f; pos.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z; - this->unk_1F4 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &pos); + this->unk_1F4 = BgCheck_EntityRaycastFloor3(&play->colCtx, &poly, &bgId, &pos); this->actor.shape.rot.x = Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f) * (0x8000 / M_PI); } -void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Update(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); this->actor.speedXZ = 0.0f; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 55.0f, 100.0f, 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; Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } -void EnHorseZelda_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseZelda_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f sp4C; Vec3f sp40; EnHorseZelda* this = (EnHorseZelda*)thisx; @@ -263,13 +263,13 @@ void EnHorseZelda_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } -void EnHorseZelda_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Draw(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; - func_80A6DE38(this, globalCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseZelda_PostDraw, true); + func_80A6DE38(this, play); + func_80093D18(play->state.gfxCtx); + func_800A6330(&this->actor, play, &this->skin, EnHorseZelda_PostDraw, true); } diff --git a/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h b/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h index 531a1a6c3..afac221da 100644 --- a/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h +++ b/soh/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h @@ -6,7 +6,7 @@ struct EnHorseZelda; -typedef void (*EnHorseZeldaActionFunc)(struct EnHorseZelda*, GlobalContext*); +typedef void (*EnHorseZeldaActionFunc)(struct EnHorseZelda*, PlayState*); typedef struct EnHorseZelda { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 743550697..d642bce3e 100644 --- a/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -11,13 +11,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHs_Init(Actor* thisx, PlayState* play); +void EnHs_Destroy(Actor* thisx, PlayState* play); +void EnHs_Update(Actor* thisx, PlayState* play); +void EnHs_Draw(Actor* thisx, PlayState* play); -void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx); -void func_80A6E6B0(EnHs* this, GlobalContext* globalCtx); +void func_80A6E9AC(EnHs* this, PlayState* play); +void func_80A6E6B0(EnHs* this, PlayState* play); const ActorInit En_Hs_InitVars = { ACTOR_EN_HS, @@ -56,16 +56,16 @@ void func_80A6E3A0(EnHs* this, EnHsActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnHs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Init(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &object_hs_Anim_0005C0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); @@ -112,16 +112,16 @@ void EnHs_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnHs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Destroy(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A6E53C(EnHs* this, GlobalContext* globalCtx, u16 textId, EnHsActionFunc actionFunc) { +s32 func_80A6E53C(EnHs* this, PlayState* play, u16 textId, EnHsActionFunc actionFunc) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { func_80A6E3A0(this, actionFunc); return 1; } @@ -130,22 +130,22 @@ s32 func_80A6E53C(EnHs* this, GlobalContext* globalCtx, u16 textId, EnHsActionFu yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistToPlayer < 100.0f)) { this->unk_2A8 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } -void func_80A6E5EC(EnHs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6E5EC(EnHs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A6E3A0(this, func_80A6E6B0); } this->unk_2A8 |= 1; } -void func_80A6E630(EnHs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A6E630(EnHs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (!gSaveContext.n64ddFlag) { func_80088AA0(180); } @@ -156,56 +156,56 @@ void func_80A6E630(EnHs* this, GlobalContext* globalCtx) { this->unk_2A8 |= 1; } -void func_80A6E6B0(EnHs* this, GlobalContext* globalCtx) { - func_80A6E53C(this, globalCtx, 0x10B6, func_80A6E5EC); +void func_80A6E6B0(EnHs* this, PlayState* play) { + func_80A6E53C(this, play, 0x10B6, func_80A6E5EC); } -void func_80A6E6D8(EnHs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6E6D8(EnHs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A6E3A0(this, func_80A6E9AC); } } -void func_80A6E70C(EnHs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6E70C(EnHs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A6E3A0(this, func_80A6E9AC); } } -void func_80A6E740(EnHs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A6E740(EnHs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_80A6E3A0(this, func_80A6E630); } else { if (gSaveContext.n64ddFlag) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TRADE_COJIRO, GI_ODD_MUSHROOM); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_COJIRO); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 10000.0f, 50.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_COJIRO); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 10000.0f, 50.0f); } else { s32 itemId = GI_ODD_MUSHROOM; - func_8002F434(&this->actor, globalCtx, itemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, itemId, 10000.0f, 50.0f); } } this->unk_2A8 |= 1; } -void func_80A6E7BC(EnHs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80A6E7BC(EnHs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_80A6E3A0(this, func_80A6E740); if (gSaveContext.n64ddFlag) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TRADE_COJIRO, GI_ODD_MUSHROOM); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_COJIRO); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 10000.0f, 50.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_COJIRO); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 10000.0f, 50.0f); } else { s32 itemId = GI_ODD_MUSHROOM; - func_8002F434(&this->actor, globalCtx, itemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, itemId, 10000.0f, 50.0f); } break; case 1: - Message_ContinueTextbox(globalCtx, 0x10B4); + Message_ContinueTextbox(play, 0x10B4); func_80A6E3A0(this, func_80A6E70C); break; } @@ -217,11 +217,11 @@ void func_80A6E7BC(EnHs* this, GlobalContext* globalCtx) { this->unk_2A8 |= 1; } -void func_80A6E8CC(EnHs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6E8CC(EnHs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x10B3); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x10B3); func_80A6E3A0(this, func_80A6E7BC); Animation_Change(&this->skelAnime, &object_hs_Anim_000528, 1.0f, 0.0f, Animation_GetLastFrame(&object_hs_Anim_000528), ANIMMODE_LOOP, 8.0f); @@ -237,12 +237,12 @@ void func_80A6E8CC(EnHs* this, GlobalContext* globalCtx) { this->unk_2A8 |= 1; } -void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6E9AC(EnHs* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - if (func_8002F368(globalCtx) == 7) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { + if (func_8002F368(play) == 7) { player->actor.textId = 0x10B2; func_80A6E3A0(this, func_80A6E8CC); Animation_Change(&this->skelAnime, &object_hs_Anim_000304, 1.0f, 0.0f, @@ -257,27 +257,27 @@ void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx) { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; this->actor.textId = 0x10B1; if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F298(&this->actor, globalCtx, 100.0f, 7); + func_8002F298(&this->actor, play, 100.0f, 7); } } } -void EnHs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Update(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; s32 pad; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 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); if (this->unk_2A8 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); this->unk_2A8 &= ~1; } else { Math_SmoothStepToS(&this->unk_29C.x, 12800, 6, 6200, 100); @@ -287,7 +287,7 @@ void EnHs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHs* this = (EnHs*)thisx; switch (limbIndex) { @@ -317,7 +317,7 @@ s32 EnHs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnHs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80A6EDFC = { 300.0f, 1000.0f, 0.0f }; EnHs* this = (EnHs*)thisx; @@ -326,10 +326,10 @@ void EnHs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnHs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Draw(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHs_OverrideLimbDraw, EnHs_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.h b/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.h index 4a6576ddc..f4b89ce15 100644 --- a/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.h +++ b/soh/src/overlays/actors/ovl_En_Hs/z_en_hs.h @@ -6,7 +6,7 @@ struct EnHs; -typedef void (*EnHsActionFunc)(struct EnHs*, GlobalContext*); +typedef void (*EnHsActionFunc)(struct EnHs*, PlayState*); typedef struct EnHs { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index d70164af5..ca3a2f8fa 100644 --- a/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -10,11 +10,11 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHs2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHs2_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80A6F1A4(EnHs2* this, GlobalContext* globalCtx); +void EnHs2_Init(Actor* thisx, PlayState* play); +void EnHs2_Destroy(Actor* thisx, PlayState* play); +void EnHs2_Update(Actor* thisx, PlayState* play); +void EnHs2_Draw(Actor* thisx, PlayState* play); +void func_80A6F1A4(EnHs2* this, PlayState* play); const ActorInit En_Hs2_InitVars = { ACTOR_EN_HS2, @@ -49,16 +49,16 @@ static ColliderCylinderInit sCylinderInit = { { 40, 40, 0, { 0, 0, 0 } }, }; -void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Init(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &object_hs_Anim_0005C0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコの店(子人の時) \n" VT_RST); @@ -67,14 +67,14 @@ void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnHs2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Destroy(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A6F0B4(EnHs2* this, GlobalContext* globalCtx, u16 textId, EnHs2ActionFunc actionFunc) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80A6F0B4(EnHs2* this, PlayState* play, u16 textId, EnHs2ActionFunc actionFunc) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; return 1; } @@ -83,43 +83,43 @@ s32 func_80A6F0B4(EnHs2* this, GlobalContext* globalCtx, u16 textId, EnHs2Action if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x2151 && this->actor.xzDistToPlayer < 100.0f) { this->unk_2A8 |= 0x1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } -void func_80A6F164(EnHs2* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6F164(EnHs2* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80A6F1A4; } this->unk_2A8 |= 0x1; } -void func_80A6F1A4(EnHs2* this, GlobalContext* globalCtx) { +void func_80A6F1A4(EnHs2* this, PlayState* play) { u16 textId; - textId = Text_GetFaceReaction(globalCtx, 9); + textId = Text_GetFaceReaction(play, 9); if (textId == 0) { textId = 0x5069; } - func_80A6F0B4(this, globalCtx, textId, func_80A6F164); + func_80A6F0B4(this, play, textId, func_80A6F164); } -void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Update(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (SkelAnime_Update(&this->skelAnime) != 0) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_2A8 & 0x1) { - func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); this->unk_2A8 &= ~1; } else { Math_SmoothStepToS(&this->unk_29C.x, 12800, 6, 6200, 100); @@ -129,7 +129,7 @@ void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHs2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHs2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHs2* this = (EnHs2*)thisx; switch (limbIndex) { @@ -151,7 +151,7 @@ s32 EnHs2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnHs2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHs2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80A6F4CC = { 300.0f, 1000.0f, 0.0f }; EnHs2* this = (EnHs2*)thisx; @@ -160,10 +160,10 @@ void EnHs2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnHs2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Draw(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHs2_OverrideLimbDraw, EnHs2_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h b/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h index e006b91f7..e2f66f79c 100644 --- a/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h +++ b/soh/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h @@ -6,7 +6,7 @@ struct EnHs2; -typedef void (*EnHs2ActionFunc)(struct EnHs2*, GlobalContext*); +typedef void (*EnHs2ActionFunc)(struct EnHs2*, PlayState*); typedef struct EnHs2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c index eaeef86c7..a7b81c8f1 100644 --- a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -17,20 +17,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnHy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHy_Init(Actor* thisx, PlayState* play); +void EnHy_Destroy(Actor* thisx, PlayState* play); +void EnHy_Update(Actor* thisx, PlayState* play); +void EnHy_Draw(Actor* thisx, PlayState* play); -void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx); -void func_80A7134C(EnHy* this, GlobalContext* globalCtx); -void func_80A71530(EnHy* this, GlobalContext* globalCtx); -void func_80A711B4(EnHy* this, GlobalContext* globalCtx); -void func_80A712C0(EnHy* this, GlobalContext* globalCtx); -void func_80A710F8(EnHy* this, GlobalContext* globalCtx); -void func_80A7127C(EnHy* this, GlobalContext* globalCtx); -void EnHy_DoNothing(EnHy* this, GlobalContext* globalCtx); -void func_80A714C4(EnHy* this, GlobalContext* globalCtx); +void EnHy_InitImpl(EnHy* this, PlayState* play); +void func_80A7134C(EnHy* this, PlayState* play); +void func_80A71530(EnHy* this, PlayState* play); +void func_80A711B4(EnHy* this, PlayState* play); +void func_80A712C0(EnHy* this, PlayState* play); +void func_80A710F8(EnHy* this, PlayState* play); +void func_80A7127C(EnHy* this, PlayState* play); +void EnHy_DoNothing(EnHy* this, PlayState* play); +void func_80A714C4(EnHy* this, PlayState* play); const ActorInit En_Hy_InitVars = { ACTOR_EN_HY, @@ -352,22 +352,22 @@ static EnHyInit2Info sInit2Info[] = { /* ENHY_TYPE_AHG_20 */ { 20.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, 0x06, 30.0f }, }; -s32 EnHy_FindSkelAndHeadObjects(EnHy* this, GlobalContext* globalCtx) { +s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) { u8 headInfoIndex = sModelInfo[this->actor.params & 0x7F].headInfoIndex; u8 skelInfoIndex2 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex2; u8 skelInfoIndex1 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex1; - this->objBankIndexSkel1 = Object_GetIndex(&globalCtx->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId); + this->objBankIndexSkel1 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId); if (this->objBankIndexSkel1 < 0) { return false; } - this->objBankIndexSkel2 = Object_GetIndex(&globalCtx->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId); + this->objBankIndexSkel2 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId); if (this->objBankIndexSkel2 < 0) { return false; } - this->objBankIndexHead = Object_GetIndex(&globalCtx->objectCtx, sHeadInfo[headInfoIndex].objectId); + this->objBankIndexHead = Object_GetIndex(&play->objectCtx, sHeadInfo[headInfoIndex].objectId); if (this->objBankIndexHead < 0) { return false; } @@ -375,24 +375,24 @@ s32 EnHy_FindSkelAndHeadObjects(EnHy* this, GlobalContext* globalCtx) { return true; } -s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexSkel1)) { +s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel1)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexSkel2)) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel2)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexHead)) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexHead)) { return false; } return true; } -s32 EnHy_FindOsAnimeObject(EnHy* this, GlobalContext* globalCtx) { - this->objBankIndexOsAnime = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); +s32 EnHy_FindOsAnimeObject(EnHy* this, PlayState* play) { + this->objBankIndexOsAnime = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if (this->objBankIndexOsAnime < 0) { return false; @@ -401,24 +401,24 @@ s32 EnHy_FindOsAnimeObject(EnHy* this, GlobalContext* globalCtx) { return true; } -s32 EnHy_IsOsAnimeObjectLoaded(EnHy* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexOsAnime)) { +s32 EnHy_IsOsAnimeObjectLoaded(EnHy* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexOsAnime)) { return false; } return true; } -void func_80A6F7CC(EnHy* this, GlobalContext* globalCtx, s32 getItemId) { +void func_80A6F7CC(EnHy* this, PlayState* play, s32 getItemId) { this->unkGetItemId = getItemId; - func_8002F434(&this->actor, globalCtx, getItemId, this->actor.xzDistToPlayer + 1.0f, + func_8002F434(&this->actor, play, getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } -u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 func_80A6F810(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); EnHy* this = (EnHy*)thisx; - u16 textId = Text_GetFaceReaction(globalCtx, (this->actor.params & 0x7F) + 37); + u16 textId = Text_GetFaceReaction(play, (this->actor.params & 0x7F) + 37); if (textId != 0) { if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) { @@ -429,9 +429,9 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { switch (this->actor.params & 0x7F) { case ENHY_TYPE_AOB: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return (this->unk_330 & 0x800) ? 0x508D : ((gSaveContext.infTable[12] & 0x800) ? 0x508C : 0x508B); - } else if (globalCtx->sceneNum == SCENE_MARKET_DAY) { + } else if (play->sceneNum == SCENE_MARKET_DAY) { return (gSaveContext.eventInf[3] & 1) ? 0x709B : 0x709C; } else if (gSaveContext.dogIsLost) { s16 followingDog = (gSaveContext.dogParams & 0xF00) >> 8; @@ -452,9 +452,9 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { return (gSaveContext.infTable[12] & 1) ? 0x7017 : 0x7016; } case ENHY_TYPE_AHG_2: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return 0x5086; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return 0x5085; } else if (gSaveContext.eventChkInf[8] & 1) { return (gSaveContext.infTable[12] & 8) ? 0x701A : 0x7047; @@ -477,9 +477,9 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { case ENHY_TYPE_BBA: return (gSaveContext.eventChkInf[8] & 1) ? 0x704A : ((gSaveContext.infTable[12] & 0x40) ? 0x7022 : 0x7021); case ENHY_TYPE_BJI_7: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return 0x5088; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return 0x5087; } else { return (gSaveContext.eventChkInf[8] & 1) ? 0x704D @@ -492,18 +492,18 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { return (gSaveContext.infTable[12] & 0x100) ? 0x701E : 0x701D; } case ENHY_TYPE_BOJ_9: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return (gSaveContext.eventChkInf[10] & 0x400) ? 0x5082 : 0x5081; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) ? 0x5080 : 0x507F; } else { return (gSaveContext.eventChkInf[8] & 1) ? 0x7049 : ((gSaveContext.infTable[12] & 0x400) ? 0x7020 : 0x701F); } case ENHY_TYPE_BOJ_10: - if (globalCtx->sceneNum == SCENE_LABO) { + if (play->sceneNum == SCENE_LABO) { return (gSaveContext.eventChkInf[10] & 0x400) ? 0x507E : 0x507D; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) ? 0x507C : 0x507B; } else { return (gSaveContext.eventChkInf[8] & 1) ? 0x7046 @@ -513,7 +513,7 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { return (gSaveContext.infTable[8] & 0x800) ? ((gSaveContext.infTable[12] & 0x1000) ? 0x7014 : 0x70A4) : 0x7014; case ENHY_TYPE_BOJ_12: - if (globalCtx->sceneNum == SCENE_SPOT01) { + if (play->sceneNum == SCENE_SPOT01) { return !IS_DAY ? 0x5084 : 0x5083; } else { return (gSaveContext.eventChkInf[8] & 1) ? 0x7044 : 0x7015; @@ -553,12 +553,12 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { } } -s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A70058(PlayState* play, Actor* thisx) { EnHy* this = (EnHy*)thisx; s16 beggarItems[] = { ITEM_BLUE_FIRE, ITEM_FISH, ITEM_BUG, ITEM_FAIRY }; s16 beggarRewards[] = { 150, 100, 50, 25 }; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CHOICE: @@ -596,7 +596,7 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { case 0x70F3: Rupees_ChangeBy(beggarRewards[this->actor.textId - 0x70F0]); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_17); - Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); break; case 0x7016: gSaveContext.infTable[12] |= 1; @@ -660,15 +660,15 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { break; case 0x709F: if (gSaveContext.infTable[25] & 2) { // Already brought the lost dog back - func_80A6F7CC(this, globalCtx, GI_RUPEE_BLUE); + func_80A6F7CC(this, play, GI_RUPEE_BLUE); } else { if (!gSaveContext.n64ddFlag) { - func_80A6F7CC(this, globalCtx, GI_HEART_PIECE); + func_80A6F7CC(this, play, GI_HEART_PIECE); } else { this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_LOST_DOG, GI_HEART_PIECE); // The follownig line and last arguments of GiveItemEntryFromActor are copied from func_80A6F7CC this->unkGetItemId = this->getItemEntry.getItemId; - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } } this->actionFunc = func_80A714C4; @@ -676,7 +676,7 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { } return 0; case TEXT_STATE_EVENT: - if (!Message_ShouldAdvance(globalCtx)) { + if (!Message_ShouldAdvance(play)) { return 1; } else { return 2; @@ -717,7 +717,7 @@ void EnHy_InitSetProperties(EnHy* this) { this->unkRange += this->collider.dim.radius; } -void EnHy_UpdateCollider(EnHy* this, GlobalContext* globalCtx) { +void EnHy_UpdateCollider(EnHy* this, PlayState* play) { Vec3s pos; pos.x = this->actor.world.pos.x; @@ -727,29 +727,29 @@ void EnHy_UpdateCollider(EnHy* this, GlobalContext* globalCtx) { pos.y += sColliderInfo[this->actor.params & 0x7F].offset.y; pos.z += sColliderInfo[this->actor.params & 0x7F].offset.z; this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80A70834(EnHy* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A70834(EnHy* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) { if (!Inventory_HasSpecificBottle(ITEM_BLUE_FIRE) && !Inventory_HasSpecificBottle(ITEM_BUG) && !Inventory_HasSpecificBottle(ITEM_FISH)) { - switch (func_8002F368(globalCtx)) { + switch (func_8002F368(play)) { case EXCH_ITEM_POE: case EXCH_ITEM_BIG_POE: case EXCH_ITEM_LETTER_RUTO: this->actor.textId = 0x70EF; break; default: - if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { + if (Player_GetMask(play) == PLAYER_MASK_NONE) { this->actor.textId = 0x70ED; } break; } } else { - switch (func_8002F368(globalCtx)) { + switch (func_8002F368(play)) { case EXCH_ITEM_BLUE_FIRE: this->actor.textId = 0x70F0; break; @@ -760,7 +760,7 @@ void func_80A70834(EnHy* this, GlobalContext* globalCtx) { this->actor.textId = 0x70F2; break; default: - if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { + if (Player_GetMask(play) == PLAYER_MASK_NONE) { this->actor.textId = 0x700C; } break; @@ -771,8 +771,8 @@ void func_80A70834(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A70978(EnHy* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A70978(EnHy* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; switch (this->actor.params & 0x7F) { @@ -808,13 +808,13 @@ void func_80A70978(EnHy* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E8, sInit1Info[this->actor.params & 0x7F].unkPresetIndex, phi_a3); - if (func_800343CC(globalCtx, &this->actor, &this->unk_1E8.unk_00, this->unkRange, func_80A6F810, func_80A70058)) { - func_80A70834(this, globalCtx); + if (func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, this->unkRange, func_80A6F810, func_80A70058)) { + func_80A70834(this, play); } } -s32 EnHy_ShouldSpawn(EnHy* this, GlobalContext* globalCtx) { - switch (globalCtx->sceneNum) { +s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) { + switch (play->sceneNum) { case SCENE_SPOT01: if (!((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_9 || (this->actor.params & 0x7F) == ENHY_TYPE_BOJ_10 || (this->actor.params & 0x7F) == ENHY_TYPE_BOJ_12 || (this->actor.params & 0x7F) == ENHY_TYPE_AHG_2 || @@ -882,15 +882,15 @@ s32 EnHy_ShouldSpawn(EnHy* this, GlobalContext* globalCtx) { } } -void EnHy_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Init(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; - if ((this->actor.params & 0x7F) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, globalCtx) || - !EnHy_FindSkelAndHeadObjects(this, globalCtx)) { + if ((this->actor.params & 0x7F) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, play) || + !EnHy_FindSkelAndHeadObjects(this, play)) { Actor_Kill(&this->actor); } - if (!EnHy_ShouldSpawn(this, globalCtx)) { + if (!EnHy_ShouldSpawn(this, play)) { Actor_Kill(&this->actor); } @@ -898,38 +898,38 @@ void EnHy_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnHy_InitImpl; } -void EnHy_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Destroy(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { - if (EnHy_IsOsAnimeObjectLoaded(this, globalCtx) && EnHy_AreSkelAndHeadObjectsLoaded(this, globalCtx)) { +void EnHy_InitImpl(EnHy* this, PlayState* play) { + if (EnHy_IsOsAnimeObjectLoaded(this, play) && EnHy_AreSkelAndHeadObjectsLoaded(this, play)) { this->actor.objBankIndex = this->objBankIndexSkel1; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->actor.objBankIndex].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, sSkeletonInfo[sModelInfo[this->actor.params & 0x7F].skelInfoIndex1].skeleton, NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexOsAnime].segment); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColCylInit); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); EnHy_InitCollider(this); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, sModelInfo[this->actor.params & 0x7F].animInfoIndex); - if ((globalCtx->sceneNum == SCENE_MARKET_ALLEY) || (globalCtx->sceneNum == SCENE_MARKET_DAY)) { + if ((play->sceneNum == SCENE_MARKET_ALLEY) || (play->sceneNum == SCENE_MARKET_DAY)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.uncullZoneScale = 0.0f; } - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { this->unk_330 = gSaveContext.eventChkInf[6]; } EnHy_InitSetProperties(this); - this->path = Path_GetByIndex(globalCtx, (this->actor.params & 0x780) >> 7, 15); + this->path = Path_GetByIndex(play, (this->actor.params & 0x780) >> 7, 15); switch (this->actor.params & 0x7F) { case ENHY_TYPE_BOJ_3: @@ -943,7 +943,7 @@ void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { this->actionFunc = func_80A712C0; break; case ENHY_TYPE_AOB: - if (globalCtx->sceneNum == SCENE_MARKET_DAY) { + if (play->sceneNum == SCENE_MARKET_DAY) { this->actionFunc = func_80A710F8; break; } @@ -977,7 +977,7 @@ void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A710F8(EnHy* this, GlobalContext* globalCtx) { +void func_80A710F8(EnHy* this, PlayState* play) { if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gObjOsAnim_0BFC) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_26); @@ -991,7 +991,7 @@ void func_80A710F8(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A711B4(EnHy* this, GlobalContext* globalCtx) { +void func_80A711B4(EnHy* this, PlayState* play) { s16 yaw; f32 distSq; @@ -1007,24 +1007,24 @@ void func_80A711B4(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A7127C(EnHy* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_21C, this->unk_23C, 16); +void func_80A7127C(EnHy* this, PlayState* play) { + func_80034F54(play, this->unk_21C, this->unk_23C, 16); } -void EnHy_DoNothing(EnHy* this, GlobalContext* globalCtx) { +void EnHy_DoNothing(EnHy* this, PlayState* play) { } -void func_80A712C0(EnHy* this, GlobalContext* globalCtx) { +void func_80A712C0(EnHy* this, PlayState* play) { if ((this->actor.xzDistToPlayer <= 100.0f) && (this->path != NULL)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_7); this->actor.speedXZ = 0.4f; this->actionFunc = func_80A7134C; } - func_80034F54(globalCtx, this->unk_21C, this->unk_23C, 16); + func_80034F54(play, this->unk_21C, this->unk_23C, 16); } -void func_80A7134C(EnHy* this, GlobalContext* globalCtx) { +void func_80A7134C(EnHy* this, PlayState* play) { s16 yaw; f32 distSq; @@ -1058,20 +1058,20 @@ void func_80A7134C(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A714C4(EnHy* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A714C4(EnHy* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80A71530; } else { if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + func_8002F434(&this->actor, play, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } } } -void func_80A71530(EnHy* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A71530(EnHy* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (gSaveContext.n64ddFlag) { if (!(gSaveContext.infTable[25] & 2)) { gSaveContext.infTable[25] |= 2; @@ -1096,11 +1096,11 @@ void func_80A71530(EnHy* this, GlobalContext* globalCtx) { } } -void EnHy_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Update(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; if (this->actionFunc != EnHy_InitImpl) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexOsAnime].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment); SkelAnime_Update(&this->skelAnime); EnHy_UpdateEyes(this); @@ -1108,26 +1108,26 @@ void EnHy_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&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); - func_80A70978(this, globalCtx); - EnHy_UpdateCollider(this, globalCtx); + this->actionFunc(this, play); + func_80A70978(this, play); + EnHy_UpdateCollider(this, play); } -s32 EnHy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHy* this = (EnHy*)thisx; s32 pad; Vec3s sp48; u8 i; UNK_PTR ptr; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 15) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objBankIndexHead].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexHead].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexHead].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexHead].segment); i = sModelInfo[this->actor.params & 0x7F].headInfoIndex; *dList = sHeadInfo[i].headDList; @@ -1136,7 +1136,7 @@ s32 EnHy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(ptr)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexSkel1].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel1].segment); } if (limbIndex == 15) { @@ -1158,21 +1158,21 @@ s32 EnHy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, rot->z += Math_CosS(this->unk_23C[limbIndex]) * 200.0f; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return false; } -void EnHy_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnHy* this = (EnHy*)thisx; s32 pad; Vec3f sp3C = { 400.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 7) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objBankIndexSkel2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexSkel2].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexSkel2].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel2].segment); } if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_3 && limbIndex == 8) { @@ -1183,29 +1183,29 @@ void EnHy_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Matrix_MultVec3f(&sp3C, &this->actor.focus.pos); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -Gfx* EnHy_SetEnvColor(GraphicsContext* globalCtx, u8 envR, u8 envG, u8 envB, u8 envA) { +Gfx* EnHy_SetEnvColor(GraphicsContext* play, u8 envR, u8 envG, u8 envB, u8 envA) { Gfx* dList; - dList = Graph_Alloc(globalCtx, 2 * sizeof(Gfx)); + dList = Graph_Alloc(play, 2 * sizeof(Gfx)); gDPSetEnvColor(dList, envR, envG, envB, envA); gSPEndDisplayList(dList + 1); return dList; } -void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Draw(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; Color_RGBA8 envColorSeg8; Color_RGBA8 envColorSeg9; Color_RGBA8 envColorSeg10; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc != EnHy_InitImpl) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->modelOffset.x, this->modelOffset.y, this->modelOffset.z, MTXMODE_APPLY); envColorSeg8 = sModelInfo[this->actor.params & 0x7F].envColorSeg8; envColorSeg9 = sModelInfo[this->actor.params & 0x7F].envColorSeg9; @@ -1233,10 +1233,10 @@ void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx) { case ENHY_TYPE_BJI_19: case ENHY_TYPE_AHG_20: gSPSegment(POLY_OPA_DISP++, 0x08, - EnHy_SetEnvColor(globalCtx->state.gfxCtx, envColorSeg8.r, envColorSeg8.g, envColorSeg8.b, + EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg8.r, envColorSeg8.g, envColorSeg8.b, envColorSeg8.a)); gSPSegment(POLY_OPA_DISP++, 0x09, - EnHy_SetEnvColor(globalCtx->state.gfxCtx, envColorSeg9.r, envColorSeg9.g, envColorSeg9.b, + EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg9.r, envColorSeg9.g, envColorSeg9.b, envColorSeg9.a)); if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_8 || (this->actor.params & 0x7F) == ENHY_TYPE_CNE_11) { @@ -1248,15 +1248,15 @@ void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx) { envColorSeg10.a = 0; } gSPSegment(POLY_OPA_DISP++, 0x0A, - EnHy_SetEnvColor(globalCtx->state.gfxCtx, envColorSeg10.r, envColorSeg10.g, + EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg10.r, envColorSeg10.g, envColorSeg10.b, envColorSeg10.a)); } break; } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHy_OverrideLimbDraw, EnHy_PostLimbDraw, &this->actor); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h index 253d8df7d..1318305e9 100644 --- a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -31,7 +31,7 @@ typedef enum { struct EnHy; -typedef void (*EnHyActionFunc)(struct EnHy*, GlobalContext*); +typedef void (*EnHyActionFunc)(struct EnHy*, PlayState*); typedef struct EnHy { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index dc8a8228b..a2a5d1c34 100644 --- a/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void EnIceHono_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIceHono_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIceHono_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIceHono_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIceHono_Init(Actor* thisx, PlayState* play); +void EnIceHono_Destroy(Actor* thisx, PlayState* play); +void EnIceHono_Update(Actor* thisx, PlayState* play); +void EnIceHono_Draw(Actor* thisx, PlayState* play); -void EnIceHono_CapturableFlame(EnIceHono* this, GlobalContext* globalCtx); -void EnIceHono_DropFlame(EnIceHono* this, GlobalContext* globalCtx); -void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx); -void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx); +void EnIceHono_CapturableFlame(EnIceHono* this, PlayState* play); +void EnIceHono_DropFlame(EnIceHono* this, PlayState* play); +void EnIceHono_SpreadFlames(EnIceHono* this, PlayState* play); +void EnIceHono_SmallFlameMove(EnIceHono* this, PlayState* play); void EnIceHono_SetupActionCapturableFlame(EnIceHono* this); void EnIceHono_SetupActionDroppedFlame(EnIceHono* this); @@ -101,7 +101,7 @@ f32 EnIceHono_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { return SQ(v1->x - v2->x) + SQ(v1->z - v2->z); } -void EnIceHono_InitCapturableFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_InitCapturableFlame(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; Actor_ProcessInitChain(&this->actor, sInitChainCapturableFlame); @@ -109,15 +109,15 @@ void EnIceHono_InitCapturableFlame(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; Actor_SetFocus(&this->actor, 10.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitCapturableFlame); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitCapturableFlame); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.colChkInfo.mass = MASS_IMMOVABLE; EnIceHono_SetupActionCapturableFlame(this); } -void EnIceHono_InitDroppedFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_InitDroppedFlame(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; Actor_ProcessInitChain(&this->actor, sInitChainDroppedFlame); @@ -128,8 +128,8 @@ void EnIceHono_InitDroppedFlame(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = 0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitDroppedFlame); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitDroppedFlame); Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 4000.4f; @@ -138,7 +138,7 @@ void EnIceHono_InitDroppedFlame(Actor* thisx, GlobalContext* globalCtx) { EnIceHono_SetupActionDroppedFlame(this); } -void EnIceHono_InitSmallFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_InitSmallFlame(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; Actor_ProcessInitChain(&this->actor, sInitChainSmallFlame); @@ -150,44 +150,44 @@ void EnIceHono_InitSmallFlame(Actor* thisx, GlobalContext* globalCtx) { EnIceHono_SetupActionSmallFlame(this); } -void EnIceHono_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Init(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; s16 params = this->actor.params; switch (this->actor.params) { case -1: - EnIceHono_InitCapturableFlame(&this->actor, globalCtx); + EnIceHono_InitCapturableFlame(&this->actor, play); break; case 0: - EnIceHono_InitDroppedFlame(&this->actor, globalCtx); + EnIceHono_InitDroppedFlame(&this->actor, play); break; case 1: case 2: - EnIceHono_InitSmallFlame(&this->actor, globalCtx); + EnIceHono_InitSmallFlame(&this->actor, play); break; } if ((this->actor.params == -1) || (this->actor.params == 0)) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 10, this->actor.world.pos.z, 155, 210, 255, 0); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_154 = Rand_ZeroOne() * (0x1FFFF / 2.0f); this->unk_156 = Rand_ZeroOne() * (0x1FFFF / 2.0f); osSyncPrintf("(ice 炎)(arg_data 0x%04x)\n", this->actor.params); // "(ice flame)" } } -void EnIceHono_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Destroy(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; if ((this->actor.params == -1) || (this->actor.params == 0)) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); } } -u32 EnIceHono_InBottleRange(EnIceHono* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u32 EnIceHono_InBottleRange(EnIceHono* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 60.0f) { Vec3f tempPos; @@ -211,16 +211,16 @@ void EnIceHono_SetupActionCapturableFlame(EnIceHono* this) { this->actor.shape.yOffset = -1000.0f; } -void EnIceHono_CapturableFlame(EnIceHono* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnIceHono_CapturableFlame(EnIceHono* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - } else if (EnIceHono_InBottleRange(this, globalCtx)) { + } else if (EnIceHono_InBottleRange(this, play)) { // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 60.0f, 100.0f); + func_8002F434(&this->actor, play, GI_MAX, 60.0f, 100.0f); } if (this->actor.xzDistToPlayer < 200.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } func_8002F8F0(&this->actor, NA_SE_EV_FIRE_PILLAR_S - SFX_FLAG); } @@ -231,7 +231,7 @@ void EnIceHono_SetupActionDroppedFlame(EnIceHono* this) { this->alpha = 255; } -void EnIceHono_DropFlame(EnIceHono* this, GlobalContext* globalCtx) { +void EnIceHono_DropFlame(EnIceHono* this, PlayState* play) { u32 bgFlag = this->actor.bgCheckFlags & 1; Math_StepToF(&this->actor.scale.x, 0.0017f, 0.00008f); @@ -241,19 +241,19 @@ void EnIceHono_DropFlame(EnIceHono* this, GlobalContext* globalCtx) { if (bgFlag != 0) { s32 i; for (i = 0; i < 8; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, ((s32)(Rand_ZeroOne() * 1000.0f) + i * 0x2000) - 0x1F4, 0, 1); } EnIceHono_SetupActionSpreadFlames(this); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, 5); Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 4000.0f; this->collider.dim.height = this->actor.scale.y * 8000.0f; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->timer <= 0) { Actor_Kill(&this->actor); @@ -266,7 +266,7 @@ void EnIceHono_SetupActionSpreadFlames(EnIceHono* this) { this->alpha = 255; } -void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx) { +void EnIceHono_SpreadFlames(EnIceHono* this, PlayState* play) { if (this->timer > 20) { Math_StepToF(&this->actor.scale.x, 0.011f, 0.00014f); Math_StepToF(&this->actor.scale.y, 0.006f, 0.00012f); @@ -276,7 +276,7 @@ void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx) { } this->actor.scale.z = this->actor.scale.x; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, 4); if (this->timer < 25) { this->alpha -= 10; this->alpha = CLAMP(this->alpha, 0, 255); @@ -286,13 +286,13 @@ void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 6000.0f; this->collider.dim.height = this->actor.scale.y * 8000.0f; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->timer == 46) { s32 i; for (i = 0; i < 10; i++) { s32 rot = i * 0x1999; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, ((s32)(Rand_ZeroOne() * 1000.0f) + rot) - 0x1F4, 0, 2); } @@ -316,7 +316,7 @@ void EnIceHono_SetupActionSmallFlame(EnIceHono* this) { } } -void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx) { +void EnIceHono_SmallFlameMove(EnIceHono* this, PlayState* play) { if (this->timer > 20) { Math_StepToF(&this->actor.scale.x, 0.006f, 0.00016f); Math_StepToF(&this->actor.scale.y, this->smallFlameTargetYScale * 0.667f, 0.00014f); @@ -327,7 +327,7 @@ void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx) { this->actor.scale.z = this->actor.scale.x; Math_StepToF(&this->actor.speedXZ, 0, 0.06f); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 5); if (this->timer < 25) { this->alpha -= 10; @@ -338,7 +338,7 @@ void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx) { } } -void EnIceHono_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Update(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; s32 pad1; f32 intensity; @@ -367,32 +367,32 @@ void EnIceHono_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void EnIceHono_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Draw(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; u32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (globalCtx->state.frames * -20) % 512, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->state.frames * -20) % 512, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 0); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), 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++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h b/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h index 8c6b8df3c..e5ad5fd1c 100644 --- a/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h +++ b/soh/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h @@ -6,7 +6,7 @@ struct EnIceHono; -typedef void (*EnIceHonoActionFunc)(struct EnIceHono*, GlobalContext*); +typedef void (*EnIceHonoActionFunc)(struct EnIceHono*, PlayState*); typedef struct EnIceHono { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 6d97f0f83..4b344e984 100644 --- a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -11,46 +11,46 @@ #define FLAGS ACTOR_FLAG_4 -typedef void (*EnIkDrawFunc)(struct EnIk*, GlobalContext*); +typedef void (*EnIkDrawFunc)(struct EnIk*, PlayState*); -void EnIk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIk_Init(Actor* thisx, PlayState* play); +void EnIk_Destroy(Actor* thisx, PlayState* play); +void EnIk_Update(Actor* thisx, PlayState* play); +void EnIk_Draw(Actor* thisx, PlayState* play); void func_80A74714(EnIk* this); -void func_80A747C0(EnIk* this, GlobalContext* globalCtx); -void func_80A7492C(EnIk* this, GlobalContext* globalCtx); +void func_80A747C0(EnIk* this, PlayState* play); +void func_80A7492C(EnIk* this, PlayState* play); void func_80A74AAC(EnIk* this); -void func_80A74BA4(EnIk* this, GlobalContext* globalCtx); +void func_80A74BA4(EnIk* this, PlayState* play); void func_80A74E2C(EnIk* this); -void func_80A74EBC(EnIk* this, GlobalContext* globalCtx); +void func_80A74EBC(EnIk* this, PlayState* play); void func_80A7506C(EnIk* this); -void func_80A7510C(EnIk* this, GlobalContext* globalCtx); +void func_80A7510C(EnIk* this, PlayState* play); void func_80A751C8(EnIk* this); -void func_80A75260(EnIk* this, GlobalContext* globalCtx); +void func_80A75260(EnIk* this, PlayState* play); void func_80A753D0(EnIk* this); -void func_80A7545C(EnIk* this, GlobalContext* globalCtx); +void func_80A7545C(EnIk* this, PlayState* play); void func_80A754A0(EnIk* this); -void func_80A75530(EnIk* this, GlobalContext* globalCtx); +void func_80A75530(EnIk* this, PlayState* play); void func_80A755F0(EnIk* this); -void func_80A7567C(EnIk* this, GlobalContext* globalCtx); -void func_80A758B0(EnIk* this, GlobalContext* globalCtx); -void func_80A75A38(EnIk* this, GlobalContext* globalCtx); -void func_80A75FA0(Actor* thisx, GlobalContext* globalCtx); -void func_80A76798(Actor* thisx, GlobalContext* globalCtx); -void func_80A7748C(EnIk* this, GlobalContext* globalCtx); -void func_80A774BC(EnIk* this, GlobalContext* globalCtx); -void func_80A774F8(EnIk* this, GlobalContext* globalCtx); -void func_80A77844(EnIk* this, GlobalContext* globalCtx); -void func_80A779DC(EnIk* this, GlobalContext* globalCtx); -void func_80A77AEC(EnIk* this, GlobalContext* globalCtx); -void func_80A77B0C(EnIk* this, GlobalContext* globalCtx); -void func_80A77B3C(EnIk* this, GlobalContext* globalCtx); -void func_80A77ED0(EnIk* this, GlobalContext* globalCtx); -void func_80A77EDC(EnIk* this, GlobalContext* globalCtx); -void func_80A78160(EnIk* this, GlobalContext* globalCtx); -void func_80A781CC(Actor* thisx, GlobalContext* globalCtx); +void func_80A7567C(EnIk* this, PlayState* play); +void func_80A758B0(EnIk* this, PlayState* play); +void func_80A75A38(EnIk* this, PlayState* play); +void func_80A75FA0(Actor* thisx, PlayState* play); +void func_80A76798(Actor* thisx, PlayState* play); +void func_80A7748C(EnIk* this, PlayState* play); +void func_80A774BC(EnIk* this, PlayState* play); +void func_80A774F8(EnIk* this, PlayState* play); +void func_80A77844(EnIk* this, PlayState* play); +void func_80A779DC(EnIk* this, PlayState* play); +void func_80A77AEC(EnIk* this, PlayState* play); +void func_80A77B0C(EnIk* this, PlayState* play); +void func_80A77B3C(EnIk* this, PlayState* play); +void func_80A77ED0(EnIk* this, PlayState* play); +void func_80A77EDC(EnIk* this, PlayState* play); +void func_80A78160(EnIk* this, PlayState* play); +void func_80A781CC(Actor* thisx, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -165,23 +165,23 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -void EnIk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Destroy(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - if (Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_IK, ACTORCAT_ENEMY, 8000.0f) == NULL) { + if (Actor_FindNearby(play, &this->actor, ACTOR_EN_IK, ACTORCAT_ENEMY, 8000.0f) == NULL) { func_800F5B58(); } - Collider_DestroyTris(globalCtx, &this->shieldCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->axeCollider); + Collider_DestroyTris(play, &this->shieldCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->axeCollider); } void EnIk_SetupAction(EnIk* this, EnIkActionFunc actionFunc) { this->actionFunc = actionFunc; } -void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { +void func_80A74398(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 pad; EffectBlureInit1 blureInit; @@ -190,12 +190,12 @@ void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { thisx->draw = func_80A76798; thisx->flags |= ACTOR_FLAG_10; - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, thisx, &sCylinderInit); - Collider_InitTris(globalCtx, &this->shieldCollider); - Collider_SetTris(globalCtx, &this->shieldCollider, thisx, &sTrisInit, this->shieldColliderItems); - Collider_InitQuad(globalCtx, &this->axeCollider); - Collider_SetQuad(globalCtx, &this->axeCollider, thisx, &sQuadInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, thisx, &sCylinderInit); + Collider_InitTris(play, &this->shieldCollider); + Collider_SetTris(play, &this->shieldCollider, thisx, &sTrisInit, this->shieldColliderItems); + Collider_InitQuad(play, &this->axeCollider); + Collider_SetQuad(play, &this->axeCollider, thisx, &sQuadInit); thisx->colChkInfo.damageTable = &sDamageTable; thisx->colChkInfo.mass = MASS_HEAVY; @@ -211,7 +211,7 @@ void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { } else { Actor_SetScale(thisx, 0.012f); thisx->naviEnemyId = 0x35; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ENEMY); } blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = @@ -227,22 +227,22 @@ void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); func_80A74714(this); if (this->switchFlags != 0xFF) { - if (Flags_GetSwitch(globalCtx, this->switchFlags)) { + if (Flags_GetSwitch(play, this->switchFlags)) { Actor_Kill(thisx); } - } else if (thisx->params != 0 && Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + } else if (thisx->params != 0 && Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(thisx); } } -s32 func_80A745E4(EnIk* this, GlobalContext* globalCtx) { +s32 func_80A745E4(EnIk* this, PlayState* play) { if (((this->unk_2FB != 0) || (this->actor.params == 0)) && - (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0) && - (globalCtx->gameplayFrames & 1)) { + (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0) && + (play->gameplayFrames & 1)) { func_80A755F0(this); return true; } else { @@ -250,8 +250,8 @@ s32 func_80A745E4(EnIk* this, GlobalContext* globalCtx) { } } -Actor* func_80A74674(GlobalContext* globalCtx, Actor* actor) { - Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +Actor* func_80A74674(PlayState* play, Actor* actor) { + Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if ((prop == actor) || (prop->id != ACTOR_BG_JYA_IRONOBJ)) { @@ -283,14 +283,14 @@ void func_80A74714(EnIk* this) { EnIk_SetupAction(this, func_80A747C0); } -void func_80A747C0(EnIk* this, GlobalContext* globalCtx) { +void func_80A747C0(EnIk* this, PlayState* play) { Vec3f sp24; if (this->bodyCollider.base.acFlags & AC_HIT) { sp24 = this->actor.world.pos; Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); sp24.y += 30.0f; - func_8003424C(globalCtx, &sp24); + func_8003424C(play, &sp24); this->skelAnime.playSpeed = 1.0f; func_800F5ACC(NA_BGM_MINI_BOSS); } @@ -313,13 +313,13 @@ void func_80A7489C(EnIk* this) { EnIk_SetupAction(this, func_80A7492C); } -void func_80A7492C(EnIk* this, GlobalContext* globalCtx) { +void func_80A7492C(EnIk* this, PlayState* play) { s32 phi_a0 = (this->unk_2FB == 0) ? 0xAAA : 0x3FFC; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) <= phi_a0) && (this->actor.xzDistToPlayer < 100.0f) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { - if ((globalCtx->gameplayFrames & 1)) { + if ((play->gameplayFrames & 1)) { func_80A74E2C(this); } else { func_80A751C8(this); @@ -329,7 +329,7 @@ void func_80A7492C(EnIk* this, GlobalContext* globalCtx) { } else { func_80A74AAC(this); } - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); SkelAnime_Update(&this->skelAnime); } @@ -349,7 +349,7 @@ void func_80A74AAC(EnIk* this) { EnIk_SetupAction(this, func_80A74BA4); } -void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) { +void func_80A74BA4(EnIk* this, PlayState* play) { s16 temp_t0; s16 temp_a1; s16 yawDiff; @@ -379,14 +379,14 @@ void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) <= temp_t0) && (this->actor.xzDistToPlayer < 100.0f)) { if (ABS(this->actor.yDistToPlayer) < 150.0f) { - if ((globalCtx->gameplayFrames & 1)) { + if ((play->gameplayFrames & 1)) { func_80A74E2C(this); } else { func_80A751C8(this); } } } - if (func_80A74674(globalCtx, &this->actor) != NULL) { + if (func_80A74674(play, &this->actor) != NULL) { func_80A751C8(this); this->unk_2FC = 1; } else { @@ -400,7 +400,7 @@ void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) { this->unk_300 = 0x28; } } - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); SkelAnime_Update(&this->skelAnime); if ((sp30 == (s16)this->skelAnime.curFrame) || (sp2E == (s16)this->skelAnime.curFrame)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_WALK); @@ -417,7 +417,7 @@ void func_80A74E2C(EnIk* this) { EnIk_SetupAction(this, func_80A74EBC); } -void func_80A74EBC(EnIk* this, GlobalContext* globalCtx) { +void func_80A74EBC(EnIk* this, PlayState* play) { Vec3f sp2C; if (this->skelAnime.curFrame == 15.0f) { @@ -427,9 +427,9 @@ void func_80A74EBC(EnIk* this, GlobalContext* globalCtx) { sp2C.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y + 0x6A4) * 70.0f; sp2C.y = this->actor.world.pos.y; Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); - Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5); + Camera_AddQuake(&play->mainCamera, 2, 0x19, 5); func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - CollisionCheck_SpawnShieldParticles(globalCtx, &sp2C); + CollisionCheck_SpawnShieldParticles(play, &sp2C); } if ((this->skelAnime.curFrame > 17.0f) && (this->skelAnime.curFrame < 23.0f)) { @@ -459,7 +459,7 @@ void func_80A7506C(EnIk* this) { EnIk_SetupAction(this, func_80A7510C); } -void func_80A7510C(EnIk* this, GlobalContext* globalCtx) { +void func_80A7510C(EnIk* this, PlayState* play) { f32 frames; if (SkelAnime_Update(&this->skelAnime) || (--this->unk_2F9 == 0)) { @@ -485,7 +485,7 @@ void func_80A751C8(EnIk* this) { EnIk_SetupAction(this, func_80A75260); } -void func_80A75260(EnIk* this, GlobalContext* globalCtx) { +void func_80A75260(EnIk* this, PlayState* play) { f32 temp_f0; this->unk_300 += 0x1C2; @@ -522,10 +522,10 @@ void func_80A753D0(EnIk* this) { EnIk_SetupAction(this, func_80A7545C); } -void func_80A7545C(EnIk* this, GlobalContext* globalCtx) { +void func_80A7545C(EnIk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_80A7489C(this); - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); } } @@ -539,7 +539,7 @@ void func_80A754A0(EnIk* this) { EnIk_SetupAction(this, func_80A75530); } -void func_80A75530(EnIk* this, GlobalContext* globalCtx) { +void func_80A75530(EnIk* this, PlayState* play) { Math_StepUntilS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x7D0); this->actor.shape.rot.y = this->actor.world.rot.y; if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 18.0f)) { @@ -552,7 +552,7 @@ void func_80A75530(EnIk* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { func_80A753D0(this); - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); } } @@ -566,12 +566,12 @@ void func_80A755F0(EnIk* this) { EnIk_SetupAction(this, func_80A7567C); } -void func_80A7567C(EnIk* this, GlobalContext* globalCtx) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider.base); +void func_80A7567C(EnIk* this, PlayState* play) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); if (SkelAnime_Update(&this->skelAnime)) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4000) && (this->actor.xzDistToPlayer < 100.0f) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { - if ((globalCtx->gameplayFrames & 1)) { + if ((play->gameplayFrames & 1)) { func_80A74E2C(this); } else { func_80A751C8(this); @@ -602,15 +602,15 @@ void func_80A75790(EnIk* this) { EnIk_SetupAction(this, func_80A758B0); } -void func_80A758B0(EnIk* this, GlobalContext* globalCtx) { +void func_80A758B0(EnIk* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 4)) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params + 4)) { this->bodyBreak.val = BODYBREAK_STATUS_FINISHED; } if (SkelAnime_Update(&this->skelAnime)) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4000) { func_80A7489C(this); - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); } else { func_80A754A0(this); } @@ -630,7 +630,7 @@ void func_80A7598C(EnIk* this) { EnIk_SetupAction(this, func_80A75A38); } -void func_80A75A38(EnIk* this, GlobalContext* globalCtx) { +void func_80A75A38(EnIk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((this->actor.colChkInfo.health == 0) && (this->unk_2F9 != 0)) { s32 i; @@ -643,12 +643,12 @@ void func_80A75A38(EnIk* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(120.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(120.0f); pos.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(50.0f); - EffectSsDeadDb_Spawn(globalCtx, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } if (this->unk_2F9 == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xB0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); if (this->switchFlags != 0xFF) { - Flags_SetSwitch(globalCtx, this->switchFlags); + Flags_SetSwitch(play, this->switchFlags); } Actor_Kill(&this->actor); } @@ -658,7 +658,7 @@ void func_80A75A38(EnIk* this, GlobalContext* globalCtx) { } } -void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { +void func_80A75C38(EnIk* this, PlayState* play) { f32 temp_f0; u8 pad; u8 pad2; @@ -690,7 +690,7 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { if ((this->unk_2FD == 0) || (this->unk_2FD == 0xD) || ((this->unk_2FB == 0) && (this->unk_2FD == 0xE))) { if (this->unk_2FD != 0) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sp38); + CollisionCheck_SpawnShieldParticlesMetal(play, &sp38); } return; } @@ -700,22 +700,22 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { if (this->actor.params != 0) { if ((prevHealth > 10) && (this->actor.colChkInfo.health <= 10)) { this->unk_2FB = 1; - BodyBreak_Alloc(&this->bodyBreak, 3, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 3, play); } } else if (this->actor.colChkInfo.health <= 10) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_LAST_DAMAGE); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_LAST_DAMAGE); if (this->switchFlags != 0xFF) { - Flags_SetSwitch(globalCtx, this->switchFlags); + Flags_SetSwitch(play, this->switchFlags); } return; } else if (prevHealth == 50) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } if (this->actor.colChkInfo.health == 0) { func_80A7598C(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return; } Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x7D0, 0); @@ -736,22 +736,22 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); - CollisionCheck_SpawnShieldParticles(globalCtx, &sp38); + CollisionCheck_SpawnShieldParticles(play, &sp38); } -void func_80A75FA0(Actor* thisx, GlobalContext* globalCtx) { +void func_80A75FA0(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); u8 prevInvincibilityTimer; this->unk_2FA = this->unk_2FB; - func_80A75C38(this, globalCtx); + func_80A75C38(this, play); if ((this->actor.params == 0) && (this->actor.colChkInfo.health <= 10)) { - func_80A781CC(&this->actor, globalCtx); + func_80A781CC(&this->actor, play); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->axeCollider.base.atFlags & AT_HIT) { this->axeCollider.base.atFlags &= ~AT_HIT; if (&player->actor == this->axeCollider.base.at) { @@ -761,28 +761,28 @@ void func_80A75FA0(Actor* thisx, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -64); + play->damagePlayer(play, -64); this->unk_2FE = 0; } } - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); player->invincibilityTimer = prevInvincibilityTimer; } } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 0x1D); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 45.0f; Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if ((this->actor.colChkInfo.health > 0) && (this->actor.colorFilterTimer == 0) && (this->unk_2F8 >= 2)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->unk_2FE > 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->axeCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->axeCollider.base); } if (this->unk_2F8 == 9) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); } } @@ -801,7 +801,7 @@ Gfx* func_80A761B0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 env return displayList; } -s32 EnIk_OverrideLimbDraw3(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnIk_OverrideLimbDraw3(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIk* this = (EnIk*)thisx; if (limbIndex == 12) { @@ -846,18 +846,18 @@ static Vec3f D_80A784D0[] = { { -3000.0, -700.0, -5000.0 }, }; -void EnIk_PostLimbDraw3(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnIk_PostLimbDraw3(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f spF4; Vec3f spE8; EnIk* this = (EnIk*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_2FB & 1) { BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 26, 27, 28, dList, BODYBREAK_OBJECT_DEFAULT); } if (limbIndex == 12) { - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params != 0) { gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_019E08); @@ -896,63 +896,63 @@ void EnIk_PostLimbDraw3(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve switch (limbIndex) { case 22: - 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_ik_DL_016F88); break; case 24: - 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_ik_DL_016EE8); break; case 26: if (!(this->unk_2FA & 1)) { - 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_ik_DL_016BE0); } break; case 27: if (!(this->unk_2FA & 1)) { - 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_ik_DL_016CD8); } break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A76798(Actor* thisx, GlobalContext* globalCtx) { +void func_80A76798(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->actor.params == 0) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(globalCtx->state.gfxCtx, 245, 225, 155, 30, 30, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 255, 40, 0, 40, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->state.gfxCtx, 255, 255, 255, 20, 40, 30)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 245, 225, 155, 30, 30, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 255, 40, 0, 40, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 255, 255, 255, 20, 40, 30)); } else if (this->actor.params == 1) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(globalCtx->state.gfxCtx, 245, 255, 205, 30, 35, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 185, 135, 25, 20, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->state.gfxCtx, 255, 255, 255, 30, 40, 20)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 245, 255, 205, 30, 35, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 185, 135, 25, 20, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 255, 255, 255, 30, 40, 20)); } else if (this->actor.params == 2) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(globalCtx->state.gfxCtx, 55, 65, 55, 0, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 55, 65, 55, 0, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(globalCtx->state.gfxCtx, 255, 255, 255, 180, 180, 180)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 255, 255, 255, 180, 180, 180)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnIk_OverrideLimbDraw3, EnIk_PostLimbDraw3, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnIk_StartMusic(void) { @@ -981,12 +981,12 @@ void func_80A76C14(EnIk* this) { } } -void func_80A76DDC(EnIk* this, GlobalContext* globalCtx, Vec3f* pos) { +void func_80A76DDC(EnIk* this, PlayState* play, Vec3f* pos) { Audio_PlaySoundGeneral(NA_SE_EN_TWINROBA_TRANSFORM, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } -void func_80A76E2C(EnIk* this, GlobalContext* globalCtx, Vec3f* pos) { +void func_80A76E2C(EnIk* this, PlayState* play, Vec3f* pos) { static Vec3f D_80A78514[] = { { 1000.0, -1000.0, 1000.0 }, { 0.0, -1000.0, 0.0 }, { -1000.0, -5000.0, -4000.0 }, { 1000.0, -5000.0, -3000.0 }, { -1000.0, 1000.0, -6000.0 }, { -1000.0, 3000.0, -5000.0 }, @@ -1017,33 +1017,33 @@ void func_80A76E2C(EnIk* this, GlobalContext* globalCtx, Vec3f* pos) { envColor.r += temp_v0; envColor.g += temp_v0; envColor.b += temp_v0; - func_8002829C(globalCtx, &effectPos, &effectVelocity, &effectAccel, &primColor, &envColor, + func_8002829C(play, &effectPos, &effectVelocity, &effectAccel, &primColor, &envColor, (Rand_ZeroOne() * 60.0f) + 300.0f, 0); } this->unk_4D4 = 1; - func_80A76DDC(this, globalCtx, pos); + func_80A76DDC(this, play, pos); } } -void func_80A77034(EnIk* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void func_80A77034(EnIk* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } s32 func_80A7707C(EnIk* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnIk_GetNpcAction(GlobalContext* globalCtx, s32 actionIdx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[actionIdx]; +CsCmdActorAction* EnIk_GetNpcAction(PlayState* play, s32 actionIdx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[actionIdx]; } else { return NULL; } } -void func_80A770C0(EnIk* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = EnIk_GetNpcAction(globalCtx, actionIdx); +void func_80A770C0(EnIk* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = EnIk_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -1065,10 +1065,10 @@ void func_80A77148(EnIk* this) { this->actor.shape.shadowAlpha = 0; } -void func_80A77158(EnIk* this, GlobalContext* globalCtx) { +void func_80A77158(EnIk* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_ik_Anim_00C114, 1.0f, 0.0f, Animation_GetLastFrame(&object_ik_Anim_00C114), ANIMMODE_ONCE, 0.0f); - func_80A770C0(this, globalCtx, 4); + func_80A770C0(this, play, 4); this->action = 1; this->drawMode = 1; this->actor.shape.shadowAlpha = 0xFF; @@ -1083,9 +1083,9 @@ void func_80A771E4(EnIk* this) { this->actor.shape.shadowAlpha = 0xFF; } -void func_80A77264(EnIk* this, GlobalContext* globalCtx, s32 arg2) { - if ((arg2 != 0) && (EnIk_GetNpcAction(globalCtx, 4) != NULL)) { - func_80A78160(this, globalCtx); +void func_80A77264(EnIk* this, PlayState* play, s32 arg2) { + if ((arg2 != 0) && (EnIk_GetNpcAction(play, 4) != NULL)) { + func_80A78160(this, play); } } @@ -1094,60 +1094,60 @@ void func_80A772A4(EnIk* this) { &D_801333E8); } -void func_80A772EC(EnIk* this, GlobalContext* globalCtx) { +void func_80A772EC(EnIk* this, PlayState* play) { static Vec3f D_80A78FA0; s32 pad[2]; f32 wDest; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->actor.world.pos, &D_80A78FA0, &wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &D_80A78FA0, &wDest); Audio_PlaySoundGeneral(NA_SE_EN_IRONNACK_DEAD, &D_80A78FA0, 4, &D_801333E0, &D_801333E0, &D_801333E8); } -void func_80A7735C(EnIk* this, GlobalContext* globalCtx) { +void func_80A7735C(EnIk* this, PlayState* play) { s32 pad[3]; f32 frames = Animation_GetLastFrame(&object_ik_Anim_0203D8); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ik_Skel_0205C0, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ik_Skel_0205C0, NULL, this->jointTable, this->morphTable, 30); Animation_Change(&this->skelAnime, &object_ik_Anim_0203D8, 1.0f, 0.0f, frames, ANIMMODE_ONCE, 0.0f); this->action = 3; this->drawMode = 2; - func_80A770C0(this, globalCtx, 4); - func_80A772EC(this, globalCtx); + func_80A770C0(this, play, 4); + func_80A772EC(this, play); this->actor.shape.shadowAlpha = 0xFF; } -void func_80A77434(EnIk* this, GlobalContext* globalCtx) { +void func_80A77434(EnIk* this, PlayState* play) { this->action = 4; this->drawMode = 2; func_80A772A4(this); this->actor.shape.shadowAlpha = 0xFF; } -void func_80A77474(EnIk* this, GlobalContext* globalCtx) { +void func_80A77474(EnIk* this, PlayState* play) { this->action = 5; this->drawMode = 0; this->actor.shape.shadowAlpha = 0; } -void func_80A7748C(EnIk* this, GlobalContext* globalCtx) { - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); +void func_80A7748C(EnIk* this, PlayState* play) { + func_80A77034(this, play); + func_80A779DC(this, play); } -void func_80A774BC(EnIk* this, GlobalContext* globalCtx) { +void func_80A774BC(EnIk* this, PlayState* play) { func_80A7707C(this); - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); + func_80A77034(this, play); + func_80A779DC(this, play); } -void func_80A774F8(EnIk* this, GlobalContext* globalCtx) { - if (EnIk_GetNpcAction(globalCtx, 4) == NULL) { +void func_80A774F8(EnIk* this, PlayState* play) { + if (EnIk_GetNpcAction(play, 4) == NULL) { Actor_Kill(&this->actor); } } -s32 EnIk_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnIk_OverrideLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIk* this = (EnIk*)thisx; if ((limbIndex == 13) || (limbIndex == 26) || (limbIndex == 27)) { @@ -1159,8 +1159,8 @@ s32 EnIk_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnIk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -1206,27 +1206,27 @@ void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve CLOSE_DISPS(gfxCtx); } -void func_80A77844(EnIk* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80A77844(EnIk* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad[2]; OPEN_DISPS(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(gfxCtx, 245, 225, 155, 30, 30, 0)); gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(gfxCtx, 255, 40, 0, 40, 0, 0)); gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(gfxCtx, 255, 255, 255, 20, 40, 30)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnIk_OverrideLimbDraw2, EnIk_PostLimbDraw2, this); CLOSE_DISPS(gfxCtx); } -void func_80A779DC(EnIk* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnIk_GetNpcAction(globalCtx, 4); +void func_80A779DC(EnIk* this, PlayState* play) { + CsCmdActorAction* npcAction = EnIk_GetNpcAction(play, 4); u32 action; u32 currentNpcAction; @@ -1239,22 +1239,22 @@ void func_80A779DC(EnIk* this, GlobalContext* globalCtx) { func_80A77148(this); break; case 2: - func_80A77158(this, globalCtx); + func_80A77158(this, play); break; case 3: func_80A771E4(this); break; case 4: - func_80A78160(this, globalCtx); + func_80A78160(this, play); break; case 5: - func_80A7735C(this, globalCtx); + func_80A7735C(this, play); break; case 6: - func_80A77434(this, globalCtx); + func_80A77434(this, play); break; case 7: - func_80A77474(this, globalCtx); + func_80A77474(this, play); break; default: osSyncPrintf("En_Ik_inConfrontion_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); @@ -1265,30 +1265,30 @@ void func_80A779DC(EnIk* this, GlobalContext* globalCtx) { } } -void func_80A77AEC(EnIk* this, GlobalContext* globalCtx) { - func_80A779DC(this, globalCtx); +void func_80A77AEC(EnIk* this, PlayState* play) { + func_80A779DC(this, play); } -void func_80A77B0C(EnIk* this, GlobalContext* globalCtx) { - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); +void func_80A77B0C(EnIk* this, PlayState* play) { + func_80A77034(this, play); + func_80A779DC(this, play); } -void func_80A77B3C(EnIk* this, GlobalContext* globalCtx) { +void func_80A77B3C(EnIk* this, PlayState* play) { s32 sp24; sp24 = func_80A7707C(this); func_80A76C14(this); - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); - func_80A77264(this, globalCtx, sp24); + func_80A77034(this, play); + func_80A779DC(this, play); + func_80A77264(this, play, sp24); } static EnIkActionFunc sActionFuncs[] = { func_80A77AEC, func_80A77B0C, func_80A77B3C, func_80A7748C, func_80A774BC, func_80A774F8, }; -void EnIk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Update(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { @@ -1296,10 +1296,10 @@ void EnIk_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -s32 EnIk_OverrideLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnIk_OverrideLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIk* this = (EnIk*)thisx; f32 curFrame; @@ -1309,7 +1309,7 @@ s32 EnIk_OverrideLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if (curFrame < 120.0f) { *dList = NULL; } else { - func_80A76E2C(this, globalCtx, pos); + func_80A76E2C(this, play, pos); } break; case 29: @@ -1321,8 +1321,8 @@ s32 EnIk_OverrideLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnIk_PostLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnIk_PostLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -1357,23 +1357,23 @@ void EnIk_PostLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve CLOSE_DISPS(gfxCtx); } -void func_80A77ED0(EnIk* this, GlobalContext* globalCtx) { +void func_80A77ED0(EnIk* this, PlayState* play) { } -void func_80A77EDC(EnIk* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80A77EDC(EnIk* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad[2]; OPEN_DISPS(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(gfxCtx, 245, 225, 155, 30, 30, 0)); gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(gfxCtx, 255, 40, 0, 40, 0, 0)); gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(gfxCtx, 255, 255, 255, 20, 40, 30)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnIk_OverrideLimbDraw1, EnIk_PostLimbDraw1, this); CLOSE_DISPS(gfxCtx); @@ -1381,7 +1381,7 @@ void func_80A77EDC(EnIk* this, GlobalContext* globalCtx) { static EnIkDrawFunc sDrawFuncs[] = { func_80A77ED0, func_80A77EDC, func_80A77844 }; -void EnIk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Draw(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; if (this->drawMode < 0 || this->drawMode >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawMode] == NULL) { @@ -1389,24 +1389,24 @@ void EnIk_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - sDrawFuncs[this->drawMode](this, globalCtx); + sDrawFuncs[this->drawMode](this, play); } -void func_80A780D0(EnIk* this, GlobalContext* globalCtx) { +void func_80A780D0(EnIk* this, PlayState* play) { if (this->actor.params == 0) { if (!(gSaveContext.eventChkInf[3] & 0x800)) { this->actor.update = EnIk_Update; this->actor.draw = EnIk_Draw; Actor_SetScale(&this->actor, 0.01f); } else { - func_80A78160(this, globalCtx); + func_80A78160(this, play); EnIk_StartMusic(); } } osSyncPrintf("En_Ik_inConfrontion_Init : %d !!!!!!!!!!!!!!!!\n", this->actor.params); } -void func_80A78160(EnIk* this, GlobalContext* globalCtx) { +void func_80A78160(EnIk* this, PlayState* play) { this->actor.update = func_80A75FA0; this->actor.draw = func_80A76798; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; @@ -1415,15 +1415,15 @@ void func_80A78160(EnIk* this, GlobalContext* globalCtx) { func_80A7489C(this); } -void func_80A781CC(Actor* thisx, GlobalContext* globalCtx) { +void func_80A781CC(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - if (!Gameplay_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { this->actor.update = EnIk_Update; this->actor.draw = EnIk_Draw; // Don't initiate nabooru defeat CS in rando if (!(gSaveContext.n64ddFlag)) { - Cutscene_SetSegment(globalCtx, gSpiritBossNabooruKnuckleDefeatCs); + Cutscene_SetSegment(play, gSpiritBossNabooruKnuckleDefeatCs); gSaveContext.cutsceneTrigger = 1; Actor_SetScale(&this->actor, 0.01f); } else { @@ -1438,30 +1438,30 @@ void func_80A781CC(Actor* thisx, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(120.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(120.0f); pos.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(120.0f); - EffectSsDeadDb_Spawn(globalCtx, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, + EffectSsDeadDb_Spawn(play, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } Actor_Kill(&this->actor); } } gSaveContext.eventChkInf[3] |= 0x1000; - func_80A7735C(this, globalCtx); + func_80A7735C(this, play); } } -void EnIk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Init(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 flag = this->actor.params & 0xFF00; if (((this->actor.params & 0xFF) == 0 && (gSaveContext.eventChkInf[3] & 0x1000)) || - (flag != 0 && Flags_GetSwitch(globalCtx, flag >> 8))) { + (flag != 0 && Flags_GetSwitch(play, flag >> 8))) { Actor_Kill(&this->actor); } else { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ik_Skel_01E178, &object_ik_Anim_00C114, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ik_Skel_01E178, &object_ik_Anim_00C114, this->jointTable, this->morphTable, 30); - func_80A74398(&this->actor, globalCtx); - func_80A780D0(this, globalCtx); + func_80A74398(&this->actor, play); + func_80A780D0(this, play); } } diff --git a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.h index 6c45cd43b..418318e60 100644 --- a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -6,7 +6,7 @@ struct EnIk; -typedef void (*EnIkActionFunc)(struct EnIk*, GlobalContext*); +typedef void (*EnIkActionFunc)(struct EnIk*, PlayState*); typedef struct EnIk { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_In/z_en_in.c b/soh/src/overlays/actors/ovl_En_In/z_en_in.c index 0953c736e..1c4291efc 100644 --- a/soh/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/soh/src/overlays/actors/ovl_En_In/z_en_in.c @@ -4,26 +4,26 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnIn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIn_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIn_Init(Actor* thisx, PlayState* play); +void EnIn_Destroy(Actor* thisx, PlayState* play); +void EnIn_Update(Actor* thisx, PlayState* play); +void EnIn_Draw(Actor* thisx, PlayState* play); void EnIn_Reset(void); -void func_80A79FB0(EnIn* this, GlobalContext* globalCtx); -void func_80A7A304(EnIn* this, GlobalContext* globalCtx); -void func_80A7A4C8(EnIn* this, GlobalContext* globalCtx); -void func_80A7A568(EnIn* this, GlobalContext* globalCtx); -void func_80A7A848(EnIn* this, GlobalContext* globalCtx); -void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx); -void func_80A7AEF0(EnIn* this, GlobalContext* globalCtx); -void func_80A7B018(EnIn* this, GlobalContext* globalCtx); -void func_80A7B024(EnIn* this, GlobalContext* globalCtx); -void func_80A7AE84(EnIn* this, GlobalContext* globalCtx); -void func_80A7A770(EnIn* this, GlobalContext* globalCtx); -void func_80A7A940(EnIn* this, GlobalContext* globalCtx); -void func_80A7AA40(EnIn* this, GlobalContext* globalCtx); -void func_80A7A4BC(EnIn* this, GlobalContext* globalCtx); +void func_80A79FB0(EnIn* this, PlayState* play); +void func_80A7A304(EnIn* this, PlayState* play); +void func_80A7A4C8(EnIn* this, PlayState* play); +void func_80A7A568(EnIn* this, PlayState* play); +void func_80A7A848(EnIn* this, PlayState* play); +void func_80A7ABD4(EnIn* this, PlayState* play); +void func_80A7AEF0(EnIn* this, PlayState* play); +void func_80A7B018(EnIn* this, PlayState* play); +void func_80A7B024(EnIn* this, PlayState* play); +void func_80A7AE84(EnIn* this, PlayState* play); +void func_80A7A770(EnIn* this, PlayState* play); +void func_80A7A940(EnIn* this, PlayState* play); +void func_80A7AA40(EnIn* this, PlayState* play); +void func_80A7A4BC(EnIn* this, PlayState* play); const ActorInit En_In_InitVars = { ACTOR_EN_IN, @@ -111,7 +111,7 @@ static Gfx* sAdultEraDLs[] = { gIngoAdultEraMustacheDL, }; -u16 func_80A78FB0(GlobalContext* globalCtx) { +u16 func_80A78FB0(PlayState* play) { if (gSaveContext.eventChkInf[1] & 0x10) { if (gSaveContext.infTable[9] & 0x80) { return 0x2046; @@ -126,9 +126,9 @@ u16 func_80A78FB0(GlobalContext* globalCtx) { } } -u16 func_80A79010(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 temp_v0 = Text_GetFaceReaction(globalCtx, 25); +u16 func_80A79010(PlayState* play) { + Player* player = GET_PLAYER(play); + u16 temp_v0 = Text_GetFaceReaction(play, 25); if (temp_v0 != 0) { return temp_v0; @@ -179,20 +179,20 @@ u16 func_80A79010(GlobalContext* globalCtx) { } } -u16 func_80A79168(GlobalContext* globalCtx, Actor* thisx) { - u16 temp_v0 = Text_GetFaceReaction(globalCtx, 25); +u16 func_80A79168(PlayState* play, Actor* thisx) { + u16 temp_v0 = Text_GetFaceReaction(play, 25); if (temp_v0 != 0) { return temp_v0; } if (!LINK_IS_ADULT) { - return func_80A78FB0(globalCtx); + return func_80A78FB0(play); } else { - return func_80A79010(globalCtx); + return func_80A79010(play); } } -s16 func_80A791CC(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A791CC(PlayState* play, Actor* thisx) { s32 ret = 0; switch (thisx->textId) { @@ -210,55 +210,55 @@ s16 func_80A791CC(GlobalContext* globalCtx, Actor* thisx) { return ret; } -s16 func_80A7924C(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A7924C(PlayState* play, Actor* thisx) { EnIn* this = (EnIn*)thisx; s32 sp18 = 1; switch (this->actor.textId) { case 0x2030: case 0x2031: - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { this->actor.textId = 0x2032; } else if (gSaveContext.rupees < 10) { this->actor.textId = 0x2033; } else { this->actor.textId = 0x2034; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); gSaveContext.infTable[9] |= 0x400; break; case 0x2034: - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { Rupees_ChangeBy(-10); this->actor.textId = 0x205C; } else { this->actor.textId = 0x2035; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; case 0x2036: case 0x2037: - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { sp18 = 2; } else { this->actor.textId = 0x201F; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } break; case 0x2038: - if (globalCtx->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { + if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { sp18 = 2; } else { this->actor.textId = 0x2039; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); gSaveContext.infTable[10] |= 4; } break; case 0x205B: - if (globalCtx->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { + if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { sp18 = 2; } else { - Message_ContinueTextbox(globalCtx, this->actor.textId = 0x2039); + Message_ContinueTextbox(play, this->actor.textId = 0x2039); gSaveContext.eventInf[0] &= ~0xF; gSaveContext.eventInf[0] &= ~0x20; gSaveContext.eventInf[0] &= ~0x40; @@ -271,40 +271,40 @@ s16 func_80A7924C(GlobalContext* globalCtx, Actor* thisx) { return sp18; } -s16 func_80A7949C(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A7949C(PlayState* play, Actor* thisx) { s32 phi_v1 = 1; if (thisx->textId == 0x2035) { Rupees_ChangeBy(-10); thisx->textId = 0x205C; - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); } else { phi_v1 = 2; } return phi_v1; } -s16 func_80A79500(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A79500(PlayState* play, Actor* thisx) { s16 sp1E = 1; - osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&globalCtx->msgCtx), thisx->textId); - switch (Message_GetState(&globalCtx->msgCtx)) { + osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&play->msgCtx), thisx->textId); + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: break; case TEXT_STATE_CLOSING: - sp1E = func_80A791CC(globalCtx, thisx); + sp1E = func_80A791CC(play, thisx); break; case TEXT_STATE_DONE_FADING: break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - sp1E = func_80A7924C(globalCtx, thisx); + if (Message_ShouldAdvance(play)) { + sp1E = func_80A7924C(play, thisx); } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { - sp1E = func_80A7949C(globalCtx, thisx); + if (Message_ShouldAdvance(play)) { + sp1E = func_80A7949C(play, thisx); } break; case TEXT_STATE_DONE: @@ -316,8 +316,8 @@ s16 func_80A79500(GlobalContext* globalCtx, Actor* thisx) { return sp1E; } -void func_80A795C8(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A795C8(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; if (this->skelAnime.animation == &object_in_Anim_0003B4 || this->skelAnime.animation == &object_in_Anim_001BE0 || @@ -330,7 +330,7 @@ void func_80A795C8(EnIn* this, GlobalContext* globalCtx) { phi_a3 = 4; } if (this->actionFunc == func_80A7B024) { - this->unk_308.unk_18 = globalCtx->view.eye; + this->unk_308.unk_18 = play->view.eye; this->unk_308.unk_14 = 60.0f; } else { this->unk_308.unk_18 = player->actor.world.pos; @@ -339,10 +339,10 @@ void func_80A795C8(EnIn* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_308, 1, phi_a3); } -void func_80A79690(SkelAnime* skelAnime, EnIn* this, GlobalContext* globalCtx) { +void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) { if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } @@ -352,7 +352,7 @@ void EnIn_ChangeAnim(EnIn* this, s32 index) { sAnimationInfo[index].morphFrames); } -s32 func_80A7975C(EnIn* this, GlobalContext* globalCtx) { +s32 func_80A7975C(EnIn* this, PlayState* play) { if (this->actor.params != 1 || this->actor.shape.rot.z != 1 || !LINK_IS_ADULT) { return 0; } @@ -364,16 +364,16 @@ s32 func_80A7975C(EnIn* this, GlobalContext* globalCtx) { return 1; } -s32 func_80A79830(EnIn* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT20 && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 1 && +s32 func_80A79830(EnIn* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT20 && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 1 && !(gSaveContext.eventChkInf[1] & 0x10)) { return 1; } - if (globalCtx->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 3 && + if (play->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 3 && (gSaveContext.eventChkInf[1] & 0x10)) { return 1; } - if (globalCtx->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_NIGHT) { + if (play->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_NIGHT) { if ((this->actor.shape.rot.z == 2) && !(gSaveContext.eventChkInf[1] & 0x10)) { return 1; } @@ -381,7 +381,7 @@ s32 func_80A79830(EnIn* this, GlobalContext* globalCtx) { return 1; } } - if (globalCtx->sceneNum == SCENE_SPOT20 && LINK_IS_ADULT && IS_DAY) { + if (play->sceneNum == SCENE_SPOT20 && LINK_IS_ADULT && IS_DAY) { if ((this->actor.shape.rot.z == 5) && !(gSaveContext.eventChkInf[1] & 0x100)) { return 2; } @@ -389,7 +389,7 @@ s32 func_80A79830(EnIn* this, GlobalContext* globalCtx) { return 4; } } - if (globalCtx->sceneNum == SCENE_SOUKO && LINK_IS_ADULT && IS_NIGHT) { + if (play->sceneNum == SCENE_SOUKO && LINK_IS_ADULT && IS_NIGHT) { if (this->actor.shape.rot.z == 6 && !(gSaveContext.eventChkInf[1] & 0x100)) { return 3; } @@ -412,12 +412,12 @@ void EnIn_UpdateEyes(EnIn* this) { } } -void func_80A79AB4(EnIn* this, GlobalContext* globalCtx) { +void func_80A79AB4(EnIn* this, PlayState* play) { s32 i; u32 f = 0; if (this->skelAnime.animation != &object_in_Anim_014CA8) { - f = globalCtx->gameplayFrames; + f = play->gameplayFrames; } for (i = 0; i < ARRAY_COUNT(this->unk_330); i++) { this->unk_330[i].y = (2068 + 50 * i) * f; @@ -425,16 +425,16 @@ void func_80A79AB4(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A79BAC(EnIn* this, GlobalContext* globalCtx, s32 index, u32 arg3) { +void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 arg3) { s16 entrances[] = { 0x0558, 0x04CA, 0x0157 }; - globalCtx->nextEntranceIndex = entrances[index]; + play->nextEntranceIndex = entrances[index]; if (index == 2) { gSaveContext.nextCutsceneIndex = 0xFFF0; } - globalCtx->fadeTransition = arg3; - globalCtx->sceneLoadFlag = 0x14; - func_8002DF54(globalCtx, &this->actor, 8); + play->fadeTransition = arg3; + play->sceneLoadFlag = 0x14; + func_8002DF54(play, &this->actor, 8); Interface_ChangeAlpha(1); if (index == 0) { AREG(6) = 0; @@ -442,26 +442,26 @@ void func_80A79BAC(EnIn* this, GlobalContext* globalCtx, s32 index, u32 arg3) { gSaveContext.timer1State = 0; } -void func_80A79C78(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A79C78(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp48; Vec3f sp3C; Vec3s zeroVec = { 0, 0, 0 }; - this->camId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); + this->camId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->camId, CAM_STAT_ACTIVE); sp48.x = this->actor.world.pos.x; sp48.y = this->actor.world.pos.y + 60.0f; sp48.z = this->actor.world.pos.z; sp3C.x = sp48.x; sp3C.y = sp48.y - 22.0f; sp3C.z = sp48.z + 40.0f; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &sp48, &sp3C); + Play_CameraSetAtEye(play, this->camId, &sp48, &sp3C); this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp3C); this->unk_308.unk_08 = zeroVec; this->unk_308.unk_0E = zeroVec; - Message_StartTextbox(globalCtx, 0x2025, NULL); + Message_StartTextbox(play, 0x2025, NULL); this->unk_308.unk_00 = 1; player->actor.world.pos = this->actor.world.pos; player->actor.world.pos.x += 100.0f * Math_SinS(this->actor.shape.rot.y); @@ -478,12 +478,12 @@ void func_80A79C78(EnIn* this, GlobalContext* globalCtx) { static s32 D_80A7B998 = 0; -void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Init(Actor* thisx, PlayState* play) { EnIn* this = (EnIn*)thisx; RespawnData* respawn = &gSaveContext.respawn[RESPAWN_MODE_DOWN]; Vec3f respawnPos; - this->ingoObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_IN); + this->ingoObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_IN); if (this->ingoObjBankIndex < 0 && this->actor.params > 0) { this->actionFunc = NULL; Actor_Kill(&this->actor); @@ -498,24 +498,24 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A79FB0; } -void EnIn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Destroy(Actor* thisx, PlayState* play) { EnIn* this = (EnIn*)thisx; if (this->actionFunc != NULL && this->actionFunc != func_80A79FB0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { +void func_80A79FB0(EnIn* this, PlayState* play) { s32 sp3C = 0; - if (Object_IsLoaded(&globalCtx->objectCtx, this->ingoObjBankIndex) || this->actor.params <= 0) { + if (Object_IsLoaded(&play->objectCtx, this->ingoObjBankIndex) || this->actor.params <= 0) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gIngoSkel, NULL, this->jointTable, this->morphTable, 20); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gIngoSkel, NULL, this->jointTable, this->morphTable, 20); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (func_80A7975C(this, globalCtx)) { + if (func_80A7975C(this, play)) { gSaveContext.eventInf[0] &= ~0x8000; return; } @@ -524,7 +524,7 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { this->unk_308.unk_00 = 0; this->actionFunc = func_80A7A4BC; - switch (func_80A79830(this, globalCtx)) { + switch (func_80A79830(this, play)) { case 1: EnIn_ChangeAnim(this, ENIN_ANIM_9); this->actionFunc = func_80A7A4BC; @@ -609,7 +609,7 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A7A304(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A304(EnIn* this, PlayState* play) { if (this->skelAnime.animation == &object_in_Anim_015814 || this->skelAnime.animation == &object_in_Anim_01646C) { if (this->skelAnime.curFrame == 8.0f) { Audio_PlaySoundRandom(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, @@ -634,24 +634,24 @@ void func_80A7A304(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A7A4BC(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A4BC(EnIn* this, PlayState* play) { } -void func_80A7A4C8(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A4C8(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 2) { - func_80A79BAC(this, globalCtx, 1, 0x20); + func_80A79BAC(this, play, 1, 0x20); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x000F) | 0x0001; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; gSaveContext.infTable[10] &= ~4; Environment_ForcePlaySequence(NA_BGM_HORSE); - globalCtx->msgCtx.stateTimer = 0; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 0; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7A568(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_a2; s32 phi_a3; @@ -660,19 +660,19 @@ void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { } if (gSaveContext.timer1State == 10) { Audio_PlaySoundGeneral(NA_SE_SY_FOUND, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - func_80A79C78(this, globalCtx); + func_80A79C78(this, play); this->actionFunc = func_80A7B024; gSaveContext.timer1State = 0; } else if (this->unk_308.unk_00 == 2) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.rupees < 50) { - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; return; } gSaveContext.eventInf[0] = - (gSaveContext.eventInf[0] & ~0x10) | (((EnHorse*)GET_PLAYER(globalCtx)->rideActor)->type << 4); + (gSaveContext.eventInf[0] & ~0x10) | (((EnHorse*)GET_PLAYER(play)->rideActor)->type << 4); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 2; phi_a2 = 2; phi_a3 = 2; @@ -688,15 +688,15 @@ void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { phi_a2 = 0; phi_a3 = 0x20; } - func_80A79BAC(this, globalCtx, phi_a2, phi_a3); - globalCtx->msgCtx.stateTimer = 0; + func_80A79BAC(this, play, phi_a2, phi_a3); + play->msgCtx.stateTimer = 0; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void func_80A7A770(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A770(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 0) { this->actor.flags |= ACTOR_FLAG_16; } else if (this->unk_308.unk_00 == 2) { @@ -708,23 +708,23 @@ void func_80A7A770(EnIn* this, GlobalContext* globalCtx) { this->unk_308.unk_00 = 0; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & 0xFFFF) | 0x20; if (!(gSaveContext.eventInf[0] & 0x40)) { - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } } -void func_80A7A848(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A848(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 2) { - if ((globalCtx->msgCtx.choiceIndex == 0 && gSaveContext.rupees < 50) || globalCtx->msgCtx.choiceIndex == 1) { + if ((play->msgCtx.choiceIndex == 0 && gSaveContext.rupees < 50) || play->msgCtx.choiceIndex == 1) { gSaveContext.eventInf[0] &= ~0xF; this->actionFunc = func_80A7A4C8; } else { - func_80A79BAC(this, globalCtx, 2, 0x26); + func_80A79BAC(this, play, 2, 0x26); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 2; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; - globalCtx->msgCtx.stateTimer = 0; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 0; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } this->unk_308.unk_00 = 0; gSaveContext.eventInf[0] &= ~0x20; @@ -732,7 +732,7 @@ void func_80A7A848(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A7A940(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A940(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 0) { this->actor.flags |= ACTOR_FLAG_16; return; @@ -745,25 +745,25 @@ void func_80A7A940(EnIn* this, GlobalContext* globalCtx) { } if (this->unk_308.unk_00 == 2) { this->actor.flags &= ~ACTOR_FLAG_16; - func_80A79BAC(this, globalCtx, 2, 0x26); + func_80A79BAC(this, play, 2, 0x26); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x000F) | 0x0002; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; - globalCtx->msgCtx.stateTimer = 0; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 0; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & 0xFFFF) | 0x40; } } -void func_80A7AA40(EnIn* this, GlobalContext* globalCtx) { +void func_80A7AA40(EnIn* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f sp30; Vec3f sp24; - this->camId = Gameplay_CreateSubCamera(globalCtx); - this->activeCamId = globalCtx->activeCamera; - Gameplay_ChangeCameraStatus(globalCtx, this->activeCamId, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); + this->camId = Play_CreateSubCamera(play); + this->activeCamId = play->activeCamera; + Play_ChangeCameraStatus(play, this->activeCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->camId, CAM_STAT_ACTIVE); this->unk_2F0 = 0.0f; this->unk_2F4 = 50.0f; @@ -783,19 +783,19 @@ void func_80A7AA40(EnIn* this, GlobalContext* globalCtx) { sp24.y += this->unk_300; sp24.z += this->unk_304; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &sp30, &sp24); + Play_CameraSetAtEye(play, this->camId, &sp30, &sp24); this->actor.textId = 0x203B; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_308.unk_00 = 1; this->unk_1FC = 0; - globalCtx->csCtx.frames = 0; + play->csCtx.frames = 0; ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); this->actionFunc = func_80A7ABD4; } -void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7ABD4(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp48; Vec3f sp3C; @@ -815,20 +815,20 @@ void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { if (this->unk_308.unk_00 == 2) { if (this->actor.textId == 0x203B) { this->actor.textId = 0x203C; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_308.unk_00 = 1; EnIn_ChangeAnim(this, ENIN_ANIM_3); } else { - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } } else { - if (globalCtx->csCtx.frames++ >= 50) { + if (play->csCtx.frames++ >= 50) { this->actionFunc = func_80A7AE84; return; } - if (globalCtx->csCtx.frames == 44) { + if (play->csCtx.frames == 44) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_RONRON_DOOR_CLOSE); } Math_SmoothStepToF(&this->unk_2F0, 0.0f, 0.06f, 10000.0f, 0.0f); @@ -847,20 +847,20 @@ void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { sp3C.x += this->unk_2FC; sp3C.y += this->unk_300; sp3C.z += this->unk_304; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &sp48, &sp3C); + Play_CameraSetAtEye(play, this->camId, &sp48, &sp3C); } } -void func_80A7AE84(EnIn* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, this->activeCamId, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->camId); - func_8002DF54(globalCtx, &this->actor, 7); +void func_80A7AE84(EnIn* this, PlayState* play) { + Play_ChangeCameraStatus(play, this->activeCamId, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->camId); + func_8002DF54(play, &this->actor, 7); Interface_ChangeAlpha(0x32); this->actionFunc = func_80A7AEF0; } -void func_80A7AEF0(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7AEF0(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 yaw; Vec3f pos = this->actor.world.pos; @@ -868,22 +868,22 @@ void func_80A7AEF0(EnIn* this, GlobalContext* globalCtx) { pos.z += 90.0f * Math_CosS(this->actor.shape.rot.y); yaw = Math_Vec3f_Yaw(&pos, &player->actor.world.pos); if (ABS(yaw) > 0x4000) { - globalCtx->nextEntranceIndex = 0x0476; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 5; + play->nextEntranceIndex = 0x0476; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 5; this->actionFunc = func_80A7B018; } else if (this->unk_308.unk_00 == 2) { - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void func_80A7B018(EnIn* this, GlobalContext* globalCtx) { +void func_80A7B018(EnIn* this, PlayState* play) { } -void func_80A7B024(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7B024(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->rideActor != NULL) { player->rideActor->freezeTimer = 10; @@ -894,53 +894,53 @@ void func_80A7B024(EnIn* this, GlobalContext* globalCtx) { gSaveContext.eventChkInf[1] |= 0x800; gSaveContext.infTable[10] |= 0x800; } - func_80A79BAC(this, globalCtx, 0, 0x26); + func_80A79BAC(this, play, 0, 0x26); gSaveContext.eventInf[0] = gSaveContext.eventInf[0] & ~0xF; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000; - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Update(Actor* thisx, PlayState* play) { ColliderCylinder* collider; EnIn* this = (EnIn*)thisx; if (this->actionFunc == func_80A79FB0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); return; } collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); if (this->actionFunc != func_80A7A304) { SkelAnime_Update(&this->skelAnime); if (this->skelAnime.animation == &object_in_Anim_001BE0 && ((gSaveContext.eventInf[0] & 0xF) != 6)) { - func_80A79690(&this->skelAnime, this, globalCtx); + func_80A79690(&this->skelAnime, this, play); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } EnIn_UpdateEyes(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_80A7A304) { - func_80A79AB4(this, globalCtx); + func_80A79AB4(this, play); if (gSaveContext.timer2Value < 6 && gSaveContext.timer2State != 0 && this->unk_308.unk_00 == 0) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {} + if (Actor_ProcessTalkRequest(&this->actor, play)) {} } else { - func_800343CC(globalCtx, &this->actor, &this->unk_308.unk_00, + func_800343CC(play, &this->actor, &this->unk_308.unk_00, ((this->actor.targetMode == 6) ? 80.0f : 320.0f) + this->collider.dim.radius, func_80A79168, func_80A79500); if (this->unk_308.unk_00 != 0) { this->unk_1FA = this->unk_1F8; - this->unk_1F8 = Message_GetState(&globalCtx->msgCtx); + this->unk_1F8 = Message_GetState(&play->msgCtx); } } - func_80A795C8(this, globalCtx); + func_80A795C8(this, play); } } -s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIn* this = (EnIn*)thisx; Vec3s sp2C; @@ -968,11 +968,11 @@ s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnIn* this = (EnIn*)thisx; Vec3f D_80A7B9A8 = { 1600.0, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == INGO_HEAD_LIMB) { Matrix_MultVec3f(&D_80A7B9A8, &this->actor.focus.pos); @@ -985,23 +985,23 @@ void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec gSPDisplayList(POLY_OPA_DISP++, gIngoChildEraPitchForkDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnIn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gIngoEyeOpenTex, gIngoEyeHalfTex, gIngoEyeClosedTex, gIngoEyeClosed2Tex }; EnIn* this = (EnIn*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc != func_80A79FB0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gIngoHeadGradient2Tex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + 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); } void EnIn_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_En_In/z_en_in.h b/soh/src/overlays/actors/ovl_En_In/z_en_in.h index 5777c21f7..85c4ad9ed 100644 --- a/soh/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/soh/src/overlays/actors/ovl_En_In/z_en_in.h @@ -6,7 +6,7 @@ struct EnIn; -typedef void (*EnInActionFunc)(struct EnIn*, GlobalContext*); +typedef void (*EnInActionFunc)(struct EnIn*, PlayState*); typedef enum { /* 0x00 */ INGO_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 5f9c4acc0..43562b00b 100644 --- a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -10,27 +10,27 @@ #define FLAGS 0 -void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx); -void EnInsect_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx); -void EnInsect_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnInsect_Init(Actor* thisx, PlayState* play); +void EnInsect_Destroy(Actor* thisx, PlayState* play); +void EnInsect_Update(Actor* thisx, PlayState* play); +void EnInsect_Draw(Actor* thisx, PlayState* play); void EnInsect_Reset(void); void func_80A7C3A0(EnInsect* this); -void func_80A7C3F4(EnInsect* this, GlobalContext* globalCtx); +void func_80A7C3F4(EnInsect* this, PlayState* play); void func_80A7C598(EnInsect* this); -void func_80A7C5EC(EnInsect* this, GlobalContext* globalCtx); +void func_80A7C5EC(EnInsect* this, PlayState* play); void func_80A7C818(EnInsect* this); -void func_80A7C86C(EnInsect* this, GlobalContext* globalCtx); -void func_80A7CAD0(EnInsect* this, GlobalContext* globalCtx); +void func_80A7C86C(EnInsect* this, PlayState* play); +void func_80A7CAD0(EnInsect* this, PlayState* play); void func_80A7CBC8(EnInsect* this); -void func_80A7CC3C(EnInsect* this, GlobalContext* globalCtx); +void func_80A7CC3C(EnInsect* this, PlayState* play); void func_80A7CE60(EnInsect* this); -void func_80A7CEC0(EnInsect* this, GlobalContext* globalCtx); +void func_80A7CEC0(EnInsect* this, PlayState* play); void func_80A7D1F4(EnInsect* this); -void func_80A7D26C(EnInsect* this, GlobalContext* globalCtx); +void func_80A7D26C(EnInsect* this, PlayState* play); void func_80A7D39C(EnInsect* this); -void func_80A7D460(EnInsect* this, GlobalContext* globalCtx); +void func_80A7D460(EnInsect* this, PlayState* play); f32 D_80A7DEB0 = 0.0f; s16 D_80A7DEB4 = 0; @@ -93,9 +93,9 @@ f32 EnInsect_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { return SQ(v1->x - v2->x) + SQ(v1->z - v2->z); } -s32 EnInsect_InBottleRange(EnInsect* this, GlobalContext* globalCtx) { +s32 EnInsect_InBottleRange(EnInsect* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f pos; if (this->actor.xzDistToPlayer < 32.0f) { @@ -123,14 +123,14 @@ void func_80A7BF58(EnInsect* this) { * * @return 1 if one was found, 0 otherwise */ -s32 EnInsect_FoundNearbySoil(EnInsect* this, GlobalContext* globalCtx) { +s32 EnInsect_FoundNearbySoil(EnInsect* this, PlayState* play) { Actor* currentActor; f32 currentDistance; f32 bestDistance; s32 ret; ret = 0; - currentActor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + currentActor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; bestDistance = 6400.0f; this->soilActor = NULL; @@ -164,9 +164,9 @@ void func_80A7C058(EnInsect* this) { } } -void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnInsect_Init(Actor* thisx, PlayState* play2) { EnInsect* this = (EnInsect*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 rand; s16 temp_s2; s32 count; @@ -176,9 +176,9 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { temp_s2 = this->actor.params & 3; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBugSkel, &gBugCrawlAnim, this->jointTable, this->morphTable, 24); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, &this->colliderItem); + SkelAnime_Init(play, &this->skelAnime, &gBugSkel, &gBugCrawlAnim, this->jointTable, this->morphTable, 24); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, &this->colliderItem); this->actor.colChkInfo.mass = 30; @@ -193,7 +193,7 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { } if (temp_s2 == 2 || temp_s2 == 3) { - if (EnInsect_FoundNearbySoil(this, globalCtx)) { + if (EnInsect_FoundNearbySoil(this, play)) { this->unk_314 |= 0x10; D_80A7DEB0 = 0.0f; } @@ -203,7 +203,7 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.rot.z = this->actor.world.rot.z; for (count = 0; count < 2; count++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 3); } @@ -225,12 +225,12 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnInsect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Destroy(Actor* thisx, PlayState* play) { s16 temp_v0; EnInsect* this = (EnInsect*)thisx; temp_v0 = this->actor.params & 3; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); if ((temp_v0 == 2 || temp_v0 == 3) && D_80A7DEB8 > 0) { D_80A7DEB8--; } @@ -243,7 +243,7 @@ void func_80A7C3A0(EnInsect* this) { this->unk_314 |= 0x100; } -void func_80A7C3F4(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7C3F4(EnInsect* this, PlayState* play) { s32 pad[2]; s16 sp2E; f32 playSpeed; @@ -278,7 +278,7 @@ void func_80A7C598(EnInsect* this) { this->unk_314 |= 0x100; } -void func_80A7C5EC(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7C5EC(EnInsect* this, PlayState* play) { s32 pad1; s32 pad2; s16 yaw; @@ -320,7 +320,7 @@ void func_80A7C818(EnInsect* this) { this->unk_314 |= 0x100; } -void func_80A7C86C(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7C86C(EnInsect* this, PlayState* play) { s32 pad1; s32 pad2; s16 pad3; @@ -334,7 +334,7 @@ void func_80A7C86C(EnInsect* this, GlobalContext* globalCtx) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000); } else if (sp38 != 0) { - frames = globalCtx->state.frames; + frames = play->state.frames; yaw = this->actor.yawTowardsPlayer + 0x8000; if (frames & 0x10) { @@ -346,7 +346,7 @@ void func_80A7C86C(EnInsect* this, GlobalContext* globalCtx) { yaw -= 0x2000; } } - if (globalCtx) {} // Must be 'globalCtx' + if (play) {} // Must be 'play' Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -375,7 +375,7 @@ void func_80A7CA64(EnInsect* this) { this->unk_314 &= ~0x100; } -void func_80A7CAD0(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7CAD0(EnInsect* this, PlayState* play) { if (this->unk_31A == 20 && !(this->unk_314 & 4)) { this->actor.draw = EnInsect_Draw; } else if (this->unk_31A == 0) { @@ -402,7 +402,7 @@ void func_80A7CBC8(EnInsect* this) { this->unk_314 |= 0x8; } -void func_80A7CC3C(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7CC3C(EnInsect* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Vec3f unused = { 0.0f, 0.0f, 0.0f }; s32 pad[2]; @@ -423,7 +423,7 @@ void func_80A7CC3C(EnInsect* this, GlobalContext* globalCtx) { velocity.x = Math_SinS(this->actor.shape.rot.y) * -0.6f; velocity.y = Math_SinS(this->actor.shape.rot.x) * 0.6f; velocity.z = Math_CosS(this->actor.shape.rot.y) * -0.6f; - func_800286CC(globalCtx, &this->actor.world.pos, &velocity, &accel, Rand_ZeroOne() * 5.0f + 8.0f, + func_800286CC(play, &this->actor.world.pos, &velocity, &accel, Rand_ZeroOne() * 5.0f + 8.0f, Rand_ZeroOne() * 5.0f + 8.0f); } @@ -444,7 +444,7 @@ void func_80A7CE60(EnInsect* this) { this->unk_314 &= ~0x100; } -void func_80A7CEC0(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7CEC0(EnInsect* this, PlayState* play) { f32 temp_f0; s16 temp_v1; s16 pad; @@ -505,8 +505,8 @@ void func_80A7CEC0(EnInsect* this, GlobalContext* globalCtx) { sp40.x = this->actor.world.pos.x; sp40.y = this->actor.world.pos.y + this->actor.yDistToWater; sp40.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp40, 20, 100, 4); - EffectSsGRipple_Spawn(globalCtx, &sp40, 40, 200, 8); + EffectSsGRipple_Spawn(play, &sp40, 20, 100, 4); + EffectSsGRipple_Spawn(play, &sp40, 40, 200, 8); } if (this->unk_31A <= 0 || ((this->unk_314 & 4) && this->unk_31C <= 0) || @@ -534,13 +534,13 @@ void func_80A7D1F4(EnInsect* this) { this->unk_314 |= 8; } -void func_80A7D26C(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7D26C(EnInsect* this, PlayState* play) { this->actor.shape.rot.x -= 500; this->actor.shape.rot.y += 200; Actor_SetScale(&this->actor, CLAMP_MIN(this->actor.scale.x - 0.00005f, 0.001f)); if (this->actor.yDistToWater > 5.0f && this->actor.yDistToWater < 30.0f && Rand_ZeroOne() < 0.3f) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -5.0f, 5.0f, 5.0f, (Rand_ZeroOne() * 0.04f) + 0.02f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, -5.0f, 5.0f, 5.0f, (Rand_ZeroOne() * 0.04f) + 0.02f); } if (this->unk_31A <= 0) { @@ -560,7 +560,7 @@ void func_80A7D39C(EnInsect* this) { this->unk_314 |= 0x100; } -void func_80A7D460(EnInsect* this, GlobalContext* globalCtx) { +void func_80A7D460(EnInsect* this, PlayState* play) { s32 temp_a0; s32 sp50; f32 phi_f0; @@ -712,7 +712,7 @@ void func_80A7D460(EnInsect* this, GlobalContext* globalCtx) { } } -void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Update(Actor* thisx, PlayState* play) { EnInsect* this = (EnInsect*)thisx; s32 phi_v0; @@ -732,7 +732,7 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_31C--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { Actor_MoveForward(&this->actor); @@ -758,10 +758,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; phi_v0 = this->actor.params & 3; @@ -772,12 +772,12 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { } } else if (this->actor.xzDistToPlayer < 50.0f && this->actionFunc != func_80A7CAD0) { if (!(this->unk_314 & 0x20) && this->unk_31C < 180) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (!(this->unk_314 & 8) && D_80A7DEB4 < 4 && EnInsect_InBottleRange(this, globalCtx) && + if (!(this->unk_314 & 8) && D_80A7DEB4 < 4 && EnInsect_InBottleRange(this, play) && // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 60.0f, 30.0f)) { + func_8002F434(&this->actor, play, GI_MAX, 60.0f, 30.0f)) { D_80A7DEB4++; } } @@ -786,11 +786,11 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnInsect_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Draw(Actor* thisx, PlayState* play) { EnInsect* this = (EnInsect*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); Collider_UpdateSpheres(0, &this->collider); D_80A7DEB4 = 0; } diff --git a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.h b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.h index 3755fead1..885f13999 100644 --- a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.h +++ b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.h @@ -7,7 +7,7 @@ struct EnInsect; -typedef void (*EnInsectActionFunc)(struct EnInsect*, GlobalContext*); +typedef void (*EnInsectActionFunc)(struct EnInsect*, PlayState*); typedef struct EnInsect { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 7b40c7c4f..b222e1f19 100644 --- a/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -12,22 +12,22 @@ #define FLAGS ACTOR_FLAG_23 -void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIshi_Init(Actor* thisx, PlayState* play); +void EnIshi_Destroy(Actor* thisx, PlayState* play); +void EnIshi_Update(Actor* thisx, PlayState* play); +void EnIshi_Draw(Actor* thisx, PlayState* play); void EnIshi_Reset(void); void EnIshi_SetupWait(EnIshi* this); -void EnIshi_Wait(EnIshi* this, GlobalContext* globalCtx); +void EnIshi_Wait(EnIshi* this, PlayState* play); void EnIshi_SetupLiftedUp(EnIshi* this); -void EnIshi_LiftedUp(EnIshi* this, GlobalContext* globalCtx); +void EnIshi_LiftedUp(EnIshi* this, PlayState* play); void EnIshi_SetupFly(EnIshi* this); -void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnFragmentsSmall(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx); +void EnIshi_Fly(EnIshi* this, PlayState* play); +void EnIshi_SpawnFragmentsSmall(EnIshi* this, PlayState* play); +void EnIshi_SpawnFragmentsLarge(EnIshi* this, PlayState* play); +void EnIshi_SpawnDustSmall(EnIshi* this, PlayState* play); +void EnIshi_SpawnDustLarge(EnIshi* this, PlayState* play); s16 sRockRotSpeedX = 0; s16 sRockRotSpeedY = 0; @@ -103,15 +103,15 @@ static ColliderCylinderInit sCylinderInits[] = { static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_IMMOVABLE }; -void EnIshi_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_InitCollider(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInits[this->actor.params & 1]); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInits[this->actor.params & 1]); Collider_UpdateCylinder(&this->actor, &this->collider); } -s32 EnIshi_SnapToFloor(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { +s32 EnIshi_SnapToFloor(EnIshi* this, PlayState* play, f32 arg2) { CollisionPoly* poly; Vec3f pos; s32 bgId; @@ -120,7 +120,7 @@ s32 EnIshi_SnapToFloor(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 30.0f; pos.z = this->actor.world.pos.z; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &poly, &bgId, &this->actor, &pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &poly, &bgId, &this->actor, &pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY + arg2; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -134,7 +134,7 @@ s32 EnIshi_SnapToFloor(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { } } -void EnIshi_SpawnFragmentsSmall(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnFragmentsSmall(EnIshi* this, PlayState* play) { static s16 scales[] = { 16, 13, 11, 9, 7, 5 }; s32 pad; Vec3f velocity; @@ -164,12 +164,12 @@ void EnIshi_SpawnFragmentsSmall(EnIshi* this, GlobalContext* globalCtx) { } else { phi_v0 = 33; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -420, phi_v0, 30, 5, 0, scales[i], 3, 10, 40, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -420, phi_v0, 30, 5, 0, scales[i], 3, 10, 40, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } } -void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnFragmentsLarge(EnIshi* this, PlayState* play) { static s16 scales[] = { 145, 135, 120, 100, 70, 50, 45, 40, 35 }; Actor* thisx = &this->actor; Vec3f velocity; @@ -210,12 +210,12 @@ void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx) { phi_v0 = 69; phi_v1 = -320; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, phi_v1, phi_v0, 30, 5, 0, scales[i], 5, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, phi_v1, phi_v0, 30, 5, 0, scales[i], 5, 2, 70, KAKERA_COLOR_WHITE, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL); } } -void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnDustSmall(EnIshi* this, PlayState* play) { Vec3f pos; Math_Vec3f_Copy(&pos, &this->actor.world.pos); @@ -228,10 +228,10 @@ void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx) { pos.y += 2.0f * this->actor.velocity.y; pos.z -= 2.0f * this->actor.velocity.z; } - func_80033480(globalCtx, &pos, 60.0f, 3, 0x50, 0x3C, 1); + func_80033480(play, &pos, 60.0f, 3, 0x50, 0x3C, 1); } -void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnDustLarge(EnIshi* this, PlayState* play) { Vec3f pos; Math_Vec3f_Copy(&pos, &this->actor.world.pos); @@ -244,10 +244,10 @@ void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx) { pos.y += 2.0f * this->actor.velocity.y; pos.z -= 2.0f * this->actor.velocity.z; } - func_80033480(globalCtx, &pos, 140.0f, 0xA, 0xB4, 0x5A, 1); + func_80033480(play, &pos, 140.0f, 0xA, 0xB4, 0x5A, 1); } -void EnIshi_DropCollectible(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_DropCollectible(EnIshi* this, PlayState* play) { s16 dropParams; if ((this->actor.params & 1) == ROCK_SMALL) { @@ -257,7 +257,7 @@ void EnIshi_DropCollectible(EnIshi* this, GlobalContext* globalCtx) { dropParams = 0; } - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, dropParams << 4); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, dropParams << 4); } } @@ -276,11 +276,11 @@ void func_80A7ED94(Vec3f* arg0, f32 arg1) { arg0->z -= arg0->z * arg1; } -void EnIshi_SpawnBugs(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnBugs(EnIshi* this, PlayState* play) { s32 i; for (i = 0; i < 3; i++) { - Actor* bug = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.world.pos.x, + Actor* bug = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, Rand_ZeroOne() * 0xFFFF, 0, 1); if (bug == NULL) { @@ -306,75 +306,75 @@ static InitChainEntry sInitChains[][5] = { }, }; -void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Init(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; s16 type = this->actor.params & 1; Actor_ProcessInitChain(&this->actor, sInitChains[type]); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } if (this->actor.shape.rot.y == 0) { this->actor.shape.rot.y = this->actor.world.rot.y = Rand_ZeroFloat(0x10000); } Actor_SetScale(&this->actor, sRockScales[type]); - EnIshi_InitCollider(&this->actor, globalCtx); + EnIshi_InitCollider(&this->actor, play); if ((type == ROCK_LARGE) && - Flags_GetSwitch(globalCtx, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3))) { + Flags_GetSwitch(play, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3))) { Actor_Kill(&this->actor); return; } CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->actor.shape.yOffset = D_80A7FA20[type]; - if (!((this->actor.params >> 5) & 1) && !EnIshi_SnapToFloor(this, globalCtx, 0.0f)) { + if (!((this->actor.params >> 5) & 1) && !EnIshi_SnapToFloor(this, play, 0.0f)) { Actor_Kill(&this->actor); return; } EnIshi_SetupWait(this); } -void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnIshi_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnIshi* this = (EnIshi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnIshi_SetupWait(EnIshi* this) { this->actionFunc = EnIshi_Wait; } -void EnIshi_Wait(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_Wait(EnIshi* this, PlayState* play) { static u16 liftSounds[] = { NA_SE_PL_PULL_UP_ROCK, NA_SE_PL_PULL_UP_BIGROCK }; s32 pad; s16 type = this->actor.params & 1; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { EnIshi_SetupLiftedUp(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, liftSounds[type]); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, liftSounds[type]); if ((this->actor.params >> 4) & 1) { - EnIshi_SpawnBugs(this, globalCtx); + EnIshi_SpawnBugs(this, play); } } else if ((this->collider.base.acFlags & AC_HIT) && (type == ROCK_SMALL) && this->collider.info.acHitInfo->toucher.dmgFlags & 0x40000048) { - EnIshi_DropCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, sBreakSoundDurations[type], + EnIshi_DropCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, sBreakSoundDurations[type], sBreakSounds[type]); - sFragmentSpawnFuncs[type](this, globalCtx); - sDustSpawnFuncs[type](this, globalCtx); + sFragmentSpawnFuncs[type](this, play); + sDustSpawnFuncs[type](this, play); Actor_Kill(&this->actor); } else if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 90.0f) { // GI_NONE in these cases allows the player to lift the actor if (type == ROCK_LARGE) { - func_8002F434(&this->actor, globalCtx, GI_NONE, 80.0f, 20.0f); + func_8002F434(&this->actor, play, GI_NONE, 80.0f, 20.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_NONE, 50.0f, 10.0f); + func_8002F434(&this->actor, play, GI_NONE, 50.0f, 10.0f); } } } @@ -387,17 +387,17 @@ void EnIshi_SetupLiftedUp(EnIshi* this) { this->actor.flags |= ACTOR_FLAG_4; } -void EnIshi_LiftedUp(EnIshi* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void EnIshi_LiftedUp(EnIshi* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.curRoom.num; if ((this->actor.params & 1) == ROCK_LARGE) { - Flags_SetSwitch(globalCtx, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3)); + Flags_SetSwitch(play, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3)); } EnIshi_SetupFly(this); EnIshi_Fall(this); func_80A7ED94(&this->actor.velocity, D_80A7FA28[this->actor.params & 1]); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); } } @@ -415,7 +415,7 @@ void EnIshi_SetupFly(EnIshi* this) { this->actionFunc = EnIshi_Fly; } -void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_Fly(EnIshi* this, PlayState* play) { s32 pad; s16 type = this->actor.params & 1; s32 pad2; @@ -423,15 +423,15 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { Vec3f contactPos; if (this->actor.bgCheckFlags & 9) { - EnIshi_DropCollectible(this, globalCtx); - sFragmentSpawnFuncs[type](this, globalCtx); + EnIshi_DropCollectible(this, play); + sFragmentSpawnFuncs[type](this, play); if (!(this->actor.bgCheckFlags & 0x20)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, sBreakSoundDurations[type], + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, sBreakSoundDurations[type], sBreakSounds[type]); - sDustSpawnFuncs[type](this, globalCtx); + sDustSpawnFuncs[type](this, play); } if (type == ROCK_LARGE) { - quakeIdx = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIdx, -0x3CB0); Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0); Quake_SetCountdown(quakeIdx, 7); @@ -444,20 +444,20 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { contactPos.x = this->actor.world.pos.x; contactPos.y = this->actor.world.pos.y + this->actor.yDistToWater; contactPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &contactPos, 0, 0, 0, 350); + EffectSsGSplash_Spawn(play, &contactPos, 0, 0, 0, 350); if (type == ROCK_SMALL) { - EffectSsGRipple_Spawn(globalCtx, &contactPos, 150, 650, 0); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 400, 800, 4); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1100, 8); + EffectSsGRipple_Spawn(play, &contactPos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &contactPos, 400, 800, 4); + EffectSsGRipple_Spawn(play, &contactPos, 500, 1100, 8); } else { - EffectSsGRipple_Spawn(globalCtx, &contactPos, 300, 700, 0); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 900, 4); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1300, 8); + EffectSsGRipple_Spawn(play, &contactPos, 300, 700, 0); + EffectSsGRipple_Spawn(play, &contactPos, 500, 900, 4); + EffectSsGRipple_Spawn(play, &contactPos, 500, 1300, 8); } this->actor.minVelocityY = -6.0f; sRockRotSpeedX >>= 2; sRockRotSpeedY >>= 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; } Math_StepToF(&this->actor.shape.yOffset, 0.0f, 2.0f); @@ -466,39 +466,39 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); this->actor.shape.rot.x += sRockRotSpeedX; this->actor.shape.rot.y += sRockRotSpeedY; - 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_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnIshi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Update(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnIshi_DrawSmall(EnIshi* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gFieldKakeraDL); +void EnIshi_DrawSmall(EnIshi* this, PlayState* play) { + Gfx_DrawDListOpa(play, gFieldKakeraDL); } -void EnIshi_DrawLarge(EnIshi* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnIshi_DrawLarge(EnIshi* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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, 0, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, gSilverRockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static EnIshiDrawFunc sDrawFuncs[] = { EnIshi_DrawSmall, EnIshi_DrawLarge }; -void EnIshi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Draw(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - sDrawFuncs[this->actor.params & 1](this, globalCtx); + sDrawFuncs[this->actor.params & 1](this, play); } void EnIshi_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h b/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h index e1566db3c..3ce7c72bf 100644 --- a/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h +++ b/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h @@ -11,9 +11,9 @@ typedef enum { struct EnIshi; -typedef void (*EnIshiActionFunc)(struct EnIshi*, GlobalContext*); -typedef void (*EnIshiEffectSpawnFunc)(struct EnIshi*, GlobalContext*); -typedef void (*EnIshiDrawFunc)(struct EnIshi*, GlobalContext*); +typedef void (*EnIshiActionFunc)(struct EnIshi*, PlayState*); +typedef void (*EnIshiEffectSpawnFunc)(struct EnIshi*, PlayState*); +typedef void (*EnIshiDrawFunc)(struct EnIshi*, PlayState*); typedef struct EnIshi { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_It/z_en_it.c b/soh/src/overlays/actors/ovl_En_It/z_en_it.c index 977ef8564..eb34b3618 100644 --- a/soh/src/overlays/actors/ovl_En_It/z_en_it.c +++ b/soh/src/overlays/actors/ovl_En_It/z_en_it.c @@ -8,9 +8,9 @@ #define FLAGS 0 -void EnIt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIt_Update(Actor* thisx, GlobalContext* globalCtx); +void EnIt_Init(Actor* thisx, PlayState* play); +void EnIt_Destroy(Actor* thisx, PlayState* play); +void EnIt_Update(Actor* thisx, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -47,25 +47,25 @@ const ActorInit En_It_InitVars = { NULL, }; -void EnIt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIt_Init(Actor* thisx, PlayState* play) { EnIt* this = (EnIt*)thisx; this->actor.params = 0x0D05; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, 0, &sColChkInfoInit); } -void EnIt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIt_Destroy(Actor* thisx, PlayState* play) { EnIt* this = (EnIt*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnIt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIt_Update(Actor* thisx, PlayState* play) { EnIt* this = (EnIt*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } diff --git a/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.c b/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.c index 101a10b4d..eabc9aaa6 100644 --- a/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -17,16 +17,16 @@ typedef enum { /* 3 */ JABUJABU_EYE_MAX } EnJjEyeState; -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJj_Init(Actor* thisx, PlayState* play); +void EnJj_Destroy(Actor* thisx, PlayState* play); +void EnJj_Update(Actor* thisx, PlayState* play); +void EnJj_Draw(Actor* thisx, PlayState* play); -void EnJj_UpdateStaticCollision(Actor* thisx, GlobalContext* globalCtx); -void EnJj_WaitToOpenMouth(EnJj* this, GlobalContext* globalCtx); -void EnJj_WaitForFish(EnJj* this, GlobalContext* globalCtx); -void EnJj_BeginCutscene(EnJj* this, GlobalContext* globalCtx); -void EnJj_RemoveDust(EnJj* this, GlobalContext* globalCtx); +void EnJj_UpdateStaticCollision(Actor* thisx, PlayState* play); +void EnJj_WaitToOpenMouth(EnJj* this, PlayState* play); +void EnJj_WaitForFish(EnJj* this, PlayState* play); +void EnJj_BeginCutscene(EnJj* this, PlayState* play); +void EnJj_RemoveDust(EnJj* this, PlayState* play); const ActorInit En_Jj_InitVars = { ACTOR_EN_JJ, @@ -78,8 +78,8 @@ void EnJj_SetupAction(EnJj* this, EnJjActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnJj_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnJj* this = (EnJj*)thisx; CollisionHeader* colHeader = NULL; @@ -88,7 +88,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { switch (this->dyna.actor.params) { case JABUJABU_MAIN: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gJabuJabuSkel, &gJabuJabuAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gJabuJabuSkel, &gJabuJabuAnim, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &gJabuJabuAnim); this->unk_30A = 0; @@ -104,22 +104,22 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->bodyCollisionActor = (DynaPolyActor*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, + &play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, JABUJABU_COLLISION); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gJabuJabuHeadCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; break; case JABUJABU_COLLISION: DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gJabuJabuBodyCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = EnJj_UpdateStaticCollision; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); @@ -128,7 +128,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { case JABUJABU_UNUSED_COLLISION: DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gJabuJabuUnusedCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.update = EnJj_UpdateStaticCollision; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); @@ -136,18 +136,18 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_Destroy(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; switch (this->dyna.actor.params) { case JABUJABU_MAIN: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); break; case JABUJABU_COLLISION: case JABUJABU_UNUSED_COLLISION: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; } } @@ -175,30 +175,30 @@ void EnJj_Blink(EnJj* this) { } } -void EnJj_OpenMouth(EnJj* this, GlobalContext* globalCtx) { +void EnJj_OpenMouth(EnJj* this, PlayState* play) { DynaPolyActor* bodyCollisionActor = this->bodyCollisionActor; if (this->mouthOpenAngle >= -5200) { this->mouthOpenAngle -= 102; if (this->mouthOpenAngle < -2600) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, bodyCollisionActor->bgId); + func_8003EBF8(play, &play->colCtx.dyna, bodyCollisionActor->bgId); } } } -void EnJj_WaitToOpenMouth(EnJj* this, GlobalContext* globalCtx) { +void EnJj_WaitToOpenMouth(EnJj* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 300.0f) { EnJj_SetupAction(this, EnJj_OpenMouth); } } -void EnJj_WaitForFish(EnJj* this, GlobalContext* globalCtx) { +void EnJj_WaitForFish(EnJj* this, PlayState* play) { static Vec3f feedingSpot = { -1589.0f, 53.0f, -43.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((Math_Vec3f_DistXZ(&feedingSpot, &player->actor.world.pos) < 300.0f) && - globalCtx->isPlayerDroppingFish(globalCtx)) { + play->isPlayerDroppingFish(play)) { this->cutsceneCountdownTimer = 100; EnJj_SetupAction(this, EnJj_BeginCutscene); } @@ -206,27 +206,27 @@ void EnJj_WaitForFish(EnJj* this, GlobalContext* globalCtx) { this->collider.dim.pos.x = -1245; this->collider.dim.pos.y = 20; this->collider.dim.pos.z = -48; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnJj_BeginCutscene(EnJj* this, GlobalContext* globalCtx) { +void EnJj_BeginCutscene(EnJj* this, PlayState* play) { DynaPolyActor* bodyCollisionActor = this->bodyCollisionActor; if (this->cutsceneCountdownTimer > 0) { this->cutsceneCountdownTimer--; } else { EnJj_SetupAction(this, EnJj_RemoveDust); - globalCtx->csCtx.segment = &D_80A88164; + play->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = 1; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, bodyCollisionActor->bgId); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8003EBF8(play, &play->colCtx.dyna, bodyCollisionActor->bgId); + func_8005B1A4(GET_ACTIVE_CAM(play)); gSaveContext.eventChkInf[3] |= 0x400; func_80078884(NA_SE_SY_CORRECT_CHIME); } } -void EnJj_CutsceneUpdate(EnJj* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.npcActions[2]->action) { +void EnJj_CutsceneUpdate(EnJj* this, PlayState* play) { + switch (play->csCtx.npcActions[2]->action) { case 1: if (this->unk_30A & 2) { this->eyeIndex = 0; @@ -241,7 +241,7 @@ void EnJj_CutsceneUpdate(EnJj* this, GlobalContext* globalCtx) { this->unk_30A |= 1; if (!(this->unk_30A & 8)) { - this->dust = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EFF_DUST, + this->dust = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EFF_DUST, -1100.0f, 105.0f, -27.0f, 0, 0, 0, EFF_DUST_TYPE_0); this->unk_30A |= 8; } @@ -267,7 +267,7 @@ void EnJj_CutsceneUpdate(EnJj* this, GlobalContext* globalCtx) { } } -void EnJj_RemoveDust(EnJj* this, GlobalContext* globalCtx) { +void EnJj_RemoveDust(EnJj* this, PlayState* play) { Actor* dust; if (!(this->unk_30A & 4)) { @@ -281,16 +281,16 @@ void EnJj_RemoveDust(EnJj* this, GlobalContext* globalCtx) { } } -void EnJj_UpdateStaticCollision(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_UpdateStaticCollision(Actor* thisx, PlayState* play) { } -void EnJj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_Update(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[2] != NULL)) { - EnJj_CutsceneUpdate(this, globalCtx); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[2] != NULL)) { + EnJj_CutsceneUpdate(this, play); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->skelAnime.curFrame == 41.0f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_JABJAB_GROAN); @@ -305,19 +305,19 @@ void EnJj_Update(Actor* thisx, GlobalContext* globalCtx) { this->skelAnime.jointTable[10].z = this->mouthOpenAngle; } -void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnJj_Draw(Actor* thisx, PlayState* play2) { static void* eyeTextures[] = { gJabuJabuEyeOpenTex, gJabuJabuEyeHalfTex, gJabuJabuEyeClosedTex }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnJj* this = (EnJj*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * (M_PI / 41.0f)) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.h b/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.h index 3733cc976..3d5a9dc15 100644 --- a/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/soh/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -6,7 +6,7 @@ struct EnJj; -typedef void (*EnJjActionFunc)(struct EnJj*, GlobalContext*); +typedef void (*EnJjActionFunc)(struct EnJj*, PlayState*); typedef struct EnJj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_En_Js/z_en_js.c b/soh/src/overlays/actors/ovl_En_Js/z_en_js.c index e2f093769..fd0a277e0 100644 --- a/soh/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/soh/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnJs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJs_Init(Actor* thisx, PlayState* play); +void EnJs_Destroy(Actor* thisx, PlayState* play); +void EnJs_Update(Actor* thisx, PlayState* play); +void EnJs_Draw(Actor* thisx, PlayState* play); -void func_80A89304(EnJs* this, GlobalContext* globalCtx); +void func_80A89304(EnJs* this, PlayState* play); const ActorInit En_Js_InitVars = { ACTOR_EN_JS, @@ -53,35 +53,35 @@ void En_Js_SetupAction(EnJs* this, EnJsActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnJs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Init(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCarpetMerchantSkel, &gCarpetMerchantSlappingKneeAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gCarpetMerchantSkel, &gCarpetMerchantSlappingKneeAnim, this->jointTable, this->morphTable, 13); Animation_PlayOnce(&this->skelAnime, &gCarpetMerchantSlappingKneeAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); En_Js_SetupAction(this, func_80A89304); this->unk_284 = 0; this->actor.gravity = -1.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_JSJUTAN, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_JSJUTAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } -void EnJs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Destroy(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -u8 func_80A88F64(EnJs* this, GlobalContext* globalCtx, u16 textId) { +u8 func_80A88F64(EnJs* this, PlayState* play, u16 textId) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return 1; } else { this->actor.textId = textId; @@ -89,7 +89,7 @@ u8 func_80A88F64(EnJs* this, GlobalContext* globalCtx, u16 textId) { if (ABS(yawDiff) <= 0x1800 && this->actor.xzDistToPlayer < 100.0f) { this->unk_284 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } @@ -101,44 +101,44 @@ void func_80A89008(EnJs* this) { Animation_GetLastFrame(&gCarpetMerchantSlappingKneeAnim), ANIMMODE_ONCE, -4.0f); } -void func_80A89078(EnJs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A89078(EnJs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A89008(this); this->actor.flags &= ~ACTOR_FLAG_16; } } -void func_80A890C0(EnJs* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80A890C0(EnJs* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { En_Js_SetupAction(this, func_80A89078); } else { - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } } -void func_80A8910C(EnJs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A8910C(EnJs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.textId = 0x6078; En_Js_SetupAction(this, func_80A890C0); this->actor.flags |= ACTOR_FLAG_16; } } -void func_80A89160(EnJs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A89160(EnJs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; En_Js_SetupAction(this, func_80A8910C); } else { - func_8002F434(&this->actor, globalCtx, GI_BOMBCHUS_10, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_BOMBCHUS_10, 10000.0f, 50.0f); } } -void func_80A891C4(EnJs* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80A891C4(EnJs* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes if (gSaveContext.rupees < 200) { - Message_ContinueTextbox(globalCtx, 0x6075); + Message_ContinueTextbox(play, 0x6075); func_80A89008(this); } else { Rupees_ChangeBy(-200); @@ -146,7 +146,7 @@ void func_80A891C4(EnJs* this, GlobalContext* globalCtx) { } break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x6074); + Message_ContinueTextbox(play, 0x6074); func_80A89008(this); } } @@ -158,24 +158,24 @@ void func_80A89294(EnJs* this) { Animation_GetLastFrame(&gCarpetMerchantIdleAnim), ANIMMODE_ONCE, -4.0f); } -void func_80A89304(EnJs* this, GlobalContext* globalCtx) { - if (func_80A88F64(this, globalCtx, 0x6077)) { +void func_80A89304(EnJs* this, PlayState* play) { + if (func_80A88F64(this, play, 0x6077)) { func_80A89294(this); } } -void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Update(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; s32 pad; s32 pad2; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (this->actor.bgCheckFlags & 1) { - if (SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1) { + if (SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1) { Math_ApproachF(&this->actor.shape.yOffset, sREG(80) + -2000.0f, 1.0f, (sREG(81) / 10.0f) + 50.0f); } } else { @@ -184,9 +184,9 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_284 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_278.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->unk_278.y, 0, 6, 0x1838, 0x64); @@ -206,7 +206,7 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnJs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnJs* this = (EnJs*)thisx; if (limbIndex == 12) { @@ -215,7 +215,7 @@ s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnJs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnJs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80A896DC = { 0.0f, 0.0f, 0.0f }; EnJs* this = (EnJs*)thisx; @@ -223,10 +223,10 @@ void EnJs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Matrix_MultVec3f(&D_80A896DC, &this->actor.focus.pos); } } -void EnJs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Draw(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnJs_OverrideLimbDraw, EnJs_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Js/z_en_js.h b/soh/src/overlays/actors/ovl_En_Js/z_en_js.h index 7653b15d3..f1e356b2c 100644 --- a/soh/src/overlays/actors/ovl_En_Js/z_en_js.h +++ b/soh/src/overlays/actors/ovl_En_Js/z_en_js.h @@ -6,7 +6,7 @@ struct EnJs; -typedef void (*EnJsActionFunc)(struct EnJs*, GlobalContext*); +typedef void (*EnJsActionFunc)(struct EnJs*, PlayState*); typedef struct EnJs { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 98b86d211..6217ae1c4 100644 --- a/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnJsjutan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJsjutan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJsjutan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJsjutan_Init(Actor* thisx, PlayState* play); +void EnJsjutan_Destroy(Actor* thisx, PlayState* play); +void EnJsjutan_Update(Actor* thisx, PlayState* play); +void EnJsjutan_Draw(Actor* thisx, PlayState* play); const ActorInit En_Jsjutan_InitVars = { ACTOR_EN_JSJUTAN, @@ -36,7 +36,7 @@ static s32 sUnused[2] = { 0, 0 }; #include "overlays/ovl_En_Jsjutan/ovl_En_Jsjutan.h" -void EnJsjutan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJsjutan_Init(Actor* thisx, PlayState* play) { EnJsjutan* this = (EnJsjutan*)thisx; s32 pad; CollisionHeader* header = NULL; @@ -44,19 +44,19 @@ void EnJsjutan_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.flags &= ~ACTOR_FLAG_0; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&sCol, &header); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, header); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, header); Actor_SetScale(thisx, 0.02f); this->unk_164 = true; this->shadowAlpha = 100.0f; } -void EnJsjutan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJsjutan_Destroy(Actor* thisx, PlayState* play) { EnJsjutan* this = (EnJsjutan*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80A89860(EnJsjutan* this, GlobalContext* globalCtx) { +void func_80A89860(EnJsjutan* this, PlayState* play) { s16 i; Vtx* oddVtx; Vtx* evenVtx; @@ -73,14 +73,14 @@ void func_80A89860(EnJsjutan* this, GlobalContext* globalCtx) { } else { this->dyna.actor.world.pos.x = oddVtx->v.ob[0] * 0.02f + actorPos.x; this->dyna.actor.world.pos.z = oddVtx->v.ob[2] * 0.02f + actorPos.z; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 10.0f, 10.0f, 10.0f, 4); oddVtx->v.ob[1] = evenVtx->v.ob[1] = this->dyna.actor.floorHeight; this->dyna.actor.world.pos = actorPos; } } } -void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { +void func_80A89A6C(EnJsjutan* this, PlayState* play) { u8 isPlayerOnTop = false; // sp127 s16 i; s16 j; @@ -112,12 +112,12 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { f32 maxOffset; f32 maxAmp; f32 waveform; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* parent = this->dyna.actor.parent; - Actor* actorExplosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + Actor* actorExplosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; u8 isInCreditsScene = false; // sp8B - if (globalCtx->gameplayFrames % 2 != 0) { + if (play->gameplayFrames % 2 != 0) { carpetVtx = SEGMENTED_TO_VIRTUAL(sCarpetOddVtx); shadowVtx = SEGMENTED_TO_VIRTUAL(gShadowOddVtx); } else { @@ -154,7 +154,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { if ((gSaveContext.entranceIndex == 0x157) && (gSaveContext.sceneSetupIndex == 8)) { isInCreditsScene = true; - actorProfessor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actorProfessor = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actorProfessor != NULL) { if (actorProfessor->id == ACTOR_EN_MK) { break; @@ -162,7 +162,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { actorProfessor = actorProfessor->next; } - actorBeanGuy = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actorBeanGuy = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actorBeanGuy != NULL) { if (actorBeanGuy->id == ACTOR_EN_MS) { break; @@ -273,7 +273,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { * A: spA8 * D: phi_f28 */ - waveform = spA8 * Math_SinS(globalCtx->gameplayFrames * 4000 + i * 10000); + waveform = spA8 * Math_SinS(play->gameplayFrames * 4000 + i * 10000); if (this->unk_174) { s16 phi_v1_4 = offset + waveform; @@ -360,20 +360,20 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { } } -void EnJsjutan_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnJsjutan_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; - thisx->shape.rot.x = Math_SinS(globalCtx->gameplayFrames * 3000) * 300.0f; - thisx->shape.rot.z = Math_CosS(globalCtx->gameplayFrames * 3500) * 300.0f; + thisx->shape.rot.x = Math_SinS(play->gameplayFrames * 3000) * 300.0f; + thisx->shape.rot.z = Math_CosS(play->gameplayFrames * 3500) * 300.0f; } -void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnJsjutan_Draw(Actor* thisx, PlayState* play2) { EnJsjutan* this = (EnJsjutan*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 i; Actor* parent = thisx->parent; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (thisx->params == ENJSJUTAN_TYPE_01) { thisx->world.pos.x = parent->world.pos.x; @@ -382,7 +382,7 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { this->unk_168 = thisx->world.pos.y; if (!this->unk_175) { this->unk_175 = true; - func_80A89860(this, globalCtx); + func_80A89860(this, play); } } else if (!this->unk_175) { this->unk_175 = true; @@ -390,10 +390,10 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { thisx->world.pos.y = (parent->world.pos.y + 5.0f) - 10.0f; thisx->world.pos.z = Math_CosS(parent->shape.rot.y) * 60.0f + parent->world.pos.z; this->unk_168 = thisx->world.pos.y; - func_80A89860(this, globalCtx); + func_80A89860(this, play); } - func_80A89A6C(this, globalCtx); + func_80A89A6C(this, play); if (this->unk_164) { this->unk_164 = false; @@ -407,14 +407,14 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { } } } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (s16)this->shadowAlpha); Matrix_Translate(thisx->world.pos.x, 3.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, 1.0f, thisx->scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); // Draws the carpet's shadow texture. @@ -423,18 +423,18 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { gDPPipeSync(POLY_OPA_DISP++); // Draws the carpet's shadow vertices. Swaps them between frames to get a smoother result. - if (globalCtx->gameplayFrames % 2 != 0) { + if (play->gameplayFrames % 2 != 0) { gSPSegment(POLY_OPA_DISP++, 0x0C, gShadowOddVtx); } else { gSPSegment(POLY_OPA_DISP++, 0x0C, sShadowEvenVtx); } gSPDisplayList(POLY_OPA_DISP++, sModelDL); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(thisx->world.pos.x, this->unk_168 + 3.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); // Draws the carpet's texture. gSPDisplayList(POLY_OPA_DISP++, sCarpetMaterialDL); @@ -442,12 +442,12 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { gDPPipeSync(POLY_OPA_DISP++); // Draws the carpet vertices. - if (globalCtx->gameplayFrames % 2 != 0) { + if (play->gameplayFrames % 2 != 0) { gSPSegment(POLY_OPA_DISP++, 0x0C, sCarpetOddVtx); } else { gSPSegment(POLY_OPA_DISP++, 0x0C, sCarpetEvenVtx); } gSPDisplayList(POLY_OPA_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 1685cd4e0..463829dd9 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnKakasi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKakasi_Init(Actor* thisx, PlayState* play); +void EnKakasi_Destroy(Actor* thisx, PlayState* play); +void EnKakasi_Update(Actor* thisx, PlayState* play); +void EnKakasi_Draw(Actor* thisx, PlayState* play); -void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8F8D0(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8F9C8(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8FBB8(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8FAA4(EnKakasi* this, GlobalContext* globalCtx); +void func_80A8F660(EnKakasi* this, PlayState* play); +void func_80A8F75C(EnKakasi* this, PlayState* play); +void func_80A8F8D0(EnKakasi* this, PlayState* play); +void func_80A8F9C8(EnKakasi* this, PlayState* play); +void func_80A8FBB8(EnKakasi* this, PlayState* play); +void func_80A8FAA4(EnKakasi* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -55,24 +55,24 @@ const ActorInit En_Kakasi_InitVars = { NULL, }; -void EnKakasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Destroy(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); - SkelAnime_Free(&this->skelanime, globalCtx); // OTR - Fixed this memory leak + Collider_DestroyCylinder(play, &this->collider); + SkelAnime_Free(&this->skelanime, play); // OTR - Fixed this memory leak //! @bug SkelAnime_Free is not called } -void EnKakasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Init(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ Let’s DANCE! ☆☆☆☆☆ %f\n" VT_RST, this->actor.world.pos.y); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 6; - SkelAnime_InitFlex(globalCtx, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->rot = this->actor.world.rot; this->actor.flags |= ACTOR_FLAG_10; @@ -93,8 +93,8 @@ void func_80A8F28C(EnKakasi* this) { Math_SmoothStepToS(&this->actor.shape.rot.z, this->rot.z, 5, 0x2710, 0); } -void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) { - s16 ocarinaNote = globalCtx->msgCtx.lastOcaNoteIdx; +void func_80A8F320(EnKakasi* this, PlayState* play, s16 arg) { + s16 ocarinaNote = play->msgCtx.lastOcaNoteIdx; s16 currentFrame; if (arg != 0) { @@ -171,7 +171,7 @@ void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) { } } -void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) { +void func_80A8F660(EnKakasi* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelanime, &object_ka_Anim_000214, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -194,13 +194,13 @@ void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) { this->actionFunc = func_80A8F75C; } -void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A8F75C(EnKakasi* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_80A8F28C(this); SkelAnime_Update(&this->skelanime); this->camId = SUBCAM_NONE; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->unk_196 == TEXT_STATE_EVENT) { this->actionFunc = func_80A8F9C8; } else { @@ -215,9 +215,9 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { if (absyawTowardsPlayer < 0x4300) { if (!this->unk_194) { if (player->stateFlags2 & 0x1000000) { - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); + this->camId = OnePointCutscene_Init(play, 2260, -99, &this->actor, MAIN_CAM); - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_LONG_RECORDING); + func_8010BD58(play, OCARINA_ACTION_SCARECROW_LONG_RECORDING); this->unk_19A = 0; this->unk_1B8 = 0.0; player->stateFlags2 |= 0x800000; @@ -228,93 +228,93 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { player->stateFlags2 |= 0x800000; } } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void func_80A8F8D0(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A8F8D0(EnKakasi* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04 && play->msgCtx.msgMode == MSGMODE_NONE) { // "end?" osSyncPrintf(VT_FGCOL(BLUE) "☆☆☆☆☆ 終り? ☆☆☆☆☆ \n" VT_RST); if (this->unk_19A != 0) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.textId = 0x4077; this->unk_196 = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = func_80A8F9C8; } else { - OnePointCutscene_EndCutscene(globalCtx, this->camId); + OnePointCutscene_EndCutscene(play, this->camId); this->camId = SUBCAM_NONE; this->actionFunc = func_80A8F660; } - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - func_80A8F320(this, globalCtx, 0); + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + func_80A8F320(this, play, 0); player->stateFlags2 |= 0x800000; } } -void func_80A8F9C8(EnKakasi* this, GlobalContext* globalCtx) { +void func_80A8F9C8(EnKakasi* this, PlayState* play) { func_80A8F28C(this); SkelAnime_Update(&this->skelanime); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); - if (this->unk_196 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { + if (this->unk_196 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->camId != SUBCAM_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + func_8005B1A4(play->cameraPtrs[this->camId]); } - this->camId = OnePointCutscene_Init(globalCtx, 2270, -99, &this->actor, MAIN_CAM); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(globalCtx, NULL, 8); - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK); + this->camId = OnePointCutscene_Init(play, 2270, -99, &this->actor, MAIN_CAM); + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8002DF54(play, NULL, 8); + func_8010BD58(play, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK); this->actionFunc = func_80A8FAA4; } } -void func_80A8FAA4(EnKakasi* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_0F) { - func_80A8F320(this, globalCtx, 1); +void func_80A8FAA4(EnKakasi* this, PlayState* play) { + if (play->msgCtx.ocarinaMode != OCARINA_MODE_0F) { + func_80A8F320(this, play, 1); return; } - osSyncPrintf("game_play->message.msg_mode=%d\n", globalCtx->msgCtx.msgMode); + osSyncPrintf("game_play->message.msg_mode=%d\n", play->msgCtx.msgMode); - if (globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if (play->msgCtx.msgMode == MSGMODE_NONE) { if (this->unk_194) { this->actor.textId = 0x4077; this->unk_196 = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); } else { this->actor.textId = 0x4078; this->unk_196 = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); } this->actionFunc = func_80A8FBB8; - OnePointCutscene_EndCutscene(globalCtx, this->camId); + OnePointCutscene_EndCutscene(play, this->camId); this->camId = SUBCAM_NONE; - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + this->camId = OnePointCutscene_Init(play, 2260, -99, &this->actor, MAIN_CAM); + func_8005B1A4(play->cameraPtrs[this->camId]); } } -void func_80A8FBB8(EnKakasi* this, GlobalContext* globalCtx) { +void func_80A8FBB8(EnKakasi* this, PlayState* play) { func_80A8F28C(this); SkelAnime_Update(&this->skelanime); - if (this->unk_196 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + if (this->unk_196 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + func_8005B1A4(play->cameraPtrs[this->camId]); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A8F660; } } -void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Update(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; s32 pad; s32 i; @@ -329,14 +329,14 @@ void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx) { this->height = 60.0f; Actor_SetFocus(&this->actor, this->height); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 28); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 28); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Draw(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; if (BREG(3) != 0) { @@ -344,7 +344,7 @@ void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) { // "flag!" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowCustomSongSet); } - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index aeb13ebcb..6b976c5cc 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -6,7 +6,7 @@ struct EnKakasi; -typedef void (*EnKakasiFunc)(struct EnKakasi*, GlobalContext*); +typedef void (*EnKakasiFunc)(struct EnKakasi*, PlayState*); typedef struct EnKakasi { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 0e1b2d67f..d3add65bb 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -30,16 +30,16 @@ static ColliderCylinderInit sCylinderInit = { { 20, 70, 0, { 0, 0, 0 } }, }; -void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx); -void func_80A90948(Actor* thisx, GlobalContext* globalCtx); +void EnKakasi2_Init(Actor* thisx, PlayState* play); +void EnKakasi2_Destroy(Actor* thisx, PlayState* play); +void EnKakasi2_Update(Actor* thisx, PlayState* play); +void func_80A90948(Actor* thisx, PlayState* play); -void func_80A9062C(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A904D8(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A90578(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A906C4(EnKakasi2* this, GlobalContext* globalCtx); +void func_80A9062C(EnKakasi2* this, PlayState* play); +void func_80A90264(EnKakasi2* this, PlayState* play); +void func_80A904D8(EnKakasi2* this, PlayState* play); +void func_80A90578(EnKakasi2* this, PlayState* play); +void func_80A906C4(EnKakasi2* this, PlayState* play); const ActorInit En_Kakasi2_InitVars = { ACTOR_EN_KAKASI2, @@ -54,7 +54,7 @@ const ActorInit En_Kakasi2_InitVars = { NULL, }; -void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi2_Init(Actor* thisx, PlayState* play) { EnKakasi2* this = (EnKakasi2*)thisx; s32 pad; f32 spawnRangeY; @@ -93,11 +93,11 @@ void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_10; this->unk_198 = this->actor.shape.rot.y; - if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) { this->actor.draw = func_80A90948; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->actionFunc = func_80A9062C; } else { this->actionFunc = func_80A90264; @@ -105,35 +105,35 @@ void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKakasi2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi2_Destroy(Actor* thisx, PlayState* play) { EnKakasi2* this = (EnKakasi2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); - SkelAnime_Free(&this->skelAnime, globalCtx); // OTR - Fixed this memory leak + Collider_DestroyCylinder(play, &this->collider); + SkelAnime_Free(&this->skelAnime, play); // OTR - Fixed this memory leak //! @bug SkelAnime_Free is not called } -void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A90264(EnKakasi2* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_194++; - bool skipScarecrow = globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_PLAYING && + bool skipScarecrow = play->msgCtx.msgMode == MSGMODE_OCARINA_PLAYING && ((CVar_GetS32("gSkipScarecrow", 0) && gSaveContext.scarecrowSpawnSongSet) || (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SKIP_SCARECROWS_SONG))); if ((BREG(1) != 0) || skipScarecrow && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)) { this->actor.draw = func_80A90948; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); - OnePointCutscene_Attention(globalCtx, &this->actor); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + OnePointCutscene_Attention(play, &this->actor); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; func_80078884(NA_SE_SY_CORRECT_CHIME); if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ SAVE 終了 ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); @@ -143,18 +143,18 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { (gSaveContext.eventChkInf[9] & 0x1000)) { this->unk_194 = 0; - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0B) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_0B) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ SAVE 終了 ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actor.draw = func_80A90948; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); - OnePointCutscene_Attention(globalCtx, &this->actor); + OnePointCutscene_Attention(play, &this->actor); func_80078884(NA_SE_SY_CORRECT_CHIME); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; @@ -163,7 +163,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { } } -void func_80A904D8(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A904D8(EnKakasi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelAnime, &object_ka_Anim_000214, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -171,7 +171,7 @@ void func_80A904D8(EnKakasi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A90578; } -void func_80A90578(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A90578(EnKakasi2* this, PlayState* play) { s16 currentFrame; SkelAnime_Update(&this->skelAnime); @@ -190,14 +190,14 @@ void func_80A90578(EnKakasi2* this, GlobalContext* globalCtx) { } } -void func_80A9062C(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A9062C(EnKakasi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelAnime, &object_ka_Anim_000214, 0.0f, 0.0f, (s16)frameCount, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80A906C4; } -void func_80A906C4(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A906C4(EnKakasi2* this, PlayState* play) { if (this->skelAnime.curFrame != 0) { Math_ApproachZeroF(&this->skelAnime.curFrame, 0.5f, 1.0f); } @@ -205,19 +205,19 @@ void func_80A906C4(EnKakasi2* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } -void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnKakasi2_Update(Actor* thisx, PlayState* play2) { EnKakasi2* this = (EnKakasi2*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; this->actor.world.rot = this->actor.shape.rot; Actor_SetFocus(&this->actor, this->height); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); if (this->actor.shape.yOffset == 0.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (BREG(0) != 0) { if (BREG(5) != 0) { @@ -231,21 +231,21 @@ void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->unk_194 % 2) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, - 1.0f, 1.0f, 1.0f, 70, 70, 70, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 1.0f, 70, 70, 70, 255, 4, play->state.gfxCtx); } } else { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 255, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 255, 255, 255, 4, play->state.gfxCtx); } } } } -void func_80A90948(Actor* thisx, GlobalContext* globalCtx) { +void func_80A90948(Actor* thisx, PlayState* play) { EnKakasi2* this = (EnKakasi2*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h b/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h index a917e7e2e..9309c1672 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h +++ b/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h @@ -6,7 +6,7 @@ struct EnKakasi2; -typedef void (*EnKakasi2ActionFunc)(struct EnKakasi2*, GlobalContext*); +typedef void (*EnKakasi2ActionFunc)(struct EnKakasi2*, PlayState*); typedef struct EnKakasi2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 9c2167740..74eada74a 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -10,21 +10,21 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnKakasi3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKakasi3_Init(Actor* thisx, PlayState* play); +void EnKakasi3_Destroy(Actor* thisx, PlayState* play); +void EnKakasi3_Update(Actor* thisx, PlayState* play); +void EnKakasi3_Draw(Actor* thisx, PlayState* play); -void func_80A911F0(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91A90(EnKakasi3* this, GlobalContext* globalCtx); +void func_80A911F0(EnKakasi3* this, PlayState* play); +void func_80A91284(EnKakasi3* this, PlayState* play); +void func_80A91348(EnKakasi3* this, PlayState* play); +void func_80A915B8(EnKakasi3* this, PlayState* play); +void func_80A91620(EnKakasi3* this, PlayState* play); +void func_80A91760(EnKakasi3* this, PlayState* play); +void func_80A917FC(EnKakasi3* this, PlayState* play); +void func_80A9187C(EnKakasi3* this, PlayState* play); +void func_80A918E4(EnKakasi3* this, PlayState* play); +void func_80A91A90(EnKakasi3* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -59,15 +59,15 @@ const ActorInit En_Kakasi3_InitVars = { NULL, }; -void EnKakasi3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Destroy(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); - SkelAnime_Free(&this->skelAnime, globalCtx); //OTR - Fixed this memory leak + Collider_DestroyCylinder(play, &this->collider); + SkelAnime_Free(&this->skelAnime, play); //OTR - Fixed this memory leak //! @bug SkelAnime_Free is not called } -void EnKakasi3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Init(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; osSyncPrintf("\n\n"); @@ -75,9 +75,9 @@ void EnKakasi3_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ おーボヌール ☆☆☆☆☆ \n" VT_RST); this->actor.targetMode = 6; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->actor.flags |= ACTOR_FLAG_10; this->rot = this->actor.world.rot; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -96,9 +96,9 @@ void func_80A90E28(EnKakasi3* this) { Math_SmoothStepToS(&this->actor.shape.rot.z, this->rot.z, 5, 0x2710, 0); } -void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) { +void func_80A90EBC(EnKakasi3* this, PlayState* play, s32 arg) { s16 currentFrame; - s16 ocarinaNote = globalCtx->msgCtx.lastOcaNoteIdx; + s16 ocarinaNote = play->msgCtx.lastOcaNoteIdx; if (arg != 0) { if (this->unk_19C[3] == 0) { @@ -174,14 +174,14 @@ void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) { } } -void func_80A911F0(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A911F0(EnKakasi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelAnime, &object_ka_Anim_000214, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A91284; } -void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A91284(EnKakasi3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.textId = 0x40A1; @@ -208,13 +208,13 @@ void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx) { this->actionFunc = func_80A91348; } -void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A91348(EnKakasi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_80A90E28(this); SkelAnime_Update(&this->skelAnime); this->camId = SUBCAM_NONE; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (!this->unk_194) { if (this->unk_1A8 == 0) { this->actionFunc = func_80A91284; @@ -234,11 +234,11 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { if (!this->unk_194) { if (player->stateFlags2 & 0x1000000) { - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + this->camId = OnePointCutscene_Init(play, 2260, -99, &this->actor, MAIN_CAM); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; - Message_StartTextbox(globalCtx, 0x40A4, NULL); + Message_StartTextbox(play, 0x40A4, NULL); player->stateFlags2 |= 0x800000; this->actionFunc = func_80A915B8; return; @@ -249,11 +249,11 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { } else if (gSaveContext.scarecrowSpawnSongSet && !this->unk_195) { if (player->stateFlags2 & 0x1000000) { - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + this->camId = OnePointCutscene_Init(play, 2260, -99, &this->actor, MAIN_CAM); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; - Message_StartTextbox(globalCtx, 0x40A8, NULL); + Message_StartTextbox(play, 0x40A8, NULL); player->stateFlags2 |= 0x800000; this->actionFunc = func_80A9187C; return; @@ -262,151 +262,151 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { player->stateFlags2 |= 0x800000; } } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_RECORDING); +void func_80A915B8(EnKakasi3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8010BD58(play, OCARINA_ACTION_SCARECROW_RECORDING); this->actionFunc = func_80A91620; } } -void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A91620(EnKakasi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 || - (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05 && globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && - (globalCtx->msgCtx.msgMode == MSGMODE_NONE)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_04 || + (play->msgCtx.ocarinaMode >= OCARINA_MODE_05 && play->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && + (play->msgCtx.msgMode == MSGMODE_NONE)) { - OnePointCutscene_EndCutscene(globalCtx, this->camId); - if (globalCtx->cameraPtrs[this->camId] == NULL) { + OnePointCutscene_EndCutscene(play, this->camId); + if (play->cameraPtrs[this->camId] == NULL) { this->camId = SUBCAM_NONE; } if (this->camId != SUBCAM_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + func_8005B1A4(play->cameraPtrs[this->camId]); } this->actionFunc = func_80A911F0; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03 && play->msgCtx.msgMode == MSGMODE_NONE) { this->dialogState = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, 0x40A5, NULL); - func_8002DF54(globalCtx, NULL, 8); + Message_StartTextbox(play, 0x40A5, NULL); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A91A90; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - func_80A90EBC(this, globalCtx, 0); + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + func_80A90EBC(this, play, 0); player->stateFlags2 |= 0x800000; } } -void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A91760(EnKakasi3* this, PlayState* play) { func_80A90E28(this); SkelAnime_Update(&this->skelAnime); - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_PLAYBACK); + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8010BD58(play, OCARINA_ACTION_SCARECROW_PLAYBACK); this->actionFunc = func_80A917FC; - this->camId = OnePointCutscene_Init(globalCtx, 2280, -99, &this->actor, MAIN_CAM); + this->camId = OnePointCutscene_Init(play, 2280, -99, &this->actor, MAIN_CAM); } } -void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A917FC(EnKakasi3* this, PlayState* play) { - if (globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_0F) { - func_80A90EBC(this, globalCtx, 1); + if (play->msgCtx.ocarinaMode != OCARINA_MODE_0F) { + func_80A90EBC(this, play, 1); } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); - OnePointCutscene_EndCutscene(globalCtx, this->camId); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + OnePointCutscene_EndCutscene(play, this->camId); this->actionFunc = func_80A911F0; } } -void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SCARECROW); +void func_80A9187C(EnKakasi3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8010BD58(play, OCARINA_ACTION_CHECK_SCARECROW); this->actionFunc = func_80A918E4; } } -void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A918E4(EnKakasi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (BREG(3) != 0) { // "No way!" - osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ まさか! ☆☆☆☆☆ %d\n" VT_RST, globalCtx->msgCtx.ocarinaMode); + osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ まさか! ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); } - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 || - (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05 && globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && - globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_04 || + (play->msgCtx.ocarinaMode >= OCARINA_MODE_05 && play->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && + play->msgCtx.msgMode == MSGMODE_NONE) { - Message_StartTextbox(globalCtx, 0x40A6, NULL); + Message_StartTextbox(play, 0x40A6, NULL); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_EndCutscene(globalCtx, this->camId); + OnePointCutscene_EndCutscene(play, this->camId); this->camId = SUBCAM_NONE; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A91A90; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03 && play->msgCtx.msgMode == MSGMODE_NONE) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; if (BREG(3) != 0) { osSyncPrintf("\n\n"); // "With this, other guys are OK! That's it!" osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ これで、他の奴もOK!だ! ☆☆☆☆☆ %d\n" VT_RST, - globalCtx->msgCtx.ocarinaMode); + play->msgCtx.ocarinaMode); } this->unk_195 = true; - Message_StartTextbox(globalCtx, 0x40A7, NULL); + Message_StartTextbox(play, 0x40A7, NULL); this->dialogState = TEXT_STATE_EVENT; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A91A90; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - func_80A90EBC(this, globalCtx, 0); + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + func_80A90EBC(this, play, 0); player->stateFlags2 |= 0x800000; } } -void func_80A91A90(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A91A90(EnKakasi3* this, PlayState* play) { func_80A90E28(this); SkelAnime_Update(&this->skelAnime); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->unk_195) { if (!(gSaveContext.eventChkInf[9] & 0x1000)) { gSaveContext.eventChkInf[9] |= 0x1000; } } - if (globalCtx->cameraPtrs[this->camId] == NULL) { + if (play->cameraPtrs[this->camId] == NULL) { this->camId = SUBCAM_NONE; } if (this->camId != SUBCAM_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + func_8005B1A4(play->cameraPtrs[this->camId]); } - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - func_8002DF54(globalCtx, NULL, 7); + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A911F0; } } -void EnKakasi3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Update(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; s32 pad; s32 i; @@ -426,17 +426,17 @@ void EnKakasi3_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 60.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 28); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 28); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnKakasi3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Draw(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h b/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h index a5c68445a..775f97e90 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h +++ b/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h @@ -6,7 +6,7 @@ struct EnKakasi3; -typedef void (*EnKakasi3ActionFunc)(struct EnKakasi3*, GlobalContext*); +typedef void (*EnKakasi3ActionFunc)(struct EnKakasi3*, PlayState*); typedef struct EnKakasi3 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/soh/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index ed135655c..77cb939b4 100644 --- a/soh/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/soh/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -70,10 +70,10 @@ typedef enum { CUT_VERT_R } EnKanbanCutType; -void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKanban_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKanban_Init(Actor* thisx, PlayState* play); +void EnKanban_Destroy(Actor* thisx, PlayState* play); +void EnKanban_Update(Actor* thisx, PlayState* play); +void EnKanban_Draw(Actor* thisx, PlayState* play); const ActorInit En_Kanban_InitVars = { ACTOR_EN_KANBAN, @@ -191,15 +191,15 @@ void EnKanban_SetFloorRot(EnKanban* this) { } } -void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Init(Actor* thisx, PlayState* play) { EnKanban* this = (EnKanban*)thisx; Actor_SetScale(&this->actor, 0.01f); if (this->actor.params != ENKANBAN_PIECE) { this->actor.targetMode = 0; this->actor.flags |= ACTOR_FLAG_0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); osSyncPrintf("KANBAN ARG %x\n", this->actor.params); if (this->actor.params == ENKANBAN_FISHING) { if (LINK_IS_CHILD) { @@ -212,7 +212,7 @@ void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { } this->bounceX = 1; this->partFlags = 0xFFFF; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 4); EnKanban_SetFloorRot(this); if (LINK_IS_CHILD) { this->actor.world.pos.y -= 15.0f; @@ -220,43 +220,43 @@ void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKanban_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnKanban* this = (EnKanban*)thisx; if (this->actionState == ENKANBAN_SIGN) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnKanban_Message(EnKanban* this, GlobalContext* globalCtx) { +void EnKanban_Message(EnKanban* this, PlayState* play) { if (!this->msgFlag) { if (this->msgTimer == 0) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x2800) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->msgFlag = true; } else { - func_8002F2CC(&this->actor, globalCtx, 68.0f); + func_8002F2CC(&this->actor, play, 68.0f); } } } else { this->msgTimer--; } } else { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->msgFlag = false; this->msgTimer = 20; } } } -void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnKanban_Update(Actor* thisx, PlayState* play2) { u8 bounced = false; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnKanban* this = (EnKanban*)thisx; EnKanban* signpost; EnKanban* piece; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f offset; this->frameCount++; @@ -272,12 +272,12 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.flags &= ~ACTOR_FLAG_0; } if (this->partFlags == 0xFFFF) { - EnKanban_Message(this, globalCtx); + EnKanban_Message(this, play); } if ((this->invincibilityTimer == 0) && (this->collider.base.acFlags & AC_HIT)) { this->collider.base.acFlags &= ~AC_HIT; this->invincibilityTimer = 6; - piece = (EnKanban*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_KANBAN, + piece = (EnKanban*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_KANBAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, ENKANBAN_PIECE); @@ -396,8 +396,8 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 44.0f; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer > 500.0f) { this->actor.flags |= ACTOR_FLAG_0; this->partFlags = 0xFFFF; @@ -427,7 +427,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { u8 onGround; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 50.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 50.0f, 5); tempX = this->actor.world.pos.x; tempY = this->actor.world.pos.y; @@ -436,7 +436,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { tempYDistToWater = this->actor.yDistToWater; this->actor.world.pos.z += ((this->actor.world.pos.y - this->actor.floorHeight) * -50.0f) / 100.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 4); EnKanban_SetFloorRot(this); this->actor.world.pos.x = tempX; @@ -492,9 +492,9 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMB_DROP_WATER); this->bounceX = this->bounceZ = 0; this->actor.world.pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, 150, 650, 0); - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, 300, 800, 5); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; osSyncPrintf(" WAT Y = %f\n", this->actor.yDistToWater); @@ -563,7 +563,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { for (j = 0; j < dustCount + 3; j++) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f); - func_800286CC(globalCtx, &pos, &velocity, &accel, 100, 5); + func_800286CC(play, &pos, &velocity, &accel, 100, 5); } } if (DECR(this->airTimer) == 0) { @@ -600,7 +600,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { } Actor_MoveForward(&this->actor); if (this->actor.speedXZ != 0.0f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, 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) { @@ -633,9 +633,9 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { rippleScale = 200; } - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, rippleScale, rippleScale + 500, 0); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, rippleScale, rippleScale + 500, 0); } - } else if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xyzDistToPlayerSq < SQ(100.0f))) { + } else if ((play->actorCtx.unk_02 != 0) && (this->actor.xyzDistToPlayerSq < SQ(100.0f))) { f32 hammerStrength = (100.0f - sqrtf(this->actor.xyzDistToPlayerSq)) * 0.05f; this->actionState = ENKANBAN_AIR; @@ -661,7 +661,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->airTimer = 70; } if (this->bounceX == 0) { - Actor* bomb = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + Actor* bomb = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; f32 dx; f32 dy; f32 dz; @@ -703,17 +703,17 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { } } osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("OCARINA_MODE %d\n", globalCtx->msgCtx.ocarinaMode); + osSyncPrintf("OCARINA_MODE %d\n", play->msgCtx.ocarinaMode); osSyncPrintf(VT_RST); switch (this->ocarinaFlag) { case 0: - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { this->ocarinaFlag = 1; } break; case 1: - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) && - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_04) && + (play->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY)) { this->actionState = ENKANBAN_REPAIR; this->bounceX = 1; Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0, @@ -783,16 +783,16 @@ static s32 sUnused[] = { 0, 0, 0 }; // Unused zero vector? #include "overlays/ovl_En_Kanban/ovl_En_Kanban.h" -void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Draw(Actor* thisx, PlayState* play) { EnKanban* this = (EnKanban*)thisx; f32 zShift; f32 zShift2; s16 i; - u8* shadowTex = Graph_Alloc(globalCtx->state.gfxCtx, 0x400); + u8* shadowTex = Graph_Alloc(play->state.gfxCtx, 0x400); - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_kanban_DL_000C30); if (this->actionState != ENKANBAN_SIGN) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); @@ -810,7 +810,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX((this->spinRot.x / (f32)0x8000) * M_PI, MTXMODE_APPLY); Matrix_RotateY((this->spinRot.z / (f32)0x8000) * M_PI, 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), + 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) { @@ -819,7 +819,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { } } else { Matrix_Translate(0.0f, 0.0f, -100.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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++, gSignRectangularDL); @@ -839,7 +839,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), + 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); } @@ -878,7 +878,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX((this->spinRot.x / (f32)0x8000) * M_PI, MTXMODE_APPLY); Matrix_RotateY((this->spinRot.z / (f32)0x8000) * M_PI, MTXMODE_APPLY); Matrix_Translate(this->offset.x, this->offset.y, this->offset.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); for (i = 0; i < 0x400; i++) { @@ -892,5 +892,5 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, sShadowDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index e0bd6e8ad..4c3277061 100644 --- a/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -11,23 +11,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKarebaba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKarebaba_Init(Actor* thisx, PlayState* play); +void EnKarebaba_Destroy(Actor* thisx, PlayState* play); +void EnKarebaba_Update(Actor* thisx, PlayState* play); +void EnKarebaba_Draw(Actor* thisx, PlayState* play); void EnKarebaba_SetupGrow(EnKarebaba* this); void EnKarebaba_SetupIdle(EnKarebaba* this); -void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Idle(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Spin(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_DeadItemDrop(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Retract(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Dead(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Regrow(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx); +void EnKarebaba_Grow(EnKarebaba* this, PlayState* play); +void EnKarebaba_Idle(EnKarebaba* this, PlayState* play); +void EnKarebaba_Awaken(EnKarebaba* this, PlayState* play); +void EnKarebaba_Spin(EnKarebaba* this, PlayState* play); +void EnKarebaba_Dying(EnKarebaba* this, PlayState* play); +void EnKarebaba_DeadItemDrop(EnKarebaba* this, PlayState* play); +void EnKarebaba_Retract(EnKarebaba* this, PlayState* play); +void EnKarebaba_Dead(EnKarebaba* this, PlayState* play); +void EnKarebaba_Regrow(EnKarebaba* this, PlayState* play); +void EnKarebaba_Upright(EnKarebaba* this, PlayState* play); const ActorInit En_Karebaba_InitVars = { ACTOR_EN_KAREBABA, @@ -90,18 +90,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, 0x09, ICHAIN_STOP), }; -void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Init(Actor* thisx, PlayState* play) { EnKarebaba* this = (EnKarebaba*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, this->morphTable, 8); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sBodyColliderInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit); Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - Collider_InitCylinder(globalCtx, &this->headCollider); - Collider_SetCylinder(globalCtx, &this->headCollider, &this->actor, &sHeadColliderInit); + Collider_InitCylinder(play, &this->headCollider); + Collider_SetCylinder(play, &this->headCollider, &this->actor, &sHeadColliderInit); Collider_UpdateCylinder(&this->actor, &this->headCollider); CollisionCheck_SetInfo(&this->actor.colChkInfo, DamageTable_Get(1), &sColCheckInfoInit); @@ -114,11 +114,11 @@ void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKarebaba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Destroy(Actor* thisx, PlayState* play) { EnKarebaba* this = (EnKarebaba*)thisx; - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyCylinder(globalCtx, &this->headCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->headCollider); } void EnKarebaba_ResetCollider(EnKarebaba* this) { @@ -182,14 +182,14 @@ void EnKarebaba_SetupDying(EnKarebaba* this) { this->actionFunc = EnKarebaba_Dying; } -void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, PlayState* play) { Actor_SetScale(&this->actor, 0.03f); this->actor.shape.rot.x -= 0x4000; this->actor.shape.yOffset = 1000.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.shape.shadowScale = 3.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.params = 200; this->actor.flags &= ~ACTOR_FLAG_5; this->actionFunc = EnKarebaba_DeadItemDrop; @@ -221,7 +221,7 @@ void EnKarebaba_SetupRegrow(EnKarebaba* this) { this->actionFunc = EnKarebaba_Regrow; } -void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Grow(EnKarebaba* this, PlayState* play) { f32 scale; this->actor.params++; @@ -233,13 +233,13 @@ void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx) { } } -void EnKarebaba_Idle(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Idle(EnKarebaba* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f && fabsf(this->actor.yDistToPlayer) < 30.0f) { EnKarebaba_SetupAwaken(this); } } -void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Awaken(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f); this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; @@ -247,11 +247,11 @@ void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx) { EnKarebaba_SetupUpright(this); } this->actor.shape.rot.y += 0x1999; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnKarebaba_Upright(EnKarebaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -265,7 +265,7 @@ void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) { if (this->bodyCollider.base.acFlags & AC_HIT) { EnKarebaba_SetupDying(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 240.0f) { EnKarebaba_SetupRetract(this); } else if (this->actor.params == 0) { @@ -273,7 +273,7 @@ void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) { } } -void EnKarebaba_Spin(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Spin(EnKarebaba* this, PlayState* play) { s32 value; f32 cos60; @@ -307,13 +307,13 @@ void EnKarebaba_Spin(EnKarebaba* this, GlobalContext* globalCtx) { if (this->bodyCollider.base.acFlags & AC_HIT) { EnKarebaba_SetupDying(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (this->actor.params == 0) { EnKarebaba_SetupUpright(this); } } -void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Dying(EnKarebaba* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 i; Vec3f position; @@ -323,13 +323,13 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { if (this->actor.params == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); if (this->actor.scale.x > 0.005f && ((this->actor.bgCheckFlags & 2) || (this->actor.bgCheckFlags & 8))) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f; this->actor.speedXZ = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); } @@ -344,30 +344,30 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { rotation.y = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); for (i = 0; i < 4; i++) { - func_800286CC(globalCtx, &position, &zeroVec, &zeroVec, 500, 50); + func_800286CC(play, &position, &zeroVec, &zeroVec, 500, 50); position.x += rotation.x; position.y += rotation.z; position.z += rotation.y; } - func_800286CC(globalCtx, &this->actor.home.pos, &zeroVec, &zeroVec, 500, 100); - EnKarebaba_SetupDeadItemDrop(this, globalCtx); + func_800286CC(play, &this->actor.home.pos, &zeroVec, &zeroVec, 500, 100); + EnKarebaba_SetupDeadItemDrop(this, play); } } -void EnKarebaba_DeadItemDrop(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_DeadItemDrop(EnKarebaba* this, PlayState* play) { if (this->actor.params != 0) { this->actor.params--; } - if (Actor_HasParent(&this->actor, globalCtx) || this->actor.params == 0) { + if (Actor_HasParent(&this->actor, play) || this->actor.params == 0) { EnKarebaba_SetupDead(this); } else { - func_8002F554(&this->actor, globalCtx, GI_STICKS_1); + func_8002F554(&this->actor, play, GI_STICKS_1); } } -void EnKarebaba_Retract(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Retract(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.scale.x, 0.005f, 0.0005f); this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; @@ -377,10 +377,10 @@ void EnKarebaba_Retract(EnKarebaba* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += 0x1999; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void EnKarebaba_Dead(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Dead(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.params != 0) { @@ -391,7 +391,7 @@ void EnKarebaba_Dead(EnKarebaba* this, GlobalContext* globalCtx) { } } -void EnKarebaba_Regrow(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Regrow(EnKarebaba* this, PlayState* play) { f32 scaleFactor; this->actor.params++; @@ -402,34 +402,34 @@ void EnKarebaba_Regrow(EnKarebaba* this, GlobalContext* globalCtx) { if (this->actor.params == 20) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); EnKarebaba_SetupIdle(this); } } -void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Update(Actor* thisx, PlayState* play) { s32 pad; EnKarebaba* this = (EnKarebaba*)thisx; f32 height; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnKarebaba_Dead) { if (this->actionFunc == EnKarebaba_Dying) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 10.0f, 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->boundFloor == NULL) { this->boundFloor = this->actor.floorPoly; } } if (this->actionFunc != EnKarebaba_Dying && this->actionFunc != EnKarebaba_DeadItemDrop) { if (this->actionFunc != EnKarebaba_Regrow && this->actionFunc != EnKarebaba_Grow) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->headCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); Actor_SetFocus(&this->actor, (this->actor.scale.x * 10.0f) / 0.01f); height = this->actor.home.pos.y + 40.0f; this->actor.focus.pos.x = this->actor.home.pos.x; @@ -439,25 +439,25 @@ void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKarebaba_DrawBaseShadow(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_DrawBaseShadow(EnKarebaba* this, PlayState* play) { MtxF mf; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); func_80038A28(this->boundFloor, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &mf); Matrix_Mult(&mf, MTXMODE_NEW); Matrix_Scale(0.15f, 1.0f, 0.15f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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) { static Color_RGBA8 black = { 0, 0, 0, 0 }; static Gfx* stemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -466,20 +466,20 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 stemSections; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actionFunc == EnKarebaba_DeadItemDrop) { if (this->actor.params > 40 || (this->actor.params & 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); } } else if (this->actionFunc != EnKarebaba_Dead) { - func_80026230(globalCtx, &black, 1, 2); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_80026230(play, &black, 1, 2); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); if ((this->actionFunc == EnKarebaba_Regrow) || (this->actionFunc == EnKarebaba_Grow)) { @@ -499,7 +499,7 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < stemSections; i++) { Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, stemDLists[i]); @@ -508,10 +508,10 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - func_80026608(globalCtx); + func_80026608(play); } - func_80026230(globalCtx, &black, 1, 2); + func_80026230(play, &black, 1, 2); Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); if (this->actionFunc != EnKarebaba_Grow) { @@ -520,22 +520,22 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateY(this->actor.home.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); - 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++, gDekuBabaBaseLeavesDL); if (this->actionFunc == EnKarebaba_Dying) { Matrix_RotateZYX(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); } - func_80026608(globalCtx); + func_80026608(play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->boundFloor != NULL) { - EnKarebaba_DrawBaseShadow(this, globalCtx); + EnKarebaba_DrawBaseShadow(this, play); } } diff --git a/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h b/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h index b0f5c8347..0687ade58 100644 --- a/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/soh/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -6,7 +6,7 @@ struct EnKarebaba; -typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, GlobalContext*); +typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, PlayState*); typedef struct EnKarebaba { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c index ff1502e4b..b3397494c 100644 --- a/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -17,19 +17,19 @@ #define ENKO_TYPE (this->actor.params & 0xFF) #define ENKO_PATH ((this->actor.params & 0xFF00) >> 8) -void EnKo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKo_Init(Actor* thisx, PlayState* play); +void EnKo_Destroy(Actor* thisx, PlayState* play); +void EnKo_Update(Actor* thisx, PlayState* play); +void EnKo_Draw(Actor* thisx, PlayState* play); -void func_80A99048(EnKo* this, GlobalContext* globalCtx); -void func_80A995CC(EnKo* this, GlobalContext* globalCtx); -void func_80A99384(EnKo* this, GlobalContext* globalCtx); -void func_80A99438(EnKo* this, GlobalContext* globalCtx); -void func_80A99504(EnKo* this, GlobalContext* globalCtx); -void func_80A99560(EnKo* this, GlobalContext* globalCtx); +void func_80A99048(EnKo* this, PlayState* play); +void func_80A995CC(EnKo* this, PlayState* play); +void func_80A99384(EnKo* this, PlayState* play); +void func_80A99438(EnKo* this, PlayState* play); +void func_80A99504(EnKo* this, PlayState* play); +void func_80A99560(EnKo* this, PlayState* play); -s32 func_80A98ECC(EnKo* this, GlobalContext* globalCtx); +s32 func_80A98ECC(EnKo* this, PlayState* play); const ActorInit En_Ko_InitVars = { ACTOR_EN_KO, @@ -234,57 +234,57 @@ static EnKoInteractInfo sInteractInfo[] = { /* ENKO_TYPE_CHILD_FADO */ { 6, 30.0f, 180.0f }, }; -s32 EnKo_AreObjectsAvailable(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_AreObjectsAvailable(EnKo* this, PlayState* play) { u8 headId = sModelInfo[ENKO_TYPE].headId; u8 bodyId = sModelInfo[ENKO_TYPE].bodyId; u8 legsId = sModelInfo[ENKO_TYPE].legsId; - this->legsObjectBankIdx = Object_GetIndex(&globalCtx->objectCtx, sSkeleton[legsId].objectId); + this->legsObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[legsId].objectId); if (this->legsObjectBankIdx < 0) { return false; } - this->bodyObjectBankIdx = Object_GetIndex(&globalCtx->objectCtx, sSkeleton[bodyId].objectId); + this->bodyObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[bodyId].objectId); if (this->bodyObjectBankIdx < 0) { return false; } - this->headObjectBankIdx = Object_GetIndex(&globalCtx->objectCtx, sHead[headId].objectId); + this->headObjectBankIdx = Object_GetIndex(&play->objectCtx, sHead[headId].objectId); if (this->headObjectBankIdx < 0) { return false; } return true; } -s32 EnKo_AreObjectsLoaded(EnKo* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->legsObjectBankIdx)) { +s32 EnKo_AreObjectsLoaded(EnKo* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->legsObjectBankIdx)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->bodyObjectBankIdx)) { + if (!Object_IsLoaded(&play->objectCtx, this->bodyObjectBankIdx)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->headObjectBankIdx)) { + if (!Object_IsLoaded(&play->objectCtx, this->headObjectBankIdx)) { return false; } return true; } -s32 EnKo_IsOsAnimeAvailable(EnKo* this, GlobalContext* globalCtx) { - this->osAnimeBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); +s32 EnKo_IsOsAnimeAvailable(EnKo* this, PlayState* play) { + this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if (this->osAnimeBankIndex < 0) { return false; } return true; } -s32 EnKo_IsOsAnimeLoaded(EnKo* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->osAnimeBankIndex)) { +s32 EnKo_IsOsAnimeLoaded(EnKo* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) { return false; } return true; } -u16 func_80A96FD0(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80A96FD0(PlayState* play, Actor* thisx) { EnKo* this = (EnKo*)thisx; switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_FADO: @@ -383,8 +383,8 @@ u16 func_80A96FD0(GlobalContext* globalCtx, Actor* thisx) { return 0; } -u16 func_80A97338(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 func_80A97338(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); EnKo* this = (EnKo*)thisx; switch (ENKO_TYPE) { @@ -468,35 +468,35 @@ u16 func_80A97338(GlobalContext* globalCtx, Actor* thisx) { } } -u16 func_80A97610(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80A97610(PlayState* play, Actor* thisx) { u16 faceReaction; EnKo* this = (EnKo*)thisx; if (ENKO_TYPE == ENKO_TYPE_CHILD_0 || ENKO_TYPE == ENKO_TYPE_CHILD_2 || ENKO_TYPE == ENKO_TYPE_CHILD_3 || ENKO_TYPE == ENKO_TYPE_CHILD_4 || ENKO_TYPE == ENKO_TYPE_CHILD_7 || ENKO_TYPE == ENKO_TYPE_CHILD_8 || ENKO_TYPE == ENKO_TYPE_CHILD_11) { - faceReaction = Text_GetFaceReaction(globalCtx, 0x13); + faceReaction = Text_GetFaceReaction(play, 0x13); } if (ENKO_TYPE == ENKO_TYPE_CHILD_1 || ENKO_TYPE == ENKO_TYPE_CHILD_5 || ENKO_TYPE == ENKO_TYPE_CHILD_6 || ENKO_TYPE == ENKO_TYPE_CHILD_9 || ENKO_TYPE == ENKO_TYPE_CHILD_10) { - faceReaction = Text_GetFaceReaction(globalCtx, 0x14); + faceReaction = Text_GetFaceReaction(play, 0x14); } if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO) { - faceReaction = Text_GetFaceReaction(globalCtx, 0x12); + faceReaction = Text_GetFaceReaction(play, 0x12); } if (faceReaction != 0) { return faceReaction; } if (LINK_IS_ADULT) { - return func_80A97338(globalCtx, thisx); + return func_80A97338(play, thisx); } - return func_80A96FD0(globalCtx, thisx); + return func_80A96FD0(play, thisx); } -s16 func_80A97738(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A97738(PlayState* play, Actor* thisx) { EnKo* this = (EnKo*)thisx; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: switch (this->actor.textId) { case 0x1005: @@ -548,34 +548,34 @@ s16 func_80A97738(GlobalContext* globalCtx, Actor* thisx) { } return 1; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x1035: - this->actor.textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x1036 : 0x1037; - Message_ContinueTextbox(globalCtx, this->actor.textId); + this->actor.textId = (play->msgCtx.choiceIndex == 0) ? 0x1036 : 0x1037; + Message_ContinueTextbox(play, this->actor.textId); break; case 0x1038: - this->actor.textId = (globalCtx->msgCtx.choiceIndex != 0) - ? (globalCtx->msgCtx.choiceIndex == 1) ? 0x103A : 0x103B + this->actor.textId = (play->msgCtx.choiceIndex != 0) + ? (play->msgCtx.choiceIndex == 1) ? 0x103A : 0x103B : 0x1039; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; case 0x103E: - this->actor.textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x103F : 0x1040; - Message_ContinueTextbox(globalCtx, this->actor.textId); + this->actor.textId = (play->msgCtx.choiceIndex == 0) ? 0x103F : 0x1040; + Message_ContinueTextbox(play, this->actor.textId); break; case 0x10B7: gSaveContext.infTable[11] |= 0x1000; case 0x10B8: - this->actor.textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x10BA : 0x10B9; - return (globalCtx->msgCtx.choiceIndex == 0) ? 2 : 1; + this->actor.textId = (play->msgCtx.choiceIndex == 0) ? 0x10BA : 0x10B9; + return (play->msgCtx.choiceIndex == 0) ? 2 : 1; } return 1; } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { return 3; } } @@ -663,7 +663,7 @@ s32 EnKo_IsWithinTalkAngle(EnKo* this) { return result; } -s32 func_80A97D68(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97D68(EnKo* this, PlayState* play) { s16 arg3; if (this->unk_1E8.unk_00 != 0) { @@ -681,10 +681,10 @@ s32 func_80A97D68(EnKo* this, GlobalContext* globalCtx) { return EnKo_IsWithinTalkAngle(this); } -s32 func_80A97E18(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97E18(EnKo* this, PlayState* play) { s16 arg3; - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); if (EnKo_IsWithinTalkAngle(this) == true) { arg3 = 2; } else { @@ -699,31 +699,31 @@ s32 func_80A97E18(EnKo* this, GlobalContext* globalCtx) { return 1; } -s32 func_80A97EB0(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97EB0(EnKo* this, PlayState* play) { s16 arg3; s32 result; - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); result = EnKo_IsWithinTalkAngle(this); arg3 = (result == true) ? 2 : 1; func_80034A14(&this->actor, &this->unk_1E8, 2, arg3); return result; } -s32 func_80A97F20(EnKo* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); +s32 func_80A97F20(EnKo* this, PlayState* play) { + func_80034F54(play, this->unk_2E4, this->unk_304, 16); func_80034A14(&this->actor, &this->unk_1E8, 2, 4); return 1; } -s32 func_80A97F70(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97F70(EnKo* this, PlayState* play) { s16 arg3; if (this->unk_1E8.unk_00 != 0) { if ((this->skelAnime.animation == &gObjOsAnim_8F6C) == false) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_29); } - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); arg3 = 2; } else { if ((this->skelAnime.animation == &gObjOsAnim_7D94) == false) { @@ -735,7 +735,7 @@ s32 func_80A97F70(EnKo* this, GlobalContext* globalCtx) { return EnKo_IsWithinTalkAngle(this); } -s32 func_80A98034(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A98034(EnKo* this, PlayState* play) { s16 arg3; s32 result; @@ -743,7 +743,7 @@ s32 func_80A98034(EnKo* this, GlobalContext* globalCtx) { if ((this->skelAnime.animation == &gObjOsAnim_8F6C) == false) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_29); } - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); result = EnKo_IsWithinTalkAngle(this); arg3 = (result == true) ? 2 : 1; } else { @@ -758,13 +758,13 @@ s32 func_80A98034(EnKo* this, GlobalContext* globalCtx) { } // Same as func_80A97F20 -s32 func_80A98124(EnKo* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); +s32 func_80A98124(EnKo* this, PlayState* play) { + func_80034F54(play, this->unk_2E4, this->unk_304, 16); func_80034A14(&this->actor, &this->unk_1E8, 2, 4); return 1; } -s32 func_80A98174(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A98174(EnKo* this, PlayState* play) { if (this->unk_1E8.unk_00 != 0) { if (Animation_OnFrame(&this->skelAnime, 18.0f)) { this->skelAnime.playSpeed = 0.0f; @@ -773,171 +773,171 @@ s32 func_80A98174(EnKo* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } if (this->skelAnime.playSpeed == 0.0f) { - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); } func_80034A14(&this->actor, &this->unk_1E8, 2, (this->skelAnime.playSpeed == 0.0f) ? 2 : 1); return EnKo_IsWithinTalkAngle(this); } -s32 EnKo_ChildStart(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_ChildStart(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A97D68(this, globalCtx); + return func_80A97D68(this, play); case ENKO_TYPE_CHILD_1: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_2: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97F70(this, globalCtx); + return func_80A97F70(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_ChildStone(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_ChildStone(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_1: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_2: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97F70(this, globalCtx); + return func_80A97F70(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_ChildSaria(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_ChildSaria(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_1: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_2: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A98174(this, globalCtx); + return func_80A98174(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_AdultEnemy(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_AdultEnemy(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_1: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_2: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_AdultSaved(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_AdultSaved(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_1: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_2: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -void func_80A9877C(EnKo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9877C(EnKo* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) { - this->unk_1E8.unk_18 = globalCtx->view.eye; + if ((play->csCtx.state != 0) || (gDbgCamEnabled != 0)) { + this->unk_1E8.unk_18 = play->view.eye; this->unk_1E8.unk_14 = 40.0f; if (ENKO_TYPE != ENKO_TYPE_CHILD_0) { func_80034A14(&this->actor, &this->unk_1E8, 2, 2); @@ -945,15 +945,15 @@ void func_80A9877C(EnKo* this, GlobalContext* globalCtx) { } else { this->unk_1E8.unk_18 = player->actor.world.pos; this->unk_1E8.unk_14 = func_80A97BC0(this); - if ((func_80A98ECC(this, globalCtx) == 0) && (this->unk_1E8.unk_00 == 0)) { + if ((func_80A98ECC(this, play) == 0) && (this->unk_1E8.unk_00 == 0)) { return; } } - if (func_800343CC(globalCtx, &this->actor, &this->unk_1E8.unk_00, this->lookDist, func_80A97610, func_80A97738) && - ENKO_TYPE == ENKO_TYPE_CHILD_FADO && globalCtx->sceneNum == SCENE_SPOT10) { + if (func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, this->lookDist, func_80A97610, func_80A97738) && + ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneNum == SCENE_SPOT10) { this->actor.textId = INV_CONTENT(ITEM_TRADE_ADULT) > ITEM_ODD_POTION ? 0x10B9 : 0x10DF; - if (func_8002F368(globalCtx) == ENKO_TYPE_CHILD_9) { + if (func_8002F368(play) == ENKO_TYPE_CHILD_9) { this->actor.textId = (gSaveContext.infTable[11] & 0x1000) ? 0x10B8 : 0x10B7; this->unk_210 = 0; } @@ -962,8 +962,8 @@ void func_80A9877C(EnKo* this, GlobalContext* globalCtx) { } // Checks if the Kokiri should spawn based on quest progress -s32 EnKo_CanSpawn(EnKo* this, GlobalContext* globalCtx) { - switch (globalCtx->sceneNum) { +s32 EnKo_CanSpawn(EnKo* this, PlayState* play) { + switch (play->sceneNum) { case SCENE_SPOT04: if (ENKO_TYPE >= ENKO_TYPE_CHILD_7 && ENKO_TYPE != ENKO_TYPE_CHILD_FADO) { return false; @@ -1081,15 +1081,15 @@ s32 EnKo_GetForestQuestState2(EnKo* this) { return ENKO_FQS_CHILD_START; } -void func_80A98DB4(EnKo* this, GlobalContext* globalCtx) { +void func_80A98DB4(EnKo* this, PlayState* play) { f32 dist; - if (globalCtx->sceneNum != SCENE_SPOT10 && globalCtx->sceneNum != SCENE_SPOT04) { + if (play->sceneNum != SCENE_SPOT10 && play->sceneNum != SCENE_SPOT04) { this->modelAlpha = 255.0f; return; } - if (globalCtx->csCtx.state != 0 || gDbgCamEnabled != 0) { - dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &globalCtx->view.eye) * 0.25f; + if (play->csCtx.state != 0 || gDbgCamEnabled != 0) { + dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->view.eye) * 0.25f; } else { dist = this->actor.xzDistToPlayer; } @@ -1110,53 +1110,53 @@ void func_80A98DB4(EnKo* this, GlobalContext* globalCtx) { } } -s32 func_80A98ECC(EnKo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT10 && ENKO_TYPE == ENKO_TYPE_CHILD_FADO) { - return func_80A97E18(this, globalCtx); +s32 func_80A98ECC(EnKo* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT10 && ENKO_TYPE == ENKO_TYPE_CHILD_FADO) { + return func_80A97E18(this, play); } switch (EnKo_GetForestQuestState(this)) { case ENKO_FQS_CHILD_START: - return EnKo_ChildStart(this, globalCtx); + return EnKo_ChildStart(this, play); case ENKO_FQS_CHILD_STONE: - return EnKo_ChildStone(this, globalCtx); + return EnKo_ChildStone(this, play); case ENKO_FQS_CHILD_SARIA: - return EnKo_ChildSaria(this, globalCtx); + return EnKo_ChildSaria(this, play); case ENKO_FQS_ADULT_ENEMY: - return EnKo_AdultEnemy(this, globalCtx); + return EnKo_AdultEnemy(this, play); case ENKO_FQS_ADULT_SAVED: - return EnKo_AdultSaved(this, globalCtx); + return EnKo_AdultSaved(this, play); } } -void EnKo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Init(Actor* thisx, PlayState* play) { EnKo* this = (EnKo*)thisx; - if (ENKO_TYPE >= ENKO_TYPE_CHILD_MAX || !EnKo_IsOsAnimeAvailable(this, globalCtx) || - !EnKo_AreObjectsAvailable(this, globalCtx)) { + if (ENKO_TYPE >= ENKO_TYPE_CHILD_MAX || !EnKo_IsOsAnimeAvailable(this, play) || + !EnKo_AreObjectsAvailable(this, play)) { Actor_Kill(thisx); } - if (!EnKo_CanSpawn(this, globalCtx)) { + if (!EnKo_CanSpawn(this, play)) { Actor_Kill(thisx); } this->actionFunc = func_80A99048; } -void EnKo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Destroy(Actor* thisx, PlayState* play) { EnKo* this = (EnKo*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A99048(EnKo* this, GlobalContext* globalCtx) { - if (EnKo_IsOsAnimeLoaded(this, globalCtx) && EnKo_AreObjectsLoaded(this, globalCtx)) { +void func_80A99048(EnKo* this, PlayState* play) { + if (EnKo_IsOsAnimeLoaded(this, play) && EnKo_AreObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->legsObjectBankIdx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->actor.objBankIndex].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (ENKO_TYPE == ENKO_TYPE_CHILD_7) { // "Angle Z" @@ -1179,8 +1179,8 @@ void func_80A99048(EnKo* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); func_80A98CD8(this); this->modelAlpha = 0.0f; - this->path = Path_GetByIndex(globalCtx, ENKO_PATH, 0xFF); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + this->path = Path_GetByIndex(play, ENKO_PATH, 0xFF); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 3); if (ENKO_TYPE == ENKO_TYPE_CHILD_3) { if (!gSaveContext.n64ddFlag) { @@ -1202,57 +1202,57 @@ void func_80A99048(EnKo* this, GlobalContext* globalCtx) { } } -void func_80A99384(EnKo* this, GlobalContext* globalCtx) { +void func_80A99384(EnKo* this, PlayState* play) { if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 != 0 && this->actor.textId == 0x10B9) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_7); this->actionFunc = func_80A99438; } else if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) { this->actionFunc = func_80A99504; - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } -void func_80A99438(EnKo* this, GlobalContext* globalCtx) { +void func_80A99438(EnKo* this, PlayState* play) { if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_6); this->actionFunc = func_80A99504; - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else if (this->unk_1E8.unk_00 == 0 || this->actor.textId != 0x10B9) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_6); this->actionFunc = func_80A99384; } } -void func_80A99504(EnKo* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A99504(EnKo* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80A99560; } else { if (gSaveContext.n64ddFlag) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TRADE_ODD_POTION, GI_SAW); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_ODD_POTION); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 120.0f, 10.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_ODD_POTION); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 120.0f, 10.0f); } else { s32 itemId = GI_SAW; - func_8002F434(&this->actor, globalCtx, itemId, 120.0f, 10.0f); + func_8002F434(&this->actor, play, itemId, 120.0f, 10.0f); } } } -void func_80A99560(EnKo* this, GlobalContext* globalCtx) { +void func_80A99560(EnKo* this, PlayState* play) { if (this->unk_1E8.unk_00 == 3) { this->actor.textId = 0x10B9; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E8.unk_00 = 1; gSaveContext.itemGetInf[3] |= 2; this->actionFunc = func_80A99384; } } -void func_80A995CC(EnKo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A995CC(EnKo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f2; f32 phi_f0; s16 homeYawToPlayer = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); @@ -1276,40 +1276,40 @@ void func_80A995CC(EnKo* this, GlobalContext* globalCtx) { } } -void EnKo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Update(Actor* thisx, PlayState* play) { ColliderCylinder* collider; EnKo* this = (EnKo*)thisx; s32 pad; if (this->actionFunc != func_80A99048) { if ((s32)this->modelAlpha != 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); SkelAnime_Update(&this->skelAnime); - func_80A98DB4(this, globalCtx); + func_80A98DB4(this, play); EnKo_Blink(this); } else { - func_80A98DB4(this, globalCtx); + func_80A98DB4(this, play); } } if (this->unk_1E8.unk_00 == 0) { Actor_MoveForward(&this->actor); } if (func_80A97C7C(this)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.gravity = -1.0f; } else { this->actor.gravity = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80A9877C(this, globalCtx); + func_80A9877C(this, play); collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); } -s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnKo* this = (EnKo*)thisx; void* eyeTexture; @@ -1318,8 +1318,8 @@ s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, s32 pad; if (limbIndex == 15) { - gSPSegment((*gfx)++, 0x06, globalCtx->objectCtx.status[this->headObjectBankIdx].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->headObjectBankIdx].segment); + gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->headObjectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->headObjectBankIdx].segment); headId = sModelInfo[ENKO_TYPE].headId; *dList = sHead[headId].dList; @@ -1327,7 +1327,7 @@ s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, eyeTexture = sHead[headId].eyeTextures[this->eyeTextureIndex]; gSPSegment((*gfx)++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTexture)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->legsObjectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->legsObjectBankIdx].segment); } if (limbIndex == 8) { sp40 = this->unk_1E8.unk_0E; @@ -1348,14 +1348,14 @@ s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnKo_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { - GlobalContext* globalCtx = globalCtx2; +void EnKo_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { + PlayState* play = play2; EnKo* this = (EnKo*)thisx; Vec3f D_80A9A774 = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 7) { - gSPSegment((*gfx)++, 0x06, globalCtx->objectCtx.status[this->bodyObjectBankIdx].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->bodyObjectBankIdx].segment); + gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->bodyObjectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->bodyObjectBankIdx].segment); } if (limbIndex == 15) { Matrix_MultVec3f(&D_80A9A774, &this->actor.focus.pos); @@ -1370,30 +1370,30 @@ Gfx* EnKo_SetEnvColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return dList; } -void EnKo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Draw(Actor* thisx, PlayState* play) { EnKo* this = (EnKo*)thisx; Color_RGBA8 tunicColor = sModelInfo[ENKO_TYPE].tunicColor; Color_RGBA8 bootsColor = sModelInfo[ENKO_TYPE].bootsColor; this->actor.shape.shadowAlpha = this->modelAlpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((s16)this->modelAlpha == 255) { gSPSegment(POLY_OPA_DISP++, 0x08, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, 255)); + EnKo_SetEnvColor(play->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, 255)); gSPSegment(POLY_OPA_DISP++, 0x09, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, 255)); - func_80034BA0(globalCtx, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, + EnKo_SetEnvColor(play->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, 255)); + func_80034BA0(play, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, this->modelAlpha); } else if ((s16)this->modelAlpha != 0) { tunicColor.a = this->modelAlpha; bootsColor.a = this->modelAlpha; gSPSegment(POLY_XLU_DISP++, 0x08, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, tunicColor.a)); + EnKo_SetEnvColor(play->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, tunicColor.a)); gSPSegment(POLY_XLU_DISP++, 0x09, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, bootsColor.a)); - func_80034CC4(globalCtx, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, + EnKo_SetEnvColor(play->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, bootsColor.a)); + func_80034CC4(play, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, this->modelAlpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.h b/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.h index b7a60dd05..efce571d0 100644 --- a/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.h +++ b/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.h @@ -6,7 +6,7 @@ struct EnKo; -typedef void (*EnKoActionFunc)(struct EnKo*, GlobalContext*); +typedef void (*EnKoActionFunc)(struct EnKo*, PlayState*); typedef struct EnKo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index c6f65ac0d..87a37cf07 100644 --- a/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -13,10 +13,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) -void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKusa_Init(Actor* thisx, PlayState* play); +void EnKusa_Destroy(Actor* thisx, PlayState* play); +void EnKusa_Update(Actor* thisx, PlayState* play); +void EnKusa_Draw(Actor* thisx, PlayState* play); void EnKusa_SetupLiftedUp(EnKusa* this); void EnKusa_SetupWaitObject(EnKusa* this); @@ -26,14 +26,14 @@ void EnKusa_SetupCut(EnKusa* this); void EnKusa_SetupUprootedWaitRegrow(EnKusa* this); void EnKusa_SetupRegrow(EnKusa* this); -void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_WaitObject(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_Main(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_CutWaitRegrow(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_DoNothing(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_UprootedWaitRegrow(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx); +void EnKusa_Fall(EnKusa* this, PlayState* play); +void EnKusa_WaitObject(EnKusa* this, PlayState* play); +void EnKusa_Main(EnKusa* this, PlayState* play); +void EnKusa_LiftedUp(EnKusa* this, PlayState* play); +void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play); +void EnKusa_DoNothing(EnKusa* this, PlayState* play); +void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play); +void EnKusa_Regrow(EnKusa* this, PlayState* play); static s16 rotSpeedXtarget = 0; static s16 rotSpeedX = 0; @@ -97,7 +97,7 @@ void EnKusa_SetupAction(EnKusa* this, EnKusaActionFunc actionFunc) { this->actionFunc = actionFunc; } -s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { +s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset) { s32 pad; CollisionPoly* poly; Vec3f pos; @@ -108,7 +108,7 @@ s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { pos.y = this->actor.world.pos.y + 30.0f; pos.z = this->actor.world.pos.z; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &poly, &bgId, &this->actor, &pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &poly, &bgId, &this->actor, &pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY + yOffset; @@ -123,7 +123,7 @@ s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { } } -void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { s16 dropParams; switch (this->actor.params & 3) { @@ -134,18 +134,18 @@ void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) { if (dropParams >= 0xD) { dropParams = 0; } - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, dropParams << 4); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, dropParams << 4); break; case ENKUSA_TYPE_1: if (CVar_GetS32("gNoRandomDrops", 0)) { } else if (CVar_GetS32("gNoHeartDrops", 0)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_SEEDS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_SEEDS); } else if (Rand_ZeroOne() < 0.5f) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_SEEDS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_SEEDS); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_HEART); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_HEART); } break; } @@ -172,7 +172,7 @@ void EnKusa_SetScaleSmall(EnKusa* this) { this->actor.scale.z = 0.120000005f; } -void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_SpawnFragments(EnKusa* this, PlayState* play) { Vec3f velocity; Vec3f pos; s32 i; @@ -193,7 +193,7 @@ 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, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubStalkDL); pos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 40.0f); @@ -206,16 +206,16 @@ 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, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubTipDL); } } -void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { s32 i; for (i = 0; i < 3; i++) { - Actor* bug = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.world.pos.x, + Actor* bug = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, Rand_ZeroOne() * 0xFFFF, 0, 1); if (bug == NULL) { @@ -224,24 +224,24 @@ void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) { } } -void EnKusa_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_InitCollider(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_Init(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } - EnKusa_InitCollider(thisx, globalCtx); + EnKusa_InitCollider(thisx, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (this->actor.shape.rot.y == 0) { @@ -252,12 +252,12 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = rand; } - if (!EnKusa_SnapToFloor(this, globalCtx, 0.0f)) { + if (!EnKusa_SnapToFloor(this, play, 0.0f)) { Actor_Kill(&this->actor); return; } - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[thisx->params & 3]); + this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[thisx->params & 3]); if (this->objBankIndex < 0) { // "Bank danger!" @@ -269,19 +269,19 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { EnKusa_SetupWaitObject(this); } -void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnKusa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnKusa* this = (EnKusa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnKusa_SetupWaitObject(EnKusa* this) { EnKusa_SetupAction(this, EnKusa_WaitObject); } -void EnKusa_WaitObject(EnKusa* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void EnKusa_WaitObject(EnKusa* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { EnKusa_SetupCut(this); } else { @@ -299,20 +299,20 @@ void EnKusa_SetupMain(EnKusa* this) { this->actor.flags &= ~ACTOR_FLAG_4; } -void EnKusa_Main(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Main(EnKusa* this, PlayState* play) { s32 pad; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { EnKusa_SetupLiftedUp(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); - } else if (this->collider.base.acFlags & AC_HIT && gGlobalCtx->csCtx.state == 0) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); + } else if (this->collider.base.acFlags & AC_HIT && gPlayState->csCtx.state == 0) { this->collider.base.acFlags &= ~AC_HIT; - EnKusa_SpawnFragments(this, globalCtx); - EnKusa_DropCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); + EnKusa_SpawnFragments(this, play); + EnKusa_DropCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); if ((this->actor.params >> 4) & 1) { - EnKusa_SpawnBugs(this, globalCtx); + EnKusa_SpawnBugs(this, play); } if ((this->actor.params & 3) == ENKUSA_TYPE_0) { @@ -329,12 +329,12 @@ void EnKusa_Main(EnKusa* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } @@ -347,9 +347,9 @@ void EnKusa_SetupLiftedUp(EnKusa* this) { this->actor.flags |= ACTOR_FLAG_4; } -void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void EnKusa_LiftedUp(EnKusa* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.curRoom.num; EnKusa_SetupFall(this); this->actor.velocity.x = this->actor.speedXZ * Math_SinS(this->actor.world.rot.y); this->actor.velocity.z = this->actor.speedXZ * Math_CosS(this->actor.world.rot.y); @@ -358,7 +358,7 @@ void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) { EnKusa_UpdateVelY(this); EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.005f); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); this->actor.gravity = -3.2f; } } @@ -371,16 +371,16 @@ void EnKusa_SetupFall(EnKusa* this) { rotSpeedY = 0; } -void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Fall(EnKusa* this, PlayState* play) { s32 pad; Vec3f contactPos; if (this->actor.bgCheckFlags & 0xB) { 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 (this->actor.params & 3) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: @@ -398,17 +398,17 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { contactPos.x = this->actor.world.pos.x; contactPos.y = this->actor.world.pos.y + this->actor.yDistToWater; contactPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &contactPos, NULL, NULL, 0, 400); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 150, 650, 0); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 400, 800, 4); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1100, 8); + EffectSsGSplash_Spawn(play, &contactPos, NULL, NULL, 0, 400); + EffectSsGRipple_Spawn(play, &contactPos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &contactPos, 400, 800, 4); + EffectSsGRipple_Spawn(play, &contactPos, 500, 1100, 8); this->actor.minVelocityY = -3.0f; rotSpeedX >>= 1; rotSpeedXtarget >>= 1; rotSpeedY >>= 1; rotSpeedYtarget >>= 1; this->actor.bgCheckFlags &= ~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); @@ -418,9 +418,9 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += rotSpeedY; EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.05f); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 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_SetOC(play, &play->colChkCtx, &this->collider.base); } void EnKusa_SetupCut(EnKusa* this) { @@ -434,13 +434,13 @@ void EnKusa_SetupCut(EnKusa* this) { } } -void EnKusa_CutWaitRegrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play) { if (this->timer >= 120) { EnKusa_SetupRegrow(this); } } -void EnKusa_DoNothing(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_DoNothing(EnKusa* this, PlayState* play) { } void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) { @@ -452,7 +452,7 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) { EnKusa_SetupAction(this, EnKusa_UprootedWaitRegrow); } -void EnKusa_UprootedWaitRegrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play) { if (this->timer > 120) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f)) { if (this->timer >= 170) { @@ -469,7 +469,7 @@ void EnKusa_SetupRegrow(EnKusa* this) { this->actor.flags &= ~ACTOR_FLAG_ENKUSA_CUT; } -void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Regrow(EnKusa* this, PlayState* play) { s32 isFullyGrown = true; isFullyGrown &= Math_StepToF(&this->actor.scale.y, 0.4f, 0.014f); @@ -483,12 +483,12 @@ void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx) { } } -void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_Update(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { this->actor.shape.yOffset = -6.25f; @@ -497,13 +497,13 @@ void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKusa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gFieldBushDL, object_kusa_DL_000140, object_kusa_DL_000140 }; EnKusa* this = (EnKusa*)thisx; if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { - Gfx_DrawDListOpa(globalCtx, object_kusa_DL_0002E0); + Gfx_DrawDListOpa(play, object_kusa_DL_0002E0); } else { - Gfx_DrawDListOpa(globalCtx, dLists[thisx->params & 3]); + Gfx_DrawDListOpa(play, dLists[thisx->params & 3]); } } diff --git a/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h b/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h index a5ef48687..3a922ebce 100644 --- a/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -6,7 +6,7 @@ struct EnKusa; -typedef void (*EnKusaActionFunc)(struct EnKusa*, GlobalContext*); +typedef void (*EnKusaActionFunc)(struct EnKusa*, PlayState*); typedef enum { /* 0 */ ENKUSA_TYPE_0, diff --git a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 96aebbef6..6b2d4970e 100644 --- a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnKz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKz_Init(Actor* thisx, PlayState* play); +void EnKz_Destroy(Actor* thisx, PlayState* play); +void EnKz_Update(Actor* thisx, PlayState* play); +void EnKz_Draw(Actor* thisx, PlayState* play); -void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx); -void EnKz_SetupMweep(EnKz* this, GlobalContext* globalCtx); -void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx); -void EnKz_StopMweep(EnKz* this, GlobalContext* globalCtx); -void EnKz_Wait(EnKz* this, GlobalContext* globalCtx); -void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx); -void EnKz_StartTimer(EnKz* this, GlobalContext* globalCtx); +void EnKz_PreMweepWait(EnKz* this, PlayState* play); +void EnKz_SetupMweep(EnKz* this, PlayState* play); +void EnKz_Mweep(EnKz* this, PlayState* play); +void EnKz_StopMweep(EnKz* this, PlayState* play); +void EnKz_Wait(EnKz* this, PlayState* play); +void EnKz_SetupGetItem(EnKz* this, PlayState* play); +void EnKz_StartTimer(EnKz* this, PlayState* play); const ActorInit En_Kz_InitVars = { ACTOR_EN_KZ, @@ -70,8 +70,8 @@ static AnimationInfo sAnimationInfo[] = { { &gKzMweepAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 EnKz_GetTextNoMaskChild(GlobalContext* globalCtx, EnKz* this) { - Player* player = GET_PLAYER(globalCtx); +u16 EnKz_GetTextNoMaskChild(PlayState* play, EnKz* this) { + Player* player = GET_PLAYER(play); if ((gSaveContext.n64ddFlag && Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_JABU_JABUS_BELLY)) || (!gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE))) { @@ -84,8 +84,8 @@ u16 EnKz_GetTextNoMaskChild(GlobalContext* globalCtx, EnKz* this) { } } -u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) { - Player* player = GET_PLAYER(globalCtx); +u16 EnKz_GetTextNoMaskAdult(PlayState* play, EnKz* this) { + Player* player = GET_PLAYER(play); // this works because both ITEM_NONE and later trade items are > ITEM_FROG if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_FROG) { @@ -104,26 +104,26 @@ u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) { } } -u16 EnKz_GetText(GlobalContext* globalCtx, Actor* thisx) { +u16 EnKz_GetText(PlayState* play, Actor* thisx) { EnKz* this = (EnKz*)thisx; - u16 reactionText = Text_GetFaceReaction(globalCtx, 0x1E); + u16 reactionText = Text_GetFaceReaction(play, 0x1E); if (reactionText != 0) { return reactionText; } if (LINK_IS_ADULT) { - return EnKz_GetTextNoMaskAdult(globalCtx, this); + return EnKz_GetTextNoMaskAdult(play, this); } else { - return EnKz_GetTextNoMaskChild(globalCtx, this); + return EnKz_GetTextNoMaskChild(play, this); } } -s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A9C6C0(PlayState* play, Actor* thisx) { EnKz* this = (EnKz*)thisx; s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_DONE: ret = 0; switch (this->actor.textId) { @@ -132,7 +132,7 @@ s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) { ret = 2; break; case 0x401B: - ret = !Message_ShouldAdvance(globalCtx) ? 1 : 2; + ret = !Message_ShouldAdvance(play) ? 1 : 2; break; case 0x401F: gSaveContext.infTable[19] |= 0x200; @@ -152,21 +152,21 @@ s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_CHOICE: - if (!Message_ShouldAdvance(globalCtx)) { + if (!Message_ShouldAdvance(play)) { break; } if (this->actor.textId == 0x4014) { - if (globalCtx->msgCtx.choiceIndex == 0) { - EnKz_SetupGetItem(this, globalCtx); + if (play->msgCtx.choiceIndex == 0) { + EnKz_SetupGetItem(this, play); ret = 2; } else { this->actor.textId = 0x4016; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 2; } break; @@ -191,21 +191,21 @@ void EnKz_UpdateEyes(EnKz* this) { } } -s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, callback1_800343CC callback1, +s32 func_80A9C95C(PlayState* play, EnKz* this, s16* arg2, f32 unkf, callback1_800343CC callback1, callback2_800343CC callback2) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 sp32; s16 sp30; f32 xzDistToPlayer; f32 yaw; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { *arg2 = 1; return 1; } if (*arg2 != 0) { - *arg2 = callback2(globalCtx, &this->actor); + *arg2 = callback2(play, &this->actor); return 0; } @@ -218,29 +218,29 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal this->actor.flags |= ACTOR_FLAG_0; - Actor_GetScreenPos(globalCtx, &this->actor, &sp32, &sp30); + Actor_GetScreenPos(play, &this->actor, &sp32, &sp30); if (!((sp32 >= -30) && (sp32 < 361) && (sp30 >= -10) && (sp30 < 241))) { return 0; } xzDistToPlayer = this->actor.xzDistToPlayer; this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos); - if (func_8002F2CC(&this->actor, globalCtx, unkf) == 0) { + if (func_8002F2CC(&this->actor, play, unkf) == 0) { this->actor.xzDistToPlayer = xzDistToPlayer; return 0; } this->actor.xzDistToPlayer = xzDistToPlayer; - this->actor.textId = callback1(globalCtx, &this->actor); + this->actor.textId = callback1(play, &this->actor); return 0; } -void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9CB18(EnKz* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_80A9C95C(globalCtx, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0)) { + if (func_80A9C95C(play, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0)) { if (((gSaveContext.n64ddFlag && LINK_IS_CHILD) || this->actor.textId == 0x401A) && !(gSaveContext.eventChkInf[3] & 8)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_LETTER_RUTO) { + if (func_8002F368(play) == EXCH_ITEM_LETTER_RUTO) { this->actor.textId = 0x401B; this->sfxPlayed = false; } else { @@ -252,8 +252,8 @@ void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { if (LINK_IS_ADULT) { if ((INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) && - (func_8002F368(globalCtx) == EXCH_ITEM_PRESCRIPTION)) { - if (!gSaveContext.n64ddFlag || !Flags_GetTreasure(globalCtx, 0x1F)) { + (func_8002F368(play) == EXCH_ITEM_PRESCRIPTION)) { + if (!gSaveContext.n64ddFlag || !Flags_GetTreasure(play, 0x1F)) { this->actor.textId = 0x4014; this->sfxPlayed = false; player->actor.textId = this->actor.textId; @@ -279,7 +279,7 @@ void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { } } -s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) { +s32 EnKz_FollowPath(EnKz* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -289,7 +289,7 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -307,7 +307,7 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) { return 0; } -s32 EnKz_SetMovedPos(EnKz* this, GlobalContext* globalCtx) { +s32 EnKz_SetMovedPos(EnKz* this, PlayState* play) { Path* path; Vec3s* lastPointPos; @@ -315,7 +315,7 @@ s32 EnKz_SetMovedPos(EnKz* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); lastPointPos += path->count - 1; @@ -326,14 +326,14 @@ s32 EnKz_SetMovedPos(EnKz* this, GlobalContext* globalCtx) { return 1; } -void EnKz_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Init(Actor* thisx, PlayState* play) { EnKz* this = (EnKz*)thisx; s32 pad; - SkelAnime_InitFlex(globalCtx, &this->skelanime, &gKzSkel, NULL, this->jointTable, this->morphTable, 12); + SkelAnime_InitFlex(play, &this->skelanime, &gKzSkel, NULL, this->jointTable, this->morphTable, 12); ActorShape_Init(&this->actor.shape, 0.0, NULL, 0.0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01); this->actor.targetMode = 3; @@ -342,32 +342,32 @@ void EnKz_Init(Actor* thisx, GlobalContext* globalCtx) { if (!gSaveContext.n64ddFlag) { if (gSaveContext.eventChkInf[3] & 8) { - EnKz_SetMovedPos(this, globalCtx); + EnKz_SetMovedPos(this, play); } } else { int zorasFountain = Randomizer_GetSettingValue(RSK_ZORAS_FOUNTAIN); switch (zorasFountain) { case 0: if (gSaveContext.eventChkInf[3] & 8) { - EnKz_SetMovedPos(this, globalCtx); + EnKz_SetMovedPos(this, play); } break; case 1: if (LINK_IS_ADULT) { - EnKz_SetMovedPos(this, globalCtx); + EnKz_SetMovedPos(this, play); } else if (gSaveContext.eventChkInf[3] & 8) { - EnKz_SetMovedPos(this, globalCtx); + EnKz_SetMovedPos(this, play); } break; case 2: - EnKz_SetMovedPos(this, globalCtx); + EnKz_SetMovedPos(this, play); break; } } if (LINK_IS_ADULT) { if (!(gSaveContext.infTable[19] & 0x100)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BG_ICE_SHELTER, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BG_ICE_SHELTER, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x04FF); } @@ -377,43 +377,43 @@ void EnKz_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKz_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Destroy(Actor* thisx, PlayState* play) { EnKz* this = (EnKz*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx) { +void EnKz_PreMweepWait(EnKz* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_2); this->unk_1E0.unk_00 = 0; this->actionFunc = EnKz_SetupMweep; } else { - func_80034F54(globalCtx, this->unk_2A6, this->unk_2BE, 12); + func_80034F54(play, this->unk_2A6, this->unk_2BE, 12); } } -void EnKz_SetupMweep(EnKz* this, GlobalContext* globalCtx) { +void EnKz_SetupMweep(EnKz* this, PlayState* play) { Vec3f unused = { 0.0f, 0.0f, 0.0f }; Vec3f pos; Vec3f initPos; - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - this->gameplayCamera = globalCtx->activeCamera; - Gameplay_ChangeCameraStatus(globalCtx, this->gameplayCamera, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, CAM_STAT_ACTIVE); + this->cutsceneCamera = Play_CreateSubCamera(play); + this->gameplayCamera = play->activeCamera; + Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cutsceneCamera, CAM_STAT_ACTIVE); pos = this->actor.world.pos; initPos = this->actor.home.pos; pos.y += 60.0f; initPos.y += -100.0f; initPos.z += 260.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &pos, &initPos); - func_8002DF54(globalCtx, &this->actor, 8); + Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos); + func_8002DF54(play, &this->actor, 8); this->actor.speedXZ = 0.1f * CVar_GetS32("gMweepSpeed", 1); this->actionFunc = EnKz_Mweep; } -void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { +void EnKz_Mweep(EnKz* this, PlayState* play) { Vec3f unused = { 0.0f, 0.0f, 0.0f }; Vec3f pos; Vec3f initPos; @@ -423,11 +423,11 @@ void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { pos.y += 60.0f; initPos.y += -100.0f; initPos.z += 260.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &pos, &initPos); - if ((EnKz_FollowPath(this, globalCtx) == 1) && (this->waypoint == 0)) { + Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos); + if ((EnKz_FollowPath(this, play) == 1) && (this->waypoint == 0)) { Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_1); - Inventory_ReplaceItem(globalCtx, ITEM_LETTER_RUTO, ITEM_BOTTLE); - EnKz_SetMovedPos(this, globalCtx); + Inventory_ReplaceItem(play, ITEM_LETTER_RUTO, ITEM_BOTTLE); + EnKz_SetMovedPos(this, play); gSaveContext.eventChkInf[3] |= 8; this->actor.speedXZ = 0.0; this->actionFunc = EnKz_StopMweep; @@ -437,29 +437,29 @@ void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { } } -void EnKz_StopMweep(EnKz* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, this->gameplayCamera, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->cutsceneCamera); - func_8002DF54(globalCtx, &this->actor, 7); +void EnKz_StopMweep(EnKz* this, PlayState* play) { + Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->cutsceneCamera); + func_8002DF54(play, &this->actor, 7); this->actionFunc = EnKz_Wait; } -void EnKz_Wait(EnKz* this, GlobalContext* globalCtx) { +void EnKz_Wait(EnKz* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { this->actionFunc = EnKz_SetupGetItem; - EnKz_SetupGetItem(this, globalCtx); + EnKz_SetupGetItem(this, play); } else { - func_80034F54(globalCtx, this->unk_2A6, this->unk_2BE, 12); + func_80034F54(play, this->unk_2A6, this->unk_2BE, 12); } } -void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) { +void EnKz_SetupGetItem(EnKz* this, PlayState* play) { GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; s32 getItemId; f32 xzRange; f32 yRange; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->unk_1E0.unk_00 = 1; this->actionFunc = EnKz_StartTimer; @@ -468,8 +468,8 @@ void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) { if (this->isTrading) { getItemEntry = Randomizer_GetItemFromKnownCheck(RC_ZD_TRADE_PRESCRIPTION, GI_FROG); getItemId = getItemEntry.getItemId; - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_PRESCRIPTION); - Flags_SetTreasure(globalCtx, 0x1F); + Randomizer_ConsumeAdultTradeItem(play, ITEM_PRESCRIPTION); + Flags_SetTreasure(play, 0x1F); } else { getItemEntry = Randomizer_GetItemFromKnownCheck(RC_ZD_KING_ZORA_THAWED, GI_TUNIC_ZORA); getItemId = getItemEntry.getItemId; @@ -480,15 +480,15 @@ void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) { yRange = fabsf(this->actor.yDistToPlayer) + 1.0f; xzRange = this->actor.xzDistToPlayer + 1.0f; if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, xzRange, yRange); + func_8002F434(&this->actor, play, getItemId, xzRange, yRange); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, xzRange, yRange); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, xzRange, yRange); } } } -void EnKz_StartTimer(EnKz* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnKz_StartTimer(EnKz* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_FROG && !gSaveContext.n64ddFlag) { func_80088AA0(180); // start timer2 with 3 minutes gSaveContext.eventInf[1] &= ~1; @@ -498,7 +498,7 @@ void EnKz_StartTimer(EnKz* this, GlobalContext* globalCtx) { } } -void EnKz_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Update(Actor* thisx, PlayState* play) { EnKz* this = (EnKz*)thisx; s32 pad; @@ -506,17 +506,17 @@ void EnKz_Update(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.infTable[19] |= 0x100; } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelanime); EnKz_UpdateEyes(this); Actor_MoveForward(&this->actor); if (this->actionFunc != EnKz_StartTimer) { - func_80A9CB18(this, globalCtx); + func_80A9CB18(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnKz_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnKz_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnKz* this = (EnKz*)thisx; if (limbIndex == 8 || limbIndex == 9 || limbIndex == 10) { @@ -527,7 +527,7 @@ s32 EnKz_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnKz_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnKz_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnKz* this = (EnKz*)thisx; Vec3f mult = { 2600.0f, 0.0f, 0.0f }; @@ -536,7 +536,7 @@ void EnKz_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnKz_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Draw(Actor* thisx, PlayState* play) { static void* sEyeSegments[] = { gKzEyeOpenTex, gKzEyeHalfTex, @@ -544,12 +544,12 @@ void EnKz_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnKz* this = (EnKz*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeSegments[this->eyeIdx])); - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, EnKz_OverrideLimbDraw, EnKz_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.h b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.h index 67491acee..1f26eba16 100644 --- a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.h +++ b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.h @@ -6,7 +6,7 @@ struct EnKz; -typedef void (*EnKzActionFunc)(struct EnKz*, GlobalContext*); +typedef void (*EnKzActionFunc)(struct EnKz*, PlayState*); typedef struct EnKz { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Light/z_en_light.c b/soh/src/overlays/actors/ovl_En_Light/z_en_light.c index 0fd9c9984..3d13d9b23 100644 --- a/soh/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/soh/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -10,11 +10,11 @@ #define FLAGS 0 -void EnLight_Init(Actor* thisx, GlobalContext* globalCtx); -void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnLight_Update(Actor* thisx, GlobalContext* globalCtx); -void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx); +void EnLight_Init(Actor* thisx, PlayState* play); +void EnLight_Destroy(Actor* thisx, PlayState* play); +void EnLight_Update(Actor* thisx, PlayState* play); +void EnLight_Draw(Actor* thisx, PlayState* play); +void EnLight_UpdateSwitch(Actor* thisx, PlayState* play); const ActorInit En_Light_InitVars = { ACTOR_EN_LIGHT, @@ -46,7 +46,7 @@ static FlameParams D_80A9E840[] = { { { 170, 255, 255, 255 }, { 0, 0, 255 }, 75 }, { { 170, 255, 255, 255 }, { 0, 150, 255 }, 75 }, }; -void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Init(Actor* thisx, PlayState* play) { EnLight* this = (EnLight*)thisx; s16 yOffset; @@ -61,7 +61,7 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.z, 255, 255, 180, -1); } - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Actor_SetScale(&this->actor, D_80A9E840[this->actor.params & 0xF].scale * 0.0001f); this->timer = (s32)(Rand_ZeroOne() * 255.0f); @@ -70,15 +70,15 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Destroy(Actor* thisx, PlayState* play) { EnLight* this = (EnLight*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) { +void EnLight_UpdatePosRot(EnLight* this, PlayState* play) { // update yaw for billboard effect - this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; if (this->actor.parent != NULL) { Math_Vec3f_Copy(&this->actor.world.pos, &(this->actor.parent)->world.pos); @@ -88,7 +88,7 @@ void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) { this->timer++; } -void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Update(Actor* thisx, PlayState* play) { f32 intensity; FlameParams* flameParams; s16 radius; @@ -100,14 +100,14 @@ void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) { Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity), (flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity), radius); - EnLight_UpdatePosRot(this, globalCtx); + EnLight_UpdatePosRot(this, play); if (this->actor.params >= 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } -void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_UpdateSwitch(Actor* thisx, PlayState* play) { f32 intensity; FlameParams* flameParams; EnLight* this = (EnLight*)thisx; @@ -117,7 +117,7 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { scale = this->actor.scale.x / ((f32)flameParams->scale * 0.0001); if ((this->actor.params & 0x800) != 0) { - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0x3F0) >> 4)) { + if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) { Math_StepToF(&scale, 1.0f, 0.05f); } else { if (scale < 0.1f) { @@ -127,7 +127,7 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { Math_StepToF(&scale, 0.0f, 0.05f); } } else { - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0x3F0) >> 4)) { + if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) { if (scale < 0.1f) { Actor_SetScale(&this->actor, 0.0f); return; @@ -143,14 +143,14 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity), (flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity), 300.0f * scale); - EnLight_UpdatePosRot(this, globalCtx); + EnLight_UpdatePosRot(this, play); if (this->actor.params >= 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } -void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Draw(Actor* thisx, PlayState* play) { EnLight* this = (EnLight*)thisx; s32 pad; FlameParams* flameParams; @@ -158,14 +158,14 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { flameParams = &D_80A9E840[this->actor.params & 0xF]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->actor.params >= 0) { gSPSegment( POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->timer * -20) & 511, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->timer * -20) & 511, 32, 128)); dList = gEffFire1DL; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, flameParams->primColor.r, flameParams->primColor.g, @@ -173,7 +173,7 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, flameParams->envColor.r, flameParams->envColor.g, flameParams->envColor.b, 0); } else { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 32, 1, ((this->timer * 2) & 63), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 32, 1, ((this->timer * 2) & 63), (this->timer * -6) & 127 * 1, 16, 32)); dList = gUnusedCandleDL; @@ -181,7 +181,7 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); } - Matrix_RotateY((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y) + 0x8000) * + Matrix_RotateY((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000) * (M_PI / 32768.0f), MTXMODE_APPLY); @@ -190,9 +190,9 @@ 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), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c b/soh/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c index d54e87599..6502bbd69 100644 --- a/soh/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c +++ b/soh/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnLightbox_Init(Actor* thisx, GlobalContext* globalCtx); -void EnLightbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnLightbox_Update(Actor* thisx, GlobalContext* globalCtx); -void EnLightbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnLightbox_Init(Actor* thisx, PlayState* play); +void EnLightbox_Destroy(Actor* thisx, PlayState* play); +void EnLightbox_Update(Actor* thisx, PlayState* play); +void EnLightbox_Draw(Actor* thisx, PlayState* play); const ActorInit En_Lightbox_InitVars = { ACTOR_EN_LIGHTBOX, @@ -27,7 +27,7 @@ const ActorInit En_Lightbox_InitVars = { NULL, }; -void EnLightbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnLightbox_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; EnLightbox* this = (EnLightbox*)thisx; s32 pad[4]; @@ -57,24 +57,24 @@ void EnLightbox_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->targetMode = 0; thisx->gravity = -2.0f; CollisionHeader_GetVirtual(&object_lightbox_Col_001F10, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void EnLightbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnLightbox_Destroy(Actor* thisx, PlayState* play) { EnLightbox* this = (EnLightbox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnLightbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnLightbox_Update(Actor* thisx, PlayState* play) { EnLightbox* this = (EnLightbox*)thisx; if (this->dyna.unk_162 != 0) { - if (Actor_HasNoParent(thisx, globalCtx)) { + if (Actor_HasNoParent(thisx, play)) { this->dyna.unk_162 = 0; } } else { - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(thisx, play)) { this->dyna.unk_162++; } else { if (thisx->speedXZ) { @@ -97,17 +97,17 @@ void EnLightbox_Update(Actor* thisx, GlobalContext* globalCtx) { thisx->velocity.y *= IREG(60) / 100.0f; thisx->bgCheckFlags &= ~0x1; } else { - func_8002F580(thisx, globalCtx); + func_8002F580(thisx, play); } } } } Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, + Actor_UpdateBgCheckInfo(play, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, thisx->colChkInfo.cylRadius, 0x1D); thisx->focus.pos = thisx->world.pos; } -void EnLightbox_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_lightbox_DL_000B70); +void EnLightbox_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_lightbox_DL_000B70); } diff --git a/soh/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c b/soh/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c index fe4240d33..ac8c715f2 100644 --- a/soh/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c +++ b/soh/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c @@ -8,9 +8,9 @@ #define FLAGS 0 -void EnMFire1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMFire1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx); +void EnMFire1_Init(Actor* thisx, PlayState* play); +void EnMFire1_Destroy(Actor* thisx, PlayState* play); +void EnMFire1_Update(Actor* thisx, PlayState* play); const ActorInit En_M_Fire1_InitVars = { ACTOR_EN_M_FIRE1, @@ -45,25 +45,25 @@ static ColliderCylinderInit sCylinderInit = { { 200, 200, 0, { 0 } }, }; -void EnMFire1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Init(Actor* thisx, PlayState* play) { EnMFire1* this = (EnMFire1*)thisx; s32 pad; if (this->actor.params < 0) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } -void EnMFire1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Destroy(Actor* thisx, PlayState* play) { EnMFire1* this = (EnMFire1*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Update(Actor* thisx, PlayState* play) { EnMFire1* this = (EnMFire1*)thisx; s32 pad; @@ -71,6 +71,6 @@ void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } diff --git a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 4d7880dc1..6ca779d41 100644 --- a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -3,14 +3,14 @@ #define FLAGS 0 -void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMThunder_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMThunder_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMThunder_Init(Actor* thisx, PlayState* play); +void EnMThunder_Destroy(Actor* thisx, PlayState* play); +void EnMThunder_Update(Actor* thisx, PlayState* play); +void EnMThunder_Draw(Actor* thisx, PlayState* play); -void func_80A9F314(GlobalContext* globalCtx, f32 arg1); -void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx); -void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx); +void func_80A9F314(PlayState* play, f32 arg1); +void func_80A9F408(EnMThunder* this, PlayState* play); +void func_80A9F9B4(EnMThunder* this, PlayState* play); const ActorInit En_M_Thunder_InitVars = { ACTOR_EN_M_THUNDER, @@ -60,17 +60,17 @@ void func_80A9EFE0(EnMThunder* this, EnMThunderActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnMThunder_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnMThunder* this = (EnMThunder*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80AA0420); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AA0420); this->unk_1C7 = (this->actor.params & 0xFF) - 1; Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 0); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->collider.dim.radius = 0; this->collider.dim.height = 40; this->collider.dim.yShift = -20; @@ -87,7 +87,7 @@ void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx2) { if (player->stateFlags2 & 0x20000) { if (!gSaveContext.magicAcquired || gSaveContext.unk_13F0 || (((this->actor.params & 0xFF00) >> 8) && - !(func_80087708(globalCtx, (this->actor.params & 0xFF00) >> 8, 0)))) { + !(func_80087708(play, (this->actor.params & 0xFF00) >> 8, 0)))) { Audio_PlaySoundGeneral(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_IT_SWORD_SWING_HARD, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, @@ -112,24 +112,24 @@ void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.child = NULL; } -void EnMThunder_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMThunder_Destroy(Actor* thisx, PlayState* play) { EnMThunder* this = (EnMThunder*)thisx; if (this->unk_1CA != 0) { - func_800876C8(globalCtx); + func_800876C8(play); } - Collider_DestroyCylinder(globalCtx, &this->collider); - func_80A9F314(globalCtx, 0.0f); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); + func_80A9F314(play, 0.0f); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void func_80A9F314(GlobalContext* globalCtx, f32 arg1) { - Environment_AdjustLights(globalCtx, arg1, 850.0f, 0.2f, 0.0f); +void func_80A9F314(PlayState* play, f32 arg1) { + Environment_AdjustLights(play, arg1, 850.0f, 0.2f, 0.0f); } -void func_80A9F350(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9F350(EnMThunder* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & 0x20000) { if (player->swordAnimation >= 0x18) { @@ -148,8 +148,8 @@ void func_80A9F350(EnMThunder* this, GlobalContext* globalCtx) { } } -void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9F408(EnMThunder* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* child = this->actor.child; this->unk_1B8 = player->unk_858; @@ -159,8 +159,8 @@ void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { if (this->unk_1CA == 0) { if (player->unk_858 >= 0.1f) { if ((gSaveContext.unk_13F0) || (((this->actor.params & 0xFF00) >> 8) && - !(func_80087708(globalCtx, (this->actor.params & 0xFF00) >> 8, 4)))) { - func_80A9F350(this, globalCtx); + !(func_80087708(play, (this->actor.params & 0xFF00) >> 8, 4)))) { + func_80A9F350(this, play); func_80A9EFE0(this, func_80A9F350); this->unk_1C8 = 0; this->unk_1BC = 0.0; @@ -225,7 +225,7 @@ void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { if (player->unk_858 > 0.15f) { this->unk_1C8 = 255; if (this->actor.child == NULL) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EFF_DUST, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_DUST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->unk_1C7 + 2); } @@ -246,12 +246,12 @@ void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { func_800F4254(&player->actor.projectedPos, 0); } - if (Gameplay_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { Actor_Kill(&this->actor); } } -void func_80A9F938(EnMThunder* this, GlobalContext* globalCtx) { +void func_80A9F938(EnMThunder* this, PlayState* play) { if (this->unk_1C4 < 2) { if (this->unk_1C8 < 40) { this->unk_1C8 = 0; @@ -269,8 +269,8 @@ void func_80A9F938(EnMThunder* this, GlobalContext* globalCtx) { } } -void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9F9B4(EnMThunder* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Math_StepToF(&this->unk_1AC, 0.0f, 1 / 16.0f)) { Actor_Kill(&this->actor); @@ -279,7 +279,7 @@ void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); this->collider.dim.radius = (this->actor.scale.x * 25.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_1C4 > 0) { @@ -294,20 +294,20 @@ void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx) { this->unk_1B0 = this->unk_1AC * (5.0f / 3.0f); } - func_80A9F938(this, globalCtx); + func_80A9F938(this, play); - if (Gameplay_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { Actor_Kill(&this->actor); } } -void EnMThunder_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMThunder_Update(Actor* thisx, PlayState* play) { EnMThunder* this = (EnMThunder*)thisx; f32 blueRadius; s32 redGreen; - this->actionFunc(this, globalCtx); - func_80A9F314(globalCtx, this->unk_1BC); + this->actionFunc(this, play); + func_80A9F314(play, this->unk_1BC); blueRadius = this->unk_1AC; redGreen = (u32)(blueRadius * 255.0f) & 0xFF; Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, @@ -315,25 +315,25 @@ void EnMThunder_Update(Actor* thisx, GlobalContext* globalCtx) { (s32)(blueRadius * 800.0f)); } -void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnMThunder_Draw(Actor* thisx, PlayState* play2) { static f32 D_80AA046C[] = { 0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.25f, 0.2f, 0.15f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnMThunder* this = (EnMThunder*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 phi_f14; s32 phi_t1; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Scale(0.02f, 0.02f, 0.02f, 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); switch (this->unk_1C6) { case 0: case 1: gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0xFF - ((u8)(s32)(this->unk_1B4 * 30) & 0xFF), 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0xFF - ((u8)(s32)(this->unk_1B4 * 30) & 0xFF), 0, 0x40, 0x20, 1, 0xFF - ((u8)(s32)(this->unk_1B4 * 20) & 0xFF), 0, 8, 8)); break; } @@ -382,7 +382,7 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { } if (this->unk_1B8 >= 0.85f) { - phi_f14 = (D_80AA046C[(globalCtx->gameplayFrames & 7)] * 6.0f) + 1.0f; + phi_f14 = (D_80AA046C[(play->gameplayFrames & 7)] * 6.0f) + 1.0f; if (CVar_GetS32("gUseChargedCol",0)) { Color_RGB8 SpinColor1 = {255, 255, 170}; Color_RGB8 SpinColor2 = {255, 100, 0}; @@ -395,7 +395,7 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); phi_t1 = 0x28; } else { - phi_f14 = (D_80AA046C[globalCtx->gameplayFrames & 7] * 2.0f) + 1.0f; + phi_f14 = (D_80AA046C[play->gameplayFrames & 7] * 2.0f) + 1.0f; if (CVar_GetS32("gUseChargedCol",0)) { Color_RGB8 SpinColor1 = {170, 255, 255}; Color_RGB8 SpinColor2 = {20, 100, 255}; @@ -409,15 +409,15 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { phi_t1 = 0x14; } Matrix_Scale(1.0f, phi_f14, phi_f14, 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); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->gameplayFrames * 5) & 0xFF, 0, 0x20, 0x20, 1, - (globalCtx->gameplayFrames * 20) & 0xFF, (globalCtx->gameplayFrames * phi_t1) & 0xFF, 8, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->gameplayFrames * 5) & 0xFF, 0, 0x20, 0x20, 1, + (play->gameplayFrames * 20) & 0xFF, (play->gameplayFrames * phi_t1) & 0xFF, 8, 8)); gSPDisplayList(POLY_XLU_DISP++, gSpinAttackChargingDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h index 92f1bdbf4..4cb7ad215 100644 --- a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h +++ b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h @@ -6,7 +6,7 @@ struct EnMThunder; -typedef void (*EnMThunderActionFunc)(struct EnMThunder*, GlobalContext*); +typedef void (*EnMThunderActionFunc)(struct EnMThunder*, PlayState*); typedef struct EnMThunder { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index c2a19e621..30afcb2e7 100644 --- a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -9,23 +9,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMa1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMa1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMa1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMa1_Init(Actor* thisx, PlayState* play); +void EnMa1_Destroy(Actor* thisx, PlayState* play); +void EnMa1_Update(Actor* thisx, PlayState* play); +void EnMa1_Draw(Actor* thisx, PlayState* play); -u16 EnMa1_GetText(GlobalContext* globalCtx, Actor* this); -s16 func_80AA0778(GlobalContext* globalCtx, Actor* this); +u16 EnMa1_GetText(PlayState* play, Actor* this); +s16 func_80AA0778(PlayState* play, Actor* this); -void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx); -void func_80AA0EA0(EnMa1* this, GlobalContext* globalCtx); -void func_80AA0EFC(EnMa1* this, GlobalContext* globalCtx); -void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx); -void func_80AA106C(EnMa1* this, GlobalContext* globalCtx); -void func_80AA10EC(EnMa1* this, GlobalContext* globalCtx); -void func_80AA1150(EnMa1* this, GlobalContext* globalCtx); -void EnMa1_DoNothing(EnMa1* this, GlobalContext* globalCtx); -void EnMa1_WaitForSongGive(EnMa1* this, GlobalContext* globalCtx); +void func_80AA0D88(EnMa1* this, PlayState* play); +void func_80AA0EA0(EnMa1* this, PlayState* play); +void func_80AA0EFC(EnMa1* this, PlayState* play); +void func_80AA0F44(EnMa1* this, PlayState* play); +void func_80AA106C(EnMa1* this, PlayState* play); +void func_80AA10EC(EnMa1* this, PlayState* play); +void func_80AA1150(EnMa1* this, PlayState* play); +void EnMa1_DoNothing(EnMa1* this, PlayState* play); +void EnMa1_WaitForSongGive(EnMa1* this, PlayState* play); const ActorInit En_Ma1_InitVars = { ACTOR_EN_MA1, @@ -94,13 +94,13 @@ bool Randomizer_ObtainedMalonHCReward() { return Flags_GetEventChkInf(0x12); } -u16 EnMa1_GetText(GlobalContext* globalCtx, Actor* thisx) { +u16 EnMa1_GetText(PlayState* play, Actor* thisx) { // Special case for Malon Hyrule Castle Text. Placing it here at the beginning // has the added benefit of circumventing mask text if wearing bunny hood. - if (gSaveContext.n64ddFlag && globalCtx->sceneNum == SCENE_SPOT15) { + if (gSaveContext.n64ddFlag && play->sceneNum == SCENE_SPOT15) { return Randomizer_ObtainedMalonHCReward() ? 0x2044 : 0x2043; } - u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x17); + u16 faceReaction = Text_GetFaceReaction(play, 0x17); if (faceReaction != 0) { return faceReaction; @@ -136,10 +136,10 @@ u16 EnMa1_GetText(GlobalContext* globalCtx, Actor* thisx) { return 0x2041; } -s16 func_80AA0778(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AA0778(PlayState* play, Actor* thisx) { s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: switch (thisx->textId) { case 0x2041: @@ -172,12 +172,12 @@ s16 func_80AA0778(GlobalContext* globalCtx, Actor* thisx) { break; case TEXT_STATE_CHOICE: case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 2; } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 3; } break; @@ -193,7 +193,7 @@ s16 func_80AA0778(GlobalContext* globalCtx, Actor* thisx) { return ret; } -s32 func_80AA08C4(EnMa1* this, GlobalContext* globalCtx) { +s32 func_80AA08C4(EnMa1* this, PlayState* play) { if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneSetupIndex == 5)) { return 1; } @@ -201,11 +201,11 @@ s32 func_80AA08C4(EnMa1* this, GlobalContext* globalCtx) { return 0; } // Causes Malon to appear in the market if you haven't met her yet. - if (((globalCtx->sceneNum == SCENE_MARKET_NIGHT) || (globalCtx->sceneNum == SCENE_MARKET_DAY)) && + if (((play->sceneNum == SCENE_MARKET_NIGHT) || (play->sceneNum == SCENE_MARKET_DAY)) && !(gSaveContext.eventChkInf[1] & 0x10) && !(gSaveContext.infTable[8] & 0x800)) { return 1; } - if ((globalCtx->sceneNum == SCENE_SPOT15) && // if we're at hyrule castle + if ((play->sceneNum == SCENE_SPOT15) && // if we're at hyrule castle (!(gSaveContext.eventChkInf[1] & 0x10) || // and talon hasn't left (gSaveContext.n64ddFlag && !Randomizer_ObtainedMalonHCReward()))) { // or we're rando'd and haven't gotten malon's HC check @@ -217,11 +217,11 @@ s32 func_80AA08C4(EnMa1* this, GlobalContext* globalCtx) { } } // Malon asleep in her bed if Talon has left Hyrule Castle and it is nighttime. - if ((globalCtx->sceneNum == SCENE_SOUKO) && IS_NIGHT && (gSaveContext.eventChkInf[1] & 0x10)) { + if ((play->sceneNum == SCENE_SOUKO) && IS_NIGHT && (gSaveContext.eventChkInf[1] & 0x10)) { return 1; } // Don't spawn Malon if none of the above are true and we are not in Lon Lon Ranch. - if (globalCtx->sceneNum != SCENE_SPOT20) { + if (play->sceneNum != SCENE_SPOT20) { return 0; } // If we've gotten this far, we're in Lon Lon Ranch. Spawn Malon if it is daytime, Talon has left Hyrule Castle, and @@ -250,8 +250,8 @@ void EnMa1_ChangeAnim(EnMa1* this, s32 index) { sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } -void func_80AA0AF4(EnMa1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA0AF4(EnMa1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; if ((this->unk_1E8.unk_00 == 0) && (this->skelAnime.animation == &gMalonChildSingAnim)) { @@ -282,14 +282,14 @@ void func_80AA0B74(EnMa1* this) { } } -void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Init(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMalonChildSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gMalonChildSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit); if (gSaveContext.n64ddFlag) { // Skip Malon's multiple textboxes before getting an item @@ -298,12 +298,12 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.eventChkInf[1] |= 1; } - if (!func_80AA08C4(this, globalCtx)) { + if (!func_80AA08C4(this, play)) { Actor_Kill(&this->actor); return; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->unk_1E8.unk_00 = 0; @@ -314,7 +314,7 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { // 2. We are Randomized and have not obtained Malon's Weird Egg Check. // 3. We are not Randomized and have obtained Epona's Song if (!(gSaveContext.eventChkInf[1] & 0x10) || (gSaveContext.n64ddFlag && !Randomizer_ObtainedMalonHCReward()) || (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && !gSaveContext.n64ddFlag) || - (gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F))) { + (gSaveContext.n64ddFlag && Flags_GetTreasure(play, 0x1F))) { this->actionFunc = func_80AA0D88; EnMa1_ChangeAnim(this, ENMA1_ANIM_2); // If none of the above conditions were true, set Malon up to teach Epona's Song. @@ -328,14 +328,14 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMa1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Destroy(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx) { +void func_80AA0D88(EnMa1* this, PlayState* play) { if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gMalonChildIdleAnim) { EnMa1_ChangeAnim(this, ENMA1_ANIM_1); @@ -349,7 +349,7 @@ void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx) { // We want to Kill Malon's Actor outside of randomizer when Talon is freed. In Randomizer we don't kill Malon's // Actor here, otherwise if we wake up Talon first and then get her check she will spontaneously // disappear. - if ((globalCtx->sceneNum == SCENE_SPOT15) && (!gSaveContext.n64ddFlag && gSaveContext.eventChkInf[1] & 0x10)) { + if ((play->sceneNum == SCENE_SPOT15) && (!gSaveContext.n64ddFlag && gSaveContext.eventChkInf[1] & 0x10)) { Actor_Kill(&this->actor); // We want Malon to give the Weird Egg Check (see function below) in the following situations: // 1. Talon as not left Hyrule Castle (Vanilla) OR @@ -358,55 +358,55 @@ void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx) { } else if ((!(gSaveContext.eventChkInf[1] & 0x10) || (gSaveContext.n64ddFlag && !Randomizer_ObtainedMalonHCReward())) || (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && !gSaveContext.n64ddFlag)) { if (this->unk_1E8.unk_00 == 2) { this->actionFunc = func_80AA0EA0; - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } } -void func_80AA0EA0(EnMa1* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AA0EA0(EnMa1* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80AA0EFC; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_WEIRD_EGG, 120.0f, 10.0f); + func_8002F434(&this->actor, play, GI_WEIRD_EGG, 120.0f, 10.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_HC_MALON_EGG, GI_WEIRD_EGG); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 120.0f, 10.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 120.0f, 10.0f); } } } -void func_80AA0EFC(EnMa1* this, GlobalContext* globalCtx) { +void func_80AA0EFC(EnMa1* this, PlayState* play) { if (this->unk_1E8.unk_00 == 3) { this->unk_1E8.unk_00 = 0; this->actionFunc = func_80AA0D88; gSaveContext.eventChkInf[1] |= 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } -void GivePlayerRandoRewardMalon(EnMa1* malon, GlobalContext* globalCtx, RandomizerCheck check) { +void GivePlayerRandoRewardMalon(EnMa1* malon, PlayState* play, RandomizerCheck check) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_EPONAS_SONG); // Prevents flag from getting set if we weren't able to get the item (i.e. Player is holding shield // when closing the textbox). - if (malon->actor.parent != NULL && malon->actor.parent->id == GET_PLAYER(globalCtx)->actor.id && - !Flags_GetTreasure(globalCtx, 0x1F)) { - Flags_SetTreasure(globalCtx, 0x1F); + if (malon->actor.parent != NULL && malon->actor.parent->id == GET_PLAYER(play)->actor.id && + !Flags_GetTreasure(play, 0x1F)) { + Flags_SetTreasure(play, 0x1F); // puts malon in the action that vanilla has her in after learning the song // (confirmed via breakpoints in a vanilla save). malon->actionFunc = func_80AA0D88; - } else if (!Flags_GetTreasure(globalCtx, 0x1F)) { - GiveItemEntryFromActor(&malon->actor, globalCtx, getItemEntry, 10000.0f, 100.0f); + } else if (!Flags_GetTreasure(play, 0x1F)) { + GiveItemEntryFromActor(&malon->actor, play, getItemEntry, 10000.0f, 100.0f); } // make malon sing again after giving the item. malon->unk_1E8.unk_00 = 0; malon->unk_1E0 = 1; } -void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA0F44(EnMa1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gMalonChildIdleAnim) { @@ -424,7 +424,7 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { player->stateFlags2 |= 0x2000000; player->unk_6A8 = &this->actor; this->actor.textId = 0x2061; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1E8.unk_00 = 1; this->actor.flags |= ACTOR_FLAG_16; // when rando'ed, skip to the Item Giving. Otherwise go to the song teaching code. @@ -436,42 +436,42 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { } // If rando'ed, a textbox is closing, it's malon's 'my mom wrote this song' text, AND we do have an ocarina // in our inventory. This allows us to grant the check when talking to malon with the ocarina in our inventory. - if (gSaveContext.n64ddFlag && (Actor_TextboxIsClosing(&this->actor, globalCtx) && globalCtx->msgCtx.textId == 0x2049) && + if (gSaveContext.n64ddFlag && (Actor_TextboxIsClosing(&this->actor, play) && play->msgCtx.textId == 0x2049) && (INV_CONTENT(ITEM_OCARINA_FAIRY) != ITEM_NONE || INV_CONTENT(ITEM_OCARINA_TIME) != ITEM_NONE)) { this->actionFunc = EnMa1_WaitForSongGive; } } } -void func_80AA106C(EnMa1* this, GlobalContext* globalCtx) { - GET_PLAYER(globalCtx)->stateFlags2 |= 0x800000; +void func_80AA106C(EnMa1* this, PlayState* play) { + GET_PLAYER(play)->stateFlags2 |= 0x800000; if (this->unk_1E8.unk_00 == 2) { Audio_OcaSetInstrument(2); - func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_EPONA); + func_8010BD58(play, OCARINA_ACTION_TEACH_EPONA); this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = func_80AA10EC; } } -void func_80AA10EC(EnMa1* this, GlobalContext* globalCtx) { - GET_PLAYER(globalCtx)->stateFlags2 |= 0x800000; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { - func_8010BD58(globalCtx, OCARINA_ACTION_PLAYBACK_EPONA); +void func_80AA10EC(EnMa1* this, PlayState* play) { + GET_PLAYER(play)->stateFlags2 |= 0x800000; + if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { + func_8010BD58(play, OCARINA_ACTION_PLAYBACK_EPONA); this->actionFunc = func_80AA1150; } } -void EnMa1_WaitForSongGive(EnMa1* this, GlobalContext* globalCtx) { +void EnMa1_WaitForSongGive(EnMa1* this, PlayState* play) { // Actually give the song check. - GivePlayerRandoRewardMalon(this, globalCtx, RC_SONG_FROM_MALON); + GivePlayerRandoRewardMalon(this, play, RC_SONG_FROM_MALON); } // Sets an Ocarina State necessary to not softlock in rando. // This function should only be called in rando. -void EnMa1_EndTeachSong(EnMa1* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +void EnMa1_EndTeachSong(EnMa1* this, PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = func_80AA0F44; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } if (gSaveContext.n64ddFlag) { @@ -480,20 +480,20 @@ void EnMa1_EndTeachSong(EnMa1* this, GlobalContext* globalCtx) { } } -void func_80AA1150(EnMa1* this, GlobalContext* globalCtx) { - GET_PLAYER(globalCtx)->stateFlags2 |= 0x800000; +void func_80AA1150(EnMa1* this, PlayState* play) { + GET_PLAYER(play)->stateFlags2 |= 0x800000; // When rando'ed, trigger the "song learned" Ocarina mode. - if (gSaveContext.n64ddFlag && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + if (gSaveContext.n64ddFlag && (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { if (!gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x157; + play->nextEntranceIndex = 0x157; gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 42; - globalCtx->sceneLoadFlag = 0x14; + play->fadeTransition = 42; + play->sceneLoadFlag = 0x14; this->actionFunc = EnMa1_DoNothing; } else { // When rando'ed, skip the cutscene, play the chime, reset some flags, @@ -501,32 +501,32 @@ void func_80AA1150(EnMa1* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = EnMa1_EndTeachSong; this->actor.flags &= ~ACTOR_FLAG_16; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; } } } -void EnMa1_DoNothing(EnMa1* this, GlobalContext* globalCtx) { +void EnMa1_DoNothing(EnMa1* this, PlayState* play) { } -void EnMa1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Update(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMa1_UpdateEyes(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnMa1_DoNothing) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E8.unk_00, (f32)this->collider.dim.radius + 30.0f, + func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, (f32)this->collider.dim.radius + 30.0f, EnMa1_GetText, func_80AA0778); } func_80AA0B74(this); - func_80AA0AF4(this, globalCtx); + func_80AA0AF4(this, play); } -s32 EnMa1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMa1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa1* this = (EnMa1*)thisx; Vec3s vec; @@ -548,7 +548,7 @@ s32 EnMa1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMa1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMa1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnMa1* this = (EnMa1*)thisx; Vec3f vec = D_80AA16B8; @@ -557,24 +557,24 @@ void EnMa1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnMa1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Draw(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; Camera* camera; f32 distFromCamera; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - camera = GET_ACTIVE_CAM(globalCtx); + camera = GET_ACTIVE_CAM(play); distFromCamera = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); func_800F6268(distFromCamera, NA_BGM_LONLON); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMa1_OverrideLimbDraw, EnMa1_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h index ee68c0b88..078a0ed11 100644 --- a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h +++ b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h @@ -6,7 +6,7 @@ struct EnMa1; -typedef void (*EnMa1ActionFunc)(struct EnMa1*, GlobalContext*); +typedef void (*EnMa1ActionFunc)(struct EnMa1*, PlayState*); typedef struct EnMa1 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index dcca4a915..ef5279aea 100644 --- a/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -3,22 +3,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void EnMa2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMa2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMa2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMa2_Init(Actor* thisx, PlayState* play); +void EnMa2_Destroy(Actor* thisx, PlayState* play); +void EnMa2_Update(Actor* thisx, PlayState* play); +void EnMa2_Draw(Actor* thisx, PlayState* play); -u16 func_80AA19A0(GlobalContext* globalCtx, Actor* this); -s16 func_80AA1A38(GlobalContext* globalCtx, Actor* this); +u16 func_80AA19A0(PlayState* play, Actor* this); +s16 func_80AA1A38(PlayState* play, Actor* this); -void func_80AA1AE4(EnMa2* this, GlobalContext* globalCtx); +void func_80AA1AE4(EnMa2* this, PlayState* play); s32 func_80AA1C68(EnMa2* this); void EnMa2_UpdateEyes(EnMa2* this); -void func_80AA1DB4(EnMa2* this, GlobalContext* globalCtx); -void func_80AA2018(EnMa2* this, GlobalContext* globalCtx); -void func_80AA204C(EnMa2* this, GlobalContext* globalCtx); -void func_80AA20E4(EnMa2* this, GlobalContext* globalCtx); -void func_80AA21C8(EnMa2* this, GlobalContext* globalCtx); +void func_80AA1DB4(EnMa2* this, PlayState* play); +void func_80AA2018(EnMa2* this, PlayState* play); +void func_80AA204C(EnMa2* this, PlayState* play); +void func_80AA20E4(EnMa2* this, PlayState* play); +void func_80AA21C8(EnMa2* this, PlayState* play); const ActorInit En_Ma2_InitVars = { ACTOR_EN_MA2, @@ -69,8 +69,8 @@ static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 func_80AA19A0(GlobalContext* globalCtx, Actor* thisx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 23); +u16 func_80AA19A0(PlayState* play, Actor* thisx) { + u16 faceReaction = Text_GetFaceReaction(play, 23); if (faceReaction != 0) { return faceReaction; @@ -90,10 +90,10 @@ u16 func_80AA19A0(GlobalContext* globalCtx, Actor* thisx) { return 0x204C; } -s16 func_80AA1A38(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AA1A38(PlayState* play, Actor* thisx) { s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: switch (thisx->textId) { case 0x2051: @@ -122,8 +122,8 @@ s16 func_80AA1A38(GlobalContext* globalCtx, Actor* thisx) { return ret; } -void func_80AA1AE4(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA1AE4(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &gMalonAdultSingAnim)) { @@ -138,19 +138,19 @@ void func_80AA1AE4(EnMa2* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E0, 0, phi_a3); } -u16 func_80AA1B58(EnMa2* this, GlobalContext* globalCtx) { +u16 func_80AA1B58(EnMa2* this, PlayState* play) { if (LINK_IS_CHILD) { return 0; } - if (!(gSaveContext.eventChkInf[1] & 0x100) && (globalCtx->sceneNum == SCENE_MALON_STABLE) && IS_DAY && + if (!(gSaveContext.eventChkInf[1] & 0x100) && (play->sceneNum == SCENE_MALON_STABLE) && IS_DAY && (this->actor.shape.rot.z == 5)) { return 1; } - if (!(gSaveContext.eventChkInf[1] & 0x100) && (globalCtx->sceneNum == SCENE_SPOT20) && IS_NIGHT && + if (!(gSaveContext.eventChkInf[1] & 0x100) && (play->sceneNum == SCENE_SPOT20) && IS_NIGHT && (this->actor.shape.rot.z == 6)) { return 2; } - if (!(gSaveContext.eventChkInf[1] & 0x100) || (globalCtx->sceneNum != SCENE_SPOT20)) { + if (!(gSaveContext.eventChkInf[1] & 0x100) || (play->sceneNum != SCENE_SPOT20)) { return 0; } if ((this->actor.shape.rot.z == 7) && IS_DAY) { @@ -194,7 +194,7 @@ void EnMa2_ChangeAnim(EnMa2* this, s32 index) { sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } -void func_80AA1DB4(EnMa2* this, GlobalContext* globalCtx) { +void func_80AA1DB4(EnMa2* this, PlayState* play) { if (this->skelAnime.animation == &gMalonAdultSingAnim) { if (this->unk_1E0.unk_00 == 0) { if (this->unk_20A != 0) { @@ -210,17 +210,17 @@ void func_80AA1DB4(EnMa2* this, GlobalContext* globalCtx) { } } -void EnMa2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Init(Actor* thisx, PlayState* play) { EnMa2* this = (EnMa2*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit); - switch (func_80AA1B58(this, globalCtx)) { + switch (func_80AA1B58(this, play)) { case 1: EnMa2_ChangeAnim(this, ENMA2_ANIM_2); this->actionFunc = func_80AA2018; @@ -242,65 +242,65 @@ void EnMa2_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - 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 = 6; this->unk_1E0.unk_00 = 0; } -void EnMa2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Destroy(Actor* thisx, PlayState* play) { EnMa2* this = (EnMa2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AA2018(EnMa2* this, GlobalContext* globalCtx) { +void func_80AA2018(EnMa2* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { this->actor.flags &= ~ACTOR_FLAG_16; this->unk_1E0.unk_00 = 0; } } -void func_80AA204C(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA204C(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & 0x1000000) { player->unk_6A8 = &this->actor; player->stateFlags2 |= 0x2000000; - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_EPONA); + func_8010BD58(play, OCARINA_ACTION_CHECK_EPONA); this->actionFunc = func_80AA20E4; } else if (this->actor.xzDistToPlayer < 30.0f + (f32)this->collider.dim.radius) { player->stateFlags2 |= 0x800000; } } -void func_80AA20E4(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA20E4(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { this->actionFunc = func_80AA204C; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); this->unk_208 = 0x1E; gSaveContext.infTable[8] |= 0x4000; this->actionFunc = func_80AA21C8; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { player->stateFlags2 |= 0x800000; } } -void func_80AA21C8(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA21C8(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (DECR(this->unk_208)) { player->stateFlags2 |= 0x800000; } else { if (this->unk_1E0.unk_00 == 0) { this->actor.flags |= ACTOR_FLAG_16; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = func_80AA2018; @@ -308,24 +308,24 @@ void func_80AA21C8(EnMa2* this, GlobalContext* globalCtx) { } } -void EnMa2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Update(Actor* thisx, PlayState* play) { EnMa2* this = (EnMa2*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMa2_UpdateEyes(this); - this->actionFunc(this, globalCtx); - func_80AA1DB4(this, globalCtx); - func_80AA1AE4(this, globalCtx); + this->actionFunc(this, play); + func_80AA1DB4(this, play); + func_80AA1AE4(this, play); if (this->actionFunc != func_80AA20E4) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 30.0f, + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 30.0f, func_80AA19A0, func_80AA1A38); } } -s32 EnMa2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMa2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa2* this = (EnMa2*)thisx; Vec3s vec; @@ -352,11 +352,11 @@ s32 EnMa2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMa2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMa2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnMa2* this = (EnMa2*)thisx; Vec3f vec = { 900.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == MALON_ADULT_HEAD_LIMB) { Matrix_MultVec3f(&vec, &this->actor.focus.pos); @@ -365,10 +365,10 @@ void EnMa2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve gSPDisplayList(POLY_OPA_DISP++, gMalonAdultBasketDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Draw(Actor* thisx, PlayState* play) { static void* sMouthTextures[] = { gMalonAdultMouthNeutralTex, gMalonAdultMouthSadTex, gMalonAdultMouthHappyTex }; static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; @@ -377,18 +377,18 @@ void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 someFloat; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - camera = GET_ACTIVE_CAM(globalCtx); + camera = GET_ACTIVE_CAM(play); someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); func_800F6268(someFloat, NA_BGM_LONLON); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMa2_OverrideLimbDraw, EnMa2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h b/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h index 6d95e2f90..249bb5574 100644 --- a/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h +++ b/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h @@ -6,7 +6,7 @@ struct EnMa2; -typedef void (*EnMa2ActionFunc)(struct EnMa2*, GlobalContext*); +typedef void (*EnMa2ActionFunc)(struct EnMa2*, PlayState*); typedef enum { /* 0x00 */ MALON_ADULT_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 52ae9407a..16a9e04ce 100644 --- a/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -9,19 +9,19 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMa3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMa3_Init(Actor* thisx, PlayState* play); +void EnMa3_Destroy(Actor* thisx, PlayState* play); +void EnMa3_Update(Actor* thisx, PlayState* play); +void EnMa3_Draw(Actor* thisx, PlayState* play); -u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* this); -s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* this); +u16 func_80AA2AA0(PlayState* play, Actor* this); +s16 func_80AA2BD4(PlayState* play, Actor* this); -void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx); -s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx); +void func_80AA2E54(EnMa3* this, PlayState* play); +s32 func_80AA2EC8(EnMa3* this, PlayState* play); s32 func_80AA2F28(EnMa3* this); void EnMa3_UpdateEyes(EnMa3* this); -void func_80AA3200(EnMa3* this, GlobalContext* globalCtx); +void func_80AA3200(EnMa3* this, PlayState* play); const ActorInit En_Ma3_InitVars = { ACTOR_EN_MA3, @@ -72,8 +72,8 @@ static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 func_80AA2AA0(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); s16* timer1ValuePtr; // weirdness with this necessary to match if (!(gSaveContext.infTable[11] & 0x100)) { @@ -99,7 +99,7 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) { } } if ((!(player->stateFlags1 & 0x800000)) && - (Actor_FindNearby(globalCtx, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) { + (Actor_FindNearby(play, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) { return 0x2001; } if (!(gSaveContext.infTable[11] & 0x200)) { @@ -109,30 +109,30 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) { } } -s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AA2BD4(PlayState* play, Actor* thisx) { s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->nextEntranceIndex = 0x157; + if (Message_ShouldAdvance(play)) { + play->nextEntranceIndex = 0x157; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->fadeTransition = 0x26; - globalCtx->sceneLoadFlag = 0x14; + play->fadeTransition = 0x26; + play->sceneLoadFlag = 0x14; gSaveContext.eventInf[0] |= 0x400; gSaveContext.timer1State = 0xF; } break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { gSaveContext.infTable[11] |= 0x200; - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.eventChkInf[1] & 0x4000) { - Message_ContinueTextbox(globalCtx, 0x2091); + Message_ContinueTextbox(play, 0x2091); } else if (HIGH_SCORE(HS_HORSE_RACE) == 0) { - Message_ContinueTextbox(globalCtx, 0x2092); + Message_ContinueTextbox(play, 0x2092); } else { - Message_ContinueTextbox(globalCtx, 0x2090); + Message_ContinueTextbox(play, 0x2090); } } } @@ -179,8 +179,8 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) { return ret; } -void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA2E54(EnMa3* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &gMalonAdultSingAnim)) { @@ -194,7 +194,7 @@ void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E0, 0, phi_a3); } -s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx) { +s32 func_80AA2EC8(EnMa3* this, PlayState* play) { if (LINK_IS_CHILD) { return 2; } @@ -239,17 +239,17 @@ void EnMa3_ChangeAnim(EnMa3* this, s32 index) { sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } -void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Init(Actor* thisx, PlayState* play) { EnMa3* this = (EnMa3*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit); - switch (func_80AA2EC8(this, globalCtx)) { + switch (func_80AA2EC8(this, play)) { case 0: EnMa3_ChangeAnim(this, ENMA3_ANIM_0); this->actionFunc = func_80AA3200; @@ -263,36 +263,36 @@ void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - 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->unk_1E0.unk_00 = (u16)0; } -void EnMa3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Destroy(Actor* thisx, PlayState* play) { EnMa3* this = (EnMa3*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AA3200(EnMa3* this, GlobalContext* globalCtx) { +void func_80AA3200(EnMa3* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { this->actor.flags &= ~ACTOR_FLAG_16; this->unk_1E0.unk_00 = 0; } } -void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Update(Actor* thisx, PlayState* play) { EnMa3* this = (EnMa3*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMa3_UpdateEyes(this); - this->actionFunc(this, globalCtx); - func_80AA2E54(this, globalCtx); - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f, + this->actionFunc(this, play); + func_80AA2E54(this, play); + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f, func_80AA2AA0, func_80AA2BD4); if (this->unk_1E0.unk_00 == 0) { if (this->unk_20A != 0) { @@ -305,7 +305,7 @@ void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnMa3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMa3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa3* this = (EnMa3*)thisx; Vec3s vec; @@ -332,11 +332,11 @@ s32 EnMa3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMa3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMa3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnMa3* this = (EnMa3*)thisx; Vec3f vec = { 900.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == MALON_ADULT_LIMB_HEAD) { Matrix_MultVec3f(&vec, &this->actor.focus.pos); @@ -346,10 +346,10 @@ void EnMa3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve gSPDisplayList(POLY_OPA_DISP++, gMalonAdultBasketDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Draw(Actor* thisx, PlayState* play) { static void* sMouthTextures[] = { gMalonAdultMouthNeutralTex, gMalonAdultMouthSadTex, gMalonAdultMouthHappyTex }; static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; EnMa3* this = (EnMa3*)thisx; @@ -357,18 +357,18 @@ void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 someFloat; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - camera = GET_ACTIVE_CAM(globalCtx); + camera = GET_ACTIVE_CAM(play); someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); func_800F6268(someFloat, NA_BGM_LONLON); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMa3_OverrideLimbDraw, EnMa3_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h b/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h index 9d4d248b0..549d60c97 100644 --- a/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h +++ b/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h @@ -6,7 +6,7 @@ struct EnMa3; -typedef void (*EnMa3ActionFunc)(struct EnMa3*, GlobalContext*); +typedef void (*EnMa3ActionFunc)(struct EnMa3*, PlayState*); typedef enum { /* 0x00 */ MALON_ADULT_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 129996361..c73c33e99 100644 --- a/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -9,19 +9,19 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnMag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMag_InitMq(Actor* thisx, GlobalContext* globalCtx); -void EnMag_InitVanilla(Actor* thisx, GlobalContext* globalCtx); +void EnMag_Init(Actor* thisx, PlayState* play); +void EnMag_InitMq(Actor* thisx, PlayState* play); +void EnMag_InitVanilla(Actor* thisx, PlayState* play); -void EnMag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMag_UpdateMq(Actor* thisx, GlobalContext* globalCtx); -void EnMag_UpdateVanilla(Actor* thisx, GlobalContext* globalCtx); +void EnMag_Destroy(Actor* thisx, PlayState* play); +void EnMag_UpdateMq(Actor* thisx, PlayState* play); +void EnMag_UpdateVanilla(Actor* thisx, PlayState* play); -void EnMag_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnMag_DrawInnerVanilla(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp); -void EnMag_DrawInnerMq(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp); +void EnMag_Draw(Actor* thisx, PlayState* play); +void EnMag_DrawInnerVanilla(Actor* thisx, PlayState* play, Gfx** gfxp); +void EnMag_DrawInnerMq(Actor* thisx, PlayState* play, Gfx** gfxp); -typedef void (*EnMagDrawInnerFunc)(struct Actor*, GlobalContext*, Gfx**); +typedef void (*EnMagDrawInnerFunc)(struct Actor*, PlayState*, Gfx**); static EnMagDrawInnerFunc drawInnerFunc; @@ -38,20 +38,20 @@ const ActorInit En_Mag_InitVars = { NULL, }; -void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Init(Actor* thisx, PlayState* play) { if (ResourceMgr_IsGameMasterQuest()) { - EnMag_InitMq(thisx, globalCtx); + EnMag_InitMq(thisx, play); drawInnerFunc = EnMag_DrawInnerMq; thisx->update = EnMag_UpdateMq; } else { - EnMag_InitVanilla(thisx, globalCtx); + EnMag_InitVanilla(thisx, play); thisx->update = EnMag_UpdateVanilla; drawInnerFunc = EnMag_DrawInnerVanilla; } } static s16 sDelayTimer = 0; -void EnMag_InitMq(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_InitMq(Actor* thisx, PlayState* play) { EnMag* this = (EnMag*)thisx; YREG(1) = 63; @@ -121,7 +121,7 @@ void EnMag_InitMq(Actor* thisx, GlobalContext* globalCtx) { this->unk_E320 = 0; } -void EnMag_InitVanilla(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_InitVanilla(Actor* thisx, PlayState* play) { EnMag* this = (EnMag*)thisx; Color_RGB8 Original_Prim = { 255, 255, 170 }; Color_RGB8 Original_Env = { 255, 100, 0 }; @@ -211,18 +211,18 @@ void EnMag_InitVanilla(Actor* thisx, GlobalContext* globalCtx) { this->unk_E320 = 0; } -void EnMag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Destroy(Actor* thisx, PlayState* play) { } -void EnMag_UpdateMq(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_UpdateMq(Actor* thisx, PlayState* play) { s32 pad[2]; EnMag* this = (EnMag*)thisx; if (gSaveContext.fileNum != 0xFEDC) { if (this->globalState < MAG_STATE_DISPLAY) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -247,19 +247,19 @@ void EnMag_UpdateMq(Actor* thisx, GlobalContext* globalCtx) { } } else if (this->globalState >= MAG_STATE_DISPLAY) { if (sDelayTimer == 0) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { - if (globalCtx->sceneLoadFlag != 20) { + if (play->sceneLoadFlag != 20) { Audio_SetCutsceneFlag(0); Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); gSaveContext.gameMode = 2; - globalCtx->sceneLoadFlag = 20; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 20; + play->fadeTransition = 2; } this->copyrightAlphaStep = 15; @@ -363,18 +363,18 @@ void EnMag_UpdateMq(Actor* thisx, GlobalContext* globalCtx) { } if (this->globalState == MAG_STATE_INITIAL) { - if (Flags_GetEnv(globalCtx, 3)) { + if (Flags_GetEnv(play, 3)) { this->effectFadeInTimer = 40; this->globalState = MAG_STATE_FADE_IN; } } else if (this->globalState == MAG_STATE_DISPLAY) { - if (Flags_GetEnv(globalCtx, 4)) { + if (Flags_GetEnv(play, 4)) { this->globalState = MAG_STATE_FADE_OUT; } } } -void EnMag_UpdateVanilla(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_UpdateVanilla(Actor* thisx, PlayState* play) { s32 pad[2]; EnMag* this = (EnMag*)thisx; Color_RGB8 Original_Prim = { 255, 255, 170 }; @@ -382,9 +382,9 @@ void EnMag_UpdateVanilla(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.fileNum != 0xFEDC) { if (this->globalState < MAG_STATE_DISPLAY) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -418,19 +418,19 @@ void EnMag_UpdateVanilla(Actor* thisx, GlobalContext* globalCtx) { } } else if (this->globalState >= MAG_STATE_DISPLAY) { if (sDelayTimer == 0) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { - if (globalCtx->sceneLoadFlag != 20) { + if (play->sceneLoadFlag != 20) { Audio_SetCutsceneFlag(0); Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); gSaveContext.gameMode = 2; - globalCtx->sceneLoadFlag = 20; - globalCtx->fadeTransition = 2; + play->sceneLoadFlag = 20; + play->fadeTransition = 2; } this->copyrightAlphaStep = 15; @@ -549,12 +549,12 @@ void EnMag_UpdateVanilla(Actor* thisx, GlobalContext* globalCtx) { } if (this->globalState == MAG_STATE_INITIAL) { - if (Flags_GetEnv(globalCtx, 3)) { + if (Flags_GetEnv(play, 3)) { this->effectFadeInTimer = 40; this->globalState = MAG_STATE_FADE_IN; } } else if (this->globalState == MAG_STATE_DISPLAY) { - if (Flags_GetEnv(globalCtx, 4)) { + if (Flags_GetEnv(play, 4)) { this->globalState = MAG_STATE_FADE_OUT; } } @@ -671,7 +671,7 @@ void EnMag_DrawCharTexture(Gfx** gfxp, u8* texture, s32 rectLeft, s32 rectTop) { } -void EnMag_DrawInnerMq(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { +void EnMag_DrawInnerMq(Actor* thisx, PlayState* play, Gfx** gfxp) { static s16 textAlpha = 0; static s16 textFadeDirection = 0; static s16 textFadeTimer = 0; @@ -694,7 +694,7 @@ void EnMag_DrawInnerMq(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { u16 rectLeft; u16 rectTop; - gSPSegment(gfx++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); func_8009457C(&gfx); @@ -861,7 +861,7 @@ void EnMag_DrawInnerMq(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { *gfxp = gfx; } -void EnMag_DrawInnerVanilla(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { +void EnMag_DrawInnerVanilla(Actor* thisx, PlayState* play, Gfx** gfxp) { static s16 textAlpha = 0; static s16 textFadeDirection = 0; static s16 textFadeTimer = 0; @@ -884,7 +884,7 @@ void EnMag_DrawInnerVanilla(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) u16 rectLeft; u16 rectTop; - gSPSegment(gfx++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); func_8009457C(&gfx); @@ -1048,22 +1048,22 @@ void EnMag_DrawInnerVanilla(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) *gfxp = gfx; } -void EnMag_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Draw(Actor* thisx, PlayState* play) { s32 pad; Gfx* gfx; Gfx* gfxRef; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfxRef = POLY_OPA_DISP; gfx = Graph_GfxPlusOne(gfxRef); gSPDisplayList(OVERLAY_DISP++, gfx); - drawInnerFunc(thisx, globalCtx, &gfx); + drawInnerFunc(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/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 7778ae6ba..1449a7f6e 100644 --- a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -48,10 +48,10 @@ typedef enum { /* 27 */ ENMB_LIMB_RFOOT } EnMbLimb; -void EnMb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMb_Init(Actor* thisx, PlayState* play); +void EnMb_Destroy(Actor* thisx, PlayState* play); +void EnMb_Update(Actor* thisx, PlayState* play); +void EnMb_Draw(Actor* thisx, PlayState* play); const ActorInit En_Mb_InitVars = { ACTOR_EN_MB, @@ -66,29 +66,29 @@ const ActorInit En_Mb_InitVars = { NULL, }; -void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx); +void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play); void EnMb_SetupClubWaitPlayerNear(EnMb* this); -void EnMb_SpearGuardLookAround(EnMb* this, GlobalContext* globalCtx); +void EnMb_SpearGuardLookAround(EnMb* this, PlayState* play); void EnMb_SetupSpearGuardLookAround(EnMb* this); void EnMb_SetupSpearDamaged(EnMb* this); -void EnMb_SpearGuardWalk(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearEndChargeQuick(EnMb* this, GlobalContext* globalCtx); -void EnMb_Stunned(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubDead(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubDamagedWhileKneeling(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubWaitPlayerNear(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearDamaged(EnMb* this, GlobalContext* globalCtx); +void EnMb_SpearGuardWalk(EnMb* this, PlayState* play); +void EnMb_SpearGuardPrepareAndCharge(EnMb* this, PlayState* play); +void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play); +void EnMb_SpearEndChargeQuick(EnMb* this, PlayState* play); +void EnMb_Stunned(EnMb* this, PlayState* play); +void EnMb_ClubDead(EnMb* this, PlayState* play); +void EnMb_ClubDamagedWhileKneeling(EnMb* this, PlayState* play); +void EnMb_ClubWaitPlayerNear(EnMb* this, PlayState* play); +void EnMb_ClubAttack(EnMb* this, PlayState* play); +void EnMb_SpearDead(EnMb* this, PlayState* play); +void EnMb_SpearDamaged(EnMb* this, PlayState* play); void EnMb_SetupSpearDead(EnMb* this); -void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubWaitAfterAttack(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubDamaged(EnMb* this, GlobalContext* globalCtx); +void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play); +void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play); +void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play); +void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play); +void EnMb_ClubWaitAfterAttack(EnMb* this, PlayState* play); +void EnMb_ClubDamaged(EnMb* this, PlayState* play); static ColliderCylinderInit sHitboxInit = { { @@ -256,26 +256,26 @@ void EnMb_SetupAction(EnMb* this, EnMbActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Init(Actor* thisx, PlayState* play) { EnMb* this = (EnMb*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 relYawFromPlayer; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 46.0f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.damageTable = &sSpearMoblinDamageTable; - Collider_InitCylinder(globalCtx, &this->hitbox); - Collider_SetCylinder(globalCtx, &this->hitbox, &this->actor, &sHitboxInit); - Collider_InitTris(globalCtx, &this->frontShielding); - Collider_SetTris(globalCtx, &this->frontShielding, &this->actor, &sFrontShieldingInit, this->frontShieldingTris); - Collider_InitQuad(globalCtx, &this->attackCollider); - Collider_SetQuad(globalCtx, &this->attackCollider, &this->actor, &sAttackColliderInit); + Collider_InitCylinder(play, &this->hitbox); + Collider_SetCylinder(play, &this->hitbox, &this->actor, &sHitboxInit); + Collider_InitTris(play, &this->frontShielding); + Collider_SetTris(play, &this->frontShielding, &this->actor, &sFrontShieldingInit, this->frontShieldingTris); + Collider_InitQuad(play, &this->attackCollider); + Collider_SetQuad(play, &this->attackCollider, &this->actor, &sAttackColliderInit); switch (this->actor.params) { case ENMB_TYPE_SPEAR_GUARD: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, this->jointTable, this->morphTable, 28); this->actor.colChkInfo.health = 2; this->actor.colChkInfo.mass = MASS_HEAVY; @@ -284,7 +284,7 @@ void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { EnMb_SetupSpearGuardLookAround(this); break; case ENMB_TYPE_CLUB: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gEnMbClubSkel, &gEnMbClubStandStillClubDownAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbClubSkel, &gEnMbClubStandStillClubDownAnim, this->jointTable, this->morphTable, 28); this->actor.colChkInfo.health = 6; @@ -313,7 +313,7 @@ void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { EnMb_SetupClubWaitPlayerNear(this); break; default: /* Spear Patrol */ - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, this->jointTable, this->morphTable, 28); Actor_SetScale(&this->actor, 0.014f); @@ -325,31 +325,31 @@ void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { this->maxHomeDist = 350.0f; this->playerDetectionRange = 1750.0f; this->actor.flags &= ~ACTOR_FLAG_0; - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); break; } } -void EnMb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Destroy(Actor* thisx, PlayState* play) { EnMb* this = (EnMb*)thisx; - Collider_DestroyTris(globalCtx, &this->frontShielding); - Collider_DestroyCylinder(globalCtx, &this->hitbox); - Collider_DestroyQuad(globalCtx, &this->attackCollider); + Collider_DestroyTris(play, &this->frontShielding); + Collider_DestroyCylinder(play, &this->hitbox); + Collider_DestroyQuad(play, &this->attackCollider); } -void EnMb_FaceWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_FaceWaypoint(EnMb* this, PlayState* play) { s16 yawToWaypoint = Math_Vec3f_Yaw(&this->actor.world.pos, &this->waypointPos); this->actor.shape.rot.y = yawToWaypoint; this->actor.world.rot.y = yawToWaypoint; } -void EnMb_NextWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_NextWaypoint(EnMb* this, PlayState* play) { Path* path; Vec3s* waypointPos; - path = &globalCtx->setupPathList[this->path]; + path = &play->setupPathList[this->path]; if (this->waypoint == 0) { this->direction = 1; @@ -370,8 +370,8 @@ void EnMb_NextWaypoint(EnMb* this, GlobalContext* globalCtx) { * Note: the longest corridor in Sacred Forest Meadows is 800 units long, * and they all are 100 units wide. */ -s32 EnMb_IsPlayerInCorridor(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnMb_IsPlayerInCorridor(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 xFromPlayer; f32 zFromPlayer; f32 cos; @@ -404,8 +404,8 @@ s32 EnMb_IsPlayerInCorridor(EnMb* this, GlobalContext* globalCtx) { return false; } -void EnMb_FindWaypointTowardsPlayer(EnMb* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->path]; +void EnMb_FindWaypointTowardsPlayer(EnMb* this, PlayState* play) { + Path* path = &play->setupPathList[this->path]; s16 yawToWaypoint; Vec3f waypointPosF; Vec3s* waypointPosS; @@ -448,12 +448,12 @@ void EnMb_SetupClubWaitPlayerNear(EnMb* this) { EnMb_SetupAction(this, EnMb_ClubWaitPlayerNear); } -void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gEnMbSpearLookLeftAndRightAnim, -4.0f); this->actor.speedXZ = 0.0f; this->timer1 = Rand_S16Offset(40, 80); this->state = ENMB_STATE_IDLE; - EnMb_NextWaypoint(this, globalCtx); + EnMb_NextWaypoint(this, play); EnMb_SetupAction(this, EnMb_SpearPatrolTurnTowardsWaypoint); } @@ -599,14 +599,14 @@ void EnMb_SetupStunned(EnMb* this) { EnMb_SetupAction(this, EnMb_Stunned); } -void EnMb_Stunned(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_Stunned(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~0x80; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -630,7 +630,7 @@ void EnMb_Stunned(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_SpearGuardLookAround(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearGuardLookAround(EnMb* this, PlayState* play) { s16 timer1; SkelAnime_Update(&this->skelAnime); @@ -645,7 +645,7 @@ void EnMb_SpearGuardLookAround(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play) { s16 relYawFromPlayer; SkelAnime_Update(&this->skelAnime); @@ -661,10 +661,10 @@ void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 0x3E8, 0); } - if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, globalCtx)) { + if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, play)) { relYawFromPlayer = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; - if (ABS(relYawFromPlayer) <= 0x4000 || (func_8002DDE4(globalCtx) && this->actor.xzDistToPlayer < 160.0f)) { - EnMb_FindWaypointTowardsPlayer(this, globalCtx); + if (ABS(relYawFromPlayer) <= 0x4000 || (func_8002DDE4(play) && this->actor.xzDistToPlayer < 160.0f)) { + EnMb_FindWaypointTowardsPlayer(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); EnMb_SetupSpearPrepareAndCharge(this); } @@ -674,12 +674,12 @@ void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { /** * Slow down and resume walking. */ -void EnMb_SpearEndChargeQuick(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearEndChargeQuick(EnMb* this, PlayState* play) { s32 pad; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.5f, 1.0f, 0.0f); if (this->actor.speedXZ > 1.0f) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); } if (SkelAnime_Update(&this->skelAnime)) { if (this->timer1 == 0) { @@ -697,13 +697,13 @@ void EnMb_SpearEndChargeQuick(EnMb* this, GlobalContext* globalCtx) { EnMb_SetupSpearGuardWalk(this); this->timer1 = this->timer2 = this->timer3 = 80; } else { - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } } } } -void EnMb_ClubWaitAfterAttack(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubWaitAfterAttack(EnMb* this, PlayState* play) { this->attack = ENMB_ATTACK_NONE; if (SkelAnime_Update(&this->skelAnime)) { EnMb_SetupClubWaitPlayerNear(this); @@ -713,8 +713,8 @@ void EnMb_ClubWaitAfterAttack(EnMb* this, GlobalContext* globalCtx) { /** * Slow down, charge again if the player is near, or resume walking. */ -void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 lastFrame; s16 relYawFromPlayer; s16 yawPlayerToWaypoint; @@ -723,14 +723,14 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x80; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } if (this->actor.bgCheckFlags & 1) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); if (this->actor.speedXZ > 1.0f) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); } if (this->timer1 != 0) { @@ -738,7 +738,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { if (this->timer3 == 0) { relYawFromPlayer = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; - if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, globalCtx) && + if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, play) && ABS(relYawFromPlayer) <= 0x4000 && this->actor.xzDistToPlayer <= 200.0f) { EnMb_SetupSpearPrepareAndCharge(this); } else { @@ -769,7 +769,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { Math_Vec3f_Yaw(&this->actor.world.pos, &this->waypointPos) - this->actor.yawTowardsPlayer; if (ABS(yawPlayerToWaypoint) <= 0x4000) { - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } else { EnMb_SetupSpearPatrolWalkTowardsWaypoint(this); } @@ -781,7 +781,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { /** * Prepare charge (animation), then charge until the player isn't in front. */ -void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearGuardPrepareAndCharge(EnMb* this, PlayState* play) { s32 prevFrame; s16 relYawTowardsPlayerAbs = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -802,7 +802,7 @@ void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { } else { this->actor.speedXZ = 10.0f; this->attack = ENMB_ATTACK_SPEAR; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); if (prevFrame != (s32)this->skelAnime.curFrame && ((s32)this->skelAnime.curFrame == 2 || (s32)this->skelAnime.curFrame == 6)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_DASH); @@ -815,8 +815,8 @@ void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_ClubAttack(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f effSpawnPos; Vec3f effWhiteShockwaveDynamics = { 0.0f, 0.0f, 0.0f }; @@ -836,11 +836,11 @@ void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } - func_8002F71C(globalCtx, &this->actor, (650.0f - this->actor.xzDistToPlayer) * 0.04f + 4.0f, + func_8002F71C(play, &this->actor, (650.0f - this->actor.xzDistToPlayer) * 0.04f + 4.0f, this->actor.world.rot.y, 8.0f); player->invincibilityTimer = prevPlayerInvincibilityTimer; @@ -860,11 +860,11 @@ void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { effSpawnPos.y = this->actor.floorHeight; Audio_PlayActorSound2(&this->actor, NA_SE_EN_MONBLIN_HAM_LAND); func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &effSpawnPos, &effWhiteShockwaveDynamics, + EffectSsBlast_SpawnWhiteShockwave(play, &effSpawnPos, &effWhiteShockwaveDynamics, &effWhiteShockwaveDynamics); - func_80033480(globalCtx, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1); - Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5); - func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, globalCtx, + func_80033480(play, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1); + Camera_AddQuake(&play->mainCamera, 2, 0x19, 5); + func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, play, -1, 0); EnMb_SetupClubWaitAfterAttack(this); } @@ -881,11 +881,11 @@ void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { /** * Prepare charge (animation), then charge to the end of the floor collision. */ -void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevFrame; s32 hasHitPlayer = false; - s32 endCharge = !Actor_TestFloorInDirection(&this->actor, globalCtx, 110.0f, this->actor.world.rot.y); + s32 endCharge = !Actor_TestFloorInDirection(&this->actor, play, 110.0f, this->actor.world.rot.y); prevFrame = (s32)this->skelAnime.curFrame; if (SkelAnime_Update(&this->skelAnime)) { @@ -900,7 +900,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { } else { this->actor.speedXZ = 10.0f; this->attack = ENMB_ATTACK_SPEAR; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); if (prevFrame != (s32)this->skelAnime.curFrame && ((s32)this->skelAnime.curFrame == 2 || (s32)this->skelAnime.curFrame == 6)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_DASH); @@ -915,13 +915,13 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } if (!(this->attackCollider.base.atFlags & AT_BOUNCED)) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; } } @@ -949,7 +949,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x80; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } } this->attack = ENMB_ATTACK_NONE; @@ -961,16 +961,16 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { /** * Charge and follow the path, until hitting the player or, after some time, reaching home. */ -void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevFrame; s32 hasHitPlayer = false; - s32 endCharge = !Actor_TestFloorInDirection(&this->actor, globalCtx, 110.0f, this->actor.world.rot.y); + s32 endCharge = !Actor_TestFloorInDirection(&this->actor, play, 110.0f, this->actor.world.rot.y); prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); if (prevFrame != (s32)this->skelAnime.curFrame && ((s32)this->skelAnime.curFrame == 2 || (s32)this->skelAnime.curFrame == 6)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_DASH); @@ -984,13 +984,13 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } if (!(this->attackCollider.base.atFlags & AT_BOUNCED)) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; } } @@ -1018,7 +1018,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x80; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } this->attack = ENMB_ATTACK_NONE; this->actor.speedXZ = -10.0f; @@ -1026,11 +1026,11 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { this->timer3 = 1; } else { this->timer3--; - EnMb_NextWaypoint(this, globalCtx); + EnMb_NextWaypoint(this, play); } } - EnMb_FaceWaypoint(this, globalCtx); + EnMb_FaceWaypoint(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->timer3 == 0 && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) < 80.0f) { @@ -1039,20 +1039,20 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_ClubDamaged(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubDamaged(EnMb* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer3 != 0) { Animation_PlayOnce(&this->skelAnime, &gEnMbClubStandUpAnim); this->timer3 = 0; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - Camera_AddQuake(&globalCtx->mainCamera, 2, 25, 5); + Camera_AddQuake(&play->mainCamera, 2, 25, 5); } else { EnMb_SetupClubWaitPlayerNear(this); } } } -void EnMb_ClubDamagedWhileKneeling(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubDamagedWhileKneeling(EnMb* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -1075,7 +1075,7 @@ void EnMb_ClubDamagedWhileKneeling(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_ClubDead(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubDead(EnMb* this, PlayState* play) { Vec3f effPos; Vec3f effPosBase; @@ -1095,30 +1095,30 @@ void EnMb_ClubDead(EnMb* this, GlobalContext* globalCtx) { effPos.x = Rand_CenteredFloat(240.0f) + effPosBase.x; effPos.y = Rand_CenteredFloat(15.0f) + (effPosBase.y + 20.0f); effPos.z = Rand_CenteredFloat(240.0f) + effPosBase.z; - EffectSsDeadDb_Spawn(globalCtx, &effPos, &effZeroVec, &effZeroVec, 230, 7, 255, 255, 255, 255, 0, 255, + EffectSsDeadDb_Spawn(play, &effPos, &effZeroVec, &effZeroVec, 230, 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, true); } } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &effPos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &effPos, 0xC0); Actor_Kill(&this->actor); } } else if ((s32)this->skelAnime.curFrame == 15 || (s32)this->skelAnime.curFrame == 22) { func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &effPos, 50.0f, 10, 3.0f, 400, 60, false); + Actor_SpawnFloorDustRing(play, &this->actor, &effPos, 50.0f, 10, 3.0f, 400, 60, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); - Camera_AddQuake(&globalCtx->mainCamera, 2, 25, 5); + Camera_AddQuake(&play->mainCamera, 2, 25, 5); } } /** * Walk around the home point, face and charge the player if close. */ -void EnMb_SpearGuardWalk(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearGuardWalk(EnMb* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad1; s32 pad2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s16 yawTowardsHome; f32 playSpeedAbs; @@ -1175,7 +1175,7 @@ void EnMb_SpearGuardWalk(EnMb* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s16 relYawTowardsPlayer; @@ -1184,7 +1184,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { if (Math_Vec3f_DistXZ(&this->waypointPos, &this->actor.world.pos) <= 8.0f || (Rand_ZeroOne() < 0.1f && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) <= 4.0f)) { - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } else { Math_SmoothStepToF(&this->actor.speedXZ, 0.59999996f, 0.1f, 1.0f, 0.0f); this->skelAnime.playSpeed = 2.0f * this->actor.speedXZ; @@ -1194,10 +1194,10 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, this->yawToWaypoint, 1, 0x5DC, 0); yDistToPlayerAbs = (this->actor.yDistToPlayer >= 0.0f) ? this->actor.yDistToPlayer : -this->actor.yDistToPlayer; - if (yDistToPlayerAbs <= 20.0f && EnMb_IsPlayerInCorridor(this, globalCtx)) { + if (yDistToPlayerAbs <= 20.0f && EnMb_IsPlayerInCorridor(this, play)) { relYawTowardsPlayer = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer); - if (ABS(relYawTowardsPlayer) <= 0x4000 || (func_8002DDE4(globalCtx) && this->actor.xzDistToPlayer < 160.0f)) { - EnMb_FindWaypointTowardsPlayer(this, globalCtx); + if (ABS(relYawTowardsPlayer) <= 0x4000 || (func_8002DDE4(play) && this->actor.xzDistToPlayer < 160.0f)) { + EnMb_FindWaypointTowardsPlayer(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); EnMb_SetupSpearPrepareAndCharge(this); return; @@ -1230,8 +1230,8 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnMb_ClubWaitPlayerNear(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_ClubWaitPlayerNear(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 relYawFromPlayer = this->actor.world.rot.y - this->actor.yawTowardsPlayer; @@ -1260,7 +1260,7 @@ void EnMb_SetupSpearDamaged(EnMb* this) { EnMb_SetupAction(this, EnMb_SpearDamaged); } -void EnMb_SpearDamaged(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearDamaged(EnMb* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.params <= ENMB_TYPE_SPEAR_GUARD) { @@ -1291,8 +1291,8 @@ void EnMb_SetupSpearDead(EnMb* this) { EnMb_SetupAction(this, EnMb_SpearDead); } -void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearDead(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -1300,7 +1300,7 @@ void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x80; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -1317,17 +1317,17 @@ void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx) { effPos.y = Rand_CenteredFloat(15.0f) + (this->actor.world.pos.y + 20.0f); effPos.z = Rand_CenteredFloat(110.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &effPos, &zeroVec, &zeroVec, 100, 7, 255, 255, 255, 255, 0, 255, 0, 1, + EffectSsDeadDb_Spawn(play, &effPos, &zeroVec, &zeroVec, 100, 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, true); } } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } } -void EnMb_SpearUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_SpearUpdateAttackCollider(Actor* thisx, PlayState* play) { Vec3f quadModel0 = { 1000.0f, 1500.0f, 0.0f }; Vec3f quadModel1 = { -1000.0f, 1500.0f, 0.0f }; Vec3f quadModel2 = { 1000.0f, 1500.0f, 4500.0f }; @@ -1353,7 +1353,7 @@ void EnMb_SpearUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { &this->attackCollider.dim.quad[3]); } -void EnMb_ClubUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_ClubUpdateAttackCollider(Actor* thisx, PlayState* play) { static Vec3f quadModel[] = { { 1000.0f, 0.0f, 0.0f }, { 1000.0f, 0.0f, 0.0f }, { 1000.0f, -8000.0f, -1500.0f }, @@ -1369,8 +1369,8 @@ void EnMb_ClubUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { &this->attackCollider.dim.quad[3]); } -void EnMb_CheckColliding(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_CheckColliding(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->frontShielding.base.acFlags & AC_HIT) { this->frontShielding.base.acFlags &= ~(AC_HIT | AC_BOUNCED); @@ -1383,7 +1383,7 @@ void EnMb_CheckColliding(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x80; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); } this->damageEffect = this->actor.colChkInfo.damageEffect; this->attack = ENMB_ATTACK_NONE; @@ -1415,36 +1415,36 @@ void EnMb_CheckColliding(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Update(Actor* thisx, PlayState* play) { EnMb* this = (EnMb*)thisx; s32 pad; - EnMb_CheckColliding(this, globalCtx); + EnMb_CheckColliding(this, play); if (thisx->colChkInfo.damageEffect != ENMB_DMGEFF_FREEZE) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 40.0f, 40.0f, 70.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, thisx, 40.0f, 40.0f, 70.0f, 0x1D); Actor_SetFocus(thisx, thisx->scale.x * 4500.0f); Collider_UpdateCylinder(thisx, &this->hitbox); if (thisx->colChkInfo.health <= 0) { this->hitbox.dim.pos.x += Math_SinS(thisx->shape.rot.y) * (-4400.0f * thisx->scale.y); this->hitbox.dim.pos.z += Math_CosS(thisx->shape.rot.y) * (-4400.0f * thisx->scale.y); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->hitbox.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->hitbox.base); if (this->state >= ENMB_STATE_STUNNED && (thisx->params == ENMB_TYPE_CLUB || this->state != ENMB_STATE_ATTACK)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->hitbox.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->hitbox.base); } if (this->state >= ENMB_STATE_IDLE) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->frontShielding.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->frontShielding.base); } if (this->attack > ENMB_ATTACK_NONE) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->attackCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->attackCollider.base); } } } -void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f unused = { 1100.0f, -700.0f, 0.0f }; static Vec3f feetPos = { 0.0f, 0.0f, 0.0f }; static Vec3f effSpawnPosModel = { 0.0f, -8000.0f, 0.0f }; @@ -1457,7 +1457,7 @@ void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if (limbIndex == ENMB_LIMB_LHAND) { Matrix_MultVec3f(&effSpawnPosModel, &this->effSpawnPos); if (this->attack > ENMB_ATTACK_NONE) { - EnMb_ClubUpdateAttackCollider(&this->actor, globalCtx); + EnMb_ClubUpdateAttackCollider(&this->actor, play); } } Actor_SetFeetPos(&this->actor, limbIndex, ENMB_LIMB_LFOOT, &feetPos, ENMB_LIMB_RFOOT, &feetPos); @@ -1505,7 +1505,7 @@ void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Draw(Actor* thisx, PlayState* play) { static Vec3f frontShieldingTriModel0[] = { { 4000.0f, 7000.0f, 3500.0f }, { 4000.0f, 0.0f, 3500.0f }, @@ -1523,13 +1523,13 @@ void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 bodyPartIdx; EnMb* this = (EnMb*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnMb_PostLimbDraw, thisx); if (thisx->params != ENMB_TYPE_CLUB) { if (this->attack > ENMB_ATTACK_NONE) { - EnMb_SpearUpdateAttackCollider(thisx, globalCtx); + EnMb_SpearUpdateAttackCollider(thisx, play); } for (i = 0; i < 3; i++) { Matrix_MultVec3f(&frontShieldingTriModel0[i], &frontShieldingTri0[i]); @@ -1552,7 +1552,7 @@ void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx) { scale = 4.0f; } bodyPartIdx = this->iceEffectTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3s(globalCtx, thisx, &this->bodyPartsPos[bodyPartIdx], 150, 150, 150, 250, 235, + EffectSsEnIce_SpawnFlyingVec3s(play, thisx, &this->bodyPartsPos[bodyPartIdx], 150, 150, 150, 250, 235, 245, 255, scale); } } diff --git a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.h b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.h index 5ddb628fc..ac20ceede 100644 --- a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.h +++ b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.h @@ -6,7 +6,7 @@ struct EnMb; -typedef void (*EnMbActionFunc)(struct EnMb*, GlobalContext*); +typedef void (*EnMbActionFunc)(struct EnMb*, PlayState*); typedef enum { /* 0 */ ENMB_STATE_SPEAR_SPEARPATH_DAMAGED, diff --git a/soh/src/overlays/actors/ovl_En_Md/z_en_md.c b/soh/src/overlays/actors/ovl_En_Md/z_en_md.c index 83252a27e..99dd5605c 100644 --- a/soh/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/soh/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -10,16 +10,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnMd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMd_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMd_Init(Actor* thisx, PlayState* play); +void EnMd_Destroy(Actor* thisx, PlayState* play); +void EnMd_Update(Actor* thisx, PlayState* play); +void EnMd_Draw(Actor* thisx, PlayState* play); -void func_80AAB874(EnMd* this, GlobalContext* globalCtx); -void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx); -void func_80AAB948(EnMd* this, GlobalContext* globalCtx); -void func_80AABC10(EnMd* this, GlobalContext* globalCtx); -void func_80AABD0C(EnMd* this, GlobalContext* globalCtx); +void func_80AAB874(EnMd* this, PlayState* play); +void func_80AAB8F8(EnMd* this, PlayState* play); +void func_80AAB948(EnMd* this, PlayState* play); +void func_80AABC10(EnMd* this, PlayState* play); +void func_80AABD0C(EnMd* this, PlayState* play); const ActorInit En_Md_InitVars = { ACTOR_EN_MD, @@ -348,8 +348,8 @@ void func_80AAAA24(EnMd* this) { func_80AAA93C(this); } -s16 func_80AAAC78(EnMd* this, GlobalContext* globalCtx) { - s16 dialogState = Message_GetState(&globalCtx->msgCtx); +s16 func_80AAAC78(EnMd* this, PlayState* play) { + s16 dialogState = Message_GetState(&play->msgCtx); if ((this->unk_209 == TEXT_STATE_AWAITING_NEXT) || (this->unk_209 == TEXT_STATE_EVENT) || (this->unk_209 == TEXT_STATE_CLOSING) || (this->unk_209 == TEXT_STATE_DONE_HAS_NEXT)) { @@ -362,8 +362,8 @@ s16 func_80AAAC78(EnMd* this, GlobalContext* globalCtx) { return dialogState; } -u16 EnMd_GetTextKokiriForest(GlobalContext* globalCtx, EnMd* this) { - u16 reactionText = Text_GetFaceReaction(globalCtx, 0x11); +u16 EnMd_GetTextKokiriForest(PlayState* play, EnMd* this) { + u16 reactionText = Text_GetFaceReaction(play, 0x11); if (reactionText != 0) { return reactionText; @@ -392,7 +392,7 @@ u16 EnMd_GetTextKokiriForest(GlobalContext* globalCtx, EnMd* this) { return 0x102F; } -u16 EnMd_GetTextKokiriHome(GlobalContext* globalCtx, EnMd* this) { +u16 EnMd_GetTextKokiriHome(PlayState* play, EnMd* this) { this->unk_208 = 0; this->unk_209 = TEXT_STATE_NONE; @@ -403,7 +403,7 @@ u16 EnMd_GetTextKokiriHome(GlobalContext* globalCtx, EnMd* this) { return 0x1046; } -u16 EnMd_GetTextLostWoods(GlobalContext* globalCtx, EnMd* this) { +u16 EnMd_GetTextLostWoods(PlayState* play, EnMd* this) { this->unk_208 = 0; this->unk_209 = TEXT_STATE_NONE; @@ -425,24 +425,24 @@ u16 EnMd_GetTextLostWoods(GlobalContext* globalCtx, EnMd* this) { return 0x1060; } -u16 EnMd_GetText(GlobalContext* globalCtx, Actor* thisx) { +u16 EnMd_GetText(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT04: - return EnMd_GetTextKokiriForest(globalCtx, this); + return EnMd_GetTextKokiriForest(play, this); case SCENE_KOKIRI_HOME4: - return EnMd_GetTextKokiriHome(globalCtx, this); + return EnMd_GetTextKokiriHome(play, this); case SCENE_SPOT10: - return EnMd_GetTextLostWoods(globalCtx, this); + return EnMd_GetTextLostWoods(play, this); default: return 0; } } -s16 func_80AAAF04(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AAAF04(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; - switch (func_80AAAC78(this, globalCtx)) { + switch (func_80AAAC78(this, play)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -473,7 +473,7 @@ s16 func_80AAAF04(GlobalContext* globalCtx, Actor* thisx) { } return 0; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { return 2; } default: @@ -481,8 +481,8 @@ s16 func_80AAAF04(GlobalContext* globalCtx, Actor* thisx) { } } -u8 EnMd_ShouldSpawn(EnMd* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT04) { +u8 EnMd_ShouldSpawn(EnMd* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT04) { if (gSaveContext.n64ddFlag) { // if we have beaten deku tree or have open forest turned on // or have already shown mido we have an equipped sword/shield @@ -499,7 +499,7 @@ u8 EnMd_ShouldSpawn(EnMd* this, GlobalContext* globalCtx) { } } - if (globalCtx->sceneNum == SCENE_KOKIRI_HOME4) { + if (play->sceneNum == SCENE_KOKIRI_HOME4) { if (((gSaveContext.eventChkInf[1] & 0x1000) != 0) || ((gSaveContext.eventChkInf[4] & 1) != 0)) { if (!LINK_IS_ADULT) { return 1; @@ -507,7 +507,7 @@ u8 EnMd_ShouldSpawn(EnMd* this, GlobalContext* globalCtx) { } } - if (globalCtx->sceneNum == SCENE_SPOT10) { + if (play->sceneNum == SCENE_SPOT10) { return 1; } @@ -524,8 +524,8 @@ void EnMd_UpdateEyes(EnMd* this) { } } -void func_80AAB158(EnMd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AAB158(EnMd* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 absYawDiff; s16 temp; s16 temp2; @@ -555,8 +555,8 @@ void func_80AAB158(EnMd* this, GlobalContext* globalCtx) { temp2 = 1; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { - this->unk_1E0.unk_18 = globalCtx->view.eye; + if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { + this->unk_1E0.unk_18 = play->view.eye; this->unk_1E0.unk_14 = 40.0f; temp = 2; } else { @@ -567,13 +567,13 @@ void func_80AAB158(EnMd* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E0, 2, temp); if (this->actionFunc != func_80AABC10) { if (temp2) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, EnMd_GetText, func_80AAAF04); } } } -u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) { +u8 EnMd_FollowPath(EnMd* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -583,7 +583,7 @@ u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -602,7 +602,7 @@ u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) { return 0; } -u8 EnMd_SetMovedPos(EnMd* this, GlobalContext* globalCtx) { +u8 EnMd_SetMovedPos(EnMd* this, PlayState* play) { Path* path; Vec3s* lastPointPos; @@ -610,7 +610,7 @@ u8 EnMd_SetMovedPos(EnMd* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); lastPointPos += path->count - 1; @@ -621,23 +621,23 @@ u8 EnMd_SetMovedPos(EnMd* this, GlobalContext* globalCtx) { return 1; } -void func_80AAB5A4(EnMd* this, GlobalContext* globalCtx) { +void func_80AAB5A4(EnMd* this, PlayState* play) { f32 temp; - if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) { + if (play->sceneNum != SCENE_KOKIRI_HOME4) { if (CVar_GetS32("gDisableKokiriDrawDistance", 0) != 0) { temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !(gSaveContext.eventChkInf[1] & 0x1000) && - (globalCtx->sceneNum == SCENE_SPOT04)) + (play->sceneNum == SCENE_SPOT04)) ? 100.0f : 32767.0f; } else { temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !(gSaveContext.eventChkInf[1] & 0x1000) && - (globalCtx->sceneNum == SCENE_SPOT04)) + (play->sceneNum == SCENE_SPOT04)) ? 100.0f : 400.0f; } - this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, temp); + this->alpha = func_80034DD4(&this->actor, play, this->alpha, temp); this->actor.shape.shadowAlpha = this->alpha; } else { this->alpha = 255; @@ -645,17 +645,17 @@ void func_80AAB5A4(EnMd* this, GlobalContext* globalCtx) { } } -void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Init(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMidoSkel, NULL, this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &gMidoSkel, NULL, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (!EnMd_ShouldSpawn(this, globalCtx)) { + if (!EnMd_ShouldSpawn(this, play)) { Actor_Kill(&this->actor); return; } @@ -664,33 +664,33 @@ void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->alpha = 255; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, FAIRY_KOKIRI); - if (((globalCtx->sceneNum == SCENE_SPOT04) && !(gSaveContext.eventChkInf[0] & 0x10)) || - ((globalCtx->sceneNum == SCENE_SPOT04) && (gSaveContext.eventChkInf[0] & 0x10) && + if (((play->sceneNum == SCENE_SPOT04) && !(gSaveContext.eventChkInf[0] & 0x10)) || + ((play->sceneNum == SCENE_SPOT04) && (gSaveContext.eventChkInf[0] & 0x10) && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) || - ((globalCtx->sceneNum == SCENE_SPOT10) && !(gSaveContext.eventChkInf[0] & 0x400))) { + ((play->sceneNum == SCENE_SPOT10) && !(gSaveContext.eventChkInf[0] & 0x400))) { this->actor.home.pos = this->actor.world.pos; this->actionFunc = func_80AAB948; return; } - if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) { - EnMd_SetMovedPos(this, globalCtx); + if (play->sceneNum != SCENE_KOKIRI_HOME4) { + EnMd_SetMovedPos(this, play); } this->actionFunc = func_80AAB874; } -void EnMd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Destroy(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AAB874(EnMd* this, GlobalContext* globalCtx) { +void func_80AAB874(EnMd* this, PlayState* play) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); + func_80034F54(play, this->unk_214, this->unk_236, 17); } else if ((this->unk_1E0.unk_00 == 0) && (this->unk_20B != 7)) { func_80AAA92C(this, 7); } @@ -698,17 +698,17 @@ void func_80AAB874(EnMd* this, GlobalContext* globalCtx) { func_80AAAA24(this); } -void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx) { +void func_80AAB8F8(EnMd* this, PlayState* play) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); + func_80034F54(play, this->unk_214, this->unk_236, 17); } func_80AAA93C(this); } -void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AAB948(EnMd* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp; - Actor* actorToBlock = &GET_PLAYER(globalCtx)->actor; + Actor* actorToBlock = &GET_PLAYER(play)->actor; s16 yaw; func_80AAAA24(this); @@ -731,14 +731,14 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { if (this->unk_1E0.unk_00 == 2) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !(gSaveContext.eventChkInf[1] & 0x1000) && - (globalCtx->sceneNum == SCENE_SPOT04)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + (play->sceneNum == SCENE_SPOT04)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; } - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { gSaveContext.eventChkInf[0] |= 0x10; } - if (globalCtx->sceneNum == SCENE_SPOT10) { + if (play->sceneNum == SCENE_SPOT10) { gSaveContext.eventChkInf[0] |= 0x400; } @@ -752,14 +752,14 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { } if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); + func_80034F54(play, this->unk_214, this->unk_236, 17); } - if ((this->unk_1E0.unk_00 == 0) && (globalCtx->sceneNum == SCENE_SPOT10)) { + if ((this->unk_1E0.unk_00 == 0) && (play->sceneNum == SCENE_SPOT10)) { if (player->stateFlags2 & 0x1000000) { player->stateFlags2 |= 0x2000000; player->unk_6A8 = &this->actor; - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SARIA); + func_8010BD58(play, OCARINA_ACTION_CHECK_SARIA); this->actionFunc = func_80AABC10; return; } @@ -770,36 +770,36 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { } } -void func_80AABC10(EnMd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AABC10(EnMd* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { this->actionFunc = func_80AAB948; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); this->actor.textId = 0x1067; - func_8002F2CC(&this->actor, globalCtx, this->collider.dim.radius + 30.0f); + func_8002F2CC(&this->actor, play, this->collider.dim.radius + 30.0f); this->actionFunc = func_80AAB948; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { player->stateFlags2 |= 0x800000; } } -void func_80AABD0C(EnMd* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); +void func_80AABD0C(EnMd* this, PlayState* play) { + func_80034F54(play, this->unk_214, this->unk_236, 17); func_80AAA93C(this); - if (!(EnMd_FollowPath(this, globalCtx)) || (this->waypoint != 0)) { + if (!(EnMd_FollowPath(this, play)) || (this->waypoint != 0)) { this->actor.shape.rot = this->actor.world.rot; return; } if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !(gSaveContext.eventChkInf[1] & 0x1000) && - (globalCtx->sceneNum == SCENE_SPOT04)) { - Message_CloseTextbox(globalCtx); + (play->sceneNum == SCENE_SPOT04)) { + Message_CloseTextbox(play); gSaveContext.eventChkInf[1] |= 0x1000; Actor_Kill(&this->actor); return; @@ -813,22 +813,22 @@ void func_80AABD0C(EnMd* this, GlobalContext* globalCtx) { this->actionFunc = func_80AAB8F8; } -void EnMd_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Update(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMd_UpdateEyes(this); - func_80AAB5A4(this, globalCtx); + func_80AAB5A4(this, play); Actor_MoveForward(&this->actor); - func_80AAB158(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + func_80AAB158(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); } -s32 EnMd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnMd* this = (EnMd*)thisx; Vec3s vec; @@ -854,7 +854,7 @@ s32 EnMd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnMd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnMd* this = (EnMd*)thisx; Vec3f vec = { 400.0f, 0.0f, 0.0f }; @@ -863,7 +863,7 @@ void EnMd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnMd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Draw(Actor* thisx, PlayState* play) { static void* sEyeTextures[] = { gMidoEyeOpenTex, gMidoEyeHalfTex, @@ -871,15 +871,15 @@ void EnMd_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnMd* this = (EnMd*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha == 255) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIdx])); - func_80034BA0(globalCtx, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); + func_80034BA0(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } else if (this->alpha != 0) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIdx])); - func_80034CC4(globalCtx, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); + func_80034CC4(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Md/z_en_md.h b/soh/src/overlays/actors/ovl_En_Md/z_en_md.h index 064cc61ef..415d15e50 100644 --- a/soh/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/soh/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -6,7 +6,7 @@ struct EnMd; -typedef void (*EnMdActionFunc)(struct EnMd*, GlobalContext*); +typedef void (*EnMdActionFunc)(struct EnMd*, PlayState*); typedef struct EnMd { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c index db22509e6..cbd96a305 100644 --- a/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -10,12 +10,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnMk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMk_Init(Actor* thisx, PlayState* play); +void EnMk_Destroy(Actor* thisx, PlayState* play); +void EnMk_Update(Actor* thisx, PlayState* play); +void EnMk_Draw(Actor* thisx, PlayState* play); -void EnMk_Wait(EnMk* this, GlobalContext* globalCtx); +void EnMk_Wait(EnMk* this, PlayState* play); const ActorInit En_Mk_InitVars = { ACTOR_EN_MK, @@ -50,18 +50,18 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Init(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; s32 swimFlag; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mk_Skel_005DF0, &object_mk_Anim_000D88, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_mk_Skel_005DF0, &object_mk_Anim_000D88, this->jointTable, this->morphTable, 13); Animation_PlayLoop(&this->skelAnime, &object_mk_Anim_000D88); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = 0xFF; Actor_SetScale(&this->actor, 0.01f); @@ -75,14 +75,14 @@ void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Destroy(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AACA40(EnMk* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80AACA40(EnMk* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnMk_Wait; } @@ -90,8 +90,8 @@ void func_80AACA40(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACA94(EnMk* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx) != 0) { +void func_80AACA94(EnMk* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play) != 0) { this->actor.parent = NULL; this->actionFunc = func_80AACA40; if (!gSaveContext.n64ddFlag) { @@ -101,48 +101,48 @@ void func_80AACA94(EnMk* this, GlobalContext* globalCtx) { } else { if (gSaveContext.n64ddFlag) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_TRADE_FROG, GI_EYEDROPS); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_FROG); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_FROG); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } else { s32 getItemID = GI_EYEDROPS; - func_8002F434(&this->actor, globalCtx, getItemID, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemID, 10000.0f, 50.0f); } } } -void func_80AACB14(EnMk* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80AACB14(EnMk* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80AACA94; if (gSaveContext.n64ddFlag) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_TRADE_FROG, GI_EYEDROPS); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_FROG); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_FROG); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } else { s32 getItemID = GI_EYEDROPS; - func_8002F434(&this->actor, globalCtx, getItemID, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemID, 10000.0f, 50.0f); } } } -void func_80AACB6C(EnMk* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80AACB6C(EnMk* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80AACB14; } this->flags |= 1; } -void func_80AACBAC(EnMk* this, GlobalContext* globalCtx) { +void func_80AACBAC(EnMk* this, PlayState* play) { if (this->timer > 0) { this->timer--; this->actor.shape.rot.y -= 0x800; } else { this->actionFunc = func_80AACB6C; - Message_ContinueTextbox(globalCtx, 0x4030); + Message_ContinueTextbox(play, 0x4030); } } -void func_80AACC04(EnMk* this, GlobalContext* globalCtx) { +void func_80AACC04(EnMk* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -154,7 +154,7 @@ void func_80AACC04(EnMk* this, GlobalContext* globalCtx) { } } -void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) { +void func_80AACCA0(EnMk* this, PlayState* play) { if (this->timer > 0) { this->timer--; this->actor.shape.rot.y += 0x800; @@ -167,13 +167,13 @@ void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) { } } -void func_80AACD48(EnMk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AACD48(EnMk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = func_80AACCA0; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; player->exchangeItemId = EXCH_ITEM_NONE; this->timer = gSaveContext.n64ddFlag ? 0 : 16; Animation_Change(&this->skelAnime, &object_mk_Anim_000D88, 1.0f, 0.0f, @@ -184,9 +184,9 @@ void func_80AACD48(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACE2C(EnMk* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x4001); +void func_80AACE2C(EnMk* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x4001); Animation_Change(&this->skelAnime, &object_mk_Anim_000AC0, 1.0f, 0.0f, Animation_GetLastFrame(&object_mk_Anim_000AC0), ANIMMODE_ONCE, -4.0f); this->flags &= ~2; @@ -196,9 +196,9 @@ void func_80AACE2C(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACEE8(EnMk* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x4000); +void func_80AACEE8(EnMk* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x4000); Animation_Change(&this->skelAnime, &object_mk_Anim_000AC0, 1.0f, 0.0f, Animation_GetLastFrame(&object_mk_Anim_000AC0), ANIMMODE_LOOP, -4.0f); this->flags &= ~2; @@ -208,44 +208,44 @@ void func_80AACEE8(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACFA0(EnMk* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AACFA0(EnMk* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80AACA40; gSaveContext.itemGetInf[1] |= 1; } else { // not sure when/how/if this is getting called if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_LAB_DIVE, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } } -void func_80AAD014(EnMk* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80AAD014(EnMk* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80AACFA0; if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_LAB_DIVE, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } this->flags |= 1; } -void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) { +void EnMk_Wait(EnMk* this, PlayState* play) { s16 angle; s32 swimFlag; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 playerExchangeItem; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - playerExchangeItem = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + playerExchangeItem = func_8002F368(play); if (this->actor.textId != 0x4018) { player->actor.textId = this->actor.textId; @@ -293,7 +293,7 @@ void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) { } } } else { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1A); + this->actor.textId = Text_GetFaceReaction(play, 0x1A); if (this->actor.textId == 0) { this->actor.textId = 0x4018; @@ -302,13 +302,13 @@ void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) { angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angle) < 0x2151) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_FROG); + func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_FROG); this->flags |= 1; } } } -void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Update(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; s32 pad; Vec3s vec; @@ -316,24 +316,24 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { s16 swimFlag; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if ((!(this->flags & 2)) && (SkelAnime_Update(&this->skelAnime))) { this->flags |= 2; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->flags & 1) { - func_80038290(globalCtx, &this->actor, &this->headRotation, &vec, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRotation, &vec, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRotation.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRotation.y, 0, 6, 6200, 100); } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (this->flags & 8) { if (!(player->stateFlags2 & 0x400)) { @@ -371,7 +371,7 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMk* this = (EnMk*)thisx; if (limbIndex == 11) { @@ -382,7 +382,7 @@ s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80AAD64C = { 1000.0f, -100.0f, 0.0f }; EnMk* this = (EnMk*)thisx; @@ -391,10 +391,10 @@ void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Draw(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMk_OverrideLimbDraw, EnMk_PostLimbDraw, &this->actor); } diff --git a/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.h b/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.h index 6c8ba12ca..5b8a438a0 100644 --- a/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.h +++ b/soh/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/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.c index c5ae033ba..c2b7908a9 100644 --- a/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -25,19 +25,19 @@ typedef enum { /* 1 */ RM_MOUTH_OPEN } RunningManMouthTex; -void EnMm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMm_Init(Actor* thisx, PlayState* play); +void EnMm_Destroy(Actor* thisx, PlayState* play); +void EnMm_Update(Actor* thisx, PlayState* play); +void EnMm_Draw(Actor* thisx, PlayState* play); -void func_80AAE598(EnMm* this, GlobalContext* globalCtx); -void func_80AAE294(EnMm* this, GlobalContext* globalCtx); -void func_80AAE50C(EnMm* this, GlobalContext* globalCtx); -void func_80AAE224(EnMm* this, GlobalContext* globalCtx); +void func_80AAE598(EnMm* this, PlayState* play); +void func_80AAE294(EnMm* this, PlayState* play); +void func_80AAE50C(EnMm* this, PlayState* play); +void func_80AAE224(EnMm* this, PlayState* play); s32 func_80AADA70(void); -s32 EnMm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnMm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); +s32 EnMm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnMm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); const ActorInit En_Mm_InitVars = { ACTOR_EN_MM, @@ -156,20 +156,20 @@ void EnMm_ChangeAnim(EnMm* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Init(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, sColChkInfoInit); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); Animation_Change(&this->skelAnime, sAnimationInfo[RM_ANIM_RUN].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[RM_ANIM_RUN].animation), sAnimationInfo[RM_ANIM_RUN].mode, sAnimationInfo[RM_ANIM_RUN].morphFrames); @@ -193,11 +193,11 @@ void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80AADA70(void) { @@ -210,20 +210,20 @@ s32 func_80AADA70(void) { return isDay; } -s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { +s32 func_80AADAA0(EnMm* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp1C = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CLOSING: case TEXT_STATE_DONE_FADING: break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { player->actor.textId = 0x202D; this->unk_254 &= ~1; EnMm_ChangeAnim(this, RM_ANIM_HAPPY, &this->curAnimIndex); @@ -235,9 +235,9 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { - Player_UnsetMask(globalCtx); - Item_Give(globalCtx, ITEM_SOLD_OUT); + if (Message_ShouldAdvance(play)) { + Player_UnsetMask(play); + Item_Give(play, ITEM_SOLD_OUT); gSaveContext.itemGetInf[3] |= 0x800; Rupees_ChangeBy(500); player->actor.textId = 0x202E; @@ -245,7 +245,7 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if ((player->actor.textId == 0x202E) || (player->actor.textId == 0x202C)) { this->unk_254 |= 1; EnMm_ChangeAnim(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); @@ -258,11 +258,11 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { return sp1C; } -s32 EnMm_GetTextId(EnMm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnMm_GetTextId(EnMm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 textId; - textId = Text_GetFaceReaction(globalCtx, 0x1C); + textId = Text_GetFaceReaction(play, 0x1C); if (gSaveContext.itemGetInf[3] & 0x800) { if (textId == 0) { @@ -277,19 +277,19 @@ s32 EnMm_GetTextId(EnMm* this, GlobalContext* globalCtx) { return textId; } -void func_80AADCD0(EnMm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AADCD0(EnMm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 yawDiff; s16 sp26; s16 sp24; if (this->unk_1E0 == 2) { - Message_ContinueTextbox(globalCtx, player->actor.textId); + Message_ContinueTextbox(play, player->actor.textId); this->unk_1E0 = 1; } else if (this->unk_1E0 == 1) { - this->unk_1E0 = func_80AADAA0(this, globalCtx); + this->unk_1E0 = func_80AADAA0(this, play); } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_1E0 = 1; if (this->curAnimIndex != 5) { @@ -299,12 +299,12 @@ void func_80AADCD0(EnMm* this, GlobalContext* globalCtx) { } } } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if ((sp26 >= 0) && (sp26 <= 0x140) && (sp24 >= 0) && (sp24 <= 0xF0) && (yawDiff <= 17152.0f) && - (this->unk_1E0 != 3) && func_8002F2CC(&this->actor, globalCtx, 100.0f)) { - this->actor.textId = EnMm_GetTextId(this, globalCtx); + (this->unk_1E0 != 3) && func_8002F2CC(&this->actor, play, 100.0f)) { + this->actor.textId = EnMm_GetTextId(this, play); } } } @@ -325,14 +325,14 @@ s32 func_80AADE60(Path* pathList, Vec3f* pos, s32 pathNum, s32 waypoint) { return 0; } -s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { +s32 func_80AADEF0(EnMm* this, PlayState* play) { f32 xDiff; f32 zDiff; Vec3f waypointPos; s32 phi_a2; s32 phi_v1; - func_80AADE60(globalCtx->setupPathList, &waypointPos, this->path, this->waypoint); + func_80AADE60(play->setupPathList, &waypointPos, this->path, this->waypoint); xDiff = waypointPos.x - this->actor.world.pos.x; zDiff = waypointPos.z - this->actor.world.pos.z; @@ -350,7 +350,7 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { phi_a2 = 0; break; case 1: - phi_a2 = EnMm_GetPointCount(globalCtx->setupPathList, this->path) - 1; + phi_a2 = EnMm_GetPointCount(play->setupPathList, this->path) - 1; break; case 2: phi_a2 = this->unk_1F0; @@ -364,7 +364,7 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { phi_v1 = 0; break; case 1: - phi_v1 = EnMm_GetPointCount(globalCtx->setupPathList, this->path) - 1; + phi_v1 = EnMm_GetPointCount(play->setupPathList, this->path) - 1; break; case 2: phi_v1 = this->unk_1F0; @@ -377,7 +377,7 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { this->waypoint = sPathInfo[this->unk_1E8].unk_08; } - func_80AADE60(globalCtx->setupPathList, &waypointPos, this->path, this->waypoint); + func_80AADE60(play->setupPathList, &waypointPos, this->path, this->waypoint); xDiff = waypointPos.x - this->actor.world.pos.x; zDiff = waypointPos.z - this->actor.world.pos.z; @@ -390,12 +390,12 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; Math_SmoothStepToF(&this->actor.speedXZ, this->speedXZ, 0.6f, this->distToWaypoint, 0.0f); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); return 0; } -void func_80AAE224(EnMm* this, GlobalContext* globalCtx) { +void func_80AAE224(EnMm* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = func_80AAE598; this->unk_1E8 = 0; @@ -407,11 +407,11 @@ void func_80AAE224(EnMm* this, GlobalContext* globalCtx) { } } -void func_80AAE294(EnMm* this, GlobalContext* globalCtx) { +void func_80AAE294(EnMm* this, PlayState* play) { f32 floorYNorm; Vec3f dustPos; - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { SkelAnime_Update(&this->skelAnime); if (this->curAnimIndex == 0) { @@ -436,7 +436,7 @@ void func_80AAE294(EnMm* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } - func_80AADEF0(this, globalCtx); + func_80AADEF0(this, play); if (func_80AADA70() == 0) { if (this->actor.floorPoly != NULL) { @@ -461,17 +461,17 @@ void func_80AAE294(EnMm* this, GlobalContext* globalCtx) { dustPos.z = this->actor.world.pos.z; if (gSaveContext.gameMode != 3) { - func_80033480(globalCtx, &dustPos, 50.0f, 2, 350, 20, 0); + func_80033480(play, &dustPos, 50.0f, 2, 350, 20, 0); } if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { - func_8002F71C(globalCtx, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 4.0f); + func_8002F71C(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 4.0f); } } } } -void func_80AAE50C(EnMm* this, GlobalContext* globalCtx) { +void func_80AAE50C(EnMm* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->sitTimer = 0; this->actionFunc = func_80AAE294; @@ -488,8 +488,8 @@ void func_80AAE50C(EnMm* this, GlobalContext* globalCtx) { } } -void func_80AAE598(EnMm* this, GlobalContext* globalCtx) { - func_80038290(globalCtx, &this->actor, &this->unk_248, &this->unk_24E, this->actor.focus.pos); +void func_80AAE598(EnMm* this, PlayState* play) { + func_80038290(play, &this->actor, &this->unk_248, &this->unk_24E, this->actor.focus.pos); SkelAnime_Update(&this->skelAnime); if ((func_80AADA70() != 0) && (this->unk_1E0 == 0)) { @@ -500,42 +500,42 @@ void func_80AAE598(EnMm* this, GlobalContext* globalCtx) { } } -void EnMm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Update(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; - this->actionFunc(this, globalCtx); - func_80AADCD0(this, globalCtx); + this->actionFunc(this, play); + func_80AADCD0(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Draw(Actor* thisx, PlayState* play) { static void* mouthTextures[] = { gRunningManMouthOpenTex, gRunningManMouthClosedTex }; s32 pad; EnMm* this = (EnMm*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMm_OverrideLimbDraw, EnMm_PostLimbDraw, this); if (gSaveContext.itemGetInf[3] & 0x800) { - s32 linkChildObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_LINK_CHILD); + s32 linkChildObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); if (linkChildObjBankIndex >= 0) { Mtx* mtx; Vec3s sp50; Mtx* mtx2; - mtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 2); + mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 2); Matrix_Put(&this->unk_208); - mtx2 = MATRIX_NEWMTX(globalCtx->state.gfxCtx); + mtx2 = MATRIX_NEWMTX(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[linkChildObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkChildObjBankIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x0B, mtx); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx2 - 7); @@ -554,14 +554,14 @@ void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx) { MATRIX_TOMTX(mtx); gSPDisplayList(POLY_OPA_DISP++, gLinkChildBunnyHoodDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnMm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMm* this = (EnMm*)thisx; if (this->unk_254 & 1) { @@ -582,7 +582,7 @@ s32 EnMm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnMm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f headOffset = { 200.0f, 800.0f, 0.0f }; EnMm* this = (EnMm*)thisx; diff --git a/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.h b/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.h index 5dec76bb0..7646e1f04 100644 --- a/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.h +++ b/soh/src/overlays/actors/ovl_En_Mm/z_en_mm.h @@ -6,7 +6,7 @@ struct EnMm; -typedef void (*EnMmActionFunc)(struct EnMm*, GlobalContext*); +typedef void (*EnMmActionFunc)(struct EnMm*, PlayState*); typedef struct EnMm { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 8b57a3740..3eaa81e22 100644 --- a/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -25,15 +25,15 @@ typedef enum { /* 1 */ RM2_MOUTH_OPEN } RunningManMouthTex; -void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMm2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMm2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMm2_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx); -void func_80AAF57C(EnMm2* this, GlobalContext* globalCtx); -void func_80AAF668(EnMm2* this, GlobalContext* globalCtx); -s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnMm2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +void EnMm2_Init(Actor* thisx, PlayState* play); +void EnMm2_Destroy(Actor* thisx, PlayState* play); +void EnMm2_Update(Actor* thisx, PlayState* play); +void EnMm2_Draw(Actor* thisx, PlayState* play); +void func_80AAF3C0(EnMm2* this, PlayState* play); +void func_80AAF57C(EnMm2* this, PlayState* play); +void func_80AAF668(EnMm2* this, PlayState* play); +s32 EnMm2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnMm2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Mm2_InitVars = { ACTOR_EN_MM2, @@ -100,7 +100,7 @@ void EnMm2_ChangeAnim(EnMm2* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAEF70(EnMm2* this, PlayState* play) { if ((gSaveContext.eventChkInf[9] & 0xF) != 0xF) { this->actor.textId = 0x6086; } else if (gSaveContext.infTable[23] & 0x8000) { @@ -122,19 +122,19 @@ void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) { } } -void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnMm2_Init(Actor* thisx, PlayState* play2) { EnMm2* this = (EnMm2*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); Animation_Change(&this->skelAnime, sAnimationInfo[RM2_ANIM_SIT_WAIT].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[RM2_ANIM_SIT_WAIT].animation), sAnimationInfo[RM2_ANIM_SIT_WAIT].mode, sAnimationInfo[RM2_ANIM_SIT_WAIT].morphFrames); this->previousAnimation = RM2_ANIM_SIT_WAIT; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->mouthTexIndex = RM2_MOUTH_CLOSED; this->actor.targetMode = 6; @@ -143,7 +143,7 @@ void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx2) { if (this->actor.params == 1) { this->actionFunc = func_80AAF668; } else { - func_80AAEF70(this, globalCtx); + func_80AAEF70(this, play); this->actionFunc = func_80AAF57C; } if (!LINK_IS_ADULT) { @@ -157,27 +157,27 @@ void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnMm2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Destroy(Actor* thisx, PlayState* play) { EnMm2* this = (EnMm2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80AAF224(EnMm2* this, GlobalContext* globalCtx, EnMm2ActionFunc actionFunc) { +s32 func_80AAF224(EnMm2* this, PlayState* play, EnMm2ActionFunc actionFunc) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; return 1; } yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } -void func_80AAF2BC(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF2BC(EnMm2* this, PlayState* play) { if (this->unk_1F6 > 60) { Actor_Kill(&this->actor); } @@ -186,34 +186,34 @@ void func_80AAF2BC(EnMm2* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 10.0f, 0.6f, 2.0f, 0.0f); } -void func_80AAF330(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF330(EnMm2* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = func_80AAF2BC; EnMm2_ChangeAnim(this, RM2_ANIM_RUN, &this->previousAnimation); this->mouthTexIndex = RM2_MOUTH_OPEN; if (!(this->unk_1F4 & 2)) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } gSaveContext.timer2State = 0; gSaveContext.eventInf[1] &= ~1; } } -void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF3C0(EnMm2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); switch (this->actor.textId) { case 0x607D: case 0x607E: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_ContinueTextbox(globalCtx, 0x607F); + Message_ContinueTextbox(play, 0x607F); this->actor.textId = 0x607F; gSaveContext.eventInf[1] |= 1; break; case 1: - Message_ContinueTextbox(globalCtx, 0x6080); + Message_ContinueTextbox(play, 0x6080); this->actor.textId = 0x6080; break; }; @@ -224,16 +224,16 @@ void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx) { } return; case 0x6081: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_1F4 |= 4; HIGH_SCORE(HS_MARATHON) -= 1; - Message_ContinueTextbox(globalCtx, 0x607E); + Message_ContinueTextbox(play, 0x607E); this->actor.textId = 0x607E; } return; } - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x607F) { func_80088AA0(0); this->actionFunc = func_80AAF57C; @@ -241,28 +241,28 @@ void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx) { this->actionFunc = func_80AAF57C; } this->actionFunc = func_80AAF57C; - func_80AAEF70(this, globalCtx); + func_80AAEF70(this, play); } } -void func_80AAF57C(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF57C(EnMm2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - func_80AAEF70(this, globalCtx); - if ((func_80AAF224(this, globalCtx, func_80AAF3C0)) && (this->actor.textId == 0x607D)) { + func_80AAEF70(this, play); + if ((func_80AAF224(this, play, func_80AAF3C0)) && (this->actor.textId == 0x607D)) { gSaveContext.infTable[23] |= 0x8000; } } -void func_80AAF5EC(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF5EC(EnMm2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_1F4 &= ~1; EnMm2_ChangeAnim(this, RM2_ANIM_STAND, &this->previousAnimation); this->actionFunc = func_80AAF330; } } -void func_80AAF668(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF668(EnMm2* this, PlayState* play) { this->actor.world.rot.y = -0x3E80; this->actor.shape.rot.y = this->actor.world.rot.y; SkelAnime_Update(&this->skelAnime); @@ -271,7 +271,7 @@ void func_80AAF668(EnMm2* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x6084; } - if (func_80AAF224(this, globalCtx, func_80AAF5EC)) { + if (func_80AAF224(this, play, func_80AAF5EC)) { this->unk_1F6 = 0; if (((void)0, gSaveContext.timer2Value) < HIGH_SCORE(HS_MARATHON)) { HIGH_SCORE(HS_MARATHON) = gSaveContext.timer2Value; @@ -287,38 +287,38 @@ void func_80AAF668(EnMm2* this, GlobalContext* globalCtx) { } } -void EnMm2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Update(Actor* thisx, PlayState* play) { EnMm2* this = (EnMm2*)thisx; s32 pad; if (this->unk_1F4 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_1E8, &this->unk_1EE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_1E8, &this->unk_1EE, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_1E8.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_1E8.y, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_1EE.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_1EE.y, 0, 6, 6200, 100); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } -void EnMm2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Draw(Actor* thisx, PlayState* play) { static void* mouthTextures[] = { gRunningManMouthOpenTex, gRunningManMouthClosedTex }; EnMm2* this = (EnMm2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMm2_OverrideLimbDraw, EnMm2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMm2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMm2* this = (EnMm2*)thisx; switch (limbIndex) { @@ -335,7 +335,7 @@ s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnMm2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMm2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f headOffset = { 200.0f, 800.0f, 0.0f }; EnMm2* this = (EnMm2*)thisx; diff --git a/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h b/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h index 9fb3df3e8..a5edeb9cb 100644 --- a/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h +++ b/soh/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h @@ -6,7 +6,7 @@ struct EnMm2; -typedef void (*EnMm2ActionFunc)(struct EnMm2*, GlobalContext*); +typedef void (*EnMm2ActionFunc)(struct EnMm2*, PlayState*); typedef struct EnMm2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 9f67a21fc..67f418340 100644 --- a/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -9,16 +9,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnMs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMs_Init(Actor* thisx, PlayState* play); +void EnMs_Destroy(Actor* thisx, PlayState* play); +void EnMs_Update(Actor* thisx, PlayState* play); +void EnMs_Draw(Actor* thisx, PlayState* play); -void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx); -void EnMs_Wait(EnMs* this, GlobalContext* globalCtx); -void EnMs_Talk(EnMs* this, GlobalContext* globalCtx); -void EnMs_Sell(EnMs* this, GlobalContext* globalCtx); -void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx); +void EnMs_SetOfferText(EnMs* this, PlayState* play); +void EnMs_Wait(EnMs* this, PlayState* play); +void EnMs_Talk(EnMs* this, PlayState* play); +void EnMs_Sell(EnMs* this, PlayState* play); +void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play); const ActorInit En_Ms_InitVars = { ACTOR_EN_MS, @@ -58,8 +58,8 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1B); +void EnMs_SetOfferText(EnMs* this, PlayState* play) { + this->actor.textId = Text_GetFaceReaction(play, 0x1B); if (this->actor.textId == 0) { if (BEANS_BOUGHT >= 10) { this->actor.textId = 0x406B; @@ -69,7 +69,7 @@ void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) { } } -void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Init(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; s32 pad; @@ -78,10 +78,10 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { return; } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable, this->morphTable, 9); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Actor_SetScale(&this->actor, 0.015f); @@ -90,90 +90,90 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; - EnMs_SetOfferText(this, globalCtx); + EnMs_SetOfferText(this, play); this->actionFunc = EnMs_Wait; } -void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Destroy(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { +void EnMs_Wait(EnMs* this, PlayState* play) { s16 yawDiff; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - EnMs_SetOfferText(this, globalCtx); + EnMs_SetOfferText(this, play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { // if talk is initiated + if (Actor_ProcessTalkRequest(&this->actor, play)) { // if talk is initiated this->actionFunc = EnMs_Talk; } else if ((this->actor.xzDistToPlayer < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range - func_8002F2CC(&this->actor, globalCtx, 90.0f); + func_8002F2CC(&this->actor, play, 90.0f); } } -void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { +void EnMs_Talk(EnMs* this, PlayState* play) { u8 dialogState; - dialogState = Message_GetState(&globalCtx->msgCtx); + dialogState = Message_GetState(&play->msgCtx); if (dialogState != TEXT_STATE_CHOICE) { - if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { // advanced final textbox + if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // advanced final textbox this->actionFunc = EnMs_Wait; } - } else if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + } else if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes if (gSaveContext.rupees < ((gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? 60 : sPrices[BEANS_BOUGHT])) { - Message_ContinueTextbox(globalCtx, 0x4069); // not enough rupees text + Message_ContinueTextbox(play, 0x4069); // not enough rupees text return; } if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) { - GiveItemEntryFromActor(&this->actor, globalCtx, + GiveItemEntryFromActor(&this->actor, play, Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN), 90.0f, 10.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); } this->actionFunc = EnMs_Sell; return; case 1: // no - Message_ContinueTextbox(globalCtx, 0x4068); + Message_ContinueTextbox(play, 0x4068); default: return; } } } -void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnMs_Sell(EnMs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { Rupees_ChangeBy((gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? -60 : -sPrices[BEANS_BOUGHT]); this->actor.parent = NULL; this->actionFunc = (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? EnMs_Wait : EnMs_TalkAfterPurchase; } else { if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) { - GiveItemEntryFromActor(&this->actor, globalCtx, + GiveItemEntryFromActor(&this->actor, play, Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN), 90.0f, 10.0f); BEANS_BOUGHT = 10; } else { - func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); } } } -void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx) { +void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { // if dialog state is 6 and player responded to textbox - if ((Message_GetState(&globalCtx->msgCtx)) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x406C); + if ((Message_GetState(&play->msgCtx)) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x406C); this->actionFunc = EnMs_Talk; } } -void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Update(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; s32 pad; @@ -182,21 +182,21 @@ void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetArrowOffset = 500.0f; Actor_SetScale(&this->actor, 0.015f); SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (gSaveContext.entranceIndex == 0x157 && gSaveContext.sceneSetupIndex == 8) { // ride carpet if in credits Actor_MoveForward(&this->actor); osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 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); } -void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Draw(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.h b/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.h index a3d3dc7d5..53c6bbeac 100644 --- a/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.h +++ b/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.h @@ -6,7 +6,7 @@ struct EnMs; -typedef void (*EnMsActionFunc)(struct EnMs*, GlobalContext*); +typedef void (*EnMsActionFunc)(struct EnMs*, PlayState*); typedef struct EnMs { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.c index c72369e9f..ac76e9242 100644 --- a/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnMu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMu_Init(Actor* thisx, PlayState* play); +void EnMu_Destroy(Actor* thisx, PlayState* play); +void EnMu_Update(Actor* thisx, PlayState* play); +void EnMu_Draw(Actor* thisx, PlayState* play); -void EnMu_Pose(EnMu* this, GlobalContext* globalCtx); -s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx); +void EnMu_Pose(EnMu* this, PlayState* play); +s16 EnMu_CheckDialogState(PlayState* play, Actor* thisx); static ColliderCylinderInit D_80AB0BD0 = { { @@ -56,7 +56,7 @@ void EnMu_SetupAction(EnMu* this, EnMuActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) { +void EnMu_Interact(EnMu* this, PlayState* play) { u8 textIdOffset[] = { 0x42, 0x43, 0x3F, 0x41, 0x3E }; u8 bitmask[] = { 0x01, 0x02, 0x04, 0x08, 0x10 }; u8 textFlags; @@ -65,7 +65,7 @@ void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) { textFlags = gSaveContext.eventInf[2] & 0x1F; gSaveContext.eventInf[2] &= ~0x1F; - randomIndex = (globalCtx->state.frames + (s32)(Rand_ZeroOne() * 5.0f)) % 5; + randomIndex = (play->state.frames + (s32)(Rand_ZeroOne() * 5.0f)) % 5; for (i = 0; i < 5; i++) { @@ -95,9 +95,9 @@ void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) { gSaveContext.eventInf[2] |= textFlags; } -u16 EnMu_GetFaceReaction(GlobalContext* globalCtx, Actor* thisx) { +u16 EnMu_GetFaceReaction(PlayState* play, Actor* thisx) { EnMu* this = (EnMu*)thisx; - u16 faceReaction = Text_GetFaceReaction(globalCtx, this->actor.params + 0x3A); + u16 faceReaction = Text_GetFaceReaction(play, this->actor.params + 0x3A); if (faceReaction != 0) { return faceReaction; @@ -105,10 +105,10 @@ u16 EnMu_GetFaceReaction(GlobalContext* globalCtx, Actor* thisx) { return this->defFaceReaction; } -s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx) { +s16 EnMu_CheckDialogState(PlayState* play, Actor* thisx) { EnMu* this = (EnMu*)thisx; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -120,39 +120,39 @@ s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx) { case TEXT_STATE_9: return 1; case TEXT_STATE_CLOSING: - EnMu_Interact(this, globalCtx); + EnMu_Interact(this, play); return 0; default: return 1; } } -void EnMu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Init(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 160.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mu_Skel_004F70, &object_mu_Anim_0003F4, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80AB0BD0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_mu_Skel_004F70, &object_mu_Anim_0003F4, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AB0BD0); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AB0BFC); this->actor.targetMode = 6; Actor_SetScale(&this->actor, 0.01f); - EnMu_Interact(this, globalCtx); + EnMu_Interact(this, play); EnMu_SetupAction(this, EnMu_Pose); } -void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Destroy(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } -void EnMu_Pose(EnMu* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_20A, this->unk_22A, 16); +void EnMu_Pose(EnMu* this, PlayState* play) { + func_80034F54(play, this->unk_20A, this->unk_22A, 16); } -void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Update(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; s32 pad; f32 talkDist; @@ -164,19 +164,19 @@ void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); talkDist = this->collider.dim.radius + 30.0f; - func_800343CC(globalCtx, &this->actor, &this->npcInfo.unk_00, talkDist, EnMu_GetFaceReaction, + func_800343CC(play, &this->actor, &this->npcInfo.unk_00, talkDist, EnMu_GetFaceReaction, EnMu_CheckDialogState); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 60.0f; } -s32 EnMu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMu* this = (EnMu*)thisx; if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) || @@ -187,7 +187,7 @@ s32 EnMu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } Gfx* EnMu_DisplayListSetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { @@ -199,7 +199,7 @@ Gfx* EnMu_DisplayListSetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return dlist; } -void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Draw(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; Color_RGBA8 colors[2][5] = { { { 100, 130, 235, 0 }, { 160, 250, 60, 0 }, { 90, 60, 20, 0 }, { 30, 240, 200, 0 }, { 140, 70, 20, 0 } }, @@ -208,15 +208,15 @@ void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx) { u8 segmentId[] = { 0x08, 0x09, 0x0A, 0x0B, 0x0C }; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(-1200.0f, 0.0f, -1400.0f, MTXMODE_APPLY); for (i = 0; i < 5; i++) { gSPSegment(POLY_OPA_DISP++, segmentId[i], - EnMu_DisplayListSetColor(globalCtx->state.gfxCtx, colors[this->actor.params][i].r, + EnMu_DisplayListSetColor(play->state.gfxCtx, colors[this->actor.params][i].r, colors[this->actor.params][i].g, colors[this->actor.params][i].b, colors[this->actor.params][i].a)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMu_OverrideLimbDraw, EnMu_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.h b/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.h index 089045ebf..1f2bf0f32 100644 --- a/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.h +++ b/soh/src/overlays/actors/ovl_En_Mu/z_en_mu.h @@ -6,7 +6,7 @@ struct EnMu; -typedef void (*EnMuActionFunc)(struct EnMu*, struct GlobalContext*); +typedef void (*EnMuActionFunc)(struct EnMu*, struct PlayState*); typedef struct EnMu { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 068fcfaf4..0ca410779 100644 --- a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -53,10 +53,10 @@ typedef enum { /* 0x04 */ NB_DRAW_LOOK_DIRECTION } EnNbDrawMode; -void EnNb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNb_Init(Actor* thisx, PlayState* play); +void EnNb_Destroy(Actor* thisx, PlayState* play); +void EnNb_Update(Actor* thisx, PlayState* play); +void EnNb_Draw(Actor* thisx, PlayState* play); static ColliderCylinderInitType1 sCylinderInit = { { @@ -99,13 +99,13 @@ s32 EnNb_GetType(EnNb* this) { return type & 0xFF; } -void EnNb_UpdatePath(EnNb* this, GlobalContext* globalCtx) { +void EnNb_UpdatePath(EnNb* this, PlayState* play) { Vec3s* pointPos; Path* pathList; s32 pad; s32 path; - pathList = globalCtx->setupPathList; + pathList = play->setupPathList; if (pathList != NULL) { path = EnNb_GetPath(this); @@ -127,38 +127,38 @@ void EnNb_UpdatePath(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_SetupCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_SetupCollider(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, thisx, &sCylinderInit); } -void EnNb_UpdateCollider(EnNb* this, GlobalContext* globalCtx) { +void EnNb_UpdateCollider(EnNb* this, PlayState* play) { s32 pad[4]; ColliderCylinder* collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); } -void EnNb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Destroy(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; D_80AB4318 = 0; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AB0FBC(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB0FBC(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_300.unk_18 = player->actor.world.pos; this->unk_300.unk_14 = kREG(16) + 9.0f; func_80034A14(&this->actor, &this->unk_300, kREG(17) + 0xC, 2); } -void func_80AB1040(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB1040(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_300.unk_18 = player->actor.world.pos; this->unk_300.unk_14 = kREG(16) + 9.0f; @@ -202,10 +202,10 @@ void func_80AB11EC(EnNb* this) { this->alphaTimer = 0.0f; } -void func_80AB1210(EnNb* this, GlobalContext* globalCtx) { +void func_80AB1210(EnNb* this, PlayState* play) { s32 one; // required to match - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_80AB4318) { if (this->actor.params == NB_TYPE_DEMO02) { func_80AB11EC(this); @@ -221,23 +221,23 @@ void func_80AB1210(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB1284(EnNb* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 4); +void func_80AB1284(EnNb* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 4); } s32 EnNb_UpdateSkelAnime(EnNb* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnNb_GetNpcCsAction(GlobalContext* globalCtx, s32 npcActionIdx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[npcActionIdx]; +CsCmdActorAction* EnNb_GetNpcCsAction(PlayState* play, s32 npcActionIdx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[npcActionIdx]; } return NULL; } -void EnNb_SetupCsPosRot(EnNb* this, GlobalContext* globalCtx, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, npcActionIdx); +void EnNb_SetupCsPosRot(EnNb* this, PlayState* play, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); s16 newRotY; Actor* thisx = &this->actor; @@ -249,30 +249,30 @@ void EnNb_SetupCsPosRot(EnNb* this, GlobalContext* globalCtx, s32 npcActionIdx) } } -s32 func_80AB1390(EnNb* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { +s32 func_80AB1390(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { CsCmdActorAction* csCmdNPCAction; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && - (csCmdNPCAction = globalCtx->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && + if ((play->csCtx.state != CS_STATE_IDLE) && + (csCmdNPCAction = play->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && (csCmdNPCAction->action == arg2)) { return true; } return false; } -s32 func_80AB13D8(EnNb* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { +s32 func_80AB13D8(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { CsCmdActorAction* csCmdNPCAction; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && - (csCmdNPCAction = globalCtx->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && + if ((play->csCtx.state != CS_STATE_IDLE) && + (csCmdNPCAction = play->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && (csCmdNPCAction->action != arg2)) { return true; } return false; } -void EnNb_SetInitialCsPosRot(EnNb* this, GlobalContext* globalCtx, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, npcActionIdx); +void EnNb_SetInitialCsPosRot(EnNb* this, PlayState* play, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); Actor* thisx = &this->actor; if (csCmdNPCAction != NULL) { @@ -302,51 +302,51 @@ void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 tr Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, mode, transitionRate); } -void EnNb_SetChamberAnim(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetChamberAnim(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsChamberOfSagesAnim, 0, 0, 0); this->actor.shape.yOffset = -10000.0f; } -void EnNb_SpawnBlueWarp(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SpawnBlueWarp(EnNb* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void EnNb_GiveMedallion(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnNb_GiveMedallion(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 50.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0xC); - Item_Give(globalCtx, ITEM_MEDALLION_SPIRIT); + Item_Give(play, ITEM_MEDALLION_SPIRIT); } -void EnNb_ComeUpImpl(EnNb* this, GlobalContext* globalCtx) { +void EnNb_ComeUpImpl(EnNb* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } -void EnNb_SetupChamberCsImpl(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupChamberCsImpl(EnNb* this, PlayState* play) { s32 pad[2]; Player* player; if ((gSaveContext.chamberCutsceneNum == 3) && (gSaveContext.sceneSetupIndex < 4)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->action = NB_CHAMBER_UNDERGROUND; - globalCtx->csCtx.segment = &D_80AB431C; + play->csCtx.segment = &D_80AB431C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_SPIRIT); + Item_Give(play, ITEM_MEDALLION_SPIRIT); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void EnNb_SetupChamberWarpImpl(EnNb* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void EnNb_SetupChamberWarpImpl(EnNb* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* csCmdNPCAction; if (csCtx->state != CS_STATE_IDLE) { @@ -354,7 +354,7 @@ void EnNb_SetupChamberWarpImpl(EnNb* this, GlobalContext* globalCtx) { if (csCmdNPCAction != NULL && csCmdNPCAction->action == 2) { this->action = NB_CHAMBER_APPEAR; this->drawMode = NB_DRAW_DEFAULT; - EnNb_SpawnBlueWarp(this, globalCtx); + EnNb_SpawnBlueWarp(this, play); } } } @@ -366,12 +366,12 @@ void EnNb_SetupDefaultChamberIdle(EnNb* this) { } } -void EnNb_SetupArmRaise(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupArmRaise(EnNb* this, PlayState* play) { AnimationHeader* animation = &gNabooruRaisingArmsGivingMedallionAnim; CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[1]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[1]; if (csCmdNPCAction != NULL && csCmdNPCAction->action == 3) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); @@ -390,64 +390,64 @@ void EnNb_SetupRaisedArmTransition(EnNb* this, s32 animFinished) { } } -void EnNb_SetupMedallion(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupMedallion(EnNb* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[6]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[6]; if (csCmdNPCAction != NULL && csCmdNPCAction->action == 2) { this->action = NB_GIVE_MEDALLION; - EnNb_GiveMedallion(this, globalCtx); + EnNb_GiveMedallion(this, play); } } } // Action func is never explicitly set to this, but it runs when the memory gets zero cleared -void EnNb_SetupChamberCs(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupChamberCsImpl(this, globalCtx); +void EnNb_SetupChamberCs(EnNb* this, PlayState* play) { + EnNb_SetupChamberCsImpl(this, play); } -void EnNb_SetupChamberWarp(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupChamberWarpImpl(this, globalCtx); +void EnNb_SetupChamberWarp(EnNb* this, PlayState* play) { + EnNb_SetupChamberWarpImpl(this, play); } -void EnNb_ComeUp(EnNb* this, GlobalContext* globalCtx) { - EnNb_ComeUpImpl(this, globalCtx); +void EnNb_ComeUp(EnNb* this, PlayState* play) { + EnNb_ComeUpImpl(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupDefaultChamberIdle(this); } -void func_80AB193C(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB193C(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetupArmRaise(this, globalCtx); + EnNb_SetupArmRaise(this, play); } -void EnNb_RaiseArm(EnNb* this, GlobalContext* globalCtx) { +void EnNb_RaiseArm(EnNb* this, PlayState* play) { s32 animFinished; - func_80AB1284(this, globalCtx); + func_80AB1284(this, play); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupRaisedArmTransition(this, animFinished); } -void func_80AB19BC(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB19BC(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetupMedallion(this, globalCtx); + EnNb_SetupMedallion(this, play); } -void func_80AB19FC(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB19FC(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); } -void EnNb_SetupLightArrowOrSealingCs(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupLightArrowOrSealingCs(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruPuttingHandsTogetherCastingMagicAnim, 2, 0.0f, 0); this->action = NB_ACTION_7; this->actor.shape.shadowAlpha = 0; @@ -457,13 +457,13 @@ void EnNb_PlaySealingSound(void) { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void EnNb_InitializeDemo6K(EnNb* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void EnNb_InitializeDemo6K(EnNb* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(21) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 7); } -void EnNb_SetupHide(EnNb* this, GlobalContext* globalCtx) { - if (func_80AB1390(this, globalCtx, 4, 1)) { +void EnNb_SetupHide(EnNb* this, PlayState* play) { + if (func_80AB1390(this, play, 4, 1)) { this->action = NB_SEAL_HIDE; this->drawMode = NB_DRAW_HIDE; this->alpha = 0; @@ -473,11 +473,11 @@ void EnNb_SetupHide(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckToFade(EnNb* this, GlobalContext* globalCtx) { +void EnNb_CheckToFade(EnNb* this, PlayState* play) { f32* alphaTimer = &this->alphaTimer; s32 alpha; - if (func_80AB1390(this, globalCtx, 4, 1)) { + if (func_80AB1390(this, play, 4, 1)) { *alphaTimer += 1.0f; if (*alphaTimer >= kREG(5) + 10.0f) { this->action = NB_ACTION_9; @@ -504,15 +504,15 @@ void EnNb_CheckToFade(EnNb* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = alpha; } -void EnNb_SetupLightOrb(EnNb* this, GlobalContext* globalCtx) { - if (func_80AB13D8(this, globalCtx, 4, 1)) { +void EnNb_SetupLightOrb(EnNb* this, PlayState* play) { + if (func_80AB13D8(this, play, 4, 1)) { this->action = NB_SEAL_HIDE; this->drawMode = NB_DRAW_HIDE; this->alphaTimer = kREG(5) + 10.0f; this->alpha = 255; if (this->flag == 0) { - EnNb_InitializeDemo6K(this, globalCtx); + EnNb_InitializeDemo6K(this, play); this->flag = 1; } @@ -520,67 +520,67 @@ void EnNb_SetupLightOrb(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_Hide(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupHide(this, globalCtx); - func_80AB1210(this, globalCtx); +void EnNb_Hide(EnNb* this, PlayState* play) { + EnNb_SetupHide(this, play); + func_80AB1210(this, play); } -void EnNb_Fade(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void EnNb_Fade(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_CheckToFade(this, globalCtx); - func_80AB1210(this, globalCtx); + EnNb_CheckToFade(this, play); + func_80AB1210(this, play); } -void EnNb_CreateLightOrb(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetupLightOrb(this, globalCtx); - func_80AB1210(this, globalCtx); + EnNb_SetupLightOrb(this, play); + func_80AB1210(this, play); } -void EnNb_DrawTransparency(EnNb* this, GlobalContext* globalCtx) { +void EnNb_DrawTransparency(EnNb* this, PlayState* play) { s32 pad[2]; s16 eyeSegIdx = this->eyeIdx; void* eyeTex = sEyeTextures[eyeSegIdx]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnNb_InitKidnap(EnNb* this, GlobalContext* globalCtx) { +void EnNb_InitKidnap(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruTrappedInVortexPushingGroundAnim, 0, 0.0f, 0); this->action = NB_KIDNAPPED; this->actor.shape.shadowAlpha = 0; gSaveContext.eventChkInf[9] |= 0x20; } -void EnNb_PlayCrySFX(EnNb* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 3) { +void EnNb_PlayCrySFX(EnNb* this, PlayState* play) { + if (play->csCtx.frames == 3) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_CRY_0); } } -void EnNb_PlayAgonySFX(EnNb* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 420) { +void EnNb_PlayAgonySFX(EnNb* this, PlayState* play) { + if (play->csCtx.frames == 420) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_AGONY); } } -void EnNb_SetPosInPortal(EnNb* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); +void EnNb_SetPosInPortal(EnNb* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); Vec3f* pos = &this->actor.world.pos; f32 f0; s32 pad; @@ -589,7 +589,7 @@ void EnNb_SetPosInPortal(EnNb* this, GlobalContext* globalCtx) { if (csCmdNPCAction != NULL) { f0 = Environment_LerpWeightAccelDecel(csCmdNPCAction->endFrame, csCmdNPCAction->startFrame, - globalCtx->csCtx.frames, 4, 4); + play->csCtx.frames, 4, 4); startPos.x = csCmdNPCAction->startPos.x; startPos.y = csCmdNPCAction->startPos.y; startPos.z = csCmdNPCAction->startPos.z; @@ -602,8 +602,8 @@ void EnNb_SetPosInPortal(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_SetupCaptureCutsceneState(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupCsPosRot(this, globalCtx, 1); +void EnNb_SetupCaptureCutsceneState(EnNb* this, PlayState* play) { + EnNb_SetupCsPosRot(this, play, 1); this->action = NB_KIDNAPPED; this->drawMode = NB_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -634,8 +634,8 @@ void EnNb_SetupKidnap(EnNb* this) { this->drawMode = NB_DRAW_DEFAULT; } -void EnNb_CheckKidnapCsMode(EnNb* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); +void EnNb_CheckKidnapCsMode(EnNb* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); s32 action; s32 previousCsAction; @@ -645,7 +645,7 @@ void EnNb_CheckKidnapCsMode(EnNb* this, GlobalContext* globalCtx) { if (action != previousCsAction) { switch (action) { case 1: - EnNb_SetupCaptureCutsceneState(this, globalCtx); + EnNb_SetupCaptureCutsceneState(this, play); break; case 7: EnNb_SetupLookAroundInKidnap(this); @@ -666,30 +666,30 @@ void EnNb_CheckKidnapCsMode(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB23A8(EnNb* this, GlobalContext* globalCtx) { - EnNb_PlayCrySFX(this, globalCtx); - EnNb_CheckKidnapCsMode(this, globalCtx); +void func_80AB23A8(EnNb* this, PlayState* play) { + EnNb_PlayCrySFX(this, play); + EnNb_CheckKidnapCsMode(this, play); } -void EnNb_MovingInPortal(EnNb* this, GlobalContext* globalCtx) { - EnNb_PlayCrySFX(this, globalCtx); - EnNb_PlayAgonySFX(this, globalCtx); +void EnNb_MovingInPortal(EnNb* this, PlayState* play) { + EnNb_PlayCrySFX(this, play); + EnNb_PlayAgonySFX(this, play); EnNb_UpdateEyes(this); EnNb_UpdateSkelAnime(this); - EnNb_CheckKidnapCsMode(this, globalCtx); + EnNb_CheckKidnapCsMode(this, play); } -void EnNb_SuckedInByPortal(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SuckedInByPortal(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_SetRaisedArmCaptureAnim(this, animFinished); - EnNb_SetPosInPortal(this, globalCtx); - EnNb_CheckKidnapCsMode(this, globalCtx); + EnNb_SetPosInPortal(this, play); + EnNb_CheckKidnapCsMode(this, play); } -void EnNb_SetupConfrontation(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupConfrontation(EnNb* this, PlayState* play) { AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; EnNb_SetCurrentAnim(this, animation, 0, 0.0f, 0); @@ -697,10 +697,10 @@ void EnNb_SetupConfrontation(EnNb* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 0; } -void EnNb_PlayKnuckleDefeatSFX(EnNb* this, GlobalContext* globalCtx) { +void EnNb_PlayKnuckleDefeatSFX(EnNb* this, PlayState* play) { s32 pad[2]; - if (globalCtx->csCtx.frames == 548) { + if (play->csCtx.frames == 548) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_CRY_0); func_80078914(&this->actor.projectedPos, NA_SE_EN_FANTOM_HIT_THUNDER); } @@ -731,14 +731,14 @@ void EnNb_PlayLookLeftSFX(EnNb* this) { } } -void EnNb_InitDemo6KInConfrontation(EnNb* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void EnNb_InitDemo6KInConfrontation(EnNb* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(21) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xB); } -void func_80AB2688(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2688(EnNb* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80AB26C8(EnNb* this) { @@ -747,12 +747,12 @@ void func_80AB26C8(EnNb* this) { this->actor.shape.shadowAlpha = 0; } -void func_80AB26DC(EnNb* this, GlobalContext* globalCtx) { +void func_80AB26DC(EnNb* this, PlayState* play) { s32 pad; AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; f32 lastFrame = Animation_GetLastFrame(animation); - EnNb_SetupCsPosRot(this, globalCtx, 1); + EnNb_SetupCsPosRot(this, play, 1); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); this->action = NB_ACTION_14; this->drawMode = NB_DRAW_KNEEL; @@ -818,9 +818,9 @@ void EnNb_CheckIfLookLeft(EnNb* this, s32 animFinished) { } } -void EnNb_SetupDemo6KInConfrontation(EnNb* this, GlobalContext* globalCtx, s32 animFinished) { +void EnNb_SetupDemo6KInConfrontation(EnNb* this, PlayState* play, s32 animFinished) { if (!this->flag && animFinished) { - EnNb_InitDemo6KInConfrontation(this, globalCtx); + EnNb_InitDemo6KInConfrontation(this, play); this->flag = 1; } } @@ -841,12 +841,12 @@ void EnNb_SetupConfrontationDestroy(EnNb* this) { this->actor.shape.shadowAlpha = 0; } -void EnNb_CheckConfrontationCsMode(EnNb* this, GlobalContext* globalCtx) { +void EnNb_CheckConfrontationCsMode(EnNb* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; s32 csAction; s32 previousCsAction; - csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); + csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); if (csCmdNPCAction != NULL) { csAction = csCmdNPCAction->action; previousCsAction = this->previousCsAction; @@ -857,7 +857,7 @@ void EnNb_CheckConfrontationCsMode(EnNb* this, GlobalContext* globalCtx) { func_80AB26C8(this); break; case 10: - func_80AB26DC(this, globalCtx); + func_80AB26DC(this, play); break; case 11: EnNb_SetupKneel(this); @@ -884,66 +884,66 @@ void EnNb_CheckConfrontationCsMode(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckConfrontationCsModeWrapper(EnNb* this, GlobalContext* globalCtx) { - EnNb_CheckConfrontationCsMode(this, globalCtx); +void EnNb_CheckConfrontationCsModeWrapper(EnNb* this, PlayState* play) { + EnNb_CheckConfrontationCsMode(this, play); } -void func_80AB2C18(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2C18(EnNb* this, PlayState* play) { EnNb_UpdateEyes(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_Kneel(EnNb* this, GlobalContext* globalCtx) { +void EnNb_Kneel(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_CheckIfKneeling(this, animFinished); EnNb_PlayKneelingOnGroundSFX(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_LookRight(EnNb* this, GlobalContext* globalCtx) { +void EnNb_LookRight(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_CheckIfLookingRight(this, animFinished); EnNb_PlayLookRightSFX(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_LookLeft(EnNb* this, GlobalContext* globalCtx) { +void EnNb_LookLeft(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_CheckIfLookLeft(this, animFinished); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_Run(EnNb* this, GlobalContext* globalCtx) { +void EnNb_Run(EnNb* this, PlayState* play) { s32 animFinished; - EnNb_PlayKnuckleDefeatSFX(this, globalCtx); + EnNb_PlayKnuckleDefeatSFX(this, play); EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_PlayLookLeftSFX(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_SetupDemo6KInConfrontation(this, globalCtx, animFinished); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_SetupDemo6KInConfrontation(this, play, animFinished); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_ConfrontationDestroy(EnNb* this, GlobalContext* globalCtx) { +void EnNb_ConfrontationDestroy(EnNb* this, PlayState* play) { this->timer++; if (this->timer > 60.0f) { @@ -951,24 +951,24 @@ void EnNb_ConfrontationDestroy(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB2E70(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2E70(EnNb* this, PlayState* play) { s32 pad; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 func_80AB2FC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_80AB2FC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; if (limbIndex == NB_LIMB_HEAD) { @@ -978,27 +978,27 @@ s32 func_80AB2FC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_80AB2FE4(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2FE4(EnNb* this, PlayState* play) { s32 pad; s16 eyeIdx = this->eyeIdx; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeIdx]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, func_80AB2FC0, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, func_80AB2FC0, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnNb_SetupCreditsSpawn(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupCreditsSpawn(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedAnim, 0, 0.0f, 0); this->action = NB_CREDITS_INIT; this->drawMode = NB_DRAW_NOTHING; @@ -1021,8 +1021,8 @@ void EnNb_SetAlphaInCredits(EnNb* this) { } } -void EnNb_SetupCreditsFadeIn(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetInitialCsPosRot(this, globalCtx, 1); +void EnNb_SetupCreditsFadeIn(EnNb* this, PlayState* play) { + EnNb_SetInitialCsPosRot(this, play, 1); this->action = NB_CREDITS_FADEIN; this->drawMode = NB_DRAW_HIDE; } @@ -1045,8 +1045,8 @@ void EnNb_CheckIfLookingUp(EnNb* this, s32 animFinished) { } } -void EnNb_CheckCreditsCsModeImpl(EnNb* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); +void EnNb_CheckCreditsCsModeImpl(EnNb* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); s32 action; s32 previousCsAction; @@ -1056,7 +1056,7 @@ void EnNb_CheckCreditsCsModeImpl(EnNb* this, GlobalContext* globalCtx) { if (action != previousCsAction) { switch (action) { case 15: - EnNb_SetupCreditsFadeIn(this, globalCtx); + EnNb_SetupCreditsFadeIn(this, play); break; case 16: EnNb_SetupCreditsHeadTurn(this); @@ -1071,37 +1071,37 @@ void EnNb_CheckCreditsCsModeImpl(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckCreditsCsMode(EnNb* this, GlobalContext* globalCtx) { - EnNb_CheckCreditsCsModeImpl(this, globalCtx); +void EnNb_CheckCreditsCsMode(EnNb* this, PlayState* play) { + EnNb_CheckCreditsCsModeImpl(this, play); } -void EnNb_CreditsFade(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void EnNb_CreditsFade(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetAlphaInCredits(this); EnNb_SetupCreditsSit(this); } -void func_80AB3428(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB3428(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_CheckCreditsCsModeImpl(this, globalCtx); + EnNb_CheckCreditsCsModeImpl(this, play); } -void EnNb_LookUp(EnNb* this, GlobalContext* globalCtx) { +void EnNb_LookUp(EnNb* this, PlayState* play) { s32 animFinished; - func_80AB1284(this, globalCtx); + func_80AB1284(this, play); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_CheckIfLookingUp(this, animFinished); } -void EnNb_CrawlspaceSpawnCheck(EnNb* this, GlobalContext* globalCtx) { +void EnNb_CrawlspaceSpawnCheck(EnNb* this, PlayState* play) { if (!gSaveContext.n64ddFlag && !(gSaveContext.eventChkInf[9] & 0x20) && LINK_IS_CHILD) { - EnNb_UpdatePath(this, globalCtx); + EnNb_UpdatePath(this, play); // looking into crawlspace if (!(gSaveContext.eventChkInf[9] & 0x10)) { @@ -1146,8 +1146,8 @@ void EnNb_SetNoticeSFX(EnNb* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_NOTICE); } -s32 EnNb_GetNoticedStatus(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnNb_GetNoticedStatus(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerX = player->actor.world.pos.x; f32 playerZ = player->actor.world.pos.z; f32 thisX = this->actor.world.pos.x; @@ -1160,7 +1160,7 @@ s32 EnNb_GetNoticedStatus(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB36DC(EnNb* this, GlobalContext* globalCtx) { +void func_80AB36DC(EnNb* this, PlayState* play) { u16 moveTime = this->movementTimer; if ((((u16)((u16)(kREG(17) + 25) - 4))) > moveTime) { @@ -1178,8 +1178,8 @@ void func_80AB36DC(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckNoticed(EnNb* this, GlobalContext* globalCtx) { - if (EnNb_GetNoticedStatus(this, globalCtx)) { +void EnNb_CheckNoticed(EnNb* this, PlayState* play) { + if (EnNb_GetNoticedStatus(this, play)) { EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); this->action = NB_NOTICE_PLAYER; EnNb_SetNoticeSFX(this); @@ -1195,8 +1195,8 @@ void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { } } -void func_80AB3838(EnNb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80AB3838(EnNb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = NB_IN_DIALOG; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1207,18 +1207,18 @@ void func_80AB3838(EnNb* this, GlobalContext* globalCtx) { this->actor.textId = 0x6024; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void EnNb_SetupPathMovement(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupPathMovement(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); gSaveContext.eventChkInf[9] |= 0x10; this->action = NB_IN_PATH; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } -void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetTextIdAsChild(EnNb* this, PlayState* play) { s32 pad; u8 choiceIndex; s32 pad1; @@ -1226,9 +1226,9 @@ void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { textId = this->actor.textId; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (textId == 0x6025) { - EnNb_SetupPathMovement(this, globalCtx); + EnNb_SetupPathMovement(this, play); } else { if (textId == 0x6027) { gSaveContext.infTable[22] |= 0x1000; @@ -1236,8 +1236,8 @@ void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { this->action = NB_IDLE_CRAWLSPACE; } this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); - } else if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - choiceIndex = globalCtx->msgCtx.choiceIndex; + } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + choiceIndex = play->msgCtx.choiceIndex; if (textId == 0x601D) { switch (choiceIndex) { @@ -1270,11 +1270,11 @@ void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { } } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } -void func_80AB3A7C(EnNb* this, GlobalContext* globalCtx, s32 animFinished) { +void func_80AB3A7C(EnNb* this, PlayState* play, s32 animFinished) { u16 movementTimer = this->movementTimer; if ((u16)(kREG(17) + 25) > movementTimer) { @@ -1287,93 +1287,93 @@ void func_80AB3A7C(EnNb* this, GlobalContext* globalCtx, s32 animFinished) { } } -void func_80AB3B04(EnNb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80AB3B04(EnNb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = NB_ACTION_30; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x23); + this->actor.textId = Text_GetFaceReaction(play, 0x23); if ((this->actor.textId) == 0) { this->actor.textId = 0x6026; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void func_80AB3B7C(EnNb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80AB3B7C(EnNb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->action = NB_IDLE_AFTER_TALK; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } } -void EnNb_WaitForNotice(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); +void EnNb_WaitForNotice(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_CheckNoticed(this, globalCtx); + EnNb_CheckNoticed(this, play); } -void EnNb_StandUpAfterNotice(EnNb* this, GlobalContext* globalCtx) { +void EnNb_StandUpAfterNotice(EnNb* this, PlayState* play) { s32 animFinished; - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupIdleCrawlspace(this, animFinished); } -void EnNb_BlockCrawlspace(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB0FBC(this, globalCtx); +void EnNb_BlockCrawlspace(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB0FBC(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3838(this, globalCtx); + func_80AB3838(this, play); } -void EnNb_InitCrawlspaceDialogue(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB0FBC(this, globalCtx); +void EnNb_InitCrawlspaceDialogue(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB0FBC(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetTextIdAsChild(this, globalCtx); + EnNb_SetTextIdAsChild(this, play); } -void EnNb_FollowPath(EnNb* this, GlobalContext* globalCtx) { +void EnNb_FollowPath(EnNb* this, PlayState* play) { s32 animFinished; func_80AB359C(this); - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB36DC(this, globalCtx); + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB36DC(this, play); func_80AB10C4(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3A7C(this, globalCtx, animFinished); + func_80AB3A7C(this, play, animFinished); } -void func_80AB3DB0(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB0FBC(this, globalCtx); +void func_80AB3DB0(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB0FBC(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3B04(this, globalCtx); + func_80AB3B04(this, play); } -void func_80AB3E10(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB1040(this, globalCtx); +void func_80AB3E10(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB1040(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3B7C(this, globalCtx); + func_80AB3B7C(this, play); } static EnNbActionFunc sActionFuncs[] = { @@ -1410,7 +1410,7 @@ static EnNbActionFunc sActionFuncs[] = { func_80AB3E10, }; -void EnNb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Update(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; if (this->action < 0 || this->action > 30 || sActionFuncs[this->action] == NULL) { @@ -1419,41 +1419,41 @@ void EnNb_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnNb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Init(Actor* thisx, PlayState* play) { s32 pad; EnNb* this = (EnNb*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - EnNb_SetupCollider(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, + EnNb_SetupCollider(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, NB_LIMB_MAX); switch (EnNb_GetType(this)) { case NB_TYPE_DEMO02: - EnNb_SetupLightArrowOrSealingCs(this, globalCtx); + EnNb_SetupLightArrowOrSealingCs(this, play); break; case NB_TYPE_KIDNAPPED: - EnNb_InitKidnap(this, globalCtx); + EnNb_InitKidnap(this, play); break; case NB_TYPE_KNUCKLE: - EnNb_SetupConfrontation(this, globalCtx); + EnNb_SetupConfrontation(this, play); break; case NB_TYPE_CREDITS: - EnNb_SetupCreditsSpawn(this, globalCtx); + EnNb_SetupCreditsSpawn(this, play); break; case NB_TYPE_CRAWLSPACE: - EnNb_CrawlspaceSpawnCheck(this, globalCtx); + EnNb_CrawlspaceSpawnCheck(this, play); break; default: // giving medallion - EnNb_SetChamberAnim(this, globalCtx); + EnNb_SetChamberAnim(this, play); break; } } -s32 EnNb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; struct_80034A14_arg1* unk_300 = &this->unk_300; s32 ret = false; @@ -1473,7 +1473,7 @@ s32 EnNb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return ret; } -void EnNb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnNb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; if (limbIndex == NB_LIMB_HEAD) { @@ -1490,34 +1490,34 @@ void EnNb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnNb_DrawNothing(EnNb* this, GlobalContext* globalCtx) { +void EnNb_DrawNothing(EnNb* this, PlayState* play) { } -void EnNb_DrawDefault(EnNb* this, GlobalContext* globalCtx) { +void EnNb_DrawDefault(EnNb* this, PlayState* play) { s32 pad; s16 eyeIdx = this->eyeIdx; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeIdx]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnNb_OverrideLimbDraw, EnNb_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static EnNbDrawFunc sDrawFuncs[] = { EnNb_DrawNothing, EnNb_DrawDefault, EnNb_DrawTransparency, func_80AB2E70, func_80AB2FE4, }; -void EnNb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Draw(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; if (this->drawMode < 0 || this->drawMode >= 5 || sDrawFuncs[this->drawMode] == NULL) { @@ -1526,7 +1526,7 @@ void EnNb_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - sDrawFuncs[this->drawMode](this, globalCtx); + sDrawFuncs[this->drawMode](this, play); } const ActorInit En_Nb_InitVars = { diff --git a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.h b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.h index f0e66ac4e..89f49fc76 100644 --- a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -29,8 +29,8 @@ typedef enum { /* 0x13 */ NB_LIMB_MAX } EnNbLimb; -typedef void (*EnNbActionFunc)(struct EnNb*, GlobalContext*); -typedef void (*EnNbDrawFunc)(struct EnNb*, GlobalContext*); +typedef void (*EnNbActionFunc)(struct EnNb*, PlayState*); +typedef void (*EnNbDrawFunc)(struct EnNb*, PlayState*); typedef struct EnNb { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c index f2722b457..c85de58ed 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -12,29 +12,29 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) -void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNiw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNiw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNiw_Init(Actor* thisx, PlayState* play); +void EnNiw_Destroy(Actor* thisx, PlayState* play); +void EnNiw_Update(Actor* thisx, PlayState* play); +void EnNiw_Draw(Actor* thisx, PlayState* play); void EnNiw_Reset(void); -void EnNiw_ResetAction(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6324(EnNiw* this, GlobalContext* globalCtx); -void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6450(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6570(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6EB4(EnNiw* this, GlobalContext* globalCtx); -void func_80AB70F8(EnNiw* this, GlobalContext* globalCtx); -void func_80AB714C(EnNiw* this, GlobalContext* globalCtx); -void func_80AB7204(EnNiw* this, GlobalContext* globalCtx); -void func_80AB7290(EnNiw* this, GlobalContext* globalCtx); -void func_80AB7328(EnNiw* this, GlobalContext* globalCtx); +void EnNiw_ResetAction(EnNiw* this, PlayState* play); +void func_80AB6324(EnNiw* this, PlayState* play); +void func_80AB63A8(EnNiw* this, PlayState* play); +void func_80AB6450(EnNiw* this, PlayState* play); +void func_80AB6570(EnNiw* this, PlayState* play); +void func_80AB6A38(EnNiw* this, PlayState* play); +void func_80AB6BF8(EnNiw* this, PlayState* play); +void func_80AB6D08(EnNiw* this, PlayState* play); +void func_80AB6EB4(EnNiw* this, PlayState* play); +void func_80AB70F8(EnNiw* this, PlayState* play); +void func_80AB714C(EnNiw* this, PlayState* play); +void func_80AB7204(EnNiw* this, PlayState* play); +void func_80AB7290(EnNiw* this, PlayState* play); +void func_80AB7328(EnNiw* this, PlayState* play); void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale); -void EnNiw_FeatherUpdate(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx); +void EnNiw_FeatherUpdate(EnNiw* this, PlayState* play); +void EnNiw_FeatherDraw(EnNiw* this, PlayState* play); s16 D_80AB85E0 = 0; @@ -121,7 +121,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Init(Actor* thisx, PlayState* play) { EnNiw* this = (EnNiw*)thisx; s32 pad; s32 i; @@ -155,9 +155,9 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.flags |= ACTOR_FLAG_0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); - if (globalCtx->sceneNum == SCENE_SPOT01) { + if (play->sceneNum == SCENE_SPOT01) { for (i = 0; i < ARRAY_COUNT(sKakarikoPosList); i++) { if (fabsf(this->actor.world.pos.x - sKakarikoPosList[i].x) < 40.0f && fabsf(this->actor.world.pos.z - sKakarikoPosList[i].z) < 40.0f) { @@ -220,20 +220,20 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { break; } - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); switch (this->actor.params) { case 0xA: this->actor.colChkInfo.mass = MASS_IMMOVABLE; case 0xD: case 0xE: - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit2); - if (globalCtx->sceneNum == SCENE_LINK_HOME && !(gSaveContext.eventChkInf[1] & 0x4000)) { + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit2); + if (play->sceneNum == SCENE_LINK_HOME && !(gSaveContext.eventChkInf[1] & 0x4000)) { Actor_Kill(&this->actor); } break; default: - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit1); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit1); break; } @@ -242,13 +242,13 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnNiw_ResetAction; } -void EnNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Destroy(Actor* thisx, PlayState* play) { EnNiw* this = (EnNiw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AB5BF8(EnNiw* this, GlobalContext* globalCtx, s16 arg2) { +void func_80AB5BF8(EnNiw* this, PlayState* play, s16 arg2) { f32 factor = 1.0f; if (this->actor.params == 0xD) { @@ -342,7 +342,7 @@ void func_80AB5BF8(EnNiw* this, GlobalContext* globalCtx, s16 arg2) { } } -void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_SpawnAttackCucco(EnNiw* this, PlayState* play) { f32 viewX; f32 viewY; f32 viewZ; @@ -350,13 +350,13 @@ void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) { Actor* attackCucco; if ((this->timer5 == 0) && (this->unk_296 < 7)) { - viewX = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - viewY = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - viewZ = globalCtx->view.lookAt.z - globalCtx->view.eye.z; - attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + globalCtx->view.eye.x; - attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((globalCtx->view.eye.y + 50.0f) + (viewY * 0.5f)); - attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + globalCtx->view.eye.z; - attackCucco = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ATTACK_NIW, + viewX = play->view.lookAt.x - play->view.eye.x; + viewY = play->view.lookAt.y - play->view.eye.y; + viewZ = play->view.lookAt.z - play->view.eye.z; + attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + play->view.eye.x; + attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((play->view.eye.y + 50.0f) + (viewY * 0.5f)); + attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + play->view.eye.z; + attackCucco = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ATTACK_NIW, attackCuccoPos.x, attackCuccoPos.y, attackCuccoPos.z, 0, 0, 0, 0); if (attackCucco != NULL) { @@ -369,7 +369,7 @@ void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) { } } -void func_80AB6100(EnNiw* this, GlobalContext* globalCtx, s32 arg2) { +void func_80AB6100(EnNiw* this, PlayState* play, s32 arg2) { f32 factor; f32 targetRotY; @@ -402,10 +402,10 @@ void func_80AB6100(EnNiw* this, GlobalContext* globalCtx, s32 arg2) { targetRotY = this->unk_2E4 + factor; Math_SmoothStepToS(&this->actor.world.rot.y, targetRotY, 3, this->unk_2FC, 0); Math_ApproachF(&this->unk_2FC, 3000.0f, 1.0f, 500.0f); - func_80AB5BF8(this, globalCtx, 5); + func_80AB5BF8(this, play, 5); } -void EnNiw_ResetAction(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_ResetAction(EnNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); @@ -422,16 +422,16 @@ void EnNiw_ResetAction(EnNiw* this, GlobalContext* globalCtx) { } } -void func_80AB6324(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6324(EnNiw* this, PlayState* play) { if (this->unk_308 != 0) { this->actor.velocity.y = Rand_ZeroFloat(2.0f) + 4.0f; this->actor.speedXZ = Rand_ZeroFloat(2.0f) + 3.0f; this->actionFunc = func_80AB63A8; } - func_80AB5BF8(this, globalCtx, 1); + func_80AB5BF8(this, play, 1); } -void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB63A8(EnNiw* this, PlayState* play) { if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y < 0.0f) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; @@ -443,18 +443,18 @@ void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6570; } else { - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } } -void func_80AB6450(EnNiw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB6450(EnNiw* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 30.0f && fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 5.0f) { this->timer6 = 100; this->actor.gravity = -2.0f; this->actionFunc = func_80AB7290; - } else if (Actor_HasParent(&this->actor, globalCtx)) { + } else if (Actor_HasParent(&this->actor, play)) { this->actor.gravity = -2.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; @@ -465,19 +465,19 @@ void func_80AB6450(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6BF8; } else { // GI_NONE in this case allows the player to lift the actor - func_8002F434(&this->actor, globalCtx, GI_NONE, 25.0f, 10.0f); - func_80AB5BF8(this, globalCtx, 1); + func_8002F434(&this->actor, play, GI_NONE, 25.0f, 10.0f); + func_80AB5BF8(this, play, 1); } } -void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6570(EnNiw* this, PlayState* play) { s32 pad[2]; f32 posY = Rand_CenteredFloat(100.0f); f32 posZ = Rand_CenteredFloat(100.0f); s16 tmp; if (this->actor.params != 0xA) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; this->path = 0; @@ -487,7 +487,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6BF8; return; } - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } else { if (this->path != 0) { this->unk_2A6 = 1; @@ -580,10 +580,10 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f); } - func_80AB5BF8(this, globalCtx, tmp); + func_80AB5BF8(this, play, tmp); } -void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6A38(EnNiw* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -599,13 +599,13 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) { this->unk_2FC = this->unk_300 = 0.0f; this->actionFunc = EnNiw_ResetAction; } else { - path = &globalCtx->setupPathList[pathIndex]; + path = &play->setupPathList[pathIndex]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; pathDiffX = pointPos->x - this->actor.world.pos.x; pathDiffZ = pointPos->z - this->actor.world.pos.z; this->unk_2E4 = Math_FAtan2F(pathDiffX, pathDiffZ) * (0x8000 / M_PI); - func_80AB6100(this, globalCtx, 2); + func_80AB6100(this, play, 2); if (fabsf(pathDiffX) < 30.0f && fabsf(pathDiffZ) < 30.0f) { this->waypoint++; @@ -614,11 +614,11 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) { } } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } } -void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6BF8(EnNiw* this, PlayState* play) { if (this->timer4 == 0) { this->unk_2A6 = 2; this->timer4 = 10; @@ -628,7 +628,7 @@ void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = Rand_CenteredFloat(5000.0f); this->actor.shape.rot.z = Rand_CenteredFloat(5000.0f); - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { if (this->actor.params == 0xD) { this->sfxTimer1 = 0; this->unk_2A6 = 1; @@ -642,10 +642,10 @@ void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; this->actionFunc = func_80AB6D08; } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } -void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6D08(EnNiw* this, PlayState* play) { if (this->path == 0) { if (!(this->actor.bgCheckFlags & 1)) { return; @@ -682,7 +682,7 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { } } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; this->path = 0; @@ -692,25 +692,25 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6BF8; } else { if (this->timer5 >= 6) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } } -void func_80AB6EB4(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6EB4(EnNiw* this, PlayState* play) { if (this->actor.world.pos.y > 400.0f) { Actor_Kill(&this->actor); } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } -void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6F04(EnNiw* this, PlayState* play) { Vec3f pos; if (this->unk_2A8 != 0) { - EnNiw_SpawnAttackCucco(this, globalCtx); + EnNiw_SpawnAttackCucco(this, play); } this->actor.speedXZ = 2.0f; @@ -725,7 +725,7 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { this->timer4 = 30; Math_Vec3f_Copy(&pos, &this->actor.world.pos); pos.y += this->actor.yDistToWater; - EffectSsGRipple_Spawn(globalCtx, &pos, 100, 500, 30); + EffectSsGRipple_Spawn(play, &pos, 100, 500, 30); } if (this->actor.bgCheckFlags & 8) { this->actor.velocity.y = 10.0f; @@ -754,23 +754,23 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { } } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } -void func_80AB70A0(EnNiw* this, GlobalContext* globalCtx) { - OnePointCutscene_Init(globalCtx, 2290, -99, &this->actor, MAIN_CAM); +void func_80AB70A0(EnNiw* this, PlayState* play) { + OnePointCutscene_Init(play, 2290, -99, &this->actor, MAIN_CAM); this->timer5 = 100; this->unk_2A2 = 1; this->actionFunc = func_80AB70F8; } -void func_80AB70A0_nocutscene(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB70A0_nocutscene(EnNiw* this, PlayState* play) { this->timer5 = 10; this->unk_2A2 = 1; this->actionFunc = func_80AB70F8; } -void func_80AB70F8(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB70F8(EnNiw* this, PlayState* play) { this->sfxTimer1 = 100; if (this->timer5 == 0) { @@ -780,10 +780,10 @@ void func_80AB70F8(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB714C; } - func_80AB5BF8(this, globalCtx, this->unk_2A2); + func_80AB5BF8(this, play, this->unk_2A2); } -void func_80AB714C(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB714C(EnNiw* this, PlayState* play) { this->sfxTimer1 = 100; if (this->timer5 == 40) { @@ -804,11 +804,11 @@ void func_80AB714C(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB7204; } - func_80AB5BF8(this, globalCtx, this->unk_2A2); + func_80AB5BF8(this, play, this->unk_2A2); } -void func_80AB7204(EnNiw* this, GlobalContext* globalCtx) { - EnNiw_SpawnAttackCucco(this, globalCtx); +void func_80AB7204(EnNiw* this, PlayState* play) { + EnNiw_SpawnAttackCucco(this, play); if (this->timer7 < 2) { if (this->timer7 == 1) { @@ -816,12 +816,12 @@ void func_80AB7204(EnNiw* this, GlobalContext* globalCtx) { this->unk_2A0 = Rand_ZeroFloat(1.99f); this->timer1 = this->timer2 = this->timer3 = this->timer4 = 0; } else { - func_80AB6100(this, globalCtx, 1); + func_80AB6100(this, play, 1); } } } -void func_80AB7290(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB7290(EnNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); this->unk_2A0 = Rand_ZeroFloat(1.99f); @@ -829,8 +829,8 @@ void func_80AB7290(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB7328; } -void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB7328(EnNiw* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer6 == 0) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; @@ -847,19 +847,19 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) { this->unk_2E4 = Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x, this->actor.world.pos.z - player->actor.world.pos.z) * (0x8000 / M_PI); - func_80AB6100(this, globalCtx, 0); - func_80AB5BF8(this, globalCtx, 2); + func_80AB6100(this, play, 0); + func_80AB5BF8(this, play, 2); } } -void func_80AB7420(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB7420(EnNiw* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { this->unk_2A4 = (s16)Rand_ZeroFloat(3.99f) + 5; this->actionFunc = EnNiw_ResetAction; } } -void func_80AB747C(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB747C(EnNiw* this, PlayState* play) { if (this->unk_2A8 == 0 && this->actor.params != 0xA && this->actionFunc != func_80AB6450 && this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; @@ -875,10 +875,10 @@ void func_80AB747C(EnNiw* this, GlobalContext* globalCtx) { } } -void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Update(Actor* thisx, PlayState* play) { s32 pad1; EnNiw* this = (EnNiw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; s16 featherCount; Vec3f zeroVec1 = { 0.0f, 0.0f, 0.0f }; @@ -930,7 +930,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A6 = 0; } - EnNiw_FeatherUpdate(this, globalCtx); + EnNiw_FeatherUpdate(this, play); if (this->timer1 != 0) { this->timer1--; } @@ -969,21 +969,21 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { } thisx->shape.rot = thisx->world.rot; thisx->shape.shadowScale = 15.0f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->unk_304); Actor_MoveForward(&this->actor); - if (this->actionFunc != func_80AB6EB4 && this->actionFunc != func_80AB6450 && globalCtx->sceneNum != SCENE_SPOT03) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 31); + if (this->actionFunc != func_80AB6EB4 && this->actionFunc != func_80AB6450 && play->sceneNum != SCENE_SPOT03) { + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 31); } - if (globalCtx->sceneNum == SCENE_SPOT03) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 29); + if (play->sceneNum == SCENE_SPOT03) { + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 29); } if (thisx->floorHeight <= BGCHECK_Y_MIN || thisx->floorHeight >= 32000.0f) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 上下? ☆☆☆☆☆ %f\n" VT_RST, thisx->floorHeight); - cam.x = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - cam.y = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - cam.z = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + cam.x = play->view.lookAt.x - play->view.eye.x; + cam.y = play->view.lookAt.y - play->view.eye.y; + cam.z = play->view.lookAt.z - play->view.eye.z; camResult = cam.y / sqrtf(SQ(cam.x) + SQ(cam.y) + SQ(cam.z)); osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外X! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.x); osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外Y! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.y); @@ -993,7 +993,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットZ! ☆☆☆☆☆ %f\n" VT_RST, thisx->home.pos.z); thisx->world.pos.x = thisx->home.pos.x; thisx->world.pos.z = thisx->home.pos.z; - thisx->world.pos.y = ((thisx->home.pos.y + globalCtx->view.eye.y) + (camResult * 160.0f)); + thisx->world.pos.y = ((thisx->home.pos.y + play->view.eye.y) + (camResult * 160.0f)); if (thisx->world.pos.y < thisx->home.pos.y) { thisx->world.pos.y = thisx->home.pos.y + 300.0f; @@ -1039,7 +1039,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Copy(&pos, &thisx->world.pos); pos.y += thisx->yDistToWater; this->timer4 = 30; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 0, 400); this->timer5 = 0; osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ぶくぶく ☆☆☆☆☆ \n" VT_RST); @@ -1074,10 +1074,10 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { dist = 20.0f; if (this->unk_2A8 != 0 && thisx->xyzDistToPlayerSq < SQ(dist) && player->invincibilityTimer == 0) { - func_8002F6D4(globalCtx, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); + func_8002F6D4(play, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); } - func_80AB747C(this, globalCtx); + func_80AB747C(this, play); if (this->sfxTimer2 == 0 && this->actionFunc == func_80AB6BF8) { this->sfxTimer2 = 7; @@ -1096,17 +1096,17 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); if (thisx->params != 0xA && thisx->params != 0xD && thisx->params != 0xE && thisx->params != 4) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != func_80AB6BF8 && this->actionFunc != func_80AB6D08 && this->actionFunc != func_80AB6324 && this->actionFunc != func_80AB63A8 && this->actionFunc != func_80AB6450) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNiw* this = (EnNiw*)thisx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -1130,20 +1130,20 @@ s32 EnNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnNiw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Draw(Actor* thisx, PlayState* play) { EnNiw* this = (EnNiw*)thisx; Vec3f scale = { 0.15f, 0.15f, 0.15f }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiw_OverrideLimbDraw, NULL, this); if (this->actionFunc == func_80AB6450) { - func_80033C30(&this->actor.world.pos, &scale, 255, globalCtx); + func_80033C30(&this->actor.world.pos, &scale, 255, play); } - EnNiw_FeatherDraw(this, globalCtx); + EnNiw_FeatherDraw(this, play); } void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale) { @@ -1166,7 +1166,7 @@ void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 s } } -void EnNiw_FeatherUpdate(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_FeatherUpdate(EnNiw* this, PlayState* play) { s16 i; EnNiwFeather* feather = this->feathers; @@ -1197,16 +1197,16 @@ void EnNiw_FeatherUpdate(EnNiw* this, GlobalContext* globalCtx) { } } -void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_FeatherDraw(EnNiw* this, PlayState* play) { u8 flag = 0; s16 i; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; EnNiwFeather* feather = &this->feathers[0]; OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) { if (feather->type == 1) { @@ -1216,7 +1216,7 @@ void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) { flag++; } 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_RotateZ(feather->unk_30, MTXMODE_APPLY); Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h index 9942e2473..48f2624a1 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -6,7 +6,7 @@ struct EnNiw; -typedef void (*EnNiwActionFunc)(struct EnNiw*, GlobalContext*); +typedef void (*EnNiwActionFunc)(struct EnNiw*, PlayState*); typedef struct { /* 0x0000 */ u8 type; @@ -82,8 +82,8 @@ typedef struct EnNiw { extern "C" { #endif - void func_80AB70A0(EnNiw* this, GlobalContext* globalCtx); - void func_80AB70A0_nocutscene(EnNiw* this, GlobalContext* globalCtx); + void func_80AB70A0(EnNiw* this, PlayState* play); + void func_80AB70A0_nocutscene(EnNiw* this, PlayState* play); #ifdef __cplusplus #undef this }; diff --git a/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index 501ba8e63..2d0393035 100644 --- a/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNiwGirl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNiwGirl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNiwGirl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNiwGirl_Init(Actor* thisx, PlayState* play); +void EnNiwGirl_Destroy(Actor* thisx, PlayState* play); +void EnNiwGirl_Update(Actor* thisx, PlayState* play); +void EnNiwGirl_Draw(Actor* thisx, PlayState* play); -void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx); -void func_80AB94D0(EnNiwGirl* this, GlobalContext* globalCtx); -void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx); +void EnNiwGirl_Talk(EnNiwGirl* this, PlayState* play); +void func_80AB94D0(EnNiwGirl* this, PlayState* play); +void func_80AB9210(EnNiwGirl* this, PlayState* play); const ActorInit En_Niw_Girl_InitVars = { ACTOR_EN_NIW_GIRL, @@ -52,17 +52,17 @@ static ColliderCylinderInit sCylinderInit = { { 10, 30, 0, { 0, 0, 0 } }, }; -void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Init(Actor* thisx, PlayState* play) { EnNiwGirl* this = (EnNiwGirl*)thisx; s32 pad; Vec3f vec1; Vec3f vec2; s32 pad2; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gNiwGirlSkel, &gNiwGirlRunAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gNiwGirlSkel, &gNiwGirlRunAnim, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 6; if (this->actor.params < 0) { this->actor.params = 0; @@ -75,7 +75,7 @@ void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx) { vec1.z = 50.0; Matrix_MultVec3f(&vec1, &vec2); this->chasedEnNiw = (EnNiw*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x + vec2.x, + &play->actorCtx, &this->actor, play, ACTOR_EN_NIW, this->actor.world.pos.x + vec2.x, this->actor.world.pos.y + vec2.y, this->actor.world.pos.z + vec2.z, 0, this->actor.world.rot.y, 0, 0xA); if (this->chasedEnNiw != NULL) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ シツレイしちゃうわね!プンプン ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); @@ -92,18 +92,18 @@ void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNiwGirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Destroy(Actor* thisx, PlayState* play) { } -void EnNiwGirl_Jump(EnNiwGirl* this, GlobalContext* globalCtx) { +void EnNiwGirl_Jump(EnNiwGirl* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gNiwGirlRunAnim); Animation_Change(&this->skelAnime, &gNiwGirlRunAnim, 1.0f, 0.0f, frameCount, 0, -10.0f); this->actor.flags &= ~ACTOR_FLAG_0; this->actionFunc = func_80AB9210; } -void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->path]; +void func_80AB9210(EnNiwGirl* this, PlayState* play) { + Path* path = &play->setupPathList[this->path]; f32 xDistBetween; f32 zDistBetween; @@ -113,7 +113,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) { // Find the X and Z distance between the girl and the cuckoo she is chasing xDistBetween = this->chasedEnNiw->actor.world.pos.x - this->actor.world.pos.x; zDistBetween = this->chasedEnNiw->actor.world.pos.z - this->actor.world.pos.z; - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { this->chasedEnNiw->path = 0; } if (sqrtf(SQ(xDistBetween) + SQ(zDistBetween)) < 70.0f) { @@ -130,13 +130,13 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; // Only allow Link to talk to her when she is playing the jumping animation - if ((this->jumpTimer == 0) || (Player_GetMask(globalCtx) != PLAYER_MASK_NONE)) { + if ((this->jumpTimer == 0) || (Player_GetMask(play) != PLAYER_MASK_NONE)) { this->jumpTimer = 60; this->actionFunc = EnNiwGirl_Talk; } } -void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx) { +void EnNiwGirl_Talk(EnNiwGirl* this, PlayState* play) { Animation_Change(&this->skelAnime, &gNiwGirlJumpAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwGirlJumpAnim), 0, -10.0f); this->actor.flags |= ACTOR_FLAG_0; @@ -144,7 +144,7 @@ void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx) { if ((gSaveContext.eventChkInf[8] & 1) && (this->unk_27A == 0)) { this->actor.textId = 0x70EA; } - switch (Player_GetMask(globalCtx)) { + switch (Player_GetMask(play)) { case PLAYER_MASK_KEATON: this->actor.textId = 0x7118; break; @@ -166,30 +166,30 @@ void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB94D0; } -void func_80AB94D0(EnNiwGirl* this, GlobalContext* globalCtx) { +void func_80AB94D0(EnNiwGirl* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { this->chasedEnNiw->path = 0; } Math_ApproachZeroF(&this->actor.speedXZ, 0.8f, 0.2f); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.textId == 0x70EA) { this->unk_27A = 1; } } else { - if ((this->jumpTimer == 0) && Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if ((this->jumpTimer == 0) && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->jumpTimer = Rand_ZeroFloat(100.0f) + 250.0f; this->actionFunc = EnNiwGirl_Jump; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } -void EnNiwGirl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Update(Actor* thisx, PlayState* play) { EnNiwGirl* this = (EnNiwGirl*)thisx; EnNiwGirlActionFunc tempActionFunc; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor_SetScale(&this->actor, 0.013f); this->unkUpTimer++; @@ -222,14 +222,14 @@ void EnNiwGirl_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->jumpTimer != 0) { this->jumpTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 100.0f, 100.0f, 200.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 100.0f, 100.0f, 200.0f, 0x1C); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnNiwGirlOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnNiwGirlOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNiwGirl* this = (EnNiwGirl*)thisx; @@ -245,19 +245,19 @@ s32 EnNiwGirlOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi static Vec3f sConstVec3f = { 0.2f, 0.2f, 0.2f }; -void EnNiwGirl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gNiwGirlEyeOpenTex, gNiwGirlEyeHalfTex, gNiwGirlEyeClosedTex }; EnNiwGirl* this = (EnNiwGirl*)thisx; s32 pad; Vec3f sp4C = sConstVec3f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiwGirlOverrideLimbDraw, NULL, this); - func_80033C30(&this->actor.world.pos, &sp4C, 255, globalCtx); + func_80033C30(&this->actor.world.pos, &sp4C, 255, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h b/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h index d931973c3..e9ef3b081 100644 --- a/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h +++ b/soh/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h @@ -7,7 +7,7 @@ struct EnNiwGirl; -typedef void (*EnNiwGirlActionFunc)(struct EnNiwGirl*, GlobalContext*); +typedef void (*EnNiwGirlActionFunc)(struct EnNiwGirl*, PlayState*); typedef struct EnNiwGirl { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 7a8a7e6d3..0a17fb10f 100644 --- a/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -7,24 +7,24 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnNiwLady_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNiwLady_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx); +void EnNiwLady_Init(Actor* thisx, PlayState* play); +void EnNiwLady_Destroy(Actor* thisx, PlayState* play); +void EnNiwLady_Update(Actor* thisx, PlayState* play); -void func_80AB9F24(EnNiwLady* this, GlobalContext* globalCtx); -void EnNiwLady_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80ABA21C(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAD38(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA778(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA878(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAB08(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAC00(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAA9C(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAC84(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAD7C(EnNiwLady* this, GlobalContext* globalCtx); +void func_80AB9F24(EnNiwLady* this, PlayState* play); +void EnNiwLady_Draw(Actor* thisx, PlayState* play); +void func_80ABA21C(EnNiwLady* this, PlayState* play); +void func_80ABAD38(EnNiwLady* this, PlayState* play); +void func_80ABA778(EnNiwLady* this, PlayState* play); +void func_80ABA878(EnNiwLady* this, PlayState* play); +void func_80ABA9B8(EnNiwLady* this, PlayState* play); +void func_80ABAB08(EnNiwLady* this, PlayState* play); +void func_80ABAC00(EnNiwLady* this, PlayState* play); +void func_80ABAA9C(EnNiwLady* this, PlayState* play); +void func_80ABAC84(EnNiwLady* this, PlayState* play); +void func_80ABA244(EnNiwLady* this, PlayState* play); +void func_80ABA654(EnNiwLady* this, PlayState* play); +void func_80ABAD7C(EnNiwLady* this, PlayState* play); const ActorInit En_Niw_Lady_InitVars = { ACTOR_EN_NIW_LADY, @@ -67,18 +67,18 @@ static ColliderCylinderInit sCylinderInit = { { 10, 10, 0, { 0, 0, 0 } }, }; -void EnNiwLady_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Init(Actor* thisx, PlayState* play) { s32 pad; EnNiwLady* this = (EnNiwLady*)thisx; - this->objectAneIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_ANE); - this->objectOsAnimeIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); + this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE); + this->objectOsAnimeIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if ((this->objectOsAnimeIndex < 0) || (this->objectAneIndex < 0)) { Actor_Kill(thisx); return; } this->unk_278 = 0; - if (globalCtx->sceneNum == SCENE_LABO) { + if (play->sceneNum == SCENE_LABO) { this->unk_278 = 1; } if ((this->unk_278 != 0) && IS_DAY) { @@ -92,16 +92,16 @@ void EnNiwLady_Init(Actor* thisx, GlobalContext* globalCtx) { this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; } -void EnNiwLady_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Destroy(Actor* thisx, PlayState* play) { EnNiwLady* this = (EnNiwLady*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnNiwLady_ChoseAnimation(EnNiwLady* this, GlobalContext* globalCtx, s32 arg2) { +void EnNiwLady_ChoseAnimation(EnNiwLady* this, PlayState* play, s32 arg2) { f32 frames; - if (Text_GetFaceReaction(globalCtx, 8) != 0) { + if (Text_GetFaceReaction(play, 8) != 0) { arg2 = 8; } if (arg2 != this->unk_270) { @@ -150,21 +150,21 @@ void EnNiwLady_ChoseAnimation(EnNiwLady* this, GlobalContext* globalCtx, s32 arg } } -void func_80AB9F24(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80AB9F24(EnNiwLady* this, PlayState* play) { f32 frames; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectAneIndex) && - Object_IsLoaded(&globalCtx->objectCtx, this->objectOsAnimeIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objectAneIndex].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objectOsAnimeIndex].segment); + if (Object_IsLoaded(&play->objectCtx, this->objectAneIndex) && + Object_IsLoaded(&play->objectCtx, this->objectOsAnimeIndex)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectAneIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment); this->unk_27E = 1; this->actor.gravity = -3.0f; Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_272 = 0; this->actor.targetMode = 6; this->actor.draw = EnNiwLady_Draw; @@ -192,18 +192,18 @@ void func_80AB9F24(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABA21C(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABA21C(EnNiwLady* this, PlayState* play) { this->actor.textId = sMissingCuccoTextIds[0]; this->unk_262 = TEXT_STATE_DONE; this->actionFunc = func_80ABA244; } -void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABA244(EnNiwLady* this, PlayState* play) { EnNiw* currentCucco; s32 phi_s1; this->cuccosInPen = gSaveContext.n64ddFlag ? (7 - Randomizer_GetSettingValue(RSK_CUCCO_COUNT)) : 0; - currentCucco = (EnNiw*)globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + currentCucco = (EnNiw*)play->actorCtx.actorLists[ACTORCAT_PROP].head; while (currentCucco != NULL) { if (currentCucco->actor.id == ACTOR_EN_NIW) { if ((fabsf(currentCucco->actor.world.pos.x - 330.0f) < 90.0f) && @@ -227,8 +227,8 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { this->cuccosInPen = BREG(7) - 1; } phi_s1 = this->cuccosInPen; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 101; } if (this->cuccosInPen >= 7) { @@ -241,15 +241,15 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { phi_s1 = 9; } this->actor.textId = sMissingCuccoTextIds[phi_s1]; - if (Text_GetFaceReaction(globalCtx, 8) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 8); + if (Text_GetFaceReaction(play, 8) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 8); this->unk_262 = TEXT_STATE_DONE; } if ((this->unk_26C != 0) && (phi_s1 != 9)) { phi_s1 = 10; this->unk_26E = 11; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ねぇちゃん選択\t ☆☆☆☆ %d\n" VT_RST, phi_s1); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ねぇちゃんハート ☆☆☆☆ %d\n" VT_RST, this->unk_26C); @@ -258,7 +258,7 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ this->actor.talk_message ☆☆ %x\n" VT_RST, this->actor.textId); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ this->message_end_code ☆☆ %d\n" VT_RST, this->unk_262); osSyncPrintf("\n\n"); - if (Text_GetFaceReaction(globalCtx, 8) == 0) { + if (Text_GetFaceReaction(play, 8) == 0) { if (this->actor.textId == 0x503C) { func_80078884(NA_SE_SY_ERROR); this->unk_26C = 2; @@ -292,13 +292,13 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { } } } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) { - if (this->unk_262 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80ABA654(EnNiwLady* this, PlayState* play) { + if (this->unk_262 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ハート ☆☆☆☆☆ %d\n" VT_RST, this->unk_26C); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 爆弾 ☆☆☆☆☆ %d\n" VT_RST, this->unk_272); osSyncPrintf("\n\n"); @@ -308,10 +308,10 @@ void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) { if (!gSaveContext.n64ddFlag) { this->getItemId = GI_BOTTLE; - func_8002F434(&this->actor, globalCtx, GI_BOTTLE, 100.0f, 50.0f); + func_8002F434(&this->actor, play, GI_BOTTLE, 100.0f, 50.0f); } else { this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_CHILD, GI_BOTTLE); - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 100.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 100.0f, 50.0f); } this->actionFunc = func_80ABAC00; @@ -319,7 +319,7 @@ void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) { } if (this->unk_26C == 1) { this->getItemId = GI_RUPEE_PURPLE; - func_8002F434(&this->actor, globalCtx, GI_RUPEE_PURPLE, 100.0f, 50.0f); + func_8002F434(&this->actor, play, GI_RUPEE_PURPLE, 100.0f, 50.0f); this->actionFunc = func_80ABAC00; } this->actionFunc = func_80ABA244; @@ -329,7 +329,7 @@ void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) { static s16 sTradeItemTextIds[] = { 0x503E, 0x503F, 0x5047, 0x5040, 0x5042, 0x5043, 0x5044, 0x00CF, 0x5045, 0x5042, 0x5027 }; -void func_80ABA778(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABA778(EnNiwLady* this, PlayState* play) { // "☆☆☆☆☆ Adult message check ☆☆☆☆☆" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ アダルトメッセージチェック ☆☆☆☆☆ \n" VT_RST); this->unk_262 = TEXT_STATE_DONE; @@ -360,16 +360,16 @@ void func_80ABA778(EnNiwLady* this, GlobalContext* globalCtx) { this->actionFunc = func_80ABA878; } -void func_80ABA878(EnNiwLady* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABA878(EnNiwLady* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 playerExchangeItemId; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 11; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - playerExchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + playerExchangeItemId = func_8002F368(play); if ((playerExchangeItemId == 6) && (gSaveContext.eventChkInf[6] & 0x400)) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); player->actor.textId = sTradeItemTextIds[5]; @@ -385,19 +385,19 @@ void func_80ABA878(EnNiwLady* this, GlobalContext* globalCtx) { this->actionFunc = !this->unk_273 ? func_80ABA778 : func_80ABA9B8; } } else { - func_8002F298(&this->actor, globalCtx, 50.0f, 6); + func_8002F298(&this->actor, play, 50.0f, 6); } } -void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) { - if ((this->unk_262 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ABA9B8(EnNiwLady* this, PlayState* play) { + if ((this->unk_262 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.parent = NULL; if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_POCKET_EGG, 200.0f, 100.0f); + func_8002F434(&this->actor, play, GI_POCKET_EGG, 200.0f, 100.0f); } else { // TODO: get-item-rework Adult trade sequence this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_ADULT, GI_POCKET_EGG); @@ -409,7 +409,7 @@ void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) { case 1: this->actor.textId = sTradeItemTextIds[3]; this->unk_26E = this->unk_27A + 21; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_262 = TEXT_STATE_EVENT; this->actionFunc = func_80ABAA9C; break; @@ -417,36 +417,36 @@ void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABAA9C(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAA9C(EnNiwLady* this, PlayState* play) { this->unk_26E = 11; - if ((this->unk_262 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->unk_262 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = func_80ABA778; } } -void func_80ABAB08(EnNiwLady* this, GlobalContext* globalCtx) { - if ((this->unk_262 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ABAB08(EnNiwLady* this, PlayState* play) { + if ((this->unk_262 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.parent = NULL; if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_COJIRO, 200.0f, 100.0f); + func_8002F434(&this->actor, play, GI_COJIRO, 200.0f, 100.0f); } else { // TODO: get-item-rework Adult trade sequence this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_TRADE_POCKET_CUCCO, GI_COJIRO); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_POCKET_CUCCO); + Randomizer_ConsumeAdultTradeItem(play, ITEM_POCKET_CUCCO); gSaveContext.itemGetInf[2] |= 0x4000; } this->actionFunc = func_80ABAC00; break; case 1: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->unk_277 = 1; this->actor.textId = sTradeItemTextIds[8]; this->unk_26E = this->unk_27A + 21; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_262 = TEXT_STATE_EVENT; this->actionFunc = func_80ABAA9C; break; @@ -454,10 +454,10 @@ void func_80ABAB08(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABAC00(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAC00(EnNiwLady* this, PlayState* play) { s32 getItemId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80ABAC84; } else { getItemId = this->getItemId; @@ -467,19 +467,19 @@ void func_80ABAC00(EnNiwLady* this, GlobalContext* globalCtx) { } else { // TODO: get-item-rework Adult trade sequence getItemId = this->getItemEntry.getItemId; - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 200.0f, 100.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 200.0f, 100.0f); // Skip setting item flags because that was done earlier this->actionFunc = func_80ABA778; } } if (this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, 200.0f, 100.0f); + func_8002F434(&this->actor, play, getItemId, 200.0f, 100.0f); } } } -void func_80ABAC84(EnNiwLady* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_DONE) || !Message_ShouldAdvance(globalCtx)) { +void func_80ABAC84(EnNiwLady* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) != TEXT_STATE_DONE) || !Message_ShouldAdvance(play)) { return; } osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); @@ -497,34 +497,34 @@ void func_80ABAC84(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABAD38(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAD38(EnNiwLady* this, PlayState* play) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 通常メッセージチェック ☆☆☆☆☆ \n" VT_RST); this->unk_262 = TEXT_STATE_DONE; this->actionFunc = func_80ABAD7C; } -void func_80ABAD7C(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAD7C(EnNiwLady* this, PlayState* play) { this->actor.textId = 0x503D; - if (Text_GetFaceReaction(globalCtx, 8) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 8); + if (Text_GetFaceReaction(play, 8) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 8); } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 8; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_274 = 1; this->unk_26E = this->unk_27A + 9; this->actionFunc = func_80ABAD38; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Update(Actor* thisx, PlayState* play) { s32 pad; EnNiwLady* this = (EnNiwLady*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor_SetFocus(thisx, 60.0f); this->unk_288.unk_18 = player->actor.world.pos; @@ -537,19 +537,19 @@ void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_276 == 0) { Math_SmoothStepToS(&this->unk_254.y, 0, 5, 3000, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objectOsAnimeIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment); if (this->objectOsAnimeIndex >= 0) { if (this->unk_27E != 0) { if (this->unk_26E != 0) { this->unk_26E--; - EnNiwLady_ChoseAnimation(this, globalCtx, this->unk_26E); + EnNiwLady_ChoseAnimation(this, play, this->unk_26E); this->unk_26E = 0; } SkelAnime_Update(&this->skelAnime); } - this->objectAneIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_ANE); + this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE); if (this->objectAneIndex >= 0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unusedTimer2 != 0) { this->unusedTimer2--; } @@ -564,9 +564,9 @@ void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { this->unusedRandomTimer = ((s16)Rand_ZeroFloat(60.0f) + 0x14); } } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 20.0f, 60.0f, 0x1D); Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } @@ -579,7 +579,7 @@ Gfx* func_80ABB0A0(GraphicsContext* gfxCtx) { return dList; } -s32 EnNiwLady_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNiwLady* this = (EnNiwLady*)thisx; s32 pad; @@ -593,26 +593,26 @@ s32 EnNiwLady_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } if (this->unk_275 != 0) { if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { - rot->y += (Math_SinS((globalCtx->state.frames * ((limbIndex * 0x32) + 0x814))) * 200.0f); - rot->z += (Math_CosS((globalCtx->state.frames * ((limbIndex * 0x32) + 0x940))) * 200.0f); + rot->y += (Math_SinS((play->state.frames * ((limbIndex * 0x32) + 0x814))) * 200.0f); + rot->z += (Math_CosS((play->state.frames * ((limbIndex * 0x32) + 0x940))) * 200.0f); } } return false; } -void EnNiwLady_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Draw(Actor* thisx, PlayState* play) { static void* sEyeTextures[] = { gCuccoLadyEyeOpenTex, gCuccoLadyEyeHalfTex, gCuccoLadyEyeClosedTex }; EnNiwLady* this = (EnNiwLady*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_27E != 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->faceState])); - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80ABB0A0(globalCtx->state.gfxCtx)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + gSPSegment(POLY_OPA_DISP++, 0x0C, func_80ABB0A0(play->state.gfxCtx)); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiwLady_OverrideLimbDraw, NULL, this); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h b/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h index 5fe9684f4..9ec191338 100644 --- a/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h +++ b/soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h @@ -6,7 +6,7 @@ struct EnNiwLady; -typedef void (*EnNiwLadyActionFunc)(struct EnNiwLady*, GlobalContext*); +typedef void (*EnNiwLadyActionFunc)(struct EnNiwLady*, PlayState*); typedef struct EnNiwLady { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index b2cd68d81..f75436f31 100644 --- a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -15,13 +15,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNutsball_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNutsball_Init(Actor* thisx, PlayState* play); +void EnNutsball_Destroy(Actor* thisx, PlayState* play); +void EnNutsball_Update(Actor* thisx, PlayState* play); +void EnNutsball_Draw(Actor* thisx, PlayState* play); -void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx); -void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx); +void func_80ABBB34(EnNutsball* this, PlayState* play); +void func_80ABBBA8(EnNutsball* this, PlayState* play); const ActorInit En_Nutsball_InitVars = { ACTOR_EN_NUTSBALL, @@ -68,14 +68,14 @@ static Gfx* sDLists[] = { gDekuNutsDekuNutDL, gHintNutsNutDL, gBusinessScrubDekuNutDL, gDntJijiNutDL, gDntStageNutDL, }; -void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Init(Actor* thisx, PlayState* play) { EnNutsball* this = (EnNutsball*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIDs[this->actor.params]); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[this->actor.params]); if (this->objBankIndex < 0) { Actor_Kill(&this->actor); @@ -84,14 +84,14 @@ void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNutsball_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Destroy(Actor* thisx, PlayState* play) { EnNutsball* this = (EnNutsball*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void func_80ABBB34(EnNutsball* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; this->actor.draw = EnNutsball_Draw; this->actor.shape.rot.y = 0; @@ -101,8 +101,8 @@ void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) { } } -void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABBBA8(EnNutsball* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3s sp4C; Vec3f sp40; @@ -137,8 +137,8 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { sp40.y = this->actor.world.pos.y + 4; sp40.z = this->actor.world.pos.z; - EffectSsHahen_SpawnBurst(globalCtx, &sp40, 6.0f, 0, 7, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); + EffectSsHahen_SpawnBurst(play, &sp40, 6.0f, 0, 7, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); Actor_Kill(&this->actor); } else { if (this->timer == -300) { @@ -147,51 +147,51 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { } } -void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Update(Actor* thisx, PlayState* play) { EnNutsball* this = (EnNutsball*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; if (!(player->stateFlags1 & 0x300000C0) || (this->actionFunc == func_80ABBB34)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10, sCylinderInit.dim.radius, sCylinderInit.dim.height, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10, sCylinderInit.dim.radius, sCylinderInit.dim.height, 5); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (CVar_GetS32("gNewDrops", 0) != 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6), + 1 * (play->state.frames * 6), 32, 32, 1, 1 * (play->state.frames * 6), + 1 * (play->state.frames * 6), 32, 32)); Matrix_Scale(25.0f,25.0f,25.0f,MTXMODE_APPLY); Matrix_RotateX(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDListsNew[thisx->params]); } else { - func_80093D18(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D18(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h index 5c4c09928..5a59e27d9 100644 --- a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h +++ b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h @@ -6,7 +6,7 @@ struct EnNutsball; -typedef void (*EnNutsballActionFunc)(struct EnNutsball*, GlobalContext*); +typedef void (*EnNutsballActionFunc)(struct EnNutsball*, PlayState*); typedef struct EnNutsball { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index b2db1621a..d07d97f21 100644 --- a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNwc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNwc_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNwc_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNwc_Init(Actor* thisx, PlayState* play); +void EnNwc_Destroy(Actor* thisx, PlayState* play); +void EnNwc_Update(Actor* thisx, PlayState* play); +void EnNwc_Draw(Actor* thisx, PlayState* play); void EnNwc_SetUpdate(EnNwc* this, EnNwcUpdateFunc updateFunc); -void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx); -void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx); -void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx); -void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_Idle(EnNwc* this, GlobalContext* globalCtx); +void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, PlayState* play); +void EnNwc_ChickBgCheck(EnNwcChick* chick, PlayState* play); +void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, PlayState* play); +void EnNwc_UpdateChicks(EnNwc* this, PlayState* play); +void EnNwc_DrawChicks(EnNwc* this, PlayState* play); +void EnNwc_Idle(EnNwc* this, PlayState* play); #define CHICK_BG_FLOOR (1 << 0) #define CHICK_BG_WALL (1 << 1) @@ -72,10 +72,10 @@ void EnNwc_SetUpdate(EnNwc* this, EnNwcUpdateFunc updateFunc) { this->updateFunc = updateFunc; } -void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, PlayState* play) { } -void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx) { +void EnNwc_ChickBgCheck(EnNwcChick* chick, PlayState* play) { CollisionPoly* outPoly; s32 bgId; Vec3f outPos; @@ -85,14 +85,14 @@ void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx) { outPos.x = chick->pos.x; outPos.y = chick->pos.y; outPos.z = chick->pos.z; - if (BgCheck_EntitySphVsWall1(&globalCtx->colCtx, &outPos, &chick->pos, &chick->lastPos, 10.0f, &chick->floorPoly, + if (BgCheck_EntitySphVsWall1(&play->colCtx, &outPos, &chick->pos, &chick->lastPos, 10.0f, &chick->floorPoly, 20.0f)) { chick->bgFlags |= CHICK_BG_WALL; } //! @bug The use of outPos here is totally wrong. Even if it didn't get overwritten // by the wall check, it should add an offset to the y-value so the raycast // doesn't go through the floor and cause the chicks to ignore all floors. - chick->floorY = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &outPoly, &bgId, &outPos); + chick->floorY = BgCheck_EntityRaycastFloor3(&play->colCtx, &outPoly, &bgId, &outPos); dy = chick->floorY - chick->pos.y; if ((0.0f <= dy) && (dy < 40.0f)) { chick->pos.y = chick->floorY; @@ -100,17 +100,17 @@ void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx) { } } -void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, PlayState* play) { chick->velY -= 0.1f; if (chick->velY < -10.0f) { chick->velY = -10.0f; } chick->pos.y += chick->velY; - EnNwc_ChickBgCheck(chick, globalCtx); + EnNwc_ChickBgCheck(chick, play); if (chick) {} // Needed for matching. Possibly from remnant of unfinished code? } -void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_UpdateChicks(EnNwc* this, PlayState* play) { static EnNwcChickFunc chickActionFuncs[] = { EnNwc_ChickNoop, EnNwc_ChickFall }; EnNwcChick* chick = this->chicks; ColliderJntSphElement* element = this->collider.elements; @@ -122,7 +122,7 @@ void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx) { for (i = 0; i < this->count; i++, prevChickPos = chick->pos, chick++, element++) { Math_Vec3f_Copy(&chick->lastPos, &chick->pos); - chickActionFuncs[chick->type](chick, this, globalCtx); + chickActionFuncs[chick->type](chick, this, play); element->dim.worldSphere.center.x = chick->pos.x; element->dim.worldSphere.center.y = chick->pos.y; @@ -147,7 +147,7 @@ void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx) { } } -void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_DrawChicks(EnNwc* this, PlayState* play) { s32 i; Gfx* dList1; Gfx* dList2; @@ -155,8 +155,8 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { MtxF floorMat; EnNwcChick* chick; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093C80(globalCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093C80(play); dList1 = POLY_XLU_DISP; dList2 = dList1 + 3 * this->count + 1; @@ -174,7 +174,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild(chick, chick->epoch); Matrix_SetTranslateRotateYXZ(chick->pos.x, chick->pos.y + chick->height, chick->pos.z, &chick->rot); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - mtx = MATRIX_NEWMTX(globalCtx->state.gfxCtx); + mtx = MATRIX_NEWMTX(play->state.gfxCtx); gDPSetEnvColor(dList1++, 0, 100, 255, 255); gSPMatrix(dList1++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(dList1++, gCuccoChickBodyDL); @@ -188,7 +188,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { chick = this->chicks; POLY_XLU_DISP = dList3; - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gCuccoChickSetupShadowDL); for (i = 0; i < this->count; i++, chick++) { @@ -198,16 +198,16 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { Matrix_Put(&floorMat); Matrix_RotateY(chick->rot.y * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 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++, gCuccoChickShadowDL); FrameInterpolation_RecordCloseChild(); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Init(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; ColliderJntSphElementInit elementInits[16]; @@ -220,8 +220,8 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { *element = sJntSphElementInit; } - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSphAllocType1(globalCtx, &this->collider, &this->actor, &sJntSphInit); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSphAllocType1(play, &this->collider, &this->actor, &sJntSphInit); this->count = 16; chick = this->chicks; for (i = 0; i < this->count; i++, chick++) { @@ -235,28 +235,28 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { EnNwc_SetUpdate(this, EnNwc_Idle); } -void EnNwc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; - Collider_FreeJntSph(globalCtx, &this->collider); + Collider_FreeJntSph(play, &this->collider); } -void EnNwc_Idle(EnNwc* this, GlobalContext* globalCtx) { - EnNwc_UpdateChicks(this, globalCtx); +void EnNwc_Idle(EnNwc* this, PlayState* play) { + EnNwc_UpdateChicks(this, play); } -void EnNwc_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Update(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; - this->updateFunc(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + this->updateFunc(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnNwc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Draw(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; - EnNwc_DrawChicks(this, globalCtx); + EnNwc_DrawChicks(this, play); } diff --git a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h index eb4d9fb1d..0014a613d 100644 --- a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h +++ b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h @@ -7,8 +7,8 @@ struct EnNwc; struct EnNwcChick; -typedef void (*EnNwcUpdateFunc)(struct EnNwc*, GlobalContext*); -typedef void (*EnNwcChickFunc)(struct EnNwcChick*, struct EnNwc*, GlobalContext*); +typedef void (*EnNwcUpdateFunc)(struct EnNwc*, PlayState*); +typedef void (*EnNwcChickFunc)(struct EnNwcChick*, struct EnNwc*, PlayState*); typedef struct EnNwcChick { /* 0x00 */ s8 type; diff --git a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c index a5831e3ec..869b32206 100644 --- a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -4,24 +4,24 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnNy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNy_Init(Actor* thisx, PlayState* play); +void EnNy_Destroy(Actor* thisx, PlayState* play); +void EnNy_Update(Actor* thisx, PlayState* play); +void EnNy_Draw(Actor* thisx, PlayState* play); -void EnNy_UpdateUnused(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Move(EnNy* this, GlobalContext* globalCtx); -void EnNy_Die(EnNy* this, GlobalContext* globalCtx); +void EnNy_UpdateUnused(Actor* thisx, PlayState* play); +void EnNy_Move(EnNy* this, PlayState* play); +void EnNy_Die(EnNy* this, PlayState* play); void func_80ABCD40(EnNy* this); void func_80ABCDBC(EnNy* this); -void EnNy_TurnToStone(EnNy* this, GlobalContext* globalCtx); -void func_80ABD11C(EnNy* this, GlobalContext* globalCtx); -void func_80ABCE50(EnNy* this, GlobalContext* globalCtx); -void func_80ABCE90(EnNy* this, GlobalContext* globalCtx); -void func_80ABCEEC(EnNy* this, GlobalContext* globalCtx); -void EnNy_UpdateDeath(Actor* thisx, GlobalContext* GlobalContext); -void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx); -void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* GlobalContext); +void EnNy_TurnToStone(EnNy* this, PlayState* play); +void func_80ABD11C(EnNy* this, PlayState* play); +void func_80ABCE50(EnNy* this, PlayState* play); +void func_80ABCE90(EnNy* this, PlayState* play); +void func_80ABCEEC(EnNy* this, PlayState* play); +void EnNy_UpdateDeath(Actor* thisx, PlayState* PlayState); +void EnNy_SetupDie(EnNy* this, PlayState* play); +void EnNy_DrawDeathEffect(Actor* thisx, PlayState* PlayState); void func_80ABD3B8(EnNy* this, f32, f32); const ActorInit En_Ny_InitVars = { @@ -105,15 +105,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnNy_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Init(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; this->epoch++; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 2; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->elements); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); this->unk_1CA = 0; this->unk_1D0 = 0; @@ -147,9 +147,9 @@ void EnNy_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNy_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Destroy(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80ABCD40(EnNy* this) { @@ -190,13 +190,13 @@ void func_80ABCE38(EnNy* this) { this->actionFunc = func_80ABD11C; } -void func_80ABCE50(EnNy* this, GlobalContext* globalCtx) { +void func_80ABCE50(EnNy* this, PlayState* play) { if (this->actor.xyzDistToPlayerSq <= 25600.0f) { func_80ABCD94(this); } } -void func_80ABCE90(EnNy* this, GlobalContext* globalCtx) { +void func_80ABCE90(EnNy* this, PlayState* play) { s32 phi_v1; s32 phi_v0; @@ -211,7 +211,7 @@ void func_80ABCE90(EnNy* this, GlobalContext* globalCtx) { this->unk_1D8 = phi_v0; } -void func_80ABCEEC(EnNy* this, GlobalContext* globalCtx) { +void func_80ABCEEC(EnNy* this, PlayState* play) { f32 phi_f0; phi_f0 = this->unk_1E0; @@ -223,7 +223,7 @@ void func_80ABCEEC(EnNy* this, GlobalContext* globalCtx) { this->unk_1E0 = phi_f0; } -void EnNy_Move(EnNy* this, GlobalContext* globalCtx) { +void EnNy_Move(EnNy* this, PlayState* play) { f32 yawDiff; s32 stoneTimer; @@ -247,7 +247,7 @@ void EnNy_Move(EnNy* this, GlobalContext* globalCtx) { } } -void EnNy_TurnToStone(EnNy* this, GlobalContext* globalCtx) { +void EnNy_TurnToStone(EnNy* this, PlayState* play) { f32 phi_f0; phi_f0 = this->unk_1E0; @@ -267,7 +267,7 @@ void EnNy_TurnToStone(EnNy* this, GlobalContext* globalCtx) { this->unk_1E0 = phi_f0; } -void func_80ABD11C(EnNy* this, GlobalContext* globalCtx) { +void func_80ABD11C(EnNy* this, PlayState* play) { s32 phi_v0; s32 phi_v1; @@ -288,7 +288,7 @@ void func_80ABD11C(EnNy* this, GlobalContext* globalCtx) { this->unk_1D8 = phi_v1; } -s32 EnNy_CollisionCheck(EnNy* this, GlobalContext* globalCtx) { +s32 EnNy_CollisionCheck(EnNy* this, PlayState* play) { u8 sp3F; Vec3f effectPos; @@ -335,10 +335,10 @@ s32 EnNy_CollisionCheck(EnNy* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 0; this->actor.flags &= ~ACTOR_FLAG_0; this->unk_1D0 = sp3F; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return 1; } - EffectSsHitMark_SpawnFixedScale(globalCtx, 0, &effectPos); + EffectSsHitMark_SpawnFixedScale(play, 0, &effectPos); return 0; } } @@ -366,7 +366,7 @@ void func_80ABD3B8(EnNy* this, f32 arg1, f32 arg2) { } } -void EnNy_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Update(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; f32 temp_f20; f32 temp_f22; @@ -385,13 +385,13 @@ void EnNy_Update(Actor* thisx, GlobalContext* globalCtx) { func_80ABD3B8(this, temp_f22 + 10.0f, temp_f22 - 10.0f); Actor_MoveForward(&this->actor); Math_StepToF(&this->unk_1E4, this->unk_1E8, 0.1f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.prevPos.y -= temp_f22; this->actor.world.pos.y -= temp_f22; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 7); this->unk_1F0 = temp_f22; this->actor.world.pos.y += temp_f22; - if (EnNy_CollisionCheck(this, globalCtx) != 0) { + if (EnNy_CollisionCheck(this, play) != 0) { for (i = 0; i < 8; i++) { this->unk_1F8[i].x = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.x); this->unk_1F8[i].y = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.y); @@ -404,13 +404,13 @@ void EnNy_Update(Actor* thisx, GlobalContext* globalCtx) { return; } if (this->unk_1E0 > 0.25f) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx) { +void EnNy_SetupDie(EnNy* this, PlayState* play) { s32 effectScale; s32 i; Vec3f effectPos; @@ -424,14 +424,14 @@ void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx) { effectPos.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; effectScale = Rand_S16Offset(0x50, 0x64); - EffectSsDtBubble_SpawnColorProfile(globalCtx, &effectPos, &effectVelocity, &effectAccel, effectScale, + EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 0, 1); } for (i = 0; i < 0x14; i++) { effectPos.x = Rand_CenteredFloat(30.0f) + this->actor.world.pos.x; effectPos.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - EffectSsBubble_Spawn(globalCtx, &effectPos, 10.0f, 10.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &effectPos, 10.0f, 10.0f, 30.0f, 0.25f); } } for (i = 0; i < 8; i++) { @@ -441,16 +441,16 @@ void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx) { } this->timer = 0; if (this->unk_1D0 == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xA0); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, 8); + Item_DropCollectible(play, &this->actor.world.pos, 8); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_NYU_DEAD); this->actionFunc = EnNy_Die; } } -void EnNy_Die(EnNy* this, GlobalContext* globalCtx) { +void EnNy_Die(EnNy* this, PlayState* play) { s32 i; if (this->actor.yDistToWater > 0.0f) { @@ -482,19 +482,19 @@ void EnNy_Die(EnNy* this, GlobalContext* globalCtx) { } } -void EnNy_UpdateDeath(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_UpdateDeath(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; this->timer++; if (this->unk_1CA != 0) { this->unk_1CA--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnNy_UpdateUnused(Actor* thisx, GlobalContext* globalCtx2) { +void EnNy_UpdateUnused(Actor* thisx, PlayState* play2) { EnNy* this = (EnNy*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 sp3C; f32 temp_f0; @@ -506,12 +506,12 @@ void EnNy_UpdateUnused(Actor* thisx, GlobalContext* globalCtx2) { this->actor.prevPos.y -= temp_f0; this->actor.world.pos.y -= temp_f0; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 7); this->unk_1F0 = temp_f0; this->actor.world.pos.y += temp_f0; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); Math_StepToF(&this->unk_1E4, this->unk_1E8, 0.1f); } @@ -522,15 +522,15 @@ static Vec3f sFireOffsets[] = { { 0.0f, 0.0f, -5.0f }, }; -void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Draw(Actor* thisx, PlayState* play) { s32 pad; EnNy* this = (EnNy*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Collider_UpdateSpheres(0, &this->collider); - func_8002ED80(&this->actor, globalCtx, 1); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_8002ED80(&this->actor, play, 1); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); @@ -542,13 +542,13 @@ void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gEnNyRockBodyDL); if (this->unk_1E0 > 0.25f) { Matrix_Scale(this->unk_1E0, this->unk_1E0, this->unk_1E0, MTXMODE_APPLY); - func_8002EBCC(&this->actor, globalCtx, 1); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_8002EBCC(&this->actor, play, 1); + func_80093D18(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++, gEnNySpikeDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->unk_1CA != 0) { Vec3f tempVec; Vec3f* fireOffset; @@ -561,19 +561,19 @@ void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx) { tempVec.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + fireOffset->x); tempVec.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + fireOffset->y); tempVec.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + fireOffset->z); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &tempVec, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &tempVec, 100, 0, 0, -1); } } } -void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_DrawDeathEffect(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; Vec3f* temp; f32 scale; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0x00, 0x00, 0x00, 0xFF); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); gDPPipeSync(POLY_OPA_DISP++); @@ -584,13 +584,13 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(temp->x, temp->y, temp->z, MTXMODE_NEW); scale = this->actor.scale.x * 0.4f * (1.0f + (i * 0.04f)); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gEnNyRockBodyDL); FrameInterpolation_RecordCloseChild(); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->unk_1CA != 0) { Vec3f tempVec; Vec3f* fireOffset; @@ -603,7 +603,7 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { tempVec.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + fireOffset->x); tempVec.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + fireOffset->y); tempVec.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + fireOffset->z); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &tempVec, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &tempVec, 100, 0, 0, -1); } } } diff --git a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h index 407a2d761..6ac92a769 100644 --- a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h +++ b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h @@ -6,7 +6,7 @@ struct EnNy; -typedef void (*EnNyActionFunc)(struct EnNy*, GlobalContext*); +typedef void (*EnNyActionFunc)(struct EnNy*, PlayState*); typedef struct EnNy { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.c b/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.c index 50bfef8b5..7ff6d8727 100644 --- a/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.c +++ b/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnOE2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOE2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOE2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOE2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOE2_Init(Actor* thisx, PlayState* play); +void EnOE2_Destroy(Actor* thisx, PlayState* play); +void EnOE2_Update(Actor* thisx, PlayState* play); +void EnOE2_Draw(Actor* thisx, PlayState* play); -void EnOE2_DoNothing(EnOE2* this, GlobalContext* globalCtx); +void EnOE2_DoNothing(EnOE2* this, PlayState* play); const ActorInit En_OE2_InitVars = { ACTOR_EN_OE2, @@ -32,20 +32,20 @@ void EnOE2_SetupAction(EnOE2* this, EnOE2ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnOE2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Init(Actor* thisx, PlayState* play) { EnOE2* this = (EnOE2*)thisx; EnOE2_SetupAction(this, EnOE2_DoNothing); } -void EnOE2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Destroy(Actor* thisx, PlayState* play) { } -void EnOE2_DoNothing(EnOE2* this, GlobalContext* globalCtx) { +void EnOE2_DoNothing(EnOE2* this, PlayState* play) { } -void EnOE2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Update(Actor* thisx, PlayState* play) { } -void EnOE2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Draw(Actor* thisx, PlayState* play) { } diff --git a/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.h b/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.h index b12b8a0a6..635495bb7 100644 --- a/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.h +++ b/soh/src/overlays/actors/ovl_En_OE2/z_en_oe2.h @@ -6,7 +6,7 @@ struct EnOE2; -typedef void (*EnOE2ActionFunc)(struct EnOE2*, GlobalContext*); +typedef void (*EnOE2ActionFunc)(struct EnOE2*, PlayState*); typedef struct EnOE2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index a3be05726..68802026e 100644 --- a/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaEffect_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaEffect_Update(Actor* thisx, GlobalContext* globalCtx); +void EnOkarinaEffect_Init(Actor* thisx, PlayState* play); +void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play); +void EnOkarinaEffect_Update(Actor* thisx, PlayState* play); -void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCtx); -void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx); +void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, PlayState* play); +void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, PlayState* play); const ActorInit En_Okarina_Effect_InitVars = { ACTOR_EN_OKARINA_EFFECT, @@ -33,55 +33,55 @@ void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, EnOkarinaEffectActionFun this->actionFunc = actionFunc; } -void EnOkarinaEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; - globalCtx->envCtx.unk_F2[0] = 0; - if ((gWeatherMode != 4) && (gWeatherMode != 5) && (globalCtx->envCtx.gloomySkyMode == 1)) { - globalCtx->envCtx.gloomySkyMode = 2; // end gloomy sky - Environment_StopStormNatureAmbience(globalCtx); + play->envCtx.unk_F2[0] = 0; + if ((gWeatherMode != 4) && (gWeatherMode != 5) && (play->envCtx.gloomySkyMode == 1)) { + play->envCtx.gloomySkyMode = 2; // end gloomy sky + Environment_StopStormNatureAmbience(play); } - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; + play->envCtx.lightningMode = LIGHTNING_MODE_LAST; } -void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Init(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; osSyncPrintf("\n\n"); // "Ocarina Storm Effect" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ オカリナあらし効果ビカビカビカ〜 ☆☆☆☆☆ \n" VT_RST); osSyncPrintf("\n\n"); - if (globalCtx->envCtx.unk_EE[1] != 0) { + if (play->envCtx.unk_EE[1] != 0) { Actor_Kill(&this->actor); } EnOkarinaEffect_SetupAction(this, EnOkarinaEffect_TriggerStorm); } -void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) { +void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, PlayState* play) { this->timer = 400; // 20 seconds - globalCtx->envCtx.unk_F2[0] = 20; // rain intensity target - globalCtx->envCtx.gloomySkyMode = 1; // start gloomy sky - if ((gWeatherMode != 0) || globalCtx->envCtx.unk_17 != 0) { - globalCtx->envCtx.unk_DE = 1; + play->envCtx.unk_F2[0] = 20; // rain intensity target + play->envCtx.gloomySkyMode = 1; // start gloomy sky + if ((gWeatherMode != 0) || play->envCtx.unk_17 != 0) { + play->envCtx.unk_DE = 1; } - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON; - Environment_PlayStormNatureAmbience(globalCtx); + play->envCtx.lightningMode = LIGHTNING_MODE_ON; + Environment_PlayStormNatureAmbience(play); EnOkarinaEffect_SetupAction(this, EnOkarinaEffect_ManageStorm); } -void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) { - Flags_UnsetEnv(globalCtx, 5); // clear storms env flag - if (((globalCtx->pauseCtx.state == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && - (globalCtx->msgCtx.msgLength == 0) && (!FrameAdvance_IsEnabled(globalCtx)) && - ((globalCtx->transitionMode == 0) || (gSaveContext.gameMode != 0))) || +void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, PlayState* play) { + Flags_UnsetEnv(play, 5); // clear storms env flag + if (((play->pauseCtx.state == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->msgCtx.msgLength == 0) && (!FrameAdvance_IsEnabled(play)) && + ((play->transitionMode == 0) || (gSaveContext.gameMode != 0))) || (this->timer >= 250)) { - if (globalCtx->envCtx.indoors || globalCtx->envCtx.unk_1F != 1) { + if (play->envCtx.indoors || play->envCtx.unk_1F != 1) { this->timer--; } osSyncPrintf("\nthis->timer=[%d]", this->timer); if (this->timer == 308) { osSyncPrintf("\n\n\n豆よ のびろ 指定\n\n\n"); // "Let's grow some beans" - Flags_SetEnv(globalCtx, 5); // set storms env flag + Flags_SetEnv(play, 5); // set storms env flag } } @@ -90,33 +90,33 @@ void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx } if (this->timer == 0) { - globalCtx->envCtx.unk_F2[0] = 0; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { - Environment_StopStormNatureAmbience(globalCtx); + play->envCtx.unk_F2[0] = 0; + if (play->csCtx.state == CS_STATE_IDLE) { + Environment_StopStormNatureAmbience(play); } else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); } osSyncPrintf("\n\n\nE_wether_flg=[%d]", gWeatherMode); - osSyncPrintf("\nrain_evt_trg=[%d]\n\n", globalCtx->envCtx.gloomySkyMode); - if (gWeatherMode == 0 && (globalCtx->envCtx.gloomySkyMode == 1)) { - globalCtx->envCtx.gloomySkyMode = 2; // end gloomy sky + osSyncPrintf("\nrain_evt_trg=[%d]\n\n", play->envCtx.gloomySkyMode); + if (gWeatherMode == 0 && (play->envCtx.gloomySkyMode == 1)) { + play->envCtx.gloomySkyMode = 2; // end gloomy sky } else { - globalCtx->envCtx.gloomySkyMode = 0; - globalCtx->envCtx.unk_DE = 0; + play->envCtx.gloomySkyMode = 0; + play->envCtx.unk_DE = 0; } - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; + play->envCtx.lightningMode = LIGHTNING_MODE_LAST; Actor_Kill(&this->actor); } } -void EnOkarinaEffect_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Update(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, globalCtx->state.gfxCtx); + 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h b/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h index 832021711..f45c4a88e 100644 --- a/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h +++ b/soh/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h @@ -6,7 +6,7 @@ struct EnOkarinaEffect; -typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, GlobalContext*); +typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, PlayState*); typedef struct EnOkarinaEffect { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index aeb8db042..d61528867 100644 --- a/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -11,16 +11,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaTag_Update(Actor* thisx, GlobalContext* globalCtx); +void EnOkarinaTag_Init(Actor* thisx, PlayState* play); +void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play); +void EnOkarinaTag_Update(Actor* thisx, PlayState* play); -void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF0CC(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF7CC(EnOkarinaTag* this, GlobalContext* globalCtx); +void func_80ABEF2C(EnOkarinaTag* this, PlayState* play); +void func_80ABF708(EnOkarinaTag* this, PlayState* play); +void func_80ABF28C(EnOkarinaTag* this, PlayState* play); +void func_80ABF0CC(EnOkarinaTag* this, PlayState* play); +void func_80ABF4C8(EnOkarinaTag* this, PlayState* play); +void func_80ABF7CC(EnOkarinaTag* this, PlayState* play); const ActorInit En_Okarina_Tag_InitVars = { ACTOR_EN_OKARINA_TAG, @@ -38,10 +38,10 @@ const ActorInit En_Okarina_Tag_InitVars = { extern CutsceneData D_80ABF9D0[]; extern CutsceneData D_80ABFB40[]; -void EnOkarinaTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play) { } -void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaTag_Init(Actor* thisx, PlayState* play) { EnOkarinaTag* this = (EnOkarinaTag*)thisx; osSyncPrintf("\n\n"); @@ -77,7 +77,7 @@ void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 当り?\t\t ☆☆☆☆☆ %d\n" VT_RST, this->unk_158); osSyncPrintf("\n\n"); - if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) { + if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { Actor_Kill(&this->actor); } else { switch (this->type) { @@ -105,13 +105,13 @@ void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { +void func_80ABEF2C(EnOkarinaTag* this, PlayState* play) { Player* player; u16 ocarinaSong; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_15A++; - if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) { + if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { this->actor.flags &= ~ACTOR_FLAG_0; } else { if ((this->ocarinaSong != 6) || (gSaveContext.scarecrowSpawnSongSet)) { @@ -127,7 +127,7 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { ocarinaSong = 0xA; } player->stateFlags2 |= 0x800000; - func_8010BD58(globalCtx, ocarinaSong + OCARINA_ACTION_CHECK_SARIA); + func_8010BD58(play, ocarinaSong + OCARINA_ACTION_CHECK_SARIA); this->actionFunc = func_80ABF0CC; } else if ((this->actor.xzDistToPlayer < (50.0f + this->interactRange) && ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 40.0f)))) { @@ -139,58 +139,58 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { } } -void func_80ABF0CC(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABF0CC(EnOkarinaTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->actionFunc = func_80ABEF2C; } else { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } - if (globalCtx->sceneNum == SCENE_MIZUSIN) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if (play->sceneNum == SCENE_MIZUSIN) { + play->msgCtx.msgMode = MSGMODE_PAUSED; } - if ((globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (globalCtx->sceneNum != SCENE_YOUSEI_IZUMI_YOKO)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if ((play->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (play->sceneNum != SCENE_YOUSEI_IZUMI_YOKO)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_80ABEF2C; return; } if (this->unk_158 != 0) { - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_05) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_06) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_07) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_08) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_09) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0A) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0D)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_05) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_06) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_07) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_08) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_09) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_0A) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_0D)) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_80ABEF2C; return; } } - if ((globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05) && (globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0E)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if ((play->msgCtx.ocarinaMode >= OCARINA_MODE_05) && (play->msgCtx.ocarinaMode < OCARINA_MODE_0E)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actionFunc = func_80ABEF2C; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= 0x800000; } } } -void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABF28C(EnOkarinaTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_15A++; if ((this->ocarinaSong != 6) || (gSaveContext.scarecrowSpawnSongSet)) { - if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { this->actor.flags &= ~ACTOR_FLAG_0; } else if (((this->type != 4) || !(gSaveContext.eventChkInf[4] & 0x800)) && ((this->type != 6) || !(gSaveContext.eventChkInf[1] & 0x2000)) && @@ -199,16 +199,16 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { if (player->stateFlags2 & 0x1000000) { switch (this->type) { case 1: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_LULLABY); + func_8010BD58(play, OCARINA_ACTION_CHECK_LULLABY); break; case 2: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_STORMS); + func_8010BD58(play, OCARINA_ACTION_CHECK_STORMS); break; case 4: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_TIME); + func_8010BD58(play, OCARINA_ACTION_CHECK_TIME); break; case 6: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_LULLABY); + func_8010BD58(play, OCARINA_ACTION_CHECK_LULLABY); break; default: // "Ocarina Invisible-kun demo start check error source" @@ -228,26 +228,26 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { } } -void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABF4C8(EnOkarinaTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->actionFunc = func_80ABF28C; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { if (!gSaveContext.n64ddFlag || (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_DOOR_OF_TIME) != 2)) { func_80078884(NA_SE_SY_CORRECT_CHIME); } if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } switch (this->type) { case 1: - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); gSaveContext.eventChkInf[3] |= 0x200; break; case 2: if (!gSaveContext.n64ddFlag) { - globalCtx->csCtx.segment = D_80ABF9D0; + play->csCtx.segment = D_80ABF9D0; gSaveContext.cutsceneTrigger = 1; } else { gSaveContext.eventChkInf[6] |= 0x80; @@ -265,18 +265,18 @@ void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_OCARINA_ERROR); break; } else { - Flags_SetEnv(globalCtx, 2); + Flags_SetEnv(play, 2); func_80078884(NA_SE_SY_CORRECT_CHIME); } } else { - globalCtx->csCtx.segment = D_80ABFB40; + play->csCtx.segment = D_80ABFB40; gSaveContext.cutsceneTrigger = 1; } break; case 6: // Don't start the cutscene in a rando save. if (!(gSaveContext.n64ddFlag)) { - globalCtx->csCtx.segment = LINK_IS_ADULT ? SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_003C80) + play->csCtx.segment = LINK_IS_ADULT ? SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_003C80) : SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_005020); gSaveContext.cutsceneTrigger = 1; } @@ -286,27 +286,27 @@ void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx) { default: break; } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actionFunc = func_80ABF28C; } else { - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05) { - if (globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0E) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_05) { + if (play->msgCtx.ocarinaMode < OCARINA_MODE_0E) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actionFunc = func_80ABF28C; return; } } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= 0x800000; } } } -void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx) { +void func_80ABF708(EnOkarinaTag* this, PlayState* play) { s16 yawDiff; s16 yawDiffNew; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80ABF7CC; } else { yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; @@ -318,49 +318,49 @@ void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx) { yawDiffNew = ABS(yawDiff); if (yawDiffNew < 0x4300) { this->unk_15A = 0; - func_8002F2CC(&this->actor, globalCtx, 70.0f); + func_8002F2CC(&this->actor, play, 70.0f); } } } } -void GivePlayerRandoRewardSunSong(EnOkarinaTag* song, GlobalContext* globalCtx, RandomizerCheck check) { - Flags_SetTreasure(globalCtx, 0x1F); +void GivePlayerRandoRewardSunSong(EnOkarinaTag* song, PlayState* play, RandomizerCheck check) { + Flags_SetTreasure(play, 0x1F); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, GI_LETTER_ZELDA); - GiveItemEntryFromActor(&song->actor, globalCtx, getItemEntry, 10000.0f, 100.0f); + GiveItemEntryFromActor(&song->actor, play, getItemEntry, 10000.0f, 100.0f); } -void func_80ABF7CC(EnOkarinaTag* this, GlobalContext* globalCtx) { +void func_80ABF7CC(EnOkarinaTag* this, PlayState* play) { // "Open sesame sesame!" - osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 開けゴマゴマゴマ! ☆☆☆☆☆ %d\n" VT_RST, Message_GetState(&globalCtx->msgCtx)); + osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 開けゴマゴマゴマ! ☆☆☆☆☆ %d\n" VT_RST, Message_GetState(&play->msgCtx)); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (!gSaveContext.n64ddFlag && !CHECK_QUEST_ITEM(QUEST_SONG_SUN)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gSunSongGraveSunSongTeachCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gSunSongGraveSunSongTeachCs); gSaveContext.cutsceneTrigger = 1; - } else if (gSaveContext.n64ddFlag && !Flags_GetTreasure(globalCtx, 0x1F)) { - GivePlayerRandoRewardSunSong(this, globalCtx, RC_SONG_FROM_ROYAL_FAMILYS_TOMB); + } else if (gSaveContext.n64ddFlag && !Flags_GetTreasure(play, 0x1F)) { + GivePlayerRandoRewardSunSong(this, play, RC_SONG_FROM_ROYAL_FAMILYS_TOMB); } this->actionFunc = func_80ABF708; } } -void EnOkarinaTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaTag_Update(Actor* thisx, PlayState* play) { EnOkarinaTag* this = (EnOkarinaTag*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(0) != 0) { if (this->unk_15A != 0) { if (!(this->unk_15A & 1)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 120, 120, 120, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 120, 120, 120, 255, 4, play->state.gfxCtx); } } else { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 255, 0, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } } diff --git a/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h b/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h index 5946f7023..1192d0cfc 100644 --- a/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h +++ b/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h @@ -6,7 +6,7 @@ struct EnOkarinaTag; -typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, GlobalContext*); +typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, PlayState*); typedef struct EnOkarinaTag { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 4f775ebde..696f83c77 100644 --- a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -4,21 +4,21 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOkuta_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOkuta_Init(Actor* thisx, PlayState* play); +void EnOkuta_Destroy(Actor* thisx, PlayState* play); +void EnOkuta_Update(Actor* thisx, PlayState* play); +void EnOkuta_Draw(Actor* thisx, PlayState* play); void EnOkuta_SetupWaitToAppear(EnOkuta* this); -void EnOkuta_WaitToAppear(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_WaitToDie(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx); +void EnOkuta_WaitToAppear(EnOkuta* this, PlayState* play); +void EnOkuta_Appear(EnOkuta* this, PlayState* play); +void EnOkuta_Hide(EnOkuta* this, PlayState* play); +void EnOkuta_WaitToShoot(EnOkuta* this, PlayState* play); +void EnOkuta_Shoot(EnOkuta* this, PlayState* play); +void EnOkuta_WaitToDie(EnOkuta* this, PlayState* play); +void EnOkuta_Die(EnOkuta* this, PlayState* play); +void EnOkuta_Freeze(EnOkuta* this, PlayState* play); +void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play); const ActorInit En_Okuta_InitVars = { ACTOR_EN_OKUTA, @@ -115,7 +115,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 6500, ICHAIN_STOP), }; -void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOkuta_Init(Actor* thisx, PlayState* play) { EnOkuta* this = (EnOkuta*)thisx; s32 pad; WaterBox* outWaterBox; @@ -126,18 +126,18 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { this->numShots = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; if (thisx->params == 0) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, this->morphTable, 38); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sOctorockColliderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sOctorockColliderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); if ((this->numShots == 0xFF) || (this->numShots == 0)) { this->numShots = 1; } thisx->floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &thisx->floorPoly, &sp30, thisx, &thisx->world.pos); + BgCheck_EntityRaycastFloor4(&play->colCtx, &thisx->floorPoly, &sp30, thisx, &thisx->world.pos); //! @bug calls WaterBox_GetSurfaceImpl directly - if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, thisx->world.pos.x, thisx->world.pos.z, &ySurface, + if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, thisx->world.pos.x, thisx->world.pos.z, &ySurface, &outWaterBox) || (ySurface <= thisx->floorHeight)) { Actor_Kill(thisx); @@ -149,9 +149,9 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&thisx->shape, 1100.0f, ActorShadow_DrawCircle, 18.0f); thisx->flags &= ~ACTOR_FLAG_0; thisx->flags |= ACTOR_FLAG_4; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sProjectileColliderInit); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sProjectileColliderInit); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); this->timer = 30; thisx->shape.rot.y = 0; this->actionFunc = EnOkuta_ProjectileFly; @@ -159,41 +159,41 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOkuta_Destroy(Actor* thisx, PlayState* play) { EnOkuta* this = (EnOkuta*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnOkuta_SpawnBubbles(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SpawnBubbles(EnOkuta* this, PlayState* play) { s32 i; for (i = 0; i < 10; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -10.0f, 10.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, -10.0f, 10.0f, 30.0f, 0.25f); } } -void EnOkuta_SpawnDust(Vec3f* pos, Vec3f* velocity, s16 scaleStep, GlobalContext* globalCtx) { +void EnOkuta_SpawnDust(Vec3f* pos, Vec3f* velocity, s16 scaleStep, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 150, 150, 150, 255 }; - func_8002829C(globalCtx, pos, velocity, &accel, &primColor, &envColor, 0x190, scaleStep); + func_8002829C(play, pos, velocity, &accel, &primColor, &envColor, 0x190, scaleStep); } -void EnOkuta_SpawnSplash(EnOkuta* this, GlobalContext* globalCtx) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.home.pos, NULL, NULL, 0, 1300); +void EnOkuta_SpawnSplash(EnOkuta* this, PlayState* play) { + EffectSsGSplash_Spawn(play, &this->actor.home.pos, NULL, NULL, 0, 1300); } -void EnOkuta_SpawnRipple(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SpawnRipple(EnOkuta* this, PlayState* play) { Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = this->actor.home.pos.y; pos.z = this->actor.world.pos.z; - if ((globalCtx->gameplayFrames % 7) == 0 && + if ((play->gameplayFrames % 7) == 0 && ((this->actionFunc != EnOkuta_Shoot) || ((this->actor.world.pos.y - this->actor.home.pos.y) < 50.0f))) { - EffectSsGRipple_Spawn(globalCtx, &pos, 250, 650, 0); + EffectSsGRipple_Spawn(play, &pos, 250, 650, 0); } } @@ -204,12 +204,12 @@ void EnOkuta_SetupWaitToAppear(EnOkuta* this) { this->actor.world.pos.y = this->actor.home.pos.y; } -void EnOkuta_SetupAppear(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SetupAppear(EnOkuta* this, PlayState* play) { this->actor.draw = EnOkuta_Draw; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.flags |= ACTOR_FLAG_0; Animation_PlayOnce(&this->skelAnime, &gOctorokAppearAnim); - EnOkuta_SpawnBubbles(this, globalCtx); + EnOkuta_SpawnBubbles(this, play); this->actionFunc = EnOkuta_Appear; } @@ -224,7 +224,7 @@ void EnOkuta_SetupWaitToShoot(EnOkuta* this) { this->actionFunc = EnOkuta_WaitToShoot; } -void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SetupShoot(EnOkuta* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gOctorokShootAnim); if (this->actionFunc != EnOkuta_Shoot) { this->timer = this->numShots; @@ -232,7 +232,7 @@ void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) { this->jumpHeight = this->actor.yDistToPlayer + 20.0f; this->jumpHeight = CLAMP_MIN(this->jumpHeight, 10.0f); if (this->jumpHeight > 50.0f) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } if (this->jumpHeight > 50.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP); @@ -261,7 +261,7 @@ void EnOkuta_SetupFreeze(EnOkuta* this) { this->actionFunc = EnOkuta_Freeze; } -void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SpawnProjectile(EnOkuta* this, PlayState* play) { Vec3f pos; Vec3f velocity; f32 sin = Math_SinS(this->actor.shape.rot.y); @@ -270,7 +270,7 @@ void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + (25.0f * sin); pos.y = this->actor.world.pos.y - 6.0f; pos.z = this->actor.world.pos.z + (25.0f * cos); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OKUTA, pos.x, pos.y, pos.z, this->actor.shape.rot.x, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKUTA, pos.x, pos.y, pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0x10) != NULL) { pos.x = this->actor.world.pos.x + (40.0f * sin); pos.z = this->actor.world.pos.z + (40.0f * cos); @@ -278,19 +278,19 @@ void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) { velocity.x = 1.5f * sin; velocity.y = 0.0f; velocity.z = 1.5f * cos; - EnOkuta_SpawnDust(&pos, &velocity, 20, globalCtx); + EnOkuta_SpawnDust(&pos, &velocity, 20, play); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } -void EnOkuta_WaitToAppear(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_WaitToAppear(EnOkuta* this, PlayState* play) { this->actor.world.pos.y = this->actor.home.pos.y; if ((this->actor.xzDistToPlayer < 480.0f) && (this->actor.xzDistToPlayer > 200.0f)) { - EnOkuta_SetupAppear(this, globalCtx); + EnOkuta_SetupAppear(this, play); } } -void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Appear(EnOkuta* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -311,17 +311,17 @@ void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND); } if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } } -void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Hide(EnOkuta* this, PlayState* play) { s32 pad; Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 30.0f); if (SkelAnime_Update(&this->skelAnime)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_BUBLE); - EnOkuta_SpawnBubbles(this, globalCtx); + EnOkuta_SpawnBubbles(this, play); EnOkuta_SetupWaitToAppear(this); } else if (this->skelAnime.curFrame >= 4.0f) { Actor_SetScale(&this->actor, (6.0f - this->skelAnime.curFrame) * 0.5f * 0.01f); @@ -330,11 +330,11 @@ void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK); } if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } } -void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_WaitToShoot(EnOkuta* this, PlayState* play) { s16 temp_v0_2; s32 phi_v1; @@ -354,12 +354,12 @@ void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) { temp_v0_2 = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C, 0x38E); phi_v1 = ABS(temp_v0_2); if ((phi_v1 < 0x38E) && (this->timer == 0) && (this->actor.yDistToPlayer < 200.0f)) { - EnOkuta_SetupShoot(this, globalCtx); + EnOkuta_SetupShoot(this, play); } } } -void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Shoot(EnOkuta* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C); if (SkelAnime_Update(&this->skelAnime)) { if (this->timer != 0) { @@ -368,7 +368,7 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { if (this->timer == 0) { EnOkuta_SetupWaitToShoot(this); } else { - EnOkuta_SetupShoot(this, globalCtx); + EnOkuta_SetupShoot(this, play); } } else { f32 curFrame = this->skelAnime.curFrame; @@ -377,10 +377,10 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { this->actor.world.pos.y = (sinf((0.08333f * M_PI) * curFrame) * this->jumpHeight) + this->actor.home.pos.y; } if (Animation_OnFrame(&this->skelAnime, 6.0f)) { - EnOkuta_SpawnProjectile(this, globalCtx); + EnOkuta_SpawnProjectile(this, play); } if ((this->jumpHeight > 50.0f) && Animation_OnFrame(&this->skelAnime, 13.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } if ((this->jumpHeight > 50.0f) && Animation_OnFrame(&this->skelAnime, 13.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND); @@ -391,14 +391,14 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { } } -void EnOkuta_WaitToDie(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_WaitToDie(EnOkuta* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnOkuta_SetupDie(this); } Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 5.0f); } -void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Die(EnOkuta* this, PlayState* play) { static Vec3f accel = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 150, 150, 150, 0 }; @@ -417,11 +417,11 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { velocity.x = 0.0f; velocity.y = -0.5f; velocity.z = 0.0f; - EnOkuta_SpawnDust(&pos, &velocity, -0x14, globalCtx); + EnOkuta_SpawnDust(&pos, &velocity, -0x14, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } if (Animation_OnFrame(&this->skelAnime, 15.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND); } if (this->timer < 3) { @@ -432,13 +432,13 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, (((this->timer - 5) * 0.04f) + 0.8f) * 0.01f); } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0005f)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_BUBLE); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x70); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_BUBLE); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70); for (i = 0; i < 20; i++) { velocity.x = (Rand_ZeroOne() - 0.5f) * 7.0f; velocity.y = Rand_ZeroOne() * 7.0f; velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f; - EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->actor.world.pos, &velocity, &accel, &primColor, + EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, Rand_S16Offset(100, 50), 25, 0); } Actor_Kill(&this->actor); @@ -447,7 +447,7 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { } } -void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Freeze(EnOkuta* this, PlayState* play) { Vec3f pos; s16 temp_v1; @@ -462,15 +462,15 @@ void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) { pos.y = (this->actor.world.pos.y - 32.0f) + (8.0f * (8 - temp_v1)); pos.x = this->actor.world.pos.x + ((temp_v1 & 2) ? 10.0f : -10.0f); pos.z = this->actor.world.pos.z + ((temp_v1 & 1) ? 10.0f : -10.0f); - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 1.9f); } Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 5.0f); } -void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play) { Vec3f pos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3s sp40; this->timer--; @@ -537,14 +537,14 @@ void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) { phi_v0 = 69; gravity = -320; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, sEffectScales[i]/5, 3, 0, 70, 1, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL); } } else { - EffectSsHahen_SpawnBurst(globalCtx, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL); + EffectSsHahen_SpawnBurst(play, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL); } - 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_Kill(&this->actor); } } else if (this->timer == -300) { @@ -597,12 +597,12 @@ void EnOkuta_UpdateHeadScale(EnOkuta* this) { } } -void EnOkuta_ColliderCheck(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_ColliderCheck(EnOkuta* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, 1); if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.colChkInfo.health = 0; this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.colChkInfo.damageEffect == 3) { @@ -614,10 +614,10 @@ void EnOkuta_ColliderCheck(EnOkuta* this, GlobalContext* globalCtx) { } } -void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnOkuta_Update(Actor* thisx, PlayState* play2) { EnOkuta* this = (EnOkuta*)thisx; - GlobalContext* globalCtx = globalCtx2; - Player* player = GET_PLAYER(globalCtx); + PlayState* play = play2; + Player* player = GET_PLAYER(play); WaterBox* outWaterBox; f32 ySurface; Vec3f sp38; @@ -625,8 +625,8 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { if (!(player->stateFlags1 & 0x300000C0)) { if (this->actor.params == 0) { - EnOkuta_ColliderCheck(this, globalCtx); - if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, + EnOkuta_ColliderCheck(this, play); + if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, &outWaterBox) || (ySurface < this->actor.floorHeight)) { if (this->actor.colChkInfo.health != 0) { @@ -637,7 +637,7 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.home.pos.y = ySurface; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params == 0) { EnOkuta_UpdateHeadScale(this); this->collider.dim.height = @@ -647,14 +647,14 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { sp34 = false; Actor_MoveForward(&this->actor); Math_Vec3f_Copy(&sp38, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 30.0f, 5); if ((this->actor.bgCheckFlags & 8) && - SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { + SurfaceType_IsIgnoredByProjectiles(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { sp34 = true; this->actor.bgCheckFlags &= ~8; } if ((this->actor.bgCheckFlags & 1) && - SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { + SurfaceType_IsIgnoredByProjectiles(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { sp34 = true; this->actor.bgCheckFlags &= ~1; } @@ -669,18 +669,18 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { } if (this->actor.params == 0x10) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnOkuta_WaitToAppear) { if ((this->actionFunc != EnOkuta_Die) && (this->actionFunc != EnOkuta_WaitToDie) && (this->actionFunc != EnOkuta_Freeze)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 15.0f); if ((this->actor.params == 0) && (this->actor.draw != NULL)) { - EnOkuta_SpawnRipple(this, globalCtx); + EnOkuta_SpawnRipple(this, play); } } } @@ -721,7 +721,7 @@ s32 EnOkuta_GetSnoutScale(EnOkuta* this, f32 curFrame, Vec3f* scale) { return true; } -s32 EnOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnOkuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnOkuta* this = (EnOkuta*)thisx; f32 curFrame = this->skelAnime.curFrame; @@ -745,37 +745,37 @@ s32 EnOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnOkuta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOkuta_Draw(Actor* thisx, PlayState* play) { EnOkuta* this = (EnOkuta*)thisx; s32 pad; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actor.params == 0) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnOkuta_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnOkuta_OverrideLimbDraw, NULL, this); } else { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (CVar_GetS32("gNewDrops", 0) != 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6), + 1 * (play->state.frames * 6), 32, 32, 1, 1 * (play->state.frames * 6), + 1 * (play->state.frames * 6), 32, 32)); Matrix_Scale(7.0f,7.0f,7.0f,MTXMODE_APPLY); Matrix_RotateX(thisx->home.rot.z * (M_PI / 0x8000), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gSilverRockDL); } else { - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(this->actor.home.rot.z * (M_PI / 0x8000), 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++, gOctorokProjectileDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h index 88beeaa1a..01c2ba114 100644 --- a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h +++ b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h @@ -6,7 +6,7 @@ struct EnOkuta; -typedef void (*EnOkutaActionFunc)(struct EnOkuta*, GlobalContext*); +typedef void (*EnOkutaActionFunc)(struct EnOkuta*, PlayState*); typedef struct EnOkuta { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 79bc37ca8..2d45be35d 100644 --- a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -16,29 +16,29 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawKokiriShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawPotionShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawBombchuShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawBazaarShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawGoronShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, GlobalContext* globalCtx); +void EnOssan_Init(Actor* thisx, PlayState* play); +void EnOssan_Destroy(Actor* thisx, PlayState* play); +void EnOssan_Update(Actor* thisx, PlayState* play); +void EnOssan_DrawKokiriShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawPotionShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawBombchuShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawBazaarShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawZoraShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawGoronShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, PlayState* play); -void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_MainActionFunc(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_InitActionFunc(EnOssan* this, PlayState* play); +void EnOssan_MainActionFunc(EnOssan* this, PlayState* play); -void EnOssan_TalkDefaultShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkKokiriShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkKakarikoPotionShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkBombchuShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkMarketPotionShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkBazaarShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkZoraShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkGoronShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkHappyMaskShopkeeper(GlobalContext* globalCtx); +void EnOssan_TalkDefaultShopkeeper(PlayState* play); +void EnOssan_TalkKokiriShopkeeper(PlayState* play); +void EnOssan_TalkKakarikoPotionShopkeeper(PlayState* play); +void EnOssan_TalkBombchuShopkeeper(PlayState* play); +void EnOssan_TalkMarketPotionShopkeeper(PlayState* play); +void EnOssan_TalkBazaarShopkeeper(PlayState* play); +void EnOssan_TalkZoraShopkeeper(PlayState* play); +void EnOssan_TalkGoronShopkeeper(PlayState* play); +void EnOssan_TalkHappyMaskShopkeeper(PlayState* play); s16 ShopItemDisp_Default(s16 v); s16 ShopItemDisp_SpookyMask(s16 v); @@ -48,45 +48,45 @@ s16 ShopItemDisp_ZoraMask(s16 v); s16 ShopItemDisp_GoronMask(s16 v); s16 ShopItemDisp_GerudoMask(s16 v); -void EnOssan_InitKokiriShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitPotionShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitBombchuShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitBazaarShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitZoraShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitGoronShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitPotionShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitBombchuShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, PlayState* play); -void EnOssan_State_Idle(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_StartConversation(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_TalkingToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_ItemSelected(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectMilkBottle(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectWeirdEgg(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectUnimplementedItem(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectBombs(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_CantGetItem(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_GiveItemWithFanfare(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_ItemPurchased(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_GiveLonLonMilk(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_21(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_22(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_QuickBuyDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LendMaskOfTruth(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_GiveDiscountDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); +void EnOssan_State_Idle(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_StartConversation(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_FacingShopkeeper(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_TalkingToShopkeeper(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LookToLeftShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LookToRightShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_BrowseLeftShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_BrowseRightShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_ItemSelected(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectMilkBottle(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectWeirdEgg(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectUnimplementedItem(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectBombs(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_CantGetItem(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_GiveItemWithFanfare(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_ItemPurchased(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_GiveLonLonMilk(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_21(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_22(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_QuickBuyDialog(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectMaskItem(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LendMaskOfTruth(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_GiveDiscountDialog(EnOssan* this, PlayState* play, Player* player); -void EnOssan_Obj3ToSeg6(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play); -void EnOssan_StartShopping(GlobalContext* globalCtx, EnOssan* this); +void EnOssan_StartShopping(PlayState* play, EnOssan* this); void EnOssan_WaitForBlink(EnOssan* this); void EnOssan_Blink(EnOssan* this); @@ -96,7 +96,7 @@ u16 EnOssan_SetupHelloDialog(EnOssan* this); s32 EnOssan_TakeItemOffShelf(EnOssan* this); s32 EnOssan_ReturnItemToShelf(EnOssan* this); void EnOssan_ResetItemPosition(EnOssan* this); -void EnOssan_SetStateGiveDiscountDialog(GlobalContext* globalCtx, EnOssan* this); +void EnOssan_SetStateGiveDiscountDialog(PlayState* play, EnOssan* this); #define CURSOR_INVALID 0xFF @@ -417,7 +417,7 @@ s16 ShopItemDisp_GerudoMask(s16 v) { return -1; } -void EnOssan_SpawnItemsOnShelves(EnOssan* this, GlobalContext* globalCtx, ShopItem* shopItems) { +void EnOssan_SpawnItemsOnShelves(EnOssan* this, PlayState* play, ShopItem* shopItems) { EnTana* shelves; s16 itemParams; s32 i; @@ -428,7 +428,7 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, GlobalContext* globalCtx, ShopIt } else { itemParams = sShopItemReplaceFunc[shopItems->shopItemIndex](shopItems->shopItemIndex); if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHOPSANITY)) { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, i); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, i); if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { itemParams = shopItemIdentity.enGirlAShopItem; @@ -443,7 +443,7 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, GlobalContext* globalCtx, ShopIt } else { shelves = this->shelves; this->shelfSlots[i] = (EnGirlA*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, shelves->actor.world.pos.x + shopItems->xOffset, + &play->actorCtx, play, ACTOR_EN_GIRLA, shelves->actor.world.pos.x + shopItems->xOffset, shelves->actor.world.pos.y + shopItems->yOffset, shelves->actor.world.pos.z + shopItems->zOffset, shelves->actor.shape.rot.x, shelves->actor.shape.rot.y + sItemShelfRot[i], shelves->actor.shape.rot.z, itemParams); @@ -455,7 +455,7 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, GlobalContext* globalCtx, ShopIt } } -void EnOssan_UpdateShopOfferings(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_UpdateShopOfferings(EnOssan* this, PlayState* play) { s32 i; ShopItem* storeItems; ShopItem* shopItem; @@ -469,7 +469,7 @@ void EnOssan_UpdateShopOfferings(EnOssan* this, GlobalContext* globalCtx) { if (params >= 0) { this->shelfSlots[i] = (EnGirlA*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, + &play->actorCtx, play, ACTOR_EN_GIRLA, this->shelves->actor.world.pos.x + shopItem->xOffset, this->shelves->actor.world.pos.y + shopItem->yOffset, this->shelves->actor.world.pos.z + shopItem->zOffset, this->shelves->actor.shape.rot.x, @@ -480,91 +480,91 @@ void EnOssan_UpdateShopOfferings(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_TalkDefaultShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x9E); +void EnOssan_TalkDefaultShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x9E); } -void EnOssan_TalkKakarikoPotionShopkeeper(GlobalContext* globalCtx) { - if (globalCtx->curSpawn == 0) { - Message_ContinueTextbox(globalCtx, 0x5046); +void EnOssan_TalkKakarikoPotionShopkeeper(PlayState* play) { + if (play->curSpawn == 0) { + Message_ContinueTextbox(play, 0x5046); } else { - Message_ContinueTextbox(globalCtx, 0x504E); + Message_ContinueTextbox(play, 0x504E); } } -void EnOssan_TalkMarketPotionShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x504E); +void EnOssan_TalkMarketPotionShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x504E); } -void EnOssan_TalkKokiriShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x10BA); +void EnOssan_TalkKokiriShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x10BA); } -void EnOssan_TalkBazaarShopkeeper(GlobalContext* globalCtx) { - if (globalCtx->curSpawn == 0) { - Message_ContinueTextbox(globalCtx, 0x9D); +void EnOssan_TalkBazaarShopkeeper(PlayState* play) { + if (play->curSpawn == 0) { + Message_ContinueTextbox(play, 0x9D); } else { - Message_ContinueTextbox(globalCtx, 0x9C); + Message_ContinueTextbox(play, 0x9C); } } -void EnOssan_TalkBombchuShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x7076); +void EnOssan_TalkBombchuShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x7076); } -void EnOssan_TalkZoraShopkeeper(GlobalContext* globalCtx) { +void EnOssan_TalkZoraShopkeeper(PlayState* play) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { - Message_ContinueTextbox(globalCtx, 0x403A); + Message_ContinueTextbox(play, 0x403A); } else { - Message_ContinueTextbox(globalCtx, 0x403B); + Message_ContinueTextbox(play, 0x403B); } } // Goron City, Goron -void EnOssan_TalkGoronShopkeeper(GlobalContext* globalCtx) { +void EnOssan_TalkGoronShopkeeper(PlayState* play) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { if (gSaveContext.eventChkInf[2] & 0x20) { - Message_ContinueTextbox(globalCtx, 0x3028); + Message_ContinueTextbox(play, 0x3028); } else if (CUR_UPG_VALUE(UPG_STRENGTH) != 0) { - Message_ContinueTextbox(globalCtx, 0x302D); + Message_ContinueTextbox(play, 0x302D); } else { - Message_ContinueTextbox(globalCtx, 0x300F); + Message_ContinueTextbox(play, 0x300F); } } else if ((!gSaveContext.n64ddFlag && !CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) || (gSaveContext.n64ddFlag && !Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_FIRE_TEMPLE))) { - Message_ContinueTextbox(globalCtx, 0x3057); + Message_ContinueTextbox(play, 0x3057); } else { - Message_ContinueTextbox(globalCtx, 0x305B); + Message_ContinueTextbox(play, 0x305B); } } // Happy Mask Shop -void EnOssan_TalkHappyMaskShopkeeper(GlobalContext* globalCtx) { +void EnOssan_TalkHappyMaskShopkeeper(PlayState* play) { if ((gSaveContext.itemGetInf[3] & 0x100) // Sold Keaton Mask && (gSaveContext.itemGetInf[3] & 0x200) // Sold Skull Mask && (gSaveContext.itemGetInf[3] & 0x400) // Sold Spooky Mask && (gSaveContext.itemGetInf[3] & 0x800)) { // Sold Bunny Hood - Message_ContinueTextbox(globalCtx, 0x70AE); + Message_ContinueTextbox(play, 0x70AE); } else { - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 1: - Message_ContinueTextbox(globalCtx, 0x70A4); + Message_ContinueTextbox(play, 0x70A4); break; case 0: - Message_ContinueTextbox(globalCtx, 0x70A3); + Message_ContinueTextbox(play, 0x70A3); break; } } } -void EnOssan_UpdateCameraDirection(EnOssan* this, GlobalContext* globalCtx, f32 cameraFaceAngle) { +void EnOssan_UpdateCameraDirection(EnOssan* this, PlayState* play, f32 cameraFaceAngle) { this->cameraFaceAngle = cameraFaceAngle; - Camera_SetCameraData(GET_ACTIVE_CAM(globalCtx), 0xC, NULL, NULL, cameraFaceAngle, 0, 0); + Camera_SetCameraData(GET_ACTIVE_CAM(play), 0xC, NULL, NULL, cameraFaceAngle, 0, 0); } -s32 EnOssan_TryGetObjBankIndexes(EnOssan* this, GlobalContext* globalCtx, s16* objectIds) { +s32 EnOssan_TryGetObjBankIndexes(EnOssan* this, PlayState* play, s16* objectIds) { if (objectIds[1] != OBJECT_ID_MAX) { - this->objBankIndex2 = Object_GetIndex(&globalCtx->objectCtx, objectIds[1]); + this->objBankIndex2 = Object_GetIndex(&play->objectCtx, objectIds[1]); if (this->objBankIndex2 < 0) { return false; } @@ -572,7 +572,7 @@ s32 EnOssan_TryGetObjBankIndexes(EnOssan* this, GlobalContext* globalCtx, s16* o this->objBankIndex2 = -1; } if (objectIds[2] != OBJECT_ID_MAX) { - this->objBankIndex3 = Object_GetIndex(&globalCtx->objectCtx, objectIds[2]); + this->objBankIndex3 = Object_GetIndex(&play->objectCtx, objectIds[2]); if (this->objBankIndex3 < 0) { return false; } @@ -582,7 +582,7 @@ s32 EnOssan_TryGetObjBankIndexes(EnOssan* this, GlobalContext* globalCtx, s16* o return true; } -void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Init(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; s32 pad; s16* objectIds; @@ -622,7 +622,7 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { } objectIds = sShopkeeperObjectIds[this->actor.params]; - this->objBankIndex1 = Object_GetIndex(&globalCtx->objectCtx, objectIds[0]); + this->objBankIndex1 = Object_GetIndex(&play->objectCtx, objectIds[0]); if (this->objBankIndex1 < 0) { Actor_Kill(&this->actor); @@ -633,12 +633,12 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (EnOssan_TryGetObjBankIndexes(this, globalCtx, objectIds) == 0) { + if (EnOssan_TryGetObjBankIndexes(this, play, objectIds) == 0) { Actor_Kill(&this->actor); osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("予備バンクが無いよ!!(%s)\n", sShopkeeperPrintName[this->actor.params]); osSyncPrintf(VT_RST); - ASSERT(EnOssan_TryGetObjBankIndexes(this, globalCtx, objectIds) == 0); + ASSERT(EnOssan_TryGetObjBankIndexes(this, play, objectIds) == 0); return; } @@ -646,124 +646,124 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { EnOssan_SetupAction(this, EnOssan_InitActionFunc); } -void EnOssan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Destroy(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnOssan_UpdateCursorPos(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_UpdateCursorPos(PlayState* play, EnOssan* this) { s16 x; s16 y; - Actor_GetScreenPos(globalCtx, &this->shelfSlots[this->cursorIndex]->actor, &x, &y); + Actor_GetScreenPos(play, &this->shelfSlots[this->cursorIndex]->actor, &x, &y); this->cursorX = x; this->cursorY = y; } -void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { + Player* player = GET_PLAYER(play); // "End of conversation!" osSyncPrintf(VT_FGCOL(YELLOW) "%s[%d]:★★★ 会話終了!! ★★★" VT_RST "\n", __FILE__, __LINE__); YREG(31) = 0; - Actor_ProcessTalkRequest(&this->actor, globalCtx); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + Actor_ProcessTalkRequest(&this->actor, play); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - func_800BC490(globalCtx, 1); + func_800BC490(play, 1); Interface_ChangeAlpha(50); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); this->actor.textId = EnOssan_SetupHelloDialog(this); this->stateFlag = OSSAN_STATE_IDLE; } -s32 EnOssan_TestEndInteraction(EnOssan* this, GlobalContext* globalCtx, Input* input) { +s32 EnOssan_TestEndInteraction(EnOssan* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return true; } else { return false; } } -s32 EnOssan_TestCancelOption(EnOssan* this, GlobalContext* globalCtx, Input* input) { +s32 EnOssan_TestCancelOption(EnOssan* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); return true; } else { return false; } } -void EnOssan_SetStateStartShopping(GlobalContext* globalCtx, EnOssan* this, u8 skipHelloState) { +void EnOssan_SetStateStartShopping(PlayState* play, EnOssan* this, u8 skipHelloState) { YREG(31) = 1; this->headRot = this->headTargetRot = 0; - Interface_SetDoAction(globalCtx, DO_ACTION_NEXT); - EnOssan_UpdateCameraDirection(this, globalCtx, 0); + Interface_SetDoAction(play, DO_ACTION_NEXT); + EnOssan_UpdateCameraDirection(this, play, 0); if (!skipHelloState) { this->stateFlag = OSSAN_STATE_START_CONVERSATION; } else { - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } -void EnOssan_StartShopping(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_StartShopping(PlayState* play, EnOssan* this) { this->stateFlag = OSSAN_STATE_FACING_SHOPKEEPER; if (this->actor.params == OSSAN_TYPE_MASK) { // if all masks have been sold, give the option to ask about the mask of truth if ((gSaveContext.itemGetInf[3] & 0x100) && (gSaveContext.itemGetInf[3] & 0x200) && (gSaveContext.itemGetInf[3] & 0x400) && (gSaveContext.itemGetInf[3] & 0x800)) { - Message_ContinueTextbox(globalCtx, 0x70AD); + Message_ContinueTextbox(play, 0x70AD); } else { - Message_ContinueTextbox(globalCtx, 0x70A2); + Message_ContinueTextbox(play, 0x70A2); } } else { - Message_ContinueTextbox(globalCtx, 0x83); + Message_ContinueTextbox(play, 0x83); } - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = true; this->stickLeftPrompt.isEnabled = true; - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); } -void EnOssan_ChooseTalkToOwner(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_ChooseTalkToOwner(PlayState* play, EnOssan* this) { this->stateFlag = OSSAN_STATE_TALKING_TO_SHOPKEEPER; - sShopkeeperTalkOwner[this->actor.params](globalCtx); - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + sShopkeeperTalkOwner[this->actor.params](play); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; } -void EnOssan_SetLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_SetLookToShopkeeperFromShelf(PlayState* play, EnOssan* this) { func_80078884(NA_SE_SY_CURSOR); this->drawCursor = 0; this->stateFlag = OSSAN_STATE_LOOK_SHOPKEEPER; } -void EnOssan_State_Idle(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_Idle(EnOssan* this, PlayState* play, Player* player) { this->headTargetRot = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { // "Start conversation!!" osSyncPrintf(VT_FGCOL(YELLOW) "★★★ 会話開始!! ★★★" VT_RST "\n"); player->stateFlags2 |= 0x20000000; - func_800BC590(globalCtx); - EnOssan_SetStateStartShopping(globalCtx, this, false); + func_800BC590(play); + EnOssan_SetStateStartShopping(play, this, false); } else if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100); + func_8002F2CC(&this->actor, play, 100); } } -void EnOssan_UpdateJoystickInputState(GlobalContext* globalCtx, EnOssan* this) { - Input* input = &globalCtx->state.input[0]; +void EnOssan_UpdateJoystickInputState(PlayState* play, EnOssan* this) { + Input* input = &play->state.input[0]; s8 stickX = input->rel.stick_x; s8 stickY = input->rel.stick_y; @@ -870,11 +870,11 @@ u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIndex, u8 shelfSlotMax) { } // pay salesman back -void EnOssan_TryPaybackMask(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_TryPaybackMask(EnOssan* this, PlayState* play) { s16 price = sMaskPaymentPrice[this->happyMaskShopState]; if (gSaveContext.rupees < price) { - Message_ContinueTextbox(globalCtx, 0x70A8); + Message_ContinueTextbox(play, 0x70A8); this->happyMaskShopkeeperEyeIdx = 1; this->happyMaskShopState = OSSAN_HAPPY_STATE_ANGRY; } else { @@ -882,7 +882,7 @@ void EnOssan_TryPaybackMask(EnOssan* this, GlobalContext* globalCtx) { if (this->happyMaskShopState == OSSAN_HAPPY_STATE_REQUEST_PAYMENT_BUNNY_HOOD) { gSaveContext.eventChkInf[8] |= 0x8000; - Message_ContinueTextbox(globalCtx, 0x70A9); + Message_ContinueTextbox(play, 0x70A9); this->happyMaskShopState = OSSAN_HAPPY_STATE_ALL_MASKS_SOLD; return; } @@ -895,80 +895,80 @@ void EnOssan_TryPaybackMask(EnOssan* this, GlobalContext* globalCtx) { gSaveContext.eventChkInf[8] |= 0x2000; } - Message_ContinueTextbox(globalCtx, 0x70A7); + Message_ContinueTextbox(play, 0x70A7); this->happyMaskShopState = OSSAN_HAPPY_STATE_NONE; } this->stateFlag = OSSAN_STATE_START_CONVERSATION; } -void EnOssan_State_StartConversation(EnOssan* this, GlobalContext* globalCtx, Player* player) { - u8 dialogState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_State_StartConversation(EnOssan* this, PlayState* play, Player* player) { + u8 dialogState = Message_GetState(&play->msgCtx); if (this->actor.params == OSSAN_TYPE_MASK && dialogState == TEXT_STATE_CHOICE) { - if (!EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0]) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0]) && + Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); break; case 1: - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); break; } } - } else if (dialogState == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + } else if (dialogState == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { func_80078884(NA_SE_SY_MESSAGE_PASS); switch (this->happyMaskShopState) { case OSSAN_HAPPY_STATE_ALL_MASKS_SOLD: - Message_ContinueTextbox(globalCtx, 0x70AA); + Message_ContinueTextbox(play, 0x70AA); this->stateFlag = OSSAN_STATE_LEND_MASK_OF_TRUTH; return; case OSSAN_HAPPY_STATE_BORROWED_FIRST_MASK: - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return; case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_KEATON_MASK: case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_SPOOKY_MASK: case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_SKULL_MASK: case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_BUNNY_HOOD: - EnOssan_TryPaybackMask(this, globalCtx); + EnOssan_TryPaybackMask(this, play); return; case OSSAN_HAPPY_STATE_ANGRY: - globalCtx->nextEntranceIndex = 0x1D1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 0x2E; + play->nextEntranceIndex = 0x1D1; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 0x2E; return; } - if (!EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0])) { + if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { // "Shop around by moving the stick left and right" osSyncPrintf("「スティック左右で品物みてくれ!」\n"); - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } } -s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx) { - switch (globalCtx->msgCtx.choiceIndex) { +s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_ChooseTalkToOwner(globalCtx, this); + EnOssan_ChooseTalkToOwner(play, this); return true; case 1: - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return true; default: return false; } } -void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player) { - Input* input = &globalCtx->state.input[0]; +void EnOssan_State_FacingShopkeeper(EnOssan* this, PlayState* play, Player* player) { + Input* input = &play->state.input[0]; u8 nextIndex; bool dpad = CVar_GetS32("gDpadText", 0); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && - !EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0])) { - if (Message_ShouldAdvance(globalCtx) && EnOssan_FacingShopkeeperDialogResult(this, globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && + !EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { + if (Message_ShouldAdvance(play) && EnOssan_FacingShopkeeperDialogResult(this, play)) { func_80078884(NA_SE_SY_DECIDE); return; } @@ -978,7 +978,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; this->stateFlag = OSSAN_STATE_LOOK_SHELF_LEFT; - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; func_80078884(NA_SE_SY_CURSOR); } @@ -987,7 +987,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; this->stateFlag = OSSAN_STATE_LOOK_SHELF_RIGHT; - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; func_80078884(NA_SE_SY_CURSOR); } @@ -995,52 +995,52 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla } } -void EnOssan_State_TalkingToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnOssan_StartShopping(globalCtx, this); +void EnOssan_State_TalkingToShopkeeper(EnOssan* this, PlayState* play, Player* player) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnOssan_StartShopping(play, this); } } -void EnOssan_State_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_LookToLeftShelf(EnOssan* this, PlayState* play, Player* player) { Math_ApproachF(&this->cameraFaceAngle, 30.0f, 0.5f, 10.0f); if (this->cameraFaceAngle > 29.5f) { - EnOssan_UpdateCameraDirection(this, globalCtx, 30.0f); + EnOssan_UpdateCameraDirection(this, play, 30.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle >= 30.0f) { - EnOssan_UpdateCameraDirection(this, globalCtx, 30.0f); - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCameraDirection(this, play, 30.0f); + EnOssan_UpdateCursorPos(play, this); this->stateFlag = OSSAN_STATE_BROWSE_LEFT_SHELF; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } else { this->stickAccumX = 0; } } -void EnOssan_State_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_LookToRightShelf(EnOssan* this, PlayState* play, Player* player) { Math_ApproachF(&this->cameraFaceAngle, -30.0f, 0.5f, 10.0f); if (this->cameraFaceAngle < -29.5f) { - EnOssan_UpdateCameraDirection(this, globalCtx, -30.0f); + EnOssan_UpdateCameraDirection(this, play, -30.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle <= -30.0f) { - EnOssan_UpdateCameraDirection(this, globalCtx, -30.0f); - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCameraDirection(this, play, -30.0f); + EnOssan_UpdateCursorPos(play, this); this->stateFlag = OSSAN_STATE_BROWSE_RIGHT_SHELF; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } else { this->stickAccumX = 0; } } -void EnOssan_CursorUpDown(EnOssan* this, GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[0]; +void EnOssan_CursorUpDown(EnOssan* this, PlayState* play) { + Input* input = &play->state.input[0]; u8 curTemp = this->cursorIndex; u8 curScanTemp; bool dpad = CVar_GetS32("gDpadText", 0); @@ -1126,16 +1126,16 @@ void EnOssan_CursorUpDown(EnOssan* this, GlobalContext* globalCtx) { } } -s32 EnOssan_HasPlayerSelectedItem(GlobalContext* globalCtx, EnOssan* this, Input* input) { +s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input) { EnGirlA* selectedItem = this->shelfSlots[this->cursorIndex]; - if (EnOssan_TestEndInteraction(this, globalCtx, input)) { + if (EnOssan_TestEndInteraction(this, play, input)) { return true; } - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (selectedItem->actor.params != SI_SOLD_OUT && selectedItem->isInvisible == 0) { this->tempStateFlag = this->stateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->itemBuyPromptTextId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->itemBuyPromptTextId); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; switch (selectedItem->actor.params) { @@ -1189,8 +1189,8 @@ s32 EnOssan_HasPlayerSelectedItem(GlobalContext* globalCtx, EnOssan* this, Input return false; } -void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { - Input* input = &globalCtx->state.input[0]; +void EnOssan_State_BrowseLeftShelf(EnOssan* this, PlayState* play, Player* player) { + Input* input = &play->state.input[0]; s32 a; s32 b; u8 prevIndex = this->cursorIndex; @@ -1209,16 +1209,16 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play } this->drawCursor = 0xFF; this->stickRightPrompt.isEnabled = true; - EnOssan_UpdateCursorPos(globalCtx, this); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && - !EnOssan_HasPlayerSelectedItem(globalCtx, this, &globalCtx->state.input[0])) { + EnOssan_UpdateCursorPos(play, this); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && + !EnOssan_HasPlayerSelectedItem(play, this, &play->state.input[0])) { if (this->moveHorizontal) { if ((this->stickAccumX > 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { a = EnOssan_CursorRight(this, this->cursorIndex, 4); if (a != CURSOR_INVALID) { this->cursorIndex = a; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if ((this->stickAccumX < 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { @@ -1233,7 +1233,7 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play if (c != CURSOR_INVALID) { this->cursorIndex = c; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if ((this->stickAccumX < 0 && this->stickAccumX < -500) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { @@ -1243,16 +1243,16 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play } } } - EnOssan_CursorUpDown(this, globalCtx); + EnOssan_CursorUpDown(this, play); if (this->cursorIndex != prevIndex) { - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); func_80078884(NA_SE_SY_CURSOR); } } } -void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { - Input* input = &globalCtx->state.input[0]; +void EnOssan_State_BrowseRightShelf(EnOssan* this, PlayState* play, Player* player) { + Input* input = &play->state.input[0]; s32 pad[2]; u8 prevIndex; u8 nextIndex; @@ -1270,16 +1270,16 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla } this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; - EnOssan_UpdateCursorPos(globalCtx, this); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && - !EnOssan_HasPlayerSelectedItem(globalCtx, this, &globalCtx->state.input[0])) { + EnOssan_UpdateCursorPos(play, this); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && + !EnOssan_HasPlayerSelectedItem(play, this, &play->state.input[0])) { if (this->moveHorizontal) { if ((this->stickAccumX < 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { nextIndex = EnOssan_CursorRight(this, this->cursorIndex, 0); if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if ((this->stickAccumX > 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { @@ -1294,7 +1294,7 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if ((this->stickAccumX > 0 && this->stickAccumX > 500) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { @@ -1304,203 +1304,203 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla } } } - EnOssan_CursorUpDown(this, globalCtx); + EnOssan_CursorUpDown(this, play); if (this->cursorIndex != prevIndex) { - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); func_80078884(NA_SE_SY_CURSOR); } } } -void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, PlayState* play, Player* player) { Math_ApproachF(&this->cameraFaceAngle, 0.0f, 0.5f, 10.0f); if ((this->cameraFaceAngle < 0.5f) && (this->cameraFaceAngle > -0.5f)) { - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle == 0.0f) { - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } -void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player) { if (!EnOssan_ReturnItemToShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", __FILE__, __LINE__); return; } Math_ApproachF(&this->cameraFaceAngle, 0.0f, 0.5f, 10.0f); if (this->cameraFaceAngle < 0.5f && this->cameraFaceAngle > -0.5f) { - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle == 0.0f) { - Message_ContinueTextbox(globalCtx, 0x3010); + Message_ContinueTextbox(play, 0x3010); this->stateFlag = OSSAN_STATE_WAIT_FOR_DISPLAY_ONLY_BOMB_DIALOG; } } -void EnOssan_GiveItemWithFanfare(GlobalContext* globalCtx, EnOssan* this) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_GiveItemWithFanfare(PlayState* play, EnOssan* this) { + Player* player = GET_PLAYER(play); osSyncPrintf("\n" VT_FGCOL(YELLOW) "初めて手にいれた!!" VT_RST "\n\n"); if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); + func_8002F434(&this->actor, play, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); } else { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->cursorIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->cursorIndex); // en_ossan/en_girla are also used for the happy mask shop, which never has randomized items // and returns RC_UNKNOWN_CHECK, in which case we should fall back to vanilla logic if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 120.0f, 120.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 120.0f, 120.0f); } else { - func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); + func_8002F434(&this->actor, play, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); } } - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - func_800BC490(globalCtx, 1); + func_800BC490(play, 1); Interface_ChangeAlpha(50); this->drawCursor = 0; - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); this->stateFlag = OSSAN_STATE_GIVE_ITEM_FANFARE; osSyncPrintf(VT_FGCOL(YELLOW) "持ち上げ開始!!" VT_RST "\n\n"); } -void EnOssan_SetStateCantGetItem(GlobalContext* globalCtx, EnOssan* this, u16 textId) { - Message_ContinueTextbox(globalCtx, textId); +void EnOssan_SetStateCantGetItem(PlayState* play, EnOssan* this, u16 textId) { + Message_ContinueTextbox(play, textId); this->stateFlag = OSSAN_STATE_CANT_GET_ITEM; } -void EnOssan_SetStateQuickBuyDialog(GlobalContext* globalCtx, EnOssan* this, u16 textId) { - Message_ContinueTextbox(globalCtx, textId); +void EnOssan_SetStateQuickBuyDialog(PlayState* play, EnOssan* this, u16 textId) { + Message_ContinueTextbox(play, textId); this->stateFlag = OSSAN_STATE_QUICK_BUY; } -void EnOssan_HandleCanBuyItem(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { EnGirlA* selectedItem = this->shelfSlots[this->cursorIndex]; - switch (selectedItem->canBuyFunc(globalCtx, selectedItem)) { + switch (selectedItem->canBuyFunc(play, selectedItem)) { case CANBUY_RESULT_SUCCESS_FANFARE: if (selectedItem->actor.params == SI_HYLIAN_SHIELD && gSaveContext.infTable[7] & 0x40) { - EnOssan_SetStateGiveDiscountDialog(globalCtx, this); + EnOssan_SetStateGiveDiscountDialog(play, this); } else { - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - selectedItem->setOutOfStockFunc(globalCtx, selectedItem); + selectedItem->setOutOfStockFunc(play, selectedItem); } break; case CANBUY_RESULT_SUCCESS: - selectedItem->itemGiveFunc(globalCtx, selectedItem); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x84); + selectedItem->itemGiveFunc(play, selectedItem); + EnOssan_SetStateQuickBuyDialog(play, this, 0x84); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - selectedItem->setOutOfStockFunc(globalCtx, selectedItem); + selectedItem->setOutOfStockFunc(play, selectedItem); break; case CANBUY_RESULT_CANT_GET_NOW: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x86); + EnOssan_SetStateCantGetItem(play, this, 0x86); break; case CANBUY_RESULT_NEED_BOTTLE: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x96); + EnOssan_SetStateCantGetItem(play, this, 0x96); break; case CANBUY_RESULT_NEED_RUPEES: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; case CANBUY_RESULT_CANT_GET_NOW_5: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x86); + EnOssan_SetStateCantGetItem(play, this, 0x86); break; } } -void EnOssan_HandleCanBuyLonLonMilk(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyLonLonMilk(PlayState* play, EnOssan* this) { EnGirlA* item = this->shelfSlots[this->cursorIndex]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_FANFARE: - Message_ContinueTextbox(globalCtx, 0x9C); + Message_ContinueTextbox(play, 0x9C); this->stateFlag = OSSAN_STATE_GIVE_LON_LON_MILK; this->drawCursor = 0; break; case CANBUY_RESULT_SUCCESS: - item->itemGiveFunc(globalCtx, item); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x98); + item->itemGiveFunc(play, item); + EnOssan_SetStateQuickBuyDialog(play, this, 0x98); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_NEED_BOTTLE: - EnOssan_SetStateCantGetItem(globalCtx, this, 0x96); + EnOssan_SetStateCantGetItem(play, this, 0x96); break; case CANBUY_RESULT_NEED_RUPEES: - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; } } -void EnOssan_HandleCanBuyWeirdEgg(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyWeirdEgg(PlayState* play, EnOssan* this) { EnGirlA* item = this->shelfSlots[this->cursorIndex]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_FANFARE: - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_SUCCESS: - item->itemGiveFunc(globalCtx, item); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x9A); + item->itemGiveFunc(play, item); + EnOssan_SetStateQuickBuyDialog(play, this, 0x9A); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_CANT_GET_NOW: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x9D); + EnOssan_SetStateCantGetItem(play, this, 0x9D); break; case CANBUY_RESULT_NEED_RUPEES: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; } } -void EnOssan_HandleCanBuyBombs(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyBombs(PlayState* play, EnOssan* this) { EnGirlA* item = this->shelfSlots[this->cursorIndex]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_FANFARE: case CANBUY_RESULT_SUCCESS: - item->itemGiveFunc(globalCtx, item); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x84); + item->itemGiveFunc(play, item); + EnOssan_SetStateQuickBuyDialog(play, this, 0x84); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_CANT_GET_NOW: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x86); + EnOssan_SetStateCantGetItem(play, this, 0x86); break; case CANBUY_RESULT_NEED_RUPEES: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; } } -void EnOssan_BuyGoronCityBombs(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_BuyGoronCityBombs(PlayState* play, EnOssan* this) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { // Let players buy the right side of the goron shop in rando regardless of DC completion // Players will still need a bomb bag to buy bombs (handled by vanilla behaviour) // gSaveContext.eventChkInf[2] & 0x20 - Completed Dodongo's Cavern if (!gSaveContext.n64ddFlag && !(gSaveContext.eventChkInf[2] & 0x20)) { if (gSaveContext.infTable[15] & 0x1000) { - EnOssan_SetStateCantGetItem(globalCtx, this, 0x302E); + EnOssan_SetStateCantGetItem(play, this, 0x302E); } else { this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -1508,113 +1508,113 @@ void EnOssan_BuyGoronCityBombs(GlobalContext* globalCtx, EnOssan* this) { this->stateFlag = OSSAN_STATE_DISPLAY_ONLY_BOMB_DIALOG; } } else { - EnOssan_HandleCanBuyBombs(globalCtx, this); + EnOssan_HandleCanBuyBombs(play, this); } } else { - EnOssan_HandleCanBuyBombs(globalCtx, this); + EnOssan_HandleCanBuyBombs(play, this); } } -void EnOssan_State_ItemSelected(EnOssan* this, GlobalContext* globalCtx2, Player* player) { - GlobalContext* globalCtx = globalCtx2; // Necessary for OKs +void EnOssan_State_ItemSelected(EnOssan* this, PlayState* play2, Player* player) { + PlayState* play = play2; // Necessary for OKs if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", __FILE__, __LINE__); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_HandleCanBuyItem(globalCtx, this); + EnOssan_HandleCanBuyItem(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectMilkBottle(EnOssan* this, GlobalContext* globalCtx2, Player* player) { - GlobalContext* globalCtx = globalCtx2; // Need for OK +void EnOssan_State_SelectMilkBottle(EnOssan* this, PlayState* play2, Player* player) { + PlayState* play = play2; // Need for OK if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", __FILE__, __LINE__); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_HandleCanBuyLonLonMilk(globalCtx, this); + EnOssan_HandleCanBuyLonLonMilk(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectWeirdEgg(EnOssan* this, GlobalContext* globalCtx2, Player* player) { - GlobalContext* globalCtx = globalCtx2; // Needed for OK +void EnOssan_State_SelectWeirdEgg(EnOssan* this, PlayState* play2, Player* player) { + PlayState* play = play2; // Needed for OK if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", __FILE__, __LINE__); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_HandleCanBuyWeirdEgg(globalCtx, this); + EnOssan_HandleCanBuyWeirdEgg(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectUnimplementedItem(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_SelectUnimplementedItem(EnOssan* this, PlayState* play, Player* player) { if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", __FILE__, __LINE__); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } } -void EnOssan_State_SelectBombs(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_SelectBombs(EnOssan* this, PlayState* play, Player* player) { if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", __FILE__, __LINE__); return; } osSyncPrintf("店主の依頼 ( %d )\n", gSaveContext.infTable[15] & 0x1000); if (this->actor.params != OSSAN_TYPE_GORON) { - EnOssan_State_ItemSelected(this, globalCtx, player); + EnOssan_State_ItemSelected(this, play, player); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_BuyGoronCityBombs(globalCtx, this); + EnOssan_BuyGoronCityBombs(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Player* player) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_State_SelectMaskItem(EnOssan* this, PlayState* play, Player* player) { + u8 talkState = Message_GetState(&play->msgCtx); EnGirlA* item = this->shelfSlots[this->cursorIndex]; if (!EnOssan_TakeItemOffShelf(this)) { @@ -1622,14 +1622,14 @@ void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Playe return; } if (talkState == TEXT_STATE_EVENT) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } } else if (talkState == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && + Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: switch (item->actor.params) { case SI_KEATON_MASK: @@ -1650,66 +1650,66 @@ void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Playe case SI_GERUDO_MASK: break; } - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_CantGetItem(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_CantGetItem(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } } -void EnOssan_State_QuickBuyDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_QuickBuyDialog(EnOssan* this, PlayState* play, Player* player) { EnGirlA* item; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnOssan_ResetItemPosition(this); item = this->shelfSlots[this->cursorIndex]; - item->updateStockedItemFunc(globalCtx, item); + item->updateStockedItemFunc(play, item); this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } } -void EnOssan_State_GiveItemWithFanfare(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_GiveItemWithFanfare(EnOssan* this, PlayState* play, Player* player) { // The player sets itself as the parent actor to signal that it has obtained the give item request - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->stateFlag = OSSAN_STATE_ITEM_PURCHASED; return; } if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); + func_8002F434(&this->actor, play, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); } else { - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->cursorIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->cursorIndex); // en_ossan/en_girla are also used for the happy mask shop, which never has randomized items // and returns RC_UNKNOWN_CHECK, in which case we should fall back to vanilla logic if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 120.0f, 120.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 120.0f, 120.0f); } else { - func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); + func_8002F434(&this->actor, play, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); } } } -void EnOssan_State_ItemPurchased(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_ItemPurchased(EnOssan* this, PlayState* play, Player* player) { EnGirlA* item; EnGirlA* itemTemp; - ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(globalCtx->sceneNum, this->cursorIndex); + ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->cursorIndex); GetItemEntry getItemEntry; if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { getItemEntry = Randomizer_GetItemFromKnownCheck(shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); @@ -1718,131 +1718,131 @@ void EnOssan_State_ItemPurchased(EnOssan* this, GlobalContext* globalCtx, Player } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (this->actor.params == OSSAN_TYPE_MASK) { itemTemp = this->shelfSlots[this->cursorIndex]; EnOssan_ResetItemPosition(this); item = this->shelfSlots[this->cursorIndex]; - item->updateStockedItemFunc(globalCtx, item); + item->updateStockedItemFunc(play, item); if (itemTemp->actor.params == SI_MASK_OF_TRUTH && !(gSaveContext.itemGetInf[3] & 0x8000)) { gSaveContext.itemGetInf[3] |= 0x8000; - Message_ContinueTextbox(globalCtx, 0x70AB); + Message_ContinueTextbox(play, 0x70AB); this->happyMaskShopState = OSSAN_HAPPY_STATE_BORROWED_FIRST_MASK; - EnOssan_UpdateShopOfferings(this, globalCtx); + EnOssan_UpdateShopOfferings(this, play); this->stateFlag = OSSAN_STATE_START_CONVERSATION; return; } else { - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return; } } item = this->shelfSlots[this->cursorIndex]; - item->buyEventFunc(globalCtx, item); + item->buyEventFunc(play, item); if (getItemEntry.getItemId == RG_ICE_TRAP && getItemEntry.modIndex == MOD_RANDOMIZER) { EnOssan_ResetItemPosition(this); - item->updateStockedItemFunc(globalCtx, item); - EnOssan_EndInteraction(globalCtx, this); + item->updateStockedItemFunc(play, item); + EnOssan_EndInteraction(play, this); return; } this->stateFlag = OSSAN_STATE_CONTINUE_SHOPPING_PROMPT; - Message_ContinueTextbox(globalCtx, 0x6B); + Message_ContinueTextbox(play, 0x6B); } } -void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player* player) { EnGirlA* selectedItem; - u8 talkState = Message_GetState(&globalCtx->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); if (talkState == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); selectedItem = this->shelfSlots[this->cursorIndex]; - selectedItem->updateStockedItemFunc(globalCtx, selectedItem); - if (!EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0])) { - switch (globalCtx->msgCtx.choiceIndex) { + selectedItem->updateStockedItemFunc(play, selectedItem); + if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { + switch (play->msgCtx.choiceIndex) { case 0: osSyncPrintf(VT_FGCOL(YELLOW) "★★★ 続けるよ!! ★★★" VT_RST "\n"); player->actor.shape.rot.y += 0x8000; player->stateFlags2 |= 0x20000000; - func_800BC490(globalCtx, 2); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - EnOssan_SetStateStartShopping(globalCtx, this, true); - func_8002F298(&this->actor, globalCtx, 100.0f, -1); + func_800BC490(play, 2); + Message_StartTextbox(play, this->actor.textId, &this->actor); + EnOssan_SetStateStartShopping(play, this, true); + func_8002F298(&this->actor, play, 100.0f, -1); break; case 1: default: osSyncPrintf(VT_FGCOL(YELLOW) "★★★ やめるよ!! ★★★" VT_RST "\n"); - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); break; } } } - } else if (talkState == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + } else if (talkState == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); selectedItem = this->shelfSlots[this->cursorIndex]; - selectedItem->updateStockedItemFunc(globalCtx, selectedItem); + selectedItem->updateStockedItemFunc(play, selectedItem); player->actor.shape.rot.y += 0x8000; player->stateFlags2 |= 0x20000000; - func_800BC490(globalCtx, 2); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - EnOssan_SetStateStartShopping(globalCtx, this, true); - func_8002F298(&this->actor, globalCtx, 100.0f, -1); + func_800BC490(play, 2); + Message_StartTextbox(play, this->actor.textId, &this->actor); + EnOssan_SetStateStartShopping(play, this, true); + func_8002F298(&this->actor, play, 100.0f, -1); } } -void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { gSaveContext.infTable[15] |= 0x1000; - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } // Unreachable -void EnOssan_State_21(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE_HAS_NEXT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_21(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE_HAS_NEXT && Message_ShouldAdvance(play)) { this->stateFlag = OSSAN_STATE_22; - Message_ContinueTextbox(globalCtx, 0x3012); + Message_ContinueTextbox(play, 0x3012); gSaveContext.infTable[15] |= 0x1000; } } // Unreachable -void EnOssan_State_22(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - EnOssan_StartShopping(globalCtx, this); +void EnOssan_State_22(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + EnOssan_StartShopping(play, this); } } -void EnOssan_State_GiveLonLonMilk(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - EnOssan_GiveItemWithFanfare(globalCtx, this); +void EnOssan_State_GiveLonLonMilk(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + EnOssan_GiveItemWithFanfare(play, this); } } // For giving Mask of Truth when you first sell all masks -void EnOssan_State_LendMaskOfTruth(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_LendMaskOfTruth(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { gSaveContext.itemGetInf[2] |= 0x400; this->cursorIndex = 2; - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); } } // Hylian Shield discount dialog -void EnOssan_SetStateGiveDiscountDialog(GlobalContext* globalCtx, EnOssan* this) { - Message_ContinueTextbox(globalCtx, 0x71B2); +void EnOssan_SetStateGiveDiscountDialog(PlayState* play, EnOssan* this) { + Message_ContinueTextbox(play, 0x71B2); this->stateFlag = OSSAN_STATE_DISCOUNT_DIALOG; } -void EnOssan_State_GiveDiscountDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_GiveDiscountDialog(EnOssan* this, PlayState* play, Player* player) { EnGirlA* selectedItem; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { selectedItem = this->shelfSlots[this->cursorIndex]; - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - selectedItem->setOutOfStockFunc(globalCtx, selectedItem); + selectedItem->setOutOfStockFunc(play, selectedItem); } } @@ -2048,12 +2048,12 @@ void EnOssan_Blink(EnOssan* this) { } } -s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex1)) { - if (this->objBankIndex2 >= 0 && !Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex2)) { +s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex1)) { + if (this->objBankIndex2 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex2)) { return false; } - if (this->objBankIndex3 >= 0 && !Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex3)) { + if (this->objBankIndex3 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex3)) { return false; } return true; @@ -2061,55 +2061,55 @@ s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, GlobalContext* globalCtx) return false; } -void EnOssan_InitBazaarShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, NULL, NULL, 0); +void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, NULL, NULL, 0); this->actor.draw = EnOssan_DrawBazaarShopkeeper; this->obj3ToSeg6Func = NULL; } -void EnOssan_InitKokiriShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment); Animation_Change(&this->skelAnime, &object_masterkokiri_Anim_0004A8, 1.0f, 0.0f, Animation_GetLastFrame(&object_masterkokiri_Anim_0004A8), 0, 0.0f); this->actor.draw = EnOssan_DrawKokiriShopkeeper; this->obj3ToSeg6Func = EnOssan_Obj3ToSeg6; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, FAIRY_KOKIRI); } -void EnOssan_InitGoronShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawGoronShopkeeper; this->obj3ToSeg6Func = EnOssan_Obj3ToSeg6; } -void EnOssan_InitZoraShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawZoraShopkeeper; this->obj3ToSeg6Func = EnOssan_Obj3ToSeg6; } -void EnOssan_InitPotionShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ds2_Skel_004258, &object_ds2_Anim_0002E4, 0, 0, 0); +void EnOssan_InitPotionShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_ds2_Skel_004258, &object_ds2_Anim_0002E4, 0, 0, 0); this->actor.draw = EnOssan_DrawPotionShopkeeper; this->obj3ToSeg6Func = NULL; } -void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_os_Skel_004658, &object_os_Anim_0002E4, NULL, NULL, 0); +void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_os_Skel_004658, &object_os_Anim_0002E4, NULL, NULL, 0); this->actor.draw = EnOssan_DrawHappyMaskShopkeeper; this->obj3ToSeg6Func = NULL; } -void EnOssan_InitBombchuShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_rs_Skel_004868, &object_rs_Anim_00065C, 0, 0, 0); +void EnOssan_InitBombchuShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_rs_Skel_004868, &object_rs_Anim_00065C, 0, 0, 0); this->actor.draw = EnOssan_DrawBombchuShopkeeper; this->obj3ToSeg6Func = NULL; } @@ -2177,15 +2177,15 @@ u16 EnOssan_SetupHelloDialog(EnOssan* this) { return 0x9E; } -void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) { ShopItem* items; - if (EnOssan_AreShopkeeperObjectsLoaded(this, globalCtx)) { + if (EnOssan_AreShopkeeperObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->objBankIndex1; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); - this->shelves = (EnTana*)Actor_Find(&globalCtx->actorCtx, ACTOR_EN_TANA, ACTORCAT_PROP); + this->shelves = (EnTana*)Actor_Find(&play->actorCtx, ACTOR_EN_TANA, ACTORCAT_PROP); if (this->shelves == NULL) { osSyncPrintf(VT_COL(RED, WHITE)); @@ -2205,7 +2205,7 @@ void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { items = sShopkeeperStores[this->actor.params]; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - sInitFuncs[this->actor.params](this, globalCtx); + sInitFuncs[this->actor.params](this, play); this->actor.textId = EnOssan_SetupHelloDialog(this); this->cursorY = this->cursorX = 100.0f; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -2261,7 +2261,7 @@ void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { this->stickAnimTween = 0; this->shopItemSelectedTween = 0; Actor_SetScale(&this->actor, sShopkeeperScale[this->actor.params]); - EnOssan_SpawnItemsOnShelves(this, globalCtx, items); + EnOssan_SpawnItemsOnShelves(this, play, items); this->headRot = this->headTargetRot = 0; this->blinkTimer = 20; this->eyeTextureIdx = 0; @@ -2271,45 +2271,45 @@ void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_Obj3ToSeg6(EnOssan* this, GlobalContext* globalCtx) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment); } -void EnOssan_MainActionFunc(EnOssan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_MainActionFunc(EnOssan* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->blinkFunc(this); - EnOssan_UpdateJoystickInputState(globalCtx, this); + EnOssan_UpdateJoystickInputState(play, this); EnOssan_UpdateItemSelectedProperty(this); EnOssan_UpdateStickDirectionPromptAnim(this); EnOssan_UpdateCursorAnim(this); Math_StepToS(&this->headRot, this->headTargetRot, 0x190); if (player != NULL) { - sStateFunc[this->stateFlag](this, globalCtx, player); + sStateFunc[this->stateFlag](this, play, player); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); Actor_SetFocus(&this->actor, 90.0f); Actor_SetScale(&this->actor, sShopkeeperScale[this->actor.params]); // use animation object if needed if (this->obj3ToSeg6Func != NULL) { - this->obj3ToSeg6Func(this, globalCtx); + this->obj3ToSeg6Func(this, play); } SkelAnime_Update(&this->skelAnime); } -void EnOssan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Update(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnOssan_OverrideLimbDrawDefaultShopkeeper(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, +s32 EnOssan_OverrideLimbDrawDefaultShopkeeper(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnOssan* this = (EnOssan*)thisx; @@ -2319,14 +2319,14 @@ s32 EnOssan_OverrideLimbDrawDefaultShopkeeper(GlobalContext* globalCtx, s32 limb return 0; } -void EnOssan_DrawCursor(GlobalContext* globalCtx, EnOssan* this, f32 x, f32 y, f32 z, u8 drawCursor) { +void EnOssan_DrawCursor(PlayState* play, EnOssan* this, f32 x, f32 y, f32 z, u8 drawCursor) { s32 ulx, uly, lrx, lry; f32 w; s32 dsdx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawCursor != 0) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColorR, this->cursorColorG, this->cursorColorB, this->cursorColorA); gDPLoadTextureBlock_4b(OVERLAY_DISP++, gSelectionCursorTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP, @@ -2339,17 +2339,17 @@ void EnOssan_DrawCursor(GlobalContext* globalCtx, EnOssan* this, f32 x, f32 y, f dsdx = (1.0f / z) * 1024.0f; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + 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, +void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y, f32 z, s32 s, s32 t, f32 dx, f32 dy) { f32 unk; s32 ulx, uly, lrx, lry; f32 w, h; s32 dsdx, dtdy; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); @@ -2364,28 +2364,28 @@ void EnOssan_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f lrx = (x + w) * 4.0f; lry = (y + h) * 4.0f; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_DrawStickDirectionPrompts(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) { s32 drawStickLeftPrompt = this->stickLeftPrompt.isEnabled; s32 drawStickRightPrompt = this->stickRightPrompt.isEnabled; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawStickLeftPrompt || drawStickRightPrompt) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPLoadTextureBlock(OVERLAY_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); if (drawStickLeftPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG, + EnOssan_DrawTextRec(play, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG, this->stickLeftPrompt.arrowColorB, this->stickLeftPrompt.arrowColorA, this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f); } if (drawStickRightPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG, + EnOssan_DrawTextRec(play, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB, this->stickRightPrompt.arrowColorA, this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f); @@ -2394,39 +2394,39 @@ void EnOssan_DrawStickDirectionPrompts(GlobalContext* globalCtx, EnOssan* this) G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); if (drawStickLeftPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG, + EnOssan_DrawTextRec(play, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG, this->stickLeftPrompt.stickColorB, this->stickLeftPrompt.stickColorA, this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f); } if (drawStickRightPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG, + EnOssan_DrawTextRec(play, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG, this->stickRightPrompt.stickColorB, this->stickRightPrompt.stickColorA, this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_DrawBazaarShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawBazaarShopkeeper(Actor* thisx, PlayState* play) { static void* sBazaarShopkeeperEyeTextures[] = { gOssanEyeOpenTex, gOssanEyeHalfTex, gOssanEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sBazaarShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnOssan_OverrideLimbDrawDefaultShopkeeper, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, +s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { static void* sKokiriShopkeeperEyeTextures[] = { gKokiriShopkeeperEyeDefaultTex, @@ -2436,16 +2436,16 @@ s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(GlobalContext* globalCtx, s32 limbI EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 15) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objBankIndex2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex2].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndex2].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex2].segment); *dList = gKokiriShopkeeperHeadDL; gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sKokiriShopkeeperEyeTextures[this->eyeTextureIdx])); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return 0; } @@ -2465,45 +2465,45 @@ Gfx* EnOssan_SetEnvColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return disp; } -void EnOssan_DrawKokiriShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawKokiriShopkeeper(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x08, EnOssan_SetEnvColor(globalCtx->state.gfxCtx, 0, 130, 70, 255)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnOssan_SetEnvColor(globalCtx->state.gfxCtx, 110, 170, 20, 255)); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EndDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, EnOssan_SetEnvColor(play->state.gfxCtx, 0, 130, 70, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnOssan_SetEnvColor(play->state.gfxCtx, 110, 170, 20, 255)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EndDList(play->state.gfxCtx)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnOssan_OverrideLimbDrawKokiriShopkeeper, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_DrawGoronShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawGoronShopkeeper(Actor* thisx, PlayState* play) { static void* sGoronShopkeeperEyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sGoronShopkeeperEyeTextures[this->eyeTextureIdx])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnOssan_OverrideLimbDrawZoraShopkeeper(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnOssan_OverrideLimbDrawZoraShopkeeper(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnOssan* this = (EnOssan*)thisx; @@ -2513,78 +2513,78 @@ s32 EnOssan_OverrideLimbDrawZoraShopkeeper(GlobalContext* globalCtx, s32 limbInd return 0; } -void EnOssan_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawZoraShopkeeper(Actor* thisx, PlayState* play) { static void* sZoraShopkeeperEyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EndDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EndDList(play->state.gfxCtx)); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sZoraShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnOssan_OverrideLimbDrawZoraShopkeeper, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_DrawPotionShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawPotionShopkeeper(Actor* thisx, PlayState* play) { static void* sPotionShopkeeperEyeTextures[] = { gPotionShopkeeperEyeOpenTex, gPotionShopkeeperEyeHalfTex, gPotionShopkeeperEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sPotionShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, PlayState* play) { static void* sHappyMaskShopkeeperEyeTextures[] = { gOsEyeClosedTex, gOsEyeOpenTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sHappyMaskShopkeeperEyeTextures[this->happyMaskShopkeeperEyeIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_DrawBombchuShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawBombchuShopkeeper(Actor* thisx, PlayState* play) { static void* sBombchuShopkeeperEyeTextures[] = { gBombchuShopkeeperEyeOpenTex, gBombchuShopkeeperEyeHalfTex, gBombchuShopkeeperEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sBombchuShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index dfc7ac97f..42084f903 100644 --- a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -8,11 +8,11 @@ struct EnOssan; -typedef void (*EnOssanActionFunc)(struct EnOssan*, GlobalContext*); -typedef void (*EnOssanTalkOwnerFunc)(GlobalContext*); -typedef void (*EnOssanInitFunc)(struct EnOssan*, GlobalContext*); +typedef void (*EnOssanActionFunc)(struct EnOssan*, PlayState*); +typedef void (*EnOssanTalkOwnerFunc)(PlayState*); +typedef void (*EnOssanInitFunc)(struct EnOssan*, PlayState*); typedef s16 (*EnOssanGetGirlAParamsFunc)(s16); -typedef void (*EnOssanStateFunc)(struct EnOssan*, GlobalContext*, Player*); +typedef void (*EnOssanStateFunc)(struct EnOssan*, PlayState*, Player*); #define ColChanMix(c1, c2, m) (c1 - (s32)(c2 * m)) & 0xFF @@ -20,7 +20,7 @@ typedef struct EnOssan { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnOssanActionFunc actionFunc; - /* 0x0194 */ void (*obj3ToSeg6Func)(struct EnOssan*, GlobalContext*); + /* 0x0194 */ void (*obj3ToSeg6Func)(struct EnOssan*, PlayState*); /* 0x0198 */ ColliderCylinder collider; // unused /* 0x01E4 */ s16 timer; /* 0x01E6 */ s16 delayTimer; diff --git a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 592443004..bbecb2505 100644 --- a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -12,37 +12,37 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOwl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOwl_Init(Actor* thisx, PlayState* play); +void EnOwl_Destroy(Actor* thisx, PlayState* play); +void EnOwl_Update(Actor* thisx, PlayState* play); +void EnOwl_Draw(Actor* thisx, PlayState* play); void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc, OwlFunc, SkelAnime*, AnimationHeader*, f32); -void EnOwl_WaitDefault(EnOwl* this, GlobalContext* globalCtx); +void EnOwl_WaitDefault(EnOwl* this, PlayState* play); void func_80ACC540(EnOwl* this); -void EnOwl_WaitOutsideKokiri(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitHyruleCastle(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitKakariko(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitGerudo(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitLakeHylia(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitZoraRiver(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitHyliaShortcut(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitDeathMountainShortcut(EnOwl* this, GlobalContext* globalCtx); -void func_80ACB3E0(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitLWPreSaria(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitLWPostSaria(EnOwl* this, GlobalContext* globalCtx); -void func_80ACD4D4(EnOwl* this, GlobalContext* globalCtx); -void func_80ACD130(EnOwl* this, GlobalContext* globalCtx, s32 arg2); -void func_80ACBAB8(EnOwl* this, GlobalContext* globalCtx); -void func_80ACD2CC(EnOwl* this, GlobalContext* globalCtx); -void func_80ACAA54(EnOwl* this, GlobalContext* globalCtx); -void func_80ACAC6C(EnOwl* this, GlobalContext* globalCtx); -void func_80ACADF0(EnOwl* this, GlobalContext* globalCtx); -void func_80ACAF74(EnOwl* this, GlobalContext* globalCtx); -void func_80ACC30C(EnOwl* this, GlobalContext* globalCtx); -void func_80ACB4FC(EnOwl* this, GlobalContext* globalCtx); -void func_80ACB680(EnOwl* this, GlobalContext* globalCtx); +void EnOwl_WaitOutsideKokiri(EnOwl* this, PlayState* play); +void EnOwl_WaitHyruleCastle(EnOwl* this, PlayState* play); +void EnOwl_WaitKakariko(EnOwl* this, PlayState* play); +void EnOwl_WaitGerudo(EnOwl* this, PlayState* play); +void EnOwl_WaitLakeHylia(EnOwl* this, PlayState* play); +void EnOwl_WaitZoraRiver(EnOwl* this, PlayState* play); +void EnOwl_WaitHyliaShortcut(EnOwl* this, PlayState* play); +void EnOwl_WaitDeathMountainShortcut(EnOwl* this, PlayState* play); +void func_80ACB3E0(EnOwl* this, PlayState* play); +void EnOwl_WaitLWPreSaria(EnOwl* this, PlayState* play); +void EnOwl_WaitLWPostSaria(EnOwl* this, PlayState* play); +void func_80ACD4D4(EnOwl* this, PlayState* play); +void func_80ACD130(EnOwl* this, PlayState* play, s32 arg2); +void func_80ACBAB8(EnOwl* this, PlayState* play); +void func_80ACD2CC(EnOwl* this, PlayState* play); +void func_80ACAA54(EnOwl* this, PlayState* play); +void func_80ACAC6C(EnOwl* this, PlayState* play); +void func_80ACADF0(EnOwl* this, PlayState* play); +void func_80ACAF74(EnOwl* this, PlayState* play); +void func_80ACC30C(EnOwl* this, PlayState* play); +void func_80ACB4FC(EnOwl* this, PlayState* play); +void func_80ACB680(EnOwl* this, PlayState* play); void func_80ACC460(EnOwl* this); -void func_80ACBEA0(EnOwl*, GlobalContext*); +void func_80ACBEA0(EnOwl*, PlayState*); typedef enum { /* 0x00 */ OWL_DEFAULT, @@ -105,7 +105,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2400, ICHAIN_STOP), }; -void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Init(Actor* thisx, PlayState* play) { EnOwl* this = (EnOwl*)thisx; ColliderCylinder* collider; s32 owlType; @@ -113,12 +113,12 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gOwlFlyingSkel, &gOwlFlyAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gOwlFlyingSkel, &gOwlFlyAnim, this->jointTable, this->morphTable, 21); - SkelAnime_InitFlex(globalCtx, &this->skelAnime2, &gOwlPerchingSkel, &gOwlPerchAnim, this->jointTable2, + SkelAnime_InitFlex(play, &this->skelAnime2, &gOwlPerchingSkel, &gOwlPerchAnim, this->jointTable2, this->morphTable2, 16); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sOwlCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sOwlCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.minVelocityY = -10.0f; this->actor.targetArrowOffset = 500.0f; @@ -136,9 +136,9 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { // "conversation owl %4x no = %d, sv = %d" osSyncPrintf(VT_FGCOL(CYAN) " 会話フクロウ %4x no = %d, sv = %d\n" VT_RST, this->actor.params, owlType, switchFlag); - if (((owlType != OWL_DEFAULT) && (switchFlag < 0x20) && Flags_GetSwitch(globalCtx, switchFlag)) || + if (((owlType != OWL_DEFAULT) && (switchFlag < 0x20) && Flags_GetSwitch(play, switchFlag)) || // Owl shortcuts at SPOT06: Lake Hylia and SPOT16: Death Mountain Trail - (gSaveContext.n64ddFlag && !(globalCtx->sceneNum == SCENE_SPOT06 || globalCtx->sceneNum == SCENE_SPOT16))) { + (gSaveContext.n64ddFlag && !(play->sceneNum == SCENE_SPOT06 || play->sceneNum == SCENE_SPOT16))) { osSyncPrintf("savebitでフクロウ退避\n"); // "Save owl with savebit" Actor_Kill(&this->actor); return; @@ -195,7 +195,7 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { break; case OWL_HYLIA_SHORTCUT: this->actionFunc = EnOwl_WaitHyliaShortcut; - Flags_UnsetSwitch(globalCtx, 0x23); + Flags_UnsetSwitch(play, 0x23); return; case OWL_DEATH_MOUNTAIN: this->actionFunc = EnOwl_WaitDeathMountainShortcut; @@ -236,17 +236,17 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Destroy(Actor* thisx, PlayState* play) { EnOwl* this = (EnOwl*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** * Rotates this to the player instance */ -void EnOwl_LookAtLink(EnOwl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnOwl_LookAtLink(EnOwl* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos); @@ -257,11 +257,11 @@ void EnOwl_LookAtLink(EnOwl* this, GlobalContext* globalCtx) { * returns 0 if the link is not within `targetDistance`, returns 1 once link is within * the distance, and the camera has been initalized. */ -s32 EnOwl_CheckInitTalk(EnOwl* this, GlobalContext* globalCtx, u16 textId, f32 targetDist, u16 flags) { +s32 EnOwl_CheckInitTalk(EnOwl* this, PlayState* play, u16 textId, f32 targetDist, u16 flags) { s32 timer; f32 distCheck; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.params == 0xFFF) { this->actionFlags |= 0x40; timer = -100; @@ -274,26 +274,26 @@ s32 EnOwl_CheckInitTalk(EnOwl* this, GlobalContext* globalCtx, u16 textId, f32 t this->actionFlags &= ~0x40; } } - this->cameraIdx = OnePointCutscene_Init(globalCtx, 8700, timer, &this->actor, MAIN_CAM); + this->cameraIdx = OnePointCutscene_Init(play, 8700, timer, &this->actor, MAIN_CAM); return true; } else { this->actor.textId = textId; distCheck = (flags & 2) ? 200.0f : 1000.0f; if (this->actor.xzDistToPlayer < targetDist) { this->actor.flags |= ACTOR_FLAG_16; - func_8002F1C4(&this->actor, globalCtx, targetDist, distCheck, 0); + func_8002F1C4(&this->actor, play, targetDist, distCheck, 0); } return false; } } -s32 func_80ACA558(EnOwl* this, GlobalContext* globalCtx, u16 textId) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80ACA558(EnOwl* this, PlayState* play, u16 textId) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return true; } else { this->actor.textId = textId; if (this->actor.xzDistToPlayer < 120.0f) { - func_8002F1C4(&this->actor, globalCtx, 350.0f, 1000.0f, 0); + func_8002F1C4(&this->actor, play, 350.0f, 1000.0f, 0); } return false; } @@ -305,19 +305,19 @@ void func_80ACA5C8(EnOwl* this) { this->blinkTimer = Rand_S16Offset(60, 60); } -void func_80ACA62C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACA62C(EnOwl* this, PlayState* play) { s32 switchFlag = this->actor.params & 0x3F; if (switchFlag < 0x20) { - Flags_SetSwitch(globalCtx, switchFlag); - osSyncPrintf(VT_FGCOL(CYAN) " Actor_Environment_sw = %d\n" VT_RST, Flags_GetSwitch(globalCtx, switchFlag)); + Flags_SetSwitch(play, switchFlag); + osSyncPrintf(VT_FGCOL(CYAN) " Actor_Environment_sw = %d\n" VT_RST, Flags_GetSwitch(play, switchFlag)); } func_80ACA5C8(this); } -void func_80ACA690(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACA690(EnOwl* this, PlayState* play) { if ((this->unk_3EE & 0x3F) == 0) { - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); } } @@ -340,23 +340,23 @@ void func_80ACA71C(EnOwl* this) { this->unk_407 = this->unk_3F2; } -void func_80ACA76C(EnOwl* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 8); +void func_80ACA76C(EnOwl* this, PlayState* play) { + func_8002DF54(play, &this->actor, 8); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); this->actor.flags &= ~ACTOR_FLAG_16; } } -void func_80ACA7E0(EnOwl* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 8); +void func_80ACA7E0(EnOwl* this, PlayState* play) { + func_8002DF54(play, &this->actor, 8); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); if ((this->unk_3EE & 0x3F) == 0) { - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); } else { this->actionFlags &= ~2; func_80ACA71C(this); @@ -366,26 +366,26 @@ void func_80ACA7E0(EnOwl* this, GlobalContext* globalCtx) { } } -void EnOwl_ConfirmKokiriMessage(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void EnOwl_ConfirmKokiriMessage(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x2065); + Message_ContinueTextbox(play, 0x2065); break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x2067); + Message_ContinueTextbox(play, 0x2067); this->actionFunc = func_80ACA76C; break; } } } -void EnOwl_WaitOutsideKokiri(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitOutsideKokiri(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x2064, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x2064, 360.0f, 0)) { // Sets BGM Audio_PlayFanfare(NA_BGM_OWL); @@ -395,17 +395,17 @@ void EnOwl_WaitOutsideKokiri(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACA998(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void func_80ACA998(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x2069); + Message_ContinueTextbox(play, 0x2069); this->actionFunc = func_80ACAA54; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x206B); + Message_ContinueTextbox(play, 0x206B); this->actionFunc = func_80ACA7E0; break; } @@ -414,49 +414,49 @@ void func_80ACA998(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACAA54(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACAA54(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACA998; this->actionFlags |= 2; func_80ACA71C(this); } } -void func_80ACAAC0(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x2069); +void func_80ACAAC0(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x2069); this->actionFunc = func_80ACAA54; this->actionFlags &= ~2; func_80ACA71C(this); } } -void EnOwl_WaitHyruleCastle(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitHyruleCastle(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x2068, 540.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x2068, 540.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACAAC0; } } -void func_80ACAB88(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void func_80ACAB88(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: // obtained zelda's letter if (gSaveContext.eventChkInf[4] & 1) { - Message_ContinueTextbox(globalCtx, 0x206D); + Message_ContinueTextbox(play, 0x206D); } else { - Message_ContinueTextbox(globalCtx, 0x206C); + Message_ContinueTextbox(play, 0x206C); } this->actionFunc = func_80ACAC6C; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x206E); + Message_ContinueTextbox(play, 0x206E); this->actionFunc = func_80ACA7E0; break; } @@ -466,35 +466,35 @@ void func_80ACAB88(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACAC6C(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACAC6C(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACAB88; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitKakariko(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitKakariko(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x206C, 480.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x206C, 480.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACAC6C; } } -void func_80ACAD34(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void func_80ACAD34(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x206F); + Message_ContinueTextbox(play, 0x206F); this->actionFunc = func_80ACADF0; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x2070); + Message_ContinueTextbox(play, 0x2070); this->actionFunc = func_80ACA7E0; break; } @@ -504,35 +504,35 @@ void func_80ACAD34(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACADF0(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACADF0(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACAD34; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitGerudo(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitGerudo(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x206F, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x206F, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACADF0; } } -void func_80ACAEB8(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void func_80ACAEB8(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x2071); + Message_ContinueTextbox(play, 0x2071); this->actionFunc = func_80ACAF74; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x2072); + Message_ContinueTextbox(play, 0x2072); this->actionFunc = func_80ACA7E0; break; } @@ -542,38 +542,38 @@ void func_80ACAEB8(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACAF74(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACAF74(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACAEB8; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitLakeHylia(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitLakeHylia(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x2071, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x2071, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACAF74; } } -void func_80ACB03C(EnOwl* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 8); +void func_80ACB03C(EnOwl* this, PlayState* play) { + func_8002DF54(play, &this->actor, 8); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); this->actor.flags &= ~ACTOR_FLAG_16; } } -void EnOwl_WaitZoraRiver(EnOwl* this, GlobalContext* globalCtx) { +void EnOwl_WaitZoraRiver(EnOwl* this, PlayState* play) { u16 textId; - EnOwl_LookAtLink(this, globalCtx); + EnOwl_LookAtLink(this, play); if (CHECK_QUEST_ITEM(QUEST_SONG_SARIA)) { if (CHECK_QUEST_ITEM(QUEST_SONG_LULLABY)) { @@ -585,101 +585,101 @@ void EnOwl_WaitZoraRiver(EnOwl* this, GlobalContext* globalCtx) { textId = 0x4002; } - if (EnOwl_CheckInitTalk(this, globalCtx, textId, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, textId, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB03C; } } -void func_80ACB148(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80ACB148(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); func_80ACA5C8(this); this->actionFunc = func_80ACC30C; - Flags_SetSwitch(globalCtx, 0x23); + Flags_SetSwitch(play, 0x23); } } -void EnOwl_WaitHyliaShortcut(EnOwl* this, GlobalContext* globalCtx) { +void EnOwl_WaitHyliaShortcut(EnOwl* this, PlayState* play) { u16 textId = (gSaveContext.infTable[25] & 0x20) ? 0x4004 : 0x4003; // Spoke to Owl in Lake Hylia - EnOwl_LookAtLink(this, globalCtx); - if (func_80ACA558(this, globalCtx, textId)) { + EnOwl_LookAtLink(this, play); + if (func_80ACA558(this, play, textId)) { gSaveContext.infTable[25] |= 0x20; Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB148; } } -void func_80ACB22C(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80ACB22C(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); func_80ACA5C8(this); this->actionFunc = func_80ACC30C; } } -void func_80ACB274(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80ACB274(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); this->actionFunc = EnOwl_WaitDeathMountainShortcut; } } -void EnOwl_WaitDeathMountainShortcut(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitDeathMountainShortcut(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); if (!gSaveContext.magicAcquired && !gSaveContext.n64ddFlag) { - if (func_80ACA558(this, globalCtx, 0x3062)) { + if (func_80ACA558(this, play, 0x3062)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB274; return; } } else { - if (func_80ACA558(this, globalCtx, 0x3063)) { + if (func_80ACA558(this, play, 0x3063)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB22C; } } } -void func_80ACB344(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void func_80ACB344(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x607A); + Message_ContinueTextbox(play, 0x607A); break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x607C); + Message_ContinueTextbox(play, 0x607C); this->actionFunc = func_80ACA7E0; break; } } } -void func_80ACB3E0(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void func_80ACB3E0(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x6079, 360.0f, 2)) { + if (EnOwl_CheckInitTalk(this, play, 0x6079, 360.0f, 2)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB344; } } -void func_80ACB440(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void func_80ACB440(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x10C1); + Message_ContinueTextbox(play, 0x10C1); this->actionFunc = func_80ACB4FC; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x10C3); + Message_ContinueTextbox(play, 0x10C3); this->actionFunc = func_80ACA7E0; } @@ -688,35 +688,35 @@ void func_80ACB440(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACB4FC(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x10C2); +void func_80ACB4FC(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x10C2); this->actionFunc = func_80ACB440; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitLWPreSaria(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitLWPreSaria(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x10C0, 190.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x10C0, 190.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB4FC; } } -void func_80ACB5C4(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { +void func_80ACB5C4(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex); + uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x10C5); + Message_ContinueTextbox(play, 0x10C5); this->actionFunc = func_80ACB680; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x10C7); + Message_ContinueTextbox(play, 0x10C7); this->actionFunc = func_80ACA7E0; break; } @@ -726,34 +726,34 @@ void func_80ACB5C4(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACB680(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x10C6); +void func_80ACB680(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x10C6); this->actionFunc = func_80ACB5C4; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitLWPostSaria(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitLWPostSaria(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x10C4, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x10C4, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB680; } } -void func_80ACB748(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACB748(EnOwl* this, PlayState* play) { static Vec3f D_80ACD62C = { 0.0f, 0.0f, 0.0f }; f32 dist; f32 weight; s32 owlType = (this->actor.params & 0xFC0) >> 6; - dist = Math3D_Vec3f_DistXYZ(&this->eye, &globalCtx->view.eye) / 45.0f; - this->eye.x = globalCtx->view.eye.x; - this->eye.y = globalCtx->view.eye.y; - this->eye.z = globalCtx->view.eye.z; + dist = Math3D_Vec3f_DistXYZ(&this->eye, &play->view.eye) / 45.0f; + this->eye.x = play->view.eye.x; + this->eye.y = play->view.eye.y; + this->eye.z = play->view.eye.z; weight = dist; if (weight > 1.0f) { @@ -763,74 +763,74 @@ void func_80ACB748(EnOwl* this, GlobalContext* globalCtx) { switch (owlType) { case 7: func_800F436C(&D_80ACD62C, NA_SE_EV_FLYING_AIR - SFX_FLAG, weight * 2.0f); - if ((globalCtx->csCtx.frames > 324) || - ((globalCtx->csCtx.frames >= 142 && (globalCtx->csCtx.frames <= 266)))) { + if ((play->csCtx.frames > 324) || + ((play->csCtx.frames >= 142 && (play->csCtx.frames <= 266)))) { func_800F4414(&D_80ACD62C, NA_SE_EN_OWL_FLUTTER, weight * 2.0f); } - if (globalCtx->csCtx.frames == 85) { + if (play->csCtx.frames == 85) { func_800F436C(&D_80ACD62C, NA_SE_EV_PASS_AIR, weight * 2.0f); } break; case 8: case 9: func_800F436C(&D_80ACD62C, NA_SE_EV_FLYING_AIR - SFX_FLAG, weight * 2.0f); - if ((globalCtx->csCtx.frames >= 420) || - ((0xC1 < globalCtx->csCtx.frames && (globalCtx->csCtx.frames <= 280)))) { + if ((play->csCtx.frames >= 420) || + ((0xC1 < play->csCtx.frames && (play->csCtx.frames <= 280)))) { func_800F4414(&D_80ACD62C, NA_SE_EN_OWL_FLUTTER, weight * 2.0f); } - if (globalCtx->csCtx.frames == 217) { + if (play->csCtx.frames == 217) { func_800F436C(&D_80ACD62C, NA_SE_EV_PASS_AIR, weight * 2.0f); } break; } } -void func_80ACB904(EnOwl* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && (globalCtx->csCtx.npcActions[7] != NULL)) { - if (this->unk_40A != globalCtx->csCtx.npcActions[7]->action) { - func_80ACD130(this, globalCtx, 7); - func_80ACBAB8(this, globalCtx); +void func_80ACB904(EnOwl* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && (play->csCtx.npcActions[7] != NULL)) { + if (this->unk_40A != play->csCtx.npcActions[7]->action) { + func_80ACD130(this, play, 7); + func_80ACBAB8(this, play); } - func_80ACD2CC(this, globalCtx); + func_80ACD2CC(this, play); } if (this->actionFlags & 0x80) { - func_80ACB748(this, globalCtx); + func_80ACB748(this, play); } } -void func_80ACB994(EnOwl* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && (globalCtx->csCtx.npcActions[7] != NULL)) { - if (this->unk_40A != globalCtx->csCtx.npcActions[7]->action) { - func_80ACD130(this, globalCtx, 7); - func_80ACBAB8(this, globalCtx); +void func_80ACB994(EnOwl* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && (play->csCtx.npcActions[7] != NULL)) { + if (this->unk_40A != play->csCtx.npcActions[7]->action) { + func_80ACD130(this, play, 7); + func_80ACBAB8(this, play); } - func_80ACD4D4(this, globalCtx); + func_80ACD4D4(this, play); } if (this->actionFlags & 0x80) { - func_80ACB748(this, globalCtx); + func_80ACB748(this, play); } } -void EnOwl_WaitDefault(EnOwl* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && (globalCtx->csCtx.npcActions[7] != NULL)) { - if (this->unk_40A != globalCtx->csCtx.npcActions[7]->action) { +void EnOwl_WaitDefault(EnOwl* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && (play->csCtx.npcActions[7] != NULL)) { + if (this->unk_40A != play->csCtx.npcActions[7]->action) { this->actionFlags |= 4; - func_80ACD130(this, globalCtx, 7); - func_80ACBAB8(this, globalCtx); + func_80ACD130(this, play, 7); + func_80ACBAB8(this, play); } else { - this->actor.world.rot.z = globalCtx->csCtx.npcActions[7]->urot.y; + this->actor.world.rot.z = play->csCtx.npcActions[7]->urot.y; } } if (this->actionFlags & 0x80) { - func_80ACB748(this, globalCtx); + func_80ACB748(this, play); } } -void func_80ACBAB8(EnOwl* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.npcActions[7]->action - 1) { +void func_80ACBAB8(EnOwl* this, PlayState* play) { + switch (play->csCtx.npcActions[7]->action - 1) { case 0: EnOwl_ChangeMode(this, func_80ACB904, func_80ACC540, &this->skelAnime, &gOwlFlyAnim, 0.0f); break; @@ -851,10 +851,10 @@ void func_80ACBAB8(EnOwl* this, GlobalContext* globalCtx) { break; } - this->unk_40A = globalCtx->csCtx.npcActions[7]->action; + this->unk_40A = play->csCtx.npcActions[7]->action; } -void func_80ACBC0C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACBC0C(EnOwl* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_5; if (this->actor.xzDistToPlayer > 6000.0f && !(this->actionFlags & 0x80)) { @@ -879,7 +879,7 @@ void func_80ACBC0C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACBD4C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACBD4C(EnOwl* this, PlayState* play) { if (this->skelAnime.curFrame > 10.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_400, 2, 0x400, 0x40); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -908,7 +908,7 @@ void func_80ACBD4C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACBEA0(EnOwl* this, GlobalContext* GlobalContext) { +void func_80ACBEA0(EnOwl* this, PlayState* PlayState) { if (this->actionFlags & 1) { this->unk_3FE = 3; EnOwl_ChangeMode(this, func_80ACBD4C, func_80ACC540, &this->skelAnime, &gOwlTakeoffAnim, 0.0f); @@ -924,7 +924,7 @@ void func_80ACBEA0(EnOwl* this, GlobalContext* GlobalContext) { this->actionFlags |= 8; } -void func_80ACBF50(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACBF50(EnOwl* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_400, 2, 0x384, 0x258); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -938,7 +938,7 @@ void func_80ACBF50(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACC00C(EnOwl* this, PlayState* play) { s32 owlType; s32 temp_v0; s32 temp_v0_2; @@ -947,7 +947,7 @@ void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.xzDistToPlayer < 50.0f) { - if (!Gameplay_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { owlType = (this->actor.params & 0xFC0) >> 6; osSyncPrintf(VT_FGCOL(CYAN)); osSyncPrintf("%dのフクロウ\n", owlType); // "%d owl" @@ -958,23 +958,23 @@ void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { osSyncPrintf("SPOT 06 の デモがはしった\n"); // "Demo of SPOT 06 has been completed" osSyncPrintf(VT_RST); if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x027E; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x027E; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; } - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaOwlCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaOwlCs); this->actor.draw = NULL; break; case 8: case 9: if (gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x0554; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 2; + play->nextEntranceIndex = 0x0554; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 2; break; } - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gDMTOwlCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gDMTOwlCs); this->actor.draw = NULL; break; default: @@ -1004,7 +1004,7 @@ void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACC23C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACC23C(EnOwl* this, PlayState* play) { if (this->skelAnime.curFrame < 20.0f) { this->actor.speedXZ = 1.5f; } else { @@ -1025,7 +1025,7 @@ void func_80ACC23C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACC30C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACC30C(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { this->unk_3FE = 3; EnOwl_ChangeMode(this, func_80ACC23C, func_80ACC540, &this->skelAnime, &gOwlTakeoffAnim, 0.0f); @@ -1090,40 +1090,40 @@ s32 func_80ACC5CC(EnOwl* this) { } } -s32 func_80ACC624(EnOwl* this, GlobalContext* globalCtx) { +s32 func_80ACC624(EnOwl* this, PlayState* play) { s32 switchFlag = (this->actor.params & 0xFC0) >> 6; - if (globalCtx->sceneNum != SCENE_SPOT11) { + if (play->sceneNum != SCENE_SPOT11) { return true; } else if (switchFlag == 0xA) { return true; - } else if (globalCtx->csCtx.frames >= 300 && globalCtx->csCtx.frames <= 430) { + } else if (play->csCtx.frames >= 300 && play->csCtx.frames <= 430) { return true; - } else if (globalCtx->csCtx.frames >= 1080 && globalCtx->csCtx.frames <= 1170) { + } else if (play->csCtx.frames >= 1080 && play->csCtx.frames <= 1170) { return true; } else { return false; } } -void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Update(Actor* thisx, PlayState* play) { s32 pad; EnOwl* this = (EnOwl*)thisx; s16 phi_a1; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 5); this->unk_410(this); this->actionFlags &= ~8; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update == NULL) { // "Owl disappears" osSyncPrintf("フクロウ消滅!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); return; } - if (!(this->actionFlags & 0x80) && func_80ACC624(this, globalCtx)) { + if (!(this->actionFlags & 0x80) && func_80ACC624(this, play)) { if ((this->skelAnime.animation == &gOwlTakeoffAnim && (this->skelAnime.curFrame == 2.0f || this->skelAnime.curFrame == 9.0f || this->skelAnime.curFrame == 23.0f || this->skelAnime.curFrame == 40.0f || @@ -1297,7 +1297,7 @@ void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnOwl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnOwl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** gfx, Vec3f* pos, Vec3s* rot, void* thisx) { EnOwl* this = (EnOwl*)thisx; switch (limbIndex) { @@ -1325,7 +1325,7 @@ s32 EnOwl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, V return false; } -void EnOwl_PostLimbUpdate(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, Vec3s* rot, void* thisx) { +void EnOwl_PostLimbUpdate(PlayState* play, s32 limbIndex, Gfx** gfx, Vec3s* rot, void* thisx) { EnOwl* this = (EnOwl*)thisx; Vec3f vec; @@ -1342,19 +1342,19 @@ void EnOwl_PostLimbUpdate(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, Ve } } -void EnOwl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gObjOwlEyeOpenTex, gObjOwlEyeHalfTex, gObjOwlEyeClosedTex }; EnOwl* this = (EnOwl*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->curSkelAnime->skeleton, this->curSkelAnime->jointTable, + SkelAnime_DrawFlexOpa(play, this->curSkelAnime->skeleton, this->curSkelAnime->jointTable, this->curSkelAnime->dListCount, EnOwl_OverrideLimbDraw, EnOwl_PostLimbUpdate, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, OwlFunc arg2, SkelAnime* skelAnime, @@ -1366,20 +1366,20 @@ void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, OwlFunc arg2, Ske this->unk_410 = arg2; } -void func_80ACD130(EnOwl* this, GlobalContext* globalCtx, s32 idx) { +void func_80ACD130(EnOwl* this, PlayState* play, s32 idx) { Vec3f startPos; - startPos.x = globalCtx->csCtx.npcActions[idx]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[idx]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[idx]->startPos.z; + startPos.x = play->csCtx.npcActions[idx]->startPos.x; + startPos.y = play->csCtx.npcActions[idx]->startPos.y; + startPos.z = play->csCtx.npcActions[idx]->startPos.z; this->actor.world.pos = startPos; - this->actor.world.rot.y = this->actor.shape.rot.y = globalCtx->csCtx.npcActions[idx]->rot.y; - this->actor.shape.rot.z = globalCtx->csCtx.npcActions[idx]->urot.z; + this->actor.world.rot.y = this->actor.shape.rot.y = play->csCtx.npcActions[idx]->rot.y; + this->actor.shape.rot.z = play->csCtx.npcActions[idx]->urot.z; } -f32 func_80ACD1C4(GlobalContext* globalCtx, s32 idx) { - f32 ret = Environment_LerpWeight(globalCtx->csCtx.npcActions[idx]->endFrame, - globalCtx->csCtx.npcActions[idx]->startFrame, globalCtx->csCtx.frames); +f32 func_80ACD1C4(PlayState* play, s32 idx) { + f32 ret = Environment_LerpWeight(play->csCtx.npcActions[idx]->endFrame, + play->csCtx.npcActions[idx]->startFrame, play->csCtx.frames); ret = CLAMP_MAX(ret, 1.0f); return ret; @@ -1398,22 +1398,22 @@ void func_80ACD220(EnOwl* this, Vec3f* arg1, f32 arg2) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void func_80ACD2CC(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACD2CC(EnOwl* this, PlayState* play) { Vec3f pos; s32 angle; - f32 t = func_80ACD1C4(globalCtx, 7); + f32 t = func_80ACD1C4(play, 7); - pos.x = globalCtx->csCtx.npcActions[7]->startPos.x; - pos.y = globalCtx->csCtx.npcActions[7]->startPos.y; - pos.z = globalCtx->csCtx.npcActions[7]->startPos.z; - angle = (s16)globalCtx->csCtx.npcActions[7]->rot.y - this->actor.world.rot.z; + pos.x = play->csCtx.npcActions[7]->startPos.x; + pos.y = play->csCtx.npcActions[7]->startPos.y; + pos.z = play->csCtx.npcActions[7]->startPos.z; + angle = (s16)play->csCtx.npcActions[7]->rot.y - this->actor.world.rot.z; if (angle < 0) { angle += 0x10000; } angle = (s16)((t * angle) + this->actor.world.rot.z); angle = (u16)angle; if (this->actionFlags & 4) { - f32 phi_f2 = globalCtx->csCtx.npcActions[7]->urot.x; + f32 phi_f2 = play->csCtx.npcActions[7]->urot.x; phi_f2 *= 10.0f * (360.0f / 0x10000); if (phi_f2 < 0.0f) { @@ -1433,17 +1433,17 @@ void func_80ACD2CC(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACD4D4(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACD4D4(EnOwl* this, PlayState* play) { Vec3f pos; Vec3f endPosf; - f32 temp_ret = func_80ACD1C4(globalCtx, 7); + f32 temp_ret = func_80ACD1C4(play, 7); - pos.x = globalCtx->csCtx.npcActions[7]->startPos.x; - pos.y = globalCtx->csCtx.npcActions[7]->startPos.y; - pos.z = globalCtx->csCtx.npcActions[7]->startPos.z; - endPosf.x = globalCtx->csCtx.npcActions[7]->endPos.x; - endPosf.y = globalCtx->csCtx.npcActions[7]->endPos.y; - endPosf.z = globalCtx->csCtx.npcActions[7]->endPos.z; + pos.x = play->csCtx.npcActions[7]->startPos.x; + pos.y = play->csCtx.npcActions[7]->startPos.y; + pos.z = play->csCtx.npcActions[7]->startPos.z; + endPosf.x = play->csCtx.npcActions[7]->endPos.x; + endPosf.y = play->csCtx.npcActions[7]->endPos.y; + endPosf.z = play->csCtx.npcActions[7]->endPos.z; pos.x = (endPosf.x - pos.x) * temp_ret + pos.x; pos.y = (endPosf.y - pos.y) * temp_ret + pos.y; pos.z = (endPosf.z - pos.z) * temp_ret + pos.z; diff --git a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.h index d83e52819..d34e72283 100644 --- a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -6,7 +6,7 @@ struct EnOwl; -typedef void (*EnOwlActionFunc)(struct EnOwl*, GlobalContext*); +typedef void (*EnOwlActionFunc)(struct EnOwl*, PlayState*); typedef void (*OwlFunc)(struct EnOwl*); typedef struct EnOwl { diff --git a/soh/src/overlays/actors/ovl_En_Part/z_en_part.c b/soh/src/overlays/actors/ovl_En_Part/z_en_part.c index 86be078b4..8088b87ea 100644 --- a/soh/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/soh/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -10,10 +10,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnPart_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPart_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPart_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPart_Init(Actor* thisx, PlayState* play); +void EnPart_Destroy(Actor* thisx, PlayState* play); +void EnPart_Update(Actor* thisx, PlayState* play); +void EnPart_Draw(Actor* thisx, PlayState* play); const ActorInit En_Part_InitVars = { ACTOR_EN_PART, @@ -28,13 +28,13 @@ const ActorInit En_Part_InitVars = { NULL, }; -void EnPart_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Init(Actor* thisx, PlayState* play) { } -void EnPart_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Destroy(Actor* thisx, PlayState* play) { } -void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { +void func_80ACDDE8(EnPart* this, PlayState* play) { f32 sign = 1.0f; this->action = 1; @@ -59,7 +59,7 @@ void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { this->rotZSpeed = 0.15f; break; case 14: - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); case 1: case 4: case 9: @@ -71,7 +71,7 @@ void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { this->rotZSpeed = 0.15f; break; case 11: - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); case 3: this->actor.speedXZ = (Rand_ZeroOne() - 0.5f) * 3.0f; this->timer = (s16)(Rand_ZeroOne() * 17.0f) + 10; @@ -97,7 +97,7 @@ void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { } } -void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { +void func_80ACE13C(EnPart* this, PlayState* play) { s32 i; Vec3f pos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -105,7 +105,7 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if ((this->actor.params == 12) || (this->actor.params == 13)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, 0x1D); if ((this->actor.bgCheckFlags & 1) || (this->actor.world.pos.y <= this->actor.floorHeight)) { this->action = 4; @@ -123,13 +123,13 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { case 9: case 10: case 14: - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, (s16)(this->actor.scale.y * 100.0f) * 40, 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, true); break; case 3: case 11: - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, (s16)(this->actor.scale.y * 100.0f) * 40, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); break; @@ -140,7 +140,7 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { Rand_CenteredFloat(50.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(60.0f); velocity.y = Rand_ZeroOne() + 1.0f; - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, Rand_S16Offset(80, 100), 25, + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, Rand_S16Offset(80, 100), 25, 0, true); } break; @@ -152,7 +152,7 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(25.0f); pos.y = this->actor.world.pos.y + Rand_CenteredFloat(40.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(25.0f); - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 0, 0, 255, 1, + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } break; @@ -166,12 +166,12 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { this->rotZ += this->rotZSpeed; } -void func_80ACE5B8(EnPart* this, GlobalContext* globalCtx) { +void func_80ACE5B8(EnPart* this, PlayState* play) { this->action = 3; } -void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ACE5C8(EnPart* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->timer--; if (this->timer == 0) { @@ -188,28 +188,28 @@ void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } - func_8002F71C(globalCtx, this->actor.parent, (650.0f - this->actor.parent->xzDistToPlayer) * 0.04f + 4.0f, + func_8002F71C(play, this->actor.parent, (650.0f - this->actor.parent->xzDistToPlayer) * 0.04f + 4.0f, this->actor.parent->world.rot.y, 8.0f); player->invincibilityTimer = prevInvincibilityTimer; this->timer = 1; } - func_80033480(globalCtx, &this->actor.world.pos, 0.0f, 1, 300, 150, 1); + func_80033480(play, &this->actor.world.pos, 0.0f, 1, 300, 150, 1); velocity.x = Rand_CenteredFloat(16.0f); - EffectSsHahen_Spawn(globalCtx, &this->actor.world.pos, &velocity, &accel, 20, + EffectSsHahen_Spawn(play, &this->actor.world.pos, &velocity, &accel, 20, (s32)((Rand_ZeroOne() * 5.0f + 12.0f) * 2), -1, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MONBLIN_GNDWAVE - SFX_FLAG); } } -void func_80ACE7E8(EnPart* this, GlobalContext* globalCtx) { +void func_80ACE7E8(EnPart* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if ((this->actor.parent == NULL) || (this->actor.parent->update == NULL)) { - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, (s16)(this->actor.scale.y * 100.0f) * 40, 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, true); Actor_Kill(&this->actor); return; @@ -235,7 +235,7 @@ void func_80ACE7E8(EnPart* this, GlobalContext* globalCtx) { } } -void EnPart_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Update(Actor* thisx, PlayState* play) { static EnPartActionFunc sActionFuncs[] = { func_80ACDDE8, func_80ACE13C, func_80ACE5B8, func_80ACE5C8, func_80ACE7E8, }; @@ -245,7 +245,7 @@ void EnPart_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if ((this->actor.params > 4 && this->actor.params < 9) || this->actor.params < 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, 5); if (this->actor.params >= 0) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (thisx->bgCheckFlags & 1) { @@ -255,7 +255,7 @@ void EnPart_Update(Actor* thisx, GlobalContext* globalCtx) { } } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } Gfx* func_80ACEAC0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { @@ -273,30 +273,30 @@ Gfx* func_80ACEAC0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 env return dList; } -void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Draw(Actor* thisx, PlayState* play) { EnPart* this = (EnPart*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (thisx->params > 0) { Matrix_RotateZ(this->rotZ, MTXMODE_APPLY); } - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(thisx, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(thisx, play, 0); if (thisx->params == 5) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(globalCtx->state.gfxCtx, 245, 255, 205, 30, 35, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 185, 135, 25, 20, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 255, 255, 255, 30, 40, 20)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(play->state.gfxCtx, 245, 255, 205, 30, 35, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(play->state.gfxCtx, 185, 135, 25, 20, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(play->state.gfxCtx, 255, 255, 255, 30, 40, 20)); } else if (thisx->params == 6) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(globalCtx->state.gfxCtx, 55, 65, 55, 0, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(play->state.gfxCtx, 55, 65, 55, 0, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); } else if (thisx->params == 7) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(globalCtx->state.gfxCtx, 255, 255, 255, 180, 180, 180)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(play->state.gfxCtx, 255, 255, 255, 180, 180, 180)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); } else if ((thisx->params == 9) && (this->displayList == ResourceMgr_LoadGfxByName(object_tite_DL_002FF0))) { gSPSegment(POLY_OPA_DISP++, 0x08, object_tite_Tex_001300); gSPSegment(POLY_OPA_DISP++, 0x09, object_tite_Tex_001700); @@ -308,10 +308,10 @@ void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (this->displayList != NULL) { - 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++, this->displayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Part/z_en_part.h b/soh/src/overlays/actors/ovl_En_Part/z_en_part.h index 8beb516a3..3502d80a8 100644 --- a/soh/src/overlays/actors/ovl_En_Part/z_en_part.h +++ b/soh/src/overlays/actors/ovl_En_Part/z_en_part.h @@ -6,7 +6,7 @@ struct EnPart; -typedef void (*EnPartActionFunc)(struct EnPart*, GlobalContext*); +typedef void (*EnPartActionFunc)(struct EnPart*, PlayState*); typedef struct EnPart { /* 0x000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 4efd71755..2d66eb2ff 100644 --- a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -8,37 +8,37 @@ #define GROUND_HOVER_HEIGHT 75.0f #define MAX_LARVA 3 -void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPeehat_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPeehat_Init(Actor* thisx, PlayState* play); +void EnPeehat_Destroy(Actor* thisx, PlayState* play); +void EnPeehat_Update(Actor* thisx, PlayState* play); +void EnPeehat_Draw(Actor* thisx, PlayState* play); void EnPeehat_Ground_SetStateGround(EnPeehat* this); void EnPeehat_Flying_SetStateGround(EnPeehat* this); void EnPeehat_Larva_SetStateSeekPlayer(EnPeehat* this); -void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Ground_StateGround(EnPeehat* this, PlayState* play); void EnPeehat_Ground_SetStateRise(EnPeehat* this); -void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Flying_StateGrounded(EnPeehat* this, PlayState* play); void EnPeehat_Flying_SetStateRise(EnPeehat* this); -void EnPeehat_Flying_StateFly(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Flying_StateFly(EnPeehat* this, PlayState* play); void EnPeehat_Flying_SetStateLanding(EnPeehat* this); -void EnPeehat_Ground_StateRise(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play); void EnPeehat_Ground_SetStateHover(EnPeehat* this); -void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play); +void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, PlayState* play); void EnPeehat_Ground_SetStateReturnHome(EnPeehat* this); void EnPeehat_Ground_SetStateLanding(EnPeehat* this); -void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, PlayState* play); void EnPeehat_SetStateAttackRecoil(EnPeehat* this); -void EnPeehat_Ground_StateLanding(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_StateBoomerangStunned(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Ground_StateLanding(EnPeehat* this, PlayState* play); +void EnPeehat_Flying_StateLanding(EnPeehat* this, PlayState* play); +void EnPeehat_Ground_StateHover(EnPeehat* this, PlayState* play); +void EnPeehat_Ground_StateReturnHome(EnPeehat* this, PlayState* play); +void EnPeehat_StateAttackRecoil(EnPeehat* this, PlayState* play); +void EnPeehat_StateBoomerangStunned(EnPeehat* this, PlayState* play); +void EnPeehat_Adult_StateDie(EnPeehat* this, PlayState* play); void EnPeehat_SetStateExplode(EnPeehat* this); -void EnPeehat_StateExplode(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_StateExplode(EnPeehat* this, PlayState* play); const ActorInit En_Peehat_InitVars = { ACTOR_EN_PEEHAT, @@ -188,12 +188,12 @@ void EnPeehat_SetupAction(EnPeehat* this, EnPeehatActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Init(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, 36.0f * 0.001f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPeehatSkel, &gPeehatRisingAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gPeehatSkel, &gPeehatRisingAnim, this->jointTable, this->morphTable, 24); ActorShape_Init(&this->actor.shape, 100.0f, ActorShadow_DrawCircle, 27.0f); this->actor.focus.pos = this->actor.world.pos; @@ -203,12 +203,12 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 6; this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.floorHeight = this->actor.world.pos.y; - Collider_InitCylinder(globalCtx, &this->colCylinder); - Collider_SetCylinder(globalCtx, &this->colCylinder, &this->actor, &sCylinderInit); - Collider_InitQuad(globalCtx, &this->colQuad); - Collider_SetQuad(globalCtx, &this->colQuad, &this->actor, &sQuadInit); - Collider_InitJntSph(globalCtx, &this->colJntSph); - Collider_SetJntSph(globalCtx, &this->colJntSph, &this->actor, &sJntSphInit, this->colJntSphItemList); + Collider_InitCylinder(play, &this->colCylinder); + Collider_SetCylinder(play, &this->colCylinder, &this->actor, &sCylinderInit); + Collider_InitQuad(play, &this->colQuad); + Collider_SetQuad(play, &this->colQuad, &this->actor, &sQuadInit); + Collider_InitJntSph(play, &this->colJntSph); + Collider_SetJntSph(play, &this->colJntSph, &this->actor, &sJntSphInit, this->colJntSphItemList); this->actor.naviEnemyId = 0x48; this->xzDistToRise = 740.0f; @@ -242,12 +242,12 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Destroy(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; EnPeehat* parent; - Collider_DestroyCylinder(globalCtx, &this->colCylinder); - Collider_DestroyJntSph(globalCtx, &this->colJntSph); + Collider_DestroyCylinder(play, &this->colCylinder); + Collider_DestroyJntSph(play, &this->colJntSph); // If PEAHAT_TYPE_LARVA, decrement total larva spawned if (this->actor.params > 0) { @@ -258,7 +258,7 @@ void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPeehat_SpawnDust(GlobalContext* globalCtx, EnPeehat* this, Vec3f* pos, f32 arg3, s32 arg4, f32 arg5, f32 arg6) { +void EnPeehat_SpawnDust(PlayState* play, EnPeehat* this, Vec3f* pos, f32 arg3, s32 arg4, f32 arg5, f32 arg6) { Vec3f dustPos; Vec3f dustVel = { 0.0f, 8.0f, 0.0f }; Vec3f dustAccel = { 0.0f, -1.5f, 0.0f }; @@ -273,21 +273,21 @@ void EnPeehat_SpawnDust(GlobalContext* globalCtx, EnPeehat* this, Vec3f* pos, f3 dustAccel.z = (Rand_ZeroOne() - 0.5f) * arg5; dustVel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; pScale = (Rand_ZeroOne() * 5 + 12) * arg6; - EffectSsHahen_Spawn(globalCtx, &dustPos, &dustVel, &dustAccel, arg4, pScale, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_Spawn(play, &dustPos, &dustVel, &dustAccel, arg4, pScale, HAHEN_OBJECT_DEFAULT, 10, NULL); } /** * Handles being hit when on the ground */ -void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_HitWhenGrounded(EnPeehat* this, PlayState* play) { this->colCylinder.base.acFlags &= ~AC_HIT; - if ((globalCtx->gameplayFrames & 0xF) == 0) { + if ((play->gameplayFrames & 0xF) == 0) { Vec3f itemDropPos = this->actor.world.pos; itemDropPos.y += 70.0f; - Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &itemDropPos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &itemDropPos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &itemDropPos, 0x40); this->unk_2D4 = 240; } else { s32 i; @@ -295,7 +295,7 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { this->colCylinder.base.acFlags &= ~AC_HIT; for (i = MAX_LARVA - this->unk_2FA; i > 0; i--) { Actor* larva = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PEEHAT, Rand_CenteredFloat(25.0f) + this->actor.world.pos.x, Rand_CenteredFloat(25.0f) + (this->actor.world.pos.y + 50.0f), Rand_CenteredFloat(25.0f) + this->actor.world.pos.z, 0, 0, 0, PEAHAT_TYPE_LARVA); @@ -322,7 +322,7 @@ void EnPeehat_Ground_SetStateGround(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateGround); } -void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateGround(EnPeehat* this, PlayState* play) { if (IS_DAY) { this->actor.flags |= ACTOR_FLAG_0; if (this->riseDelayTimer == 0) { @@ -344,7 +344,7 @@ void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); } } else if (this->colCylinder.base.acFlags & AC_HIT) { - EnPeehat_HitWhenGrounded(this, globalCtx); + EnPeehat_HitWhenGrounded(this, play); } } } @@ -359,7 +359,7 @@ void EnPeehat_Flying_SetStateGround(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateGrounded); } -void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateGrounded(EnPeehat* this, PlayState* play) { if (IS_DAY) { if (this->actor.xzDistToPlayer < this->xzDistToRise) { EnPeehat_Flying_SetStateRise(this); @@ -374,7 +374,7 @@ void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); } } else if (this->colCylinder.base.acFlags & AC_HIT) { - EnPeehat_HitWhenGrounded(this, globalCtx); + EnPeehat_HitWhenGrounded(this, play); } } } @@ -385,14 +385,14 @@ void EnPeehat_Flying_SetStateFly(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateFly); } -void EnPeehat_Flying_StateFly(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateFly(EnPeehat* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); SkelAnime_Update(&this->skelAnime); if (!IS_DAY || this->xzDistToRise < this->actor.xzDistToPlayer) { EnPeehat_Flying_SetStateLanding(this); } else if (this->actor.xzDistToPlayer < this->xzDistMax) { - if (this->unk_2FA < MAX_LARVA && (globalCtx->gameplayFrames & 7) == 0) { - Actor* larva = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT, + if (this->unk_2FA < MAX_LARVA && (play->gameplayFrames & 7) == 0) { + Actor* larva = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PEEHAT, Rand_CenteredFloat(25.0f) + this->actor.world.pos.x, Rand_CenteredFloat(5.0f) + this->actor.world.pos.y, Rand_CenteredFloat(25.0f) + this->actor.world.pos.z, 0, 0, 0, 1); @@ -417,7 +417,7 @@ void EnPeehat_Ground_SetStateRise(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateRise); } -void EnPeehat_Ground_StateRise(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -437,10 +437,10 @@ void EnPeehat_Ground_StateRise(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 90.0f, 1, 0x96, 100, 1); + func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } } - EnPeehat_SpawnDust(globalCtx, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); + EnPeehat_SpawnDust(play, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); Math_SmoothStepToF(&this->scaleShift, 0.075f, 1.0f, 0.005f, 0.0f); this->bladeRot += this->bladeRotVel; } @@ -458,7 +458,7 @@ void EnPeehat_Flying_SetStateRise(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateRise); } -void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -480,10 +480,10 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 90.0f, 1, 0x96, 100, 1); + func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } } - EnPeehat_SpawnDust(globalCtx, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); + EnPeehat_SpawnDust(play, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); Math_SmoothStepToF(&this->scaleShift, 0.075f, 1.0f, 0.005f, 0.0f); this->bladeRot += this->bladeRotVel; } @@ -495,8 +495,8 @@ void EnPeehat_Ground_SetStateSeekPlayer(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateSeekPlayer); } -void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 3.0f, 1.0f, 0.25f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 80.0f, 1.0f, 3.0f, 0.0f); @@ -530,7 +530,7 @@ void EnPeehat_Larva_SetStateSeekPlayer(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Larva_StateSeekPlayer); } -void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, PlayState* play) { f32 speedXZ = 5.3f; if (this->actor.xzDistToPlayer <= 5.3f) { @@ -562,7 +562,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { EnPeehat_SetStateAttackRecoil(this); } else if ((this->colQuad.base.atFlags & AT_HIT) || (this->colCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & 1)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->colQuad.base.atFlags &= ~AT_HIT; if (!(this->colCylinder.base.acFlags & AC_HIT) && &player->actor == this->colQuad.base.at) { if (Rand_ZeroOne() > 0.5f) { @@ -579,16 +579,16 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); } } if (&player->actor != this->colQuad.base.at || this->colCylinder.base.acFlags & AC_HIT) { if (!(this->actor.bgCheckFlags & 1)) { - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_PIHAT_SM_DEAD, 1, 1, + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_PIHAT_SM_DEAD, 1, 1, 40); } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x20); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x20); Actor_Kill(&this->actor); } } @@ -600,7 +600,7 @@ void EnPeehat_Ground_SetStateLanding(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateLanding); } -void EnPeehat_Ground_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateLanding(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 50, 0); @@ -613,8 +613,8 @@ void EnPeehat_Ground_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 60.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 80.0f, 1, 150, 100, 1); - EnPeehat_SpawnDust(globalCtx, this, &pos, 75.0f, 2, 1.05f, 2.0f); + func_80033480(play, &pos, 80.0f, 1, 150, 100, 1); + EnPeehat_SpawnDust(play, this, &pos, 75.0f, 2, 1.05f, 2.0f); } } Math_SmoothStepToS(&this->bladeRotVel, 0, 1, 100, 0); @@ -627,7 +627,7 @@ void EnPeehat_Flying_SetStateLanding(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateLanding); } -void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateLanding(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 50, 0); @@ -640,8 +640,8 @@ void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 60.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 80.0f, 1, 150, 100, 1); - EnPeehat_SpawnDust(globalCtx, this, &pos, 75.0f, 2, 1.05f, 2.0f); + func_80033480(play, &pos, 80.0f, 1, 150, 100, 1); + EnPeehat_SpawnDust(play, this, &pos, 75.0f, 2, 1.05f, 2.0f); } } Math_SmoothStepToS(&this->bladeRotVel, 0, 1, 100, 0); @@ -656,9 +656,9 @@ void EnPeehat_Ground_SetStateHover(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateHover); } -void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateHover(EnPeehat* this, PlayState* play) { f32 cos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); // hover but don't gain altitude if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) { @@ -686,7 +686,7 @@ void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) { if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnPeehat_Ground_SetStateSeekPlayer(this); - this->unk_2FA = globalCtx->gameplayFrames & 1; + this->unk_2FA = play->gameplayFrames & 1; } else { EnPeehat_Ground_SetStateReturnHome(this); } @@ -702,12 +702,12 @@ void EnPeehat_Ground_SetStateReturnHome(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateReturnHome); } -void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateReturnHome(EnPeehat* this, PlayState* play) { f32 cos; s16 yRot; Player* player; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) { this->actor.world.pos.y -= 1.0f; } else { @@ -728,7 +728,7 @@ void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) { if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) { this->seekPlayerTimer = 400; EnPeehat_Ground_SetStateSeekPlayer(this); - this->unk_2FA = (globalCtx->gameplayFrames & 1); + this->unk_2FA = (play->gameplayFrames & 1); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); } @@ -741,7 +741,7 @@ void EnPeehat_SetStateAttackRecoil(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_StateAttackRecoil); } -void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_StateAttackRecoil(EnPeehat* this, PlayState* play) { this->bladeRot += this->bladeRotVel; SkelAnime_Update(&this->skelAnime); this->actor.speedXZ += 0.5f; @@ -755,7 +755,7 @@ void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); } Actor_Kill(&this->actor); @@ -782,7 +782,7 @@ void EnPeehat_SetStateBoomerangStunned(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_StateBoomerangStunned); } -void EnPeehat_StateBoomerangStunned(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_StateBoomerangStunned(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight, 1.0f, 8.0f, 0.0f); if (this->actor.colorFilterTimer == 0) { @@ -801,7 +801,7 @@ void EnPeehat_Adult_SetStateDie(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Adult_StateDie); } -void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Adult_StateDie(EnPeehat* this, PlayState* play) { if (this->isStateDieFirstUpdate) { this->unk_2D4--; if (this->unk_2D4 <= 0 || this->actor.colChkInfo.health == 0) { @@ -829,8 +829,8 @@ void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) { this->actor.world.pos.y - this->actor.floorHeight < 59.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 80.0f, 1, 150, 100, 1); - EnPeehat_SpawnDust(globalCtx, this, &pos, 75.0f, 2, 1.05f, 2.0f); + func_80033480(play, &pos, 80.0f, 1, 150, 100, 1); + EnPeehat_SpawnDust(play, this, &pos, 75.0f, 2, 1.05f, 2.0f); } if (this->actor.speedXZ < 0) { this->actor.speedXZ += 0.25f; @@ -858,12 +858,12 @@ void EnPeehat_SetStateExplode(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_StateExplode); } -void EnPeehat_StateExplode(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_StateExplode(EnPeehat* this, PlayState* play) { EnBom* bomb; s32 pad[2]; if (this->animTimer == 5) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x602, 0); if (bomb != NULL) { bomb->timer = 0; @@ -871,14 +871,14 @@ void EnPeehat_StateExplode(EnPeehat* this, GlobalContext* globalCtx) { } this->animTimer--; if (this->animTimer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); Actor_Kill(&this->actor); } } -void EnPeehat_Adult_CollisionCheck(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Adult_CollisionCheck(EnPeehat* this, PlayState* play) { if ((this->colCylinder.base.acFlags & AC_BOUNCED) || (this->colQuad.base.acFlags & AC_BOUNCED)) { this->colQuad.base.acFlags &= ~AC_BOUNCED; this->colCylinder.base.acFlags &= ~AC_BOUNCED; @@ -910,7 +910,7 @@ void EnPeehat_Adult_CollisionCheck(EnPeehat* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_ZeroOne() * 25.0f + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &pos, 70, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &pos, 70, 0, 0, -1); } Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, 100); } @@ -920,23 +920,23 @@ void EnPeehat_Adult_CollisionCheck(EnPeehat* this, GlobalContext* globalCtx) { } } -void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Update(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); // If Adult Peahat if (thisx->params <= 0) { - EnPeehat_Adult_CollisionCheck(this, globalCtx); + EnPeehat_Adult_CollisionCheck(this, play); } if (thisx->colChkInfo.damageEffect != PEAHAT_DMG_EFF_LIGHT_ICE_ARROW) { if (thisx->speedXZ != 0.0f || thisx->velocity.y != 0.0f) { Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 30.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 30.0f, 30.0f, 5); } - this->actionFunc(this, globalCtx); - if ((globalCtx->gameplayFrames & 0x7F) == 0) { + this->actionFunc(this, play); + if ((play->gameplayFrames & 0x7F) == 0) { this->jiggleRotInc = (Rand_ZeroOne() * 0.25f) + 0.5f; } this->jiggleRot += this->jiggleRotInc; @@ -959,11 +959,11 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->colChkInfo.health > 0) { // If Adult Peahat if (thisx->params <= 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colJntSph.base); if (thisx->colorFilterTimer == 0 || !(thisx->colorFilterParams & 0x4000)) { if (this->state != PEAHAT_STATE_EXPLODE) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colJntSph.base); } } } @@ -977,8 +977,8 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->state == PEAHAT_STATE_15 || this->state == PEAHAT_STATE_SEEK_PLAYER || this->state == PEAHAT_STATE_FLY || this->state == PEAHAT_STATE_RETURN_HOME || this->state == PEAHAT_STATE_EXPLODE) { if (thisx->params != PEAHAT_TYPE_FLYING) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colQuad.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colQuad.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colQuad.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colQuad.base); } // if PEAHAT_TYPE_GROUNDED if (thisx->params < 0 && (thisx->flags & ACTOR_FLAG_6)) { @@ -988,22 +988,22 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { s32 bgId; Vec3f* posB = &this->bladeTip[i]; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &thisx->world.pos, posB, &posResult, &poly, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, posB, &posResult, &poly, true, true, false, true, &bgId) == true) { - func_80033480(globalCtx, &posResult, 0.0f, 1, 300, 150, 1); - EnPeehat_SpawnDust(globalCtx, this, &posResult, 0.0f, 3, 1.05f, 1.5f); + func_80033480(play, &posResult, 0.0f, 1, 300, 150, 1); + EnPeehat_SpawnDust(play, this, &posResult, 0.0f, 3, 1.05f, 1.5f); } } } else if (thisx->params != PEAHAT_TYPE_FLYING) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); } Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.001f, 0.0f); } -s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnPeehat_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnPeehat* this = (EnPeehat*)thisx; @@ -1012,7 +1012,7 @@ s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } if (limbIndex == 3 || (limbIndex == 23 && (this->state == PEAHAT_STATE_DYING || this->state == PEAHAT_STATE_3 || this->state == PEAHAT_STATE_4))) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(this->jiggleRot * 0.115f, MTXMODE_APPLY); @@ -1022,17 +1022,17 @@ s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Matrix_RotateZ(-(this->jiggleRot * 0.1f), MTXMODE_APPLY); Matrix_RotateY(-(this->jiggleRot * 0.13f), MTXMODE_APPLY); Matrix_RotateX(-(this->jiggleRot * 0.115f), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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); return true; } return false; } -void EnPeehat_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnPeehat_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f peahatBladeTip[] = { { 0.0f, 0.0f, 5500.0f }, { 0.0f, 0.0f, -5500.0f } }; EnPeehat* this = (EnPeehat*)thisx; @@ -1046,7 +1046,7 @@ void EnPeehat_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, // is Adult Peahat if (limbIndex == 3 && this->actor.params <= 0) { damageYRot = 0.0f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(-1000.0f, 0.0f, 0.0f, MTXMODE_APPLY); Collider_UpdateSpheres(0, &this->colJntSph); @@ -1056,22 +1056,22 @@ void EnPeehat_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } Matrix_RotateY(3.2f + damageYRot, MTXMODE_APPLY); Matrix_Scale(0.3f, 0.2f, 0.2f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 EnPeehat_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Draw(Actor* thisx, PlayState* play) { static Vec3f D_80AD285C[] = { { 0.0f, 0.0f, -4500.0f }, { -4500.0f, 0.0f, 0.0f }, { 4500.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 4500.0f } }; EnPeehat* this = (EnPeehat*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, EnPeehat_PostLimbDraw, this); if (this->actor.speedXZ != 0.0f || this->actor.velocity.y != 0.0f) { Matrix_MultVec3f(&D_80AD285C[0], &this->colQuad.dim.quad[1]); diff --git a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index ffc7f265b..706ec34bb 100644 --- a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -12,7 +12,7 @@ typedef enum { struct EnPeehat; -typedef void (*EnPeehatActionFunc)(struct EnPeehat*, GlobalContext*); +typedef void (*EnPeehatActionFunc)(struct EnPeehat*, PlayState*); typedef struct EnPeehat { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index 493e2ec54..869184a37 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_7 | ACTOR_FLAG_12) -void EnPoDesert_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoDesert_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoDesert_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoDesert_Init(Actor* thisx, PlayState* play); +void EnPoDesert_Destroy(Actor* thisx, PlayState* play); +void EnPoDesert_Update(Actor* thisx, PlayState* play); +void EnPoDesert_Draw(Actor* thisx, PlayState* play); -void EnPoDesert_SetNextPathPoint(EnPoDesert* this, GlobalContext* globalCtx); -void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx); -void EnPoDesert_MoveToNextPoint(EnPoDesert* this, GlobalContext* globalCtx); -void EnPoDesert_Disappear(EnPoDesert* this, GlobalContext* globalCtx); +void EnPoDesert_SetNextPathPoint(EnPoDesert* this, PlayState* play); +void EnPoDesert_WaitForPlayer(EnPoDesert* this, PlayState* play); +void EnPoDesert_MoveToNextPoint(EnPoDesert* this, PlayState* play); +void EnPoDesert_Disappear(EnPoDesert* this, PlayState* play); const ActorInit En_Po_Desert_InitVars = { ACTOR_EN_PO_DESERT, @@ -58,38 +58,38 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 3200, ICHAIN_STOP), }; -void EnPoDesert_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Init(Actor* thisx, PlayState* play) { s32 pad; EnPoDesert* this = (EnPoDesert*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, 10); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColliderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sColliderInit); this->lightColor.r = 255; this->lightColor.g = 255; this->lightColor.b = 210; this->lightColor.a = 255; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 200); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 37.0f); this->currentPathPoint = 1; this->actor.params = (this->actor.params >> 8) & 0xFF; this->targetY = this->actor.world.pos.y; - EnPoDesert_SetNextPathPoint(this, globalCtx); + EnPoDesert_SetNextPathPoint(this, play); } -void EnPoDesert_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Destroy(Actor* thisx, PlayState* play) { EnPoDesert* this = (EnPoDesert*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); } -void EnPoDesert_SetNextPathPoint(EnPoDesert* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params]; +void EnPoDesert_SetNextPathPoint(EnPoDesert* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params]; Vec3s* pathPoint; Animation_MorphToLoop(&this->skelAnime, &gPoeFieldDisappearAnim, -6.0f); @@ -131,15 +131,15 @@ void EnPoDesert_UpdateSpeedModifier(EnPoDesert* this) { this->actor.world.pos.y = Math_SinS(this->speedModifier * 0x800) * 13.0f + this->targetY; } -void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx) { +void EnPoDesert_WaitForPlayer(EnPoDesert* this, PlayState* play) { func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); - if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.lensActive)) { + if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || play->actorCtx.lensActive)) { if (this->currentPathPoint == 2) { - if (Gameplay_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { this->actor.shape.rot.y += 0x800; return; } - Message_StartTextbox(globalCtx, 0x600B, NULL); + Message_StartTextbox(play, 0x600B, NULL); } EnPoDesert_SetupMoveToNextPoint(this); } else { @@ -147,7 +147,7 @@ void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx) { } } -void EnPoDesert_MoveToNextPoint(EnPoDesert* this, GlobalContext* globalCtx) { +void EnPoDesert_MoveToNextPoint(EnPoDesert* this, PlayState* play) { f32 temp_f20; if (this->actionTimer != 0) { @@ -167,14 +167,14 @@ void EnPoDesert_MoveToNextPoint(EnPoDesert* this, GlobalContext* globalCtx) { this->targetY = this->actor.home.pos.y - ((temp_f20 * this->yDiff) / this->initDistToNextPoint); if (temp_f20 < 40.0f) { if (this->currentPathPoint != 0) { - EnPoDesert_SetNextPathPoint(this, globalCtx); + EnPoDesert_SetNextPathPoint(this, play); } else { EnPoDesert_SetupDisappear(this); } } } -void EnPoDesert_Disappear(EnPoDesert* this, GlobalContext* globalCtx) { +void EnPoDesert_Disappear(EnPoDesert* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } @@ -186,19 +186,19 @@ void EnPoDesert_Disappear(EnPoDesert* this, GlobalContext* globalCtx) { } } -void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Update(Actor* thisx, PlayState* play) { EnPoDesert* this = (EnPoDesert*)thisx; s32 pad; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); EnPoDesert_UpdateSpeedModifier(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 27.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, 4); Actor_SetFocus(&this->actor, 42.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (globalCtx->actorCtx.lensActive) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawCircle; } else { @@ -207,7 +207,7 @@ void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnPoDesert_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnPoDesert_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoDesert* this = (EnPoDesert*)thisx; f32 mtxScale; @@ -222,7 +222,7 @@ s32 EnPoDesert_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnPoDesert_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, +void EnPoDesert_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { static Vec3f baseLightPos = { 0.0f, 1400.0f, 0.0f }; @@ -240,7 +240,7 @@ void EnPoDesert_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { gDPPipeSync((*gfxP)++); gDPSetEnvColor((*gfxP)++, color.r, color.g, color.b, 255); - gSPMatrix((*gfxP)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfxP)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, gPoeFieldLanternDL); gSPDisplayList((*gfxP)++, gPoeFieldLanternTopDL); @@ -251,21 +251,21 @@ void EnPoDesert_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnPoDesert_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Draw(Actor* thisx, PlayState* play) { EnPoDesert* this = (EnPoDesert*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 85, 0, 255)); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + gSPSegment(POLY_XLU_DISP++, 0x0A, Gfx_EnvColor(play->state.gfxCtx, 255, 85, 0, 255)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); if (this->actionFunc == EnPoDesert_Disappear) { gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); } else { gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280 + 2); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoDesert_OverrideLimbDraw, EnPoDesert_PostLimbDraw, &this->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h b/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h index a0c84fa21..aeb2503ed 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h +++ b/soh/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h @@ -6,7 +6,7 @@ struct EnPoDesert; -typedef void (*EnPoDesertActionFunc)(struct EnPoDesert*, GlobalContext*); +typedef void (*EnPoDesertActionFunc)(struct EnPoDesert*, PlayState*); typedef struct EnPoDesert { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 356a09dc6..821e50ae7 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -12,28 +12,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_12) -void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoField_Init(Actor* thisx, PlayState* play); +void EnPoField_Destroy(Actor* thisx, PlayState* play); +void EnPoField_Update(Actor* thisx, PlayState* play); +void EnPoField_Draw(Actor* thisx, PlayState* play); void EnPoField_Reset(void); -void EnPoField_UpdateDead(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_DrawSoul(Actor* thisx, GlobalContext* globalCtx); +void EnPoField_UpdateDead(Actor* thisx, PlayState* play); +void EnPoField_DrawSoul(Actor* thisx, PlayState* play); -void EnPoField_SetupWaitForSpawn(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Appear(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_CirclePlayer(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Damage(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Disappear(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_SoulIdle(EnPoField* this, GlobalContext* globalCtx); -void func_80AD587C(EnPoField* this, GlobalContext* globalCtx); -void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_SoulDisappear(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx); +void EnPoField_SetupWaitForSpawn(EnPoField* this, PlayState* play); +void EnPoField_WaitForSpawn(EnPoField* this, PlayState* play); +void EnPoField_Appear(EnPoField* this, PlayState* play); +void EnPoField_CirclePlayer(EnPoField* this, PlayState* play); +void EnPoField_Damage(EnPoField* this, PlayState* play); +void EnPoField_Flee(EnPoField* this, PlayState* play); +void EnPoField_Death(EnPoField* this, PlayState* play); +void EnPoField_Disappear(EnPoField* this, PlayState* play); +void EnPoField_SoulIdle(EnPoField* this, PlayState* play); +void func_80AD587C(EnPoField* this, PlayState* play); +void func_80AD58D4(EnPoField* this, PlayState* play); +void EnPoField_SoulDisappear(EnPoField* this, PlayState* play); +void EnPoField_SoulInteract(EnPoField* this, PlayState* play); void EnPoField_SpawnFlame(EnPoField* this); const ActorInit En_Po_Field_InitVars = { @@ -149,7 +149,7 @@ Vec3s sEnPoFieldSpawnPositions[10]; u8 sEnPoFieldSpawnSwitchFlags[10]; static MtxF sLimb7Mtx; -void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Init(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; s32 pad; @@ -166,33 +166,33 @@ void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx) { return; } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, 10); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80AD7080); - Collider_InitCylinder(globalCtx, &this->flameCollider); - Collider_SetCylinder(globalCtx, &this->flameCollider, &this->actor, &D_80AD70AC); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AD7080); + Collider_InitCylinder(play, &this->flameCollider); + Collider_SetCylinder(play, &this->flameCollider, &this->actor, &D_80AD70AC); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &D_80AD70D8); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 0); this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } -void EnPoField_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Destroy(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; if (this->actor.params != 0xFF) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->flameCollider); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->flameCollider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnPoField_SetupWaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SetupWaitForSpawn(EnPoField* this, PlayState* play) { this->actor.update = EnPoField_Update; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.shape.rot.x = 0; Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); this->actionTimer = 200; @@ -237,8 +237,8 @@ void EnPoField_SetupAppear(EnPoField* this) { this->actionFunc = EnPoField_Appear; } -void EnPoField_SetupCirclePlayer(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_SetupCirclePlayer(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); Animation_PlayLoop(&this->skelAnime, &gPoeFieldFloatAnim); this->collider.base.acFlags |= AC_ON; @@ -301,7 +301,7 @@ void EnPoField_SetupDisappear(EnPoField* this) { this->actionFunc = EnPoField_Disappear; } -void EnPoField_SetupSoulIdle(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SetupSoulIdle(EnPoField* this, PlayState* play) { this->actor.update = EnPoField_UpdateDead; this->actor.draw = EnPoField_DrawSoul; this->actor.shape.shadowDraw = NULL; @@ -311,7 +311,7 @@ void EnPoField_SetupSoulIdle(EnPoField* this, GlobalContext* globalCtx) { this->actor.shape.rot.x = -0x8000; this->actionTimer = 60; this->actor.world.pos.y -= 15.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actionFunc = EnPoField_SoulIdle; } @@ -360,8 +360,8 @@ void EnPoField_SetupInteractWithSoul(EnPoField* this) { this->actor.home.pos.y = this->actor.world.pos.y - 15.0f; } -void EnPoField_CorrectYPos(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_CorrectYPos(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_194 == 0) { this->unk_194 = 32; @@ -381,8 +381,8 @@ void EnPoField_CorrectYPos(EnPoField* this, GlobalContext* globalCtx) { this->actor.world.pos.y = Math_SinS(this->unk_194 * 0x800) * 13.0f + this->actor.home.pos.y; } -f32 EnPoField_SetFleeSpeed(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +f32 EnPoField_SetFleeSpeed(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 speed = ((player->stateFlags1 & 0x800000) && player->rideActor != NULL) ? player->rideActor->speedXZ : 12.0f; if (this->actor.xzDistToPlayer < 300.0f) { @@ -397,8 +397,8 @@ f32 EnPoField_SetFleeSpeed(EnPoField* this, GlobalContext* globalCtx) { this->actor.speedXZ = CLAMP_MIN(this->actor.speedXZ, 12.0f); } -void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_WaitForSpawn(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 spawnDist; s32 i; s32 bgId; @@ -410,7 +410,7 @@ void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { for (i = 0; i < sEnPoFieldNumSpawned; i++) { if (fabsf(sEnPoFieldSpawnPositions[i].x - player->actor.world.pos.x) < 150.0f && fabsf(sEnPoFieldSpawnPositions[i].z - player->actor.world.pos.z) < 150.0f) { - if (Flags_GetSwitch(globalCtx, sEnPoFieldSpawnSwitchFlags[i])) { + if (Flags_GetSwitch(play, sEnPoFieldSpawnSwitchFlags[i])) { if (player->stateFlags1 & 0x800000) { // Player riding Epona return; } else { @@ -428,7 +428,7 @@ void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { this->actor.world.pos.x = Math_SinS(player->actor.shape.rot.y) * spawnDist + player->actor.world.pos.x; this->actor.world.pos.z = Math_CosS(player->actor.shape.rot.y) * spawnDist + player->actor.world.pos.z; this->actor.world.pos.y = player->actor.world.pos.y + 1000.0f; - this->actor.world.pos.y = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.world.pos.y = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); if (this->actor.world.pos.y != BGCHECK_Y_MIN) { this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &player->actor); @@ -441,14 +441,14 @@ void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { } } -void EnPoField_Appear(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Appear(EnPoField* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->lightColor.a = 255; Actor_SetScale(&this->actor, this->scaleModifier); if (this->actor.params == EN_PO_FIELD_BIG) { EnPoField_SetupFlee(this); } else { - EnPoField_SetupCirclePlayer(this, globalCtx); + EnPoField_SetupCirclePlayer(this, play); } } else if (this->skelAnime.curFrame > 10.0f) { this->lightColor.a = ((this->skelAnime.curFrame - 10.0f) * 0.05f) * 255.0f; @@ -461,12 +461,12 @@ void EnPoField_Appear(EnPoField* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; if (this->actor.params == EN_PO_FIELD_BIG) { this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; - EnPoField_SetFleeSpeed(this, globalCtx); + EnPoField_SetFleeSpeed(this, play); } } -void EnPoField_CirclePlayer(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_CirclePlayer(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 temp_v1 = 16 - this->unk_194; SkelAnime_Update(&this->skelAnime); @@ -497,11 +497,11 @@ void EnPoField_CirclePlayer(EnPoField* this, GlobalContext* globalCtx) { } else { EnPoField_SpawnFlame(this); } - EnPoField_CorrectYPos(this, globalCtx); + EnPoField_CorrectYPos(this, play); func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Flee(EnPoField* this, PlayState* play) { f32 temp_f6; s16 phi_t0; @@ -516,7 +516,7 @@ void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx) { phi_t0 = 0; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer - phi_t0, 6, 0x400); - EnPoField_SetFleeSpeed(this, globalCtx); + EnPoField_SetFleeSpeed(this, play); this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; temp_f6 = Math_SinS(this->actionTimer * 0x800) * 3.0f; this->actor.world.pos.x -= temp_f6 * Math_CosS(this->actor.shape.rot.y); @@ -524,12 +524,12 @@ void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx) { if (this->actionTimer == 0 || this->actor.xzDistToPlayer > 1500.0f) { EnPoField_SetupDisappear(this); } else { - EnPoField_CorrectYPos(this, globalCtx); + EnPoField_CorrectYPos(this, play); } func_8002F974(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } -void EnPoField_Damage(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Damage(EnPoField* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health == 0) { @@ -537,12 +537,12 @@ void EnPoField_Damage(EnPoField* this, GlobalContext* globalCtx) { } else if (this->actor.params == EN_PO_FIELD_BIG) { EnPoField_SetupFlee(this); } else { - EnPoField_SetupCirclePlayer(this, globalCtx); + EnPoField_SetupCirclePlayer(this, play); } } } -void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Death(EnPoField* this, PlayState* play) { Vec3f sp6C; f32 sp68; s32 pad; @@ -555,31 +555,31 @@ void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx) { sp6C.y = Math_SinS(this->actionTimer * 0x1000 - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); sp68 = Math_CosS(this->actionTimer * 0x1000 - 0x4000) * 23.0f; sp6C.x = - Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * sp68 + this->actor.world.pos.x; + Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * sp68 + this->actor.world.pos.x; sp6C.z = - Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * sp68 + this->actor.world.pos.z; + Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * sp68 + this->actor.world.pos.z; } else { sp6C.y = this->actor.world.pos.y + 40.0f + 15.0f * (this->actionTimer - 5); sp6C.x = - Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.x; + Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.x; sp6C.z = - Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.z; + Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(globalCtx, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); sp6C.x = (this->actor.world.pos.x + this->actor.world.pos.x) - sp6C.x; sp6C.z = (this->actor.world.pos.z + this->actor.world.pos.z) - sp6C.z; - EffectSsDeadDb_Spawn(globalCtx, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); sp6C.x = this->actor.world.pos.x; sp6C.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); if (this->actionTimer == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EXTINCT); } } else if (this->actionTimer == 28) { - EnPoField_SetupSoulIdle(this, globalCtx); + EnPoField_SetupSoulIdle(this, play); } else if (this->actionTimer >= 19) { temp_f0 = (28 - this->actionTimer) * 0.001f; this->actor.world.pos.y += 5.0f; @@ -592,7 +592,7 @@ void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx) { } } -void EnPoField_Disappear(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Disappear(EnPoField* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actionTimer != 0) { this->actionTimer--; @@ -601,23 +601,23 @@ void EnPoField_Disappear(EnPoField* this, GlobalContext* globalCtx) { this->lightColor.a = this->actionTimer * 15.9375f; this->actor.shape.shadowAlpha = this->lightColor.a; if (this->actionTimer == 0) { - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } } -void EnPoField_SoulIdle(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SoulIdle(EnPoField* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } if (this->actor.bgCheckFlags & 1) { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO_FIELD, 10, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO_FIELD, 10, gPoeFieldLanternDL); func_80AD42B0(this); } else if (this->actionTimer == 0) { - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); } void EnPoField_SoulUpdateProperties(EnPoField* this, s32 arg1) { @@ -642,7 +642,7 @@ void EnPoField_SoulUpdateProperties(EnPoField* this, s32 arg1) { this->lightColor.a * (200.0f / 255)); } -void func_80AD587C(EnPoField* this, GlobalContext* globalCtx) { +void func_80AD587C(EnPoField* this, PlayState* play) { this->actor.home.pos.y += 2.0f; EnPoField_SoulUpdateProperties(this, 20); if (this->lightColor.a == 255) { @@ -650,11 +650,11 @@ void func_80AD587C(EnPoField* this, GlobalContext* globalCtx) { } } -void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx) { +void func_80AD58D4(EnPoField* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnPoField_SetupInteractWithSoul(this); return; } @@ -666,10 +666,10 @@ void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx) { } if (this->collider.base.ocFlags1 & OC1_HIT) { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.flags &= ~ACTOR_FLAG_16; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } this->actor.world.pos.y = Math_SinS(this->unk_194 * 0x800) * 5.0f + this->actor.home.pos.y; if (this->unk_194 != 0) { @@ -686,32 +686,32 @@ void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx) { this->lightColor.a * (200.0f / 255)); } -void EnPoField_SoulDisappear(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SoulDisappear(EnPoField* this, PlayState* play) { EnPoField_SoulUpdateProperties(this, -13); if (this->lightColor.a == 0) { - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } } -void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SoulInteract(EnPoField* this, PlayState* play) { if (this->actor.textId != 0x5005) { EnPoField_SoulUpdateProperties(this, -13); } else { func_8002F974(&this->actor, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (Inventory_HasEmptyBottle()) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_BIG_GET); if (this->actor.params == 0) { - Item_Give(globalCtx, ITEM_POE); + Item_Give(play, ITEM_POE); this->actor.textId = 0x5008; } else { this->actor.textId = 0x508F; - Item_Give(globalCtx, ITEM_BIG_POE); - Flags_SetSwitch(globalCtx, sEnPoFieldSpawnSwitchFlags[this->spawnFlagIndex]); + Item_Give(play, ITEM_BIG_POE); + Flags_SetSwitch(play, sEnPoFieldSpawnSwitchFlags[this->spawnFlagIndex]); } } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); @@ -721,20 +721,20 @@ void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx) { this->actor.textId = 0x5007; Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); return; } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { EnPoField_SetupSoulDisappear(this); } } -void EnPoField_TestForDamage(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_TestForDamage(EnPoField* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DEAD); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); @@ -754,7 +754,7 @@ void EnPoField_SpawnFlame(EnPoField* this) { } } -void EnPoField_UpdateFlame(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_UpdateFlame(EnPoField* this, PlayState* play) { if (this->flameTimer != 0) { if (this->flameTimer != 0) { this->flameTimer--; @@ -774,24 +774,24 @@ void EnPoField_UpdateFlame(EnPoField* this, GlobalContext* globalCtx) { this->flameCollider.dim.pos.x = this->flamePosition.x; this->flameCollider.dim.pos.y = this->flamePosition.y; this->flameCollider.dim.pos.z = this->flamePosition.z; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->flameCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->flameCollider.base); } } -void EnPoField_DrawFlame(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_DrawFlame(EnPoField* this, PlayState* play) { f32 sp4C; s32 pad; if (this->flameTimer != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (globalCtx->gameplayFrames * -20) % 512, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + (play->gameplayFrames * -20) % 512, 32, 128)); sp4C = this->flameScale * 85000.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, sp4C); Matrix_Translate(this->flamePosition.x, this->flamePosition.y, this->flamePosition.z, MTXMODE_NEW); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); if (this->flameTimer >= 20) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Scale(this->flameScale, this->flameScale, this->flameScale, MTXMODE_APPLY); @@ -800,10 +800,10 @@ void EnPoField_DrawFlame(EnPoField* this, GlobalContext* globalCtx) { Matrix_Scale((this->flameScale * 0.7f) + 0.00090000004f, (0.003f - this->flameScale) + 0.003f, 0.003f, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -853,31 +853,31 @@ void func_80AD6330(EnPoField* this) { } } -void EnPoField_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Update(Actor* thisx, PlayState* play) { s32 pad; EnPoField* this = (EnPoField*)thisx; - EnPoField_TestForDamage(this, globalCtx); - this->actionFunc(this, globalCtx); - EnPoField_UpdateFlame(this, globalCtx); + EnPoField_TestForDamage(this, play); + this->actionFunc(this, play); + EnPoField_UpdateFlame(this, play); if (this->actionFunc == EnPoField_Flee || this->actionFunc == EnPoField_Damage || this->actionFunc == EnPoField_Appear) { Actor_MoveForward(&this->actor); } if (this->actionFunc != EnPoField_WaitForSpawn) { Actor_SetFocus(&this->actor, 42.0f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 27.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, 4); func_80AD619C(this); func_80AD6330(this); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnPoField_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnPoField_OverrideLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoField* this = (EnPoField*)thisx; @@ -898,11 +898,11 @@ s32 EnPoField_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnPoField_PostLimDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { +void EnPoField_PostLimDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoField* this = (EnPoField*)thisx; if (this->actionFunc == EnPoField_Death && this->actionTimer >= 2 && limbIndex == 8) { - gSPMatrix((*gfxP)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfxP)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, gPoeFieldBurnDL); } @@ -924,88 +924,88 @@ void EnPoField_PostLimDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnPoField_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Draw(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; EnPoFieldInfo* info = &sPoFieldInfo[this->actor.params]; if (this->actionFunc != EnPoField_WaitForSpawn) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); + Gfx_EnvColor(play->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); if (this->lightColor.a == 255 || this->lightColor.a == 0) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0C, D_80116280 + 2); POLY_OPA_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoField_OverrideLimbDraw2, EnPoField_PostLimDraw2, &this->actor, POLY_OPA_DISP); } else { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); POLY_XLU_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoField_OverrideLimbDraw2, EnPoField_PostLimDraw2, &this->actor, POLY_XLU_DISP); } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->soulColor.r, this->soulColor.g, this->soulColor.b, 255); Matrix_Put(&sLimb7Mtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternDL); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternTopDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } - EnPoField_DrawFlame(this, globalCtx); + EnPoField_DrawFlame(this, play); } -void EnPoField_UpdateDead(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_UpdateDead(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == EnPoField_SoulIdle) { func_80AD6330(this); } - EnPoField_UpdateFlame(this, globalCtx); + EnPoField_UpdateFlame(this, play); } -void EnPoField_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_DrawSoul(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; s32 pad; EnPoFieldInfo* info = &sPoFieldInfo[this->actor.params]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc == EnPoField_SoulIdle) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); + Gfx_EnvColor(play->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->soulColor.r, this->soulColor.g, this->soulColor.b, 200); gDPSetEnvColor(POLY_OPA_DISP++, this->soulColor.r, this->soulColor.g, this->soulColor.b, 255); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternDL); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternTopDL); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (globalCtx->gameplayFrames * info->unk_9) & 0x1FF, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + (play->gameplayFrames * info->unk_9) & 0x1FF, 0x20, 0x80)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(info->soulTexture)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, info->primColor.r, info->primColor.g, info->primColor.b, this->lightColor.a); gDPSetEnvColor(POLY_XLU_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPoeFieldSoulDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); - EnPoField_DrawFlame(this, globalCtx); + CLOSE_DISPS(play->state.gfxCtx); + EnPoField_DrawFlame(this, play); } void EnPoField_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h index 384b1bbdc..7f5273e74 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h +++ b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h @@ -6,7 +6,7 @@ struct EnPoField; -typedef void (*EnPoFieldActionFunc)(struct EnPoField*, GlobalContext*); +typedef void (*EnPoFieldActionFunc)(struct EnPoField*, PlayState*); typedef enum { EN_PO_FIELD_SMALL, diff --git a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index b04779143..1efbdf7ea 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_12 | ACTOR_FLAG_16) -void EnPoRelay_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoRelay_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoRelay_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoRelay_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoRelay_Init(Actor* thisx, PlayState* play); +void EnPoRelay_Destroy(Actor* thisx, PlayState* play); +void EnPoRelay_Update(Actor* thisx, PlayState* play); +void EnPoRelay_Draw(Actor* thisx, PlayState* play); -void EnPoRelay_Idle(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_EndRace(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_Talk(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_Talk2(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx); +void EnPoRelay_Idle(EnPoRelay* this, PlayState* play); +void EnPoRelay_Race(EnPoRelay* this, PlayState* play); +void EnPoRelay_EndRace(EnPoRelay* this, PlayState* play); +void EnPoRelay_Talk(EnPoRelay* this, PlayState* play); +void EnPoRelay_Talk2(EnPoRelay* this, PlayState* play); +void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play); void EnPoRelay_SetupIdle(EnPoRelay* this); static Vec3s D_80AD8C30[] = { @@ -85,17 +85,17 @@ static void* sEyesTextures[] = { gDampeEyeClosedTex, }; -void EnPoRelay_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Init(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; s32 temp; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 42.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDampeSkel, &gDampeFloatAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gDampeSkel, &gDampeFloatAnim, this->jointTable, this->morphTable, 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 200); this->lightColor.a = 255; @@ -104,19 +104,19 @@ void EnPoRelay_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } else { D_80AD8D24 = temp; - Actor_SetTextWithPrefix(globalCtx, &this->actor, 65); + Actor_SetTextWithPrefix(play, &this->actor, 65); this->textId = this->actor.textId; EnPoRelay_SetupIdle(this); } this->actor.params &= 0x3F; } -void EnPoRelay_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Destroy(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; D_80AD8D24 = 0; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); } void EnPoRelay_SetupIdle(EnPoRelay* this) { @@ -142,7 +142,7 @@ void EnPoRelay_SetupRace(EnPoRelay* this) { this->actionTimer = ((s16)(this->actor.shape.rot.y - this->actor.world.rot.y - 0x8000) >> 0xB) % 32U; func_80088B34(0); this->hookshotSlotFull = (INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE && !gSaveContext.n64ddFlag) || - (gSaveContext.n64ddFlag && Flags_GetTreasure(gGlobalCtx, 0x1E)); + (gSaveContext.n64ddFlag && Flags_GetTreasure(gPlayState, 0x1E)); this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec); this->actor.flags |= ACTOR_FLAG_27; Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); @@ -161,31 +161,31 @@ void EnPoRelay_CorrectY(EnPoRelay* this) { this->actor.world.pos.y = Math_SinS(this->unk_195 * 0x800) * 8.0f + this->actor.home.pos.y; } -void EnPoRelay_Idle(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_Idle(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnPoRelay_Talk; } else if (this->actor.xzDistToPlayer < 250.0f) { this->actor.flags |= ACTOR_FLAG_16; this->actor.textId = this->textId; - func_8002F2CC(&this->actor, globalCtx, 250.0f); + func_8002F2CC(&this->actor, play, 250.0f); } func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_Talk(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_Talk(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - Actor_SetTextWithPrefix(globalCtx, &this->actor, 0x2F); + if (Actor_TextboxIsClosing(&this->actor, play)) { + Actor_SetTextWithPrefix(play, &this->actor, 0x2F); this->textId = this->actor.textId; EnPoRelay_SetupRace(this); } func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f vec; f32 speed; f32 multiplier; @@ -206,7 +206,7 @@ void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) { } speed = 30.0f * multiplier; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HONOTRAP, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HONOTRAP, Math_CosS(this->unk_19A) * speed + this->actor.world.pos.x, this->actor.world.pos.y, Math_SinS(this->unk_19A) * speed + this->actor.world.pos.z, 0, (this->unk_19A + 0x8000) - (0x2000 * multiplier), 0, HONOTRAP_FLAME_DROP); @@ -246,44 +246,44 @@ void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) { if (this->pathIndex == 28) { EnPoRelay_SetupEndRace(this); } else if (this->pathIndex == 9) { - Flags_SetSwitch(globalCtx, 0x35); + Flags_SetSwitch(play, 0x35); } else if (this->pathIndex == 17) { - Flags_SetSwitch(globalCtx, 0x36); + Flags_SetSwitch(play, 0x36); } else if (this->pathIndex == 25) { - Flags_SetSwitch(globalCtx, 0x37); + Flags_SetSwitch(play, 0x37); } } this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec); func_8002F974(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } -void EnPoRelay_EndRace(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_EndRace(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, -0x4000, 0x800); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnPoRelay_Talk2; - } else if (globalCtx->roomCtx.curRoom.num == 5) { + } else if (play->roomCtx.curRoom.num == 5) { Actor_Kill(&this->actor); gSaveContext.timer1State = 0; } else if (Actor_IsFacingAndNearPlayer(&this->actor, 150.0f, 0x3000)) { this->actor.textId = this->textId; - func_8002F2CC(&this->actor, globalCtx, 250.0f); + func_8002F2CC(&this->actor, play, 250.0f); } func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_Talk2(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_Talk2(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + if (Message_ShouldAdvance(play)) { if (this->hookshotSlotFull != 0) { - Actor_SetTextWithPrefix(globalCtx, &this->actor, 0x2E); + Actor_SetTextWithPrefix(play, &this->actor, 0x2E); } else { - Actor_SetTextWithPrefix(globalCtx, &this->actor, 0x2D); + Actor_SetTextWithPrefix(play, &this->actor, 0x2D); } this->textId = this->actor.textId; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { gSaveContext.timer1State = 0; this->actionTimer = 0; this->actionFunc = EnPoRelay_DisappearAndReward; @@ -291,7 +291,7 @@ void EnPoRelay_Talk2(EnPoRelay* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { Vec3f vec; f32 multiplier; s32 pad; @@ -303,26 +303,26 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { if (this->actionTimer < 5) { vec.y = Math_SinS((this->actionTimer * 0x1000) - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); multiplier = Math_CosS((this->actionTimer * 0x1000) - 0x4000) * 23.0f; - vec.x = (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier) + + vec.x = (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier) + this->actor.world.pos.x; - vec.z = (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier) + + vec.z = (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier) + this->actor.world.pos.z; } else { vec.y = this->actor.world.pos.y + 40.0f + 15.0f * (this->actionTimer - 5); vec.x = - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f) + this->actor.world.pos.x; + (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.x; vec.z = - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f) + this->actor.world.pos.z; + (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); vec.x = (this->actor.world.pos.x + this->actor.world.pos.x) - vec.x; vec.z = (this->actor.world.pos.z + this->actor.world.pos.z) - vec.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); vec.x = this->actor.world.pos.x; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); if (this->actionTimer == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EXTINCT); @@ -337,13 +337,13 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { if (gSaveContext.timer1Value < HIGH_SCORE(HS_DAMPE_RACE)) { HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value; } - if (Flags_GetCollectible(globalCtx, this->actor.params) == 0 && gSaveContext.timer1Value <= 60) { - Item_DropCollectible2(globalCtx, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); + if (Flags_GetCollectible(play, this->actor.params) == 0 && gSaveContext.timer1Value <= 60) { + Item_DropCollectible2(play, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2); } } else { - Flags_SetTempClear(globalCtx, 4); + Flags_SetTempClear(play, 4); HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value; } } else { @@ -352,18 +352,18 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { sp60.z = this->actor.world.pos.z; if (this->hookshotSlotFull == 0) { - Flags_SetTempClear(globalCtx, 4); - Flags_SetTreasure(gGlobalCtx, 0x1E); + Flags_SetTempClear(play, 4); + Flags_SetTreasure(gPlayState, 0x1E); HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value; } if (gSaveContext.timer1Value < HIGH_SCORE(HS_DAMPE_RACE)) { HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value; } - if (Flags_GetCollectible(globalCtx, this->actor.params) == 0 && gSaveContext.timer1Value <= 60) { - Item_DropCollectible2(globalCtx, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); - } else if (Flags_GetCollectible(globalCtx, this->actor.params) != 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2); + if (Flags_GetCollectible(play, this->actor.params) == 0 && gSaveContext.timer1Value <= 60) { + Item_DropCollectible2(play, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); + } else if (Flags_GetCollectible(play, this->actor.params) != 0) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2); } } Actor_Kill(&this->actor); @@ -373,17 +373,17 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 10.0f; } -void EnPoRelay_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Update(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; s32 pad; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); EnPoRelay_CorrectY(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 27.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.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, 50.0f); if (this->unk_195 != 0) { this->unk_195 -= 1; @@ -397,14 +397,14 @@ void EnPoRelay_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPoRelay_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnPoRelay_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnPoRelay* this = (EnPoRelay*)thisx; if (limbIndex == 14) { f32 rand; Vec3f vec; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); rand = Rand_ZeroOne(); this->lightColor.r = (s16)(rand * 30.0f) + 225; this->lightColor.g = (s16)(rand * 100.0f) + 155; @@ -412,26 +412,26 @@ void EnPoRelay_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 128); gSPDisplayList(POLY_OPA_DISP++, gDampeLanternDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&D_80AD8D48, &vec); Lights_PointNoGlowSetInfo(&this->lightInfo, vec.x, vec.y, vec.z, this->lightColor.r, this->lightColor.g, this->lightColor.b, 200); } else if (limbIndex == 8) { - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(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); gSPDisplayList(POLY_OPA_DISP++, gDampeHaloDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnPoRelay_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Draw(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnPoRelay_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h index 5f26aba8b..70567ada7 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h +++ b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h @@ -6,7 +6,7 @@ struct EnPoRelay; -typedef void (*EnPoRelayActionFunc)(struct EnPoRelay*, GlobalContext*); +typedef void (*EnPoRelayActionFunc)(struct EnPoRelay*, PlayState*); typedef struct EnPoRelay { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 473d426d0..dbbd1d46e 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -11,41 +11,41 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoSisters_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoSisters_Init(Actor* thisx, PlayState* play); +void EnPoSisters_Destroy(Actor* thisx, PlayState* play); +void EnPoSisters_Update(Actor* thisx, PlayState* play); +void EnPoSisters_Draw(Actor* thisx, PlayState* play); void EnPoSisters_Reset(void); -void func_80ADA094(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA4A8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA7F0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA9E8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAD54(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAE6C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB17C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB9F0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB4B0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBBF4(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBC88(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBD38(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBD8C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBEE8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBF58(EnPoSisters* this, GlobalContext* globalCtx); +void func_80ADA094(EnPoSisters* this, PlayState* play); +void func_80ADA4A8(EnPoSisters* this, PlayState* play); +void func_80ADA530(EnPoSisters* this, PlayState* play); +void func_80ADA6A0(EnPoSisters* this, PlayState* play); +void func_80ADA7F0(EnPoSisters* this, PlayState* play); +void func_80ADA8C0(EnPoSisters* this, PlayState* play); +void func_80ADA9E8(EnPoSisters* this, PlayState* play); +void func_80ADAAA4(EnPoSisters* this, PlayState* play); +void func_80ADAC70(EnPoSisters* this, PlayState* play); +void func_80ADAD54(EnPoSisters* this, PlayState* play); +void func_80ADAE6C(EnPoSisters* this, PlayState* play); +void func_80ADAFC0(EnPoSisters* this, PlayState* play); +void func_80ADB17C(EnPoSisters* this, PlayState* play); +void func_80ADB2B8(EnPoSisters* this, PlayState* play); +void func_80ADB338(EnPoSisters* this, PlayState* play); +void func_80ADB9F0(EnPoSisters* this, PlayState* play); +void func_80ADB4B0(EnPoSisters* this, PlayState* play); +void func_80ADB51C(EnPoSisters* this, PlayState* play); +void func_80ADB770(EnPoSisters* this, PlayState* play); +void func_80ADBB6C(EnPoSisters* this, PlayState* play); +void func_80ADBBF4(EnPoSisters* this, PlayState* play); +void func_80ADBC88(EnPoSisters* this, PlayState* play); +void func_80ADBD38(EnPoSisters* this, PlayState* play); +void func_80ADBD8C(EnPoSisters* this, PlayState* play); +void func_80ADBEE8(EnPoSisters* this, PlayState* play); +void func_80ADBF58(EnPoSisters* this, PlayState* play); -void func_80AD9AA8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80AD9C24(EnPoSisters* this, GlobalContext* globalCtx); +void func_80AD9AA8(EnPoSisters* this, PlayState* play); +void func_80AD9C24(EnPoSisters* this, PlayState* play); void func_80AD9D44(EnPoSisters* this); @@ -176,7 +176,7 @@ static Color_RGBA8 D_80ADD7E8[4] = { static Vec3f D_80ADD7F8 = { 1000.0f, -1700.0f, 0.0f }; -void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Init(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; s32 pad; @@ -184,23 +184,23 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { // Skip Poe Intro Cutscene if (gSaveContext.n64ddFlag && thisx->params == 4124 && !Randomizer_GetSettingValue(RSK_ENABLE_GLITCH_CUTSCENES)) { - Flags_SetSwitch(globalCtx, 0x1B); + Flags_SetSwitch(play, 0x1B); Actor_Kill(thisx); } Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeSistersSkel, &gPoeSistersSwayAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gPoeSistersSkel, &gPoeSistersSwayAnim, this->jointTable, this->morphTable, 12); this->unk_22E.r = 255; this->unk_22E.g = 255; this->unk_22E.b = 210; this->unk_22E.a = 255; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_194 = (thisx->params >> 8) & 3; this->actor.naviEnemyId = this->unk_194 + 0x50; @@ -212,11 +212,11 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_294 = 110.0f; this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.params & 0x1000) { - func_80ADA094(this, globalCtx); + func_80ADA094(this, play); } else if (this->unk_194 == 0) { if (this->unk_195 == 0) { this->collider.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER; - func_80AD9AA8(this, globalCtx); + func_80AD9AA8(this, play); } else { this->actor.flags &= ~(ACTOR_FLAG_9 | ACTOR_FLAG_14); this->collider.info.elemType = ELEMTYPE_UNK4; @@ -230,14 +230,14 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.params &= 0x3F; } -void EnPoSisters_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Destroy(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); if (this->unk_194 == 0 && this->unk_195 == 0) { func_800F5B58(); } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80AD9240(EnPoSisters* this, s32 arg1, Vec3f* arg2) { @@ -344,8 +344,8 @@ void func_80AD9718(EnPoSisters* this) { this->actionFunc = func_80ADAD54; } -void func_80AD97C8(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD97C8(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sp20; if (this->unk_195 == 0 || this->actionFunc != func_80ADAAA4) { @@ -363,12 +363,12 @@ void func_80AD97C8(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y + 0x8000) * sp20) + player->actor.world.pos.z; } -void func_80AD98F4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD98F4(EnPoSisters* this, PlayState* play) { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim), ANIMMODE_ONCE, -3.0f); if (this->unk_194 == 0) { this->unk_294 = 110.0f; - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); this->unk_22E.a = 0; this->actor.draw = EnPoSisters_Draw; } else { @@ -381,7 +381,7 @@ void func_80AD98F4(EnPoSisters* this, GlobalContext* globalCtx) { this->actionFunc = func_80ADAE6C; } -void func_80AD99D4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD99D4(EnPoSisters* this, PlayState* play) { this->unk_19A = 0; this->actor.speedXZ = 0.0f; this->actor.world.pos.y += 42.0f; @@ -389,23 +389,23 @@ void func_80AD99D4(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_199 = 0; this->actionFunc = func_80ADAFC0; - OnePointCutscene_Init(globalCtx, 3190, 999, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3190, 999, &this->actor, MAIN_CAM); } -void func_80AD9A54(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD9A54(EnPoSisters* this, PlayState* play) { this->unk_19A = 0; this->actor.world.pos.y = this->unk_234[0].y; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); this->actionFunc = func_80ADB17C; } // Meg spawning fakes -void func_80AD9AA8(EnPoSisters* this, GlobalContext* globalCtx) { - Actor* actor1 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, +void func_80AD9AA8(EnPoSisters* this, PlayState* play) { + Actor* actor1 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x400); - Actor* actor2 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + Actor* actor2 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x800); - Actor* actor3 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + Actor* actor3 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xC00); s32 pad; s32 pad1; @@ -432,7 +432,7 @@ void func_80AD9AA8(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80AD9C24(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD9C24(EnPoSisters* this, PlayState* play) { Vec3f vec; this->actor.draw = NULL; @@ -441,11 +441,11 @@ void func_80AD9C24(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_199 = 32; this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; - if (globalCtx != NULL) { + if (play != NULL) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y + 45.0f; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &sZeroVector, &sZeroVector, 150, 0, 255, 255, 255, 155, 150, 150, 150, 1, + EffectSsDeadDb_Spawn(play, &vec, &sZeroVector, &sZeroVector, 150, 0, 255, 255, 255, 155, 150, 150, 150, 1, 9, 0); } Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); @@ -465,12 +465,12 @@ void func_80AD9D44(EnPoSisters* this) { this->actionFunc = func_80ADB9F0; } -void func_80AD9DF0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD9DF0(EnPoSisters* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gPoeSistersAppearDisappearAnim, -5.0f); this->unk_198 = 1; this->unk_199 &= ~0x80; this->actionFunc = func_80ADB4B0; - OnePointCutscene_Init(globalCtx, 3180, 156, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 3180, 156, &this->actor, MAIN_CAM); } void func_80AD9E60(EnPoSisters* this) { @@ -522,13 +522,13 @@ void func_80ADA028(EnPoSisters* this) { this->actor.speedXZ = 0.0f; } -void func_80ADA094(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA094(EnPoSisters* this, PlayState* play) { D_80ADD784 = 0; this->unk_22E.a = 0; this->unk_199 = 128; this->unk_19A = 50; this->unk_234[0] = this->actor.home.pos; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actionFunc = func_80ADBC88; } @@ -563,7 +563,7 @@ void func_80ADA25C(EnPoSisters* this) { this->actionFunc = func_80ADBEE8; } -void func_80ADA2BC(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA2BC(EnPoSisters* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); this->unk_198 = 0; this->unk_199 = 40; @@ -572,15 +572,15 @@ void func_80ADA2BC(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.world.rot.y = D_80ADD79C[this->unk_194]; this->actor.home.pos.y = this->actor.world.pos.y; if (this->unk_194 == 0) { - Flags_SetSwitch(globalCtx, 0x1B); + Flags_SetSwitch(play, 0x1B); } Audio_PlayActorSound2(&this->actor, NA_SE_EV_FLAME_IGNITION); this->actionFunc = func_80ADBF58; } -void func_80ADA35C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA35C(EnPoSisters* this, PlayState* play) { f32 targetY; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->actionFunc == func_80ADBF58) { targetY = this->actor.home.pos.y; @@ -606,7 +606,7 @@ void func_80ADA35C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA4A8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA4A8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { this->unk_19A--; @@ -616,7 +616,7 @@ void func_80ADA4A8(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA530(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { @@ -636,8 +636,8 @@ void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ADA6A0(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_v0; SkelAnime_Update(&this->skelAnime); @@ -657,7 +657,7 @@ void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA7F0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA7F0(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_19A != 0) { this->unk_19A--; @@ -671,7 +671,7 @@ void func_80ADA7F0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA8C0(EnPoSisters* this, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelAnime); @@ -686,7 +686,7 @@ void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx) { func_80AD93C4(this); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } if (Animation_OnFrame(&this->skelAnime, 1.0f)) { @@ -694,7 +694,7 @@ void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA9E8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA9E8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y -= (this->actor.speedXZ * 10.0f) * 128.0f; if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f) != 0) { @@ -703,12 +703,12 @@ void func_80ADA9E8(EnPoSisters* this, GlobalContext* globalCtx) { func_80AD93C4(this); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } } -void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAAA4(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_15)) { if (this->actor.colChkInfo.health != 0) { if (this->unk_194 != 0) { @@ -716,10 +716,10 @@ void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) { } else if (this->unk_195 != 0) { func_80AD9C24(this, NULL); } else { - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } else { - func_80AD99D4(this, globalCtx); + func_80AD99D4(this, play); } } if (this->unk_195 != 0) { @@ -727,13 +727,13 @@ void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) { (this->unk_195 == 2) ? 0x800 : 0x400); this->unk_22E.a = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; this->actor.world.pos.y = this->actor.parent->world.pos.y; - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); } else if (this->unk_194 != 0) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); } } -void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAC70(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1820); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { @@ -749,7 +749,7 @@ void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADAD54(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAD54(EnPoSisters* this, PlayState* play) { s32 endFrame; if (SkelAnime_Update(&this->skelAnime)) { @@ -762,7 +762,7 @@ void func_80ADAD54(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADAE6C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAE6C(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_22E.a = 255; if (this->unk_194 != 0) { @@ -781,12 +781,12 @@ void func_80ADAE6C(EnPoSisters* this, GlobalContext* globalCtx) { } else { this->unk_22E.a = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; if (this->unk_194 == 0) { - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); } } } -void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAFC0(EnPoSisters* this, PlayState* play) { s32 i; this->unk_19A++; @@ -806,7 +806,7 @@ void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_234[0].y = this->unk_234[1].y + 2.0f; if (this->unk_19A >= 16) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f) != 0) { - func_80AD9A54(this, globalCtx); + func_80AD9A54(this, play); } this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; @@ -817,15 +817,15 @@ void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADB17C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB17C(EnPoSisters* this, PlayState* play) { this->unk_19A++; if (this->unk_19A == 64) { - Flags_SetSwitch(globalCtx, this->actor.params); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_FLAME_IGNITION); + Flags_SetSwitch(play, this->actor.params); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_FLAME_IGNITION); if (this->unk_194 == 0) { - Flags_UnsetSwitch(globalCtx, 0x1B); + Flags_UnsetSwitch(play, 0x1B); } - globalCtx->envCtx.unk_BF = 0xFF; + play->envCtx.unk_BF = 0xFF; func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->actor); } else if (this->unk_19A < 32) { @@ -840,10 +840,10 @@ void func_80ADB17C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB2B8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.xzDistToPlayer < 130.0f) { - func_80AD9DF0(this, globalCtx); + func_80AD9DF0(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_CRY); @@ -851,8 +851,8 @@ void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; } -void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ADB338(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; if (this->unk_195 == 0) { @@ -871,7 +871,7 @@ void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_19C == 0) { this->actor.shape.rot.y = (s32)(4.0f * Rand_ZeroOne()) * 0x4000 + this->actor.yawTowardsPlayer; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } } else { if (realMeg->actionFunc == func_80ADB51C) { @@ -880,23 +880,23 @@ void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx) { } else if (realMeg->actionFunc == func_80ADAE6C) { this->actor.shape.rot.y = this->actor.parent->shape.rot.y + this->unk_195 * 0x4000; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } else if (realMeg->actionFunc == func_80ADAFC0) { Actor_Kill(&this->actor); } } } -void func_80ADB4B0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB4B0(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_80AD9E60(this); } - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); this->actor.world.pos.y += 1.0f; Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB51C(EnPoSisters* this, PlayState* play) { f32 temp_f2; s16 phi_v0; s16 phi_a2; @@ -943,11 +943,11 @@ void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); } } - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB770(EnPoSisters* this, PlayState* play) { s32 temp_v0; s32 phi_a0; @@ -979,14 +979,14 @@ void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_199 &= ~0x40; } } - if (Actor_WorldDistXZToPoint(&GET_PLAYER(globalCtx)->actor, &this->actor.home.pos) > 600.0f) { + if (Actor_WorldDistXZToPoint(&GET_PLAYER(play)->actor, &this->actor.home.pos) > 600.0f) { this->unk_199 &= ~0x40; - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } else if (this->unk_19A == 0) { if (this->unk_195 == 0) { func_80AD94E0(this); } else { - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } else if (this->unk_195 != 0) { EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; @@ -1002,10 +1002,10 @@ void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { func_80AD94E0(this); } } - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); } -void func_80ADB9F0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB9F0(EnPoSisters* this, PlayState* play) { f32 div; if (SkelAnime_Update(&this->skelAnime)) { @@ -1029,7 +1029,7 @@ void func_80ADB9F0(EnPoSisters* this, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBB6C(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 10.0f) { func_80ADA028(this); @@ -1039,7 +1039,7 @@ void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBBF4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBBF4(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1820); if (this->actor.xzDistToPlayer < 240.0f && fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f) { @@ -1047,14 +1047,14 @@ void func_80ADBBF4(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBC88(EnPoSisters* this, GlobalContext* globalCtx) { - if (D_80ADD784 != 0 || !Player_InCsMode(globalCtx)) { +void func_80ADBC88(EnPoSisters* this, PlayState* play) { + if (D_80ADD784 != 0 || !Player_InCsMode(play)) { if (this->unk_19A != 0) { this->unk_19A--; } if (this->unk_19A == 30) { if (this->unk_194 == 0) { - OnePointCutscene_Init(globalCtx, 3140, 999, NULL, MAIN_CAM); + OnePointCutscene_Init(play, 3140, 999, NULL, MAIN_CAM); } D_80ADD784 = 1; } @@ -1065,7 +1065,7 @@ void func_80ADBC88(EnPoSisters* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } -void func_80ADBD38(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBD38(EnPoSisters* this, PlayState* play) { this->unk_19A++; func_80AD9240(this, this->unk_19A, &this->actor.home.pos); if (this->unk_19A == 32) { @@ -1073,7 +1073,7 @@ void func_80ADBD38(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBD8C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBD8C(EnPoSisters* this, PlayState* play) { this->unk_19A--; if (this->unk_19A == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_APPEAR); @@ -1092,36 +1092,36 @@ void func_80ADBD8C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBEE8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBEE8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_19A != 0) { this->unk_19A--; } func_80AD9240(this, this->unk_19A, &this->actor.home.pos); if (this->unk_19A == 0) { - func_80ADA2BC(this, globalCtx); + func_80ADA2BC(this, play); } } -void func_80ADBF58(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBF58(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_19A--; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 0x500); if (this->unk_19A == 0 && this->unk_194 == 0) { - globalCtx->envCtx.unk_BF = 4; + play->envCtx.unk_BF = 4; } if (this->unk_19A < 0) { Math_StepToF(&this->actor.speedXZ, 5.0f, 0.2f); } if (this->unk_19A == -70 && this->unk_194 == 1) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &D_80ADD7BC, 40, NA_SE_EN_PO_LAUGH); + SoundSource_PlaySfxAtFixedWorldPos(play, &D_80ADD7BC, 40, NA_SE_EN_PO_LAUGH); } if (this->unk_19A < -120) { Actor_Kill(&this->actor); } } -void func_80ADC034(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADC034(EnPoSisters* this, PlayState* play) { if (this->actor.isTargeted && this->unk_22E.a == 255) { if (this->unk_197 != 0) { this->unk_197--; @@ -1138,12 +1138,12 @@ void func_80ADC034(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_197 == 0) { func_80AD9718(this); } else if (this->unk_19C == 0 && this->unk_22E.a == 0) { - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } } } -void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADC10C(EnPoSisters* this, PlayState* play) { Vec3f sp24; if (this->collider.base.acFlags & AC_HIT) { @@ -1152,12 +1152,12 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_195 != 0) { ((EnPoSisters*)this->actor.parent)->unk_19C--; Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); if (Rand_ZeroOne() < 0.2f) { sp24.x = this->actor.world.pos.x; sp24.y = this->actor.world.pos.y; sp24.z = this->actor.world.pos.z; - Item_DropCollectible(globalCtx, &sp24, ITEM00_ARROWS_SMALL); + Item_DropCollectible(play, &sp24, ITEM00_ARROWS_SMALL); } } else if (this->collider.base.colType == 9 || (this->actor.colChkInfo.damageEffect == 0 && this->actor.colChkInfo.damage == 0)) { @@ -1167,7 +1167,7 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { } else if (this->actor.colChkInfo.damageEffect == 0xF) { this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_199 |= 2; - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } else if (this->unk_194 == 0 && this->actor.colChkInfo.damageEffect == 0xE && this->actionFunc == func_80ADB770) { if (this->unk_19C == 0) { @@ -1177,7 +1177,7 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_SISTER_DEAD); } func_80AD95D8(this); @@ -1185,7 +1185,7 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Update(Actor* thisx, PlayState* play) { s32 pad; EnPoSisters* this = (EnPoSisters*)thisx; s16 temp; @@ -1194,19 +1194,19 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~AT_HIT; func_80AD9568(this); } - func_80ADC10C(this, globalCtx); + func_80ADC10C(this, play); if (this->unk_199 & 4) { - func_80ADC034(this, globalCtx); + func_80ADC034(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_199 & 0x1F) { if (this->unk_199 & 8) { - func_80ADA35C(this, globalCtx); + func_80ADA35C(this, play); } Actor_MoveForward(&this->actor); if (this->unk_199 & 0x10) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, 5); } else { Vec3f vec; s32 sp34; @@ -1215,7 +1215,7 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { vec.y = this->actor.world.pos.y + 10.0f; vec.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &sp34, &this->actor, &vec); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &sp34, &this->actor, &vec); } Collider_UpdateCylinder(&this->actor, &this->collider); @@ -1228,13 +1228,13 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc == func_80ADA8C0) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_199 & 1) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != func_80ADB338) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 40.0f); if (this->actionFunc == func_80ADAC70) { @@ -1281,7 +1281,7 @@ void func_80ADC55C(EnPoSisters* this) { } } -s32 EnPoSisters_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoSisters* this = (EnPoSisters*)thisx; Color_RGBA8* color; @@ -1309,14 +1309,14 @@ s32 EnPoSisters_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnPoSisters_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, +void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoSisters* this = (EnPoSisters*)thisx; s32 i; s32 pad; if (this->actionFunc == func_80ADAFC0 && this->unk_19A >= 8 && limbIndex == 9) { - gSPMatrix((*gfxP)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfxP)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, gPoSistersBurnDL); } @@ -1352,7 +1352,7 @@ void EnPoSisters_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Draw(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; u8 phi_s5 = 0; f32 phi_f20; @@ -1362,32 +1362,32 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { Color_RGBA8* temp_s7 = &D_80ADD6F0[this->unk_194]; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); func_80ADC55C(this); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->unk_22E.a == 255 || this->unk_22E.a == 0) { gDPSetEnvColor(POLY_OPA_DISP++, this->unk_22E.r, this->unk_22E.g, this->unk_22E.b, this->unk_22E.a); gSPSegment(POLY_OPA_DISP++, 0x09, D_80116280 + 2); POLY_OPA_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->unk_22E.a); gSPSegment(POLY_XLU_DISP++, 0x09, D_80116280); POLY_XLU_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_XLU_DISP); } if (!(this->unk_199 & 0x80)) { Matrix_Put(&this->unk_2F8); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gPoSistersTorchDL); } gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (globalCtx->gameplayFrames * -20) % 512, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + (play->gameplayFrames * -20) % 512, 0x20, 0x80)); gDPSetEnvColor(POLY_XLU_DISP++, temp_s1->r, temp_s1->g, temp_s1->b, temp_s1->a); if (this->actionFunc == func_80ADB17C) { if (this->unk_19A < 32) { @@ -1420,18 +1420,18 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); - Matrix_RotateZYX(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000), 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000), 0, MTXMODE_APPLY); if (this->actionFunc == func_80ADAFC0) { phi_f20 = (this->unk_19A - i) * 0.025f + 0.5f; phi_f20 = CLAMP(phi_f20, 0.5f, 0.8f) * 0.007f; } Matrix_Scale(phi_f20, phi_f20, phi_f20, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnPoSisters_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 0e9464738..913291551 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -6,7 +6,7 @@ struct EnPoSisters; -typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, GlobalContext*); +typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, PlayState*); typedef struct EnPoSisters { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 2b7a4ca5f..0474bbd8d 100644 --- a/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -10,35 +10,35 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12) -void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx); +void EnPoh_Init(Actor* thisx, PlayState* play); +void EnPoh_Destroy(Actor* thisx, PlayState* play); +void EnPoh_Update(Actor* thisx, PlayState* play); -void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_UpdateDead(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_DrawRegular(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_DrawComposer(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx); +void EnPoh_UpdateLiving(Actor* thisx, PlayState* play); +void EnPoh_UpdateDead(Actor* thisx, PlayState* play); +void EnPoh_DrawRegular(Actor* thisx, PlayState* play); +void EnPoh_DrawComposer(Actor* thisx, PlayState* play); +void EnPoh_DrawSoul(Actor* thisx, PlayState* play); -void func_80ADEAC4(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Idle(EnPoh* this, GlobalContext* globalCtx); -void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx); -void func_80ADEECC(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF894(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_ComposerAppear(EnPoh* this, GlobalContext* globalCtx); -void func_80ADEF38(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF574(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF5E0(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Disappear(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Appear(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx); -void func_80ADFE28(EnPoh* this, GlobalContext* globalCtx); -void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx); -void func_80AE009C(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_TalkRegular(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_TalkComposer(EnPoh* this, GlobalContext* globalCtx); +void func_80ADEAC4(EnPoh* this, PlayState* play); +void EnPoh_Idle(EnPoh* this, PlayState* play); +void func_80ADEC9C(EnPoh* this, PlayState* play); +void EnPoh_Attack(EnPoh* this, PlayState* play); +void func_80ADEECC(EnPoh* this, PlayState* play); +void func_80ADF894(EnPoh* this, PlayState* play); +void EnPoh_ComposerAppear(EnPoh* this, PlayState* play); +void func_80ADEF38(EnPoh* this, PlayState* play); +void func_80ADF15C(EnPoh* this, PlayState* play); +void func_80ADF574(EnPoh* this, PlayState* play); +void func_80ADF5E0(EnPoh* this, PlayState* play); +void EnPoh_Disappear(EnPoh* this, PlayState* play); +void EnPoh_Appear(EnPoh* this, PlayState* play); +void EnPoh_Death(EnPoh* this, PlayState* play); +void func_80ADFE28(EnPoh* this, PlayState* play); +void func_80ADFE80(EnPoh* this, PlayState* play); +void func_80AE009C(EnPoh* this, PlayState* play); +void EnPoh_TalkRegular(EnPoh* this, PlayState* play); +void EnPoh_TalkComposer(EnPoh* this, PlayState* play); static s16 D_80AE1A50 = 0; @@ -182,26 +182,26 @@ static InitChainEntry sInitChain[] = { static Vec3f D_80AE1B60 = { 0.0f, 3.0f, 0.0f }; static Vec3f D_80AE1B6C = { 0.0f, 0.0f, 0.0f }; -void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Init(Actor* thisx, PlayState* play) { s32 pad; EnItem00* collectible; EnPoh* this = (EnPoh*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); this->colliderSph.elements[0].dim.worldSphere.radius = 0; this->colliderSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->colliderSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; this->colliderSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; - Collider_InitCylinder(globalCtx, &this->colliderCyl); - Collider_SetCylinder(globalCtx, &this->colliderCyl, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCyl); + Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_194 = 0; this->unk_195 = 32; this->visibilityTimer = Rand_S16Offset(700, 300); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 0); if (this->actor.params >= 4) { @@ -212,30 +212,30 @@ void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { if (D_80AE1A50 >= 3) { Actor_Kill(&this->actor); } else { - collectible = Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x4000 | ITEM00_RUPEE_BLUE); + collectible = Item_DropCollectible(play, &this->actor.world.pos, 0x4000 | ITEM00_RUPEE_BLUE); if (collectible != NULL) { collectible->actor.speedXZ = 0.0f; } } } else if (this->actor.params == EN_POH_FLAT) { - if (Flags_GetSwitch(globalCtx, 0x28) || Flags_GetSwitch(globalCtx, 0x9)) { + if (Flags_GetSwitch(play, 0x28) || Flags_GetSwitch(play, 0x9)) { Actor_Kill(&this->actor); } else { - Flags_SetSwitch(globalCtx, 0x28); + Flags_SetSwitch(play, 0x28); } } else if (this->actor.params == EN_POH_SHARP) { - if (Flags_GetSwitch(globalCtx, 0x29) || Flags_GetSwitch(globalCtx, 0x9)) { + if (Flags_GetSwitch(play, 0x29) || Flags_GetSwitch(play, 0x9)) { Actor_Kill(&this->actor); } else { - Flags_SetSwitch(globalCtx, 0x29); + Flags_SetSwitch(play, 0x29); } } if (this->actor.params < EN_POH_SHARP) { - this->objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_POH); + this->objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_POH); this->infoIdx = EN_POH_INFO_NORMAL; this->actor.naviEnemyId = 0x44; } else { - this->objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_PO_COMPOSER); + this->objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_PO_COMPOSER); this->infoIdx = EN_POH_INFO_COMPOSER; this->actor.naviEnemyId = 0x43; } @@ -245,12 +245,12 @@ void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Destroy(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyJntSph(globalCtx, &this->colliderSph); - Collider_DestroyCylinder(globalCtx, &this->colliderCyl); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyJntSph(play, &this->colliderSph); + Collider_DestroyCylinder(play, &this->colliderCyl); if (this->actor.params == EN_POH_RUPEE) { D_80AE1A50--; } @@ -368,7 +368,7 @@ void EnPoh_SetupAppear(EnPoh* this) { this->actionFunc = EnPoh_Appear; } -void EnPoh_SetupDeath(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_SetupDeath(EnPoh* this, PlayState* play) { this->actor.update = EnPoh_UpdateDead; this->actor.draw = EnPoh_DrawSoul; this->actor.shape.shadowDraw = NULL; @@ -380,7 +380,7 @@ void EnPoh_SetupDeath(EnPoh* this, GlobalContext* globalCtx) { if (this->infoIdx != EN_POH_INFO_COMPOSER) { this->actor.shape.rot.x = -0x8000; } - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, 8); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, 8); this->unk_198 = 60; this->actionFunc = EnPoh_Death; } @@ -410,7 +410,7 @@ void func_80ADE6D4(EnPoh* this) { this->actionFunc = func_80ADFE28; } -void EnPoh_Talk(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Talk(EnPoh* this, PlayState* play) { this->actor.home.pos.y = this->actor.world.pos.y; Actor_SetFocus(&this->actor, -10.0f); this->colliderCyl.dim.radius = 13; @@ -423,10 +423,10 @@ void EnPoh_Talk(EnPoh* this, GlobalContext* globalCtx) { if (this->actor.params == EN_POH_FLAT || this->actor.params == EN_POH_SHARP) { if (CHECK_QUEST_ITEM(QUEST_SONG_SUN)) { this->actor.textId = 0x5000; - } else if (!Flags_GetSwitch(globalCtx, 0xA) && !Flags_GetSwitch(globalCtx, 0xB)) { + } else if (!Flags_GetSwitch(play, 0xA) && !Flags_GetSwitch(play, 0xB)) { this->actor.textId = 0x500F; - } else if ((this->actor.params == EN_POH_FLAT && Flags_GetSwitch(globalCtx, 0xA)) || - (this->actor.params == EN_POH_SHARP && Flags_GetSwitch(globalCtx, 0xB))) { + } else if ((this->actor.params == EN_POH_FLAT && Flags_GetSwitch(play, 0xA)) || + (this->actor.params == EN_POH_SHARP && Flags_GetSwitch(play, 0xB))) { this->actor.textId = 0x5013; } else { this->actor.textId = 0x5012; @@ -457,8 +457,8 @@ void func_80ADE9BC(EnPoh* this) { this->actionFunc = EnPoh_TalkComposer; } -void EnPoh_MoveTowardsPlayerHeight(EnPoh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoh_MoveTowardsPlayerHeight(EnPoh* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_StepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 1.0f); this->actor.world.pos.y += 2.5f * Math_SinS(this->unk_195 * 0x800); @@ -477,12 +477,12 @@ void func_80ADEA5C(EnPoh* this) { Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_19C, 0x71C); } -void func_80ADEAC4(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEAC4(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_198 != 0) { this->unk_198--; } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->actor.xzDistToPlayer < 200.0f) { func_80ADE1BC(this); } else if (this->unk_198 == 0) { @@ -493,14 +493,14 @@ void func_80ADEAC4(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_Idle(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Idle(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_198 != 0) { this->unk_198--; } func_80ADEA5C(this); - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->actor.xzDistToPlayer < 200.0f && this->unk_198 < 19) { func_80ADE1BC(this); } else if (this->unk_198 == 0) { @@ -515,11 +515,11 @@ void EnPoh_Idle(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEC9C(EnPoh* this, PlayState* play) { Player* player; s16 facingDiff; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->unk_198 != 0) { this->unk_198--; @@ -532,11 +532,11 @@ void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) { } else { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C); } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->actor.xzDistToPlayer > 280.0f) { EnPoh_SetupIdle(this); } else if (this->unk_198 == 0 && this->actor.xzDistToPlayer < 140.0f && - !Player_IsFacingActor(&this->actor, 0x2AAA, globalCtx)) { + !Player_IsFacingActor(&this->actor, 0x2AAA, play)) { EnPoh_SetupAttack(this); } if (this->lightColor.a == 255) { @@ -544,7 +544,7 @@ void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Attack(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_KANTERA); @@ -552,7 +552,7 @@ void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx) { this->unk_198--; } } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->unk_198 >= 10) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xE38); } else if (this->unk_198 == 9) { @@ -564,7 +564,7 @@ void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADEECC(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEECC(EnPoh* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { @@ -575,7 +575,7 @@ void func_80ADEECC(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADEF38(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEF38(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->lightColor.a = 255; this->visibilityTimer = Rand_S16Offset(700, 300); @@ -590,7 +590,7 @@ void func_80ADEF38(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_ComposerAppear(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_ComposerAppear(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->lightColor.a = 255; this->visibilityTimer = Rand_S16Offset(700, 300); @@ -601,7 +601,7 @@ void EnPoh_ComposerAppear(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF15C(EnPoh* this, PlayState* play) { Vec3f vec; f32 multiplier; f32 newScale; @@ -613,32 +613,32 @@ void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx) { if (this->unk_198 < 5) { vec.y = Math_SinS((this->unk_198 * 0x1000) - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); multiplier = Math_CosS((this->unk_198 * 0x1000) - 0x4000) * 23.0f; - vec.x = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier + + vec.x = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier + this->actor.world.pos.x; - vec.z = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier + + vec.z = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier + this->actor.world.pos.z; } else { vec.y = (this->actor.world.pos.y + 40.0f) + (15.0f * (this->unk_198 - 5)); vec.x = - Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.x; + Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.x; vec.z = - Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.z; + Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); vec.x = (this->actor.world.pos.x + this->actor.world.pos.x) - vec.x; vec.z = (this->actor.world.pos.z + this->actor.world.pos.z) - vec.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); vec.x = this->actor.world.pos.x; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, + EffectSsDeadDb_Spawn(play, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); if (this->unk_198 == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EXTINCT); } } else if (this->unk_198 == 28) { - EnPoh_SetupDeath(this, globalCtx); + EnPoh_SetupDeath(this, play); } else if (this->unk_198 >= 19) { newScale = (28 - this->unk_198) * 0.001f; this->actor.world.pos.y += 5.0f; @@ -651,7 +651,7 @@ void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF574(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF574(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = this->actor.shape.rot.y; EnPoh_SetupIdle(this); @@ -662,7 +662,7 @@ void func_80ADF574(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF5E0(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF5E0(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_19C, 1820) != 0) { EnPoh_SetupIdle(this); @@ -670,15 +670,15 @@ void func_80ADF5E0(EnPoh* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < 200.0f) { func_80ADE1BC(this); } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); } -void EnPoh_Disappear(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Disappear(EnPoh* this, PlayState* play) { if (this->unk_194 != 0) { this->unk_194--; } this->actor.world.rot.y += 0x1000; - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); this->lightColor.a = this->unk_194 * 7.96875f; if (this->unk_194 == 0) { this->visibilityTimer = Rand_S16Offset(100, 50); @@ -686,10 +686,10 @@ void EnPoh_Disappear(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_Appear(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Appear(EnPoh* this, PlayState* play) { this->unk_194++; this->actor.world.rot.y -= 0x1000; - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); this->lightColor.a = this->unk_194 * 7.96875f; if (this->unk_194 == 32) { this->visibilityTimer = Rand_S16Offset(700, 300); @@ -698,7 +698,7 @@ void EnPoh_Appear(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF894(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF894(EnPoh* this, PlayState* play) { f32 multiplier; SkelAnime_Update(&this->skelAnime); @@ -706,7 +706,7 @@ void func_80ADF894(EnPoh* this, GlobalContext* globalCtx) { this->actor.world.pos.x -= multiplier * Math_CosS(this->actor.shape.rot.y); this->actor.world.pos.z += multiplier * Math_SinS(this->actor.shape.rot.y); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 0x71C); - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->unk_198 == 0 || this->actor.xzDistToPlayer > 250.0f) { this->actor.world.rot.y = this->actor.shape.rot.y; EnPoh_SetupIdle(this); @@ -714,7 +714,7 @@ void func_80ADF894(EnPoh* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } -void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Death(EnPoh* this, PlayState* play) { s32 objId; if (this->unk_198 != 0) { @@ -722,7 +722,7 @@ void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & 1) { objId = (this->infoIdx == EN_POH_INFO_COMPOSER) ? OBJECT_PO_COMPOSER : OBJECT_POH; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, objId, 10, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, objId, 10, this->info->lanternDisplayList); func_80ADE6D4(this); } else if (this->unk_198 == 0) { @@ -730,7 +730,7 @@ void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx) { return; } Actor_MoveForward(&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_80ADFA90(EnPoh* this, s32 arg1) { @@ -754,19 +754,19 @@ void func_80ADFA90(EnPoh* this, s32 arg1) { this->info->lightColor.b, this->lightColor.a * (200.0f / 255)); } -void func_80ADFE28(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADFE28(EnPoh* this, PlayState* play) { this->actor.home.pos.y += 2.0f; func_80ADFA90(this, 20); if (this->lightColor.a == 255) { - EnPoh_Talk(this, globalCtx); + EnPoh_Talk(this, play); } } -void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADFE80(EnPoh* this, PlayState* play) { if (this->unk_198 != 0) { this->unk_198--; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.params >= EN_POH_SHARP) { func_80ADE9BC(this); } else { @@ -781,10 +781,10 @@ void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx) { } if (this->colliderCyl.base.ocFlags1 & OC1_HIT) { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.flags &= ~ACTOR_FLAG_16; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCyl.base); } this->actor.world.pos.y = Math_SinS(this->unk_195 * 0x800) * 5.0f + this->actor.home.pos.y; if (this->unk_195 != 0) { @@ -800,26 +800,26 @@ void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx) { this->info->lightColor.b, this->lightColor.a * (200.0f / 255)); } -void func_80AE009C(EnPoh* this, GlobalContext* globalCtx) { +void func_80AE009C(EnPoh* this, PlayState* play) { func_80ADFA90(this, -13); if (this->lightColor.a == 0) { Actor_Kill(&this->actor); } } -void EnPoh_TalkRegular(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_TalkRegular(EnPoh* this, PlayState* play) { if (this->actor.textId != 0x5005) { func_80ADFA90(this, -13); } else { func_8002F974(&this->actor, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (Inventory_HasEmptyBottle()) { this->actor.textId = 0x5008; - Item_Give(globalCtx, ITEM_POE); + Item_Give(play, ITEM_POE); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_BIG_GET); } else { this->actor.textId = 0x5006; @@ -829,47 +829,47 @@ void EnPoh_TalkRegular(EnPoh* this, GlobalContext* globalCtx) { this->actor.textId = 0x5007; Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { func_80ADE950(this, 0); } } -void EnPoh_TalkComposer(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_TalkComposer(EnPoh* this, PlayState* play) { func_8002F974(&this->actor, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { - if (!Flags_GetSwitch(globalCtx, 0xB) && !Flags_GetSwitch(globalCtx, 0xA)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + if (!Flags_GetSwitch(play, 0xB) && !Flags_GetSwitch(play, 0xA)) { this->actor.textId = 0x5010; } else { this->actor.textId = 0x5014; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } else { if (this->actor.params == EN_POH_SHARP) { - Flags_SetSwitch(globalCtx, 0xB); + Flags_SetSwitch(play, 0xB); } else { - Flags_SetSwitch(globalCtx, 0xA); + Flags_SetSwitch(play, 0xA); } func_80ADE950(this, 1); } } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x5000) { - Flags_SetSwitch(globalCtx, 9); + Flags_SetSwitch(play, 9); } func_80ADE950(this, 1); } } -void func_80AE032C(EnPoh* this, GlobalContext* globalCtx) { +void func_80AE032C(EnPoh* this, PlayState* play) { if (this->colliderCyl.base.acFlags & AC_HIT) { this->colliderCyl.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DEAD); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); @@ -906,19 +906,19 @@ void EnPoh_UpdateVisibility(EnPoh* this) { } } -void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Update(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectIdx)) { + if (Object_IsLoaded(&play->objectCtx, this->objectIdx)) { this->actor.objBankIndex = this->objectIdx; this->actor.update = EnPoh_UpdateLiving; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); if (this->infoIdx == EN_POH_INFO_NORMAL) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeSkel, &gPoeFloatAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gPoeSkel, &gPoeFloatAnim, this->jointTable, this->morphTable, 21); this->actor.draw = EnPoh_DrawRegular; } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gPoeComposerSkel, &gPoeComposerFloatAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gPoeComposerSkel, &gPoeComposerFloatAnim, this->jointTable, this->morphTable, 12); this->actor.draw = EnPoh_DrawComposer; this->colliderSph.elements[0].dim.limb = 9; @@ -985,7 +985,7 @@ void func_80AE089C(EnPoh* this) { } } -void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_UpdateLiving(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; s32 pad; Vec3f vec; @@ -995,20 +995,20 @@ void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx) { this->colliderSph.base.atFlags &= ~AT_HIT; func_80ADE4C8(this); } - func_80AE032C(this, globalCtx); + func_80AE032C(this, play); EnPoh_UpdateVisibility(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); if (this->actionFunc == EnPoh_Attack && this->unk_198 < 10) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } Collider_UpdateCylinder(&this->actor, &this->colliderCyl); if ((this->colliderCyl.base.acFlags & AC_ON) && this->lightColor.a == 255) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSph.base); Actor_SetFocus(&this->actor, 42.0f); if (this->actionFunc != func_80ADEECC && this->actionFunc != func_80ADF574) { if (this->actionFunc == func_80ADF894) { @@ -1021,12 +1021,12 @@ void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx) { vec.y = this->actor.world.pos.y + 20.0f; vec.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &sp38, &this->actor, &vec); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &sp38, &this->actor, &vec); func_80AE089C(this); this->actor.shape.shadowAlpha = this->lightColor.a; } -s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnPoh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoh* this = (EnPoh*)thisx; @@ -1044,12 +1044,12 @@ s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { +void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoh* this = (EnPoh*)thisx; Collider_UpdateSpheres(limbIndex, &this->colliderSph); if (this->actionFunc == func_80ADF15C && this->unk_198 >= 2 && limbIndex == this->info->unk_7) { - gSPMatrix((*gfxP)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfxP)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, this->info->burnDisplayList); } @@ -1071,39 +1071,39 @@ void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnPoh_DrawRegular(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_DrawRegular(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); func_80AE067C(this); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->lightColor.a == 255 || this->lightColor.a == 0) { gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a); gSPSegment(POLY_OPA_DISP++, 0x08, D_80116280 + 2); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->lightColor.a); gSPSegment(POLY_XLU_DISP++, 0x08, D_80116280); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_XLU_DISP); } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->envColor.r, this->envColor.g, this->envColor.b, 255); Matrix_Put(&this->unk_368); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->info->lanternDisplayList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnPoh_DrawComposer(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_DrawComposer(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; Color_RGBA8* sp90; Color_RGBA8* phi_t0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); func_80AE067C(this); if (this->actor.params == EN_POH_SHARP) { sp90 = &D_80AE1B4C; @@ -1113,67 +1113,67 @@ void EnPoh_DrawComposer(Actor* thisx, GlobalContext* globalCtx) { phi_t0 = &D_80AE1B58; } if (this->lightColor.a == 255 || this->lightColor.a == 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_EnvColor(globalCtx->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0C, D_80116280 + 2); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0B, - Gfx_EnvColor(globalCtx->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_XLU_DISP); } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->envColor.r, this->envColor.g, this->envColor.b, 255); Matrix_Put(&this->unk_368); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->info->lanternDisplayList); gSPDisplayList(POLY_OPA_DISP++, gPoeComposerLanternBottomDL); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sp90->r, sp90->g, sp90->b, 255); gSPDisplayList(POLY_OPA_DISP++, gPoeComposerLanternTopDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnPoh_UpdateDead(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_UpdateDead(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnPoh_Death) { this->visibilityTimer++; } func_80AE089C(this); } -void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_DrawSoul(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc == EnPoh_Death) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, this->envColor.r, this->envColor.g, this->envColor.b, 255); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->envColor.r, this->envColor.g, this->envColor.b, 200); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->info->lanternDisplayList); if (this->infoIdx == EN_POH_INFO_COMPOSER) { @@ -1186,17 +1186,17 @@ void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gPoeComposerLanternTopDL); } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->visibilityTimer * this->info->unk_8) % 512U, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, this->info->primColor.r, this->info->primColor.g, this->info->primColor.b, this->lightColor.a); gDPSetEnvColor(POLY_XLU_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, this->info->soulDisplayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.h index 724ade9e1..8c57fd512 100644 --- a/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/soh/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -6,7 +6,7 @@ struct EnPoh; -typedef void (*EnPohActionFunc)(struct EnPoh*, GlobalContext*); +typedef void (*EnPohActionFunc)(struct EnPoh*, PlayState*); typedef enum { EN_POH_NORMAL, diff --git a/soh/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c b/soh/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c index 0240b8f30..d31377ab8 100644 --- a/soh/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c +++ b/soh/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnPubox_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPubox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPubox_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPubox_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPubox_Init(Actor* thisx, PlayState* play); +void EnPubox_Destroy(Actor* thisx, PlayState* play); +void EnPubox_Update(Actor* thisx, PlayState* play); +void EnPubox_Draw(Actor* thisx, PlayState* play); const ActorInit En_Pu_box_InitVars = { ACTOR_EN_PU_BOX, @@ -27,7 +27,7 @@ const ActorInit En_Pu_box_InitVars = { NULL, }; -void EnPubox_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPubox_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; EnPubox* this = (EnPubox*)thisx; @@ -57,16 +57,16 @@ void EnPubox_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->targetMode = 1; thisx->gravity = -2.0f; CollisionHeader_GetVirtual(&gBlockMediumCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void EnPubox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPubox_Destroy(Actor* thisx, PlayState* play) { EnPubox* this = (EnPubox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnPubox_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPubox_Update(Actor* thisx, PlayState* play) { EnPubox* this = (EnPubox*)thisx; thisx->speedXZ += this->dyna.unk_150; @@ -80,11 +80,11 @@ void EnPubox_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.unk_154 = 0.0f; this->dyna.unk_150 = 0.0f; Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, + Actor_UpdateBgCheckInfo(play, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, thisx->colChkInfo.cylRadius, 0x1D); thisx->focus.pos = thisx->world.pos; } -void EnPubox_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gBlockMediumDL); +void EnPubox_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gBlockMediumDL); } diff --git a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 5e240e788..c9415cc1a 100644 --- a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -3,31 +3,31 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_10) -void EnRd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRd_Init(Actor* thisx, PlayState* play); +void EnRd_Destroy(Actor* thisx, PlayState* play); +void EnRd_Update(Actor* thisx, PlayState* play); +void EnRd_Draw(Actor* thisx, PlayState* play); void func_80AE269C(EnRd* this); -void func_80AE2744(EnRd* this, GlobalContext* globalCtx); +void func_80AE2744(EnRd* this, PlayState* play); void func_80AE2970(EnRd* this); -void func_80AE2A10(EnRd* this, GlobalContext* globalCtx); -void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx); -void func_80AE2F50(EnRd* this, GlobalContext* globalCtx); -void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx); +void func_80AE2A10(EnRd* this, PlayState* play); +void func_80AE2C1C(EnRd* this, PlayState* play); +void func_80AE2F50(EnRd* this, PlayState* play); +void func_80AE2FD0(EnRd* this, PlayState* play); void func_80AE31DC(EnRd* this); -void func_80AE3260(EnRd* this, GlobalContext* globalCtx); +void func_80AE3260(EnRd* this, PlayState* play); void func_80AE33F0(EnRd* this); void func_80AE392C(EnRd* this); void func_80AE39D4(EnRd* this); -void func_80AE3454(EnRd* this, GlobalContext* globalCtx); +void func_80AE3454(EnRd* this, PlayState* play); void func_80AE37BC(EnRd* this); -void func_80AE3834(EnRd* this, GlobalContext* globalCtx); -void func_80AE3978(EnRd* this, GlobalContext* globalCtx); -void func_80AE3A54(EnRd* this, GlobalContext* globalCtx); -void func_80AE3B18(EnRd* this, GlobalContext* globalCtx); -void func_80AE3C98(EnRd* this, GlobalContext* globalCtx); -void func_80AE3ECC(EnRd* this, GlobalContext* globalCtx); +void func_80AE3834(EnRd* this, PlayState* play); +void func_80AE3978(EnRd* this, PlayState* play); +void func_80AE3A54(EnRd* this, PlayState* play); +void func_80AE3B18(EnRd* this, PlayState* play); +void func_80AE3C98(EnRd* this, PlayState* play); +void func_80AE3ECC(EnRd* this, PlayState* play); const ActorInit En_Rd_InitVars = { ACTOR_EN_RD, @@ -121,7 +121,7 @@ void EnRd_SetupAction(EnRd* this, EnRdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Init(Actor* thisx, PlayState* play) { EnRd* this = (EnRd*)thisx; Actor_ProcessInitChain(thisx, sInitChain); @@ -143,17 +143,17 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { } if (thisx->params >= -1) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRedeadSkel, &gGibdoRedeadIdleAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, 26); thisx->naviEnemyId = 0x2A; } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, 26); thisx->naviEnemyId = 0x2D; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); if (thisx->params >= -2) { func_80AE269C(this); @@ -168,17 +168,17 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Destroy(Actor* thisx, PlayState* play) { EnRd* this = (EnRd*)thisx; if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AE2630(GlobalContext* globalCtx, Actor* thisx, s32 arg2) { - Actor* enemyIt = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].head; +void func_80AE2630(PlayState* play, Actor* thisx, s32 arg2) { + Actor* enemyIt = play->actorCtx.actorLists[ACTORCAT_ENEMY].head; while (enemyIt != NULL) { if ((enemyIt->id != ACTOR_EN_RD) || (enemyIt == thisx) || (enemyIt->params < 0)) { @@ -209,7 +209,7 @@ void func_80AE269C(EnRd* this) { EnRd_SetupAction(this, func_80AE2744); } -void func_80AE2744(EnRd* this, GlobalContext* globalCtx) { +void func_80AE2744(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0); Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0); @@ -246,7 +246,7 @@ void func_80AE2744(EnRd* this, GlobalContext* globalCtx) { } this->unk_305 = 0; - if ((this->actor.xzDistToPlayer <= 150.0f) && func_8002DDE4(globalCtx)) { + if ((this->actor.xzDistToPlayer <= 150.0f) && func_8002DDE4(play)) { if ((this->actor.params != 2) && (this->unk_305 == 0)) { func_80AE37BC(this); } else { @@ -255,7 +255,7 @@ void func_80AE2744(EnRd* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -273,7 +273,7 @@ void func_80AE2970(EnRd* this) { } // Rising out of coffin -void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) { +void func_80AE2A10(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) { @@ -295,7 +295,7 @@ void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) { } } -void func_80AE2B90(EnRd* this, GlobalContext* globalCtx) { +void func_80AE2B90(EnRd* this, PlayState* play) { Animation_Change(&this->skelAnime, &gGibdoRedeadWalkAnim, 1.0f, 4.0f, Animation_GetLastFrame(&gGibdoRedeadWalkAnim), ANIMMODE_LOOP_INTERP, -4.0f); this->actor.speedXZ = 0.4f; @@ -303,11 +303,11 @@ void func_80AE2B90(EnRd* this, GlobalContext* globalCtx) { EnRd_SetupAction(this, func_80AE2C1C); } -void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) { +void func_80AE2C1C(EnRd* this, PlayState* play) { Vec3f sp44 = D_80AE4918; Color_RGBA8 sp40 = D_80AE4924; Color_RGBA8 sp3C = D_80AE4928; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; s16 sp32 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310; @@ -319,7 +319,7 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { - func_80AE2F50(this, globalCtx); + func_80AE2F50(this, play); } if ((ABS(sp32) < 0x1554) && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 150.0f)) { @@ -327,15 +327,15 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) { if (this->unk_306 == 0) { if (!(this->unk_312 & 0x80)) { player->actor.freezeTimer = 40; - func_8008EEAC(globalCtx, &this->actor); - GET_PLAYER(globalCtx)->unk_684 = &this->actor; + func_8008EEAC(play, &this->actor); + GET_PLAYER(play)->unk_684 = &this->actor; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); } this->unk_306 = 0x3C; Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM); } } else { - func_80AE2F50(this, globalCtx); + func_80AE2F50(this, play); } } @@ -346,7 +346,7 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) { if (!this->unk_307 && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 45.0f) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { player->actor.freezeTimer = 0; - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { this->actor.flags &= ~ACTOR_FLAG_0; func_80AE33F0(this); } @@ -360,20 +360,20 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) { if ((this->skelAnime.curFrame == 10.0f) || (this->skelAnime.curFrame == 22.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } -void func_80AE2F50(EnRd* this, GlobalContext* globalCtx) { +void func_80AE2F50(EnRd* this, PlayState* play) { Animation_Change(&this->skelAnime, &gGibdoRedeadWalkAnim, 0.5f, 0, Animation_GetLastFrame(&gGibdoRedeadWalkAnim), ANIMMODE_LOOP_INTERP, -4.0f); this->unk_31B = 2; EnRd_SetupAction(this, func_80AE2FD0); } -void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE2FD0(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 targetY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); @@ -398,7 +398,7 @@ void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) { if (!(player->stateFlags1 & 0x2C6080) && !(player->stateFlags2 & 0x80) && (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { this->actor.targetMode = 0; - func_80AE2B90(this, globalCtx); + func_80AE2B90(this, play); } else if (this->actor.params > 0) { if (this->actor.parent != NULL) { func_80AE31DC(this); @@ -409,7 +409,7 @@ void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == 10.0f || this->skelAnime.curFrame == 22.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -422,7 +422,7 @@ void func_80AE31DC(EnRd* this) { EnRd_SetupAction(this, func_80AE3260); } -void func_80AE3260(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3260(EnRd* this, PlayState* play) { if (this->actor.parent != NULL) { s32 pad; s16 targetY; @@ -447,7 +447,7 @@ void func_80AE3260(EnRd* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0); Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0); } else { - func_80AE2B90(this, globalCtx); + func_80AE2B90(this, play); } this->actor.world.rot.y = this->actor.shape.rot.y; @@ -455,7 +455,7 @@ void func_80AE3260(EnRd* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == 10.0f || this->skelAnime.curFrame == 22.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -469,9 +469,9 @@ void func_80AE33F0(EnRd* this) { EnRd_SetupAction(this, func_80AE3454); } -void func_80AE3454(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3454(EnRd* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (SkelAnime_Update(&this->skelAnime)) { this->unk_304++; @@ -481,7 +481,7 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) { case 1: Animation_PlayLoop(&this->skelAnime, &gGibdoRedeadGrabAttackAnim); this->unk_304++; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_800AA000(this->actor.xzDistToPlayer, 0xFF, 1, 0xC); this->unk_319 = 20; case 0: @@ -515,7 +515,7 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) { this->unk_319--; if (this->unk_319 == 0) { - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_800AA000(this->actor.xzDistToPlayer, 0xF0, 1, 0xC); this->unk_319 = 20; func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92); @@ -534,7 +534,7 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; this->unk_306 = 0xA; this->unk_307 = 0xF; - func_80AE2B90(this, globalCtx); + func_80AE2B90(this, play); break; } } @@ -546,21 +546,21 @@ void func_80AE37BC(EnRd* this) { EnRd_SetupAction(this, func_80AE3834); } -void func_80AE3834(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3834(EnRd* this, PlayState* play) { Vec3f sp34 = D_80AE492C; Color_RGBA8 sp30 = D_80AE4938; Color_RGBA8 sp2C = D_80AE493C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310; if (ABS(temp_v0) < 0x2008) { if (!(this->unk_312 & 0x80)) { player->actor.freezeTimer = 60; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - func_8008EEAC(globalCtx, &this->actor); + func_8008EEAC(play, &this->actor); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM); - func_80AE2B90(this, globalCtx); + func_80AE2B90(this, play); } } @@ -570,7 +570,7 @@ void func_80AE392C(EnRd* this) { EnRd_SetupAction(this, func_80AE3978); } -void func_80AE3978(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3978(EnRd* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.parent != NULL) { func_80AE31DC(this); @@ -587,7 +587,7 @@ void func_80AE39D4(EnRd* this) { EnRd_SetupAction(this, func_80AE3A54); } -void func_80AE3A54(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3A54(EnRd* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_80AE269C(this); } @@ -606,8 +606,8 @@ void func_80AE3A8C(EnRd* this) { EnRd_SetupAction(this, func_80AE3B18); } -void func_80AE3B18(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE3B18(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; @@ -622,9 +622,9 @@ void func_80AE3B18(EnRd* this, GlobalContext* globalCtx) { if (this->actor.parent != NULL) { func_80AE31DC(this); } else if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { - func_80AE2F50(this, globalCtx); + func_80AE2F50(this, play); } else { - func_80AE2B90(this, globalCtx); + func_80AE2B90(this, play); } this->unk_31D = 0xFF; @@ -641,9 +641,9 @@ void func_80AE3C20(EnRd* this) { EnRd_SetupAction(this, func_80AE3C98); } -void func_80AE3C98(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3C98(EnRd* this, PlayState* play) { if (this->actor.category != ACTORCAT_PROP) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x7D0, 0); @@ -651,12 +651,12 @@ void func_80AE3C98(EnRd* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_30C == 0) { - if (!Flags_GetSwitch(globalCtx, this->unk_312 & 0x7F)) { - Flags_SetSwitch(globalCtx, this->unk_312 & 0x7F); + if (!Flags_GetSwitch(play, this->unk_312 & 0x7F)) { + Flags_SetSwitch(play, this->unk_312 & 0x7F); } if (this->unk_314 != 0) { if (this->unk_314 == 0xB4) { - func_80AE2630(globalCtx, &this->actor, 0); + func_80AE2630(play, &this->actor, 0); } this->actor.scale.y -= 0.000075f; this->unk_314 -= 5; @@ -689,7 +689,7 @@ void func_80AE3DE4(EnRd* this) { EnRd_SetupAction(this, func_80AE3ECC); } -void func_80AE3ECC(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3ECC(EnRd* this, PlayState* play) { if ((this->unk_318 != 0) && (this->unk_316 != 0)) { this->unk_316--; if (this->unk_316 >= 0xFF) { @@ -703,16 +703,16 @@ void func_80AE3ECC(EnRd* this, GlobalContext* globalCtx) { if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { - func_80AE2630(globalCtx, &this->actor, 1); + func_80AE2630(play, &this->actor, 1); func_80AE3C20(this); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); } else { func_80AE3A8C(this); } } } -void func_80AE3F9C(EnRd* this, GlobalContext* globalCtx) { +void func_80AE3F9C(EnRd* this, PlayState* play) { s16 temp1; s16 temp2; s16 temp3; @@ -735,9 +735,9 @@ void func_80AE3F9C(EnRd* this, GlobalContext* globalCtx) { this->unk_30E = CLAMP(this->unk_30E, -9583, 9583); } -void func_80AE4114(EnRd* this, GlobalContext* globalCtx) { +void func_80AE4114(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->unk_318 == 0) && (this->unk_31B != 9) && (this->unk_31B != 10) && (this->unk_31B != 1)) { @@ -774,9 +774,9 @@ void func_80AE4114(EnRd* this, GlobalContext* globalCtx) { Actor_ApplyDamage(&this->actor); if (this->actor.colChkInfo.health == 0) { - func_80AE2630(globalCtx, &this->actor, 1); + func_80AE2630(play, &this->actor, 1); func_80AE3C20(this); - Item_DropCollectibleRandom(globalCtx, 0, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, 0, &this->actor.world.pos, 0x90); } else { func_80AE3A8C(this); } @@ -785,13 +785,13 @@ void func_80AE4114(EnRd* this, GlobalContext* globalCtx) { } } -void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Update(Actor* thisx, PlayState* play) { s32 pad; EnRd* this = (EnRd*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; - func_80AE4114(this, globalCtx); + func_80AE4114(this, play); if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE && this->unk_318 == 0) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; @@ -802,17 +802,17 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_306--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_31B != 8 && this->actor.speedXZ != 0.0f) { Actor_MoveForward(&this->actor); } if ((this->actor.shape.rot.x == 0) && (this->unk_31B != 8) && (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->unk_31B == 7) { - func_80AE3F9C(this, globalCtx); + func_80AE3F9C(this, play); } } @@ -821,14 +821,14 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.health > 0) && (this->unk_31B != 8)) { 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_31B != 9) || ((player->unk_844 != 0) && (player->unk_845 != this->unk_31D))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnRd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnRd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnRd* this = (EnRd*)thisx; @@ -840,7 +840,7 @@ s32 EnRd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnRd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Vec3f sp2C = D_80AE4940; EnRd* this = (EnRd*)thisx; s32 idx = -1; @@ -889,39 +889,39 @@ void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Draw(Actor* thisx, PlayState* play) { s32 pad; EnRd* this = (EnRd*)thisx; Vec3f thisPos = thisx->world.pos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_314 == 0xFF) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk_314); gSPSegment(POLY_OPA_DISP++, 8, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnRd_OverrideLimbDraw, EnRd_PostLimbDraw, this, POLY_OPA_DISP); - func_80033C30(&thisPos, &D_80AE4958, 255, globalCtx); + func_80033C30(&thisPos, &D_80AE4958, 255, play); if (this->unk_31A != 0) { thisx->colorFilterTimer++; this->unk_31A--; if (this->unk_31A % 4 == 0) { - EffectSsEnFire_SpawnVec3s(globalCtx, thisx, &this->firePos[this->unk_31A >> 2], 0x4B, 0, 0, + EffectSsEnFire_SpawnVec3s(play, thisx, &this->firePos[this->unk_31A >> 2], 0x4B, 0, 0, (this->unk_31A >> 2)); } } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_314); gSPSegment(POLY_XLU_DISP++, 8, &D_80116280[0]); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnRd_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - func_80033C30(&thisPos, &D_80AE4958, this->unk_314, globalCtx); + func_80033C30(&thisPos, &D_80AE4958, this->unk_314, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.h b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.h index f679f08ab..09304f39b 100644 --- a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.h +++ b/soh/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 struct EnRd { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index 13c08dfc3..93529183e 100644 --- a/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -12,23 +12,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_27) -void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnReeba_Init(Actor* thisx, PlayState* play); +void EnReeba_Destroy(Actor* thisx, PlayState* play); +void EnReeba_Update(Actor* thisx, PlayState* play); +void EnReeba_Draw(Actor* thisx, PlayState* play); -void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5054(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5270(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5688(EnReeba* this, GlobalContext* globalCtx); -void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx); -void func_80AE538C(EnReeba* this, GlobalContext* globalCtx); -void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5E48(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5854(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5938(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx); +void func_80AE4F40(EnReeba* this, PlayState* play); +void func_80AE5054(EnReeba* this, PlayState* play); +void func_80AE5270(EnReeba* this, PlayState* play); +void func_80AE5688(EnReeba* this, PlayState* play); +void func_80AE56E0(EnReeba* this, PlayState* play); +void func_80AE538C(EnReeba* this, PlayState* play); +void func_80AE53AC(EnReeba* this, PlayState* play); +void func_80AE5E48(EnReeba* this, PlayState* play); +void func_80AE5854(EnReeba* this, PlayState* play); +void func_80AE5C38(EnReeba* this, PlayState* play); +void func_80AE5938(EnReeba* this, PlayState* play); +void func_80AE5A9C(EnReeba* this, PlayState* play); static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x0), @@ -98,7 +98,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; -void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnReeba_Init(Actor* thisx, PlayState* play) { s32 pad; EnReeba* this = (EnReeba*)thisx; s32 surfaceType; @@ -107,12 +107,12 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 3; this->actor.gravity = -3.5f; this->actor.focus.pos = this->actor.world.pos; - SkelAnime_Init(globalCtx, &this->skelanime, &object_reeba_Skel_001EE8, &object_reeba_Anim_0001E4, this->jointTable, + SkelAnime_Init(play, &this->skelanime, &object_reeba_Skel_001EE8, &object_reeba_Anim_0001E4, this->jointTable, this->morphTable, 18); this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 4; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->isBig = this->actor.params; this->scale = 0.04f; @@ -124,15 +124,15 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 20; this->collider.info.toucher.effect = 4; this->collider.info.toucher.damage = 16; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } this->actor.shape.yOffset = this->unk_284 = this->scale * -27500.0f; ActorShape_Init(&this->actor.shape, this->actor.shape.yOffset, ActorShadow_DrawCircle, 0.0f); this->actor.colChkInfo.damageTable = &sDamageTable; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D); - surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surfaceType != 4) && (surfaceType != 7)) { Actor_Kill(&this->actor); @@ -142,11 +142,11 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionfunc = func_80AE4F40; } -void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnReeba_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnReeba* this = (EnReeba*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (this->actor.parent != NULL) { EnEncount1* spawner = (EnEncount1*)this->actor.parent; @@ -163,9 +163,9 @@ void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE4F40(EnReeba* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&object_reeba_Anim_0001E4); - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 playerSpeed; Animation_Change(&this->skelanime, &object_reeba_Anim_0001E4, 2.0f, 0.0f, frames, ANIMMODE_LOOP, -10.0f); @@ -191,14 +191,14 @@ void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5054; } -void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE5054(EnReeba* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerLinearVel; SkelAnime_Update(&this->skelanime); - if ((globalCtx->gameplayFrames % 4) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, + if ((play->gameplayFrames % 4) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, 500, 10, true); } @@ -241,7 +241,7 @@ void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5270(EnReeba* this, PlayState* play) { s32 surfaceType; SkelAnime_Update(&this->skelanime); @@ -250,7 +250,7 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f); } - surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surfaceType != 4) && (surfaceType != 7)) { this->actor.speedXZ = 0.0f; @@ -264,12 +264,12 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE538C(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE538C(EnReeba* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; this->actionfunc = func_80AE53AC; } -void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE53AC(EnReeba* this, PlayState* play) { f32 speed; s16 yawDiff; s16 yaw; @@ -281,7 +281,7 @@ void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f); } - surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if (((surfaceType != 4) && (surfaceType != 7)) || (this->actor.xzDistToPlayer > 400.0f) || (this->actor.bgCheckFlags & 8)) { @@ -312,7 +312,7 @@ void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE561C(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE561C(EnReeba* this, PlayState* play) { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.3f); if (this->unk_272 == 0) { @@ -324,7 +324,7 @@ void func_80AE561C(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5688(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5688(EnReeba* this, PlayState* play) { this->unk_27E = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actor.flags |= ACTOR_FLAG_27; @@ -332,14 +332,14 @@ void func_80AE5688(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE56E0; } -void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE56E0(EnReeba* this, PlayState* play) { Math_ApproachZeroF(&this->actor.shape.shadowScale, 1.0f, 0.3f); Math_ApproachZeroF(&this->actor.speedXZ, 0.1f, 0.3f); SkelAnime_Update(&this->skelanime); if ((this->unk_284 + 10.0f) <= this->actor.shape.yOffset) { - if ((globalCtx->gameplayFrames % 4) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, + if ((play->gameplayFrames % 4) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, 500, 10, true); } @@ -350,7 +350,7 @@ void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE57F0(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE57F0(EnReeba* this, PlayState* play) { this->unk_276 = 14; this->actor.speedXZ = -8.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -358,7 +358,7 @@ void func_80AE57F0(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5854; } -void func_80AE5854(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5854(EnReeba* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.speedXZ < 0.0f) { @@ -375,7 +375,7 @@ void func_80AE5854(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE58EC(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE58EC(EnReeba* this, PlayState* play) { this->unk_278 = 14; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speedXZ = -8.0f; @@ -384,7 +384,7 @@ void func_80AE58EC(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5938; } -void func_80AE5938(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5938(EnReeba* this, PlayState* play) { Vec3f pos; f32 scale; @@ -406,7 +406,7 @@ void func_80AE5938(EnReeba* this, GlobalContext* globalCtx) { scale = 6.0f; } - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); } this->unk_278 = 66; @@ -418,7 +418,7 @@ void func_80AE5938(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5A9C(EnReeba* this, PlayState* play) { Vec3f pos; f32 scale; @@ -433,16 +433,16 @@ void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx) { scale = 6.0f; } - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); } } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actionfunc = func_80AE5C38; } } -void func_80AE5BC4(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5BC4(EnReeba* this, PlayState* play) { this->actor.speedXZ = -8.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); @@ -451,7 +451,7 @@ void func_80AE5BC4(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5C38; } -void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5C38(EnReeba* this, PlayState* play) { Vec3f pos; Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -471,12 +471,12 @@ void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) { velocity.y = 4.0f; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velocity, &accel, 120, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &velocity, &accel, 120, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); if (!this->isBig) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &pos, 0xE0); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &pos, 0xC0); } if (this->actor.parent != NULL) { @@ -498,7 +498,7 @@ void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5E48(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5E48(EnReeba* this, PlayState* play) { if (this->unk_278 < 37) { this->actor.shape.rot.x = Rand_CenteredFloat(3000.0f); this->actor.shape.rot.z = Rand_CenteredFloat(3000.0f); @@ -513,7 +513,7 @@ void func_80AE5E48(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5EDC(EnReeba* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; @@ -544,7 +544,7 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) { Actor_ApplyDamage(&this->actor); if (this->actor.colChkInfo.health == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actionfunc = func_80AE5BC4; } else { if (this->actionfunc == func_80AE5E48) { @@ -573,13 +573,13 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) { } } -void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnReeba_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnReeba* this = (EnReeba*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_80AE5EDC(this, globalCtx); - this->actionfunc(this, globalCtx); + func_80AE5EDC(this, play); + this->actionfunc(this, play); Actor_SetScale(&this->actor, this->scale); if (this->unk_270 != 0) { @@ -603,7 +603,7 @@ void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) { } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D); if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; @@ -636,25 +636,25 @@ void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->actor.shape.yOffset >= -700.0f) && (this->actor.colChkInfo.health > 0) && (this->actionfunc != func_80AE56E0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (!(this->actor.shape.yOffset < 0.0f)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if ((this->actionfunc == func_80AE5270) || (this->actionfunc == func_80AE53AC)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } } -void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnReeba_Draw(Actor* thisx, PlayState* play) { s32 pad; EnReeba* this = (EnReeba*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->isBig) { gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 155, 55, 255, 255); @@ -662,9 +662,9 @@ void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 255, 255, 255, 255); } - SkelAnime_DrawOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, NULL, NULL, this); + SkelAnime_DrawOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (BREG(0)) { Vec3f debugPos; @@ -673,6 +673,6 @@ void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx) { debugPos.y = this->actor.world.pos.y + 20.0f; debugPos.z = (Math_CosS(this->actor.world.rot.y) * 30.0f) + this->actor.world.pos.z; DebugDisplay_AddObject(debugPos.x, debugPos.y, debugPos.z, this->actor.world.rot.x, this->actor.world.rot.y, - this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, globalCtx->state.gfxCtx); + this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h b/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h index 397ff92f6..61ff9666c 100644 --- a/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h +++ b/soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h @@ -6,7 +6,7 @@ struct EnReeba; -typedef void (*EnReebaActionFunc)(struct EnReeba*, GlobalContext*); +typedef void (*EnReebaActionFunc)(struct EnReeba*, PlayState*); typedef struct EnReeba { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 5f0997a1e..5a0cb531c 100644 --- a/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -8,10 +8,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRiverSound_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRiverSound_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRiverSound_Init(Actor* thisx, PlayState* play); +void EnRiverSound_Destroy(Actor* thisx, PlayState* play); +void EnRiverSound_Update(Actor* thisx, PlayState* play); +void EnRiverSound_Draw(Actor* thisx, PlayState* play); const ActorInit En_River_Sound_InitVars = { ACTOR_EN_RIVER_SOUND, @@ -26,7 +26,7 @@ const ActorInit En_River_Sound_InitVars = { NULL, }; -void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Init(Actor* thisx, PlayState* play) { EnRiverSound* this = (EnRiverSound*)thisx; this->playSound = 0; @@ -47,7 +47,7 @@ void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRiverSound_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Destroy(Actor* thisx, PlayState* play) { EnRiverSound* this = (EnRiverSound*)thisx; if (this->actor.params == RS_SARIAS_SONG) { @@ -164,22 +164,22 @@ s32 EnRiverSound_GetSoundPos(Vec3s* points, s32 numPoints, Vec3f* hearPos, Vec3f return true; } -void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Update(Actor* thisx, PlayState* play) { Path* path; Vec3f* pos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnRiverSound* this = (EnRiverSound*)thisx; s32 sp34; if ((thisx->params == RS_UNK_0) || (thisx->params == RS_UNK_4) || (thisx->params == RS_UNK_5)) { - path = &globalCtx->setupPathList[this->pathIndex]; + path = &play->setupPathList[this->pathIndex]; pos = &thisx->world.pos; if (EnRiverSound_GetSoundPos(SEGMENTED_TO_VIRTUAL(path->points), path->count, &player->actor.world.pos, pos)) { - if (BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &thisx->floorPoly, &sp34, thisx, pos) != + if (BgCheck_EntityRaycastFloor4(&play->colCtx, &thisx->floorPoly, &sp34, thisx, pos) != BGCHECK_Y_MIN) { // Get the sound volume pitch based on the speed of the river current under the actor - this->soundPitchIndex = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, thisx->floorPoly, sp34); + this->soundPitchIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, thisx->floorPoly, sp34); } else { this->soundPitchIndex = 0; } @@ -199,12 +199,12 @@ void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { } } else if ((thisx->params == RS_UNK_13) || (thisx->params == RS_UNK_19)) { func_8002DBD0(&player->actor, &thisx->home.pos, &thisx->world.pos); - } else if (globalCtx->sceneNum == SCENE_DDAN_BOSS && Flags_GetClear(globalCtx, thisx->room)) { + } else if (play->sceneNum == SCENE_DDAN_BOSS && Flags_GetClear(play, thisx->room)) { Actor_Kill(thisx); } } -void EnRiverSound_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Draw(Actor* thisx, PlayState* play) { static s16 soundEffects[] = { 0, NA_SE_EV_WATER_WALL - SFX_FLAG, diff --git a/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c index 1d4fdceb8..7e4cef134 100644 --- a/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -10,30 +10,30 @@ #define FLAGS ACTOR_FLAG_4 -void EnRl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRl_Init(Actor* thisx, PlayState* play); +void EnRl_Destroy(Actor* thisx, PlayState* play); +void EnRl_Update(Actor* thisx, PlayState* play); +void EnRl_Draw(Actor* thisx, PlayState* play); -void func_80AE7798(EnRl* this, GlobalContext* globalCtx); -void func_80AE77B8(EnRl* this, GlobalContext* globalCtx); -void func_80AE77F8(EnRl* this, GlobalContext* globalCtx); -void func_80AE7838(EnRl* this, GlobalContext* globalCtx); -void func_80AE7C64(EnRl* this, GlobalContext* globalCtx); -void func_80AE7C94(EnRl* this, GlobalContext* globalCtx); -void func_80AE7CE8(EnRl* this, GlobalContext* globalCtx); -void func_80AE7D40(EnRl* this, GlobalContext* globalCtx); -void func_80AE7FD0(EnRl* this, GlobalContext* globalCtx); -void func_80AE7FDC(EnRl* this, GlobalContext* globalCtx); -void func_80AE7D94(EnRl* this, GlobalContext* globalCtx); +void func_80AE7798(EnRl* this, PlayState* play); +void func_80AE77B8(EnRl* this, PlayState* play); +void func_80AE77F8(EnRl* this, PlayState* play); +void func_80AE7838(EnRl* this, PlayState* play); +void func_80AE7C64(EnRl* this, PlayState* play); +void func_80AE7C94(EnRl* this, PlayState* play); +void func_80AE7CE8(EnRl* this, PlayState* play); +void func_80AE7D40(EnRl* this, PlayState* play); +void func_80AE7FD0(EnRl* this, PlayState* play); +void func_80AE7FDC(EnRl* this, PlayState* play); +void func_80AE7D94(EnRl* this, PlayState* play); static void* D_80AE81A0[] = { object_rl_Tex_003620, object_rl_Tex_003960, object_rl_Tex_003B60 }; static s32 D_80AE81AC = 0; -void EnRl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Destroy(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; D_80AE81AC = 0; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void func_80AE72D0(EnRl* this) { @@ -62,9 +62,9 @@ void func_80AE7358(EnRl* this) { this->unk_19C = 0.0f; } -void func_80AE73D8(EnRl* this, GlobalContext* globalCtx) { +void func_80AE73D8(EnRl* this, PlayState* play) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_80AE81AC) { if (this->actor.params == 2) { func_80AE7358(this); @@ -76,19 +76,19 @@ void func_80AE73D8(EnRl* this, GlobalContext* globalCtx) { } } -void func_80AE744C(EnRl* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void func_80AE744C(EnRl* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } s32 func_80AE7494(EnRl* this) { return SkelAnime_Update(&this->skelAnime); } -s32 func_80AE74B4(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { +s32 func_80AE74B4(EnRl* this, PlayState* play, u16 arg2, s32 arg3) { CsCmdActorAction* csCmdActorAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdActorAction = globalCtx->csCtx.npcActions[arg3]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdActorAction = play->csCtx.npcActions[arg3]; if (csCmdActorAction != NULL && csCmdActorAction->action == arg2) { return 1; } @@ -96,11 +96,11 @@ s32 func_80AE74B4(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -s32 func_80AE74FC(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { +s32 func_80AE74FC(EnRl* this, PlayState* play, u16 arg2, s32 arg3) { CsCmdActorAction* csCmdActorAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdActorAction = globalCtx->csCtx.npcActions[arg3]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdActorAction = play->csCtx.npcActions[arg3]; if (csCmdActorAction != NULL && csCmdActorAction->action != arg2) { return 1; } @@ -108,42 +108,42 @@ s32 func_80AE74FC(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -void func_80AE7544(EnRl* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); +void func_80AE7544(EnRl* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); } -void func_80AE7590(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7590(EnRl* this, PlayState* play) { s32 pad; Player* player; Vec3f pos; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; - if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_KENJYANOMA && globalCtx->csCtx.state != CS_STATE_IDLE && - globalCtx->csCtx.npcActions[6] != NULL && globalCtx->csCtx.npcActions[6]->action == 2 && + if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_KENJYANOMA && play->csCtx.state != CS_STATE_IDLE && + play->csCtx.npcActions[6] != NULL && play->csCtx.npcActions[6]->action == 2 && !this->lightMedallionGiven) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); pos.x = player->actor.world.pos.x; pos.y = player->actor.world.pos.y + 80.0f; pos.z = player->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, pos.x, pos.y, pos.z, 0, 0, 0, 0xE); - Item_Give(globalCtx, ITEM_MEDALLION_LIGHT); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, pos.x, pos.y, pos.z, 0, 0, 0, 0xE); + Item_Give(play, ITEM_MEDALLION_LIGHT); this->lightMedallionGiven = 1; } } -void func_80AE7668(EnRl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE7668(EnRl* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->drawConfig = 1; this->action = 1; player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } -void func_80AE7698(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7698(EnRl* this, PlayState* play) { CsCmdActorAction* csCmdActorAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdActorAction = globalCtx->csCtx.npcActions[0]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdActorAction = play->csCtx.npcActions[0]; if (csCmdActorAction != NULL && csCmdActorAction->action == 3) { Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, Animation_GetLastFrame(&object_rl_Anim_00040C), ANIMMODE_ONCE, 0.0f); @@ -160,46 +160,46 @@ void func_80AE772C(EnRl* this, s32 arg1) { } } -void func_80AE7798(EnRl* this, GlobalContext* globalCtx) { - func_80AE7668(this, globalCtx); +void func_80AE7798(EnRl* this, PlayState* play) { + func_80AE7668(this, play); } -void func_80AE77B8(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE77B8(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE7698(this, globalCtx); + func_80AE7698(this, play); } -void func_80AE77F8(EnRl* this, GlobalContext* globalCtx) { +void func_80AE77F8(EnRl* this, PlayState* play) { s32 temp; - func_80AE744C(this, globalCtx); + func_80AE744C(this, play); temp = func_80AE7494(this); func_80AE72D0(this); func_80AE772C(this, temp); } -void func_80AE7838(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE7838(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE7590(this, globalCtx); + func_80AE7590(this, play); } -void func_80AE7878(EnRl* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); +void func_80AE7878(EnRl* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); this->action = 4; this->actor.shape.shadowAlpha = 0; } -void func_80AE78D4(EnRl* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void func_80AE78D4(EnRl* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(18) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 5); } -void func_80AE7954(EnRl* this, GlobalContext* globalCtx) { - if (func_80AE74B4(this, globalCtx, 4, 0)) { +void func_80AE7954(EnRl* this, PlayState* play) { + if (func_80AE74B4(this, play, 4, 0)) { this->action = 5; this->drawConfig = 2; this->alpha = 0; @@ -208,11 +208,11 @@ void func_80AE7954(EnRl* this, GlobalContext* globalCtx) { } } -void func_80AE79A4(EnRl* this, GlobalContext* globalCtx) { +void func_80AE79A4(EnRl* this, PlayState* play) { f32* unk_19C = &this->unk_19C; s32 alpha = 255; - if (func_80AE74B4(this, globalCtx, 4, 0)) { + if (func_80AE74B4(this, play, 4, 0)) { *unk_19C += 1.0f; if (*unk_19C >= kREG(5) + 10.0f) { this->action = 7; @@ -238,18 +238,18 @@ void func_80AE79A4(EnRl* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = alpha; } -void func_80AE7AF8(EnRl* this, GlobalContext* globalCtx) { - if (func_80AE74B4(this, globalCtx, 3, 0)) { +void func_80AE7AF8(EnRl* this, PlayState* play) { + if (func_80AE74B4(this, play, 3, 0)) { Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, Animation_GetLastFrame(&object_rl_Anim_00040C), ANIMMODE_ONCE, -8.0f); this->action = 6; - } else if (func_80AE74FC(this, globalCtx, 4, 0)) { + } else if (func_80AE74FC(this, play, 4, 0)) { this->action = 5; this->drawConfig = 2; this->unk_19C = kREG(5) + 10.0f; this->alpha = 255; if (!this->lightBallSpawned) { - func_80AE78D4(this, globalCtx); + func_80AE78D4(this, play); this->lightBallSpawned = 1; } this->actor.shape.shadowAlpha = 0xFF; @@ -264,56 +264,56 @@ void func_80AE7BF8(EnRl* this, s32 arg1) { } } -void func_80AE7C64(EnRl* this, GlobalContext* globalCtx) { - func_80AE7954(this, globalCtx); - func_80AE73D8(this, globalCtx); +void func_80AE7C64(EnRl* this, PlayState* play) { + func_80AE7954(this, play); + func_80AE73D8(this, play); } -void func_80AE7C94(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE7C94(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE79A4(this, globalCtx); - func_80AE73D8(this, globalCtx); + func_80AE79A4(this, play); + func_80AE73D8(this, play); } -void func_80AE7CE8(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7CE8(EnRl* this, PlayState* play) { s32 temp; - func_80AE744C(this, globalCtx); + func_80AE744C(this, play); temp = func_80AE7494(this); func_80AE72D0(this); func_80AE7BF8(this, temp); - func_80AE73D8(this, globalCtx); + func_80AE73D8(this, play); } -void func_80AE7D40(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE7D40(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE7AF8(this, globalCtx); - func_80AE73D8(this, globalCtx); + func_80AE7AF8(this, play); + func_80AE73D8(this, play); } -void func_80AE7D94(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7D94(EnRl* this, PlayState* play) { s32 pad[2]; s16 temp = this->eyeTextureIndex; void* tex = D_80AE81A0[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static EnRlActionFunc sActionFuncs[] = { @@ -321,47 +321,47 @@ static EnRlActionFunc sActionFuncs[] = { func_80AE7C64, func_80AE7C94, func_80AE7CE8, func_80AE7D40, }; -void EnRl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Update(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; if ((this->action < 0) || (this->action > 7) || (sActionFuncs[this->action] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnRl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Init(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); if (this->actor.params == 2) { - func_80AE7878(this, globalCtx); + func_80AE7878(this, play); } else { - func_80AE7544(this, globalCtx); + func_80AE7544(this, play); } } -void func_80AE7FD0(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7FD0(EnRl* this, PlayState* play) { } -void func_80AE7FDC(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7FDC(EnRl* this, PlayState* play) { s32 pad[2]; s16 temp = this->eyeTextureIndex; void* tex = D_80AE81A0[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static EnRlDrawFunc sDrawFuncs[] = { @@ -370,14 +370,14 @@ static EnRlDrawFunc sDrawFuncs[] = { func_80AE7D94, }; -void EnRl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Draw(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } const ActorInit En_Rl_InitVars = { diff --git a/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.h b/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.h index 84a698dcd..9aa6b9ae6 100644 --- a/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.h +++ b/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.h @@ -6,8 +6,8 @@ struct EnRl; -typedef void (*EnRlActionFunc)(struct EnRl*, GlobalContext*); -typedef void (*EnRlDrawFunc)(struct EnRl*, GlobalContext*); +typedef void (*EnRlActionFunc)(struct EnRl*, PlayState*); +typedef void (*EnRlDrawFunc)(struct EnRl*, PlayState*); typedef struct EnRl { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 45655f784..f3a7a3c32 100644 --- a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -46,23 +46,23 @@ typedef enum { /* 5 */ RR_DROP_RUPEE_RED } EnRrDropType; -void EnRr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRr_Init(Actor* thisx, PlayState* play); +void EnRr_Destroy(Actor* thisx, PlayState* play); +void EnRr_Update(Actor* thisx, PlayState* play); +void EnRr_Draw(Actor* thisx, PlayState* play); -void EnRr_InitBodySegments(EnRr* this, GlobalContext* globalCtx); +void EnRr_InitBodySegments(EnRr* this, PlayState* play); void EnRr_SetupDamage(EnRr* this); void EnRr_SetupDeath(EnRr* this); -void EnRr_Approach(EnRr* this, GlobalContext* globalCtx); -void EnRr_Reach(EnRr* this, GlobalContext* globalCtx); -void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx); -void EnRr_Damage(EnRr* this, GlobalContext* globalCtx); -void EnRr_Death(EnRr* this, GlobalContext* globalCtx); -void EnRr_Retreat(EnRr* this, GlobalContext* globalCtx); -void EnRr_Stunned(EnRr* this, GlobalContext* globalCtx); +void EnRr_Approach(EnRr* this, PlayState* play); +void EnRr_Reach(EnRr* this, PlayState* play); +void EnRr_GrabPlayer(EnRr* this, PlayState* play); +void EnRr_Damage(EnRr* this, PlayState* play); +void EnRr_Death(EnRr* this, PlayState* play); +void EnRr_Retreat(EnRr* this, PlayState* play); +void EnRr_Stunned(EnRr* this, PlayState* play); const ActorInit En_Rr_InitVars = { ACTOR_EN_RR, @@ -161,18 +161,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnRr_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnRr_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnRr* this = (EnRr*)thisx; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 4; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinderType1(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinderType1(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinderType1(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinderType1(play, &this->collider2, &this->actor, &sCylinderInit2); Actor_SetFocus(&this->actor, 30.0f); this->actor.scale.y = 0.013f; this->actor.scale.x = this->actor.scale.z = 0.014f; @@ -195,15 +195,15 @@ void EnRr_Init(Actor* thisx, GlobalContext* globalCtx2) { this->bodySegs[i].height = this->bodySegs[i].heightTarget = this->bodySegs[i].scaleMod.x = this->bodySegs[i].scaleMod.y = this->bodySegs[i].scaleMod.z = 0.0f; } - EnRr_InitBodySegments(this, globalCtx); + EnRr_InitBodySegments(this, play); } -void EnRr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnRr* this = (EnRr*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } void EnRr_SetSpeed(EnRr* this, f32 speed) { @@ -283,8 +283,8 @@ u8 EnRr_GetMessage(u8 shield, u8 tunic) { return messageIndex; } -void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRr_SetupReleasePlayer(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); u8 shield; u8 tunic; @@ -297,14 +297,14 @@ void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { tunic = 0; shield = 0; if (CUR_EQUIP_VALUE(EQUIP_SHIELD) != 3 /* Mirror shield */) { - shield = Inventory_DeleteEquipment(globalCtx, EQUIP_SHIELD); + shield = Inventory_DeleteEquipment(play, EQUIP_SHIELD); if (shield != 0) { this->eatenShield = shield; this->retreat = true; } } if (CUR_EQUIP_VALUE(EQUIP_TUNIC) != 1 /* Kokiri tunic */) { - tunic = Inventory_DeleteEquipment(globalCtx, EQUIP_TUNIC); + tunic = Inventory_DeleteEquipment(play, EQUIP_TUNIC); if (tunic != 0) { this->eatenTunic = tunic; this->retreat = true; @@ -313,17 +313,17 @@ void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { player->actor.parent = NULL; switch (EnRr_GetMessage(shield, tunic)) { case RR_MESSAGE_SHIELD: - Message_StartTextbox(globalCtx, 0x305F, NULL); + Message_StartTextbox(play, 0x305F, NULL); break; case RR_MESSAGE_TUNIC: - Message_StartTextbox(globalCtx, 0x3060, NULL); + Message_StartTextbox(play, 0x3060, NULL); break; case RR_MESSAGE_TUNIC | RR_MESSAGE_SHIELD: - Message_StartTextbox(globalCtx, 0x3061, NULL); + Message_StartTextbox(play, 0x3061, NULL); break; } osSyncPrintf(VT_FGCOL(YELLOW) "%s[%d] : Rr_Catch_Cancel" VT_RST "\n", __FILE__, __LINE__); - func_8002F6D4(globalCtx, &this->actor, 4.0f, this->actor.shape.rot.y, 12.0f, 8); + func_8002F6D4(play, &this->actor, 4.0f, this->actor.shape.rot.y, 12.0f, 8); if (this->actor.colorFilterTimer == 0) { this->actionFunc = EnRr_Approach; Audio_PlayActorSound2(&this->actor, NA_SE_EN_LIKE_THROW); @@ -410,9 +410,9 @@ void EnRr_SetupStunned(EnRr* this) { this->actionFunc = EnRr_Stunned; } -void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { +void EnRr_CollisionCheck(EnRr* this, PlayState* play) { Vec3f hitPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->collider2.base.acFlags & AC_HIT) { this->collider2.base.acFlags &= ~AC_HIT; @@ -421,7 +421,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { hitPos.x = this->collider2.info.bumper.hitPos.x; hitPos.y = this->collider2.info.bumper.hitPos.y; hitPos.z = this->collider2.info.bumper.hitPos.z; - CollisionCheck_SpawnShieldParticlesMetal2(globalCtx, &hitPos); + CollisionCheck_SpawnShieldParticlesMetal2(play, &hitPos); } else { if (this->collider1.base.acFlags & AC_HIT) { u8 dropType = RR_DROP_RANDOM_RUPEE; @@ -431,7 +431,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { hitPos.x = this->collider1.info.bumper.hitPos.x; hitPos.y = this->collider1.info.bumper.hitPos.y; hitPos.z = this->collider1.info.bumper.hitPos.z; - CollisionCheck_BlueBlood(globalCtx, NULL, &hitPos); + CollisionCheck_BlueBlood(play, NULL, &hitPos); } switch (this->actor.colChkInfo.damageEffect) { case RR_DMG_LIGHT_ARROW: @@ -452,7 +452,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { this->invincibilityTimer = 40; Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, this->invincibilityTimer); if (this->hasPlayer) { - EnRr_SetupReleasePlayer(this, globalCtx); + EnRr_SetupReleasePlayer(this, play); } else if (this->actor.colChkInfo.health != 0) { EnRr_SetupDamage(this); } else { @@ -502,7 +502,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { this->collider2.base.ocFlags1 &= ~OC1_HIT; // "catch" osSyncPrintf(VT_FGCOL(GREEN) "キャッチ(%d)!!" VT_RST "\n", this->frameCount); - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; this->stopScroll = false; EnRr_SetupGrabPlayer(this, player); @@ -511,7 +511,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_InitBodySegments(EnRr* this, GlobalContext* globalCtx) { +void EnRr_InitBodySegments(EnRr* this, PlayState* play) { s32 i; this->segMovePhase = 0; @@ -544,7 +544,7 @@ void EnRr_InitBodySegments(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_UpdateBodySegments(EnRr* this, GlobalContext* globalCtx) { +void EnRr_UpdateBodySegments(EnRr* this, PlayState* play) { s32 i; s16 phase = this->segMovePhase; @@ -568,7 +568,7 @@ void EnRr_UpdateBodySegments(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Approach(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Approach(EnRr* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1F4, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actionTimer == 0) && (this->actor.xzDistToPlayer < 160.0f)) { @@ -578,7 +578,7 @@ void EnRr_Approach(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Reach(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Reach(EnRr* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1F4, 0); this->actor.world.rot.y = this->actor.shape.rot.y; switch (this->reachState) { @@ -616,8 +616,8 @@ void EnRr_Reach(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRr_GrabPlayer(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_800AA000(this->actor.xyzDistToPlayerSq, 120, 2, 120); if ((this->frameCount % 8) == 0) { @@ -625,7 +625,7 @@ void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) { } this->ocTimer = 8; if ((this->grabTimer == 0) || !(player->stateFlags2 & 0x80)) { - EnRr_SetupReleasePlayer(this, globalCtx); + EnRr_SetupReleasePlayer(this, play); } else { Math_ApproachF(&player->actor.world.pos.x, this->mouthPos.x, 1.0f, 30.0f); Math_ApproachF(&player->actor.world.pos.y, this->mouthPos.y + this->swallowOffset, 1.0f, 30.0f); @@ -634,7 +634,7 @@ void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Damage(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Damage(EnRr* this, PlayState* play) { s32 i; if (this->actor.colorFilterTimer == 0) { @@ -650,7 +650,7 @@ void EnRr_Damage(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Death(EnRr* this, PlayState* play) { s32 pad; s32 i; @@ -668,41 +668,41 @@ void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { dropPos.z = this->actor.world.pos.z; switch (this->eatenShield) { case 1: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_SHIELD_DEKU); + Item_DropCollectible(play, &dropPos, ITEM00_SHIELD_DEKU); break; case 2: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_SHIELD_HYLIAN); + Item_DropCollectible(play, &dropPos, ITEM00_SHIELD_HYLIAN); break; } switch (this->eatenTunic) { case 2: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_TUNIC_GORON); + Item_DropCollectible(play, &dropPos, ITEM00_TUNIC_GORON); break; case 3: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_TUNIC_ZORA); + Item_DropCollectible(play, &dropPos, ITEM00_TUNIC_ZORA); break; } // "dropped" osSyncPrintf(VT_FGCOL(GREEN) "「%s」が出た!!" VT_RST "\n", sDropNames[this->dropType]); switch (this->dropType) { case RR_DROP_MAGIC: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_MAGIC_SMALL); + Item_DropCollectible(play, &dropPos, ITEM00_MAGIC_SMALL); break; case RR_DROP_ARROW: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_ARROWS_SINGLE); + Item_DropCollectible(play, &dropPos, ITEM00_ARROWS_SINGLE); break; case RR_DROP_FLEXIBLE: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_FLEXIBLE); + Item_DropCollectible(play, &dropPos, ITEM00_FLEXIBLE); break; case RR_DROP_RUPEE_PURPLE: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_RUPEE_PURPLE); + Item_DropCollectible(play, &dropPos, ITEM00_RUPEE_PURPLE); break; case RR_DROP_RUPEE_RED: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &dropPos, ITEM00_RUPEE_RED); break; case RR_DROP_RANDOM_RUPEE: default: - Item_DropCollectibleRandom(globalCtx, &this->actor, &dropPos, 12 << 4); + Item_DropCollectibleRandom(play, &this->actor, &dropPos, 12 << 4); break; } Actor_Kill(&this->actor); @@ -721,7 +721,7 @@ void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { accel.y = 0.0f; accel.z = 0.0f; - EffectSsDeadDb_Spawn(globalCtx, &pos, &vel, &accel, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &vel, &accel, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); } else { Math_ApproachF(&this->actor.scale.x, 0.0f, 1.0f, this->shrinkRate); Math_ApproachF(&this->shrinkRate, 0.001f, 1.0f, 0.00001f); @@ -729,7 +729,7 @@ void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Retreat(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Retreat(EnRr* this, PlayState* play) { if (this->actionTimer == 0) { this->retreat = false; this->actionFunc = EnRr_Approach; @@ -742,11 +742,11 @@ void EnRr_Retreat(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Stunned(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Stunned(EnRr* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { this->stopScroll = false; if (this->hasPlayer) { - EnRr_SetupReleasePlayer(this, globalCtx); + EnRr_SetupReleasePlayer(this, play); } else if (this->actor.colChkInfo.health != 0) { this->actionFunc = EnRr_Approach; } else { @@ -755,7 +755,7 @@ void EnRr_Stunned(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Update(Actor* thisx, PlayState* play) { s32 pad; EnRr* this = (EnRr*)thisx; s32 i; @@ -781,12 +781,12 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 30.0f); - EnRr_UpdateBodySegments(this, globalCtx); + EnRr_UpdateBodySegments(this, play); if (!this->isDead && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - EnRr_CollisionCheck(this, globalCtx); + EnRr_CollisionCheck(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->hasPlayer == 0x3F80) { // checks if 1.0f has been stored to hasPlayer's address ASSERT(this->hasPlayer == 0x3F80); } @@ -798,19 +798,19 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider2.dim.pos.y = this->mouthPos.y; this->collider2.dim.pos.z = this->mouthPos.z; if (!this->isDead && (this->invincibilityTimer == 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); if (this->ocTimer == 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } else { this->collider2.base.ocFlags1 &= ~OC1_HIT; this->collider2.base.acFlags &= ~AC_HIT; this->collider1.base.ocFlags1 &= ~OC1_HIT; this->collider1.base.acFlags &= ~AC_HIT; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 30.0f, 20.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 30.0f, 20.0f, 7); if (!this->stopScroll) { Math_ApproachF(&this->segPhaseVel, this->segPhaseVelTarget, 1.0f, 50.0f); Math_ApproachF(&this->segPulsePhaseDiff, 4.0f, 1.0f, 5.0f); @@ -838,18 +838,18 @@ static Vec3f sEffectOffsets[] = { { 0.0f, 0.0f, -25.0f }, }; -void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Draw(Actor* thisx, PlayState* play) { s32 pad; Vec3f zeroVec; EnRr* this = (EnRr*)thisx; s32 i; - Mtx* segMtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Mtx)); + Mtx* segMtx = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x0C, segMtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (this->scrollTimer * 0) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (this->scrollTimer * 0) & 0x7F, (this->scrollTimer * 0) & 0x3F, 32, 16, 1, (this->scrollTimer * 0) & 0x3F, (this->scrollTimer * -6) & 0x7F, 32, 16)); Matrix_Push(); @@ -857,7 +857,7 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale((1.0f + this->bodySegs[RR_BASE].scaleMod.x) * this->bodySegs[RR_BASE].scale.x, (1.0f + this->bodySegs[RR_BASE].scaleMod.y) * this->bodySegs[RR_BASE].scale.y, (1.0f + this->bodySegs[RR_BASE].scaleMod.z) * this->bodySegs[RR_BASE].scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_Pop(); zeroVec.x = 0.0f; @@ -880,7 +880,7 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&zeroVec, &this->mouthPos); gSPDisplayList(POLY_XLU_DISP++, gLikeLikeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->effectTimer != 0) { Vec3f effectPos; s16 effectTimer = this->effectTimer - 1; @@ -894,9 +894,9 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { effectPos.y = this->effectPos[segIndex].y + sEffectOffsets[offIndex].y + Rand_CenteredFloat(10.0f); effectPos.z = this->effectPos[segIndex].z + sEffectOffsets[offIndex].z + Rand_CenteredFloat(10.0f); if (this->actor.colorFilterParams & 0x4000) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &effectPos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &effectPos, 100, 0, 0, -1); } else { - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, 3.0f); } } diff --git a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.h b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.h index 2991723a4..aa1f78207 100644 --- a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.h +++ b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.h @@ -6,7 +6,7 @@ struct EnRr; -typedef void (*EnRrActionFunc)(struct EnRr*, GlobalContext*); +typedef void (*EnRrActionFunc)(struct EnRr*, PlayState*); typedef struct { /* 0x00 */ f32 height; diff --git a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 0abbb4cd3..d500345fc 100644 --- a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -10,63 +10,63 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_26) -void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRu1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRu1_Init(Actor* thisx, PlayState* play); +void EnRu1_Destroy(Actor* thisx, PlayState* play); +void EnRu1_Update(Actor* thisx, PlayState* play); +void EnRu1_Draw(Actor* thisx, PlayState* play); -void func_80AEC0B4(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC100(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC130(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC17C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC1D4(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC244(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC2C0(EnRu1* this, GlobalContext* globalCtx); -void func_80AECA94(EnRu1* this, GlobalContext* globalCtx); -void func_80AECAB4(EnRu1* this, GlobalContext* globalCtx); -void func_80AECAD4(EnRu1* this, GlobalContext* globalCtx); -void func_80AECB18(EnRu1* this, GlobalContext* globalCtx); -void func_80AECB60(EnRu1* this, GlobalContext* globalCtx); -void func_80AECBB8(EnRu1* this, GlobalContext* globalCtx); -void func_80AECC1C(EnRu1* this, GlobalContext* globalCtx); -void func_80AECC84(EnRu1* this, GlobalContext* globalCtx); -void func_80AED304(EnRu1* this, GlobalContext* globalCtx); -void func_80AED324(EnRu1* this, GlobalContext* globalCtx); -void func_80AED344(EnRu1* this, GlobalContext* globalCtx); -void func_80AED374(EnRu1* this, GlobalContext* globalCtx); -void func_80AED3A4(EnRu1* this, GlobalContext* globalCtx); -void func_80AED3E0(EnRu1* this, GlobalContext* globalCtx); -void func_80AED414(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF29C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF2AC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF2D0(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF354(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF3A8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEBD4(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEC5C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEECF0(EnRu1* this, GlobalContext* globalCtx); -void func_80AEED58(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEDCC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEE34(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEE9C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEF08(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEF5C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF9D8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFA2C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFAAC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFB04(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFB68(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFBC8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFC24(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFECC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFF40(EnRu1* this, GlobalContext* globalCtx); +void func_80AEC0B4(EnRu1* this, PlayState* play); +void func_80AEC100(EnRu1* this, PlayState* play); +void func_80AEC130(EnRu1* this, PlayState* play); +void func_80AEC17C(EnRu1* this, PlayState* play); +void func_80AEC1D4(EnRu1* this, PlayState* play); +void func_80AEC244(EnRu1* this, PlayState* play); +void func_80AEC2C0(EnRu1* this, PlayState* play); +void func_80AECA94(EnRu1* this, PlayState* play); +void func_80AECAB4(EnRu1* this, PlayState* play); +void func_80AECAD4(EnRu1* this, PlayState* play); +void func_80AECB18(EnRu1* this, PlayState* play); +void func_80AECB60(EnRu1* this, PlayState* play); +void func_80AECBB8(EnRu1* this, PlayState* play); +void func_80AECC1C(EnRu1* this, PlayState* play); +void func_80AECC84(EnRu1* this, PlayState* play); +void func_80AED304(EnRu1* this, PlayState* play); +void func_80AED324(EnRu1* this, PlayState* play); +void func_80AED344(EnRu1* this, PlayState* play); +void func_80AED374(EnRu1* this, PlayState* play); +void func_80AED3A4(EnRu1* this, PlayState* play); +void func_80AED3E0(EnRu1* this, PlayState* play); +void func_80AED414(EnRu1* this, PlayState* play); +void func_80AEF29C(EnRu1* this, PlayState* play); +void func_80AEF2AC(EnRu1* this, PlayState* play); +void func_80AEF2D0(EnRu1* this, PlayState* play); +void func_80AEF354(EnRu1* this, PlayState* play); +void func_80AEF3A8(EnRu1* this, PlayState* play); +void func_80AEEBD4(EnRu1* this, PlayState* play); +void func_80AEEC5C(EnRu1* this, PlayState* play); +void func_80AEECF0(EnRu1* this, PlayState* play); +void func_80AEED58(EnRu1* this, PlayState* play); +void func_80AEEDCC(EnRu1* this, PlayState* play); +void func_80AEEE34(EnRu1* this, PlayState* play); +void func_80AEEE9C(EnRu1* this, PlayState* play); +void func_80AEEF08(EnRu1* this, PlayState* play); +void func_80AEEF5C(EnRu1* this, PlayState* play); +void func_80AEF9D8(EnRu1* this, PlayState* play); +void func_80AEFA2C(EnRu1* this, PlayState* play); +void func_80AEFAAC(EnRu1* this, PlayState* play); +void func_80AEFB04(EnRu1* this, PlayState* play); +void func_80AEFB68(EnRu1* this, PlayState* play); +void func_80AEFCE8(EnRu1* this, PlayState* play); +void func_80AEFBC8(EnRu1* this, PlayState* play); +void func_80AEFC24(EnRu1* this, PlayState* play); +void func_80AEFECC(EnRu1* this, PlayState* play); +void func_80AEFF40(EnRu1* this, PlayState* play); -void func_80AF0278(EnRu1* this, GlobalContext* globalCtx, s32 limbIndex, Vec3s* rot); +void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot); -void EnRu1_DrawNothing(EnRu1* this, GlobalContext* globalCtx); -void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx); -void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx); +void EnRu1_DrawNothing(EnRu1* this, PlayState* play); +void EnRu1_DrawOpa(EnRu1* this, PlayState* play); +void EnRu1_DrawXlu(EnRu1* this, PlayState* play); static ColliderCylinderInitType1 sCylinderInit1 = { { @@ -144,44 +144,44 @@ const ActorInit En_Ru1_InitVars = { NULL, }; -void func_80AEAC10(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEAC10(EnRu1* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80AEAC54(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEAC54(EnRu1* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider2); if (this->unk_34C != 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } else if (this->actor.xzDistToPlayer > 32.0f) { this->unk_34C = 1; } } -void func_80AEACDC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEACDC(EnRu1* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider2); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } -void func_80AEAD20(Actor* thisx, GlobalContext* globalCtx) { +void func_80AEAD20(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinderType1(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinderType1(play, &this->collider2, &this->actor, &sCylinderInit2); } -void EnRu1_DestroyColliders(EnRu1* this, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &this->collider); - Collider_DestroyCylinder(globalCtx, &this->collider2); +void EnRu1_DestroyColliders(EnRu1* this, PlayState* play) { + Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->collider2); } void func_80AEADD8(EnRu1* this) { @@ -200,11 +200,11 @@ u8 func_80AEADF0(EnRu1* this) { return params; } -void EnRu1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Destroy(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; D_80AF1938 = 0; - EnRu1_DestroyColliders(this, globalCtx); + EnRu1_DestroyColliders(this, play); } void EnRu1_UpdateEyes(EnRu1* this) { @@ -230,34 +230,34 @@ void EnRu1_SetMouthIndex(EnRu1* this, s16 mouthIndex) { this->mouthIndex = mouthIndex; } -void func_80AEAECC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEAECC(EnRu1* this, PlayState* play) { f32* velocityY = &this->actor.velocity.y; f32 velocityYHeld = *velocityY; *velocityY = -4.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 25.0f, 30.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 25.0f, 30.0f, 7); *velocityY = velocityYHeld; } -s32 EnRu1_IsCsStateIdle(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +s32 EnRu1_IsCsStateIdle(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } return false; } -CsCmdActorAction* func_80AEAF58(GlobalContext* globalCtx, s32 npcActionIdx) { +CsCmdActorAction* func_80AEAF58(PlayState* play, s32 npcActionIdx) { s32 pad[2]; CsCmdActorAction* ret = NULL; - if (!EnRu1_IsCsStateIdle(globalCtx)) { - ret = globalCtx->csCtx.npcActions[npcActionIdx]; + if (!EnRu1_IsCsStateIdle(play)) { + ret = play->csCtx.npcActions[npcActionIdx]; } return ret; } -s32 func_80AEAFA0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AEAF58(globalCtx, npcActionIdx); +s32 func_80AEAFA0(PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == action)) { return true; @@ -265,8 +265,8 @@ s32 func_80AEAFA0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { return false; } -s32 func_80AEAFE0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AEAF58(globalCtx, npcActionIdx); +s32 func_80AEAFE0(PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action != action)) { return true; @@ -274,8 +274,8 @@ s32 func_80AEAFE0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { return false; } -s32 func_80AEB020(EnRu1* this, GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; +s32 func_80AEB020(EnRu1* this, PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_NPC].head; EnRu1* someEnRu1; while (actorIt != NULL) { @@ -292,8 +292,8 @@ s32 func_80AEB020(EnRu1* this, GlobalContext* globalCtx) { return false; } -BgBdanObjects* EnRu1_FindSwitch(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_BG].head; +BgBdanObjects* EnRu1_FindSwitch(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_BG].head; while (actorIt != NULL) { if (actorIt->id == ACTOR_BG_BDAN_OBJECTS && actorIt->params == 0) { @@ -320,8 +320,8 @@ s32 func_80AEB104(EnRu1* this) { } } -Actor* func_80AEB124(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; +Actor* func_80AEB124(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actorIt != NULL) { if ((actorIt->id == ACTOR_DEMO_EFFECT) && ((actorIt->params & 0xFF) == 0x15)) { @@ -332,12 +332,12 @@ Actor* func_80AEB124(GlobalContext* globalCtx) { return NULL; } -s32 func_80AEB174(GlobalContext* globalCtx) { - return (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx); +s32 func_80AEB174(PlayState* play) { + return (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play); } -s32 func_80AEB1B4(GlobalContext* globalCtx) { - return Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING; +s32 func_80AEB1B4(PlayState* play) { + return Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING; } void func_80AEB1D8(EnRu1* this) { @@ -352,8 +352,8 @@ void func_80AEB1D8(EnRu1* this) { func_80AEB0EC(this, 0); } -void func_80AEB220(EnRu1* this, GlobalContext* globalCtx) { - if ((EnRu1_IsCsStateIdle(globalCtx)) && (this->actor.params == 0xA)) { +void func_80AEB220(EnRu1* this, PlayState* play) { + if ((EnRu1_IsCsStateIdle(play)) && (this->actor.params == 0xA)) { func_80AEB1D8(this); } } @@ -388,21 +388,21 @@ s32 EnRu1_UpdateSkelAnime(EnRu1* this) { } } -void func_80AEB364(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB364(EnRu1* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80AEB3A4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB3A4(EnRu1* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - func_80AEB364(this, globalCtx); + func_80AEB364(this, play); } void func_80AEB3CC(EnRu1* this) { this->skelAnime.moveFlags &= ~0x1; } -void func_80AEB3DC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB3DC(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWaitHandsBehindBackAnim, 0, 0, 0); this->action = 0; this->drawConfig = 1; @@ -410,69 +410,69 @@ void func_80AEB3DC(EnRu1* this, GlobalContext* globalCtx) { EnRu1_SetMouthIndex(this, 0); } -CsCmdActorAction* func_80AEB438(GlobalContext* globalCtx) { - return func_80AEAF58(globalCtx, 3); +CsCmdActorAction* func_80AEB438(PlayState* play) { + return func_80AEAF58(play, 3); } -s32 func_80AEB458(GlobalContext* globalCtx, u16 action) { - return func_80AEAFA0(globalCtx, action, 3); +s32 func_80AEB458(PlayState* play, u16 action) { + return func_80AEAFA0(play, action, 3); } -s32 func_80AEB480(GlobalContext* globalCtx, u16 action) { - return func_80AEAFE0(globalCtx, action, 3); +s32 func_80AEB480(PlayState* play, u16 action) { + return func_80AEAFE0(play, action, 3); } -void EnRu1_SpawnRipple(EnRu1* this, GlobalContext* globalCtx, s16 radiusMax, s16 life) { +void EnRu1_SpawnRipple(EnRu1* this, PlayState* play, s16 radiusMax, s16 life) { Vec3f pos; Actor* thisx = &this->actor; pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + this->actor.yDistToWater; pos.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &pos, 100, radiusMax, life); + EffectSsGRipple_Spawn(play, &pos, 100, radiusMax, life); } -void func_80AEB50C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB50C(EnRu1* this, PlayState* play) { this->unk_270 += 1.0f; if (this->unk_270 >= kREG(3) + 10.0f) { - EnRu1_SpawnRipple(this, globalCtx, kREG(1) + 500, 0); + EnRu1_SpawnRipple(this, play, kREG(1) + 500, 0); this->unk_270 = 0.0f; } } -void func_80AEB59C(EnRu1* this, GlobalContext* globalCtx) { - EnRu1_SpawnRipple(this, globalCtx, kREG(2) + 500, 0); - EnRu1_SpawnRipple(this, globalCtx, kREG(2) + 500, kREG(3) + 10.0f); - EnRu1_SpawnRipple(this, globalCtx, kREG(2) + 500, (kREG(3) + 10.0f) * 2.0f); +void func_80AEB59C(EnRu1* this, PlayState* play) { + EnRu1_SpawnRipple(this, play, kREG(2) + 500, 0); + EnRu1_SpawnRipple(this, play, kREG(2) + 500, kREG(3) + 10.0f); + EnRu1_SpawnRipple(this, play, kREG(2) + 500, (kREG(3) + 10.0f) * 2.0f); } -void EnRu1_SpawnSplash(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_SpawnSplash(EnRu1* this, PlayState* play) { Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + this->actor.yDistToWater; pos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 1, 0); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 1, 0); } -void func_80AEB6E0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB6E0(EnRu1* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } -void func_80AEB738(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB738(EnRu1* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; skelAnime->baseTransl = skelAnime->jointTable[0]; skelAnime->prevTransl = skelAnime->jointTable[0]; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } @@ -480,8 +480,8 @@ void func_80AEB7D0(EnRu1* this) { this->skelAnime.moveFlags &= ~0x3; } -f32 func_80AEB7E0(CsCmdActorAction* csCmdNPCAction, GlobalContext* globalCtx) { - s32 csCtxFrames = globalCtx->csCtx.frames; +f32 func_80AEB7E0(CsCmdActorAction* csCmdNPCAction, PlayState* play) { + s32 csCtxFrames = play->csCtx.frames; if ((csCtxFrames < csCmdNPCAction->endFrame) && (csCmdNPCAction->endFrame - csCmdNPCAction->startFrame > 0)) { return (Math_CosS(((csCtxFrames - csCmdNPCAction->startFrame) / @@ -497,8 +497,8 @@ f32 func_80AEB87C(f32 arg0, s32 arg1, s32 arg2) { return (((f32)arg2 - arg1) * arg0) + arg1; } -void func_80AEB89C(EnRu1* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = func_80AEB438(globalCtx); +void func_80AEB89C(EnRu1* this, PlayState* play) { + CsCmdActorAction* npcAction = func_80AEB438(play); s16 npcActionRotY; if (npcAction != NULL) { @@ -511,26 +511,26 @@ void func_80AEB89C(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEB914(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB89C(this, globalCtx); +void func_80AEB914(EnRu1* this, PlayState* play) { + func_80AEB89C(this, play); } -void func_80AEB934(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB89C(this, globalCtx); +void func_80AEB934(EnRu1* this, PlayState* play) { + func_80AEB89C(this, play); } -void func_80AEB954(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB6E0(this, globalCtx); +void func_80AEB954(EnRu1* this, PlayState* play) { + func_80AEB6E0(this, play); } -void func_80AEB974(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB974(EnRu1* this, PlayState* play) { Vec3f* thisPos; f32 sp30; - CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); + CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); s32 pad; if (csCmdNPCAction != NULL) { - sp30 = func_80AEB7E0(csCmdNPCAction, globalCtx); + sp30 = func_80AEB7E0(csCmdNPCAction, play); thisPos = &this->actor.world.pos; thisPos->x = func_80AEB87C(sp30, csCmdNPCAction->startPos.x, csCmdNPCAction->endPos.x); thisPos->y = func_80AEB87C(sp30, csCmdNPCAction->startPos.y, csCmdNPCAction->endPos.y); @@ -538,20 +538,20 @@ void func_80AEB974(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEBA0C(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB6E0(this, globalCtx); +void func_80AEBA0C(EnRu1* this, PlayState* play) { + func_80AEB6E0(this, play); } -void func_80AEBA2C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEBA2C(EnRu1* this, PlayState* play) { s32 pad; Vec3f* unk_364 = &this->unk_364; Vec3f* thisPos; f32 temp_ret_2; - CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); + CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); s32 pad2; if (csCmdNPCAction != NULL) { - temp_ret_2 = func_80AEB7E0(csCmdNPCAction, globalCtx); + temp_ret_2 = func_80AEB7E0(csCmdNPCAction, play); thisPos = &this->actor.world.pos; thisPos->x = func_80AEB87C(temp_ret_2, unk_364->x, csCmdNPCAction->endPos.x); thisPos->y = func_80AEB87C(temp_ret_2, unk_364->y, csCmdNPCAction->endPos.y); @@ -587,18 +587,18 @@ void func_80AEBBF4(EnRu1* this) { } } -void func_80AEBC30(GlobalContext* globalCtx) { +void func_80AEBC30(PlayState* play) { Player* player; - if (globalCtx->csCtx.frames == 0xCD) { - player = GET_PLAYER(globalCtx); + if (play->csCtx.frames == 0xCD) { + player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_EV_DIVE_INTO_WATER, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } -void func_80AEBC84(EnRu1* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 0x82) { +void func_80AEBC84(EnRu1* this, PlayState* play) { + if (play->csCtx.frames == 0x82) { func_80078914(&this->actor.projectedPos, NA_SE_VO_RT_LAUGH_0); } } @@ -610,32 +610,32 @@ void func_80AEBCB8(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AEBD1C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB480(globalCtx, 2)) { +void func_80AEBD1C(EnRu1* this, PlayState* play) { + if (func_80AEB480(play, 2)) { this->action = 1; this->drawConfig = 0; - func_80AEB914(this, globalCtx); - func_80AEAECC(this, globalCtx); - EnRu1_SpawnSplash(this, globalCtx); - func_80AEB59C(this, globalCtx); + func_80AEB914(this, play); + func_80AEAECC(this, play); + EnRu1_SpawnSplash(this, play); + func_80AEB59C(this, play); } } -void func_80AEBD94(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEBD94(EnRu1* this, PlayState* play) { s32 pad[2]; f32 frameCount; - if (func_80AEB480(globalCtx, 3)) { + if (func_80AEB480(play, 3)) { frameCount = Animation_GetLastFrame(&gRutoChildAnim_009060); - func_80AEB934(this, globalCtx); - func_80AEB738(this, globalCtx); + func_80AEB934(this, play); + func_80AEB738(this, play); Animation_Change(&this->skelAnime, &gRutoChildAnim_009060, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = 2; this->drawConfig = 1; } } -void func_80AEBE3C(EnRu1* this, GlobalContext* globalCtx, s32 arg2) { +void func_80AEBE3C(EnRu1* this, PlayState* play, s32 arg2) { s32 pad[2]; f32 frameCount; @@ -645,41 +645,41 @@ void func_80AEBE3C(EnRu1* this, GlobalContext* globalCtx, s32 arg2) { Animation_Change(&this->skelAnime, &gRutoChildTreadWaterAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); this->action = 3; } else { - func_80AEB954(this, globalCtx); + func_80AEB954(this, play); } } -void func_80AEBEC8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEBEC8(EnRu1* this, PlayState* play) { s32 pad[2]; f32 frameCount; - if (func_80AEB458(globalCtx, 6)) { + if (func_80AEB458(play, 6)) { frameCount = Animation_GetLastFrame(&gRutoChildTransitionToSwimOnBackAnim); - func_80AEB738(this, globalCtx); + func_80AEB738(this, play); Animation_Change(&this->skelAnime, &gRutoChildTransitionToSwimOnBackAnim, 1.0f, 0, frameCount, ANIMMODE_ONCE, -8.0f); this->action = 4; } } -void func_80AEBF60(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB480(globalCtx, 6)) { +void func_80AEBF60(EnRu1* this, PlayState* play) { + if (func_80AEB480(play, 6)) { func_80AEB7D0(this); this->action = 5; this->unk_364 = this->actor.world.pos; } else { - func_80AEBA0C(this, globalCtx); + func_80AEBA0C(this, play); } } -void func_80AEBFD8(EnRu1* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); +void func_80AEBFD8(EnRu1* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); f32 frameCount; u16 csCtxFrames; u16 endFrame; if (csCmdNPCAction != NULL) { - csCtxFrames = globalCtx->csCtx.frames; + csCtxFrames = play->csCtx.frames; endFrame = csCmdNPCAction->endFrame; if (csCtxFrames >= endFrame - 2) { frameCount = Animation_GetLastFrame(&gRutoChildTransitionFromSwimOnBackAnim); @@ -690,74 +690,74 @@ void func_80AEBFD8(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEC070(EnRu1* this, GlobalContext* globalCtx, UNK_TYPE arg2) { - if ((func_80AEB458(globalCtx, 8)) && (arg2 != 0)) { +void func_80AEC070(EnRu1* this, PlayState* play, UNK_TYPE arg2) { + if ((func_80AEB458(play, 8)) && (arg2 != 0)) { Actor_Kill(&this->actor); } } -void func_80AEC0B4(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB89C(this, globalCtx); +void func_80AEC0B4(EnRu1* this, PlayState* play) { + func_80AEB89C(this, play); EnRu1_UpdateSkelAnime(this); - func_80AEBC84(this, globalCtx); - func_80AEBC30(globalCtx); - func_80AEBD1C(this, globalCtx); + func_80AEBC84(this, play); + func_80AEBC30(play); + func_80AEBD1C(this, play); } -void func_80AEC100(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC100(EnRu1* this, PlayState* play) { func_80AEBAFC(this); - func_80AEBD94(this, globalCtx); + func_80AEBD94(this, play); } -void func_80AEC130(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC130(EnRu1* this, PlayState* play) { s32 something = EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEBB3C(this); - func_80AEBE3C(this, globalCtx, something); + func_80AEBE3C(this, play, something); } -void func_80AEC17C(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB974(this, globalCtx); - func_80AEAECC(this, globalCtx); +void func_80AEC17C(EnRu1* this, PlayState* play) { + func_80AEB974(this, play); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); - func_80AEB50C(this, globalCtx); - func_80AEBEC8(this, globalCtx); + func_80AEB50C(this, play); + func_80AEBEC8(this, play); } -void func_80AEC1D4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC1D4(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEB50C(this, globalCtx); + func_80AEB50C(this, play); func_80AEBCB8(this, something); func_80AEBBF4(this); - func_80AEBF60(this, globalCtx); + func_80AEBF60(this, play); } -void func_80AEC244(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC244(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); - func_80AEBA2C(this, globalCtx); - func_80AEAECC(this, globalCtx); + func_80AEBA2C(this, play); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEB50C(this, globalCtx); + func_80AEB50C(this, play); func_80AEBCB8(this, something); func_80AEBB78(this); - func_80AEBFD8(this, globalCtx); + func_80AEBFD8(this, play); } -void func_80AEC2C0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC2C0(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEB50C(this, globalCtx); - func_80AEC070(this, globalCtx, something); + func_80AEB50C(this, play); + func_80AEC070(this, play, something); } // Convenience function used so that Ruto always spawns in Jabu in rando, even after she's been kidnapped @@ -768,7 +768,7 @@ bool shouldSpawnRuto() { return !(gSaveContext.infTable[20] & 0x20) || (gSaveContext.n64ddFlag && (gSaveContext.infTable[20] & 0x40)); } -void func_80AEC320(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC320(EnRu1* this, PlayState* play) { s8 actorRoom; if (!(gSaveContext.infTable[20] & 2)) { @@ -776,7 +776,7 @@ void func_80AEC320(EnRu1* this, GlobalContext* globalCtx) { this->action = 7; EnRu1_SetMouthIndex(this, 1); } else if ((gSaveContext.infTable[20] & 0x80) && !(gSaveContext.infTable[20] & 1) && shouldSpawnRuto()) { - if (!func_80AEB020(this, globalCtx)) { + if (!func_80AEB020(this, play)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -825,8 +825,8 @@ void func_80AEC4F4(EnRu1* this) { Actor_MoveForward(&this->actor); } -s32 func_80AEC5FC(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80AEC5FC(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 thisPosZ = this->actor.world.pos.z; f32 playerPosZ = player->actor.world.pos.z; @@ -851,8 +851,8 @@ void func_80AEC6B0(EnRu1* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_RT_FALL); } -void func_80AEC6E4(EnRu1* this, GlobalContext* globalCtx) { - if ((func_80AEAFA0(globalCtx, 4, 3)) && (this->unk_280 == 0)) { +void func_80AEC6E4(EnRu1* this, PlayState* play) { + if ((func_80AEAFA0(play, 4, 3)) && (this->unk_280 == 0)) { Animation_Change(&this->skelAnime, &gRutoChildBringArmsUpAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildBringArmsUpAnim), ANIMMODE_ONCE, -8.0f); this->unk_280 = 1; @@ -860,26 +860,26 @@ void func_80AEC6E4(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEC780(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC780(EnRu1* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((func_80AEC5FC(this, globalCtx)) && (!Gameplay_InCsMode(globalCtx)) && (!(player->stateFlags1 & 0x206000)) && + if ((func_80AEC5FC(this, play)) && (!Play_InCsMode(play)) && (!(player->stateFlags1 & 0x206000)) && (player->actor.bgCheckFlags & 1)) { - globalCtx->csCtx.segment = &D_80AF0880; + play->csCtx.segment = &D_80AF0880; gSaveContext.cutsceneTrigger = 1; player->linearVelocity = 0.0f; this->action = 8; } } -void func_80AEC81C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC81C(EnRu1* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; s16 newRotY; - if (func_80AEAFE0(globalCtx, 1, 3)) { - csCmdNPCAction = globalCtx->csCtx.npcActions[3]; + if (func_80AEAFE0(play, 1, 3)) { + csCmdNPCAction = play->csCtx.npcActions[3]; this->actor.world.pos.x = csCmdNPCAction->startPos.x; this->actor.world.pos.y = csCmdNPCAction->startPos.y; this->actor.world.pos.z = csCmdNPCAction->startPos.z; @@ -891,8 +891,8 @@ void func_80AEC81C(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEC8B8(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEAFA0(globalCtx, 3, 3)) { +void func_80AEC8B8(EnRu1* this, PlayState* play) { + if (func_80AEAFA0(play, 3, 3)) { Animation_Change(&this->skelAnime, &gRutoChildTurnAroundAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildTurnAroundAnim), ANIMMODE_ONCE, -8.0f); this->action = 10; @@ -926,73 +926,73 @@ void func_80AECA18(EnRu1* this) { } } -void func_80AECA44(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEAFA0(globalCtx, 5, 3)) { +void func_80AECA44(EnRu1* this, PlayState* play) { + if (func_80AEAFA0(play, 5, 3)) { gSaveContext.infTable[20] |= 2; this->action = 14; } } -void func_80AECA94(EnRu1* this, GlobalContext* globalCtx) { - func_80AEC780(this, globalCtx); +void func_80AECA94(EnRu1* this, PlayState* play) { + func_80AEC780(this, play); } -void func_80AECAB4(EnRu1* this, GlobalContext* globalCtx) { - func_80AEC81C(this, globalCtx); +void func_80AECAB4(EnRu1* this, PlayState* play) { + func_80AEC81C(this, play); } -void func_80AECAD4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECAD4(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEC8B8(this, globalCtx); + func_80AEAECC(this, play); + func_80AEC8B8(this, play); } -void func_80AECB18(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECB18(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC93C(this, something); } -void func_80AECB60(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECB60(EnRu1* this, PlayState* play) { func_80AEC40C(this); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC650(this); func_80AEC9C4(this); } -void func_80AECBB8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECBB8(EnRu1* this, PlayState* play) { func_80AEC4CC(this); - func_80AEC6E4(this, globalCtx); + func_80AEC6E4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC650(this); func_80AECA18(this); } -void func_80AECC1C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECC1C(EnRu1* this, PlayState* play) { func_80AEC4F4(this); - func_80AEC6E4(this, globalCtx); + func_80AEC6E4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC650(this); - func_80AECA44(this, globalCtx); + func_80AECA44(this, play); } -void func_80AECC84(EnRu1* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +void func_80AECC84(EnRu1* this, PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { Actor_Kill(&this->actor); } } -void func_80AECCB0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECCB0(EnRu1* this, PlayState* play) { s32 pad; Vec3f* pos; s16 yawTowardsPlayer; @@ -1006,11 +1006,11 @@ void func_80AECCB0(EnRu1* this, GlobalContext* globalCtx) { spawnX = ((kREG(1) + 12.0f) * Math_SinS(yawTowardsPlayer)) + pos->x; spawnY = pos->y; spawnZ = ((kREG(1) + 12.0f) * Math_CosS(yawTowardsPlayer)) + pos->z; - this->blueWarp = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, + this->blueWarp = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, spawnX, spawnY, spawnZ, 0, yawTowardsPlayer, 0, WARP_BLUE_RUTO); } -void func_80AECDA0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECDA0(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWaitHandsOnHipsAnim, 0, 0, 0); this->action = 15; this->actor.shape.yOffset = -10000.0f; @@ -1018,13 +1018,13 @@ void func_80AECDA0(EnRu1* this, GlobalContext* globalCtx) { EnRu1_SetMouthIndex(this, 2); } -void func_80AECE04(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECE04(EnRu1* this, PlayState* play) { this->actor.shape.yOffset += (250.0f / 3.0f); } -void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECE20(EnRu1* this, PlayState* play) { s32 pad2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; s16 shapeRotY = player->actor.shape.rot.y; s32 pad; @@ -1036,9 +1036,9 @@ void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { pos->z = (Math_CosS(shapeRotY) * unk_27C) + playerPos->z; } -void func_80AECEB4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECEB4(EnRu1* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* player_unk_450 = &player->unk_450; Vec3f* pos = &this->actor.world.pos; s16 shapeRotY = this->actor.shape.rot.y; @@ -1047,9 +1047,9 @@ void func_80AECEB4(EnRu1* this, GlobalContext* globalCtx) { player_unk_450->z = ((kREG(2) + 30.0f) * Math_CosS(shapeRotY)) + pos->z; } -s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AECF6C(EnRu1* this, PlayState* play) { s16* shapeRotY; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Player* otherPlayer; s16 temp_f16; f32 temp1; @@ -1058,7 +1058,7 @@ s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) { this->unk_26C += 1.0f; if ((player->actor.speedXZ == 0.0f) && (this->unk_26C >= 3.0f)) { - otherPlayer = GET_PLAYER(globalCtx); + otherPlayer = GET_PLAYER(play); player->actor.world.pos.x = otherPlayer->unk_450.x; player->actor.world.pos.y = otherPlayer->unk_450.y; player->actor.world.pos.z = otherPlayer->unk_450.z; @@ -1089,16 +1089,16 @@ void func_80AED0B0(EnRu1* this, s32 state) { } } -void func_80AED0C8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED0C8(EnRu1* this, PlayState* play) { this->action = 16; } -void func_80AED0D8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED0D8(EnRu1* this, PlayState* play) { this->action = 17; this->drawConfig = 1; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - func_80AECCB0(this, globalCtx); + func_80AECCB0(this, play); } void func_80AED110(EnRu1* this) { @@ -1109,11 +1109,11 @@ void func_80AED110(EnRu1* this) { } } -void func_80AED154(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED154(EnRu1* this, PlayState* play) { if (func_80AED084(this, WARP_BLUE_RUTO_STATE_ENTERED)) { this->action = 0x13; this->unk_26C = 0.0f; - func_80AECEB4(this, globalCtx); + func_80AECEB4(this, play); } } @@ -1141,47 +1141,47 @@ void func_80AED218(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AED304(EnRu1* this, GlobalContext* globalCtx) { - func_80AED0C8(this, globalCtx); +void func_80AED304(EnRu1* this, PlayState* play) { + func_80AED0C8(this, play); } -void func_80AED324(EnRu1* this, GlobalContext* globalCtx) { - func_80AED0D8(this, globalCtx); +void func_80AED324(EnRu1* this, PlayState* play) { + func_80AED0D8(this, play); } -void func_80AED344(EnRu1* this, GlobalContext* globalCtx) { - func_80AECE04(this, globalCtx); +void func_80AED344(EnRu1* this, PlayState* play) { + func_80AECE04(this, play); EnRu1_UpdateSkelAnime(this); func_80AED110(this); } -void func_80AED374(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED374(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); - func_80AED154(this, globalCtx); + func_80AED154(this, play); } -void func_80AED3A4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED3A4(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); - func_80AED19C(this, func_80AECF6C(this, globalCtx)); + func_80AED19C(this, func_80AECF6C(this, play)); } -void func_80AED3E0(EnRu1* this, GlobalContext* globalCtx) { - func_80AEAECC(this, globalCtx); +void func_80AED3E0(EnRu1* this, PlayState* play) { + func_80AEAECC(this, play); func_80AED218(this, EnRu1_UpdateSkelAnime(this)); } -void func_80AED414(EnRu1* this, GlobalContext* globalCtx) { - func_80AECE20(this, globalCtx); - func_80AEAECC(this, globalCtx); +void func_80AED414(EnRu1* this, PlayState* play) { + func_80AECE20(this, play); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); } -void func_80AED44C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED44C(EnRu1* this, PlayState* play) { s8 actorRoom; if ((gSaveContext.infTable[20] & 2) && shouldSpawnRuto() && !(gSaveContext.infTable[20] & 1) && !(gSaveContext.infTable[20] & 0x80)) { - if (!func_80AEB020(this, globalCtx)) { + if (!func_80AEB020(this, play)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -1201,8 +1201,8 @@ void func_80AED4FC(EnRu1* this) { func_80078914(&this->actor.projectedPos, NA_SE_EV_LAND_DIRT); } -void func_80AED520(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AED520(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_PL_PULL_UP_RUTO, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -1227,8 +1227,8 @@ void func_80AED600(EnRu1* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_RT_DISCOVER); } -s32 func_80AED624(EnRu1* this, GlobalContext* globalCtx) { - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; +s32 func_80AED624(EnRu1* this, PlayState* play) { + s8 curRoomNum = play->roomCtx.curRoom.num; if (this->roomNum2 != curRoomNum) { Actor_Kill(&this->actor); @@ -1243,28 +1243,28 @@ s32 func_80AED624(EnRu1* this, GlobalContext* globalCtx) { return true; } -void func_80AED6DC(EnRu1* this, GlobalContext* globalCtx) { - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; +void func_80AED6DC(EnRu1* this, PlayState* play) { + s8 curRoomNum = play->roomCtx.curRoom.num; this->roomNum2 = curRoomNum; this->unk_288 = 0.0f; } -void func_80AED6F8(GlobalContext* globalCtx) { +void func_80AED6F8(PlayState* play) { s8 curRoomNum; if ((!(gSaveContext.infTable[20] & 0x80))) { - curRoomNum = globalCtx->roomCtx.curRoom.num; + curRoomNum = play->roomCtx.curRoom.num; if (curRoomNum == 2) { gSaveContext.infTable[20] |= 0x80; } } } -void func_80AED738(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED738(EnRu1* this, PlayState* play) { u32 temp_v0; - if (func_80AED624(this, globalCtx)) { + if (func_80AED624(this, play)) { this->unk_2A4 += 1.0f; if (this->unk_2A4 < 20.0f) { temp_v0 = ((20.0f - this->unk_2A4) * 255.0f) / 20.0f; @@ -1321,15 +1321,15 @@ void func_80AED8DC(EnRu1* this) { } } -void func_80AEDAE0(EnRu1* this, GlobalContext* globalCtx) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); +void func_80AEDAE0(EnRu1* this, PlayState* play) { + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (dynaPolyActor == NULL || dynaPolyActor->actor.id == ACTOR_EN_BOX) { this->actor.bgCheckFlags &= ~0x19; } } -void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEDB30(EnRu1* this, PlayState* play) { DynaPolyActor* dynaPolyActor; f32* velocityY; f32* speedXZ; @@ -1342,7 +1342,7 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1) { velocityY = &this->actor.velocity.y; - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (*velocityY <= 0.0f) { speedXZ = &this->actor.speedXZ; if (dynaPolyActor != NULL) { @@ -1415,9 +1415,9 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEDEF4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEDEF4(EnRu1* this, PlayState* play) { f32* speedXZ = &this->actor.speedXZ; - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_EN_BOX) { if (*speedXZ != 0.0f) { @@ -1433,9 +1433,9 @@ void func_80AEDEF4(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEDFF4(EnRu1* this, GlobalContext* globalCtx) { - func_80AEDB30(this, globalCtx); - func_80AEDEF4(this, globalCtx); +void func_80AEDFF4(EnRu1* this, PlayState* play) { + func_80AEDB30(this, play); + func_80AEDEF4(this, play); Actor_MoveForward(&this->actor); } @@ -1501,31 +1501,31 @@ void func_80AEE050(EnRu1* this) { } } -s32 func_80AEE264(EnRu1* this, GlobalContext* globalCtx) { - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80AEE264(EnRu1* this, PlayState* play) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; if ((gSaveContext.infTable[20] & 8)) { this->actor.textId = 0x404E; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else if (gSaveContext.infTable[20] & 4) { this->actor.textId = 0x404D; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.textId = 0x404C; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } return false; } return true; } -void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE2F8(EnRu1* this, PlayState* play) { DynaPolyActor* dynaPolyActor; s32 floorBgId; if ((this->actor.bgCheckFlags & 1) && (this->actor.floorBgId != BGCHECK_SCENE)) { floorBgId = this->actor.floorBgId; - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, floorBgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, floorBgId); if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_BG_BDAN_SWITCH)) { if (((dynaPolyActor->actor.params >> 8) & 0x3F) == 0x38) { gSaveContext.infTable[20] |= 1; @@ -1536,20 +1536,20 @@ void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { gSaveContext.infTable[20] &= ~0x1; } -s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEE394(EnRu1* this, PlayState* play) { s32 pad[2]; CollisionContext* colCtx; DynaPolyActor* dynaPolyActor; s32 floorBgId; if ((this->actor.bgCheckFlags & 1) && this->actor.floorBgId != BGCHECK_SCENE) { - colCtx = &globalCtx->colCtx; + colCtx = &play->colCtx; floorBgId = this->actor.floorBgId; // necessary match, can't move this out of this block unfortunately dynaPolyActor = DynaPoly_GetActor(colCtx, floorBgId); if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_BG_BDAN_OBJECTS && - dynaPolyActor->actor.params == 0 && !Player_InCsMode(globalCtx) && globalCtx->msgCtx.msgLength == 0) { + dynaPolyActor->actor.params == 0 && !Player_InCsMode(play) && play->msgCtx.msgLength == 0) { func_80AEE02C(this); - globalCtx->csCtx.segment = &D_80AF10A4; + play->csCtx.segment = &D_80AF10A4; gSaveContext.cutsceneTrigger = 1; this->action = 36; this->drawConfig = 0; @@ -1561,26 +1561,26 @@ s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEE488(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE488(EnRu1* this, PlayState* play) { s8 curRoomNum; - if (Actor_HasParent(&this->actor, globalCtx)) { - curRoomNum = globalCtx->roomCtx.curRoom.num; + if (Actor_HasParent(&this->actor, play)) { + curRoomNum = play->roomCtx.curRoom.num; this->roomNum3 = curRoomNum; this->action = 31; - func_80AED520(this, globalCtx); - } else if ((!func_80AEE394(this, globalCtx)) && (!(this->actor.bgCheckFlags & 1))) { + func_80AED520(this, play); + } else if ((!func_80AEE394(this, play)) && (!(this->actor.bgCheckFlags & 1))) { this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); this->actor.gravity = -((kREG(23) * 0.01f) + 1.3f); this->action = 28; } } -void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) { - if (!func_80AEE394(this, globalCtx)) { +void func_80AEE568(EnRu1* this, PlayState* play) { + if (!func_80AEE394(this, play)) { if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ == 0.0f) && (this->actor.minVelocityY == 0.0f)) { func_80AEE02C(this); - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); this->action = 27; func_80AEADD8(this); } else if (this->actor.yDistToWater > 0.0f) { @@ -1590,11 +1590,11 @@ void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEE628(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE628(EnRu1* this, PlayState* play) { s32 pad[2]; - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; + s8 curRoomNum = play->roomCtx.curRoom.num; - if (EnRu1_IsCsStateIdle(globalCtx)) { + if (EnRu1_IsCsStateIdle(play)) { Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildSittingAnim), ANIMMODE_LOOP, -8.0f); gSaveContext.infTable[20] |= 0x10; @@ -1603,18 +1603,18 @@ void func_80AEE628(EnRu1* this, GlobalContext* globalCtx) { this->roomNum3 = curRoomNum; } -s32 func_80AEE6D0(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEE6D0(EnRu1* this, PlayState* play) { s32 pad; - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; + s8 curRoomNum = play->roomCtx.curRoom.num; - if (!(gSaveContext.infTable[20] & 0x10) && (func_80AEB124(globalCtx) != 0)) { - if (!Player_InCsMode(globalCtx)) { + if (!(gSaveContext.infTable[20] & 0x10) && (func_80AEB124(play) != 0)) { + if (!Player_InCsMode(play)) { Animation_Change(&this->skelAnime, &gRutoChildSeesSapphireAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildSquirmAnim), ANIMMODE_LOOP, -8.0f); func_80AED600(this); this->action = 34; this->unk_26C = 0.0f; - globalCtx->csCtx.segment = &D_80AF1728; + play->csCtx.segment = &D_80AF1728; gSaveContext.cutsceneTrigger = 1; } this->roomNum3 = curRoomNum; @@ -1624,16 +1624,16 @@ s32 func_80AEE6D0(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE7C4(EnRu1* this, PlayState* play) { f32 frameCount; s32 pad[13]; Player* player; f32* unk_370 = &this->unk_370; - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); - func_80AED6DC(this, globalCtx); + func_80AED6DC(this, play); this->actor.speedXZ *= (kREG(25) * 0.01f) + 1.0f; this->actor.velocity.y *= (kREG(26) * 0.01f) + 1.0f; this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); @@ -1644,12 +1644,12 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { return; } - if (func_80AEE6D0(this, globalCtx)) { + if (func_80AEE6D0(this, play)) { *unk_370 = 0.0f; return; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (player->stateFlags2 & 0x10000000) { this->unk_370 += 1.0f; if (this->action != 32) { @@ -1678,10 +1678,10 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { } } -s32 func_80AEEAC8(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEEAC8(EnRu1* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { func_80AEE02C(this); - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); this->action = 27; func_80AEADD8(this); return true; @@ -1689,8 +1689,8 @@ s32 func_80AEEAC8(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEEB24(EnRu1* this, GlobalContext* globalCtx) { - if ((func_80AEEAC8(this, globalCtx) == 0) && (this->unk_350 == 3)) { +void func_80AEEB24(EnRu1* this, PlayState* play) { + if ((func_80AEEAC8(this, play) == 0) && (this->unk_350 == 3)) { this->action = 30; func_80AEE02C(this); this->actor.gravity = -0.1f; @@ -1698,99 +1698,99 @@ void func_80AEEB24(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEEBB4(EnRu1* this, GlobalContext* globalCtx) { - func_8002F580(&this->actor, globalCtx); +void func_80AEEBB4(EnRu1* this, PlayState* play) { + func_8002F580(&this->actor, play); } -void func_80AEEBD4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEBD4(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAC54(this, globalCtx); - func_80AEAECC(this, globalCtx); + func_80AEAC54(this, play); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEEBB4(this, globalCtx); - func_80AEE488(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEDAE0(this, globalCtx); + func_80AEEBB4(this, play); + func_80AEE488(this, play); + func_80AED624(this, play); + func_80AEDAE0(this, play); } -void func_80AEEC5C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEC5C(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEACDC(this, globalCtx); - func_80AEAECC(this, globalCtx); - func_80AEE2F8(this, globalCtx); - func_80AEDFF4(this, globalCtx); + func_80AEACDC(this, play); + func_80AEAECC(this, play); + func_80AEE2F8(this, play); + func_80AEDFF4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEE568(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEDAE0(this, globalCtx); + func_80AEE568(this, play); + func_80AED624(this, play); + func_80AEDAE0(this, play); } -void func_80AEECF0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEECF0(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEE050(this); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEEB24(this, globalCtx); - func_80AED624(this, globalCtx); + func_80AEEB24(this, play); + func_80AED624(this, play); } -void func_80AEED58(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEED58(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); Actor_MoveForward(&this->actor); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEEAC8(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEDAE0(this, globalCtx); + func_80AEEAC8(this, play); + func_80AED624(this, play); + func_80AEDAE0(this, play); } -void func_80AEEDCC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEDCC(EnRu1* this, PlayState* play) { func_80AED8DC(this); EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); - func_80AEE2F8(this, globalCtx); + func_80AEAECC(this, play); + func_80AEE2F8(this, play); EnRu1_UpdateEyes(this); - func_80AED6F8(globalCtx); - func_80AEE7C4(this, globalCtx); + func_80AED6F8(play); + func_80AEE7C4(this, play); } -void func_80AEEE34(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEE34(EnRu1* this, PlayState* play) { func_80AED83C(this); EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); - func_80AEE2F8(this, globalCtx); + func_80AEAECC(this, play); + func_80AEE2F8(this, play); EnRu1_UpdateEyes(this); - func_80AED6F8(globalCtx); - func_80AEE7C4(this, globalCtx); + func_80AED6F8(play); + func_80AEE7C4(this, play); } -void func_80AEEE9C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEE9C(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); - func_80AEDFF4(this, globalCtx); + func_80AEAECC(this, play); + func_80AEDFF4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AED738(this, globalCtx); - func_80AED624(this, globalCtx); + func_80AED738(this, play); + func_80AED624(this, play); } -void func_80AEEF08(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEF08(EnRu1* this, PlayState* play) { func_80AED83C(this); EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEE628(this, globalCtx); + func_80AEE628(this, play); } -void func_80AEEF5C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEF5C(EnRu1* this, PlayState* play) { } -void func_80AEEF68(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AEEF68(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 something; this->unk_374.unk_18 = player->actor.world.pos; @@ -1799,8 +1799,8 @@ void func_80AEEF68(EnRu1* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_374, something, 2); } -void func_80AEEFEC(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AEEFEC(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 something; this->unk_374.unk_18 = player->actor.world.pos; @@ -1816,13 +1816,13 @@ void func_80AEF080(EnRu1* this) { } } -s32 func_80AEF0BC(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEF0BC(EnRu1* this, PlayState* play) { s32 frameCount; if (gSaveContext.infTable[20] & 4) { frameCount = Animation_GetLastFrame(&gRutoChildSitAnim); Animation_Change(&this->skelAnime, &gRutoChildSitAnim, 1.0f, 0, frameCount, ANIMMODE_ONCE, -8.0f); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->action = 26; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); return true; @@ -1830,73 +1830,73 @@ s32 func_80AEF0BC(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEF170(EnRu1* this, GlobalContext* globalCtx, s32 cond) { +void func_80AEF170(EnRu1* this, PlayState* play, s32 cond) { if (cond) { this->action = 25; } } -void func_80AEF188(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB174(globalCtx) && !func_80AEF0BC(this, globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80AEF188(EnRu1* this, PlayState* play) { + if (func_80AEB174(play) && !func_80AEF0BC(this, play)) { + Message_CloseTextbox(play); gSaveContext.infTable[20] |= 4; this->action = 24; } } -void func_80AEF1F0(EnRu1* this, GlobalContext* globalCtx, UNK_TYPE arg2) { +void func_80AEF1F0(EnRu1* this, PlayState* play, UNK_TYPE arg2) { if (arg2 != 0) { Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gRutoChildSittingAnim), ANIMMODE_LOOP, 0.0f); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gSaveContext.infTable[20] |= 8; - func_80AED6DC(this, globalCtx); - func_8002F580(&this->actor, globalCtx); + func_80AED6DC(this, play); + func_8002F580(&this->actor, play); this->action = 27; func_80AEADD8(this); } } -void func_80AEF29C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF29C(EnRu1* this, PlayState* play) { this->action = 23; } -void func_80AEF2AC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF2AC(EnRu1* this, PlayState* play) { this->action = 24; this->drawConfig = 1; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; } -void func_80AEF2D0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF2D0(EnRu1* this, PlayState* play) { s32 cond; - func_80AEEF68(this, globalCtx); + func_80AEEF68(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAC10(this, globalCtx); - func_80AEAECC(this, globalCtx); - cond = func_80AEE264(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEF170(this, globalCtx, cond); + func_80AEAC10(this, play); + func_80AEAECC(this, play); + cond = func_80AEE264(this, play); + func_80AED624(this, play); + func_80AEF170(this, play, cond); } -void func_80AEF354(EnRu1* this, GlobalContext* globalCtx) { - func_80AEEFEC(this, globalCtx); +void func_80AEF354(EnRu1* this, PlayState* play) { + func_80AEEFEC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEF188(this, globalCtx); + func_80AEAECC(this, play); + func_80AEF188(this, play); } -void func_80AEF3A8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF3A8(EnRu1* this, PlayState* play) { s32 something; func_80AED83C(this); something = EnRu1_UpdateSkelAnime(this); func_80AEF080(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEF1F0(this, globalCtx, something); + func_80AEAECC(this, play); + func_80AEF1F0(this, play, something); } void func_80AEF40C(EnRu1* this) { @@ -1909,8 +1909,8 @@ void func_80AEF40C(EnRu1* this) { } } -void func_80AEF4A8(EnRu1* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.projectedPos, 20, NA_SE_VO_RT_FALL); +void func_80AEF4A8(EnRu1* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.projectedPos, 20, NA_SE_VO_RT_FALL); } void func_80AEF4E0(EnRu1* this) { @@ -1948,16 +1948,16 @@ void func_80AEF5B8(EnRu1* this) { } } -void func_80AEF624(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF624(EnRu1* this, PlayState* play) { f32 frameCount; CsCmdActorAction* csCmdNPCAction; CsCmdActorAction* csCmdNPCAction2; s16 newRotTmp; - if (func_80AEAFE0(globalCtx, 1, 3)) { + if (func_80AEAFE0(play, 1, 3)) { frameCount = Animation_GetLastFrame(&gRutoChildWalkToAndHoldUpSapphireAnim); // this weird part with the redundant variable is necessary to match for some reason - csCmdNPCAction2 = globalCtx->csCtx.npcActions[3]; + csCmdNPCAction2 = play->csCtx.npcActions[3]; csCmdNPCAction = csCmdNPCAction2; this->actor.world.pos.x = csCmdNPCAction->startPos.x; this->actor.world.pos.y = csCmdNPCAction->startPos.y; @@ -1973,7 +1973,7 @@ void func_80AEF624(EnRu1* this, GlobalContext* globalCtx) { this->actor.world.rot.z = newRotTmp; Animation_Change(&this->skelAnime, &gRutoChildWalkToAndHoldUpSapphireAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); - func_80AEB3A4(this, globalCtx); + func_80AEB3A4(this, play); this->action = 37; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; @@ -1989,8 +1989,8 @@ void func_80AEF728(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AEF79C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEAFE0(globalCtx, 2, 3)) { +void func_80AEF79C(EnRu1* this, PlayState* play) { + if (func_80AEAFE0(play, 2, 3)) { Animation_Change(&this->skelAnime, &gRutoChildBringHandsDownAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildBringHandsDownAnim), ANIMMODE_ONCE, -8.0f); this->action = 39; @@ -2005,107 +2005,107 @@ void func_80AEF820(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AEF890(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF890(EnRu1* this, PlayState* play) { s32 pad[2]; s8 curRoomNum; - if ((gSaveContext.sceneSetupIndex < 4) && (EnRu1_IsCsStateIdle(globalCtx))) { - curRoomNum = globalCtx->roomCtx.curRoom.num; + if ((gSaveContext.sceneSetupIndex < 4) && (EnRu1_IsCsStateIdle(play))) { + curRoomNum = play->roomCtx.curRoom.num; gSaveContext.infTable[20] |= 0x20; - Flags_SetSwitch(globalCtx, func_80AEADE0(this)); + Flags_SetSwitch(play, func_80AEADE0(this)); func_80AEB0EC(this, 1); this->action = 42; this->actor.room = curRoomNum; } } -void func_80AEF930(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF930(EnRu1* this, PlayState* play) { if (func_80AEB104(this) == 3) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.textId = 0x4048; - Message_ContinueTextbox(globalCtx, this->actor.textId); - func_80AEF4A8(this, globalCtx); + Message_ContinueTextbox(play, this->actor.textId); + func_80AEF4A8(this, play); this->action = 43; this->drawConfig = 0; } } -void func_80AEF99C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB1B4(globalCtx) != 0) { +void func_80AEF99C(EnRu1* this, PlayState* play) { + if (func_80AEB1B4(play) != 0) { func_80AEB0EC(this, 4); Actor_Kill(&this->actor); } } -void func_80AEF9D8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF9D8(EnRu1* this, PlayState* play) { func_80AED83C(this); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEF624(this, globalCtx); - func_80AEB220(this, globalCtx); + func_80AEF624(this, play); + func_80AEB220(this, play); } -void func_80AEFA2C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFA2C(EnRu1* this, PlayState* play) { s32 something; func_80AED83C(this); - func_80AEB364(this, globalCtx); - func_80AEAECC(this, globalCtx); + func_80AEB364(this, play); + func_80AEAECC(this, play); something = EnRu1_UpdateSkelAnime(this); func_80AEF4E0(this); func_80AEF5B8(this); func_80AEF40C(this); func_80AEF728(this, something); - func_80AEB220(this, globalCtx); + func_80AEB220(this, play); } -void func_80AEFAAC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFAAC(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); - func_80AEF79C(this, globalCtx); - func_80AEB220(this, globalCtx); + func_80AEF79C(this, play); + func_80AEB220(this, play); } -void func_80AEFB04(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFB04(EnRu1* this, PlayState* play) { s32 something; func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); something = EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF820(this, something); - func_80AEB220(this, globalCtx); + func_80AEB220(this, play); } -void func_80AEFB68(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFB68(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEF890(this, globalCtx); - func_80AEB220(this, globalCtx); + func_80AEF890(this, play); + func_80AEB220(this, play); } -void func_80AEFBC8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFBC8(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF540(this); - func_80AEF930(this, globalCtx); + func_80AEF930(this, play); } -void func_80AEFC24(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFC24(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEF99C(this, globalCtx); + func_80AEF99C(this, play); } -void func_80AEFC54(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFC54(EnRu1* this, PlayState* play) { if ((gSaveContext.infTable[20] & 0x20) && !(gSaveContext.infTable[20] & 0x40)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 41; - this->unk_28C = EnRu1_FindSwitch(globalCtx); + this->unk_28C = EnRu1_FindSwitch(play); func_80AEB0EC(this, 1); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } else { @@ -2113,8 +2113,8 @@ void func_80AEFC54(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx) { - this->unk_28C = EnRu1_FindSwitch(globalCtx); +void func_80AEFCE8(EnRu1* this, PlayState* play) { + this->unk_28C = EnRu1_FindSwitch(play); if (this->unk_28C != NULL) { this->action = 42; this->drawConfig = 1; @@ -2122,7 +2122,7 @@ void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEFD38(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFD38(EnRu1* this, PlayState* play) { if ((gSaveContext.eventChkInf[3] & 0x80) && LINK_IS_CHILD) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->actor.flags &= ~ACTOR_FLAG_4; @@ -2133,61 +2133,61 @@ void func_80AEFD38(EnRu1* this, GlobalContext* globalCtx) { } } -s32 func_80AEFDC0(EnRu1* this, GlobalContext* globalCtx) { - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80AEFDC0(EnRu1* this, PlayState* play) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1F); + this->actor.textId = Text_GetFaceReaction(play, 0x1F); if (this->actor.textId == 0) { this->actor.textId = 0x402C; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); return false; } return true; } -s32 func_80AEFE38(EnRu1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s32 func_80AEFE38(EnRu1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); return true; } return false; } -void func_80AEFE84(EnRu1* this, GlobalContext* globalCtx, s32 cond) { +void func_80AEFE84(EnRu1* this, PlayState* play, s32 cond) { if (cond) { this->action = 45; } } -void func_80AEFE9C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEFE38(this, globalCtx)) { +void func_80AEFE9C(EnRu1* this, PlayState* play) { + if (func_80AEFE38(this, play)) { this->action = 44; } } -void func_80AEFECC(EnRu1* this, GlobalContext* globalCtx) { - func_80AEEF68(this, globalCtx); +void func_80AEFECC(EnRu1* this, PlayState* play) { + func_80AEEF68(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAC10(this, globalCtx); - func_80AEAECC(this, globalCtx); - func_80AEFE84(this, globalCtx, func_80AEFDC0(this, globalCtx)); + func_80AEAC10(this, play); + func_80AEAECC(this, play); + func_80AEFE84(this, play, func_80AEFDC0(this, play)); } -void func_80AEFF40(EnRu1* this, GlobalContext* globalCtx) { - func_80AEEFEC(this, globalCtx); +void func_80AEFF40(EnRu1* this, PlayState* play) { + func_80AEEFEC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEFE9C(this, globalCtx); + func_80AEAECC(this, play); + func_80AEFE9C(this, play); } -void func_80AEFF94(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFF94(EnRu1* this, PlayState* play) { s8 actorRoom; if ((gSaveContext.infTable[20] & 2) && (gSaveContext.infTable[20] & 1) && shouldSpawnRuto() && - (!(func_80AEB020(this, globalCtx)))) { + (!(func_80AEB020(this, play)))) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -2205,15 +2205,15 @@ void func_80AEFF94(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AF0050(EnRu1* this, GlobalContext* globalCtx) { +void func_80AF0050(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 36; this->roomNum1 = this->actor.room; - this->unk_28C = EnRu1_FindSwitch(globalCtx); + this->unk_28C = EnRu1_FindSwitch(play); this->actor.room = -1; } -void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Update(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { @@ -2222,40 +2222,40 @@ void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Init(Actor* thisx, PlayState* play) { s32 pad; EnRu1* this = (EnRu1*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRutoChildSkel, NULL, this->jointTable, this->morphTable, 17); - func_80AEAD20(&this->actor, globalCtx); + SkelAnime_InitFlex(play, &this->skelAnime, &gRutoChildSkel, NULL, this->jointTable, this->morphTable, 17); + func_80AEAD20(&this->actor, play); switch (func_80AEADF0(this)) { case 0: - func_80AECDA0(this, globalCtx); + func_80AECDA0(this, play); break; case 1: - func_80AEB3DC(this, globalCtx); + func_80AEB3DC(this, play); break; case 2: - func_80AEC320(this, globalCtx); + func_80AEC320(this, play); break; case 3: - func_80AED44C(this, globalCtx); + func_80AED44C(this, play); break; case 4: - func_80AEFC54(this, globalCtx); + func_80AEFC54(this, play); break; case 5: - func_80AEFD38(this, globalCtx); + func_80AEFD38(this, play); break; case 6: - func_80AEFF94(this, globalCtx); + func_80AEFF94(this, play); break; case 10: - func_80AF0050(this, globalCtx); + func_80AF0050(this, play); break; default: Actor_Kill(&this->actor); @@ -2265,7 +2265,7 @@ void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80AF0278(EnRu1* this, GlobalContext* globalCtx, s32 limbIndex, Vec3s* rot) { +void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot) { Vec3s* vec1 = &this->unk_374.unk_0E; Vec3s* vec2 = &this->unk_374.unk_08; @@ -2281,7 +2281,7 @@ void func_80AF0278(EnRu1* this, GlobalContext* globalCtx, s32 limbIndex, Vec3s* } } -s32 EnRu1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnRu1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnRu1* this = (EnRu1*)thisx; @@ -2289,12 +2289,12 @@ s32 EnRu1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, // "Neck rotation mode is improper!" osSyncPrintf(VT_FGCOL(RED) "首回しモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sPreLimbDrawFuncs[this->unk_290](this, globalCtx, limbIndex, rot); + sPreLimbDrawFuncs[this->unk_290](this, play, limbIndex, rot); } return false; } -void EnRu1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnRu1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnRu1* this = (EnRu1*)thisx; Vec3f vec1; Vec3f vec2; @@ -2311,10 +2311,10 @@ void EnRu1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnRu1_DrawNothing(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_DrawNothing(EnRu1* this, PlayState* play) { } -void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_DrawOpa(EnRu1* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; @@ -2323,9 +2323,9 @@ void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2333,13 +2333,13 @@ void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnRu1_OverrideLimbDraw, EnRu1_PostLimbDraw, this, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_DrawXlu(EnRu1* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; @@ -2348,9 +2348,9 @@ void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2358,13 +2358,13 @@ void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnRu1_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Draw(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == 0) { @@ -2372,5 +2372,5 @@ void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h index 7d6ed6269..d5ed7b3a6 100644 --- a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -9,9 +9,9 @@ struct EnRu1; -typedef void (*EnRu1ActionFunc)(struct EnRu1*, GlobalContext*); -typedef void (*EnRu1DrawFunc)(struct EnRu1*, GlobalContext*); -typedef void (*EnRu1PreLimbDrawFunc)(struct EnRu1*, GlobalContext*, s32, Vec3s*); +typedef void (*EnRu1ActionFunc)(struct EnRu1*, PlayState*); +typedef void (*EnRu1DrawFunc)(struct EnRu1*, PlayState*); +typedef void (*EnRu1PreLimbDrawFunc)(struct EnRu1*, PlayState*, s32, Vec3s*); typedef struct EnRu1 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 433c90521..c269935b2 100644 --- a/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -11,37 +11,37 @@ #define FLAGS ACTOR_FLAG_4 -void EnRu2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRu2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRu2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRu2_Init(Actor* thisx, PlayState* play); +void EnRu2_Destroy(Actor* thisx, PlayState* play); +void EnRu2_Update(Actor* thisx, PlayState* play); +void EnRu2_Draw(Actor* thisx, PlayState* play); -void func_80AF2CB4(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2CD4(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2CF4(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2D2C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2D6C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2DAC(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2DEC(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3144(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3174(EnRu2* this, GlobalContext* globalCtx); -void func_80AF31C8(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3604(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3624(EnRu2* this, GlobalContext* globalCtx); -void func_80AF366C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF36AC(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3BC8(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3C04(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3C64(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3CB8(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3D0C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3D60(EnRu2* this, GlobalContext* globalCtx); +void func_80AF2CB4(EnRu2* this, PlayState* play); +void func_80AF2CD4(EnRu2* this, PlayState* play); +void func_80AF2CF4(EnRu2* this, PlayState* play); +void func_80AF2D2C(EnRu2* this, PlayState* play); +void func_80AF2D6C(EnRu2* this, PlayState* play); +void func_80AF2DAC(EnRu2* this, PlayState* play); +void func_80AF2DEC(EnRu2* this, PlayState* play); +void func_80AF3144(EnRu2* this, PlayState* play); +void func_80AF3174(EnRu2* this, PlayState* play); +void func_80AF31C8(EnRu2* this, PlayState* play); +void func_80AF3604(EnRu2* this, PlayState* play); +void func_80AF3624(EnRu2* this, PlayState* play); +void func_80AF366C(EnRu2* this, PlayState* play); +void func_80AF36AC(EnRu2* this, PlayState* play); +void func_80AF3BC8(EnRu2* this, PlayState* play); +void func_80AF3C04(EnRu2* this, PlayState* play); +void func_80AF3C64(EnRu2* this, PlayState* play); +void func_80AF3CB8(EnRu2* this, PlayState* play); +void func_80AF3D0C(EnRu2* this, PlayState* play); +void func_80AF3D60(EnRu2* this, PlayState* play); -void func_80AF3F14(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3F20(EnRu2* this, GlobalContext* globalCtx); -void func_80AF321C(EnRu2* this, GlobalContext* globalCtx); +void func_80AF3F14(EnRu2* this, PlayState* play); +void func_80AF3F20(EnRu2* this, PlayState* play); +void func_80AF321C(EnRu2* this, PlayState* play); -void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx); +void func_80AF2AB4(EnRu2* this, PlayState* play); static ColliderCylinderInitType1 sCylinderInit = { { @@ -90,24 +90,24 @@ const ActorInit En_Ru2_InitVars = { NULL, }; -void func_80AF2550(Actor* thisx, GlobalContext* globalCtx) { +void func_80AF2550(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void func_80AF259C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF259C(EnRu2* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnRu2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Destroy(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; D_80AF4118 = 0; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80AF2608(EnRu2* this) { @@ -146,10 +146,10 @@ void func_80AF26AC(EnRu2* this) { this->unk_2B0 = 0.0f; } -void func_80AF26D0(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF26D0(EnRu2* this, PlayState* play) { s32 one; // Needed to match - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_80AF4118 != 0) { if (this->actor.params == 2) { func_80AF26AC(this); @@ -165,23 +165,23 @@ void func_80AF26D0(EnRu2* this, GlobalContext* globalCtx) { } } -void func_80AF2744(EnRu2* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 4); +void func_80AF2744(EnRu2* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 4); } s32 EnRu2_UpdateSkelAnime(EnRu2* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* func_80AF27AC(GlobalContext* globalCtx, s32 npcActionIdx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[npcActionIdx]; +CsCmdActorAction* func_80AF27AC(PlayState* play, s32 npcActionIdx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[npcActionIdx]; } return NULL; } -s32 func_80AF27D0(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdActorAction = func_80AF27AC(globalCtx, npcActionIdx); +s32 func_80AF27D0(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { + CsCmdActorAction* csCmdActorAction = func_80AF27AC(play, npcActionIdx); if ((csCmdActorAction != NULL) && (csCmdActorAction->action == arg2)) { return true; @@ -189,8 +189,8 @@ s32 func_80AF27D0(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcAction return false; } -s32 func_80AF281C(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(globalCtx, npcActionIdx); +s32 func_80AF281C(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action != arg2)) { return true; @@ -198,8 +198,8 @@ s32 func_80AF281C(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcAction return false; } -void func_80AF2868(EnRu2* this, GlobalContext* globalCtx, u32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(globalCtx, npcActionIdx); +void func_80AF2868(EnRu2* this, PlayState* play, u32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); s16 newRotY; Actor* thisx = &this->actor; @@ -232,54 +232,54 @@ void func_80AF28E8(EnRu2* this, AnimationHeader* animation, u8 arg2, f32 transit Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, transitionRate); } -void func_80AF2978(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2978(EnRu2* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } -void func_80AF2994(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2994(EnRu2* this, PlayState* play) { func_80AF28E8(this, &gAdultRutoIdleAnim, 0, 0.0f, 0); this->actor.shape.yOffset = -10000.0f; } -void func_80AF29DC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF29DC(EnRu2* this, PlayState* play) { Actor* thisx = &this->actor; f32 posX = thisx->world.pos.x; f32 posY = thisx->world.pos.y; f32 posZ = thisx->world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void func_80AF2A38(EnRu2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF2A38(EnRu2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 50.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 10); - Item_Give(globalCtx, ITEM_MEDALLION_WATER); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 10); + Item_Give(play, ITEM_MEDALLION_WATER); } -void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2AB4(EnRu2* this, PlayState* play) { s32 pad[2]; Player* player; s16 temp; if ((gSaveContext.chamberCutsceneNum == 2) && (gSaveContext.sceneSetupIndex < 4)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->action = 1; - globalCtx->csCtx.segment = &D_80AF411C; + play->csCtx.segment = &D_80AF411C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_WATER); + Item_Give(play, ITEM_MEDALLION_WATER); temp = this->actor.world.rot.y + 0x8000; player->actor.shape.rot.y = temp; player->actor.world.rot.y = temp; } } -void func_80AF2B44(EnRu2* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80AF2B44(EnRu2* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* csCmdNPCAction; if (csCtx->state != CS_STATE_IDLE) { @@ -287,7 +287,7 @@ void func_80AF2B44(EnRu2* this, GlobalContext* globalCtx) { if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 2)) { this->action = 2; this->drawConfig = 1; - func_80AF29DC(this, globalCtx); + func_80AF29DC(this, play); } } } @@ -299,12 +299,12 @@ void func_80AF2B94(EnRu2* this) { } } -void func_80AF2BC0(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2BC0(EnRu2* this, PlayState* play) { AnimationHeader* animation = &gAdultRutoRaisingArmsUpAnim; CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[3]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[3]; if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 3)) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); @@ -319,63 +319,63 @@ void func_80AF2C54(EnRu2* this, s32 arg1) { } } -void func_80AF2C68(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2C68(EnRu2* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[6]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[6]; if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 2)) { this->action = 6; - func_80AF2A38(this, globalCtx); + func_80AF2A38(this, play); } } } -void func_80AF2CB4(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2AB4(this, globalCtx); +void func_80AF2CB4(EnRu2* this, PlayState* play) { + func_80AF2AB4(this, play); } -void func_80AF2CD4(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2B44(this, globalCtx); +void func_80AF2CD4(EnRu2* this, PlayState* play) { + func_80AF2B44(this, play); } -void func_80AF2CF4(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2978(this, globalCtx); +void func_80AF2CF4(EnRu2* this, PlayState* play) { + func_80AF2978(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF2B94(this); } -void func_80AF2D2C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF2D2C(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF2BC0(this, globalCtx); + func_80AF2BC0(this, play); } -void func_80AF2D6C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2D6C(EnRu2* this, PlayState* play) { s32 something; - func_80AF2744(this, globalCtx); + func_80AF2744(this, play); something = EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF2C54(this, something); } -void func_80AF2DAC(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF2DAC(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF2C68(this, globalCtx); + func_80AF2C68(this, play); } -void func_80AF2DEC(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF2DEC(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); } -void func_80AF2E1C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2E1C(EnRu2* this, PlayState* play) { func_80AF28E8(this, &gAdultRutoCrossingArmsAnim, 2, 0.0f, 0); this->action = 7; this->actor.shape.shadowAlpha = 0; @@ -385,13 +385,13 @@ void func_80AF2E64() { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void func_80AF2E84(EnRu2* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void func_80AF2E84(EnRu2* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(19) + 24.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 8); } -void func_80AF2F04(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF27D0(this, globalCtx, 4, 3)) { +void func_80AF2F04(EnRu2* this, PlayState* play) { + if (func_80AF27D0(this, play, 4, 3)) { this->action = 8; this->drawConfig = 2; this->alpha = 0; @@ -401,11 +401,11 @@ void func_80AF2F04(EnRu2* this, GlobalContext* globalCtx) { } } -void func_80AF2F58(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2F58(EnRu2* this, PlayState* play) { f32* unk_2B0 = &this->unk_2B0; s32 alpha; - if (func_80AF27D0(this, globalCtx, 4, 3)) { + if (func_80AF27D0(this, play, 4, 3)) { *unk_2B0 += 1.0f; if (*unk_2B0 >= kREG(5) + 10.0f) { this->action = 9; @@ -431,63 +431,63 @@ void func_80AF2F58(EnRu2* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = alpha; } -void func_80AF30AC(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF281C(this, globalCtx, 4, 3)) { +void func_80AF30AC(EnRu2* this, PlayState* play) { + if (func_80AF281C(this, play, 4, 3)) { this->action = 8; this->drawConfig = 2; this->unk_2B0 = kREG(5) + 10.0f; this->alpha = 255; if (this->unk_2B8 == 0) { - func_80AF2E84(this, globalCtx); + func_80AF2E84(this, play); this->unk_2B8 = 1; } this->actor.shape.shadowAlpha = 0xFF; } } -void func_80AF3144(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2F04(this, globalCtx); - func_80AF26D0(this, globalCtx); +void func_80AF3144(EnRu2* this, PlayState* play) { + func_80AF2F04(this, play); + func_80AF26D0(this, play); } -void func_80AF3174(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3174(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF2F58(this, globalCtx); - func_80AF26D0(this, globalCtx); + func_80AF2F58(this, play); + func_80AF26D0(this, play); } -void func_80AF31C8(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF31C8(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF30AC(this, globalCtx); - func_80AF26D0(this, globalCtx); + func_80AF30AC(this, play); + func_80AF26D0(this, play); } -void func_80AF321C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF321C(EnRu2* this, PlayState* play) { s32 pad[2]; s16 temp = this->unk_2A4; void* tex = sEyeTextures[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80AF3394(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3394(EnRu2* this, PlayState* play) { func_80AF28E8(this, &gAdultRutoIdleHandsOnHipsAnim, 0, 0.0f, 0); this->action = 10; this->drawConfig = 0; @@ -512,8 +512,8 @@ void func_80AF33E0(EnRu2* this) { } } -void func_80AF346C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2868(this, globalCtx, 3); +void func_80AF346C(EnRu2* this, PlayState* play) { + func_80AF2868(this, play, 3); this->action = 11; this->drawConfig = 2; } @@ -536,8 +536,8 @@ void func_80AF3530(EnRu2* this, s32 arg1) { } } -void func_80AF3564(EnRu2* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(globalCtx, 3); +void func_80AF3564(EnRu2* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, 3); s32 action; s32 unk_2BC; @@ -547,7 +547,7 @@ void func_80AF3564(EnRu2* this, GlobalContext* globalCtx) { if (action != unk_2BC) { switch (action) { case 7: - func_80AF346C(this, globalCtx); + func_80AF346C(this, play); break; case 8: func_80AF34F0(this); @@ -562,44 +562,44 @@ void func_80AF3564(EnRu2* this, GlobalContext* globalCtx) { } } -void func_80AF3604(EnRu2* this, GlobalContext* globalCtx) { - func_80AF3564(this, globalCtx); +void func_80AF3604(EnRu2* this, PlayState* play) { + func_80AF3564(this, play); } -void func_80AF3624(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3624(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF33E0(this); func_80AF34A4(this); } -void func_80AF366C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF366C(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF3564(this, globalCtx); + func_80AF3564(this, play); } -void func_80AF36AC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF36AC(EnRu2* this, PlayState* play) { s32 something; - func_80AF2744(this, globalCtx); + func_80AF2744(this, play); something = EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF3530(this, something); } -void func_80AF36EC(EnRu2* this, GlobalContext* globalCtx) { - Flags_SetSwitch(globalCtx, func_80AF2690(this)); +void func_80AF36EC(EnRu2* this, PlayState* play) { + Flags_SetSwitch(play, func_80AF2690(this)); } -s32 func_80AF3718(EnRu2* this, GlobalContext* globalCtx) { - return Flags_GetSwitch(globalCtx, func_80AF2690(this)); +s32 func_80AF3718(EnRu2* this, PlayState* play) { + return Flags_GetSwitch(play, func_80AF2690(this)); } -void func_80AF3744(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF3718(this, globalCtx)) { +void func_80AF3744(EnRu2* this, PlayState* play) { + if (func_80AF3718(this, play)) { Actor_Kill(&this->actor); } else { func_80AF28E8(this, &gAdultRutoIdleAnim, 0, 0.0f, 0); @@ -620,8 +620,8 @@ void func_80AF37CC(EnRu2* this) { this->actor.world.pos.y = this->actor.home.pos.y + (300.0f * funcFloat); } -s32 func_80AF383C(EnRu2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80AF383C(EnRu2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 thisPosX = this->actor.world.pos.x; f32 playerPosX = player->actor.world.pos.x; @@ -631,19 +631,19 @@ s32 func_80AF383C(EnRu2* this, GlobalContext* globalCtx) { return 0; } -void func_80AF3878(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF383C(this, globalCtx) && !Gameplay_InCsMode(globalCtx)) { +void func_80AF3878(EnRu2* this, PlayState* play) { + if (func_80AF383C(this, play) && !Play_InCsMode(play)) { this->action = 16; - this->subCamId = OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(play, 3130, -99, &this->actor, MAIN_CAM); } } -void func_80AF38D0(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF38D0(EnRu2* this, PlayState* play) { this->action = 16; - this->subCamId = OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(play, 3130, -99, &this->actor, MAIN_CAM); } -void func_80AF390C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF390C(EnRu2* this, PlayState* play) { f32* unk_2C4 = &this->unk_2C4; *unk_2C4 += 1.0f; @@ -651,12 +651,12 @@ void func_80AF390C(EnRu2* this, GlobalContext* globalCtx) { func_80AF37AC(); } else if (*unk_2C4 > kREG(4) + 50.0f) { this->actor.textId = 0x403E; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->action = 17; } } -void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF39DC(EnRu2* this, PlayState* play) { s32 pad; MessageContext* msgCtx; s32 pad2; @@ -664,7 +664,7 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { Player* player; s32 pad3; - msgCtx = &globalCtx->msgCtx; + msgCtx = &play->msgCtx; dialogState = Message_GetState(msgCtx); if (dialogState == TEXT_STATE_DONE_FADING) { @@ -673,10 +673,10 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { osSyncPrintf("おれが小松だ! \n"); this->unk_2C2++; if (this->unk_2C2 % 6 == 3) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); // "uorya-!" (screeming sound) osSyncPrintf("うおりゃー! \n"); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); player->actor.world.pos.x = 820.0f; player->actor.world.pos.y = 0.0f; player->actor.world.pos.z = 180.0f; @@ -687,75 +687,75 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { this->unk_2C3 = dialogState; if (Message_GetState(msgCtx) == TEXT_STATE_CLOSING) { this->action = 18; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } } -void func_80AF3ADC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3ADC(EnRu2* this, PlayState* play) { this->unk_2C4 += 1.0f; if (this->unk_2C4 > kREG(5) + 100.0f) { func_80AF28E8(this, &gAdultRutoSwimmingUpAnim, 0, -12.0f, 0); this->action = 19; - func_80AF36EC(this, globalCtx); + func_80AF36EC(this, play); } } -void func_80AF3B74(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3B74(EnRu2* this, PlayState* play) { if (this->unk_2C0 > ((((u16)(kREG(3) + 0x28)) + ((u16)(kREG(2) + 0x96))) & 0xFFFF)) { Actor_Kill(&this->actor); - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); } } -void func_80AF3BC8(EnRu2* this, GlobalContext* globalCtx) { - func_80AF3878(this, globalCtx); +void func_80AF3BC8(EnRu2* this, PlayState* play) { + func_80AF3878(this, play); Actor_SetFocus(&this->actor, 50.0f); - func_80AF259C(this, globalCtx); + func_80AF259C(this, play); } -void func_80AF3C04(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); - func_80AF259C(this, globalCtx); +void func_80AF3C04(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); + func_80AF259C(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF38D0(this, globalCtx); + func_80AF38D0(this, play); } -void func_80AF3C64(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3C64(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF390C(this, globalCtx); + func_80AF390C(this, play); } -void func_80AF3CB8(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3CB8(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF39DC(this, globalCtx); + func_80AF39DC(this, play); } -void func_80AF3D0C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3D0C(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF3ADC(this, globalCtx); + func_80AF3ADC(this, play); } -void func_80AF3D60(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3D60(EnRu2* this, PlayState* play) { func_80AF37CC(this); - func_80AF2744(this, globalCtx); + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF3B74(this, globalCtx); + func_80AF3B74(this, play); } -void EnRu2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Update(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; if ((this->action < 0) || (this->action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[this->action] == NULL)) { @@ -763,28 +763,28 @@ void EnRu2_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnRu2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Init(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - func_80AF2550(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gAdultRutoSkel, NULL, this->jointTable, this->morphTable, 23); + func_80AF2550(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gAdultRutoSkel, NULL, this->jointTable, this->morphTable, 23); switch (func_80AF26A0(this)) { case 2: - func_80AF2E1C(this, globalCtx); + func_80AF2E1C(this, play); break; case 3: - func_80AF3394(this, globalCtx); + func_80AF3394(this, play); break; case 4: - func_80AF3744(this, globalCtx); + func_80AF3744(this, play); break; default: - func_80AF2994(this, globalCtx); + func_80AF2994(this, play); break; } @@ -793,31 +793,31 @@ void EnRu2_Init(Actor* thisx, GlobalContext* globalCtx) { this->subCamId = 0; } -void func_80AF3F14(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3F14(EnRu2* this, PlayState* play) { } -void func_80AF3F20(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3F20(EnRu2* this, PlayState* play) { s32 pad[2]; s16 temp = this->unk_2A4; void* tex = sEyeTextures[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Draw(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; // FAST3D: This is a hack for the issue of both TEXEL0 and TEXEL1 using the same texture with different settings. @@ -839,5 +839,5 @@ void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h b/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h index 0b5572cfc..be13c2095 100644 --- a/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h +++ b/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h @@ -6,8 +6,8 @@ struct EnRu2; -typedef void (*EnRu2ActionFunc)(struct EnRu2*, GlobalContext*); -typedef void (*EnRu2DrawFunc)(struct EnRu2*, GlobalContext*); +typedef void (*EnRu2ActionFunc)(struct EnRu2*, PlayState*); +typedef void (*EnRu2DrawFunc)(struct EnRu2*, PlayState*); typedef struct EnRu2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 6d9c160a8..5823e3539 100644 --- a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -6,16 +6,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnSa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSa_Init(Actor* thisx, PlayState* play); +void EnSa_Destroy(Actor* thisx, PlayState* play); +void EnSa_Update(Actor* thisx, PlayState* play); +void EnSa_Draw(Actor* thisx, PlayState* play); -void func_80AF6448(EnSa* this, GlobalContext* globalCtx); -void func_80AF67D0(EnSa* this, GlobalContext* globalCtx); -void func_80AF683C(EnSa* this, GlobalContext* globalCtx); -void func_80AF68E4(EnSa* this, GlobalContext* globalCtx); -void func_80AF6B20(EnSa* this, GlobalContext* globalCtx); +void func_80AF6448(EnSa* this, PlayState* play); +void func_80AF67D0(EnSa* this, PlayState* play); +void func_80AF683C(EnSa* this, PlayState* play); +void func_80AF68E4(EnSa* this, PlayState* play); +void func_80AF6B20(EnSa* this, PlayState* play); typedef enum { /* 0 */ SARIA_EYE_OPEN, @@ -126,8 +126,8 @@ static AnimationInfo sAnimationInfo2[] = { { &gSariaWaitArmsToSideAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, }; -s16 func_80AF5560(EnSa* this, GlobalContext* globalCtx) { - s16 textState = Message_GetState(&globalCtx->msgCtx); +s16 func_80AF5560(EnSa* this, PlayState* play) { + s16 textState = Message_GetState(&play->msgCtx); if (this->unk_209 == TEXT_STATE_AWAITING_NEXT || this->unk_209 == TEXT_STATE_EVENT || this->unk_209 == TEXT_STATE_CLOSING || this->unk_209 == TEXT_STATE_DONE_HAS_NEXT) { @@ -139,9 +139,9 @@ s16 func_80AF5560(EnSa* this, GlobalContext* globalCtx) { return textState; } -u16 func_80AF55E0(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80AF55E0(PlayState* play, Actor* thisx) { EnSa* this = (EnSa*)thisx; - u16 reaction = Text_GetFaceReaction(globalCtx, 0x10); + u16 reaction = Text_GetFaceReaction(play, 0x10); if (reaction != 0) { return reaction; @@ -179,11 +179,11 @@ u16 func_80AF55E0(GlobalContext* globalCtx, Actor* thisx) { return 0x1001; } -s16 func_80AF56F4(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AF56F4(PlayState* play, Actor* thisx) { s16 ret = 1; EnSa* this = (EnSa*)thisx; - switch (func_80AF5560(this, globalCtx)) { + switch (func_80AF5560(this, play)) { case TEXT_STATE_CLOSING: switch (this->actor.textId) { case 0x1002: @@ -217,10 +217,10 @@ s16 func_80AF56F4(GlobalContext* globalCtx, Actor* thisx) { return ret; } -void func_80AF57D8(EnSa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum != SCENE_SPOT05 || +void func_80AF57D8(EnSa* this, PlayState* play) { + if (play->sceneNum != SCENE_SPOT05 || ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x1555 || this->unk_1E0.unk_00 != 0) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, func_80AF55E0, + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, func_80AF55E0, func_80AF56F4); } } @@ -373,26 +373,26 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { sAnimationInfo1[index].morphFrames); } -s32 func_80AF5DFC(EnSa* this, GlobalContext* globalCtx) { +s32 func_80AF5DFC(EnSa* this, PlayState* play) { if (gSaveContext.cutsceneIndex >= 0xFFF0 && gSaveContext.cutsceneIndex != 0xFFFD) { - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { return 4; } - if (globalCtx->sceneNum == SCENE_SPOT05) { + if (play->sceneNum == SCENE_SPOT05) { return 5; } } - if (globalCtx->sceneNum == SCENE_KOKIRI_HOME5 && !LINK_IS_ADULT && + if (play->sceneNum == SCENE_KOKIRI_HOME5 && !LINK_IS_ADULT && INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY && !(gSaveContext.eventChkInf[4] & 1)) { return 1; } - if (globalCtx->sceneNum == SCENE_SPOT05 && (gSaveContext.eventChkInf[4] & 1)) { + if (play->sceneNum == SCENE_SPOT05 && (gSaveContext.eventChkInf[4] & 1)) { if (gSaveContext.n64ddFlag) { return 5; } return CHECK_QUEST_ITEM(QUEST_SONG_SARIA) ? 2 : 5; } - if (globalCtx->sceneNum == SCENE_SPOT04 && !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { + if (play->sceneNum == SCENE_SPOT04 && !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { if (gSaveContext.infTable[0] & 1) { return 1; } @@ -401,21 +401,21 @@ s32 func_80AF5DFC(EnSa* this, GlobalContext* globalCtx) { return 0; } -void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF5F34(EnSa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3 = 0; - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { phi_a3 = (this->actionFunc == func_80AF68E4) ? 1 : 4; } - if (globalCtx->sceneNum == SCENE_SPOT05) { + if (play->sceneNum == SCENE_SPOT05) { phi_a3 = (this->skelAnime.animation == &gSariaPlayingOcarinaAnim) ? 1 : 3; } - if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 && + if (play->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 && this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) { phi_a3 = 1; } - if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 && + if (play->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 && this->skelAnime.animation == &gSariaOcarinaToMouthAnim) { phi_a3 = 1; } @@ -474,17 +474,17 @@ void func_80AF6170(CsCmdActorAction* csAction, Vec3f* dst) { dst->z = csAction->endPos.z; } -void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Init(Actor* thisx, PlayState* play) { EnSa* this = (EnSa*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 12.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, NULL, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, NULL, this->jointTable, this->morphTable, 17); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - switch (func_80AF5DFC(this, globalCtx)) { + switch (func_80AF5DFC(this, play)) { case 2: EnSa_ChangeAnim(this, ENSA_ANIM1_11); this->actionFunc = func_80AF6448; @@ -501,7 +501,7 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: this->unk_210 = 0; this->actor.gravity = -1.0f; - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSpot04Cs_10E20); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSpot04Cs_10E20); gSaveContext.cutsceneTrigger = 1; EnSa_ChangeAnim(this, ENSA_ANIM1_4); this->actionFunc = func_80AF68E4; @@ -524,18 +524,18 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { this->alpha = 255; this->unk_21A = this->actor.shape.rot; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, FAIRY_KOKIRI); } -void EnSa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Destroy(Actor* thisx, PlayState* play) { EnSa* this = (EnSa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT04) { +void func_80AF6448(EnSa* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT04) { if (this->unk_1E0.unk_00 != 0) { switch (this->actor.textId) { case 0x1002: @@ -604,45 +604,45 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { EnSa_ChangeAnim(this, ENSA_ANIM1_6); } } - if (this->unk_1E0.unk_00 != 0 && globalCtx->sceneNum == SCENE_SPOT05) { + if (this->unk_1E0.unk_00 != 0 && play->sceneNum == SCENE_SPOT05) { Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80AF67D0; } } -void func_80AF67D0(EnSa* this, GlobalContext* globalCtx) { +void func_80AF67D0(EnSa* this, PlayState* play) { if (this->unk_1E0.unk_00 == 0) { Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80AF6448; } } -void GivePlayerRandoRewardSaria(EnSa* saria, GlobalContext* globalCtx, RandomizerCheck check) { +void GivePlayerRandoRewardSaria(EnSa* saria, PlayState* play, RandomizerCheck check) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, RG_SARIAS_SONG); - if (saria->actor.parent != NULL && saria->actor.parent->id == GET_PLAYER(globalCtx)->actor.id && - !Flags_GetTreasure(globalCtx, 0x1F)) { - Flags_SetTreasure(globalCtx, 0x1F); - } else if (!Flags_GetTreasure(globalCtx, 0x1F)) { - GiveItemEntryFromActor(&saria->actor, globalCtx, getItemEntry, 10000.0f, 100.0f); + if (saria->actor.parent != NULL && saria->actor.parent->id == GET_PLAYER(play)->actor.id && + !Flags_GetTreasure(play, 0x1F)) { + Flags_SetTreasure(play, 0x1F); + } else if (!Flags_GetTreasure(play, 0x1F)) { + GiveItemEntryFromActor(&saria->actor, play, getItemEntry, 10000.0f, 100.0f); } } -void func_80AF683C(EnSa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF683C(EnSa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!(player->actor.world.pos.z >= -2220.0f) && !Gameplay_InCsMode(globalCtx)) { + if (!(player->actor.world.pos.z >= -2220.0f) && !Play_InCsMode(play)) { if (gSaveContext.n64ddFlag) { - GivePlayerRandoRewardSaria(this, globalCtx, RC_SONG_FROM_SARIA); + GivePlayerRandoRewardSaria(this, play, RC_SONG_FROM_SARIA); return; } - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(spot05_scene_Cs_005730); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(spot05_scene_Cs_005730); gSaveContext.cutsceneTrigger = 1; this->actionFunc = func_80AF68E4; } } -void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { +void func_80AF68E4(EnSa* this, PlayState* play) { s16 phi_v0; Vec3f startPos; Vec3f endPos; @@ -651,11 +651,11 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { f32 temp_f0; f32 gravity; - if ((gSaveContext.cutsceneTrigger != 1) && (globalCtx->csCtx.state == CS_STATE_IDLE)) { + if ((gSaveContext.cutsceneTrigger != 1) && (play->csCtx.state == CS_STATE_IDLE)) { this->actionFunc = func_80AF6B20; return; } - csAction = globalCtx->csCtx.npcActions[1]; + csAction = play->csCtx.npcActions[1]; if (csAction != NULL) { func_80AF6130(csAction, &startPos); func_80AF6170(csAction, &endPos); @@ -697,12 +697,12 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { this->actor.shape.rot.z = csAction->urot.z; this->actor.velocity = D_80AF7448; - if (globalCtx->csCtx.frames < csAction->endFrame) { + if (play->csCtx.frames < csAction->endFrame) { temp_f0 = csAction->endFrame - csAction->startFrame; this->actor.velocity.x = (endPos.x - startPos.x) / temp_f0; this->actor.velocity.y = (endPos.y - startPos.y) / temp_f0; gravity = this->actor.gravity; - if (globalCtx->sceneNum == SCENE_SPOT05) { + if (play->sceneNum == SCENE_SPOT05) { gravity = 0.0f; } this->actor.velocity.y += gravity; @@ -714,13 +714,13 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { } } -void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT05) { - Item_Give(globalCtx, ITEM_SONG_SARIA); +void func_80AF6B20(EnSa* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT05) { + Item_Give(play, ITEM_SONG_SARIA); EnSa_ChangeAnim(this, ENSA_ANIM1_6); } - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { EnSa_ChangeAnim(this, ENSA_ANIM1_4); this->actor.world.pos = this->actor.home.pos; this->actor.world.rot = this->unk_21A; @@ -731,12 +731,12 @@ void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { this->actionFunc = func_80AF6448; } -void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Update(Actor* thisx, PlayState* play) { EnSa* this = (EnSa*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.animation == &gSariaOcarinaToMouthAnim && @@ -746,10 +746,10 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc != func_80AF68E4) { if (CVar_GetS32("gDisableKokiriDrawDistance", 0) != 0) { - this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, 32767); + this->alpha = func_80034DD4(&this->actor, play, this->alpha, 32767); } else { - this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, 400.0f); + this->alpha = func_80034DD4(&this->actor, play, this->alpha, 400.0f); } } else { this->alpha = 255; @@ -765,17 +765,17 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } - if (globalCtx->sceneNum != SCENE_SPOT05) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + if (play->sceneNum != SCENE_SPOT05) { + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } func_80AF609C(this); - this->actionFunc(this, globalCtx); - func_80AF57D8(this, globalCtx); - func_80AF5F34(this, globalCtx); + this->actionFunc(this, play); + func_80AF57D8(this, play); + func_80AF5F34(this, play); } -s32 EnSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnSa* this = (EnSa*)thisx; s32 pad; @@ -795,14 +795,14 @@ s32 EnSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Matrix_RotateX(BINANG_TO_RAD(sp18.x), MTXMODE_APPLY); } - if (globalCtx->sceneNum == SCENE_SPOT05 && limbIndex == 15) { + if (play->sceneNum == SCENE_SPOT05 && limbIndex == 15) { *dList = gSariaRightHandAndOcarinaDL; } return 0; } -void EnSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnSa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnSa* this = (EnSa*)thisx; Vec3f D_80AF7454 = { 400.0, 0.0f, 0.0f }; @@ -811,7 +811,7 @@ void EnSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Draw(Actor* thisx, PlayState* play) { static void* mouthTextures[] = { gSariaMouthClosed2Tex, gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex, gSariaMouthSuprisedTex, gSariaMouthClosedTex, @@ -821,19 +821,19 @@ void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnSa* this = (EnSa*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha == 255) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->rightEyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->leftEyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthIndex])); - func_80034BA0(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); + func_80034BA0(play, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); } else if (this->alpha != 0) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->rightEyeIndex])); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->leftEyeIndex])); gSPSegment(POLY_XLU_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthIndex])); - func_80034CC4(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); + func_80034CC4(play, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.h b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.h index 872b50f82..3fc8e3d6d 100644 --- a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.h +++ b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.h @@ -6,7 +6,7 @@ struct EnSa; -typedef void (*EnSaActionFunc)(struct EnSa*, GlobalContext*); +typedef void (*EnSaActionFunc)(struct EnSa*, PlayState*); typedef struct EnSa { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.c index c50d4a9b1..4d66a124c 100644 --- a/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -10,20 +10,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnSb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSb_Init(Actor* thisx, PlayState* play); +void EnSb_Destroy(Actor* thisx, PlayState* play); +void EnSb_Update(Actor* thisx, PlayState* play); +void EnSb_Draw(Actor* thisx, PlayState* play); void EnSb_SetupWaitClosed(EnSb* this); -void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx); -void EnSb_Open(EnSb* this, GlobalContext* globalCtx); -void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx); -void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx); -void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx); -void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx); -void EnSb_Cooldown(EnSb* this, GlobalContext* globalCtx); +void EnSb_WaitClosed(EnSb* this, PlayState* play); +void EnSb_Open(EnSb* this, PlayState* play); +void EnSb_WaitOpen(EnSb* this, PlayState* play); +void EnSb_TurnAround(EnSb* this, PlayState* play); +void EnSb_Lunge(EnSb* this, PlayState* play); +void EnSb_Bounce(EnSb* this, PlayState* play); +void EnSb_Cooldown(EnSb* this, PlayState* play); const ActorInit En_Sb_InitVars = { ACTOR_EN_SB, @@ -106,15 +106,15 @@ typedef enum { /* 0x04 */ SHELLBLADE_BOUNCE } ShellbladeBehavior; -void EnSb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Init(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = sDamageTable; this->actor.colChkInfo.health = 2; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_sb_Skel_002BF0, &object_sb_Anim_000194, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_sb_Skel_002BF0, &object_sb_Anim_000194, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); this->isDead = false; this->actor.colChkInfo.mass = 0; Actor_SetScale(&this->actor, 0.006f); @@ -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 = (EnSb*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnSb_SpawnBubbles(GlobalContext* globalCtx, EnSb* this) { +void EnSb_SpawnBubbles(PlayState* play, EnSb* this) { s32 i; if (this->actor.yDistToWater > 0) { for (i = 0; i < 10; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 10.0f, 10.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 10.0f, 10.0f, 30.0f, 0.25f); } } } @@ -206,7 +206,7 @@ void EnSb_SetupCooldown(EnSb* this, s32 changeSpeed) { this->actionFunc = EnSb_Cooldown; } -void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx) { +void EnSb_WaitClosed(EnSb* this, PlayState* play) { // always face toward link Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0x0); @@ -215,7 +215,7 @@ void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Open(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Open(EnSb* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; if (Animation_GetLastFrame(&object_sb_Anim_000194) <= currentFrame) { @@ -229,7 +229,7 @@ void EnSb_Open(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) { +void EnSb_WaitOpen(EnSb* this, PlayState* play) { s16 timer = this->timer; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0x0); @@ -247,7 +247,7 @@ void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { +void EnSb_TurnAround(EnSb* this, PlayState* play) { s16 invertedYaw; invertedYaw = this->attackYaw + 0x8000; @@ -264,7 +264,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { this->actor.speedXZ = 6.0f; this->actor.gravity = -2.0f; } - EnSb_SpawnBubbles(globalCtx, this); + EnSb_SpawnBubbles(play, this); this->bouncesLeft = 3; EnSb_SetupLunge(this); // "Attack!!" @@ -272,7 +272,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Lunge(EnSb* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); if ((this->actor.velocity.y <= -0.1f) || ((this->actor.bgCheckFlags & 2))) { if (!(this->actor.yDistToWater > 0.0f)) { @@ -283,7 +283,7 @@ void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Bounce(EnSb* this, PlayState* play) { s32 pad; f32 currentFrame; f32 frameCount; @@ -305,7 +305,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; @@ -317,7 +317,7 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Cooldown(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Cooldown(EnSb* this, PlayState* play) { if (this->timer != 0) { this->timer--; if (this->actor.bgCheckFlags & 1) { @@ -364,7 +364,7 @@ s32 EnSb_IsVulnerable(EnSb* this) { return false; } -s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { +s32 EnSb_UpdateDamage(EnSb* this, PlayState* play) { Vec3f hitPoint; f32 hitY; s16 yawDiff; @@ -421,10 +421,10 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { } if (this->actor.colChkInfo.health == 0) { this->hitByWindArrow = hitByWindArrow; - BodyBreak_Alloc(&this->bodyBreak, 8, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 8, play); this->isDead = true; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_SHELL_DEAD); + Enemy_StartFinishingBlow(play, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_SHELL_DEAD); return 1; } @@ -433,14 +433,14 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { hitPoint.x = this->collider.info.bumper.hitPos.x; hitPoint.y = this->collider.info.bumper.hitPos.y; hitPoint.z = this->collider.info.bumper.hitPos.z; - CollisionCheck_SpawnShieldParticlesMetal2(globalCtx, &hitPoint); + CollisionCheck_SpawnShieldParticlesMetal2(play, &hitPoint); } } return 0; } -void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Update(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; s32 pad; @@ -450,11 +450,11 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->actor.params = 1; } - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params)) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params)) { if (!this->hitByWindArrow) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, 8); + Item_DropCollectible(play, &this->actor.world.pos, 8); } Actor_Kill(&this->actor); } @@ -462,31 +462,31 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 20.0f); Actor_SetScale(&this->actor, 0.006f); Actor_MoveForward(&this->actor); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 5); - EnSb_UpdateDamage(this, globalCtx); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); + EnSb_UpdateDamage(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); } } -void EnSb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSb* this = (EnSb*)thisx; BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 6, 8, dList, BODYBREAK_OBJECT_DEFAULT); } -void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Draw(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; Vec3f flamePos; Vec3f* offset; s16 fireDecr; - func_8002EBCC(&this->actor, globalCtx, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8002EBCC(&this->actor, play, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnSb_PostLimbDraw, this); if (this->fire != 0) { this->actor.colorFilterTimer++; @@ -498,7 +498,7 @@ void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { flamePos.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + offset->x); flamePos.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + offset->y); flamePos.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + offset->z); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 100, 0, 0, -1); } } } diff --git a/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.h b/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.h index 587474395..a6dbd2cdf 100644 --- a/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.h +++ b/soh/src/overlays/actors/ovl_En_Sb/z_en_sb.h @@ -6,7 +6,7 @@ struct EnSb; -typedef void (*EnSbActionFunc)(struct EnSb*, GlobalContext*); +typedef void (*EnSbActionFunc)(struct EnSb*, PlayState*); typedef struct EnSb { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c b/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c index c559dd598..eb7ebe5ee 100644 --- a/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c +++ b/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c @@ -8,12 +8,12 @@ #define FLAGS 0 -void EnSceneChange_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSceneChange_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSceneChange_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSceneChange_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSceneChange_Init(Actor* thisx, PlayState* play); +void EnSceneChange_Destroy(Actor* thisx, PlayState* play); +void EnSceneChange_Update(Actor* thisx, PlayState* play); +void EnSceneChange_Draw(Actor* thisx, PlayState* play); -void EnSceneChange_DoNothing(EnSceneChange* this, GlobalContext* globalCtx); +void EnSceneChange_DoNothing(EnSceneChange* this, PlayState* play); const ActorInit En_Scene_Change_InitVars = { ACTOR_EN_SCENE_CHANGE, @@ -32,38 +32,38 @@ void EnSceneChange_SetupAction(EnSceneChange* this, EnSceneChangeActionFunc acti this->actionFunc = actionFunc; } -void EnSceneChange_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Init(Actor* thisx, PlayState* play) { EnSceneChange* this = (EnSceneChange*)thisx; EnSceneChange_SetupAction(this, EnSceneChange_DoNothing); } -void EnSceneChange_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Destroy(Actor* thisx, PlayState* play) { } -void EnSceneChange_DoNothing(EnSceneChange* this, GlobalContext* globalCtx) { +void EnSceneChange_DoNothing(EnSceneChange* this, PlayState* play) { } -void EnSceneChange_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Update(Actor* thisx, PlayState* play) { EnSceneChange* this = (EnSceneChange*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnSceneChange_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Draw(Actor* thisx, PlayState* play) { s32 pad[2]; Gfx* displayList; s32 pad2[2]; Gfx* displayListHead; - displayList = Graph_Alloc(globalCtx->state.gfxCtx, 0x3C0); + displayList = Graph_Alloc(play->state.gfxCtx, 0x3C0); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); displayListHead = displayList; gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h b/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h index d0b53e008..4add7d11e 100644 --- a/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h +++ b/soh/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h @@ -6,7 +6,7 @@ struct EnSceneChange; -typedef void (*EnSceneChangeActionFunc)(struct EnSceneChange*, GlobalContext*); +typedef void (*EnSceneChangeActionFunc)(struct EnSceneChange*, PlayState*); typedef struct EnSceneChange { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/soh/src/overlays/actors/ovl_En_Sda/z_en_sda.c index d8faaf6ee..a24355447 100644 --- a/soh/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/soh/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -8,13 +8,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnSda_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSda_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSda_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSda_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSda_Init(Actor* thisx, PlayState* play); +void EnSda_Destroy(Actor* thisx, PlayState* play); +void EnSda_Update(Actor* thisx, PlayState* play); +void EnSda_Draw(Actor* thisx, PlayState* play); -void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext* globalCtx); -void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx); +void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, PlayState* play); +void func_80AF9C70(u8* shadowTexture, Player* player, PlayState* play); void func_80AF8F60(Player* player, u8* shadowTexture, f32 arg2); const ActorInit En_Sda_InitVars = { @@ -89,13 +89,13 @@ static u32 D_80AFA390[] = { 0, 0 }; static Vec3f D_80AFA660[16]; -void EnSda_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Init(Actor* thisx, PlayState* play) { } -void EnSda_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Destroy(Actor* thisx, PlayState* play) { } -void EnSda_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Update(Actor* thisx, PlayState* play) { s32 pad; EnSda* this = (EnSda*)thisx; Player* player; @@ -105,7 +105,7 @@ void EnSda_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 1) { player = (Player*)this->actor.parent; } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); } this->actor.world.pos = player->actor.world.pos; @@ -113,24 +113,24 @@ void EnSda_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("SDA MOVE END\n"); } -void EnSda_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Draw(Actor* thisx, PlayState* play) { EnSda* this = (EnSda*)thisx; Player* player; - u8* shadowTexture = Graph_Alloc(globalCtx->state.gfxCtx, 0x1000); + u8* shadowTexture = Graph_Alloc(play->state.gfxCtx, 0x1000); osSyncPrintf("SDA DRAW \n"); if (this->actor.params == 1) { player = (Player*)this->actor.parent; } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); } player->actor.shape.shadowAlpha = 0; - func_80AF95C4(this, shadowTexture, player, globalCtx); + func_80AF95C4(this, shadowTexture, player, play); if (KREG(0) < 5) { - func_80AF9C70(shadowTexture, player, globalCtx); + func_80AF9C70(shadowTexture, player, play); } osSyncPrintf("SDA DRAW END\n"); @@ -235,7 +235,7 @@ void func_80AF8F60(Player* player, u8* shadowTexture, f32 arg2) { } } -void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext* globalCtx) { +void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, PlayState* play) { s16 temp_t0; s16 temp_t1; s16 temp_v0; @@ -332,17 +332,17 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext osSyncPrintf("SDA CONT 4\n"); } -void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx) { +void func_80AF9C70(u8* shadowTexture, Player* player, PlayState* play) { s32 pad; f32 tempx; f32 tempz; s16 phi_s1; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); osSyncPrintf("SDA D 1\n"); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 0, 0, 0, (BREG(52) + 50)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); Matrix_Translate(player->actor.world.pos.x, player->actor.floorHeight, player->actor.world.pos.z, MTXMODE_NEW); @@ -353,7 +353,7 @@ void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx) 20.0f; Matrix_Translate(tempx, 0.0f, tempz, MTXMODE_APPLY); Matrix_Scale(((BREG(56) - 250) / 1000.0f) + 0.6f, 1.0f, ((BREG(59) - 250) / 1000.0f) + 0.6f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_80AFA3D8); gDPLoadTextureBlock(POLY_XLU_DISP++, shadowTexture, G_IM_FMT_I, G_IM_SIZ_8b, 0x40, 0x40, 0, @@ -363,7 +363,7 @@ void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx) for (phi_s1 = 0; phi_s1 < KREG(78); phi_s1++) { Matrix_Scale((KREG(79) / 100.0f) + 1.0f, 1.0f, (KREG(79) / 100.0f) + 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_80AFA3F8); } diff --git a/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c b/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c index 70a4c8e10..3bbfe7350 100644 --- a/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c +++ b/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c @@ -3,18 +3,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnShopnuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnShopnuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnShopnuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnShopnuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnShopnuts_Init(Actor* thisx, PlayState* play); +void EnShopnuts_Destroy(Actor* thisx, PlayState* play); +void EnShopnuts_Update(Actor* thisx, PlayState* play); +void EnShopnuts_Draw(Actor* thisx, PlayState* play); void EnShopnuts_SetupWait(EnShopnuts* this); -void EnShopnuts_Wait(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_LookAround(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_Stand(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_ThrowNut(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_Burrow(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_SpawnSalesman(EnShopnuts* this, GlobalContext* globalCtx); +void EnShopnuts_Wait(EnShopnuts* this, PlayState* play); +void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play); +void EnShopnuts_Stand(EnShopnuts* this, PlayState* play); +void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play); +void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play); +void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play); const ActorInit En_Shopnuts_InitVars = { ACTOR_EN_SHOPNUTS, @@ -57,21 +57,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP), }; -void EnShopnuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Init(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubAnim_4574, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubAnim_4574, this->jointTable, this->morphTable, 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Collider_UpdateCylinder(&this->actor, &this->collider); if (gSaveContext.n64ddFlag) { s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); - ScrubIdentity scrubIdentity = Randomizer_IdentifyScrub(globalCtx->sceneNum, this->actor.params, respawnData); + ScrubIdentity scrubIdentity = Randomizer_IdentifyScrub(play->sceneNum, this->actor.params, respawnData); if (scrubIdentity.isShuffled && Flags_GetRandomizerInf(scrubIdentity.randomizerInf)) { Actor_Kill(&this->actor); @@ -87,10 +87,10 @@ void EnShopnuts_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnShopnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Destroy(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnShopnuts_SetupWait(EnShopnuts* this) { @@ -135,7 +135,7 @@ void EnShopnuts_SetupSpawnSalesman(EnShopnuts* this) { this->actionFunc = EnShopnuts_SpawnSalesman; } -void EnShopnuts_Wait(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) { s32 hasSlowPlaybackSpeed = false; if (this->skelAnime.playSpeed < 0.5f) { @@ -169,7 +169,7 @@ void EnShopnuts_Wait(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_LookAround(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -179,7 +179,7 @@ void EnShopnuts_LookAround(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_Stand(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_Stand(EnShopnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -194,7 +194,7 @@ void EnShopnuts_Stand(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_ThrowNut(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play) { Vec3f spawnPos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -206,14 +206,14 @@ void EnShopnuts_ThrowNut(EnShopnuts* this, GlobalContext* globalCtx) { spawnPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f); spawnPos.y = this->actor.world.pos.y + 12.0f; spawnPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 2) != NULL) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } } } -void EnShopnuts_Burrow(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnShopnuts_SetupWait(this); } else { @@ -224,9 +224,9 @@ void EnShopnuts_Burrow(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_SpawnSalesman(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_DNS, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DNS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, this->actor.params); Actor_Kill(&this->actor); @@ -235,26 +235,26 @@ void EnShopnuts_SpawnSalesman(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_ColliderCheck(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_ColliderCheck(EnShopnuts* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, 1); EnShopnuts_SetupSpawnSalesman(this); - } else if (globalCtx->actorCtx.unk_02 != 0) { + } else if (play->actorCtx.unk_02 != 0) { EnShopnuts_SetupSpawnSalesman(this); } } -void EnShopnuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Update(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; - EnShopnuts_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, 4); + EnShopnuts_ColliderCheck(this, play); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, 4); if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc == EnShopnuts_Wait) { Actor_SetFocus(&this->actor, this->skelAnime.curFrame); } else if (this->actionFunc == EnShopnuts_Burrow) { @@ -265,7 +265,7 @@ void EnShopnuts_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnShopnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnShopnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnShopnuts* this = (EnShopnuts*)thisx; @@ -275,7 +275,7 @@ s32 EnShopnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return 0; } -void EnShopnuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnShopnuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnShopnuts* this = (EnShopnuts*)thisx; f32 curFrame; @@ -284,7 +284,7 @@ void EnShopnuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis f32 z; if ((limbIndex == 9) && (this->actionFunc == EnShopnuts_ThrowNut)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); curFrame = this->skelAnime.curFrame; if (curFrame <= 6.0f) { y = 1.0f - (curFrame * 0.0833f); @@ -301,16 +301,16 @@ void EnShopnuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } Matrix_Scale(x, y, 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++, gBusinessScrubNoseDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnShopnuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Draw(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnShopnuts_OverrideLimbDraw, EnShopnuts_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h b/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h index 0b314e0cf..6ebfeabf3 100644 --- a/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h +++ b/soh/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h @@ -6,7 +6,7 @@ struct EnShopnuts; -typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, GlobalContext*); +typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, PlayState*); typedef struct EnShopnuts { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c index 5fb466b72..7c0d46a10 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -8,17 +8,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_9) -void EnSi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSi_Init(Actor* thisx, PlayState* play); +void EnSi_Destroy(Actor* thisx, PlayState* play); +void EnSi_Update(Actor* thisx, PlayState* play); +void EnSi_Draw(Actor* thisx, PlayState* play); -s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx); -void func_80AFB768(EnSi* this, GlobalContext* globalCtx); -void func_80AFB89C(EnSi* this, GlobalContext* globalCtx); -void func_80AFB950(EnSi* this, GlobalContext* globalCtx); -void Randomizer_UpdateSkullReward(EnSi* this, GlobalContext* globalCtx); -void Randomizer_GiveSkullReward(EnSi* this, GlobalContext* globalCtx); +s32 func_80AFB748(EnSi* this, PlayState* play); +void func_80AFB768(EnSi* this, PlayState* play); +void func_80AFB89C(EnSi* this, PlayState* play); +void func_80AFB950(EnSi* this, PlayState* play); +void Randomizer_UpdateSkullReward(EnSi* this, PlayState* play); +void Randomizer_GiveSkullReward(EnSi* this, PlayState* play); s32 textId = 0xB4; s32 giveItemId = ITEM_SKULL_TOKEN; @@ -60,11 +60,11 @@ const ActorInit En_Si_InitVars = { NULL, }; -void EnSi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Init(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AFBADC); Actor_SetScale(&this->actor, 0.025f); this->unk_19C = 0; @@ -72,21 +72,21 @@ void EnSi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 42.0f; } -void EnSi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Destroy(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx) { +s32 func_80AFB748(EnSi* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; } return 0; } -void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFB768(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { this->actionFunc = func_80AFB89C; @@ -95,25 +95,25 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.shape.rot.y += 0x400; - if (!Player_InCsMode(globalCtx)) { - func_80AFB748(this, globalCtx); + if (!Player_InCsMode(play)) { + func_80AFB748(this, play); if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; if (gSaveContext.n64ddFlag) { - Randomizer_UpdateSkullReward(this, globalCtx); + Randomizer_UpdateSkullReward(this, play); } else { - Item_Give(globalCtx, giveItemId); + Item_Give(play, giveItemId); } if ((CVar_GetS32("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN) && getItemId != RG_ICE_TRAP) { player->actor.freezeTimer = 20; } - Message_StartTextbox(globalCtx, textId, NULL); + Message_StartTextbox(play, textId, NULL); if (gSaveContext.n64ddFlag && getItemId != RG_ICE_TRAP) { - Randomizer_GiveSkullReward(this, globalCtx); + Randomizer_GiveSkullReward(this, play); Audio_PlayFanfare_Rando(getItem); } else { Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); @@ -123,30 +123,30 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { this->actionFunc = func_80AFB950; } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } } -void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFB89C(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.shape.rot.y += 0x400; if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { if (gSaveContext.n64ddFlag) { - Randomizer_UpdateSkullReward(this, globalCtx); + Randomizer_UpdateSkullReward(this, play); } else { - Item_Give(globalCtx, giveItemId); + Item_Give(play, giveItemId); } - Message_StartTextbox(globalCtx, textId, NULL); + Message_StartTextbox(play, textId, NULL); if (gSaveContext.n64ddFlag && getItemId != RG_ICE_TRAP) { - Randomizer_GiveSkullReward(this, globalCtx); + Randomizer_GiveSkullReward(this, play); Audio_PlayFanfare_Rando(getItem); } else { Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); @@ -157,10 +157,10 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { } } -void func_80AFB950(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFB950(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_CLOSING && + if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING && ((CVar_GetS32("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN) && getItemId != RG_ICE_TRAP)) { player->actor.freezeTimer = 10; } else { @@ -169,40 +169,40 @@ void func_80AFB950(EnSi* this, GlobalContext* globalCtx) { } } -void EnSi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Update(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 16.0f); } -void EnSi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Draw(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; if (this->actionFunc != func_80AFB950) { - func_8002ED80(&this->actor, globalCtx, 0); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002ED80(&this->actor, play, 0); + func_8002EBCC(&this->actor, play, 0); if (!gSaveContext.n64ddFlag) { - GetItem_Draw(globalCtx, GID_SKULL_TOKEN_2); + GetItem_Draw(play, GID_SKULL_TOKEN_2); } else { - getItem = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->actor.params, GI_SKULL_TOKEN); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, getItem); + getItem = Randomizer_GetItemFromActor(this->actor.id, play->sceneNum, this->actor.params, GI_SKULL_TOKEN); + EnItem00_CustomItemsParticles(&this->actor, play, getItem); if (getItem.itemId != ITEM_SKULL_TOKEN) { f32 mtxScale = 1.5f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); } - GetItemEntry_Draw(globalCtx, getItem); + GetItemEntry_Draw(play, getItem); } } } -void Randomizer_UpdateSkullReward(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Randomizer_UpdateSkullReward(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); - getItem = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->actor.params, GI_SKULL_TOKEN); + getItem = Randomizer_GetItemFromActor(this->actor.id, play->sceneNum, this->actor.params, GI_SKULL_TOKEN); getItemId = getItem.getItemId; if (getItemId == RG_ICE_TRAP) { gSaveContext.pendingIceTrapCount++; @@ -214,16 +214,16 @@ void Randomizer_UpdateSkullReward(EnSi* this, GlobalContext* globalCtx) { player->getItemEntry = getItem; } -void Randomizer_GiveSkullReward(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Randomizer_GiveSkullReward(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (getItem.modIndex == MOD_NONE) { // RANDOTOD: Move this into Item_Give() or some other more central location if (getItem.getItemId == GI_SWORD_BGS) { gSaveContext.bgsFlag = true; } - Item_Give(globalCtx, giveItemId); + Item_Give(play, giveItemId); } else if (getItem.modIndex == MOD_RANDOMIZER) { - Randomizer_Item_Give(globalCtx, getItem); + Randomizer_Item_Give(play, getItem); } } diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.h b/soh/src/overlays/actors/ovl_En_Si/z_en_si.h index b6dec1237..b52e831a3 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.h +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.h @@ -6,7 +6,7 @@ struct EnSi; -typedef void (*EnSiActionFunc)(struct EnSi*, GlobalContext*); +typedef void (*EnSiActionFunc)(struct EnSi*, PlayState*); typedef struct EnSi { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 7af6fd614..7ec825985 100644 --- a/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSiofuki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSiofuki_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSiofuki_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSiofuki_Init(Actor* thisx, PlayState* play); +void EnSiofuki_Destroy(Actor* thisx, PlayState* play); +void EnSiofuki_Update(Actor* thisx, PlayState* play); +void EnSiofuki_Draw(Actor* thisx, PlayState* play); -void func_80AFC34C(EnSiofuki* this, GlobalContext* globalCtx); -void func_80AFC544(EnSiofuki* this, GlobalContext* globalCtx); -void func_80AFC478(EnSiofuki* this, GlobalContext* globalCtx); +void func_80AFC34C(EnSiofuki* this, PlayState* play); +void func_80AFC544(EnSiofuki* this, PlayState* play); +void func_80AFC478(EnSiofuki* this, PlayState* play); const ActorInit En_Siofuki_InitVars = { ACTOR_EN_SIOFUKI, @@ -35,13 +35,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Init(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; s32 type; CollisionHeader* colHeader = NULL; s32 pad; - if ((thisx->room == 10) && Flags_GetSwitch(globalCtx, 0x1E)) { + if ((thisx->room == 10) && Flags_GetSwitch(play, 0x1E)) { Actor_Kill(thisx); return; } @@ -49,7 +49,7 @@ void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&object_siofuki_Col_000D78, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->sfxFlags |= 1; type = ((u16)thisx->params >> 0xC) & 0xF; @@ -88,7 +88,7 @@ void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { this->targetHeight = 10.0f; this->actionFunc = func_80AFC34C; } else if (type == EN_SIOFUKI_LOWERING) { - if (Flags_GetTreasure(globalCtx, (u16)thisx->params & 0x3F)) { + if (Flags_GetTreasure(play, (u16)thisx->params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; @@ -99,21 +99,21 @@ void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSiofuki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Destroy(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80AFBDC8(EnSiofuki* this, GlobalContext* globalCtx) { - this->oscillation = sinf((globalCtx->gameplayFrames & 0x1F) / 32.0f * M_PI * 2.0f) * 4.0f; +void func_80AFBDC8(EnSiofuki* this, PlayState* play) { + this->oscillation = sinf((play->gameplayFrames & 0x1F) / 32.0f * M_PI * 2.0f) * 4.0f; this->unk_170 = this->unk_174 * 10.0f + -6058.0f - this->oscillation * 10.0f; this->unk_174 = 35.0f; this->dyna.actor.world.pos.y = this->initPosY + this->currentHeight + this->oscillation; } -void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFBE8C(EnSiofuki* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 dX; f32 dY; f32 dZ; @@ -130,7 +130,7 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) { (dZ > (this->dyna.actor.scale.z * -400.0f)) && (dZ < (this->dyna.actor.scale.z * 400.0f)) && (dY < 0.0f)) { if (func_8004356C(&this->dyna)) { if (this->splashTimer <= 0) { - EffectSsGSplash_Spawn(globalCtx, &player->actor.world.pos, NULL, NULL, 1, 1); + EffectSsGSplash_Spawn(play, &player->actor.world.pos, NULL, NULL, 1, 1); this->splashTimer = 10; } else { this->splashTimer--; @@ -179,18 +179,18 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) { } } -void func_80AFC1D0(EnSiofuki* this, GlobalContext* globalCtx) { +void func_80AFC1D0(EnSiofuki* this, PlayState* play) { Math_SmoothStepToF(&this->currentHeight, this->targetHeight, 0.8f, 3.0f, 0.01f); } -void func_80AFC218(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC218(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); this->timer--; if (this->timer < 0) { - Flags_UnsetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F); + Flags_UnsetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F); switch (((u16)this->dyna.actor.params >> 0xC) & 0xF) { case EN_SIOFUKI_RAISING: this->targetHeight = 10.0f; @@ -206,30 +206,30 @@ void func_80AFC218(EnSiofuki* this, GlobalContext* globalCtx) { } if (((((u16)this->dyna.actor.params >> 0xC) & 0xF) == EN_SIOFUKI_LOWERING) && - Flags_GetTreasure(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; - Flags_UnsetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F); + Flags_UnsetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F); this->actionFunc = func_80AFC544; } } -void func_80AFC34C(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC34C(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { this->targetHeight = 400.0f; this->timer = 300; this->actionFunc = func_80AFC218; } } -void func_80AFC3C8(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC3C8(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); this->timer--; if (this->timer < 0) { @@ -238,26 +238,26 @@ void func_80AFC3C8(EnSiofuki* this, GlobalContext* globalCtx) { this->actionFunc = func_80AFC218; } - if (Flags_GetTreasure(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; } } -void func_80AFC478(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC478(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); if (((u16)this->dyna.actor.params >> 0xC & 0xF) == EN_SIOFUKI_LOWERING) { - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { this->timer = 20; this->actionFunc = func_80AFC3C8; - OnePointCutscene_Init(globalCtx, 5010, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 5010, 40, &this->dyna.actor, MAIN_CAM); } - if (Flags_GetTreasure(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; @@ -265,34 +265,34 @@ void func_80AFC478(EnSiofuki* this, GlobalContext* globalCtx) { } } -void func_80AFC544(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC544(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFC1D0(this, play); } -void EnSiofuki_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Update(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnSiofuki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Draw(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; u32 x; u32 y; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(0.0f, this->unk_170, 0.0f, MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); x = gameplayFrames * 15; y = gameplayFrames * -15; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, x, y, 64, 64, 1, x, y, 64, 64)); + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, x, y, 64, 64, 1, x, y, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_siofuki_DL_000B70); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->sfxFlags & 1) { f32 heightRatio; diff --git a/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h b/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h index 32bad16b7..b291c5cd2 100644 --- a/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h +++ b/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h @@ -11,7 +11,7 @@ typedef enum { struct EnSiofuki; -typedef void (*EnSiofukiActionFunc)(struct EnSiofuki*, GlobalContext*); +typedef void (*EnSiofukiActionFunc)(struct EnSiofuki*, PlayState*); typedef struct EnSiofuki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 956b13b94..0ddea6bcf 100644 --- a/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -4,28 +4,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSkb_Init(Actor* thisx, PlayState* play); +void EnSkb_Destroy(Actor* thisx, PlayState* play); +void EnSkb_Update(Actor* thisx, PlayState* play); +void EnSkb_Draw(Actor* thisx, PlayState* play); void func_80AFCD60(EnSkb* this); void func_80AFCDF8(EnSkb* this); -void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx); +void func_80AFCE5C(EnSkb* this, PlayState* play); void func_80AFCF48(EnSkb* this); -void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx); +void func_80AFCFF0(EnSkb* this, PlayState* play); void func_80AFD0A4(EnSkb* this); -void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx); +void EnSkb_Advance(EnSkb* this, PlayState* play); void func_80AFD33C(EnSkb* this); -void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx); +void EnSkb_SetupAttack(EnSkb* this, PlayState* play); void func_80AFD47C(EnSkb* this); -void func_80AFD508(EnSkb* this, GlobalContext* globalCtx); +void func_80AFD508(EnSkb* this, PlayState* play); void EnSkb_SetupStunned(EnSkb* this); -void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD880(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD968(EnSkb* this, GlobalContext* globalCtx); +void func_80AFD59C(EnSkb* this, PlayState* play); +void func_80AFD6CC(EnSkb* this, PlayState* play); +void func_80AFD7B4(EnSkb* this, PlayState* play); +void func_80AFD880(EnSkb* this, PlayState* play); +void func_80AFD968(EnSkb* this, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[2] = { { @@ -117,7 +117,7 @@ void EnSkb_SetupAction(EnSkb* this, EnSkbActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnSkb_SpawnDebris(GlobalContext* globalCtx, EnSkb* this, Vec3f* spawnPos) { +void EnSkb_SpawnDebris(PlayState* play, EnSkb* this, Vec3f* spawnPos) { Vec3f pos; Vec3f vel = { 0.0f, 8.0f, 0.0f }; Vec3f accel = { 0.0f, -1.5f, 0.0f }; @@ -132,8 +132,8 @@ void EnSkb_SpawnDebris(GlobalContext* globalCtx, EnSkb* this, Vec3f* spawnPos) { accel.z = Rand_CenteredFloat(1.0f); vel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; scale = (Rand_ZeroOne() * 5.0f) + 12.0f; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, 0); - func_80033480(globalCtx, &pos, 10.0f, 1, 150, 0, 1); + EffectSsHahen_Spawn(play, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, 0); + func_80033480(play, &pos, 10.0f, 1, 150, 0, 1); } static InitChainEntry sInitChain[] = { @@ -141,7 +141,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Init(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; s16 paramOffsetBody; s16 paramOffsetArm; @@ -153,12 +153,12 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = 0xFE; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - SkelAnime_Init(globalCtx, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlingAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlingAnim, this->jointTable, this->morphTable, 20); this->actor.naviEnemyId = 0x55; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f); paramOffsetBody = this->actor.params + 0xA; @@ -172,7 +172,7 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { func_80AFCDF8(this); } -void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Destroy(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; if (this->actor.parent != NULL) { @@ -184,7 +184,7 @@ void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } } - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80AFCD60(EnSkb* this) { @@ -206,7 +206,7 @@ void func_80AFCDF8(EnSkb* this) { EnSkb_SetupAction(this, func_80AFCE5C); } -void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFCE5C(EnSkb* this, PlayState* play) { if (this->skelAnime.curFrame < 4.0f) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -215,8 +215,8 @@ void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx) { } Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 800.0f, 0.0f); Math_SmoothStepToF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f, 0.0f); - if ((globalCtx->gameplayFrames & 1) != 0) { - EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos); + if ((play->gameplayFrames & 1) != 0) { + EnSkb_SpawnDebris(play, this, &this->actor.world.pos); } if ((SkelAnime_Update(&this->skelAnime) != 0) && (0.0f == this->actor.shape.yOffset)) { func_80AFCD60(this); @@ -234,10 +234,10 @@ void func_80AFCF48(EnSkb* this) { EnSkb_SetupAction(this, func_80AFCFF0); } -void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFCFF0(EnSkb* this, PlayState* play) { if ((Math_SmoothStepToF(&this->actor.shape.yOffset, -8000.0f, 1.0f, 500.0f, 0.0f) != 0.0f) && - (globalCtx->gameplayFrames & 1)) { - EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos); + (play->gameplayFrames & 1)) { + EnSkb_SpawnDebris(play, this, &this->actor.world.pos); } Math_SmoothStepToF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f, 0.0f); if (SkelAnime_Update(&this->skelAnime) != 0) { @@ -254,13 +254,13 @@ void func_80AFD0A4(EnSkb* this) { EnSkb_SetupAction(this, EnSkb_Advance); } -void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx) { +void EnSkb_Advance(EnSkb* this, PlayState* play) { s32 thisKeyFrame; s32 prevKeyFrame; f32 playSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((this->unk_283 != 0) && ((globalCtx->gameplayFrames & 0xF) == 0)) { + if ((this->unk_283 != 0) && ((play->gameplayFrames & 0xF) == 0)) { this->unk_288 = Rand_CenteredFloat(50000.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, (this->actor.yawTowardsPlayer + this->unk_288), 1, 0x2EE, 0); @@ -302,7 +302,7 @@ void func_80AFD33C(EnSkb* this) { EnSkb_SetupAction(this, EnSkb_SetupAttack); } -void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx) { +void EnSkb_SetupAttack(EnSkb* this, PlayState* play) { s32 frameData; frameData = this->skelAnime.curFrame; @@ -329,7 +329,7 @@ void func_80AFD47C(EnSkb* this) { EnSkb_SetupAction(this, func_80AFD508); } -void func_80AFD508(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD508(EnSkb* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { func_80AFCD60(this); } @@ -345,7 +345,7 @@ void EnSkb_SetupStunned(EnSkb* this) { EnSkb_SetupAction(this, func_80AFD59C); } -void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD59C(EnSkb* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; } @@ -356,7 +356,7 @@ void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) { } if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { if (this->actor.colChkInfo.health == 0) { - func_80AFD7B4(this, globalCtx); + func_80AFD7B4(this, play); } else { func_80AFCD60(this); } @@ -374,12 +374,12 @@ void func_80AFD644(EnSkb* this) { EnSkb_SetupAction(this, func_80AFD6CC); } -void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD6CC(EnSkb* this, PlayState* play) { // this cast is likely not real, but allows for a match u8* new_var; new_var = &this->unk_283; - if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) { + if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) { if ((*new_var) != 0) { this->unk_283 = (*new_var) | 2; } @@ -399,7 +399,7 @@ void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) { } } -void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD7B4(EnSkb* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDyingAnim, -4.0f); this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -408,22 +408,22 @@ void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) { } this->unk_280 = 1; this->actor.flags &= ~ACTOR_FLAG_0; - BodyBreak_Alloc(&this->bodyBreak, 18, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 18, play); this->unk_283 |= 4; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28); EnSkb_SetupAction(this, func_80AFD880); } -void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) { - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) { +void func_80AFD880(EnSkb* this, PlayState* play) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) { if (this->actor.scale.x == 0.01f) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x10); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x10); } else if (this->actor.scale.x <= 0.015f) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); } this->unk_283 |= 8; @@ -431,7 +431,7 @@ void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) { } } -void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD968(EnSkb* this, PlayState* play) { s16 pad; s32 i; Vec3f flamePos; @@ -442,7 +442,7 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { if ((this->unk_280 != 1) && (this->actor.bgCheckFlags & 0x60) && (this->actor.yDistToWater >= 40.0f)) { this->actor.colChkInfo.health = 0; this->unk_281 = 0; - func_80AFD7B4(this, globalCtx); + func_80AFD7B4(this, play); } else if (this->unk_280 >= 3) { if ((this->collider.base.acFlags & 2) != 0) { this->collider.base.acFlags &= ~2; @@ -465,22 +465,22 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { flamePos.x += Rand_CenteredFloat(20.0f); flamePos.z += Rand_CenteredFloat(20.0f); flamePos.y += (Rand_ZeroOne() * 25.0f); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, scale, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, scale, 0, 0, -1); } phi_v1 = 25; } Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, phi_v1); if (!Actor_ApplyDamage(&this->actor)) { - func_80AFD7B4(this, globalCtx); + func_80AFD7B4(this, play); return; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (this->unk_283 == 0) { if ((this->actor.colChkInfo.damageEffect == 0xD) || ((this->actor.colChkInfo.damageEffect == 0xE) && ((player->swordAnimation >= 4 && player->swordAnimation <= 11) || (player->swordAnimation == 20 || player->swordAnimation == 21)))) { - BodyBreak_Alloc(&this->bodyBreak, 2, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 2, play); this->unk_283 = 1; } } @@ -491,41 +491,41 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { } } -void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Update(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; s32 pad; - func_80AFD968(this, globalCtx); + func_80AFD968(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); + this->actionFunc(this, play); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += (3000.0f * this->actor.scale.y); if (this->unk_281 != 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_280 >= 3) { if ((this->actor.colorFilterTimer == 0) || ((this->actor.colorFilterParams & 0x4000) == 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSkb* this = (EnSkb*)thisx; s16 color; s16 pad[2]; if (limbIndex == 11) { if ((this->unk_283 & 2) == 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); - color = ABS((s16)(Math_SinS((globalCtx->gameplayFrames * 0x1770)) * 95.0f)) + 160; + OPEN_DISPS(play->state.gfxCtx); + color = ABS((s16)(Math_SinS((play->gameplayFrames * 0x1770)) * 95.0f)) + 160; gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, color, color, color, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { *dList = NULL; } @@ -535,7 +535,7 @@ s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSkb* this = (EnSkb*)thisx; Collider_UpdateSpheres(limbIndex, &this->collider); @@ -547,9 +547,9 @@ void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Draw(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, EnSkb_PostLimbDraw, &this->actor); } diff --git a/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 142b589c9..87d8aa3e5 100644 --- a/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -6,7 +6,7 @@ struct EnSkb; -typedef void (*EnSkbActionFunc)(struct EnSkb*, GlobalContext*); +typedef void (*EnSkbActionFunc)(struct EnSkb*, PlayState*); typedef struct EnSkb { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c index e75a52fae..b5f738aff 100644 --- a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -4,13 +4,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSkj_Init(Actor* thisx, PlayState* play); +void EnSkj_Destroy(Actor* thisx, PlayState* play); +void EnSkj_Update(Actor* thisx, PlayState* play); +void EnSkj_Draw(Actor* thisx, PlayState* play); -void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx); +void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play); +void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, PlayState* play); void func_80AFF2A0(EnSkj* this); void func_80AFF334(EnSkj* this); @@ -38,58 +38,58 @@ void EnSkj_SetupWaitForMaskTextClear(EnSkj* this); void EnSkj_SetupWaitForTextClear(EnSkj* this); void EnSkj_SetupDie(EnSkj* this); void func_80AFF1F0(EnSkj* this); -void EnSkj_OfferNextRound(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SetupAskForMask(EnSkj* this, GlobalContext* globalCtx); +void EnSkj_OfferNextRound(EnSkj* this, PlayState* play); +void EnSkj_SetupAskForMask(EnSkj* this, PlayState* play); f32 EnSkj_GetItemXzRange(EnSkj* this); -s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SetupTakeMask(EnSkj* this, GlobalContext* globalCtx); +s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play); +void EnSkj_SetupTakeMask(EnSkj* this, PlayState* play); void EnSkj_TurnPlayer(EnSkj* this, Player* player); -void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForOcarina(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_FailedMiniGame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WonOcarinaMiniGame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitToGiveReward(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_GiveOcarinaGameReward(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_FinishOcarinaGameRound(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForNextRound(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForOfferResponse(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_CleanupOcarinaGame(EnSkj* this, GlobalContext* globalCtx); +void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play); +void EnSkj_StartOcarinaMinigame(EnSkj* this, PlayState* play); +void EnSkj_WaitForOcarina(EnSkj* this, PlayState* play); +void EnSkj_WaitForPlayback(EnSkj* this, PlayState* play); +void EnSkj_FailedMiniGame(EnSkj* this, PlayState* play); +void EnSkj_WonOcarinaMiniGame(EnSkj* this, PlayState* play); +void EnSkj_WaitToGiveReward(EnSkj* this, PlayState* play); +void EnSkj_GiveOcarinaGameReward(EnSkj* this, PlayState* play); +void EnSkj_FinishOcarinaGameRound(EnSkj* this, PlayState* play); +void EnSkj_WaitForNextRound(EnSkj* this, PlayState* play); +void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play); +void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play); +void EnSkj_CleanupOcarinaGame(EnSkj* this, PlayState* play); -void EnSkj_Fade(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitToShootNeedle(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForDeathAnim(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_PickNextFightAction(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForLandAnim(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_ResetFight(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_NeedleRecover(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SpawnDeathEffect(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_AfterSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SariaSongTalk(EnSkj* this, GlobalContext* globalCtx); -void func_80AFFE44(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_ChangeModeAfterSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_StartMaskTrade(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForLanding(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForLandAnimFinish(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WalkToPlayer(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_AskForMask(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_TakeMask(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForMaskTextClear(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WrongSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SariasSongWaitForTextClear(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_OcarinaGameIdle(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_PlayOcarinaGame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx); +void EnSkj_Fade(EnSkj* this, PlayState* play); +void EnSkj_WaitToShootNeedle(EnSkj* this, PlayState* play); +void EnSkj_SariasSongKidIdle(EnSkj* this, PlayState* play); +void EnSkj_WaitForDeathAnim(EnSkj* this, PlayState* play); +void EnSkj_PickNextFightAction(EnSkj* this, PlayState* play); +void EnSkj_WaitForLandAnim(EnSkj* this, PlayState* play); +void EnSkj_ResetFight(EnSkj* this, PlayState* play); +void EnSkj_Fight(EnSkj* this, PlayState* play); +void EnSkj_NeedleRecover(EnSkj* this, PlayState* play); +void EnSkj_SpawnDeathEffect(EnSkj* this, PlayState* play); +void EnSkj_WaitInRange(EnSkj* this, PlayState* play); +void EnSkj_WaitForSong(EnSkj* this, PlayState* play); +void EnSkj_AfterSong(EnSkj* this, PlayState* play); +void EnSkj_SariaSongTalk(EnSkj* this, PlayState* play); +void func_80AFFE44(EnSkj* this, PlayState* play); +void EnSkj_ChangeModeAfterSong(EnSkj* this, PlayState* play); +void EnSkj_StartMaskTrade(EnSkj* this, PlayState* play); +void EnSkj_WaitForLanding(EnSkj* this, PlayState* play); +void EnSkj_WaitForLandAnimFinish(EnSkj* this, PlayState* play); +void EnSkj_WalkToPlayer(EnSkj* this, PlayState* play); +void EnSkj_AskForMask(EnSkj* this, PlayState* play); +void EnSkj_TakeMask(EnSkj* this, PlayState* play); +void EnSkj_WaitForMaskTextClear(EnSkj* this, PlayState* play); +void EnSkj_WrongSong(EnSkj* this, PlayState* play); +void EnSkj_SariasSongWaitForTextClear(EnSkj* this, PlayState* play); +void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, PlayState* play); +void EnSkj_OcarinaGameIdle(EnSkj* this, PlayState* play); +void EnSkj_PlayOcarinaGame(EnSkj* this, PlayState* play); +void EnSkj_LeaveOcarinaGame(EnSkj* this, PlayState* play); -void EnSkj_SpawnBlood(GlobalContext* globalCtx, Vec3f* pos); +void EnSkj_SpawnBlood(PlayState* play, Vec3f* pos); void EnSkj_SetupWaitInRange(EnSkj* this); @@ -361,10 +361,10 @@ void EnSkj_SetNaviId(EnSkj* this) { } } -void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnSkj_Init(Actor* thisx, PlayState* play2) { s16 type = (thisx->params >> 0xA) & 0x3F; EnSkj* this = (EnSkj*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 pad; Player* player; @@ -378,7 +378,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.update = EnSkj_SariasSongShortStumpUpdate; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); break; case 6: // Invisible on the short stump (ocarina game) @@ -389,7 +389,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.update = EnSkj_OcarinaMinigameShortStumpUpdate; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); this->actor.focus.pos.x = 1230.0f; this->actor.focus.pos.y = -90.0f; this->actor.focus.pos.z = 450.0f; @@ -406,12 +406,12 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { } EnSkj_SetNaviId(this); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSkullKidSkel, &gSkullKidPlayFluteAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, &gSkullKidPlayFluteAnim, this->jointTable, this->morphTable, 19); if ((type >= 0) && (type < 3)) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); } if ((type < 0) || (type >= 7)) { @@ -433,8 +433,8 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 10; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &D_80B01678); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &D_80B01678); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); Actor_SetScale(thisx, 0.01f); this->actor.textId = this->textId = 0; @@ -447,7 +447,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.gravity = -1.0f; EnSkj_CalculateCenter(this); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); osSyncPrintf("Player_X : %f\n", player->actor.world.pos.x); osSyncPrintf("Player_Z : %f\n", player->actor.world.pos.z); osSyncPrintf("World_X : %f\n", this->actor.world.pos.x); @@ -459,11 +459,11 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnSkj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnSkj* this = (EnSkj*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 EnSkj_RangeCheck(Player* player, EnSkj* this) { @@ -489,7 +489,7 @@ f32 EnSkj_GetItemYRange(EnSkj* this) { return fabsf(sSmallStumpSkullKid.skullkid->actor.world.pos.y - this->actor.world.pos.y) + 10.0f; } -s32 EnSkj_ShootNeedle(EnSkj* this, GlobalContext* globalCtx) { +s32 EnSkj_ShootNeedle(EnSkj* this, PlayState* play) { s32 pad; Vec3f pos; Vec3f pos2; @@ -506,7 +506,7 @@ s32 EnSkj_ShootNeedle(EnSkj* this, GlobalContext* globalCtx) { pos2.z += this->actor.world.pos.z; pos2.y = this->actor.world.pos.y + 27.0f; - needle = (EnSkjneedle*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SKJNEEDLE, pos2.x, pos2.y, pos2.z, + needle = (EnSkjneedle*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SKJNEEDLE, pos2.x, pos2.y, pos2.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0); if (needle != NULL) { needle->killTimer = 100; @@ -516,7 +516,7 @@ s32 EnSkj_ShootNeedle(EnSkj* this, GlobalContext* globalCtx) { return 0; } -void EnSkj_SpawnBlood(GlobalContext* globalCtx, Vec3f* pos) { +void EnSkj_SpawnBlood(PlayState* play, Vec3f* pos) { EffectSparkInit effect; s32 sp20; @@ -572,10 +572,10 @@ void EnSkj_SpawnBlood(GlobalContext* globalCtx, Vec3f* pos) { effect.timer = 0; effect.duration = 8; - Effect_Add(globalCtx, &sp20, EFFECT_SPARK, 0, 1, &effect); + Effect_Add(play, &sp20, EFFECT_SPARK, 0, 1, &effect); } -s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx) { +s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play) { s16 yawDiff; Vec3f effectPos; @@ -587,8 +587,8 @@ s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx) { effectPos.y = this->collider.info.bumper.hitPos.y; effectPos.z = this->collider.info.bumper.hitPos.z; - EnSkj_SpawnBlood(globalCtx, &effectPos); - EffectSsHitMark_SpawnFixedScale(globalCtx, 1, &effectPos); + EnSkj_SpawnBlood(play, &effectPos); + EffectSsHitMark_SpawnFixedScale(play, 1, &effectPos); yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if ((this->action == 2) || (this->action == 6)) { @@ -624,12 +624,12 @@ s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx) { return 0; } -s32 func_80AFEDF8(EnSkj* this, GlobalContext* globalCtx) { +s32 func_80AFEDF8(EnSkj* this, PlayState* play) { s16 yawDiff; if (this->actor.xzDistToPlayer < this->unk_2EC) { this = this; - if (func_8002DDE4(globalCtx) != 0) { + if (func_8002DDE4(play) != 0) { return 1; } } @@ -651,11 +651,11 @@ void EnSkj_Backflip(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_FADE); } -void EnSkj_Fade(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_Fade(EnSkj* this, PlayState* play) { u32 alpha = this->alpha; if (this->unk_2D6 == 2) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; this->unk_2D6 = 0; } @@ -685,14 +685,14 @@ void EnSkj_SetupWaitToShootNeedle(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_WAIT_TO_SHOOT_NEEDLE); } -void EnSkj_WaitToShootNeedle(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitToShootNeedle(EnSkj* this, PlayState* play) { u8 val; s16 lastFrame = Animation_GetLastFrame(&gSkullKidShootNeedleAnim); if ((this->skelAnime.curFrame == lastFrame) && (this->needleShootTimer == 0)) { val = this->needlesToShoot; if (this->needlesToShoot != 0) { - EnSkj_ShootNeedle(this, globalCtx); + EnSkj_ShootNeedle(this, play); this->needleShootTimer = 4; val--; this->needlesToShoot = val; @@ -710,13 +710,13 @@ void EnSkj_SetupResetFight(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_IDLE); } -void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_SariasSongKidIdle(EnSkj* this, PlayState* play) { if (this->actor.params == 0) { if (!(gSaveContext.itemGetInf[1] & 0x40) && (this->actor.xzDistToPlayer < 200.0f)) { this->backflipFlag = 1; EnSkj_Backflip(this); } else if (sSmallStumpSkullKid.unk_0 != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (EnSkj_RangeCheck(player, sSmallStumpSkullKid.skullkid)) { EnSkj_SetupWaitInRange(this); player->stateFlags2 |= 0x800000; @@ -724,7 +724,7 @@ void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { } } } else { - if (func_80AFEDF8(this, globalCtx) != 0) { + if (func_80AFEDF8(this, play) != 0) { func_80AFF334(this); } } @@ -735,7 +735,7 @@ void EnSkj_SetupDie(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_WAIT_FOR_DEATH_ANIM); } -void EnSkj_WaitForDeathAnim(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForDeathAnim(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidDieAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -748,7 +748,7 @@ void func_80AFF1F0(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_PICK_NEXT_FIHGT_ACTION); } -void EnSkj_PickNextFightAction(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_PickNextFightAction(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidHitAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -768,7 +768,7 @@ void func_80AFF2A0(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_WAIT_FOR_LAND_ANIM); } -void EnSkj_WaitForLandAnim(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForLandAnim(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidLandAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -784,10 +784,10 @@ void func_80AFF334(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_RESET_FIGHT); } -void EnSkj_ResetFight(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_ResetFight(EnSkj* this, PlayState* play) { if (this->battleExitTimer == 0) { EnSkj_SetupResetFight(this); - } else if (func_80AFEDF8(this, globalCtx) != 0) { + } else if (func_80AFEDF8(this, play) != 0) { this->battleExitTimer = 600; EnSkj_SetupStand(this); } @@ -802,7 +802,7 @@ void EnSkj_SetupStand(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_FIGHT); } -void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_Fight(EnSkj* this, PlayState* play) { Vec3f pos1; Vec3f pos2; s32 pad[3]; @@ -836,7 +836,7 @@ void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = (yawDistToPlayer < 0) ? -(1.0f + phi_f14) : (1.0f + phi_f14); - } else if (func_80AFEDF8(this, globalCtx) != 0) { + } else if (func_80AFEDF8(this, play) != 0) { this->backflipFlag = 1; EnSkj_Backflip(this); } else { @@ -849,7 +849,7 @@ void EnSkj_SetupNeedleRecover(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_NEEDLE_RECOVER); } -void EnSkj_NeedleRecover(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_NeedleRecover(EnSkj* this, PlayState* play) { if (this->skelAnime.curFrame == 0.0f) { EnSkj_SetupStand(this); } @@ -860,7 +860,7 @@ void EnSkj_SetupSpawnDeathEffect(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SPAWN_DEATH_EFFECT); } -void EnSkj_SpawnDeathEffect(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_SpawnDeathEffect(EnSkj* this, PlayState* play) { Vec3f effectPos; Vec3f effectVel; Vec3f effectAccel; @@ -886,7 +886,7 @@ void EnSkj_SpawnDeathEffect(EnSkj* this, GlobalContext* globalCtx) { effectVel.y = 0.0f; effectVel.x = 0.0f; - EffectSsDeadDb_Spawn(globalCtx, &effectPos, &effectVel, &effectAccel, 100, 10, 255, 255, 255, 255, 0, 0, 255, 1, 9, + EffectSsDeadDb_Spawn(play, &effectPos, &effectVel, &effectAccel, 100, 10, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); } @@ -897,8 +897,8 @@ void EnSkj_SetupWaitInRange(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_IN_RANGE); } -void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitInRange(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); // When link pulls out the Ocarina center him on the stump // Link was probably supposed to be pointed towards skull kid as well @@ -909,13 +909,13 @@ void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx) { player->actor.world.pos.y = sSmallStumpSkullKid.skullkid->actor.world.pos.y; player->actor.world.pos.z = sSmallStumpSkullKid.skullkid->actor.world.pos.z; EnSkj_TurnPlayer(sSmallStumpSkullKid.skullkid, player); - func_8010BD88(globalCtx, OCARINA_ACTION_CHECK_SARIA); + func_8010BD88(play, OCARINA_ACTION_CHECK_SARIA); EnSkj_SetupWaitForSong(this); } else if (D_80B01EA0 != 0) { player->actor.world.pos.x = sSmallStumpSkullKid.skullkid->actor.world.pos.x; player->actor.world.pos.y = sSmallStumpSkullKid.skullkid->actor.world.pos.y; player->actor.world.pos.z = sSmallStumpSkullKid.skullkid->actor.world.pos.z; - if ((Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) && !(gSaveContext.itemGetInf[3] & 0x200)) { + if ((Player_GetMask(play) == PLAYER_MASK_SKULL) && !(gSaveContext.itemGetInf[3] & 0x200)) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); EnSkj_SetupMaskTrade(this); } else { @@ -927,18 +927,18 @@ void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx) { player->stateFlags2 |= 0x800000; if (gSaveContext.itemGetInf[1] & 0x40) { if (gSaveContext.itemGetInf[3] & 0x200) { - this->textId = Text_GetFaceReaction(globalCtx, 0x15); + this->textId = Text_GetFaceReaction(play, 0x15); if (this->textId == 0) { this->textId = 0x1020; } - } else if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { + } else if (Player_GetMask(play) == PLAYER_MASK_NONE) { this->textId = 0x10BC; - } else if (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) { + } else if (Player_GetMask(play) == PLAYER_MASK_SKULL) { this->textId = 0x101B; } else { - this->textId = Text_GetFaceReaction(globalCtx, 0x15); + this->textId = Text_GetFaceReaction(play, 0x15); } - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); } } } @@ -948,60 +948,60 @@ void EnSkj_SetupWaitForSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_SONG); } -void EnSkj_WaitForSong(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitForSong(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); // Played a song thats not Saria's song - if (!(gSaveContext.itemGetInf[1] & 0x40) && ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_FAIL) || - (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_FAIL_NO_TEXT))) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); + if (!(gSaveContext.itemGetInf[1] & 0x40) && ((play->msgCtx.msgMode == MSGMODE_OCARINA_FAIL) || + (play->msgCtx.msgMode == MSGMODE_OCARINA_FAIL_NO_TEXT))) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); EnSkj_SetupWrongSong(this); } else { - if ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) && (this->unk_2D6 == 0)) { + if ((play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) && (this->unk_2D6 == 0)) { this->unk_2D6 = 1; EnSkj_ChangeAnim(this, SKJ_ANIM_PLAY_FLUTE); - } else if ((this->unk_2D6 != 0) && (globalCtx->msgCtx.msgMode == MSGMODE_SONG_DEMONSTRATION_DONE)) { + } else if ((this->unk_2D6 != 0) && (play->msgCtx.msgMode == MSGMODE_SONG_DEMONSTRATION_DONE)) { this->unk_2D6 = 0; EnSkj_ChangeAnim(this, SKJ_ANIM_WAIT); } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + play->msgCtx.ocarinaMode = OCARINA_MODE_00; this->unk_2D6 = 0; EnSkj_ChangeAnim(this, SKJ_ANIM_WAIT); EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_IN_RANGE); - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { if (!(gSaveContext.itemGetInf[1] & 0x40)) { // Saria's song has been played for the first titme - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; func_80078884(NA_SE_SY_CORRECT_CHIME); player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); this->textId = 0x10BB; EnSkj_SetupAfterSong(this); } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_05; + play->msgCtx.ocarinaMode = OCARINA_MODE_05; } - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_02) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { player->stateFlags2 &= ~0x1000000; Actor_Kill(&this->actor); - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= 0x800000; } else { - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_05) { gSaveContext.sunsSongState = 0; if (gSaveContext.itemGetInf[1] & 0x40) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); this->textId = 0x10BD; EnSkj_SetupAfterSong(this); } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); EnSkj_SetupWrongSong(this); } } @@ -1015,11 +1015,11 @@ void EnSkj_SetupAfterSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_AFTER_SONG); } -void EnSkj_AfterSong(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_AfterSong(EnSkj* this, PlayState* play) { if (D_80B01EA0 != 0) { EnSkj_SetupTalk(this); } else { - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); } } @@ -1027,19 +1027,19 @@ void EnSkj_SetupTalk(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_TALK); } -void EnSkj_SariaSongTalk(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_SariaSongTalk(EnSkj* this, PlayState* play) { s32 pad; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (gSaveContext.itemGetInf[1] & 0x40) { EnSkj_SetupWaitInRange(this); } else { func_80AFFE24(this); if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); + func_8002F434(&this->actor, play, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_SKULL_KID, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); } } } @@ -1049,16 +1049,16 @@ void func_80AFFE24(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_UNK14); } -void func_80AFFE44(EnSkj* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AFFE44(EnSkj* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnSkj_SetupPostSariasSong(this); } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); + func_8002F434(&this->actor, play, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_SKULL_KID, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); } } } @@ -1067,8 +1067,8 @@ void EnSkj_SetupPostSariasSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_CHANGE_MODE); } -void EnSkj_ChangeModeAfterSong(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnSkj_ChangeModeAfterSong(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { gSaveContext.itemGetInf[1] |= 0x40; EnSkj_SetNaviId(this); EnSkj_SetupWaitInRange(this); @@ -1079,11 +1079,11 @@ void EnSkj_SetupMaskTrade(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_START_TRADE); } -void EnSkj_StartMaskTrade(EnSkj* this, GlobalContext* globalCtx) { - u8 sp1F = Message_GetState(&globalCtx->msgCtx); +void EnSkj_StartMaskTrade(EnSkj* this, PlayState* play) { + u8 sp1F = Message_GetState(&play->msgCtx); - func_8002DF54(globalCtx, &this->actor, 1); - if ((sp1F == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + func_8002DF54(play, &this->actor, 1); + if ((sp1F == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { EnSkj_JumpFromStump(this); } } @@ -1097,7 +1097,7 @@ void EnSkj_JumpFromStump(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_LANDING); } -void EnSkj_WaitForLanding(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForLanding(EnSkj* this, PlayState* play) { if (this->actor.velocity.y <= 0.0f) { if (this->actor.bgCheckFlags & 2) { this->actor.bgCheckFlags &= ~2; @@ -1112,7 +1112,7 @@ void EnSkj_SetupWaitForLandAnimFinish(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_LANDING_ANIM); } -void EnSkj_WaitForLandAnimFinish(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForLandAnimFinish(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidLandAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -1127,49 +1127,49 @@ void EnSkj_SetupWalkToPlayer(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WALK_TO_PLAYER); } -void EnSkj_WalkToPlayer(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WalkToPlayer(EnSkj* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, this->unk_2F0, 0); Math_ApproachF(&this->unk_2F0, 2000.0f, 1.0f, 100.0f); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 120.0f) { this->actor.speedXZ = 0.0f; - EnSkj_SetupAskForMask(this, globalCtx); + EnSkj_SetupAskForMask(this, play); } } -void EnSkj_SetupAskForMask(EnSkj* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, 0x101C, &this->actor); +void EnSkj_SetupAskForMask(EnSkj* this, PlayState* play) { + Message_StartTextbox(play, 0x101C, &this->actor); EnSkj_ChangeAnim(this, SKJ_ANIM_WAIT); EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_ASK_FOR_MASK); } -void EnSkj_AskForMask(EnSkj* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnSkj_AskForMask(EnSkj* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // Yes - EnSkj_SetupTakeMask(this, globalCtx); + EnSkj_SetupTakeMask(this, play); break; case 1: // No - Message_ContinueTextbox(globalCtx, 0x101D); + Message_ContinueTextbox(play, 0x101D); EnSkj_SetupWaitForMaskTextClear(this); break; } } } -void EnSkj_SetupTakeMask(EnSkj* this, GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x101E); +void EnSkj_SetupTakeMask(EnSkj* this, PlayState* play) { + Message_ContinueTextbox(play, 0x101E); EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_TAKE_MASK); } -void EnSkj_TakeMask(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnSkj_TakeMask(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { Rupees_ChangeBy(10); gSaveContext.itemGetInf[3] |= 0x200; EnSkj_SetNaviId(this); - Player_UnsetMask(globalCtx); - Item_Give(globalCtx, ITEM_SOLD_OUT); - Message_ContinueTextbox(globalCtx, 0x101F); + Player_UnsetMask(play); + Item_Give(play, ITEM_SOLD_OUT); + Message_ContinueTextbox(play, 0x101F); EnSkj_SetupWaitForMaskTextClear(this); } } @@ -1178,9 +1178,9 @@ void EnSkj_SetupWaitForMaskTextClear(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_MASK_TEXT); } -void EnSkj_WaitForMaskTextClear(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, &this->actor, 7); +void EnSkj_WaitForMaskTextClear(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { + func_8002DF54(play, &this->actor, 7); this->backflipFlag = 1; EnSkj_Backflip(this); } @@ -1192,11 +1192,11 @@ void EnSkj_SetupWrongSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WRONG_SONG); } -void EnSkj_WrongSong(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WrongSong(EnSkj* this, PlayState* play) { if (D_80B01EA0 != 0) { EnSkj_SetupWaitForTextClear(this); } else { - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); } } @@ -1204,11 +1204,11 @@ void EnSkj_SetupWaitForTextClear(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_TEXT); } -void EnSkj_SariasSongWaitForTextClear(EnSkj* this, GlobalContext* globalCtx) { - u8 state = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnSkj_SariasSongWaitForTextClear(EnSkj* this, PlayState* play) { + u8 state = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); - if (state == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { + if (state == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { EnSkj_SetupWaitInRange(this); player->stateFlags2 |= 0x800000; player->unk_6A8 = (Actor*)sSmallStumpSkullKid.skullkid; @@ -1221,7 +1221,7 @@ void EnSkj_OcarinaGameSetupWaitForPlayer(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_WAIT_FOR_PLAYER); } -void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, PlayState* play) { if (this->playerInRange) { this->actor.flags |= ACTOR_FLAG_0; EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_IDLE); @@ -1253,7 +1253,7 @@ void EnSkj_Appear(EnSkj* this) { } } -void EnSkj_OcarinaGameIdle(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_OcarinaGameIdle(EnSkj* this, PlayState* play) { EnSkj_Appear(this); if ((EnSkj_IsLeavingGame(this) == false) && (this->minigameState != 0)) { @@ -1266,7 +1266,7 @@ void EnSkj_SetupPlayOcarinaGame(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_PLAY); } -void EnSkj_PlayOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_PlayOcarinaGame(EnSkj* this, PlayState* play) { EnSkj_Appear(this); if (!EnSkj_IsLeavingGame(this) && (this->minigameState == 0)) { @@ -1281,7 +1281,7 @@ void EnSkj_SetupLeaveOcarinaGame(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_LEAVE); } -void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_LeaveOcarinaGame(EnSkj* this, PlayState* play) { s32 paramsDecr = this->actor.params - 1; sOcarinaMinigameSkullKids[paramsDecr].unk_0 = 0; @@ -1290,12 +1290,12 @@ void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { EnSkj_Backflip(this); } -void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_Update(Actor* thisx, PlayState* play) { Vec3f dropPos; s32 pad; EnSkj* this = (EnSkj*)thisx; - D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, globalCtx); + D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, play); this->timer++; @@ -1321,7 +1321,7 @@ void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx) { dropPos.y = this->actor.world.pos.y; dropPos.z = this->actor.world.pos.z; - Item_DropCollectible(globalCtx, &dropPos, ITEM00_RUPEE_ORANGE); + Item_DropCollectible(play, &dropPos, ITEM00_RUPEE_ORANGE); } Actor_Kill(&this->actor); return; @@ -1329,34 +1329,34 @@ void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 30.0f); Actor_SetScale(&this->actor, 0.01f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.textId = this->textId; - EnSkj_CollisionCheck(this, globalCtx); + EnSkj_CollisionCheck(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); if ((this->unk_2D3 != 0) && (D_80B01EA0 == 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 7); } -void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play) { EnSkj* this = (EnSkj*)thisx; - D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, globalCtx); + D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, play); if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } @@ -1366,8 +1366,8 @@ void EnSkj_TurnPlayer(EnSkj* this, Player* player) { player->currentYaw = player->actor.shape.rot.y; } -void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (EnSkj_RangeCheck(player, this)) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->playerInRange = true; @@ -1378,7 +1378,7 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; - Message_StartTextbox(globalCtx, 0x10BE, &this->actor); + Message_StartTextbox(play, 0x10BE, &this->actor); this->actionFunc = EnSkj_StartOcarinaMinigame; } else { this->actionFunc = EnSkj_WaitForOcarina; @@ -1386,29 +1386,29 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_WaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitForOcarina(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & 0x1000000) { player->stateFlags2 |= 0x2000000; func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; - Message_StartTextbox(globalCtx, 0x10BE, &this->actor); + Message_StartTextbox(play, 0x10BE, &this->actor); this->actionFunc = EnSkj_StartOcarinaMinigame; } else if (EnSkj_RangeCheck(player, this)) { player->stateFlags2 |= 0x800000; } } -void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx) { - u8 dialogState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnSkj_StartOcarinaMinigame(EnSkj* this, PlayState* play) { + u8 dialogState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); EnSkj_TurnPlayer(this, player); if (dialogState == TEXT_STATE_CLOSING) { - func_8010BD58(globalCtx, OCARINA_ACTION_MEMORY_GAME); + func_8010BD58(play, OCARINA_ACTION_MEMORY_GAME); if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_PLAY_NOTES; } @@ -1417,28 +1417,28 @@ void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitForPlayback(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnSkj_TurnPlayer(this, player); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { // failed the game - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { // failed the game + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); this->textId = 0x102D; this->actionFunc = EnSkj_FailedMiniGame; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0F) { // completed the game + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_0F) { // completed the game func_80078884(NA_SE_SY_CORRECT_CHIME); - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); this->textId = 0x10BF; this->actionFunc = EnSkj_WonOcarinaMiniGame; } else { // playing the game - switch (globalCtx->msgCtx.msgMode) { + switch (play->msgCtx.msgMode) { case MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT: if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT; @@ -1448,7 +1448,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCARINA_PLAY_NOTES; } - Message_UpdateOcarinaGame(globalCtx); + Message_UpdateOcarinaGame(play); } break; case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT: @@ -1456,7 +1456,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT; } if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) { - Message_UpdateOcarinaGame(globalCtx); + Message_UpdateOcarinaGame(play); this->songFailTimer = 160; } break; @@ -1465,10 +1465,10 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { this->songFailTimer--; } else { // took too long, game failed func_80078884(NA_SE_SY_OCARINA_ERROR); - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); this->textId = 0x102D; this->actionFunc = EnSkj_FailedMiniGame; } @@ -1482,40 +1482,40 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { this->songFailTimer = 160; Audio_OcaSetInstrument(6); // related instrument sound (flute?) Audio_OcaSetSongPlayback(OCARINA_SONG_MEMORY_GAME + 1, 1); - globalCtx->msgCtx.msgMode = MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING; - globalCtx->msgCtx.stateTimer = 2; + play->msgCtx.msgMode = MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING; + play->msgCtx.stateTimer = 2; } break; } } } -void EnSkj_FailedMiniGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_FailedMiniGame(EnSkj* this, PlayState* play) { if (D_80B01EA0) { this->actionFunc = EnSkj_WaitForNextRound; } else { - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); } } -void EnSkj_WaitForNextRound(EnSkj* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { - EnSkj_OfferNextRound(this, globalCtx); +void EnSkj_WaitForNextRound(EnSkj* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { + EnSkj_OfferNextRound(this, play); } } -void EnSkj_OfferNextRound(EnSkj* this, GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x102E); +void EnSkj_OfferNextRound(EnSkj* this, PlayState* play) { + Message_ContinueTextbox(play, 0x102E); this->actionFunc = EnSkj_WaitForOfferResponse; } -void EnSkj_WaitForOfferResponse(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play) { Player* player; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->stateFlags3 |= 0x20; // makes player take ocarina out right away after closing box this->actionFunc = EnSkj_SetupWaitForOcarina; break; @@ -1526,43 +1526,43 @@ void EnSkj_WaitForOfferResponse(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_WonOcarinaMiniGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WonOcarinaMiniGame(EnSkj* this, PlayState* play) { if (D_80B01EA0) { this->actionFunc = EnSkj_WaitToGiveReward; } else { - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); } } -void EnSkj_WaitToGiveReward(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnSkj_WaitToGiveReward(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (gSaveContext.n64ddFlag && gSaveContext.ocarinaGameRoundNum != 3) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_OCARINA_MEMORY_GAME, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 26.0f, 26.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 26.0f, 26.0f); } else { - func_8002F434(&this->actor, globalCtx, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); + func_8002F434(&this->actor, play, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); } this->actionFunc = EnSkj_GiveOcarinaGameReward; } } -void EnSkj_GiveOcarinaGameReward(EnSkj* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnSkj_GiveOcarinaGameReward(EnSkj* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnSkj_FinishOcarinaGameRound; } else { if (gSaveContext.n64ddFlag && gSaveContext.ocarinaGameRoundNum != 3) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_OCARINA_MEMORY_GAME, GI_HEART_PIECE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 26.0f, 26.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 26.0f, 26.0f); } else { - func_8002F434(&this->actor, globalCtx, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); + func_8002F434(&this->actor, play, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); } } } -void EnSkj_FinishOcarinaGameRound(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnSkj_FinishOcarinaGameRound(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { s32 ocarinaGameRoundNum = gSaveContext.ocarinaGameRoundNum; if (gSaveContext.ocarinaGameRoundNum < 3) { @@ -1577,12 +1577,12 @@ void EnSkj_FinishOcarinaGameRound(EnSkj* this, GlobalContext* globalCtx) { gSaveContext.itemGetInf[1] |= 0x80; this->actionFunc = EnSkj_CleanupOcarinaGame; } else { - EnSkj_OfferNextRound(this, globalCtx); + EnSkj_OfferNextRound(this, play); } } } -void EnSkj_CleanupOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_CleanupOcarinaGame(EnSkj* this, PlayState* play) { if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].unk_0 = 2; } @@ -1598,10 +1598,10 @@ void EnSkj_CleanupOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, PlayState* play) { EnSkj* this = (EnSkj*)thisx; - D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, globalCtx); + D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, play); this->timer++; this->actor.focus.pos.x = 1230.0f; @@ -1611,33 +1611,33 @@ void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, GlobalContext* globalCt if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.textId = this->textId; this->actor.xzDistToPlayer = 50.0; } -s32 EnSkj_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSkj_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return 0; } -void EnSkj_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnSkj_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { + OPEN_DISPS(play->state.gfxCtx); if ((limbIndex == 11) && (gSaveContext.itemGetInf[3] & 0x200)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Push(); Matrix_RotateZYX(-0x4000, 0, 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gSkullKidSkullMaskDL); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Gfx* EnSkj_TranslucentDL(GraphicsContext* gfxCtx, u32 alpha) { @@ -1665,22 +1665,22 @@ Gfx* EnSkj_OpaqueDL(GraphicsContext* gfxCtx, u32 alpha) { return dList; } -void EnSkj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_Draw(Actor* thisx, PlayState* play) { s32 pad; EnSkj* this = (EnSkj*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->alpha < 255) { - gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_TranslucentDL(globalCtx->state.gfxCtx, this->alpha)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_TranslucentDL(play->state.gfxCtx, this->alpha)); } else { - gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_OpaqueDL(globalCtx->state.gfxCtx, this->alpha)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_OpaqueDL(play->state.gfxCtx, this->alpha)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSkj_OverrideLimbDraw, EnSkj_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.h b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.h index 09b806de6..dc0f97cc9 100644 --- a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.h +++ b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.h @@ -6,7 +6,7 @@ struct EnSkj; -typedef void (*EnSkjActionFunc)(struct EnSkj*, GlobalContext*); +typedef void (*EnSkjActionFunc)(struct EnSkj*, PlayState*); typedef struct EnSkj { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/soh/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index 45763284e..e1bf69b1d 100644 --- a/soh/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/soh/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_9) -void EnSkjneedle_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSkjneedle_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSkjneedle_Init(Actor* thisx, PlayState* play); +void EnSkjneedle_Destroy(Actor* thisx, PlayState* play); +void EnSkjneedle_Update(Actor* thisx, PlayState* play); +void EnSkjneedle_Draw(Actor* thisx, PlayState* play); s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this); @@ -53,21 +53,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnSkjneedle_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSkjneedle_Init(Actor* thisx, PlayState* play) { EnSkjneedle* this = (EnSkjneedle*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 20.0f); thisx->flags &= ~ACTOR_FLAG_0; Actor_SetScale(&this->actor, 0.01f); } -void EnSkjneedle_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSkjneedle_Destroy(Actor* thisx, PlayState* play) { EnSkjneedle* this = (EnSkjneedle*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this) { @@ -78,9 +78,9 @@ s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this) { return 0; } -void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnSkjneedle_Update(Actor* thisx, PlayState* play2) { EnSkjneedle* this = (EnSkjneedle*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; this->unusedTimer1++; if (this->killTimer != 0) { @@ -91,22 +91,22 @@ void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { Actor_SetScale(&this->actor, 0.01f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 7); } } -void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSkjneedle_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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++, gSkullKidNeedleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 222cf1cfc..3a05dbfd9 100644 --- a/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -18,15 +18,15 @@ typedef enum { SSH_ANIM_UNK6 // Faster repeating version of ANIM_UNK0 } EnSshAnimation; -void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSsh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSsh_Init(Actor* thisx, PlayState* play); +void EnSsh_Destroy(Actor* thisx, PlayState* play); +void EnSsh_Update(Actor* thisx, PlayState* play); +void EnSsh_Draw(Actor* thisx, PlayState* play); -void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Drop(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Return(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Start(EnSsh* this, GlobalContext* globalCtx); +void EnSsh_Idle(EnSsh* this, PlayState* play); +void EnSsh_Drop(EnSsh* this, PlayState* play); +void EnSsh_Return(EnSsh* this, PlayState* play); +void EnSsh_Start(EnSsh* this, PlayState* play); #include "overlays/ovl_En_Ssh/ovl_En_Ssh.h" @@ -116,17 +116,17 @@ void EnSsh_SetupAction(EnSsh* this, EnSshActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnSsh_SpawnShockwave(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SpawnShockwave(EnSsh* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = this->actor.floorHeight; pos.z = this->actor.world.pos.z; - EffectSsBlast_SpawnWhiteCustomScale(globalCtx, &pos, &zeroVec, &zeroVec, 100, 220, 8); + EffectSsBlast_SpawnWhiteCustomScale(play, &pos, &zeroVec, &zeroVec, 100, 220, 8); } -s32 EnSsh_CreateBlureEffect(GlobalContext* globalCtx) { +s32 EnSsh_CreateBlureEffect(PlayState* play) { EffectBlureInit1 blureInit; u8 p1StartColor[] = { 255, 255, 255, 75 }; u8 p2StartColor[] = { 255, 255, 255, 75 }; @@ -146,11 +146,11 @@ s32 EnSsh_CreateBlureEffect(GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 3; - Effect_Add(globalCtx, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); return blureIdx; } -s32 EnSsh_CheckCeilingPos(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CheckCeilingPos(EnSsh* this, PlayState* play) { CollisionPoly* poly; s32 bgId; Vec3f posB; @@ -158,7 +158,7 @@ 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, + if (!BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &posB, &this->ceilingPos, &poly, false, false, true, true, &bgId)) { return false; } else { @@ -189,7 +189,7 @@ void EnSsh_AddBlureSpace(EnSsh* this) { EffectBlure_AddSpace(Effect_GetByIndex(this->blureIdx)); } -void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_InitColliders(EnSsh* this, PlayState* play) { ColliderCylinderInit* cylinders[6] = { &sCylinderInit1, &sCylinderInit1, &sCylinderInit1, &sCylinderInit2, &sCylinderInit2, &sCylinderInit2, }; @@ -197,8 +197,8 @@ void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { s32 pad; for (i = 0; i < ARRAY_COUNT(cylinders); i++) { - Collider_InitCylinder(globalCtx, &this->colCylinder[i]); - Collider_SetCylinder(globalCtx, &this->colCylinder[i], &this->actor, cylinders[i]); + Collider_InitCylinder(play, &this->colCylinder[i]); + Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); } this->colCylinder[0].info.bumper.dmgFlags = 0x0003F8E9; @@ -210,8 +210,8 @@ void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInfoInit); - Collider_InitJntSph(globalCtx, &this->colSph); - Collider_SetJntSph(globalCtx, &this->colSph, &this->actor, &sJntSphInit, this->colSphElements); + Collider_InitJntSph(play, &this->colSph); + Collider_SetJntSph(play, &this->colSph, &this->actor, &sJntSphInit, this->colSphElements); } f32 EnSsh_SetAnimation(EnSsh* this, s32 animIndex) { @@ -306,7 +306,7 @@ s32 EnSsh_Damaged(EnSsh* this) { } } -void EnSsh_Turn(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Turn(EnSsh* this, PlayState* play) { if (this->hitTimer != 0) { this->hitTimer--; } @@ -318,7 +318,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); } @@ -332,25 +332,25 @@ void EnSsh_Stunned(EnSsh* this, GlobalContext* globalCtx) { } } -void EnSsh_UpdateYaw(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_UpdateYaw(EnSsh* this, PlayState* play) { if (this->stunTimer != 0) { - EnSsh_Stunned(this, globalCtx); + EnSsh_Stunned(this, play); } else { - EnSsh_Turn(this, globalCtx); + EnSsh_Turn(this, play); } } -void EnSsh_Bob(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Bob(EnSsh* this, PlayState* play) { f32 bobVel = 0.5f; - if ((globalCtx->state.frames & 8) != 0) { + if ((play->state.frames & 8) != 0) { bobVel *= -1.0f; } Math_SmoothStepToF(&this->actor.velocity.y, bobVel, 0.4f, 1000.0f, 0.0f); } -s32 EnSsh_IsCloseToLink(EnSsh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnSsh_IsCloseToLink(EnSsh* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 yDist; if (this->stateFlags & SSH_STATE_GROUND_START) { @@ -430,9 +430,9 @@ void EnSsh_Sway(EnSsh* this) { } } -void EnSsh_CheckBodyStickHit(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_CheckBodyStickHit(EnSsh* this, PlayState* play) { ColliderInfo* info = &this->colCylinder[0].info; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { info->bumper.dmgFlags |= 2; @@ -445,7 +445,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; @@ -467,8 +467,8 @@ s32 EnSsh_CheckHitPlayer(EnSsh* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_ROLL); Audio_PlayActorSound2(&this->actor, NA_SE_VO_ST_ATTACK); - globalCtx->damagePlayer(globalCtx, -8); - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, -8); + func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->hitCount--; return true; } @@ -491,7 +491,7 @@ s32 EnSsh_CheckHitFront(EnSsh* this) { } } -s32 EnSsh_CheckHitBack(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CheckHitBack(EnSsh* this, PlayState* play) { ColliderCylinder* cyl = &this->colCylinder[0]; s32 hit = false; @@ -520,13 +520,13 @@ s32 EnSsh_CheckHitBack(EnSsh* this, GlobalContext* globalCtx) { return false; } -s32 EnSsh_CollisionCheck(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CollisionCheck(EnSsh* this, PlayState* play) { if (this->stunTimer == 0) { - EnSsh_CheckHitPlayer(this, globalCtx); + EnSsh_CheckHitPlayer(this, play); } if (EnSsh_CheckHitFront(this)) { return false; - } else if (globalCtx->actorCtx.unk_02 != 0) { + } else if (play->actorCtx.unk_02 != 0) { this->invincibilityTimer = 8; if (this->stunTimer == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); @@ -536,29 +536,29 @@ s32 EnSsh_CollisionCheck(EnSsh* this, GlobalContext* globalCtx) { this->stateFlags |= SSH_STATE_STUNNED; return false; } else { - return EnSsh_CheckHitBack(this, globalCtx); + return EnSsh_CheckHitBack(this, play); // Always returns false } } -void EnSsh_SetBodyCylinderAC(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetBodyCylinderAC(EnSsh* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[0]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[0].base); } -void EnSsh_SetLegsCylinderAC(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetLegsCylinderAC(EnSsh* this, PlayState* play) { s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (angleTowardsLink < 90 * (0x10000 / 360)) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[2].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[2].base); } else { Collider_UpdateCylinder(&this->actor, &this->colCylinder[1]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[1].base); } } -s32 EnSsh_SetCylinderOC(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_SetCylinderOC(EnSsh* this, PlayState* play) { Vec3f cyloffsets[] = { { 40.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, @@ -580,27 +580,27 @@ s32 EnSsh_SetCylinderOC(EnSsh* this, GlobalContext* globalCtx) { this->colCylinder[i + 3].dim.pos.x = cylPos.x; this->colCylinder[i + 3].dim.pos.y = cylPos.y; this->colCylinder[i + 3].dim.pos.z = cylPos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[i + 3].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder[i + 3].base); } return 1; } -void EnSsh_SetColliders(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetColliders(EnSsh* this, PlayState* play) { if (this->actor.colChkInfo.health == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colSph.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colSph.base); } else { if (this->hitTimer == 0) { - EnSsh_SetCylinderOC(this, globalCtx); + EnSsh_SetCylinderOC(this, play); } if (DECR(this->invincibilityTimer) == 0) { - EnSsh_SetBodyCylinderAC(this, globalCtx); - EnSsh_SetLegsCylinderAC(this, globalCtx); + EnSsh_SetBodyCylinderAC(this, play); + EnSsh_SetLegsCylinderAC(this, play); } } } -void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Init(Actor* thisx, PlayState* play) { f32 frameCount; s32 pad; EnSsh* this = (EnSsh*)thisx; @@ -616,13 +616,13 @@ void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) { return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_ssh_Skel_0052E0, NULL, this->jointTable, this->morphTable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_0052E0, NULL, this->jointTable, this->morphTable, 30); Animation_Change(&this->skelAnime, &object_ssh_Anim_000304, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP_INTERP, 0.0f); - this->blureIdx = EnSsh_CreateBlureEffect(globalCtx); - EnSsh_InitColliders(this, globalCtx); + this->blureIdx = EnSsh_CreateBlureEffect(play); + EnSsh_InitColliders(this, play); this->stateFlags = 0; this->hitCount = 0; - EnSsh_CheckCeilingPos(this, globalCtx); + EnSsh_CheckCeilingPos(this, play); if (this->actor.params != ENSSH_FATHER) { EnSsh_SetColliderScale(this, 0.5f, 1.0f); } else { @@ -633,36 +633,36 @@ void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) { EnSsh_SetupAction(this, EnSsh_Start); } -void EnSsh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnSsh* this = (EnSsh*)thisx; s32 i; - Effect_Delete(globalCtx, this->blureIdx); + Effect_Delete(play, this->blureIdx); for (i = 0; i < 6; i++) { - Collider_DestroyCylinder(globalCtx, &this->colCylinder[i]); + Collider_DestroyCylinder(play, &this->colCylinder[i]); } - Collider_DestroyJntSph(globalCtx, &this->colSph); + Collider_DestroyJntSph(play, &this->colSph); } -void EnSsh_Wait(EnSsh* this, GlobalContext* globalCtx) { - if (EnSsh_IsCloseToLink(this, globalCtx)) { +void EnSsh_Wait(EnSsh* this, PlayState* play) { + if (EnSsh_IsCloseToLink(this, play)) { EnSsh_SetDropAnimation(this); EnSsh_SetupAction(this, EnSsh_Drop); } else { - EnSsh_Bob(this, globalCtx); + EnSsh_Bob(this, play); } } -void EnSsh_Talk(EnSsh* this, GlobalContext* globalCtx) { - EnSsh_Bob(this, globalCtx); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnSsh_Talk(EnSsh* this, PlayState* play) { + EnSsh_Bob(this, play); + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnSsh_Idle; } } -void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnSsh_Idle(EnSsh* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnSsh_Talk; if (this->actor.params == ENSSH_FATHER) { gSaveContext.eventChkInf[9] |= 0x40; @@ -680,7 +680,7 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { if ((this->animTimer != 0) && (DECR(this->animTimer) == 0)) { EnSsh_SetAnimation(this, SSH_ANIM_WAIT); } - if (!EnSsh_IsCloseToLink(this, globalCtx)) { + if (!EnSsh_IsCloseToLink(this, play)) { EnSsh_SetReturnAnimation(this); EnSsh_SetupAction(this, EnSsh_Return); } else { @@ -688,9 +688,9 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_LAUGH); this->sfxTimer = 64; } - EnSsh_Bob(this, globalCtx); + EnSsh_Bob(this, play); if ((this->unkTimer == 0) && (this->animTimer == 0)) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0xD); + this->actor.textId = Text_GetFaceReaction(play, 0xD); if (this->actor.textId == 0) { if (this->actor.params == ENSSH_FATHER) { if (gSaveContext.inventory.gsTokens >= 50) { @@ -712,13 +712,13 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { this->actor.textId = 0x22; } } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void EnSsh_Land(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Land(EnSsh* this, PlayState* play) { if ((this->unkTimer != 0) && (DECR(this->unkTimer) == 0)) { EnSsh_SetAnimation(this, SSH_ANIM_WAIT); } @@ -732,15 +732,15 @@ void EnSsh_Land(EnSsh* this, GlobalContext* globalCtx) { } } -void EnSsh_Drop(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Drop(EnSsh* this, PlayState* play) { if ((this->unkTimer != 0) && (DECR(this->unkTimer) == 0)) { EnSsh_SetAnimation(this, SSH_ANIM_DROP); } - if (!EnSsh_IsCloseToLink(this, globalCtx)) { + if (!EnSsh_IsCloseToLink(this, play)) { EnSsh_SetReturnAnimation(this); EnSsh_SetupAction(this, EnSsh_Return); } else if (EnSsh_IsCloseToGround(this)) { - EnSsh_SpawnShockwave(this, globalCtx); + EnSsh_SpawnShockwave(this, play); EnSsh_SetLandAnimation(this); EnSsh_SetupAction(this, EnSsh_Land); } else if (DECR(this->sfxTimer) == 0) { @@ -749,13 +749,13 @@ void EnSsh_Drop(EnSsh* this, GlobalContext* globalCtx) { } } -void EnSsh_Return(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Return(EnSsh* this, PlayState* play) { f32 frameRatio = this->skelAnime.curFrame / (this->skelAnime.animLength - 1.0f); if (frameRatio == 1.0f) { EnSsh_SetReturnAnimation(this); } - if (EnSsh_IsCloseToLink(this, globalCtx)) { + if (EnSsh_IsCloseToLink(this, play)) { EnSsh_SetDropAnimation(this); EnSsh_SetupAction(this, EnSsh_Drop); } else if (EnSsh_IsCloseToHome(this)) { @@ -788,24 +788,24 @@ void EnSsh_UpdateColliderScale(EnSsh* this) { } } -void EnSsh_Start(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Start(EnSsh* this, PlayState* play) { if (!EnSsh_IsCloseToGround(this)) { EnSsh_SetupAction(this, EnSsh_Wait); - EnSsh_Wait(this, globalCtx); + EnSsh_Wait(this, play); } else { EnSsh_SetLandAnimation(this); this->stateFlags |= 4; EnSsh_SetupAction(this, EnSsh_Land); - EnSsh_Land(this, globalCtx); + EnSsh_Land(this, play); } } -void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Update(Actor* thisx, PlayState* play) { s32 pad; EnSsh* this = (EnSsh*)thisx; EnSsh_UpdateColliderScale(this); - if (EnSsh_CollisionCheck(this, globalCtx)) { + if (EnSsh_CollisionCheck(this, play)) { return; // EnSsh_CollisionCheck always returns false, so this never happens } if (this->stunTimer != 0) { @@ -813,10 +813,10 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { } else { SkelAnime_Update(&this->skelAnime); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 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); } @@ -824,11 +824,11 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->blinkState >= 3) { this->blinkState = 0; } - EnSsh_SetColliders(this, globalCtx); + EnSsh_SetColliders(this, play); Actor_SetFocus(&this->actor, 0.0f); } -s32 EnSsh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSsh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSsh* this = (EnSsh*)thisx; switch (limbIndex) { @@ -860,13 +860,13 @@ s32 EnSsh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnSsh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSsh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSsh* this = (EnSsh*)thisx; Collider_UpdateSpheres(limbIndex, &this->colSph); } -void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Draw(Actor* thisx, PlayState* play) { static void* blinkTex[] = { object_ssh_Tex_0007E0, object_ssh_Tex_000C60, @@ -875,11 +875,11 @@ void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnSsh* this = (EnSsh*)thisx; - EnSsh_CheckBodyStickHit(this, globalCtx); + EnSsh_CheckBodyStickHit(this, play); EnSsh_Sway(this); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->blinkState])); - CLOSE_DISPS(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSsh_OverrideLimbDraw, + CLOSE_DISPS(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSsh_OverrideLimbDraw, EnSsh_PostLimbDraw, &this->actor); } diff --git a/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h b/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h index 1cb04e59c..3060fb6fb 100644 --- a/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h +++ b/soh/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h @@ -6,7 +6,7 @@ struct EnSsh; -typedef void (*EnSshActionFunc)(struct EnSsh*, GlobalContext*); +typedef void (*EnSshActionFunc)(struct EnSsh*, PlayState*); typedef struct EnSsh { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_St/z_en_st.c b/soh/src/overlays/actors/ovl_En_St/z_en_st.c index 3346f8d80..0e7fc6d4d 100644 --- a/soh/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/soh/src/overlays/actors/ovl_En_St/z_en_st.c @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnSt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnSt_ReturnToCeiling(EnSt* this, GlobalContext* globalCtx); -void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx); -void EnSt_StartOnCeilingOrGround(EnSt* this, GlobalContext* globalCtx); -void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx); -void EnSt_Die(EnSt* this, GlobalContext* globalCtx); -void EnSt_BounceAround(EnSt* this, GlobalContext* globalCtx); -void EnSt_FinishBouncing(EnSt* this, GlobalContext* globalCtx); +void EnSt_Init(Actor* thisx, PlayState* play); +void EnSt_Destroy(Actor* thisx, PlayState* play); +void EnSt_Update(Actor* thisx, PlayState* play); +void EnSt_Draw(Actor* thisx, PlayState* play); +void EnSt_ReturnToCeiling(EnSt* this, PlayState* play); +void EnSt_MoveToGround(EnSt* this, PlayState* play); +void EnSt_StartOnCeilingOrGround(EnSt* this, PlayState* play); +void EnSt_WaitOnGround(EnSt* this, PlayState* play); +void EnSt_Die(EnSt* this, PlayState* play); +void EnSt_BounceAround(EnSt* this, PlayState* play); +void EnSt_FinishBouncing(EnSt* this, PlayState* play); #include "overlays/ovl_En_St/ovl_En_St.h" @@ -134,7 +134,7 @@ void EnSt_SetupAction(EnSt* this, EnStActionFunc actionFunc) { /** * Spawns `dustCnt` dust particles in a random pattern around the Skulltula */ -void EnSt_SpawnDust(EnSt* this, GlobalContext* globalCtx, s32 dustCnt) { +void EnSt_SpawnDust(EnSt* this, PlayState* play, s32 dustCnt) { Color_RGBA8 primColor = { 170, 130, 90, 255 }; Color_RGBA8 envColor = { 100, 60, 20, 0 }; Vec3f dustVel = { 0.0f, 0.0f, 0.0f }; @@ -150,11 +150,11 @@ void EnSt_SpawnDust(EnSt* this, GlobalContext* globalCtx, s32 dustCnt) { dustAccel.z = (Rand_ZeroOne() - 0.5f) * 4.0f; dustPos.x = this->actor.world.pos.x + (Math_SinS(yAngle) * 22.0f); dustPos.z = this->actor.world.pos.z + (Math_CosS(yAngle) * 22.0f); - func_8002836C(globalCtx, &dustPos, &dustVel, &dustAccel, &primColor, &envColor, 120, 40, 10); + func_8002836C(play, &dustPos, &dustVel, &dustAccel, &primColor, &envColor, 120, 40, 10); } } -void EnSt_SpawnBlastEffect(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SpawnBlastEffect(EnSt* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f blastPos; @@ -162,20 +162,20 @@ void EnSt_SpawnBlastEffect(EnSt* this, GlobalContext* globalCtx) { blastPos.y = this->actor.floorHeight; blastPos.z = this->actor.world.pos.z; - EffectSsBlast_SpawnWhiteCustomScale(globalCtx, &blastPos, &zeroVec, &zeroVec, 100, 220, 8); + EffectSsBlast_SpawnWhiteCustomScale(play, &blastPos, &zeroVec, &zeroVec, 100, 220, 8); } -void EnSt_SpawnDeadEffect(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SpawnDeadEffect(EnSt* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f firePos; firePos.x = this->actor.world.pos.x + ((Rand_ZeroOne() - 0.5f) * 60.0f); firePos.y = (this->actor.world.pos.y + 10.0f) + ((Rand_ZeroOne() - 0.5f) * 45.0f); firePos.z = this->actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 60.0f); - EffectSsDeadDb_Spawn(globalCtx, &firePos, &zeroVec, &zeroVec, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &firePos, &zeroVec, &zeroVec, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); } -s32 EnSt_CreateBlureEffect(GlobalContext* globalCtx) { +s32 EnSt_CreateBlureEffect(PlayState* play) { EffectBlureInit1 blureInit; u8 p1StartColor[] = { 255, 255, 255, 75 }; u8 p2StartColor[] = { 255, 255, 255, 75 }; @@ -195,7 +195,7 @@ s32 EnSt_CreateBlureEffect(GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 3; - Effect_Add(globalCtx, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); return blureIdx; } @@ -203,7 +203,7 @@ s32 EnSt_CreateBlureEffect(GlobalContext* globalCtx) { * Checks for the position of the ceiling above the Skulltula. * If no ceiling is found it is set to 1000 units above the Skulltula */ -s32 EnSt_CheckCeilingPos(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_CheckCeilingPos(EnSt* this, PlayState* play) { CollisionPoly* poly; s32 bgId; Vec3f checkPos; @@ -211,7 +211,7 @@ s32 EnSt_CheckCeilingPos(EnSt* this, GlobalContext* globalCtx) { checkPos.x = this->actor.world.pos.x; checkPos.y = this->actor.world.pos.y + 1000.0f; checkPos.z = this->actor.world.pos.z; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &checkPos, &this->ceilingPos, &poly, false, + if (!BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &checkPos, &this->ceilingPos, &poly, false, false, true, true, &bgId)) { return false; } @@ -273,7 +273,7 @@ void EnSt_SetDropAnimAndVel(EnSt* this) { /** * Initalizes the Skulltula's 6 cylinders, and sphere collider. */ -void EnSt_InitColliders(EnSt* this, GlobalContext* globalCtx) { +void EnSt_InitColliders(EnSt* this, PlayState* play) { ColliderCylinderInit* cylinders[6] = { &sCylinderInit, &sCylinderInit, &sCylinderInit, &sCylinderInit2, &sCylinderInit2, &sCylinderInit2, }; @@ -282,8 +282,8 @@ void EnSt_InitColliders(EnSt* this, GlobalContext* globalCtx) { s32 pad; for (i = 0; i < ARRAY_COUNT(cylinders); i++) { - Collider_InitCylinder(globalCtx, &this->colCylinder[i]); - Collider_SetCylinder(globalCtx, &this->colCylinder[i], &this->actor, cylinders[i]); + Collider_InitCylinder(play, &this->colCylinder[i]); + Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); } this->colCylinder[0].info.bumper.dmgFlags = 0x0003F8F9; @@ -295,13 +295,13 @@ void EnSt_InitColliders(EnSt* this, GlobalContext* globalCtx) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInit); - Collider_InitJntSph(globalCtx, &this->colSph); - Collider_SetJntSph(globalCtx, &this->colSph, &this->actor, &sJntSphInit, this->colSphItems); + Collider_InitJntSph(play, &this->colSph); + Collider_SetJntSph(play, &this->colSph, &this->actor, &sJntSphInit, this->colSphItems); } -void EnSt_CheckBodyStickHit(EnSt* this, GlobalContext* globalCtx) { +void EnSt_CheckBodyStickHit(EnSt* this, PlayState* play) { ColliderInfo* body = &this->colCylinder[0].info; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { body->bumper.dmgFlags |= 2; @@ -314,24 +314,24 @@ void EnSt_CheckBodyStickHit(EnSt* this, GlobalContext* globalCtx) { } } -void EnSt_SetBodyCylinderAC(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SetBodyCylinderAC(EnSt* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[0]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[0].base); } -void EnSt_SetLegsCylinderAC(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SetLegsCylinderAC(EnSt* this, PlayState* play) { s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (angleTowardsLink < 0x3FFC) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[2].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[2].base); } else { Collider_UpdateCylinder(&this->actor, &this->colCylinder[1]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[1].base); } } -s32 EnSt_SetCylinderOC(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_SetCylinderOC(EnSt* this, PlayState* play) { Vec3f cyloffsets[] = { { 40.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, @@ -353,30 +353,30 @@ s32 EnSt_SetCylinderOC(EnSt* this, GlobalContext* globalCtx) { this->colCylinder[i + 3].dim.pos.x = cylPos.x; this->colCylinder[i + 3].dim.pos.y = cylPos.y; this->colCylinder[i + 3].dim.pos.z = cylPos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[i + 3].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder[i + 3].base); } return true; } -void EnSt_UpdateCylinders(EnSt* this, GlobalContext* globalCtx) { +void EnSt_UpdateCylinders(EnSt* this, PlayState* play) { if ((this->actor.colChkInfo.health != 0) || (this->actionFunc == EnSt_FinishBouncing)) { if (DECR(this->gaveDamageSpinTimer) == 0) { - EnSt_SetCylinderOC(this, globalCtx); + EnSt_SetCylinderOC(this, play); } DECR(this->invulnerableTimer); DECR(this->takeDamageSpinTimer); if (this->invulnerableTimer == 0 && this->takeDamageSpinTimer == 0) { - EnSt_SetBodyCylinderAC(this, globalCtx); - EnSt_SetLegsCylinderAC(this, globalCtx); + EnSt_SetBodyCylinderAC(this, play); + EnSt_SetLegsCylinderAC(this, play); } } } -s32 EnSt_CheckHitLink(EnSt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnSt_CheckHitLink(EnSt* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 hit; s32 i; @@ -397,9 +397,9 @@ s32 EnSt_CheckHitLink(EnSt* this, GlobalContext* globalCtx) { } this->gaveDamageSpinTimer = 30; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); return true; } @@ -418,7 +418,7 @@ s32 EnSt_CheckHitFrontside(EnSt* this) { } } -s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) { ColliderCylinder* cyl = &this->colCylinder[0]; s32 flags = 0; // ac hit flags from colliders 0 and 1 s32 hit = false; @@ -459,7 +459,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE); return false; } - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; this->groundBounces = 3; this->deathTimer = 20; @@ -481,24 +481,24 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) { /** * Checks if the Skulltula's colliders have been hit, returns true if the hit has dealt damage to the Skulltula */ -s32 EnSt_CheckColliders(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_CheckColliders(EnSt* this, PlayState* play) { if (EnSt_CheckHitFrontside(this)) { // player has hit the front shield area of the Skulltula return false; } - if (globalCtx->actorCtx.unk_02 != 0) { + if (play->actorCtx.unk_02 != 0) { return true; } - if (EnSt_CheckHitBackside(this, globalCtx)) { + if (EnSt_CheckHitBackside(this, play)) { // player has hit the backside of the Skulltula return true; } if (this->stunTimer == 0 && this->takeDamageSpinTimer == 0) { // check if the Skulltula has hit link. - EnSt_CheckHitLink(this, globalCtx); + EnSt_CheckHitLink(this, play); } return false; } @@ -566,7 +566,7 @@ s32 EnSt_DecrStunTimer(EnSt* this) { * turning, and the actual turning to face away from the player, and then back to * face the player */ -void EnSt_UpdateYaw(EnSt* this, GlobalContext* globalCtx) { +void EnSt_UpdateYaw(EnSt* this, PlayState* play) { u16 yawDir = 0; Vec3s rot; s16 yawDiff; @@ -649,7 +649,7 @@ void EnSt_UpdateYaw(EnSt* this, GlobalContext* globalCtx) { * Checks to see if the Skulltula is done bouncing on the ground, * spawns dust particles as the Skulltula hits the ground */ -s32 EnSt_IsDoneBouncing(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_IsDoneBouncing(EnSt* this, PlayState* play) { if (this->actor.velocity.y > 0.0f || this->groundBounces == 0) { // the Skulltula is moving upwards or the groundBounces is 0 return false; @@ -661,7 +661,7 @@ s32 EnSt_IsDoneBouncing(EnSt* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); - EnSt_SpawnDust(this, globalCtx, 10); + EnSt_SpawnDust(this, play, 10); // creates an elastic bouncing effect, boucing up less for each hit on the ground. this->actor.velocity.y = 6.0f / (4 - this->groundBounces); this->groundBounces--; @@ -674,17 +674,17 @@ s32 EnSt_IsDoneBouncing(EnSt* this, GlobalContext* globalCtx) { return true; } -void EnSt_Bob(EnSt* this, GlobalContext* globalCtx) { +void EnSt_Bob(EnSt* this, PlayState* play) { f32 ySpeedTarget = 0.5f; - if ((globalCtx->state.frames & 8) != 0) { + if ((play->state.frames & 8) != 0) { ySpeedTarget *= -1.0f; } Math_SmoothStepToF(&this->actor.velocity.y, ySpeedTarget, 0.4f, 1000.0f, 0.0f); } -s32 EnSt_IsCloseToPlayer(EnSt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnSt_IsCloseToPlayer(EnSt* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 yDist; if (this->takeDamageSpinTimer != 0) { @@ -775,15 +775,15 @@ void EnSt_Sway(EnSt* this) { } } -void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Init(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_0); - this->blureIdx = EnSt_CreateBlureEffect(globalCtx); - EnSt_InitColliders(this, globalCtx); + this->blureIdx = EnSt_CreateBlureEffect(play); + EnSt_InitColliders(this, play); if (thisx->params == 2) { this->actor.flags |= ACTOR_FLAG_7; } @@ -792,7 +792,7 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { } else { this->actor.naviEnemyId = 0x04; } - EnSt_CheckCeilingPos(this, globalCtx); + EnSt_CheckCeilingPos(this, play); this->actor.flags |= ACTOR_FLAG_14; this->actor.flags |= ACTOR_FLAG_24; EnSt_SetColliderScale(this); @@ -801,23 +801,23 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { EnSt_SetupAction(this, EnSt_StartOnCeilingOrGround); } -void EnSt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Destroy(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; s32 i; - Effect_Delete(globalCtx, this->blureIdx); + Effect_Delete(play, this->blureIdx); for (i = 0; i < 6; i++) { - Collider_DestroyCylinder(globalCtx, &this->colCylinder[i]); + Collider_DestroyCylinder(play, &this->colCylinder[i]); } - Collider_DestroyJntSph(globalCtx, &this->colSph); + Collider_DestroyJntSph(play, &this->colSph); } -void EnSt_WaitOnCeiling(EnSt* this, GlobalContext* globalCtx) { - if (EnSt_IsCloseToPlayer(this, globalCtx)) { +void EnSt_WaitOnCeiling(EnSt* this, PlayState* play) { + if (EnSt_IsCloseToPlayer(this, play)) { EnSt_SetDropAnimAndVel(this); EnSt_SetupAction(this, EnSt_MoveToGround); } else { - EnSt_Bob(this, globalCtx); + EnSt_Bob(this, play); } } @@ -825,7 +825,7 @@ void EnSt_WaitOnCeiling(EnSt* this, GlobalContext* globalCtx) { * Skulltula is waiting on the ground for the player to move away, or for * a collider to have contact */ -void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_WaitOnGround(EnSt* this, PlayState* play) { if (this->takeDamageSpinTimer != 0) { this->takeDamageSpinTimer--; if (this->takeDamageSpinTimer == 0) { @@ -840,7 +840,7 @@ void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) { } } - if (!EnSt_IsCloseToPlayer(this, globalCtx)) { + if (!EnSt_IsCloseToPlayer(this, play)) { // Player is no longer within range, return to ceiling. EnSt_SetReturnToCeilingAnimation(this); EnSt_SetupAction(this, EnSt_ReturnToCeiling); @@ -854,10 +854,10 @@ void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) { } // simply bob up and down. - EnSt_Bob(this, globalCtx); + EnSt_Bob(this, play); } -void EnSt_LandOnGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_LandOnGround(EnSt* this, PlayState* play) { if (this->animFrames != 0) { this->animFrames--; if (this->animFrames == 0) { @@ -887,7 +887,7 @@ void EnSt_LandOnGround(EnSt* this, GlobalContext* globalCtx) { } } -void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_MoveToGround(EnSt* this, PlayState* play) { if (this->takeDamageSpinTimer != 0) { this->takeDamageSpinTimer--; if (this->takeDamageSpinTimer == 0) { @@ -895,13 +895,13 @@ void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) { } } - if (!EnSt_IsCloseToPlayer(this, globalCtx)) { + if (!EnSt_IsCloseToPlayer(this, play)) { // the player moved out of range, return to the ceiling. EnSt_SetReturnToCeilingAnimation(this); EnSt_SetupAction(this, EnSt_ReturnToCeiling); } else if (EnSt_IsCloseToGround(this)) { // The Skulltula has become close to the ground. - EnSt_SpawnBlastEffect(this, globalCtx); + EnSt_SpawnBlastEffect(this, play); EnSt_SetLandAnimation(this); EnSt_SetupAction(this, EnSt_LandOnGround); } else if (DECR(this->sfxTimer) == 0) { @@ -910,14 +910,14 @@ void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) { } } -void EnSt_ReturnToCeiling(EnSt* this, GlobalContext* globalCtx) { +void EnSt_ReturnToCeiling(EnSt* this, PlayState* play) { f32 animPctDone = this->skelAnime.curFrame / (this->skelAnime.animLength - 1.0f); if (animPctDone == 1.0f) { EnSt_SetReturnToCeilingAnimation(this); } - if (EnSt_IsCloseToPlayer(this, globalCtx)) { + if (EnSt_IsCloseToPlayer(this, play)) { // player came back into range EnSt_SetDropAnimAndVel(this); EnSt_SetupAction(this, EnSt_MoveToGround); @@ -934,13 +934,13 @@ void EnSt_ReturnToCeiling(EnSt* this, GlobalContext* globalCtx) { /** * The Skulltula has been killed, bounce around */ -void EnSt_BounceAround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_BounceAround(EnSt* this, PlayState* play) { this->actor.colorFilterTimer = this->deathTimer; func_8002D868(&this->actor); this->actor.world.rot.x += 0x800; this->actor.world.rot.z -= 0x800; this->actor.shape.rot = this->actor.world.rot; - if (EnSt_IsDoneBouncing(this, globalCtx)) { + if (EnSt_IsDoneBouncing(this, play)) { this->actor.shape.yOffset = 400.0f; this->actor.speedXZ = 1.0f; this->actor.gravity = -2.0f; @@ -953,7 +953,7 @@ void EnSt_BounceAround(EnSt* this, GlobalContext* globalCtx) { /** * Finish up the bouncing animation, and rotate towards the final position */ -void EnSt_FinishBouncing(EnSt* this, GlobalContext* globalCtx) { +void EnSt_FinishBouncing(EnSt* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if (DECR(this->deathTimer) == 0) { @@ -976,41 +976,41 @@ void EnSt_FinishBouncing(EnSt* this, GlobalContext* globalCtx) { func_8002D868(&this->actor); this->groundBounces = 2; - EnSt_IsDoneBouncing(this, globalCtx); + EnSt_IsDoneBouncing(this, play); } /** * Spawn the enemy dying effects, and drop a random item */ -void EnSt_Die(EnSt* this, GlobalContext* globalCtx) { +void EnSt_Die(EnSt* this, PlayState* play) { if (DECR(this->finishDeathTimer) != 0) { - EnSt_SpawnDeadEffect(this, globalCtx); + EnSt_SpawnDeadEffect(this, play); } else { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } -void EnSt_StartOnCeilingOrGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_StartOnCeilingOrGround(EnSt* this, PlayState* play) { if (!EnSt_IsCloseToGround(this)) { this->rotAwayTimer = 60; EnSt_SetupAction(this, EnSt_WaitOnCeiling); - EnSt_WaitOnCeiling(this, globalCtx); + EnSt_WaitOnCeiling(this, play); } else { EnSt_SetLandAnimation(this); EnSt_SetupAction(this, EnSt_LandOnGround); - EnSt_LandOnGround(this, globalCtx); + EnSt_LandOnGround(this, play); } } -void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Update(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; s32 pad; Color_RGBA8 color = { 0, 0, 0, 0 }; if (this->actor.flags & ACTOR_FLAG_15) { SkelAnime_Update(&this->skelAnime); - } else if (!EnSt_CheckColliders(this, globalCtx)) { + } else if (!EnSt_CheckColliders(this, play)) { // no collision has been detected. if (this->stunTimer == 0) { @@ -1021,12 +1021,12 @@ void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D7EC(&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->stunTimer == 0) && (this->swayTimer == 0)) { // run the current action if the Skulltula isn't stunned // or swaying. - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } else if (this->stunTimer != 0) { // decrement the stun timer. EnSt_DecrStunTimer(this); @@ -1035,24 +1035,24 @@ void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { EnSt_Sway(this); } - EnSt_UpdateYaw(this, globalCtx); + EnSt_UpdateYaw(this, play); if (this->actionFunc == EnSt_WaitOnGround) { - if ((globalCtx->state.frames & 0x10) != 0) { + if ((play->state.frames & 0x10) != 0) { color.r = 255; } } EnSt_SetTeethColor(this, color.r, color.g, color.b, 8); - EnSt_UpdateCylinders(this, globalCtx); + EnSt_UpdateCylinders(this, play); Actor_SetFocus(&this->actor, 0.0f); } } -s32 EnSt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dListP, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dListP, Vec3f* pos, Vec3s* rot, void* thisx) { EnSt* this = (EnSt*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (limbIndex) { case 1: if (this->gaveDamageSpinTimer != 0 && this->swayTimer == 0) { @@ -1069,21 +1069,21 @@ s32 EnSt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dListP, gDPSetEnvColor(POLY_OPA_DISP++, this->teethR, this->teethG, this->teethB, 0); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return false; } -void EnSt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dListP, Vec3s* rot, void* thisx) { +void EnSt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dListP, Vec3s* rot, void* thisx) { EnSt* this = (EnSt*)thisx; Collider_UpdateSpheres(limbIndex, &this->colSph); } -void EnSt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Draw(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; - EnSt_CheckBodyStickHit(this, globalCtx); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSt_OverrideLimbDraw, + EnSt_CheckBodyStickHit(this, play); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSt_OverrideLimbDraw, EnSt_PostLimbDraw, this); } diff --git a/soh/src/overlays/actors/ovl_En_St/z_en_st.h b/soh/src/overlays/actors/ovl_En_St/z_en_st.h index d6feb1106..5b65c82e4 100644 --- a/soh/src/overlays/actors/ovl_En_St/z_en_st.h +++ b/soh/src/overlays/actors/ovl_En_St/z_en_st.h @@ -6,7 +6,7 @@ struct EnSt; -typedef void (*EnStActionFunc)(struct EnSt* this, GlobalContext* globalCtx); +typedef void (*EnStActionFunc)(struct EnSt* this, PlayState* play); typedef struct EnSt { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c index bfaf4188f..ed18e0956 100644 --- a/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -11,16 +11,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnSth_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Update2(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSth_Init(Actor* thisx, PlayState* play); +void EnSth_Destroy(Actor* thisx, PlayState* play); +void EnSth_Update(Actor* thisx, PlayState* play); +void EnSth_Update2(Actor* thisx, PlayState* play); +void EnSth_Draw(Actor* thisx, PlayState* play); -void EnSth_WaitForObjectLoaded(EnSth* this, GlobalContext* globalCtx); -void EnSth_ParentRewardObtainedWait(EnSth* this, GlobalContext* globalCtx); -void EnSth_RewardUnobtainedWait(EnSth* this, GlobalContext* globalCtx); -void EnSth_ChildRewardObtainedWait(EnSth* this, GlobalContext* globalCtx); +void EnSth_WaitForObjectLoaded(EnSth* this, PlayState* play); +void EnSth_ParentRewardObtainedWait(EnSth* this, PlayState* play); +void EnSth_RewardUnobtainedWait(EnSth* this, PlayState* play); +void EnSth_ChildRewardObtainedWait(EnSth* this, PlayState* play); const ActorInit En_Sth_InitVars = { ACTOR_EN_STH, @@ -97,7 +97,7 @@ void EnSth_SetupAction(EnSth* this, EnSthActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Init(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; s16 objectId; @@ -121,7 +121,7 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { objectId = sObjectIds[params]; if (objectId != 1) { - objectBankIdx = Object_GetIndex(&globalCtx->objectCtx, objectId); + objectBankIdx = Object_GetIndex(&play->objectCtx, objectId); } else { objectBankIdx = 0; } @@ -139,24 +139,24 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnSth_SetupShapeColliderUpdate2AndDraw(EnSth* this, GlobalContext* globalCtx) { +void EnSth_SetupShapeColliderUpdate2AndDraw(EnSth* this, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.update = EnSth_Update2; this->actor.draw = this->drawFunc; } -void EnSth_SetupAfterObjectLoaded(EnSth* this, GlobalContext* globalCtx) { +void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) { s32 pad; s16* params; - EnSth_SetupShapeColliderUpdate2AndDraw(this, globalCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objectBankIdx].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, + EnSth_SetupShapeColliderUpdate2AndDraw(this, play); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectBankIdx].segment); + SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]); @@ -169,27 +169,27 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, GlobalContext* globalCtx) { } } -void EnSth_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Destroy(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnSth_WaitForObjectLoaded(EnSth* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectBankIdx)) { +void EnSth_WaitForObjectLoaded(EnSth* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objectBankIdx)) { this->actor.objBankIndex = this->objectBankIdx; this->actionFunc = EnSth_SetupAfterObjectLoaded; } } -void EnSth_FacePlayer(EnSth* this, GlobalContext* globalCtx) { +void EnSth_FacePlayer(EnSth* this, PlayState* play) { s32 pad; s16 diffRot = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(diffRot) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); } else { if (diffRot < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 0x1838, 0x100); @@ -201,11 +201,11 @@ void EnSth_FacePlayer(EnSth* this, GlobalContext* globalCtx) { } } -void EnSth_LookAtPlayer(EnSth* this, GlobalContext* globalCtx) { +void EnSth_LookAtPlayer(EnSth* this, PlayState* play) { s16 diffRot = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(diffRot) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); @@ -214,30 +214,30 @@ void EnSth_LookAtPlayer(EnSth* this, GlobalContext* globalCtx) { } } -void EnSth_RewardObtainedTalk(EnSth* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnSth_RewardObtainedTalk(EnSth* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.params == 0) { EnSth_SetupAction(this, EnSth_ParentRewardObtainedWait); } else { EnSth_SetupAction(this, EnSth_ChildRewardObtainedWait); } } - EnSth_FacePlayer(this, globalCtx); + EnSth_FacePlayer(this, play); } -void EnSth_ParentRewardObtainedWait(EnSth* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnSth_ParentRewardObtainedWait(EnSth* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnSth_SetupAction(this, EnSth_RewardObtainedTalk); } else { this->actor.textId = 0x23; if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnSth_LookAtPlayer(this, globalCtx); + EnSth_LookAtPlayer(this, play); } -void EnSth_GivePlayerItem(EnSth* this, GlobalContext* globalCtx) { +void EnSth_GivePlayerItem(EnSth* this, PlayState* play) { u16 getItemId = sGetItemIds[this->actor.params]; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; @@ -280,34 +280,34 @@ void EnSth_GivePlayerItem(EnSth* this, GlobalContext* globalCtx) { } if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemId, 10000.0f, 50.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } -void EnSth_GiveReward(EnSth* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnSth_GiveReward(EnSth* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnSth_SetupAction(this, EnSth_RewardObtainedTalk); gSaveContext.eventChkInf[13] |= this->eventFlag; } else { - EnSth_GivePlayerItem(this, globalCtx); + EnSth_GivePlayerItem(this, play); } - EnSth_FacePlayer(this, globalCtx); + EnSth_FacePlayer(this, play); } -void EnSth_RewardUnobtainedTalk(EnSth* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnSth_RewardUnobtainedTalk(EnSth* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); EnSth_SetupAction(this, EnSth_GiveReward); - EnSth_GivePlayerItem(this, globalCtx); + EnSth_GivePlayerItem(this, play); } - EnSth_FacePlayer(this, globalCtx); + EnSth_FacePlayer(this, play); } -void EnSth_RewardUnobtainedWait(EnSth* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnSth_RewardUnobtainedWait(EnSth* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnSth_SetupAction(this, EnSth_RewardUnobtainedTalk); } else { if (this->actor.params == 0) { @@ -316,14 +316,14 @@ void EnSth_RewardUnobtainedWait(EnSth* this, GlobalContext* globalCtx) { this->actor.textId = 0x21; } if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnSth_LookAtPlayer(this, globalCtx); + EnSth_LookAtPlayer(this, play); } -void EnSth_ChildRewardObtainedWait(EnSth* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnSth_ChildRewardObtainedWait(EnSth* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnSth_SetupAction(this, EnSth_RewardObtainedTalk); } else { if (gSaveContext.inventory.gsTokens < 50) { @@ -332,30 +332,30 @@ void EnSth_ChildRewardObtainedWait(EnSth* this, GlobalContext* globalCtx) { this->actor.textId = 0x1F; } if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnSth_LookAtPlayer(this, globalCtx); + EnSth_LookAtPlayer(this, play); } -void EnSth_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Update(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnSth_Update2(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Update2(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 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); // Likely an unused blink timer and eye index if (DECR(this->unk_2B6) == 0) { @@ -367,7 +367,7 @@ void EnSth_Update2(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnSth_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSth* this = (EnSth*)thisx; s32 temp_v1; @@ -385,57 +385,57 @@ s32 EnSth_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { temp_v1 = limbIndex * 0x32; - rot->y += (Math_SinS(globalCtx->state.frames * (temp_v1 + 0x814)) * 200.0f); - rot->z += (Math_CosS(globalCtx->state.frames * (temp_v1 + 0x940)) * 200.0f); + rot->y += (Math_SinS(play->state.frames * (temp_v1 + 0x814)) * 200.0f); + rot->z += (Math_CosS(play->state.frames * (temp_v1 + 0x940)) * 200.0f); } return 0; } -void EnSth_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSth_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSth* this = (EnSth*)thisx; if (limbIndex == 15) { Matrix_MultVec3f(&D_80B0B49C, &this->actor.focus.pos); if (this->actor.params != 0) { // Children - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, D_80B0A3C0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -Gfx* EnSth_AllocColorDList(GraphicsContext* globalCtx, u8 envR, u8 envG, u8 envB, u8 envA) { +Gfx* EnSth_AllocColorDList(GraphicsContext* play, u8 envR, u8 envG, u8 envB, u8 envA) { Gfx* dList; - dList = Graph_Alloc(globalCtx, 2 * sizeof(Gfx)); + dList = Graph_Alloc(play, 2 * sizeof(Gfx)); gDPSetEnvColor(dList, envR, envG, envB, envA); gSPEndDisplayList(dList + 1); return dList; } -void EnSth_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Draw(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; Color_RGB8* envColor1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objectBankIdx].segment); - func_800943C8(globalCtx->state.gfxCtx); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectBankIdx].segment); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - EnSth_AllocColorDList(globalCtx->state.gfxCtx, sTunicColors[this->actor.params].r, + EnSth_AllocColorDList(play->state.gfxCtx, sTunicColors[this->actor.params].r, sTunicColors[this->actor.params].g, sTunicColors[this->actor.params].b, 255)); if (this->actor.params == 0) { - gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(globalCtx->state.gfxCtx, 190, 110, 0, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(play->state.gfxCtx, 190, 110, 0, 255)); } else { - gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(globalCtx->state.gfxCtx, 90, 110, 130, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(play->state.gfxCtx, 90, 110, 130, 255)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSth_OverrideLimbDraw, EnSth_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.h b/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.h index ce90fbfdd..dec16c4e1 100644 --- a/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.h +++ b/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.h @@ -6,7 +6,7 @@ struct EnSth; -typedef void (*EnSthActionFunc)(struct EnSth*, GlobalContext*); +typedef void (*EnSthActionFunc)(struct EnSth*, PlayState*); typedef struct EnSth { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c index efd271a59..e34b24ca9 100644 --- a/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -9,11 +9,11 @@ #define FLAGS ACTOR_FLAG_4 -void EnStream_Init(Actor* thisx, GlobalContext* globalCtx); -void EnStream_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnStream_Update(Actor* thisx, GlobalContext* globalCtx); -void EnStream_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx); +void EnStream_Init(Actor* thisx, PlayState* play); +void EnStream_Destroy(Actor* thisx, PlayState* play); +void EnStream_Update(Actor* thisx, PlayState* play); +void EnStream_Draw(Actor* thisx, PlayState* play); +void EnStream_WaitForPlayer(EnStream* this, PlayState* play); const ActorInit En_Stream_InitVars = { ACTOR_EN_STREAM, @@ -36,7 +36,7 @@ void EnStream_SetupAction(EnStream* this, EnStreamActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnStream_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Init(Actor* thisx, PlayState* play) { EnStream* this = (EnStream*)thisx; this->unk_150 = thisx->params & 0xFF; @@ -47,7 +47,7 @@ void EnStream_Init(Actor* thisx, GlobalContext* globalCtx) { EnStream_SetupAction(this, EnStream_WaitForPlayer); } -void EnStream_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Destroy(Actor* thisx, PlayState* play) { } // Checks if the player is in range of the vortex @@ -80,8 +80,8 @@ s32 func_80B0B81C(Vec3f* vortexPosRot, Vec3f* playerPosRot, Vec3f* posDifference return ret; } -void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnStream_SuckPlayer(EnStream* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad48; Vec3f posDifference; f32 xzDist; @@ -111,8 +111,8 @@ void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) { } } -void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnStream_WaitForPlayer(EnStream* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 pad; Vec3f temp; @@ -121,25 +121,25 @@ void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx) { } } -void EnStream_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Update(Actor* thisx, PlayState* play) { EnStream* this = (EnStream*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002F948(thisx, NA_SE_EV_WHIRLPOOL - SFX_FLAG); } -void EnStream_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Draw(Actor* thisx, PlayState* play) { u32 multipliedFrames; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); multipliedFrames = frames * 20; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 30, -multipliedFrames, 0x40, 0x40, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 30, -multipliedFrames, 0x40, 0x40, 1, multipliedFrames, -multipliedFrames, 0x40, 0x40)); gSPDisplayList(POLY_XLU_DISP++, object_stream_DL_000950); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.h b/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.h index 228fff4de..199d1c679 100644 --- a/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.h +++ b/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.h @@ -6,7 +6,7 @@ struct EnStream; -typedef void (*EnStreamActionFunc)(struct EnStream*, GlobalContext*); +typedef void (*EnStreamActionFunc)(struct EnStream*, PlayState*); typedef struct EnStream { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c index b67d735f9..901e33686 100644 --- a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -3,22 +3,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnSw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx); -s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx); -void func_80B0D364(EnSw* this, GlobalContext* globalCtx); -void func_80B0E5E0(EnSw* this, GlobalContext* globalCtx); -void func_80B0D590(EnSw* this, GlobalContext* globalCtx); -void func_80B0E90C(EnSw* this, GlobalContext* globalCtx); -void func_80B0E9BC(EnSw* this, GlobalContext* globalCtx); -void func_80B0E728(EnSw* this, GlobalContext* globalCtx); -void func_80B0DC7C(EnSw* this, GlobalContext* globalCtx); -s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32); -void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx); -void func_80B0DB00(EnSw* this, GlobalContext* globalCtx); -void func_80B0D878(EnSw* this, GlobalContext* globalCtx); +void EnSw_Init(Actor* thisx, PlayState* play); +void EnSw_Destroy(Actor* thisx, PlayState* play); +void EnSw_Update(Actor* thisx, PlayState* play); +void EnSw_Draw(Actor* thisx, PlayState* play); +s32 func_80B0DFFC(EnSw* this, PlayState* play); +void func_80B0D364(EnSw* this, PlayState* play); +void func_80B0E5E0(EnSw* this, PlayState* play); +void func_80B0D590(EnSw* this, PlayState* play); +void func_80B0E90C(EnSw* this, PlayState* play); +void func_80B0E9BC(EnSw* this, PlayState* play); +void func_80B0E728(EnSw* this, PlayState* play); +void func_80B0DC7C(EnSw* this, PlayState* play); +s32 func_80B0C0CC(EnSw* this, PlayState* play, s32); +void func_80B0D3AC(EnSw* this, PlayState* play); +void func_80B0DB00(EnSw* this, PlayState* play); +void func_80B0D878(EnSw* this, PlayState* play); const ActorInit En_Sw_InitVars = { ACTOR_EN_SW, @@ -115,26 +115,26 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) { //! @bug: Does not return. } -CollisionPoly* func_80B0C020(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32* arg4) { +CollisionPoly* func_80B0C020(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32* arg4) { CollisionPoly* sp3C; s32 pad; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, arg1, arg2, arg3, &sp3C, true, true, true, false, arg4)) { + if (!BgCheck_EntityLineTest1(&play->colCtx, arg1, arg2, arg3, &sp3C, true, true, true, false, arg4)) { return NULL; } - if (func_80041DB8(&globalCtx->colCtx, sp3C, *arg4) & 0x30) { + if (func_80041DB8(&play->colCtx, sp3C, *arg4) & 0x30) { return NULL; } - if (SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, sp3C, *arg4)) { + if (SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp3C, *arg4)) { return NULL; } return sp3C; } -s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80B0C0CC(EnSw* this, PlayState* play, s32 arg2) { CollisionPoly* temp_v0_2; CollisionPoly* temp_s1; Vec3f sp9C; @@ -156,13 +156,13 @@ s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { sp78.x -= this->unk_364.x * 18.0f; sp78.y -= this->unk_364.y * 18.0f; sp78.z -= this->unk_364.z * 18.0f; - temp_s1 = func_80B0C020(globalCtx, &sp84, &sp78, &sp90, &sp70); + temp_s1 = func_80B0C020(play, &sp84, &sp78, &sp90, &sp70); if ((temp_s1 != NULL) && (this->unk_360 == 0)) { sp78.x = sp84.x + (this->unk_37C.x * 24); sp78.y = sp84.y + (this->unk_37C.y * 24); sp78.z = sp84.z + (this->unk_37C.z * 24); - temp_v0_2 = func_80B0C020(globalCtx, &sp84, &sp78, &sp9C, &sp6C); + temp_v0_2 = func_80B0C020(play, &sp84, &sp78, &sp9C, &sp6C); if (temp_v0_2 != NULL) { if (arg2 == 1) { func_80B0BE20(this, temp_v0_2); @@ -193,7 +193,7 @@ s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { sp78.y = sp84.y - (this->unk_370.y * 24.0f); sp78.z = sp84.z - (this->unk_370.z * 24.0f); } - temp_v0_2 = func_80B0C020(globalCtx, &sp84, &sp78, &sp9C, &sp6C); + temp_v0_2 = func_80B0C020(play, &sp84, &sp78, &sp9C, &sp6C); if (temp_v0_2 != NULL) { if (arg2 == 1) { func_80B0BE20(this, temp_v0_2); @@ -213,7 +213,7 @@ s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { return sp64; } -void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Init(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; s32 phi_v0; Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; @@ -235,11 +235,11 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - SkelAnime_Init(globalCtx, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENSW_ANIM_0); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->sphs); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xE), &D_80B0F074); this->actor.scale.x = 0.02f; @@ -250,7 +250,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_484.y = this->actor.world.pos.y; this->unk_484.x = this->actor.world.pos.x + (Math_SinS(this->actor.world.rot.y) * -60.0f); this->unk_484.z = this->actor.world.pos.z + (Math_CosS(this->actor.world.rot.y) * -60.0f); - func_80B0DFFC(this, globalCtx); + func_80B0DFFC(this, play); this->actor.home.pos = this->actor.world.pos; } else { this->unk_370.x = Math_SinS(thisx->shape.rot.y + 0x4000); @@ -262,7 +262,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_37C.x = Math_SinS(thisx->shape.rot.y); this->unk_37C.y = 0.0f; this->unk_37C.z = Math_CosS(thisx->shape.rot.y); - func_80B0C0CC(this, globalCtx, 1); + func_80B0C0CC(this, play, 1); } if (((thisx->params & 0xE000) >> 0xD) >= 3) { @@ -285,7 +285,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; break; default: - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.naviEnemyId = 0x1F; break; } @@ -306,17 +306,17 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Destroy(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) { +s32 func_80B0C9F0(EnSw* this, PlayState* play) { s32 phi_v1 = false; if (this->actor.xyzDistToPlayerSq < SQ(400.0f) && ((this->actor.params & 0xE000) >> 0xD) == 0 && - globalCtx->actorCtx.unk_02 != 0) { + play->actorCtx.unk_02 != 0) { this->actor.colChkInfo.damage = this->actor.colChkInfo.health; phi_v1 = true; @@ -331,13 +331,13 @@ s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE); return true; } - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); if (((this->actor.params & 0xE000) >> 0xD) != 0) { if (CVar_GetS32("gGsCutscene", 0)) { - OnePointCutscene_Init(globalCtx, 2200, 90, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 2200, 90, &this->actor, MAIN_CAM); } this->skelAnime.playSpeed = 8.0f; - if ((globalCtx->state.frames & 1) == 0) { + if ((play->state.frames & 1) == 0) { this->unk_420 = 0.1f; } else { this->unk_420 = -0.1f; @@ -368,21 +368,21 @@ s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) { return false; } -void func_80B0CBE8(EnSw* this, GlobalContext* globalCtx) { +void func_80B0CBE8(EnSw* this, PlayState* play) { if ((((this->actor.params & 0xE000) >> 0xD) > 0) && (this->actionFunc != func_80B0D590)) { if (this->unk_392 != 0) { this->unk_392--; } } else { if ((DECR(this->unk_390) == 0) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((DECR(this->unk_392) == 0) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -432,9 +432,9 @@ s32 func_80B0CCF4(EnSw* this, f32* arg1) { return true; } -void func_80B0CEA8(EnSw* this, GlobalContext* globalCtx) { +void func_80B0CEA8(EnSw* this, PlayState* play) { if (!(this->actor.scale.x < 0.0139999995f)) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); + Camera* activeCam = GET_ACTIVE_CAM(play); if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &activeCam->eye) >= 380.0f)) { Audio_PlayActorSound2(&this->actor, ((this->actor.params & 0xE000) >> 0xD) > 0 ? NA_SE_EN_STALGOLD_ROLL @@ -443,7 +443,7 @@ void func_80B0CEA8(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0CF44(EnSw* this, GlobalContext* globalCtx, s32 cnt) { +void func_80B0CF44(EnSw* this, PlayState* play, s32 cnt) { Color_RGBA8 primColor = { 80, 80, 50, 255 }; Color_RGBA8 envColor = { 100, 100, 80, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -458,11 +458,11 @@ void func_80B0CF44(EnSw* this, GlobalContext* globalCtx, s32 cnt) { pos.x = this->actor.world.pos.x + (Math_SinS(angle) * 2.0f); pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z + (Math_CosS(angle) * 2.0f); - func_8002836C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 20, 30, 12); + func_8002836C(play, &pos, &velocity, &accel, &primColor, &envColor, 20, 30, 12); } } -void func_80B0D14C(EnSw* this, GlobalContext* globalCtx, s32 cnt) { +void func_80B0D14C(EnSw* this, PlayState* play, s32 cnt) { Color_RGBA8 primColor = { 80, 80, 50, 255 }; Color_RGBA8 envColor = { 100, 100, 80, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -477,11 +477,11 @@ void func_80B0D14C(EnSw* this, GlobalContext* globalCtx, s32 cnt) { pos.x = this->actor.world.pos.x + (Math_SinS(angle) * 14.0f); pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z + (Math_CosS(angle) * 14.0f); - func_8002836C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 20, 40, 10); + func_8002836C(play, &pos, &velocity, &accel, &primColor, &envColor, 20, 40, 10); } } -void func_80B0D364(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D364(EnSw* this, PlayState* play) { if (((this->actor.params & 0xE000) >> 0xD) == 4) { this->unk_38C = 0; this->actionFunc = func_80B0D3AC; @@ -491,15 +491,15 @@ void func_80B0D364(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D3AC(EnSw* this, PlayState* play) { if (this->unk_38C != 0) { if ((this->unk_38C & 4) != 0) { - func_80B0CF44(this, globalCtx, 5); + func_80B0CF44(this, play, 5); } this->unk_38C--; if (this->unk_38C == 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALGOLD_UP_CRY); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_DODO_M_UP); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALGOLD_UP_CRY); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_DODO_M_UP); } else { return; } @@ -520,9 +520,9 @@ void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx) { this->unk_360 = 0; } - if (func_80B0C0CC(this, globalCtx, 1) == 1) { + if (func_80B0C0CC(this, play, 1) == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); - func_80B0D14C(this, globalCtx, 8); + func_80B0D14C(this, play, 8); this->actor.scale.x = 0.02f; Actor_SetScale(&this->actor, 0.02f); this->actionFunc = func_80B0D590; @@ -532,7 +532,7 @@ void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D590(EnSw* this, PlayState* play) { f32 sp2C; if (((this->actor.params & 0xE000) >> 0xD) == 2) { @@ -555,8 +555,8 @@ void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { if (this->unk_38E != 0) { this->unk_38E--; if (this->unk_38E == 0) { - func_80B0CEA8(this, globalCtx); - this->unk_420 = ((globalCtx->state.frames % 2) == 0) ? 0.1f : -0.1f; + func_80B0CEA8(this, play); + this->unk_420 = ((play->state.frames % 2) == 0) ? 0.1f : -0.1f; this->unk_38A = 1; this->unk_38C = Rand_S16Offset(30, 60); if (((this->actor.params & 0xE000) >> 0xD) != 0) { @@ -578,7 +578,7 @@ void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = (this->unk_38A == 0) ? 4.0f : 0.0f; if (this->skelAnime.playSpeed > 0.0f) { - func_80B0CEA8(this, globalCtx); + func_80B0CEA8(this, play); } if (((this->actor.params & 0xE000) >> 0xD) != 0) { this->skelAnime.playSpeed *= 2.0f; @@ -596,7 +596,7 @@ void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D878(EnSw* this, PlayState* play) { Actor* temp_v0; Vec3f pos; Vec3f velAndAccel = { 0.0f, 0.5f, 0.0f }; @@ -605,7 +605,7 @@ void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { f32 z; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) == 1) { - func_80B0CEA8(this, globalCtx); + func_80B0CEA8(this, play); } func_80B0CCF4(this, &this->unk_420); @@ -616,7 +616,7 @@ void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { x = (this->unk_364.x * 10.0f); y = (this->unk_364.y * 10.0f); z = (this->unk_364.z * 10.0f); - temp_v0 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_SI, + temp_v0 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SI, this->actor.world.pos.x + x, this->actor.world.pos.y + y, this->actor.world.pos.z + z, 0, 0, 0, this->actor.params); if (temp_v0 != NULL) { @@ -631,16 +631,16 @@ void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { pos.y += 10.0f + ((Rand_ZeroOne() - 0.5f) * 6.0f); pos.x += (Rand_ZeroOne() - 0.5f) * 32.0f; pos.z += (Rand_ZeroOne() - 0.5f) * 32.0f; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, + EffectSsDeadDb_Spawn(play, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); } } -void func_80B0DB00(EnSw* this, GlobalContext* globalCtx) { +void func_80B0DB00(EnSw* this, PlayState* play) { Actor_MoveForward(&this->actor); this->actor.shape.rot.x += 0x1000; this->actor.shape.rot.z += 0x1000; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, 5); if ((this->actor.bgCheckFlags & 1) && (!(0.0f <= this->actor.velocity.y))) { if (this->actor.floorHeight <= BGCHECK_Y_MIN || this->actor.floorHeight >= 32000.0f) { @@ -658,11 +658,11 @@ void func_80B0DB00(EnSw* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 16.0f, 12, 2.0f, 120, 10, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 16.0f, 12, 2.0f, 120, 10, false); } } -void func_80B0DC7C(EnSw* this, GlobalContext* globalCtx) { +void func_80B0DC7C(EnSw* this, PlayState* play) { Vec3f velAndAccel = { 0.0f, 0.5f, 0.0f }; Vec3f pos = { 0.0f, 0.0f, 0.0f }; @@ -670,12 +670,12 @@ void func_80B0DC7C(EnSw* this, GlobalContext* globalCtx) { pos.y = ((Rand_ZeroOne() - 0.5f) * 6.0f) + (this->actor.world.pos.y + 10.0f); pos.x = ((Rand_ZeroOne() - 0.5f) * 32.0f) + this->actor.world.pos.x; pos.z = ((Rand_ZeroOne() - 0.5f) * 32.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, + EffectSsDeadDb_Spawn(play, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); this->actor.shape.rot.x += 0x1000; this->actor.shape.rot.z += 0x1000; } else { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x30); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x30); Actor_Kill(&this->actor); } } @@ -689,21 +689,21 @@ s16 func_80B0DE34(EnSw* this, Vec3f* arg1) { return pitch * (yaw >= 0 ? -1 : 1); } -s32 func_80B0DEA8(EnSw* this, GlobalContext* globalCtx, s32 arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B0DEA8(EnSw* this, PlayState* play, s32 arg2) { + Player* player = GET_PLAYER(play); CollisionPoly* sp58; s32 sp54; Vec3f sp48; if (!(player->stateFlags1 & 0x200000) && arg2) { return false; - } else if (func_8002DDF4(globalCtx) && arg2) { + } else if (func_8002DDF4(play) && arg2) { return false; } else if (ABS(func_80B0DE34(this, &player->actor.world.pos) - this->actor.shape.rot.z) >= 0x1FC2) { return false; } else if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &player->actor.world.pos) >= 130.0f) { return false; - } else if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp48, + } else if (!BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp48, &sp58, true, false, false, true, &sp54)) { return true; } else { @@ -711,7 +711,7 @@ s32 func_80B0DEA8(EnSw* this, GlobalContext* globalCtx, s32 arg2) { } } -s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx) { +s32 func_80B0DFFC(EnSw* this, PlayState* play) { s32 pad; CollisionPoly* sp60; s32 sp5C; @@ -721,25 +721,25 @@ s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx) { if (this->collider.base.ocFlags1 & OC1_HIT) { this->collider.base.acFlags &= ~AC_HIT; sp4C = false; - } else if (((globalCtx->state.frames % 4) == 0) && - !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_454, &sp50, &sp60, true, + } else if (((play->state.frames % 4) == 0) && + !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_454, &sp50, &sp60, true, false, false, true, &sp5C)) { sp4C = false; - } else if (((globalCtx->state.frames % 4) == 1) && - BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_460, &sp50, &sp60, true, + } else if (((play->state.frames % 4) == 1) && + BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_460, &sp50, &sp60, true, false, false, true, &sp5C)) { sp4C = false; - } else if (((globalCtx->state.frames % 4) == 2) && - !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_46C, &sp50, &sp60, true, + } else if (((play->state.frames % 4) == 2) && + !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_46C, &sp50, &sp60, true, false, false, true, &sp5C)) { sp4C = false; - } else if (((globalCtx->state.frames % 4) == 3) && - BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_478, &sp50, &sp60, true, + } else if (((play->state.frames % 4) == 3) && + BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_478, &sp50, &sp60, true, false, false, true, &sp5C)) { sp4C = false; } - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_484, &sp50, &this->unk_430, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_484, &sp50, &this->unk_430, true, false, false, true, &sp5C)) { this->actor.wallYaw = Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z) * (0x8000 / M_PI); this->actor.world.pos = sp50; @@ -782,7 +782,7 @@ void func_80B0E314(EnSw* this, Vec3f arg1, f32 arg4) { this->actor.world.pos.z += zDist; } -s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, GlobalContext* globalCtx) { +s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, PlayState* play) { Camera* activeCam; f32 lastFrame = Animation_GetLastFrame(&object_st_Anim_000304); @@ -797,7 +797,7 @@ s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, GlobalContext* globa return 0; } - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &activeCam->eye) < 380.0f) { if (DECR(this->unk_440) == 0) { @@ -815,39 +815,39 @@ s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, GlobalContext* globa return 0; } -void func_80B0E5E0(EnSw* this, GlobalContext* globalCtx) { +void func_80B0E5E0(EnSw* this, PlayState* play) { s32 pad[2]; f32 rand; - if (func_80B0E430(this, 6.0f, 0x3E8, 1, globalCtx)) { + if (func_80B0E430(this, 6.0f, 0x3E8, 1, play)) { rand = Rand_ZeroOne(); this->unk_444 = ((s16)(20000.0f * rand) + 0x2EE0) * (Rand_ZeroOne() >= 0.5f ? 1.0f : -1.0f) + this->actor.world.rot.z; this->unk_388 = Rand_S16Offset(10, 30); } - if ((DECR(this->unk_442) == 0) && (func_80B0DEA8(this, globalCtx, 1))) { + if ((DECR(this->unk_442) == 0) && (func_80B0DEA8(this, play, 1))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_LAUGH); this->unk_442 = 20; this->actionFunc = func_80B0E728; } } -void func_80B0E728(EnSw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B0E728(EnSw* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (DECR(this->unk_442) != 0) { - if (func_80B0DEA8(this, globalCtx, 1)) { + if (func_80B0DEA8(this, play, 1)) { this->unk_448 = player->actor.world.pos; this->unk_448.y += 30.0f; this->unk_444 = func_80B0DE34(this, &this->unk_448); - func_80B0E430(this, 6.0f, (u16)0xFA0, 0, globalCtx); + func_80B0E430(this, 6.0f, (u16)0xFA0, 0, play); } else { this->actionFunc = func_80B0E5E0; } } else { - if (!func_80B0DFFC(this, globalCtx)) { + if (!func_80B0DFFC(this, play)) { this->unk_442 = Rand_S16Offset(20, 10); this->unk_444 = func_80B0DE34(this, &this->actor.home.pos); this->unk_448 = this->actor.home.pos; @@ -860,14 +860,14 @@ void func_80B0E728(EnSw* this, GlobalContext* globalCtx) { this->unk_440 = 4; } - if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_448) > 13.0f) || func_8002DDF4(globalCtx)) { + if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_448) > 13.0f) || func_8002DDF4(play)) { this->actionFunc = func_80B0E90C; } } } } -void func_80B0E90C(EnSw* this, GlobalContext* globalCtx) { +void func_80B0E90C(EnSw* this, PlayState* play) { s32 pad; func_80B0E314(this, this->unk_448, 0.0f); @@ -878,10 +878,10 @@ void func_80B0E90C(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0E9BC(EnSw* this, GlobalContext* globalCtx) { +void func_80B0E9BC(EnSw* this, PlayState* play) { s32 pad; - if (func_80B0E430(this, 6.0f, 0x3E8, 0, globalCtx)) { + if (func_80B0E430(this, 6.0f, 0x3E8, 0, play)) { func_80B0E314(this, this->unk_448, 2.0f); if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_448) > 4.0f)) { this->actionFunc = func_80B0E5E0; @@ -889,16 +889,16 @@ void func_80B0E9BC(EnSw* this, GlobalContext* globalCtx) { } } -void EnSw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Update(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; SkelAnime_Update(&this->skelAnime); - func_80B0C9F0(this, globalCtx); - this->actionFunc(this, globalCtx); - func_80B0CBE8(this, globalCtx); + func_80B0C9F0(this, play); + this->actionFunc(this, play); + func_80B0CBE8(this, play); } -s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Vec3f sp7C = { 1400.0f, -2600.0f, -800.0f }; Vec3f sp70 = { 1400.0f, -1600.0f, 0.0f }; Vec3f sp64 = { -1400.0f, -2600.0f, -800.0f }; @@ -907,7 +907,7 @@ s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, EnSw* this = (EnSw*)thisx; Vec3f sp3C = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (((this->actor.params & 0xE000) >> 0xD) != 0) { switch (limbIndex) { @@ -962,18 +962,18 @@ s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return false; } -void EnSw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void func_80B0EDB8(GlobalContext* globalCtx, Color_RGBA8* arg1, s16 arg2, s16 arg3) { +void func_80B0EDB8(PlayState* play, Color_RGBA8* arg1, s16 arg2, s16 arg3) { f32 temp_f2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); temp_f2 = (11500.0f / arg3) * (arg3 - arg2); @@ -983,20 +983,20 @@ void func_80B0EDB8(GlobalContext* globalCtx, Color_RGBA8* arg1, s16 arg2, s16 ar POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, arg1->r, arg1->g, arg1->b, arg1->a, 0, (s16)temp_f2); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B0EEA4(GlobalContext* globalCtx) { +void func_80B0EEA4(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Draw(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; Color_RGBA8 sp30 = { 184, 0, 228, 255 }; @@ -1005,15 +1005,15 @@ void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health != 0) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); } - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); } else if (this->actionFunc == func_80B0E728) { - func_80B0EDB8(globalCtx, &sp30, 0x14, 0x1E); + func_80B0EDB8(play, &sp30, 0x14, 0x1E); } - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSw_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSw_OverrideLimbDraw, EnSw_PostLimbDraw, this); if (this->actionFunc == func_80B0E728) { - func_80B0EEA4(globalCtx); + func_80B0EEA4(play); } } diff --git a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.h b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.h index 452fc5e75..c766e9f9e 100644 --- a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -6,7 +6,7 @@ struct EnSw; -typedef void (*EnSwActionFunc)(struct EnSw* this, GlobalContext* globalCtx); +typedef void (*EnSwActionFunc)(struct EnSw* this, PlayState* play); typedef struct EnSw { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index 160394e62..ce9d38646 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -16,16 +16,16 @@ typedef enum { SYATEKI_ROUND_MAX } EnSyatekItemRound; -void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiItm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiItm_Update(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiItm_Init(Actor* thisx, PlayState* play); +void EnSyatekiItm_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiItm_Update(Actor* thisx, PlayState* play); -void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_EndGame(EnSyatekiItm* this, GlobalContext* globalCtx); +void EnSyatekiItm_Idle(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_StartRound(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_EndGame(EnSyatekiItm* this, PlayState* play); const ActorInit En_Syateki_Itm_InitVars = { ACTOR_EN_SYATEKI_ITM, @@ -68,12 +68,12 @@ static Vec3f sRupeePos[] = { { 20.0f, 0.0f, -60.0f }, { 40.0f, 0.0f, -60.0f }, }; -void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnSyatekiItm_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnSyatekiItm* this = (EnSyatekiItm*)thisx; s32 i; - this->man = (EnSyatekiMan*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_SYATEKI_MAN, + this->man = (EnSyatekiMan*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SYATEKI_MAN, 140.0f, 0.0f, 255.0f, 0, -0x4000, 0, 0); if (this->man == NULL) { // "Spawn error" @@ -83,7 +83,7 @@ void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx2) { } for (i = 0; i < 10; i++) { this->markers[i] = - (EnExRuppy*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_RUPPY, + (EnExRuppy*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_RUPPY, sRupeePos[i].x, sRupeePos[i].y, sRupeePos[i].z, 0, 0, 0, 4); if (this->markers[i] == NULL) { // "Second spawn error" @@ -96,12 +96,12 @@ void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnSyatekiItm_Idle; } -void EnSyatekiItm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiItm_Destroy(Actor* thisx, PlayState* play) { } -void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { +void EnSyatekiItm_Idle(EnSyatekiItm* this, PlayState* play) { s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->signal == ENSYATEKI_START) { player->actor.world.pos.x = -12.0f; @@ -110,7 +110,7 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = 0x7F03; player->actor.world.rot.x = player->actor.shape.rot.x = player->actor.world.rot.z = player->actor.shape.rot.z = 0; - func_8008EF44(globalCtx, 15); + func_8008EF44(play, 15); this->roundNum = this->hitCount = 0; for (i = 0; i < 6; i++) { this->roundFlags[i] = false; @@ -122,10 +122,10 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx) { +void EnSyatekiItm_StartRound(EnSyatekiItm* this, PlayState* play) { s32 i; s32 j; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unkTimer == 0) { if (LINK_IS_ADULT) { @@ -163,13 +163,13 @@ void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 i; s32 roundIdx; - if (globalCtx->shootingGalleryStatus == -1) { + if (play->shootingGalleryStatus == -1) { player->actor.freezeTimer = 10; this->signal = ENSYATEKI_END; this->actionFunc = EnSyatekiItm_CleanupGame; @@ -234,7 +234,7 @@ void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { for (i = 0; i < this->numTargets; i++) { this->targets[i] = (EnGSwitch*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_G_SWITCH, this->targetHome[i].x, + &play->actorCtx, &this->actor, play, ACTOR_EN_G_SWITCH, this->targetHome[i].x, this->targetHome[i].y, this->targetHome[i].z, 0, 0, 0, (ENGSWITCH_TARGET_RUPEE << 0xC) | 0x3F); if (this->targets[i] == NULL) { // "Rupee spawn error" @@ -271,12 +271,12 @@ void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s16 j; - if (globalCtx->shootingGalleryStatus == -1) { + if (play->shootingGalleryStatus == -1) { player->actor.freezeTimer = 10; this->signal = ENSYATEKI_END; this->actionFunc = EnSyatekiItm_CleanupGame; @@ -295,7 +295,7 @@ void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, GlobalContext* globalCtx) { +void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, PlayState* play) { s32 i; for (i = 0; i < 2; i++) { @@ -306,8 +306,8 @@ void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, GlobalContext* globalCtx) { this->actionFunc = EnSyatekiItm_EndGame; } -void EnSyatekiItm_EndGame(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSyatekiItm_EndGame(EnSyatekiItm* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.freezeTimer = 10; if (this->signal == ENSYATEKI_RESULTS) { @@ -331,11 +331,11 @@ void EnSyatekiItm_EndGame(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiItm_Update(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiItm* this = (EnSyatekiItm*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer != 0) { this->timer--; @@ -346,6 +346,6 @@ void EnSyatekiItm_Update(Actor* thisx, GlobalContext* globalCtx) { if (BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h index 11657fdb0..c7e01a776 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h +++ b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h @@ -6,7 +6,7 @@ struct EnSyatekiItm; -typedef void (*EnSyatekiItmActionFunc)(struct EnSyatekiItm*, GlobalContext*); +typedef void (*EnSyatekiItmActionFunc)(struct EnSyatekiItm*, PlayState*); typedef enum { /* 0 */ ENSYATEKI_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index c6709e144..3f1db6e49 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -20,22 +20,22 @@ typedef enum { /* 3 */ SYATEKI_TEXT_REFUSE } EnSyatekiManTextIdx; -void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiMan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiMan_Init(Actor* thisx, PlayState* play); +void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiMan_Update(Actor* thisx, PlayState* play); +void EnSyatekiMan_Draw(Actor* thisx, PlayState* play); -void EnSyatekiMan_Start(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_Idle(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_StopTalk(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_GivePrize(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_RestartGame(EnSyatekiMan* this, GlobalContext* globalCtx); +void EnSyatekiMan_Start(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Idle(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Talk(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_StopTalk(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_StartGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_EndGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_GivePrize(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play); void EnSyatekiMan_BlinkWait(EnSyatekiMan* this); void EnSyatekiMan_Blink(EnSyatekiMan* this); @@ -150,7 +150,7 @@ static s16 sTextIds[] = { 0x2B, 0x2E, 0xC8, 0x2D }; static s16 sTextBoxCount[] = { TEXT_STATE_CHOICE, TEXT_STATE_EVENT, TEXT_STATE_EVENT, TEXT_STATE_EVENT }; -void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiMan* this = (EnSyatekiMan*)thisx; @@ -159,7 +159,7 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 親父登場!!むほほほほほほほーん ☆☆☆☆☆ \n" VT_RST); this->actor.targetMode = 1; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, this->jointTable, this->morphTable, 9); if (!LINK_IS_ADULT) { this->headRot.z = 20; @@ -172,17 +172,17 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; } -void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play) { } -void EnSyatekiMan_Start(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_Start(EnSyatekiMan* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gObjectOssanAnim_000338); Animation_Change(&this->skelAnime, &gObjectOssanAnim_000338, 1.0f, 0.0f, (s16)lastFrame, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnSyatekiMan_SetupIdle; } -void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play) { if (this->gameResult == SYATEKI_RESULT_REFUSE) { this->textIdx = SYATEKI_TEXT_REFUSE; } @@ -192,25 +192,25 @@ void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, GlobalContext* globalCtx) { this->actionFunc = EnSyatekiMan_Idle; } -void EnSyatekiMan_Idle(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_Idle(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnSyatekiMan_Talk; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_Talk(EnSyatekiMan* this, PlayState* play) { s16 nextState = 0; SkelAnime_Update(&this->skelAnime); if (this->cameraHold) { - globalCtx->shootingGalleryStatus = -2; + play->shootingGalleryStatus = -2; } - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->textIdx == SYATEKI_TEXT_CHOICE) { - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees >= 20) { Rupees_ChangeBy(-20); @@ -229,9 +229,9 @@ void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx) { nextState = 2; break; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } switch (nextState) { case 0: @@ -247,36 +247,36 @@ void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_StopTalk(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_StopTalk(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->cameraHold) { - globalCtx->shootingGalleryStatus = -2; + play->shootingGalleryStatus = -2; } - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->cameraHold) { - OnePointCutscene_EndCutscene(globalCtx, this->csCam); + OnePointCutscene_EndCutscene(play, this->csCam); this->csCam = SUBCAM_NONE; this->cameraHold = false; } - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = EnSyatekiMan_SetupIdle; } } -void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_StartGame(EnSyatekiMan* this, PlayState* play) { EnSyatekiItm* gallery; SkelAnime_Update(&this->skelAnime); if (this->cameraHold) { - globalCtx->shootingGalleryStatus = -2; + play->shootingGalleryStatus = -2; } - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->cameraHold) { - OnePointCutscene_EndCutscene(globalCtx, this->csCam); + OnePointCutscene_EndCutscene(play, this->csCam); this->csCam = SUBCAM_NONE; this->cameraHold = false; } - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gallery = ((EnSyatekiItm*)this->actor.parent); if (gallery->actor.update != NULL) { gallery->signal = ENSYATEKI_START; @@ -285,13 +285,13 @@ void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, PlayState* play) { EnSyatekiItm* gallery; SkelAnime_Update(&this->skelAnime); gallery = ((EnSyatekiItm*)this->actor.parent); if ((gallery->actor.update != NULL) && (gallery->signal == ENSYATEKI_END)) { - this->csCam = OnePointCutscene_Init(globalCtx, 8002, -99, &this->actor, MAIN_CAM); + this->csCam = OnePointCutscene_Init(play, 8002, -99, &this->actor, MAIN_CAM); switch (gallery->hitCount) { case 10: this->gameResult = SYATEKI_RESULT_WINNER; @@ -305,28 +305,28 @@ void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx) { default: this->gameResult = SYATEKI_RESULT_FAILURE; this->actor.textId = 0x71AD; - if (globalCtx->shootingGalleryStatus == 15 + 1) { + if (play->shootingGalleryStatus == 15 + 1) { this->gameResult = SYATEKI_RESULT_REFUSE; this->actor.textId = 0x2D; } break; } - globalCtx->shootingGalleryStatus = -2; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + play->shootingGalleryStatus = -2; + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = EnSyatekiMan_EndGame; } } -void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_EndGame(EnSyatekiMan* this, PlayState* play) { EnSyatekiItm* gallery; SkelAnime_Update(&this->skelAnime); - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->gameResult != SYATEKI_RESULT_FAILURE) { - OnePointCutscene_EndCutscene(globalCtx, this->csCam); + OnePointCutscene_EndCutscene(play, this->csCam); this->csCam = SUBCAM_NONE; } - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gallery = ((EnSyatekiItm*)this->actor.parent); if (gallery->actor.update != NULL) { gallery->signal = ENSYATEKI_RESULTS; @@ -336,10 +336,10 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { this->tempGallery = this->actor.parent; this->actor.parent = NULL; if (!LINK_IS_ADULT) { - if(gSaveContext.n64ddFlag && !Flags_GetTreasure(globalCtx, 0x1E)) { + if(gSaveContext.n64ddFlag && !Flags_GetTreasure(play, 0x1E)) { this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_SHOOTING_GALLERY_REWARD, GI_BULLET_BAG_50); this->getItemId = this->getItemEntry.getItemId; - Flags_SetTreasure(globalCtx, 0x1E); + Flags_SetTreasure(play, 0x1E); } else if (!gSaveContext.n64ddFlag && !(gSaveContext.itemGetInf[0] & 0x2000)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ Equip_Pachinko ☆☆☆☆☆ %d\n" VT_RST, CUR_UPG_VALUE(UPG_BULLET_BAG)); @@ -353,10 +353,10 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { this->getItemId = GI_RUPEE_PURPLE; } } else { - if(gSaveContext.n64ddFlag && !Flags_GetTreasure(globalCtx, 0x1F)) { + if(gSaveContext.n64ddFlag && !Flags_GetTreasure(play, 0x1F)) { this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_SHOOTING_GALLERY_REWARD, GI_QUIVER_50); this->getItemId = this->getItemEntry.getItemId; - Flags_SetTreasure(globalCtx, 0x1F); + Flags_SetTreasure(play, 0x1F); } else if (!gSaveContext.n64ddFlag && !(gSaveContext.itemGetInf[0] & 0x4000)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ Equip_Bow ☆☆☆☆☆ %d\n" VT_RST, CUR_UPG_VALUE(UPG_QUIVER)); @@ -377,15 +377,15 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { } } if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 2000.0f, 1000.0f); } this->actionFunc = EnSyatekiMan_GivePrize; break; case SYATEKI_RESULT_ALMOST: this->timer = 20; - func_8008EF44(globalCtx, 15); + func_8008EF44(play, 15); this->actionFunc = EnSyatekiMan_RestartGame; break; default: @@ -395,7 +395,7 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { this->cameraHold = true; this->actor.textId = sTextIds[this->textIdx]; this->numTextBox = sTextBoxCount[this->textIdx]; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = EnSyatekiMan_Talk; } break; @@ -404,22 +404,22 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_GivePrize(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_GivePrize(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnSyatekiMan_FinishPrize; } else { if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 2000.0f, 1000.0f); } } } -void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // "Successful completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); if (!LINK_IS_ADULT) { @@ -434,7 +434,7 @@ void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_RestartGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer == 0) { EnSyatekiItm* gallery = ((EnSyatekiItm*)this->actor.parent); @@ -478,22 +478,22 @@ void EnSyatekiMan_Blink(EnSyatekiMan* this) { } } -void EnSyatekiMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiMan* this = (EnSyatekiMan*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); EnSyatekiMan_SetBgm(); this->blinkFunc(this); this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); - func_80038290(globalCtx, &this->actor, &this->headRot, &this->bodyRot, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->bodyRot, this->actor.focus.pos); } -s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSyatekiMan* this = (EnSyatekiMan*)thisx; s32 turnDirection; @@ -513,12 +513,12 @@ s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiMan* this = (EnSyatekiMan*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSyatekiMan_OverrideLimbDraw, NULL, this); } diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h b/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h index 9caa7c88f..363802902 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h +++ b/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h @@ -6,7 +6,7 @@ struct EnSyatekiMan; -typedef void (*EnSyatekiManActionFunc) (struct EnSyatekiMan*, GlobalContext*); +typedef void (*EnSyatekiManActionFunc) (struct EnSyatekiMan*, PlayState*); typedef void (*EnSyatekiManOtherFunc) (struct EnSyatekiMan*); typedef struct EnSyatekiMan { diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index 64eba93a8..c270b2a1b 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -11,19 +11,19 @@ #define FLAGS ACTOR_FLAG_4 -void EnSyatekiNiw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiNiw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiNiw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiNiw_Init(Actor* thisx, PlayState* play); +void EnSyatekiNiw_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiNiw_Update(Actor* thisx, PlayState* play); +void EnSyatekiNiw_Draw(Actor* thisx, PlayState* play); -void func_80B11DEC(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B132A8(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B128D8(EnSyatekiNiw* this, GlobalContext* globalCtx); +void func_80B11DEC(EnSyatekiNiw* this, PlayState* play); +void func_80B132A8(EnSyatekiNiw* this, PlayState* play); +void func_80B129EC(EnSyatekiNiw* this, PlayState* play); +void func_80B13464(EnSyatekiNiw* this, PlayState* play); +void func_80B123A8(EnSyatekiNiw* this, PlayState* play); +void func_80B11E78(EnSyatekiNiw* this, PlayState* play); +void func_80B12460(EnSyatekiNiw* this, PlayState* play); +void func_80B128D8(EnSyatekiNiw* this, PlayState* play); void func_80B131B8(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4); @@ -66,21 +66,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnSyatekiNiw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Init(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.flags &= ~ACTOR_FLAG_0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); this->unk_29E = this->actor.params; if (this->unk_29E < 0) { this->unk_29E = 0; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); if (this->unk_29E == 0) { osSyncPrintf("\n\n"); // "Archery range chicken" @@ -99,13 +99,13 @@ void EnSyatekiNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B11DEC; } -void EnSyatekiNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Destroy(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B11A94(EnSyatekiNiw* this, GlobalContext* globalCtx, s16 arg2) { +void func_80B11A94(EnSyatekiNiw* this, PlayState* play, s16 arg2) { if (this->unk_254 == 0) { if (arg2 == 0) { this->unk_264 = 0.0f; @@ -208,7 +208,7 @@ void func_80B11A94(EnSyatekiNiw* this, GlobalContext* globalCtx, s16 arg2) { } } -void func_80B11DEC(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B11DEC(EnSyatekiNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); if (this->unk_29E != 0) { @@ -218,7 +218,7 @@ void func_80B11DEC(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80B11E78; } -void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B11E78(EnSyatekiNiw* this, PlayState* play) { Vec3f dustVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f dustAccel = { 0.0f, 0.2f, 0.0f }; Color_RGBA8 dustPrimColor = { 0, 0, 0, 255 }; @@ -336,19 +336,19 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) { } if (this->unk_260 == 0) { - func_80B11A94(this, globalCtx, sp4A); + func_80B11A94(this, play, sp4A); return; } - if ((globalCtx->gameplayFrames % 4) == 0) { + if ((play->gameplayFrames % 4) == 0) { dustVelocity.y = Rand_CenteredFloat(5.0f); dustAccel.y = 0.2f; dustPos = this->actor.world.pos; - func_8002836C(globalCtx, &dustPos, &dustVelocity, &dustAccel, &dustPrimColor, &dustEnvColor, 600, 40, 30); + func_8002836C(play, &dustPos, &dustVelocity, &dustAccel, &dustPrimColor, &dustEnvColor, 600, 40, 30); } } -void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B123A8(EnSyatekiNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); this->unk_27C = 6000.0f; @@ -365,8 +365,8 @@ void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->unk_26C = -10000.0f; } -void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B12460(EnSyatekiNiw* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 phi_f16 = 0.0f; player->actor.freezeTimer = 10; @@ -466,9 +466,9 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { case 6: if (this->unk_25E == 1) { - globalCtx->sceneLoadFlag = 0x14; - globalCtx->nextEntranceIndex = gSaveContext.entranceIndex; - globalCtx->shootingGalleryStatus = 0; + play->sceneLoadFlag = 0x14; + play->nextEntranceIndex = gSaveContext.entranceIndex; + play->shootingGalleryStatus = 0; player->actor.freezeTimer = 20; this->unk_25E = 0x14; this->actionFunc = func_80B128D8; @@ -488,21 +488,21 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->unk_254 = this->unk_256; } - func_80B11A94(this, globalCtx, this->unk_296); + func_80B11A94(this, play, this->unk_296); } -void func_80B128D8(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B128D8(EnSyatekiNiw* this, PlayState* play) { if (this->unk_25E == 1) { gSaveContext.timer1State = 0; } } -void func_80B128F8(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B128F8(EnSyatekiNiw* this, PlayState* play) { s16 sp26; s16 sp24; Actor_SetFocus(&this->actor, this->unk_2D4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); if ((this->actor.projectedPos.z > 200.0f) && (this->actor.projectedPos.z < 800.0f) && (sp26 > 0) && (sp26 < SCREEN_WIDTH) && (sp24 > 0) && (sp24 < SCREEN_HEIGHT)) { this->actor.speedXZ = 5.0f; @@ -514,7 +514,7 @@ void func_80B128F8(EnSyatekiNiw* this, GlobalContext* globalCtx) { } } -void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B129EC(EnSyatekiNiw* this, PlayState* play) { s32 pad; f32 phi_f2; s16 sp2E; @@ -522,7 +522,7 @@ void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx) { f32 tmpf2; Actor_SetFocus(&this->actor, this->unk_2D4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp2E, &sp2C); + Actor_GetScreenPos(play, &this->actor, &sp2E, &sp2C); if ((this->unk_25E == 0) || (this->actor.projectedPos.z < -70.0f) || (sp2E < 0) || (sp2E > SCREEN_WIDTH) || (sp2C < 0) || (sp2C > SCREEN_HEIGHT)) { Actor_Kill(&this->actor); @@ -543,10 +543,10 @@ void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx) { tmpf2 = this->unk_2D8 + phi_f2; Math_SmoothStepToS(&this->actor.world.rot.y, tmpf2, 3, this->unk_2C8.y, 0); Math_ApproachF(&this->unk_2C8.y, 3000.0f, 1.0f, 500.0f); - func_80B11A94(this, globalCtx, 2); + func_80B11A94(this, play, 2); } -void func_80B12BA4(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B12BA4(EnSyatekiNiw* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; switch (this->unk_29E) { @@ -573,7 +573,7 @@ void func_80B12BA4(EnSyatekiNiw* this, GlobalContext* globalCtx) { } } -void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Update(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; s32 pad; s16 i; @@ -583,7 +583,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp6C; Vec3f sp60; - func_80B132A8(this, globalCtx); + func_80B132A8(this, play); this->unk_28C++; if (this->unk_254 != 0) { this->unk_254--; @@ -616,9 +616,9 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; this->actor.shape.shadowScale = 15.0f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); if (this->unk_2A0 != 0) { for (i = 0; i < 20; i++) { @@ -636,7 +636,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A0 = 0; } - func_80B12BA4(this, globalCtx); + func_80B12BA4(this, play); if (this->unk_262 == 0) { if (this->actionFunc == func_80B11E78) { this->unk_262 = 0x12C; @@ -650,7 +650,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { i = 0; switch (this->unk_29E) { case 0: - if (globalCtx->shootingGalleryStatus != 0) { + if (play->shootingGalleryStatus != 0) { i = 1; } break; @@ -662,12 +662,12 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if (i != 0) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 SyatekiNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 SyatekiNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; Vec3f sp0 = { 0.0f, 0.0f, 0.0f }; @@ -691,20 +691,20 @@ s32 SyatekiNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnSyatekiNiw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Draw(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; Color_RGBA8 sp30 = { 0, 0, 0, 255 }; if (this->actionFunc != func_80B128F8) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->unk_260 != 0) { - func_80026230(globalCtx, &sp30, 0, 0x14); + func_80026230(play, &sp30, 0, 0x14); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, SyatekiNiw_OverrideLimbDraw, NULL, this); - func_80026608(globalCtx); - func_80B13464(this, globalCtx); + func_80026608(play); + func_80B13464(this, play); } } @@ -728,7 +728,7 @@ void func_80B131B8(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f3 } } -void func_80B132A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B132A8(EnSyatekiNiw* this, PlayState* play) { s16 i; EnSyatekiNiw_1* ptr = &this->unk_348[0]; @@ -758,15 +758,15 @@ void func_80B132A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { } } -void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80B13464(EnSyatekiNiw* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; EnSyatekiNiw_1* ptr = &this->unk_348[0]; u8 flag = 0; OPEN_DISPS(gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < 5; i++, ptr++) { if (ptr->unk_00 == 1) { @@ -777,7 +777,7 @@ void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { FrameInterpolation_RecordOpenChild(ptr, ptr->epoch); 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_2C, ptr->unk_2C, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(ptr->unk_30, MTXMODE_APPLY); Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h index aa9b5dde8..b512c6cd3 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h +++ b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h @@ -6,7 +6,7 @@ struct EnSyatekiNiw; -typedef void (*EnSyatekiNiwActionFunc)(struct EnSyatekiNiw*, GlobalContext*); +typedef void (*EnSyatekiNiwActionFunc)(struct EnSyatekiNiw*, PlayState*); typedef struct { /* 0x00 */ u8 unk_00; diff --git a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c index b7b964272..7e43d16d2 100644 --- a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -10,20 +10,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnTa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTa_Init(Actor* thisx, PlayState* play); +void EnTa_Destroy(Actor* thisx, PlayState* play); +void EnTa_Update(Actor* thisx, PlayState* play); +void EnTa_Draw(Actor* thisx, PlayState* play); -void func_80B14634(EnTa* this, GlobalContext* globalCtx); -void func_80B146F8(EnTa* this, GlobalContext* globalCtx); -void func_80B14754(EnTa* this, GlobalContext* globalCtx); -void func_80B14C18(EnTa* this, GlobalContext* globalCtx); -void func_80B14CAC(EnTa* this, GlobalContext* globalCtx); -void func_80B14D98(EnTa* this, GlobalContext* globalCtx); -void func_80B154FC(EnTa* this, GlobalContext* globalCtx); -void func_80B16504(EnTa* this, GlobalContext* globalCtx); -void func_80B16608(EnTa* this, GlobalContext* globalCtx); +void func_80B14634(EnTa* this, PlayState* play); +void func_80B146F8(EnTa* this, PlayState* play); +void func_80B14754(EnTa* this, PlayState* play); +void func_80B14C18(EnTa* this, PlayState* play); +void func_80B14CAC(EnTa* this, PlayState* play); +void func_80B14D98(EnTa* this, PlayState* play); +void func_80B154FC(EnTa* this, PlayState* play); +void func_80B16504(EnTa* this, PlayState* play); +void func_80B16608(EnTa* this, PlayState* play); void func_80B166CC(EnTa* this); void func_80B16700(EnTa* this); void func_80B167C0(EnTa* this); @@ -69,8 +69,8 @@ void func_80B13AA0(EnTa* this, EnTaActionFunc arg1, EnTaUnkFunc arg2) { this->unk_260 = arg2; } -void func_80B13AAC(EnTa* this, GlobalContext* globalCtx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 24); +void func_80B13AAC(EnTa* this, PlayState* play) { + u16 faceReaction = Text_GetFaceReaction(play, 24); if (gSaveContext.eventInf[0] & 0x400) { if (gSaveContext.eventInf[0] & 0x100) { @@ -98,15 +98,15 @@ void func_80B13AAC(EnTa* this, GlobalContext* globalCtx) { } } -void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnTa_Init(Actor* thisx, PlayState* play2) { EnTa* this = (EnTa*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_2E0 = 0; @@ -146,7 +146,7 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); } else if (!LINK_IS_ADULT) { Actor_Kill(&this->actor); - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE && !IS_DAY) { + } else if (play->sceneNum == SCENE_MALON_STABLE && !IS_DAY) { Actor_Kill(&this->actor); osSyncPrintf(VT_FGCOL(CYAN) " 夜はいない \n" VT_RST); } else { @@ -158,7 +158,7 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { break; default: osSyncPrintf(VT_FGCOL(CYAN) " その他のタロン \n" VT_RST); - if (globalCtx->sceneNum == SCENE_SPOT15) { + if (play->sceneNum == SCENE_SPOT15) { if (gSaveContext.eventChkInf[1] & 0x10) { Actor_Kill(&this->actor); } else if (gSaveContext.eventChkInf[1] & 0x8) { @@ -173,7 +173,7 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { this->currentAnimation = &gTalonSleepAnim; this->actor.shape.shadowScale = 54.0f; } - } else if (globalCtx->sceneNum == SCENE_SOUKO) { + } else if (play->sceneNum == SCENE_SOUKO) { osSyncPrintf(VT_FGCOL(CYAN) " ロンロン牧場の倉庫 の タロン\n" VT_RST); if (!(gSaveContext.eventChkInf[1] & 0x10)) { Actor_Kill(&this->actor); @@ -184,15 +184,15 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.flags |= ACTOR_FLAG_4; this->unk_2C4[0] = this->unk_2C4[1] = this->unk_2C4[2] = 7; this->superCuccos[0] = (EnNiw*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f, + &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f, this->actor.world.pos.y + 3.0f, this->actor.world.pos.z + 26.0f, 0, 0, 0, 0xD); this->superCuccos[1] = (EnNiw*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x - 20.0f, + &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x - 20.0f, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD); this->superCuccos[2] = (EnNiw*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f, + &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); if (gSaveContext.eventInf[0] & 0x400) { func_80B13AA0(this, func_80B16608, func_80B16938); @@ -231,12 +231,12 @@ void func_80B14248(EnTa* this) { } } -void EnTa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTa_Destroy(Actor* thisx, PlayState* play) { EnTa* this = (EnTa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); - if (this->actor.params != 1 && this->actor.params != 2 && globalCtx->sceneNum == SCENE_SOUKO) { + if (this->actor.params != 1 && this->actor.params != 2 && play->sceneNum == SCENE_SOUKO) { gSaveContext.timer1State = 0; } @@ -245,8 +245,8 @@ void EnTa_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_80B142F4(EnTa* this, GlobalContext* globalCtx, u16 textId) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80B142F4(EnTa* this, PlayState* play, u16 textId) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return true; } @@ -255,19 +255,19 @@ s32 func_80B142F4(EnTa* this, GlobalContext* globalCtx, u16 textId) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { this->unk_2E0 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return false; } -void func_80B14398(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B14398(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14754, func_80B167FC); } } -void func_80B143D4(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B143D4(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B146F8, func_80B167FC); } } @@ -282,22 +282,22 @@ void func_80B14410(EnTa* this) { } } -void func_80B1448C(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B1448C(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B14410(this); } func_80B14248(this); this->unk_2E0 |= 0x4; } -void func_80B144D8(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B144D8(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B14410(this); this->blinkTimer = 1; this->unk_2B0 = func_80B16700; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { this->eyeIndex = 1; func_80B13AA0(this, func_80B1448C, func_80B167C0); } @@ -305,7 +305,7 @@ void func_80B144D8(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 4; } -void func_80B14570(EnTa* this, GlobalContext* globalCtx) { +void func_80B14570(EnTa* this, PlayState* play) { this->unk_2E0 |= 4; if (this->unk_2CC == 0) { @@ -318,17 +318,17 @@ void func_80B14570(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B145F8(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B145F8(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14634, func_80B167FC); } } -void func_80B14634(EnTa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B14634(EnTa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - s32 exchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + s32 exchangeItemId = func_8002F368(play); switch (exchangeItemId) { case EXCH_ITEM_CHICKEN: @@ -345,23 +345,23 @@ void func_80B14634(EnTa* this, GlobalContext* globalCtx) { } } else { this->actor.textId = 0x702A; - func_8002F298(&this->actor, globalCtx, 100.0f, 3); + func_8002F298(&this->actor, play, 100.0f, 3); } } -void func_80B146F8(EnTa* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B146F8(EnTa* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { func_80B13AA0(this, func_80B143D4, func_80B167FC); } this->actor.textId = 0x204B; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } -void func_80B14754(EnTa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B14754(EnTa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - s32 exchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + s32 exchangeItemId = func_8002F368(play); switch (exchangeItemId) { case EXCH_ITEM_POCKET_CUCCO: @@ -378,12 +378,12 @@ void func_80B14754(EnTa* this, GlobalContext* globalCtx) { } } else { this->actor.textId = 0x5015; - func_8002F298(&this->actor, globalCtx, 100.0f, 6); + func_8002F298(&this->actor, play, 100.0f, 6); } } -void func_80B14818(EnTa* this, GlobalContext* globalCtx) { - s32 framesMod12 = (s32)globalCtx->state.frames % 12; +void func_80B14818(EnTa* this, PlayState* play) { + s32 framesMod12 = (s32)play->state.frames % 12; if (framesMod12 == 0 || framesMod12 == 6) { Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_GROUND); @@ -394,16 +394,16 @@ void func_80B14818(EnTa* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } -void func_80B14898(EnTa* this, GlobalContext* globalCtx) { - func_80033480(globalCtx, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, globalCtx); +void func_80B14898(EnTa* this, PlayState* play) { + func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); + func_80B14818(this, play); if (this->unk_2CC == 0) { Actor_Kill(&this->actor); } } -void func_80B1490C(EnTa* this, GlobalContext* globalCtx) { +void func_80B1490C(EnTa* this, PlayState* play) { this->actor.world.rot.y += 0xC00; this->actor.shape.rot.y += 0xC00; @@ -413,9 +413,9 @@ void func_80B1490C(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B1496C(EnTa* this, GlobalContext* globalCtx) { - func_80033480(globalCtx, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, globalCtx); +void func_80B1496C(EnTa* this, PlayState* play) { + func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); + func_80B14818(this, play); if (this->unk_2CC == 0) { func_80B13AA0(this, func_80B1490C, func_80B167C0); @@ -423,7 +423,7 @@ void func_80B1496C(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B149F4(EnTa* this, GlobalContext* globalCtx) { +void func_80B149F4(EnTa* this, PlayState* play) { this->actor.world.rot.y -= 0xD00; this->actor.shape.rot.y -= 0xD00; @@ -433,12 +433,12 @@ void func_80B149F4(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B14A54(EnTa* this, GlobalContext* globalCtx) { - func_80033480(globalCtx, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, globalCtx); +void func_80B14A54(EnTa* this, PlayState* play) { + func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); + func_80B14818(this, play); if (this->unk_2CC == 20) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } if (this->unk_2CC == 0) { this->unk_2CC = 5; @@ -446,7 +446,7 @@ void func_80B14A54(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B14AF4(EnTa* this, GlobalContext* globalCtx) { +void func_80B14AF4(EnTa* this, PlayState* play) { this->actor.world.rot.y -= 0xC00; this->actor.shape.rot.y -= 0xC00; @@ -458,14 +458,14 @@ void func_80B14AF4(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B14B6C(EnTa* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - s16 csCamIdx = OnePointCutscene_Init(globalCtx, 4175, -99, &this->actor, MAIN_CAM); +void func_80B14B6C(EnTa* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + s16 csCamIdx = OnePointCutscene_Init(play, 4175, -99, &this->actor, MAIN_CAM); func_80B13AA0(this, func_80B14AF4, func_80B167C0); this->unk_2CC = 5; gSaveContext.eventChkInf[1] |= 0x10; if (gSaveContext.n64ddFlag) { - OnePointCutscene_EndCutscene(globalCtx, csCamIdx); + OnePointCutscene_EndCutscene(play, csCamIdx); } Animation_PlayOnce(&this->skelAnime, &gTalonRunTransitionAnim); this->currentAnimation = &gTalonRunAnim; @@ -473,41 +473,41 @@ void func_80B14B6C(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 1; } -void func_80B14C18(EnTa* this, GlobalContext* globalCtx) { - if (func_80B142F4(this, globalCtx, 0x702C)) { +void func_80B14C18(EnTa* this, PlayState* play) { + if (func_80B142F4(this, play, 0x702C)) { func_80B13AA0(this, func_80B14B6C, func_80B167C0); } func_80B14248(this); } -void func_80B14C60(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B14C60(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14CAC, func_80B167C0); } this->unk_2E0 |= 1; } -void func_80B14CAC(EnTa* this, GlobalContext* globalCtx) { +void func_80B14CAC(EnTa* this, PlayState* play) { if (gSaveContext.eventChkInf[1] & 0x100) { - if (func_80B142F4(this, globalCtx, 0x5017)) { + if (func_80B142F4(this, play, 0x5017)) { func_80B13AA0(this, func_80B14C60, func_80B167C0); gSaveContext.eventChkInf[6] |= 0x800; } - } else if (func_80B142F4(this, globalCtx, 0x5016)) { + } else if (func_80B142F4(this, play, 0x5016)) { func_80B13AA0(this, func_80B14C60, func_80B167C0); } func_80B14248(this); } -void func_80B14D4C(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B14D4C(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14D98, func_80B167C0); } this->unk_2E0 |= 1; } -void func_80B14D98(EnTa* this, GlobalContext* globalCtx) { - if (func_80B142F4(this, globalCtx, 0x2055)) { +void func_80B14D98(EnTa* this, PlayState* play) { + if (func_80B142F4(this, play, 0x2055)) { func_80B13AA0(this, func_80B14D4C, func_80B167C0); } } @@ -522,14 +522,14 @@ s32 func_80B14DD8(void) { } } -void func_80B14E28(EnTa* this, GlobalContext* globalCtx) { +void func_80B14E28(EnTa* this, PlayState* play) { Vec3f b; Vec3f a; - this->unk_2D0 = Gameplay_CreateSubCamera(globalCtx); - this->unk_2D2 = globalCtx->activeCamera; - Gameplay_ChangeCameraStatus(globalCtx, this->unk_2D2, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_2D0, CAM_STAT_ACTIVE); + this->unk_2D0 = Play_CreateSubCamera(play); + this->unk_2D2 = play->activeCamera; + Play_ChangeCameraStatus(play, this->unk_2D2, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_2D0, CAM_STAT_ACTIVE); b.x = 1053.0f; b.y = 11.0f; @@ -539,12 +539,12 @@ void func_80B14E28(EnTa* this, GlobalContext* globalCtx) { a.y = 45.0f; a.z = -40.0f; - Gameplay_CameraSetAtEye(globalCtx, this->unk_2D0, &a, &b); + Play_CameraSetAtEye(play, this->unk_2D0, &a, &b); } -void func_80B14EDC(EnTa* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, this->unk_2D2, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->unk_2D0); +void func_80B14EDC(EnTa* this, PlayState* play) { + Play_ChangeCameraStatus(play, this->unk_2D2, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->unk_2D0); } void func_80B14F20(EnTa* this, EnTaActionFunc arg1) { @@ -564,17 +564,17 @@ void func_80B14FAC(EnTa* this, EnTaActionFunc arg1) { ANIMMODE_ONCE, -5.0f); } -void func_80B15034(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80B15034(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); } this->unk_2E0 |= 1; } -s32 func_80B150AC(EnTa* this, GlobalContext* globalCtx, s32 idx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B150AC(EnTa* this, PlayState* play, s32 idx) { + Player* player = GET_PLAYER(play); Actor* interactRangeActor; if (player->stateFlags1 & 0x800) { @@ -587,17 +587,17 @@ s32 func_80B150AC(EnTa* this, GlobalContext* globalCtx, s32 idx) { return false; } -void func_80B15100(EnTa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B15100(EnTa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { s32 unk_2CA; Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f); this->unk_2E0 &= ~0x10; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); unk_2CA = this->unk_2CA; this->actionFunc = func_80B154FC; this->superCuccos[unk_2CA]->actor.gravity = 0.1f; @@ -617,17 +617,17 @@ void func_80B15100(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 1; } -void func_80B15260(EnTa* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B15260(EnTa* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80B15100; this->actor.flags &= ~ACTOR_FLAG_16; } else { - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } this->unk_2E0 |= 1; } -s32 EnTa_GetSuperCuccosCount(EnTa* this, GlobalContext* globalCtx) { +s32 EnTa_GetSuperCuccosCount(EnTa* this, PlayState* play) { s32 count; s32 i; @@ -652,39 +652,39 @@ void func_80B15308(EnTa* this) { } } -void func_80B153D4(EnTa* this, GlobalContext* globalCtx) { +void func_80B153D4(EnTa* this, PlayState* play) { func_80B15308(this); if (this->unk_2CC == 0) { if (this->unk_2E0 & 0x80) { this->unk_2E0 &= ~0x80; - func_80B14EDC(this, globalCtx); + func_80B14EDC(this, play); } } } -void func_80B15424(EnTa* this, GlobalContext* globalCtx) { +void func_80B15424(EnTa* this, PlayState* play) { func_80B15308(this); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->nextEntranceIndex = 0x5E4; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->nextEntranceIndex = 0x5E4; if (gSaveContext.eventInf[0] & 0x100) { - globalCtx->fadeTransition = 46; + play->fadeTransition = 46; gSaveContext.nextTransition = 3; } else { - globalCtx->fadeTransition = 38; + play->fadeTransition = 38; gSaveContext.nextTransition = 2; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; gSaveContext.eventInf[0] |= 0x400; this->actionFunc = func_80B153D4; this->unk_2CC = 22; } } -void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { +void func_80B154FC(EnTa* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) { @@ -693,7 +693,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { this->superCuccos[i]->actor.gravity -= 0.03f; } - if (func_80B150AC(this, globalCtx, i)) { + if (func_80B150AC(this, play, i)) { if (this->unk_2C4[i] > 0) { this->unk_2C4[i]--; } else { @@ -701,12 +701,12 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); this->unk_2E0 &= ~0x10; - switch (EnTa_GetSuperCuccosCount(this, globalCtx)) { + switch (EnTa_GetSuperCuccosCount(this, play)) { case 1: gSaveContext.timer1State = 0; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); - Message_StartTextbox(globalCtx, 0x2084, &this->actor); + Message_StartTextbox(play, 0x2084, &this->actor); this->actionFunc = func_80B15424; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); @@ -728,7 +728,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { } this->actionFunc = func_80B15260; this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); return; } } else { @@ -741,15 +741,15 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { func_800F5918(); } - if (gSaveContext.timer1Value == 0 && !Gameplay_InCsMode(globalCtx)) { + if (gSaveContext.timer1Value == 0 && !Play_InCsMode(play)) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP); this->unk_2E0 &= ~0x200; func_80078884(NA_SE_SY_FOUND); gSaveContext.timer1State = 0; - func_8002DF54(globalCtx, &this->actor, 1); - Message_StartTextbox(globalCtx, 0x2081, &this->actor); + func_8002DF54(play, &this->actor, 1); + Message_StartTextbox(play, 0x2081, &this->actor); this->actionFunc = func_80B15424; - func_80B14E28(this, globalCtx); + func_80B14E28(this, play); gSaveContext.eventInf[0] &= ~0x100; this->unk_2E0 |= 0x80; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); @@ -760,7 +760,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 1; } -void func_80B1585C(EnTa* this, GlobalContext* globalCtx) { +void func_80B1585C(EnTa* this, PlayState* play) { s32 i; if (this->unk_2CC > 35) { @@ -799,11 +799,11 @@ void func_80B1585C(EnTa* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f); - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); } } -void func_80B15AD4(EnTa* this, GlobalContext* globalCtx) { +void func_80B15AD4(EnTa* this, PlayState* play) { if (this->unk_2CC == 0 && this->unk_2E0 & 0x20) { func_80B13AA0(this, func_80B1585C, func_80B16938); this->unk_2E0 &= ~0x10; @@ -813,60 +813,60 @@ void func_80B15AD4(EnTa* this, GlobalContext* globalCtx) { func_80088B34(0x1E); func_800F5ACC(NA_BGM_TIMED_MINI_GAME); this->unk_2E0 |= 0x200; - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, &this->actor, 1); + Message_CloseTextbox(play); + func_8002DF54(play, &this->actor, 1); } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_2E0 |= 0x20; } this->unk_2E0 |= 1; } -void func_80B15BF8(EnTa* this, GlobalContext* globalCtx) { +void func_80B15BF8(EnTa* this, PlayState* play) { if (this->unk_2E0 & 0x10) { func_80B13AA0(this, func_80B15AD4, func_80B16938); this->unk_2E0 &= ~0x10; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 0.0f, 1.0f, ANIMMODE_ONCE, 0.0f); this->unk_2CC = 5; } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_2E0 |= 0x20; } this->unk_2E0 |= 1; } -void func_80B15CC8(EnTa* this, GlobalContext* globalCtx) { +void func_80B15CC8(EnTa* this, PlayState* play) { if (this->unk_2E0 & 0x10) { func_80B13AA0(this, func_80B15BF8, func_80B16938); this->unk_2E0 &= ~0x10; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, -1.0f, 29.0f, 0.0f, ANIMMODE_ONCE, 10.0f); } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_2E0 |= 0x20; } this->unk_2E0 |= 1; } -void func_80B15D90(EnTa* this, GlobalContext* globalCtx) { +void func_80B15D90(EnTa* this, PlayState* play) { func_80B13AA0(this, func_80B15CC8, func_80B16938); this->unk_2E0 &= ~0x10; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); - Message_ContinueTextbox(globalCtx, 0x2080); + Message_ContinueTextbox(play, 0x2080); this->unk_2E0 &= ~0x20; } -void func_80B15E28(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B15E28(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); } this->unk_2E0 |= 1; } -void func_80B15E80(EnTa* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B15E80(EnTa* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80B15E28; if (!(this->unk_2E0 & 0x2)) { @@ -874,65 +874,65 @@ void func_80B15E80(EnTa* this, GlobalContext* globalCtx) { } this->unk_2E0 &= ~0x2; } else if (this->unk_2E0 & 2) { - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_MILK_BOTTLE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LLR_TALONS_CHICKENS, GI_MILK_BOTTLE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } this->unk_2E0 |= 1; } -void func_80B15F54(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80B15F54(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->unk_2E0 &= ~0x2; func_80B13AA0(this, func_80B15E80, func_80B16938); if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_MILK_BOTTLE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LLR_TALONS_CHICKENS, GI_MILK_BOTTLE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 10000.0f, 50.0f); } } } -void func_80B15FE8(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80B15FE8(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: switch (func_80B14DD8()) { case 0: - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); func_80B13AA0(this, func_80B15034, func_80B16938); break; case 1: - Message_ContinueTextbox(globalCtx, 0x208A); + Message_ContinueTextbox(play, 0x208A); func_80B13AA0(this, func_80B15E28, func_80B16938); break; case 2: this->unk_2E0 |= 2; func_80B13AA0(this, func_80B15E80, func_80B16938); Rupees_ChangeBy(-30); - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); break; } break; case 1: if (gSaveContext.rupees < 10) { - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); func_80B13AA0(this, func_80B15034, func_80B16938); } else { Rupees_ChangeBy(-10); - func_80B15D90(this, globalCtx); + func_80B15D90(this, play); } break; case 2: func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); break; } } @@ -942,7 +942,7 @@ void func_80B15FE8(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B161C0(EnTa* this, GlobalContext* globalCtx) { +void func_80B161C0(EnTa* this, PlayState* play) { s32 price; if (this->actor.textId == 0x2085) { @@ -951,20 +951,20 @@ void func_80B161C0(EnTa* this, GlobalContext* globalCtx) { price = 10; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees < price) { - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); func_80B13AA0(this, func_80B15034, func_80B16938); } else { Rupees_ChangeBy(-price); - func_80B15D90(this, globalCtx); + func_80B15D90(this, play); } break; case 1: func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); break; } } @@ -974,9 +974,9 @@ void func_80B161C0(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B162E8(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x2087); +void func_80B162E8(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x2087); func_80B13AA0(this, func_80B15F54, func_80B16938); } @@ -985,14 +985,14 @@ void func_80B162E8(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B16364(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_80B16364(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { gSaveContext.infTable[7] |= 0x4000; if (gSaveContext.itemGetInf[0] & 4) { - Message_ContinueTextbox(globalCtx, 0x208B); + Message_ContinueTextbox(play, 0x208B); func_80B13AA0(this, func_80B15FE8, func_80B16938); } else { - Message_ContinueTextbox(globalCtx, 0x207F); + Message_ContinueTextbox(play, 0x207F); func_80B13AA0(this, func_80B161C0, func_80B16938); } } @@ -1002,26 +1002,26 @@ void func_80B16364(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B1642C(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_80B1642C(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->unk_2E0 |= 2; func_80B13AA0(this, func_80B15E80, func_80B16938); - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); } else { - Message_ContinueTextbox(globalCtx, 0x208A); + Message_ContinueTextbox(play, 0x208A); func_80B13AA0(this, func_80B15E28, func_80B16938); } } } -void func_80B16504(EnTa* this, GlobalContext* globalCtx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x18); +void func_80B16504(EnTa* this, PlayState* play) { + u16 faceReaction = Text_GetFaceReaction(play, 0x18); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); - if (func_80B142F4(this, globalCtx, this->actor.textId)) { + if (func_80B142F4(this, play, this->actor.textId)) { Audio_PlayActorSound2(&this->actor, NA_SE_VO_TA_SURPRISE); if (faceReaction != 0) { @@ -1046,8 +1046,8 @@ void func_80B16504(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 &= ~1; } -void func_80B16608(EnTa* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B16608(EnTa* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { switch (this->actor.textId) { case 0x2085: this->actionFunc = func_80B161C0; @@ -1062,7 +1062,7 @@ void func_80B16608(EnTa* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_16; } else { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } this->unk_2E0 |= 1; } @@ -1145,23 +1145,23 @@ void func_80B16938(EnTa* this) { } } -void EnTa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTa_Update(Actor* thisx, PlayState* play) { EnTa* this = (EnTa*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->unk_260(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->unk_2E0 & 4)) { this->unk_2B0(this); } if (this->unk_2E0 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_2D4.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_2D4.y, 0, 6, 6200, 100); @@ -1176,7 +1176,7 @@ void EnTa_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnTa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTa* this = (EnTa*)thisx; switch (limbIndex) { @@ -1195,14 +1195,14 @@ s32 EnTa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } else if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { s32 limbIdx50 = limbIndex * 50; - rot->y += Math_SinS(globalCtx->state.frames * (limbIdx50 + 0x814)) * 200.0f; - rot->z += Math_CosS(globalCtx->state.frames * (limbIdx50 + 0x940)) * 200.0f; + rot->y += Math_SinS(play->state.frames * (limbIdx50 + 0x814)) * 200.0f; + rot->z += Math_CosS(play->state.frames * (limbIdx50 + 0x940)) * 200.0f; } return false; } -void EnTa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80B16E7C = { 1100.0f, 1000.0f, @@ -1215,7 +1215,7 @@ void EnTa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnTa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTa_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gTalonEyeOpenTex, gTalonEyeHalfTex, @@ -1224,15 +1224,15 @@ void EnTa_Draw(Actor* thisx, GlobalContext* globalCtx) { EnTa* this = (EnTa*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x9, SEGMENTED_TO_VIRTUAL(gTalonHeadSkinTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTa_OverrideLimbDraw, EnTa_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.h b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.h index 8429ad7ab..ec4f2766a 100644 --- a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.h +++ b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.h @@ -8,7 +8,7 @@ struct EnTa; -typedef void (*EnTaActionFunc)(struct EnTa*, GlobalContext*); +typedef void (*EnTaActionFunc)(struct EnTa*, PlayState*); typedef void (*EnTaUnkFunc)(struct EnTa*); typedef struct EnTa { diff --git a/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c b/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c index 5cc65866f..36aa5af68 100644 --- a/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c +++ b/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_27) -void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraMan_Reset(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTakaraMan_Init(Actor* thisx, PlayState* play); +void EnTakaraMan_Reset(Actor* thisx, PlayState* play); +void EnTakaraMan_Update(Actor* thisx, PlayState* play); +void EnTakaraMan_Draw(Actor* thisx, PlayState* play); -void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17B14(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17A6C(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17AC4(EnTakaraMan* this, GlobalContext* globalCtx); +void func_80B176E0(EnTakaraMan* this, PlayState* play); +void func_80B1778C(EnTakaraMan* this, PlayState* play); +void func_80B17B14(EnTakaraMan* this, PlayState* play); +void func_80B17934(EnTakaraMan* this, PlayState* play); +void func_80B17A6C(EnTakaraMan* this, PlayState* play); +void func_80B17AC4(EnTakaraMan* this, PlayState* play); const ActorInit En_Takara_Man_InitVars = { ACTOR_EN_TAKARA_MAN, @@ -37,11 +37,11 @@ const ActorInit En_Takara_Man_InitVars = { u8 sTakaraIsInitialized = false; -void EnTakaraMan_Reset(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Reset(Actor* thisx, PlayState* play) { sTakaraIsInitialized = false; } -void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Init(Actor* thisx, PlayState* play) { EnTakaraMan* this = (EnTakaraMan*)thisx; if (sTakaraIsInitialized) { @@ -53,10 +53,10 @@ void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) { sTakaraIsInitialized = true; osSyncPrintf("\n\n"); // "Bun! %x" (needs a better translation) - osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ ばぅん! ☆☆☆☆☆ %x\n" VT_RST, globalCtx->actorCtx.flags.chest); - globalCtx->actorCtx.flags.chest = 0; + osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ ばぅん! ☆☆☆☆☆ %x\n" VT_RST, play->actorCtx.flags.chest); + play->actorCtx.flags.chest = 0; gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = -1; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ts_Skel_004FE0, &object_ts_Anim_000498, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ts_Skel_004FE0, &object_ts_Anim_000498, this->jointTable, this->morphTable, 10); thisx->focus.pos = thisx->world.pos; this->pos = thisx->world.pos; @@ -72,7 +72,7 @@ void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B176E0; } -void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx) { +void func_80B176E0(EnTakaraMan* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ts_Anim_000498); Animation_Change(&this->skelAnime, &object_ts_Anim_000498, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -83,12 +83,12 @@ void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx) { this->actionFunc = func_80B1778C; } -void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { +void func_80B1778C(EnTakaraMan* this, PlayState* play) { s16 absYawDiff; s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx) && this->dialogState != TEXT_STATE_DONE) { + if (Actor_ProcessTalkRequest(&this->actor, play) && this->dialogState != TEXT_STATE_DONE) { if (!this->unk_214) { this->actionFunc = func_80B17934; } else { @@ -96,14 +96,14 @@ void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { } } else { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (globalCtx->roomCtx.curRoom.num == 6 && !this->unk_21A) { + if (play->roomCtx.curRoom.num == 6 && !this->unk_21A) { this->actor.textId = 0x6E; this->unk_21A = 1; this->dialogState = TEXT_STATE_DONE; } if (!this->unk_21A && this->unk_214) { - if (Flags_GetSwitch(globalCtx, 0x32)) { + if (Flags_GetSwitch(play, 0x32)) { this->actor.textId = 0x84; this->dialogState = TEXT_STATE_EVENT; } else { @@ -114,7 +114,7 @@ void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { absYawDiff = ABS(yawDiff); if (absYawDiff < 0x4300) { - if (globalCtx->roomCtx.curRoom.num != this->originalRoomNum) { + if (play->roomCtx.curRoom.num != this->originalRoomNum) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_218 = 0; } else { @@ -122,35 +122,35 @@ void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; this->unk_218 = 1; } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx) { - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80B17934(EnTakaraMan* this, PlayState* play) { + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // Yes if (gSaveContext.rupees >= 10) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); Rupees_ChangeBy(-10); this->unk_214 = 1; this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, GI_DOOR_KEY, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, GI_DOOR_KEY, 2000.0f, 1000.0f); this->actionFunc = func_80B17A6C; } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.textId = 0x85; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_80B17B14; } break; case 1: // No - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.textId = 0x2D; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_80B17B14; break; @@ -158,28 +158,28 @@ void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx) { } } -void func_80B17A6C(EnTakaraMan* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B17A6C(EnTakaraMan* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80B17AC4; } else { - func_8002F434(&this->actor, globalCtx, GI_DOOR_KEY, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, GI_DOOR_KEY, 2000.0f, 1000.0f); } } -void func_80B17AC4(EnTakaraMan* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80B17AC4(EnTakaraMan* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { this->actionFunc = func_80B176E0; } } -void func_80B17B14(EnTakaraMan* this, GlobalContext* globalCtx) { - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80B17B14(EnTakaraMan* this, PlayState* play) { + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = func_80B176E0; } } -void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Update(Actor* thisx, PlayState* play) { EnTakaraMan* this = (EnTakaraMan*)thisx; if (this->eyeTimer != 0) { @@ -187,7 +187,7 @@ void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, this->height); - func_80038290(globalCtx, &this->actor, &this->unk_22C, &this->unk_232, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_22C, &this->unk_232, this->actor.focus.pos); if (this->eyeTimer == 0) { this->eyeTextureIdx++; if (this->eyeTextureIdx >= 2) { @@ -196,10 +196,10 @@ void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx) { } } this->unk_212++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnTakaraMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnTakaraMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTakaraMan* this = (EnTakaraMan*)thisx; @@ -213,19 +213,19 @@ s32 EnTakaraMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnTakaraMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { object_ts_Tex_000970, object_ts_Tex_000D70, }; EnTakaraMan* this = (EnTakaraMan*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTakaraMan_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h b/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h index dc48850e8..48898909b 100644 --- a/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h +++ b/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h @@ -6,7 +6,7 @@ struct EnTakaraMan; -typedef void (*EnTakaraManActionFunc)(struct EnTakaraMan*, GlobalContext*); +typedef void (*EnTakaraManActionFunc)(struct EnTakaraMan*, PlayState*); typedef struct EnTakaraMan { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Tana/z_en_tana.c b/soh/src/overlays/actors/ovl_En_Tana/z_en_tana.c index af115fd49..2d492ef0e 100644 --- a/soh/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/soh/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -9,11 +9,11 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnTana_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTana_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTana_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTana_DrawWoodenShelves(Actor* thisx, GlobalContext* globalCtx); -void EnTana_DrawStoneShelves(Actor* thisx, GlobalContext* globalCtx); +void EnTana_Init(Actor* thisx, PlayState* play); +void EnTana_Destroy(Actor* thisx, PlayState* play); +void EnTana_Update(Actor* thisx, PlayState* play); +void EnTana_DrawWoodenShelves(Actor* thisx, PlayState* play); +void EnTana_DrawStoneShelves(Actor* thisx, PlayState* play); const ActorInit En_Tana_InitVars = { ACTOR_EN_TANA, @@ -55,7 +55,7 @@ static void* sStoneTextures[] = { gShopDungenStone2Tex, }; -void EnTana_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_Init(Actor* thisx, PlayState* play) { EnTana* this = (EnTana*)thisx; osSyncPrintf("☆☆☆ %s ☆☆☆\n", sShelfTypes[thisx->params]); @@ -64,35 +64,35 @@ void EnTana_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->draw = sDrawFuncs[thisx->params]; } -void EnTana_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_Destroy(Actor* thisx, PlayState* play) { } -void EnTana_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_Update(Actor* thisx, PlayState* play) { } -void EnTana_DrawWoodenShelves(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_DrawWoodenShelves(Actor* thisx, PlayState* play) { EnTana* this = (EnTana*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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++, sShelfDLists[thisx->params]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnTana_DrawStoneShelves(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_DrawStoneShelves(Actor* thisx, PlayState* play) { EnTana* this = (EnTana*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sStoneTextures[thisx->params])); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sShelfDLists[thisx->params]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c index 5ae60ebf9..7c0c582e8 100644 --- a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnTest_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTest_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTest_Init(Actor* thisx, PlayState* play); +void EnTest_Destroy(Actor* thisx, PlayState* play); +void EnTest_Update(Actor* thisx, PlayState* play); +void EnTest_Draw(Actor* thisx, PlayState* play); void EnTest_SetupWaitGround(EnTest* this); void EnTest_SetupWaitAbove(EnTest* this); @@ -29,37 +29,37 @@ void EnTest_SetupRecoil(EnTest* this); void func_80862398(EnTest* this); void func_80862154(EnTest* this); void EnTest_SetupStopAndBlock(EnTest* this); -void func_808627C4(EnTest* this, GlobalContext* globalCtx); +void func_808627C4(EnTest* this, PlayState* play); -void EnTest_WaitGround(EnTest* this, GlobalContext* globalCtx); -void EnTest_WaitAbove(EnTest* this, GlobalContext* globalCtx); -void EnTest_Fall(EnTest* this, GlobalContext* globalCtx); -void EnTest_Land(EnTest* this, GlobalContext* globalCtx); -void EnTest_Rise(EnTest* this, GlobalContext* globalCtx); -void EnTest_Idle(EnTest* this, GlobalContext* globalCtx); -void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx); -void func_80860C24(EnTest* this, GlobalContext* globalCtx); -void func_80860F84(EnTest* this, GlobalContext* globalCtx); -void EnTest_SlashDown(EnTest* this, GlobalContext* globalCtx); -void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx); -void EnTest_SlashUp(EnTest* this, GlobalContext* globalCtx); -void EnTest_JumpBack(EnTest* this, GlobalContext* globalCtx); -void EnTest_Jumpslash(EnTest* this, GlobalContext* globalCtx); -void EnTest_JumpUp(EnTest* this, GlobalContext* globalCtx); -void EnTest_StopAndBlock(EnTest* this, GlobalContext* globalCtx); -void EnTest_IdleFromBlock(EnTest* this, GlobalContext* globalCtx); -void func_808621D4(EnTest* this, GlobalContext* globalCtx); -void func_80862418(EnTest* this, GlobalContext* globalCtx); -void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx); -void func_808628C8(EnTest* this, GlobalContext* globalCtx); -void func_80862E6C(EnTest* this, GlobalContext* globalCtx); -void func_80863044(EnTest* this, GlobalContext* globalCtx); -void func_8086318C(EnTest* this, GlobalContext* globalCtx); -void EnTest_Recoil(EnTest* this, GlobalContext* globalCtx); -void func_808633E8(EnTest* this, GlobalContext* globalCtx); -void func_80862FA8(EnTest* this, GlobalContext* globalCtx); +void EnTest_WaitGround(EnTest* this, PlayState* play); +void EnTest_WaitAbove(EnTest* this, PlayState* play); +void EnTest_Fall(EnTest* this, PlayState* play); +void EnTest_Land(EnTest* this, PlayState* play); +void EnTest_Rise(EnTest* this, PlayState* play); +void EnTest_Idle(EnTest* this, PlayState* play); +void EnTest_WalkAndBlock(EnTest* this, PlayState* play); +void func_80860C24(EnTest* this, PlayState* play); +void func_80860F84(EnTest* this, PlayState* play); +void EnTest_SlashDown(EnTest* this, PlayState* play); +void EnTest_SlashDownEnd(EnTest* this, PlayState* play); +void EnTest_SlashUp(EnTest* this, PlayState* play); +void EnTest_JumpBack(EnTest* this, PlayState* play); +void EnTest_Jumpslash(EnTest* this, PlayState* play); +void EnTest_JumpUp(EnTest* this, PlayState* play); +void EnTest_StopAndBlock(EnTest* this, PlayState* play); +void EnTest_IdleFromBlock(EnTest* this, PlayState* play); +void func_808621D4(EnTest* this, PlayState* play); +void func_80862418(EnTest* this, PlayState* play); +void EnTest_Stunned(EnTest* this, PlayState* play); +void func_808628C8(EnTest* this, PlayState* play); +void func_80862E6C(EnTest* this, PlayState* play); +void func_80863044(EnTest* this, PlayState* play); +void func_8086318C(EnTest* this, PlayState* play); +void EnTest_Recoil(EnTest* this, PlayState* play); +void func_808633E8(EnTest* this, PlayState* play); +void func_80862FA8(EnTest* this, PlayState* play); -s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this); +s32 EnTest_ReactToProjectile(PlayState* play, EnTest* this); static u8 sJointCopyFlags[] = { false, // STALFOS_LIMB_NONE @@ -252,15 +252,15 @@ void EnTest_SetupAction(EnTest* this, EnTestActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Init(Actor* thisx, PlayState* play) { EffectBlureInit1 slashBlure; EnTest* this = (EnTest*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->jointTable, this->morphTable, STALFOS_LIMB_MAX); - SkelAnime_Init(globalCtx, &this->upperSkelanime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->upperJointTable, + SkelAnime_Init(play, &this->upperSkelanime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->upperJointTable, this->upperMorphTable, STALFOS_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); @@ -271,14 +271,14 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 45.0f; this->actor.colChkInfo.damageTable = &sDamageTable; - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sBodyColliderInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit); - Collider_InitCylinder(globalCtx, &this->shieldCollider); - Collider_SetCylinder(globalCtx, &this->shieldCollider, &this->actor, &sShieldColliderInit); + Collider_InitCylinder(play, &this->shieldCollider); + Collider_SetCylinder(play, &this->shieldCollider, &this->actor, &sShieldColliderInit); - Collider_InitQuad(globalCtx, &this->swordCollider); - Collider_SetQuad(globalCtx, &this->swordCollider, &this->actor, &sSwordColliderInit); + Collider_InitQuad(play, &this->swordCollider); + Collider_SetQuad(play, &this->swordCollider, &this->actor, &sSwordColliderInit); this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 10; @@ -296,7 +296,7 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { slashBlure.unkFlag = 0; slashBlure.calcMode = 2; - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &slashBlure); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE1, 0, 0, &slashBlure); if (this->actor.params != STALFOS_TYPE_CEILING) { EnTest_SetupWaitGround(this); @@ -309,32 +309,32 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTest_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Destroy(Actor* thisx, PlayState* play) { EnTest* this = (EnTest*)thisx; if ((this->actor.params != STALFOS_TYPE_2) && - !Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { + !Actor_FindNearby(play, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { func_800F5B58(); } - Effect_Delete(globalCtx, this->effectIndex); - Collider_DestroyCylinder(globalCtx, &this->shieldCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->swordCollider); + Effect_Delete(play, this->effectIndex); + Collider_DestroyCylinder(play, &this->shieldCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->swordCollider); } /** * If EnTest_ChooseAction failed to pick a new action, this function will unconditionally pick * a new action as a last resort */ -void EnTest_ChooseRandomAction(EnTest* this, GlobalContext* globalCtx) { +void EnTest_ChooseRandomAction(EnTest* this, PlayState* play) { switch ((u32)(Rand_ZeroOne() * 10.0f)) { case 0: case 1: case 5: case 6: if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 170.0f) && - Actor_IsFacingPlayer(&this->actor, 0x71C) && Actor_IsTargeted(globalCtx, &this->actor)) { + Actor_IsFacingPlayer(&this->actor, 0x71C) && Actor_IsTargeted(play, &this->actor)) { EnTest_SetupJumpslash(this); break; } @@ -346,7 +346,7 @@ void EnTest_ChooseRandomAction(EnTest* this, GlobalContext* globalCtx) { case 3: case 4: case 7: - func_808627C4(this, globalCtx); + func_808627C4(this, play); break; case 2: @@ -357,9 +357,9 @@ void EnTest_ChooseRandomAction(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { +void EnTest_ChooseAction(EnTest* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; yawDiff = ABS(yawDiff); @@ -376,7 +376,7 @@ void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { case 5: case 6: case 8: - func_808627C4(this, globalCtx); + func_808627C4(this, play); break; case 2: @@ -390,11 +390,11 @@ void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { } } else if (yawDiff <= 0x3E80) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) > 0x3E80) { - if (((globalCtx->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { + if (((play->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnTest_SetupJumpBack(this); } else if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 170.0f)) { - if (Actor_IsFacingPlayer(&this->actor, 0x71C) && !Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsFacingPlayer(&this->actor, 0x71C) && !Actor_IsTargeted(play, &this->actor)) { EnTest_SetupJumpslash(this); } } else { @@ -407,18 +407,18 @@ void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } else { EnTest_SetupSlashDown(this); } } } else { - EnTest_ChooseRandomAction(this, globalCtx); + EnTest_ChooseRandomAction(this, play); } } } else { - EnTest_ChooseRandomAction(this, globalCtx); + EnTest_ChooseRandomAction(this, play); } } @@ -432,7 +432,7 @@ void EnTest_SetupWaitGround(EnTest* this) { EnTest_SetupAction(this, EnTest_WaitGround); } -void EnTest_WaitGround(EnTest* this, GlobalContext* globalCtx) { +void EnTest_WaitGround(EnTest* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->timer == 0) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { @@ -462,7 +462,7 @@ void EnTest_SetupWaitAbove(EnTest* this) { EnTest_SetupAction(this, EnTest_WaitAbove); } -void EnTest_WaitAbove(EnTest* this, GlobalContext* globalCtx) { +void EnTest_WaitAbove(EnTest* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; @@ -483,13 +483,13 @@ void EnTest_SetupIdle(EnTest* this) { EnTest_SetupAction(this, EnTest_Idle); } -void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_Idle(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 100.0f) { @@ -499,7 +499,7 @@ void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() > 0.7f && player->swordAnimation != 0x11) { EnTest_SetupJumpBack(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } return; } @@ -511,30 +511,30 @@ void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 160.0f) && (Rand_ZeroOne() < 0.3f)) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { EnTest_SetupJumpslash(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } else { if (Rand_ZeroOne() > 0.3f) { EnTest_SetupWalkAndBlock(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } else { if (Rand_ZeroOne() > 0.7f) { func_80860BDC(this); } else { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } } } } } -void EnTest_Fall(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Fall(EnTest* this, PlayState* play) { Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalfosLandFromLeapAnim, 0.0f); SkelAnime_Update(&this->skelAnime); @@ -547,7 +547,7 @@ void EnTest_Fall(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_Land(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Land(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnTest_SetupIdle(this); this->timer = (Rand_ZeroOne() * 10.0f) + 5.0f; @@ -564,21 +564,21 @@ void EnTest_SetupWalkAndBlock(EnTest* this) { EnTest_SetupAction(this, EnTest_WalkAndBlock); } -void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { +void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { s32 pad; f32 checkDist = 0.0f; s32 pad1; s32 prevFrame; s32 temp_f16; f32 playSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 absPlaySpeed; s16 yawDiff; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { this->timer++; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { checkDist = 150.0f; } @@ -595,7 +595,7 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { } if ((this->actor.params == STALFOS_TYPE_CEILING) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.world.rot.y)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.world.rot.y)) { this->actor.speedXZ *= -1.0f; } @@ -658,19 +658,19 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 160.0f) && (Actor_IsFacingPlayer(&this->actor, 0x71C))) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { if (Rand_ZeroOne() < 0.1f) { EnTest_SetupJumpslash(this); return; } } else if (player->heldItemActionParam != PLAYER_AP_NONE) { if (this->actor.isTargeted) { - if ((globalCtx->gameplayFrames % 2) != 0) { - func_808627C4(this, globalCtx); + if ((play->gameplayFrames % 2) != 0) { + func_808627C4(this, play); return; } - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } else { func_80860EC0(this); } @@ -693,7 +693,7 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } else { EnTest_SetupSlashDown(this); @@ -715,7 +715,7 @@ void func_80860BDC(EnTest* this) { } // a variation of sidestep -void func_80860C24(EnTest* this, GlobalContext* globalCtx) { +void func_80860C24(EnTest* this, PlayState* play) { s16 yawDiff; s16 yawChange; f32 playSpeed; @@ -724,7 +724,7 @@ void func_80860C24(EnTest* this, GlobalContext* globalCtx) { s32 temp2; s32 absPlaySpeed; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { yawDiff = this->actor.yawTowardsPlayer; yawDiff -= this->actor.shape.rot.y; @@ -766,7 +766,7 @@ void func_80860C24(EnTest* this, GlobalContext* globalCtx) { if ((Rand_ZeroOne() > 0.7f)) { func_80860EC0(this); } else { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } } else { EnTest_SetupWalkAndBlock(this); @@ -787,18 +787,18 @@ void func_80860EC0(EnTest* this) { } // a variation of sidestep -void func_80860F84(EnTest* this, GlobalContext* globalCtx) { +void func_80860F84(EnTest* this, PlayState* play) { s16 playerYaw180; s32 pad; s32 prevFrame; s32 temp_f16; s16 yawDiff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 checkDist = 0.0f; s16 newYaw; s32 absPlaySpeed; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); this->actor.world.rot.y = this->actor.shape.rot.y + 0x3E80; playerYaw180 = player->actor.shape.rot.y + 0x8000; @@ -819,7 +819,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 8) || ((this->actor.params == STALFOS_TYPE_CEILING) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.world.rot.y))) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.world.rot.y))) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { newYaw = this->actor.shape.rot.y + 0x3FFF; @@ -844,7 +844,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { checkDist = 200.0f; } @@ -876,7 +876,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_WARAU); } @@ -884,7 +884,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { yawDiff = ABS(yawDiff); if ((yawDiff > 0x6800) || (this->timer == 0)) { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } else if (this->timer != 0) { this->timer--; } @@ -905,7 +905,7 @@ void EnTest_SetupSlashDown(EnTest* this) { } } -void EnTest_SlashDown(EnTest* this, GlobalContext* globalCtx) { +void EnTest_SlashDown(EnTest* this, PlayState* play) { this->actor.speedXZ = 0.0f; if ((s32)this->skelAnime.curFrame < 4) { @@ -923,7 +923,7 @@ void EnTest_SlashDown(EnTest* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { EnTest_SetupSlashDownEnd(this); } else { EnTest_SetupSlashUp(this); @@ -938,8 +938,8 @@ void EnTest_SetupSlashDownEnd(EnTest* this) { EnTest_SetupAction(this, EnTest_SlashDownEnd); } -void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_SlashDownEnd(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; if (SkelAnime_Update(&this->skelAnime)) { @@ -977,8 +977,8 @@ void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx) { } else if (player->stateFlags1 & 0x10) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); - } else if ((globalCtx->gameplayFrames % 2) != 0) { - func_808627C4(this, globalCtx); + } else if ((play->gameplayFrames % 2) != 0) { + func_808627C4(this, play); } else { EnTest_SetupJumpBack(this); } @@ -986,7 +986,7 @@ void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx) { EnTest_SetupSlashDown(this); } } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } @@ -1004,7 +1004,7 @@ void EnTest_SetupSlashUp(EnTest* this) { } } -void EnTest_SlashUp(EnTest* this, GlobalContext* globalCtx) { +void EnTest_SlashUp(EnTest* this, PlayState* play) { this->actor.speedXZ = 0.0f; if ((s32)this->skelAnime.curFrame == 2) { @@ -1040,7 +1040,7 @@ void EnTest_SetupJumpBack(EnTest* this) { } } -void EnTest_JumpBack(EnTest* this, GlobalContext* globalCtx) { +void EnTest_JumpBack(EnTest* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); if (this->timer == 0) { @@ -1050,7 +1050,7 @@ void EnTest_JumpBack(EnTest* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { if (this->actor.xzDistToPlayer <= 100.0f) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { EnTest_SetupSlashDown(this); @@ -1091,7 +1091,7 @@ void EnTest_SetupJumpslash(EnTest* this) { } } -void EnTest_Jumpslash(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Jumpslash(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer == 0) { Animation_PlayOnce(&this->skelAnime, &gStalfosJumpslashAnim); @@ -1131,7 +1131,7 @@ void EnTest_SetupJumpUp(EnTest* this) { EnTest_SetupAction(this, EnTest_JumpUp); } -void EnTest_JumpUp(EnTest* this, GlobalContext* globalCtx) { +void EnTest_JumpUp(EnTest* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); SkelAnime_Update(&this->skelAnime); @@ -1165,12 +1165,12 @@ void EnTest_SetupStopAndBlock(EnTest* this) { EnTest_SetupAction(this, EnTest_StopAndBlock); } -void EnTest_StopAndBlock(EnTest* this, GlobalContext* globalCtx) { +void EnTest_StopAndBlock(EnTest* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); SkelAnime_Update(&this->skelAnime); if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) > 0x3E80) && - (this->actor.params != STALFOS_TYPE_CEILING) && ((globalCtx->gameplayFrames % 2) != 0)) { + (this->actor.params != STALFOS_TYPE_CEILING) && ((play->gameplayFrames % 2) != 0)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnTest_SetupJumpBack(this); } @@ -1188,7 +1188,7 @@ void EnTest_SetupIdleFromBlock(EnTest* this) { EnTest_SetupAction(this, EnTest_IdleFromBlock); } -void EnTest_IdleFromBlock(EnTest* this, GlobalContext* globalCtx) { +void EnTest_IdleFromBlock(EnTest* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); SkelAnime_Update(&this->skelAnime); @@ -1196,11 +1196,11 @@ void EnTest_IdleFromBlock(EnTest* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->unk_7DE = 0; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { if (this->actor.xzDistToPlayer < 500.0f) { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } @@ -1215,8 +1215,8 @@ void func_80862154(EnTest* this) { EnTest_SetupAction(this, func_808621D4); } -void func_808621D4(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808621D4(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); @@ -1226,8 +1226,8 @@ void func_808621D4(EnTest* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 8) && ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && (this->actor.xzDistToPlayer < 80.0f))) { EnTest_SetupJumpUp(this); - } else if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + } else if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } else { return; } @@ -1257,16 +1257,16 @@ void func_80862398(EnTest* this) { EnTest_SetupAction(this, func_80862418); } -void func_80862418(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80862418(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); if (SkelAnime_Update(&this->skelAnime)) { this->actor.speedXZ = 0.0f; - if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } else { return; } @@ -1310,14 +1310,14 @@ void EnTest_SetupStunned(EnTest* this) { EnTest_SetupAction(this, EnTest_Stunned); } -void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_Stunned(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { - func_80862FA8(this, globalCtx); + func_80862FA8(this, play); } else if (player->swordState != 0) { if ((this->actor.bgCheckFlags & 8) && ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && @@ -1332,23 +1332,23 @@ void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx) { this->unk_7C8 = 8; } else { this->actor.speedXZ = 0.0f; - if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } } } } // a variation of sidestep -void func_808627C4(EnTest* this, GlobalContext* globalCtx) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { +void func_808627C4(EnTest* this, PlayState* play) { + if (Actor_OtherIsTargeted(play, &this->actor)) { func_80860EC0(this); return; } Animation_MorphToLoop(&this->skelAnime, &gStalfosSidestepAnim, -2.0f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); - this->actor.speedXZ = ((globalCtx->gameplayFrames % 2) != 0) ? -4.0f : 4.0f; + this->actor.speedXZ = ((play->gameplayFrames % 2) != 0) ? -4.0f : 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; this->timer = (Rand_ZeroOne() * 20.0f) + 20.0f; this->unk_7C8 = 0x18; @@ -1357,9 +1357,9 @@ void func_808627C4(EnTest* this, GlobalContext* globalCtx) { } // a variation of sidestep -void func_808628C8(EnTest* this, GlobalContext* globalCtx) { +void func_808628C8(EnTest* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad1; s32 prevFrame; s32 temp_f16; @@ -1390,7 +1390,7 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 8) || ((this->actor.params == STALFOS_TYPE_CEILING) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF))) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF))) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { newYaw = (this->actor.shape.rot.y + 0x3FFF); @@ -1417,7 +1417,7 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { checkDist = 200.0f; } @@ -1453,14 +1453,14 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { EnTest_SetupIdle(this); - } else if (Actor_IsTargeted(globalCtx, &this->actor)) { - if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + } else if (Actor_IsTargeted(play, &this->actor)) { + if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } } else if (player->heldItemActionParam != PLAYER_AP_NONE) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { EnTest_SetupIdle(this); } else { EnTest_SetupWalkAndBlock(this); @@ -1474,10 +1474,10 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { } } -void func_80862DBC(EnTest* this, GlobalContext* globalCtx) { +void func_80862DBC(EnTest* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_DAMAGE); this->unk_7C8 = 2; - BodyBreak_Alloc(&this->bodyBreak, 60, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 60, play); this->actor.home.rot.x = 0; if (this->swordState >= 0) { @@ -1488,19 +1488,19 @@ void func_80862DBC(EnTest* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.params == STALFOS_TYPE_5) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } EnTest_SetupAction(this, func_80862E6C); } -void func_80862E6C(EnTest* this, GlobalContext* globalCtx) { +void func_80862E6C(EnTest* this, PlayState* play) { if (this->actor.child == NULL) { if (this->actor.home.rot.x == 0) { this->actor.home.rot.x = this->bodyBreak.count; } - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 8)) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params + 8)) { this->actor.child = &this->actor; } } else { @@ -1510,15 +1510,15 @@ void func_80862E6C(EnTest* this, GlobalContext* globalCtx) { if (this->actor.params == STALFOS_TYPE_4) { this->actor.params = -1; } else { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } this->actor.child = NULL; this->actor.flags |= ACTOR_FLAG_0; EnTest_SetupJumpBack(this); } else if ((this->actor.params == STALFOS_TYPE_5) && - !Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + !Actor_FindNearby(play, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); if (this->actor.parent != NULL) { this->actor.parent->home.rot.z--; @@ -1529,7 +1529,7 @@ void func_80862E6C(EnTest* this, GlobalContext* globalCtx) { } } -void func_80862FA8(EnTest* this, GlobalContext* globalCtx) { +void func_80862FA8(EnTest* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gStalfosFallOverBackwardsAnim); Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7DE = 0; @@ -1541,16 +1541,16 @@ void func_80862FA8(EnTest* this, GlobalContext* globalCtx) { this->unk_7C8 = 5; EnTest_SetupAction(this, func_80863044); } else { - func_80862DBC(this, globalCtx); + func_80862DBC(this, play); } } -void func_80863044(EnTest* this, GlobalContext* globalCtx) { +void func_80863044(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->timer = (Rand_ZeroOne() * 10.0f) + 10.0f; this->unk_7C8 = 7; EnTest_SetupAction(this, func_808633E8); - BodyBreak_Alloc(&this->bodyBreak, 60, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 60, play); } if ((s32)this->skelAnime.curFrame == 15) { @@ -1558,7 +1558,7 @@ void func_80863044(EnTest* this, GlobalContext* globalCtx) { } } -void func_808630F0(EnTest* this, GlobalContext* globalCtx) { +void func_808630F0(EnTest* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gStalfosFallOverForwardsAnim); Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7C8 = 6; @@ -1570,16 +1570,16 @@ void func_808630F0(EnTest* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; EnTest_SetupAction(this, func_8086318C); } else { - func_80862DBC(this, globalCtx); + func_80862DBC(this, play); } } -void func_8086318C(EnTest* this, GlobalContext* globalCtx) { +void func_8086318C(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->timer = (Rand_ZeroOne() * 10.0f) + 10.0f; this->unk_7C8 = 7; EnTest_SetupAction(this, func_808633E8); - BodyBreak_Alloc(&this->bodyBreak, 60, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 60, play); } if (((s32)this->skelAnime.curFrame == 10) || ((s32)this->skelAnime.curFrame == 25)) { @@ -1597,20 +1597,20 @@ void EnTest_SetupRecoil(EnTest* this) { EnTest_SetupAction(this, EnTest_Recoil); } -void EnTest_Recoil(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Recoil(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { EnTest_SetupIdle(this); this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; - } else if (((globalCtx->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { + } else if (((play->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { EnTest_SetupJumpBack(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } -void EnTest_Rise(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Rise(EnTest* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.scale.y < 0.015f) { @@ -1622,11 +1622,11 @@ void EnTest_Rise(EnTest* this, GlobalContext* globalCtx) { } } -void func_808633E8(EnTest* this, GlobalContext* globalCtx) { +void func_808633E8(EnTest* this, PlayState* play) { this->actor.params = STALFOS_TYPE_1; - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params)) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); if (this->actor.parent != NULL) { this->actor.parent->home.rot.z--; @@ -1636,7 +1636,7 @@ void func_808633E8(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_UpdateHeadRot(EnTest* this, GlobalContext* globalCtx) { +void EnTest_UpdateHeadRot(EnTest* this, PlayState* play) { s16 lookAngle = this->actor.yawTowardsPlayer; lookAngle -= (s16)(this->headRot.y + this->actor.shape.rot.y); @@ -1646,8 +1646,8 @@ void EnTest_UpdateHeadRot(EnTest* this, GlobalContext* globalCtx) { this->headRot.y = CLAMP(this->headRot.y, -0x382F, 0x382F); } -void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_UpdateDamage(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->shieldCollider.base.acFlags & AC_BOUNCED) { this->shieldCollider.base.acFlags &= ~AC_BOUNCED; @@ -1680,14 +1680,14 @@ void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) { } else { if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); - func_80862FA8(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + func_80862FA8(this, play); } else { func_80862154(this); } } else if (Actor_ApplyDamage(&this->actor) == 0) { - func_808630F0(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + func_808630F0(this, play); + Enemy_StartFinishingBlow(play, &this->actor); } else { func_80862398(this); } @@ -1696,17 +1696,17 @@ void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Update(Actor* thisx, PlayState* play) { EnTest* this = (EnTest*)thisx; f32 oldWeight; u32 floorProperty; s32 pad; - EnTest_UpdateDamage(this, globalCtx); + EnTest_UpdateDamage(this, play); if (this->actor.colChkInfo.damageEffect != STALFOS_DMGEFF_FIREMAGIC) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 0x1D); if (this->actor.params == STALFOS_TYPE_1) { if (this->actor.world.pos.y <= this->actor.home.pos.y) { @@ -1718,16 +1718,16 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.floorHeight = this->actor.home.pos.y; } } else if (this->actor.bgCheckFlags & 2) { - floorProperty = func_80041EA4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + floorProperty = func_80041EA4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorProperty == 5) || (floorProperty == 0xC) || - func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 9) { + func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 9) { Actor_Kill(&this->actor); return; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch (this->unk_7DE) { case 0: @@ -1736,7 +1736,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { case 1: Animation_Change(&this->upperSkelanime, &gStalfosBlockWithShieldAnim, 2.0f, 0.0f, Animation_GetLastFrame(&gStalfosBlockWithShieldAnim), 2, 2.0f); - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->upperSkelanime.jointTable, sJointCopyFlags); this->unk_7DE++; break; @@ -1769,7 +1769,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.colorFilterTimer == 0) && (this->actor.colChkInfo.health != 0)) { if ((this->unk_7C8 != 0x10) && (this->unk_7C8 != 0x17)) { - EnTest_UpdateHeadRot(this, globalCtx); + EnTest_UpdateHeadRot(this, play); } else { Math_SmoothStepToS(&this->headRot.y, 0, 1, 0x3E8, 0); } @@ -1782,21 +1782,21 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 45.0f; if ((this->actor.colChkInfo.health > 0) || (this->actor.colorFilterTimer != 0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if ((this->unk_7C8 >= 0xA) && ((this->actor.colorFilterTimer == 0) || (!(this->actor.colorFilterParams & 0x4000)))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->unk_7DE != 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); } } if (this->swordState >= 1) { if (!(this->swordCollider.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->swordCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } else { this->swordCollider.base.atFlags &= ~AT_BOUNCED; EnTest_SetupRecoil(this); @@ -1804,7 +1804,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.params == STALFOS_TYPE_INVISIBLE) { - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawFeet; } else { @@ -1814,7 +1814,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnTest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTest* this = (EnTest*)thisx; s32 pad; @@ -1823,13 +1823,13 @@ s32 EnTest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList rot->y -= this->headRot.x; rot->z += this->headRot.z; } else if (limbIndex == STALFOS_LIMB_HEAD) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, 80 + ABS((s16)(Math_SinS(globalCtx->gameplayFrames * 2000) * 175.0f)), 0, 0, + gDPSetEnvColor(POLY_OPA_DISP++, 80 + ABS((s16)(Math_SinS(play->gameplayFrames * 2000) * 175.0f)), 0, 0, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if ((this->actor.params == STALFOS_TYPE_INVISIBLE) && !CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { @@ -1839,7 +1839,7 @@ s32 EnTest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTest_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f unused1 = { 1100.0f, -700.0f, 0.0f }; static Vec3f D_80864658 = { 300.0f, 0.0f, 0.0f }; static Vec3f D_80864664 = { 3400.0f, 0.0f, 0.0f }; @@ -1877,7 +1877,7 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_80864670, &sp64); if ((this->swordState >= 1) && - ((this->actor.params != STALFOS_TYPE_INVISIBLE) || globalCtx->actorCtx.lensActive)) { + ((this->actor.params != STALFOS_TYPE_INVISIBLE) || play->actorCtx.lensActive)) { EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp70, &sp64); } else if (this->swordState >= 0) { EffectBlure_AddSpace(Effect_GetByIndex(this->effectIndex)); @@ -1897,7 +1897,7 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V if ((this->unk_7C8 == 0x15) || (this->unk_7C8 == 0x16)) { if (this->actor.speedXZ != 0.0f) { Matrix_MultVec3f(&D_80864658, &sp64); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp64, 10.0f, 1, 8.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &sp64, 10.0f, 1, 8.0f, 100, 15, false); } } } @@ -1944,14 +1944,14 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Draw(Actor* thisx, PlayState* play) { EnTest* this = (EnTest*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 1); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 1); if ((thisx->params <= STALFOS_TYPE_CEILING) || (thisx->child == NULL)) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTest_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTest_OverrideLimbDraw, EnTest_PostLimbDraw, this); } @@ -1962,7 +1962,7 @@ void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->iceTimer % 4) == 0) { s32 iceIndex = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3s(globalCtx, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, + EffectSsEnIce_SpawnFlyingVec3s(play, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, 245, 255, 1.5f); } } @@ -1982,14 +1982,14 @@ void func_80864158(EnTest* this, f32 xzSpeed) { * Check if a projectile actor is within 300 units and react accordingly. * Returns true if the projectile test passes and a new action is performed. */ -s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { +s32 EnTest_ReactToProjectile(PlayState* play, EnTest* this) { Actor* projectileActor; s16 yawToProjectile; s16 wallYawDiff; s16 touchingWall; s16 directionFlag; - projectileActor = Actor_GetProjectileActor(globalCtx, &this->actor, 300.0f); + projectileActor = Actor_GetProjectileActor(play, &this->actor, 300.0f); if (projectileActor != NULL) { yawToProjectile = Actor_WorldYawTowardActor(&this->actor, projectileActor) - (u16)this->actor.shape.rot.y; @@ -2002,7 +2002,7 @@ s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { } if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &projectileActor->world.pos) < 200.0f) { - if (Actor_IsTargeted(globalCtx, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { + if (Actor_IsTargeted(play, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { EnTest_SetupJumpUp(this); } else if (ABS(yawToProjectile) < 0x2000) { EnTest_SetupStopAndBlock(this); @@ -2015,13 +2015,13 @@ s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { return true; } - if (Actor_IsTargeted(globalCtx, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { + if (Actor_IsTargeted(play, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { EnTest_SetupJumpUp(this); return true; } if ((ABS(yawToProjectile) < 0x2000) || (ABS(yawToProjectile) > 0x6000)) { - directionFlag = globalCtx->gameplayFrames % 2; + directionFlag = play->gameplayFrames % 2; if (touchingWall && (wallYawDiff > 0x2000) && (wallYawDiff < 0x6000)) { directionFlag = false; @@ -2035,7 +2035,7 @@ s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { func_80864158(this, -4.0f); } } else if (ABS(yawToProjectile) < 0x6000) { - directionFlag = globalCtx->gameplayFrames % 2; + directionFlag = play->gameplayFrames % 2; if (touchingWall && (ABS(wallYawDiff) > 0x6000)) { directionFlag = false; diff --git a/soh/src/overlays/actors/ovl_En_Test/z_en_test.h b/soh/src/overlays/actors/ovl_En_Test/z_en_test.h index 93263e236..3ddf9f723 100644 --- a/soh/src/overlays/actors/ovl_En_Test/z_en_test.h +++ b/soh/src/overlays/actors/ovl_En_Test/z_en_test.h @@ -6,7 +6,7 @@ struct EnTest; -typedef void (*EnTestActionFunc)(struct EnTest*, GlobalContext*); +typedef void (*EnTestActionFunc)(struct EnTest*, PlayState*); typedef enum { /* 0x00 */ STALFOS_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.c index 9e36d4b8e..bd7dab2c4 100644 --- a/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnTg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTg_Init(Actor* thisx, PlayState* play); +void EnTg_Destroy(Actor* thisx, PlayState* play); +void EnTg_Update(Actor* thisx, PlayState* play); +void EnTg_Draw(Actor* thisx, PlayState* play); -void EnTg_SpinIfNotTalking(EnTg* this, GlobalContext* globalCtx); +void EnTg_SpinIfNotTalking(EnTg* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -51,18 +51,18 @@ const ActorInit En_Tg_InitVars = { NULL, }; -u16 EnTg_GetTextId(GlobalContext* globalCtx, Actor* thisx) { +u16 EnTg_GetTextId(PlayState* play, Actor* thisx) { EnTg* this = (EnTg*)thisx; u16 temp; u32 phi; // If the player is wearing a mask, return a special reaction text - temp = Text_GetFaceReaction(globalCtx, 0x24); + temp = Text_GetFaceReaction(play, 0x24); if (temp != 0) { return temp; } // Use a different set of dialogue in Kakariko Village (Adult) - if (globalCtx->sceneNum == SCENE_SPOT01) { + if (play->sceneNum == SCENE_SPOT01) { if (this->nextDialogue % 2 != 0) { phi = 0x5089; } else { @@ -79,10 +79,10 @@ u16 EnTg_GetTextId(GlobalContext* globalCtx, Actor* thisx) { } } -s16 EnTg_OnTextComplete(GlobalContext* globalCtx, Actor* thisx) { +s16 EnTg_OnTextComplete(PlayState* play, Actor* thisx) { EnTg* this = (EnTg*)thisx; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -111,34 +111,34 @@ s16 EnTg_OnTextComplete(GlobalContext* globalCtx, Actor* thisx) { } } -void EnTg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Init(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDancingCoupleSkel, &gDancingCoupleAnim, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gDancingCoupleSkel, &gDancingCoupleAnim, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->actor.targetMode = 6; Actor_SetScale(&this->actor, 0.01f); - this->nextDialogue = globalCtx->state.frames % 2; + this->nextDialogue = play->state.frames % 2; this->actionFunc = EnTg_SpinIfNotTalking; } -void EnTg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Destroy(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnTg_SpinIfNotTalking(EnTg* this, GlobalContext* globalCtx) { +void EnTg_SpinIfNotTalking(EnTg* this, PlayState* play) { if (!this->isTalking) { this->actor.shape.rot.y += 0x800; } } -void EnTg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Update(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; s32 pad; f32 temp; @@ -148,19 +148,19 @@ void EnTg_Update(Actor* thisx, GlobalContext* globalCtx) { sp2C.y = this->actor.world.pos.y; sp2C.z = (s16)this->actor.world.pos.z + 3; this->collider.dim.pos = sp2C; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); temp = this->collider.dim.radius + 30.0f; - func_800343CC(globalCtx, &this->actor, &this->isTalking, temp, EnTg_GetTextId, EnTg_OnTextComplete); + func_800343CC(play, &this->actor, &this->isTalking, temp, EnTg_GetTextId, EnTg_OnTextComplete); } -s32 EnTg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return false; } -void EnTg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnTg* this = (EnTg*)thisx; Vec3f targetOffset = { 0.0f, 800.0f, 0.0f }; @@ -178,19 +178,19 @@ Gfx* EnTg_SetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return displayList; } -void EnTg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Draw(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, 0.0f, -560.0f, MTXMODE_APPLY); // Set the guy's shoes and shirt to royal blue - gSPSegment(POLY_OPA_DISP++, 0x08, EnTg_SetColor(globalCtx->state.gfxCtx, 0, 50, 160, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, EnTg_SetColor(play->state.gfxCtx, 0, 50, 160, 0)); // Set the girl's shirt to white - gSPSegment(POLY_OPA_DISP++, 0x09, EnTg_SetColor(globalCtx->state.gfxCtx, 255, 255, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnTg_SetColor(play->state.gfxCtx, 255, 255, 255, 0)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTg_OverrideLimbDraw, EnTg_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.h b/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.h index fc6ff7f49..4ba4e5034 100644 --- a/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.h +++ b/soh/src/overlays/actors/ovl_En_Tg/z_en_tg.h @@ -6,7 +6,7 @@ struct EnTg; -typedef void (*EnTgActionFunc)(struct EnTg*, GlobalContext*); +typedef void (*EnTgActionFunc)(struct EnTg*, PlayState*); typedef struct EnTg { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 7969425ab..4357fdcc7 100644 --- a/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -52,10 +52,10 @@ typedef enum { /* 0x2 */ TEKTITE_FLIPPED } EnTiteFlipState; -void EnTite_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTite_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTite_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTite_Init(Actor* thisx, PlayState* play); +void EnTite_Destroy(Actor* thisx, PlayState* play); +void EnTite_Update(Actor* thisx, PlayState* play); +void EnTite_Draw(Actor* thisx, PlayState* play); void EnTite_SetupIdle(EnTite* this); void EnTite_SetupTurnTowardPlayer(EnTite* this); @@ -63,16 +63,16 @@ void EnTite_SetupMoveTowardPlayer(EnTite* this); void EnTite_SetupDeathCry(EnTite* this); void EnTite_SetupFlipUpright(EnTite* this); -void EnTite_Idle(EnTite* this, GlobalContext* globalCtx); -void EnTite_Attack(EnTite* this, GlobalContext* globalCtx); -void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx); -void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx); -void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx); -void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx); -void EnTite_DeathCry(EnTite* this, GlobalContext* globalCtx); -void EnTite_FallApart(EnTite* this, GlobalContext* globalCtx); -void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx); -void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx); +void EnTite_Idle(EnTite* this, PlayState* play); +void EnTite_Attack(EnTite* this, PlayState* play); +void EnTite_TurnTowardPlayer(EnTite* this, PlayState* play); +void EnTite_MoveTowardPlayer(EnTite* this, PlayState* play); +void EnTite_Recoil(EnTite* this, PlayState* play); +void EnTite_Stunned(EnTite* this, PlayState* play); +void EnTite_DeathCry(EnTite* this, PlayState* play); +void EnTite_FallApart(EnTite* this, PlayState* play); +void EnTite_FlipOnBack(EnTite* this, PlayState* play); +void EnTite_FlipUpright(EnTite* this, PlayState* play); const ActorInit En_Tite_InitVars = { ACTOR_EN_TITE, @@ -174,13 +174,13 @@ void EnTite_SetupAction(EnTite* this, EnTiteActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Init(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; Actor_ProcessInitChain(thisx, sInitChain); thisx->targetMode = 3; Actor_SetScale(thisx, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_tite_Skel_003A20, &object_tite_Anim_0012E4, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_tite_Skel_003A20, &object_tite_Anim_0012E4, this->jointTable, this->morphTable, 25); ActorShape_Init(&thisx->shape, -200.0f, ActorShadow_DrawCircle, 70.0f); this->flipState = TEKTITE_INITIAL; @@ -191,8 +191,8 @@ void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->focus.pos.y += 20.0f; thisx->colChkInfo.health = 2; thisx->colChkInfo.mass = MASS_HEAVY; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, &this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, &this->colliderItem); this->unk_2DC = 0x1D; if (this->actor.params == TEKTITE_BLUE) { this->unk_2DC |= 0x40; // Don't use the actor engine's ripple spawning code @@ -202,7 +202,7 @@ void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { EnTite_SetupIdle(this); } -void EnTite_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Destroy(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; EnEncount1* spawner; @@ -216,7 +216,7 @@ void EnTite_Destroy(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n" VT_RST, spawner->curNumSpawn); osSyncPrintf("\n\n"); } - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnTite_SetupIdle(EnTite* this) { @@ -227,7 +227,7 @@ void EnTite_SetupIdle(EnTite* this) { EnTite_SetupAction(this, EnTite_Idle); } -void EnTite_Idle(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Idle(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (this->actor.params == TEKTITE_BLUE) { @@ -262,7 +262,7 @@ void EnTite_SetupAttack(EnTite* this) { EnTite_SetupAction(this, EnTite_Attack); } -void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Attack(EnTite* this, PlayState* play) { s16 angleToPlayer; s32 attackState; Vec3f ripplePos; @@ -308,7 +308,7 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { this->vAttackState++; // TEKTITE_SUBMERGED this->actor.velocity.y *= 0.75f; attackState = this->vAttackState; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 0, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 0, 500, 0); } else { this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; @@ -358,16 +358,16 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { // Generate sparkles at feet upon landing, set jumping animation and hurtbox and check if hit player if (this->actor.velocity.y >= 5.0f) { if (this->actor.bgCheckFlags & 1) { - func_800355B8(globalCtx, &this->frontLeftFootPos); - func_800355B8(globalCtx, &this->frontRightFootPos); - func_800355B8(globalCtx, &this->backRightFootPos); - func_800355B8(globalCtx, &this->backLeftFootPos); + func_800355B8(play, &this->frontLeftFootPos); + func_800355B8(play, &this->frontRightFootPos); + func_800355B8(play, &this->backRightFootPos); + func_800355B8(play, &this->backLeftFootPos); } } if (!(this->collider.base.atFlags & AT_HIT) && (this->actor.flags & ACTOR_FLAG_6)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->collider.base.atFlags &= ~AT_HIT; Animation_MorphToLoop(&this->skelAnime, &object_tite_Anim_0012E4, 4.0f); this->actor.speedXZ = -6.0f; @@ -395,10 +395,10 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { // Create ripples on water surface where tektite feet landed if (this->actor.bgCheckFlags & 2) { if (!(this->actor.bgCheckFlags & 0x20)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); } } // if landed, kill XZ speed and play appropriate sounds @@ -433,7 +433,7 @@ void EnTite_SetupTurnTowardPlayer(EnTite* this) { EnTite_SetupAction(this, EnTite_TurnTowardPlayer); } -void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx) { +void EnTite_TurnTowardPlayer(EnTite* this, PlayState* play) { s16 angleToPlayer; s16 turnVelocity; @@ -448,7 +448,7 @@ void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx) { if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)) { this->actor.world.pos.y += this->actor.yDistToWater; } - angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (angleToPlayer > 0) { turnVelocity = (angleToPlayer / 42.0f) + 10.0f; this->actor.world.rot.y += (turnVelocity * 2); @@ -505,16 +505,16 @@ void EnTite_SetupMoveTowardPlayer(EnTite* this) { /** * Jumping toward player as a method of travel (different from attacking, has no hitbox) */ -void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { +void EnTite_MoveTowardPlayer(EnTite* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 0x42) { if (!(this->actor.bgCheckFlags & 0x40)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_LAND_WATER); @@ -545,7 +545,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { ripplePos.y += this->actor.yDistToWater; this->actor.gravity = 0.0f; this->actor.velocity.y *= 0.75f; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 0, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 0, 500, 0); return; } else { // If submerged, float to surface @@ -593,10 +593,10 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 1000, 0); if (this->actor.velocity.y >= 6.0f) { if (this->actor.bgCheckFlags & 1) { - func_800355B8(globalCtx, &this->frontLeftFootPos); - func_800355B8(globalCtx, &this->frontRightFootPos); - func_800355B8(globalCtx, &this->backRightFootPos); - func_800355B8(globalCtx, &this->backLeftFootPos); + func_800355B8(play, &this->frontLeftFootPos); + func_800355B8(play, &this->frontRightFootPos); + func_800355B8(play, &this->backRightFootPos); + func_800355B8(play, &this->backLeftFootPos); } } } @@ -614,7 +614,7 @@ void EnTite_SetupRecoil(EnTite* this) { /** * After tektite hits or gets hit, recoils backwards and slides a bit upon landing */ -void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Recoil(EnTite* this, PlayState* play) { s16 angleToPlayer; // Snap to ground or water surface upon landing @@ -635,10 +635,10 @@ void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx) { // play sound and generate ripples if (this->actor.bgCheckFlags & 0x42) { if (!(this->actor.bgCheckFlags & 0x40)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { this->actor.bgCheckFlags &= ~0x40; @@ -683,7 +683,7 @@ void EnTite_SetupStunned(EnTite* this) { /** * stunned or frozen */ -void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Stunned(EnTite* this, PlayState* play) { s16 angleToPlayer; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -704,10 +704,10 @@ void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx) { // Play sounds and spawn dirt effects upon landing if (this->actor.bgCheckFlags & 0x42) { if (!(this->actor.bgCheckFlags & 0x40)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { this->actor.bgCheckFlags &= ~0x40; @@ -749,23 +749,23 @@ void EnTite_SetupDeathCry(EnTite* this) { /** * First frame of death. Scream in pain and allocate memory for EnPart data */ -void EnTite_DeathCry(EnTite* this, GlobalContext* globalCtx) { - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_TEKU_DEAD, true, +void EnTite_DeathCry(EnTite* this, PlayState* play) { + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_TEKU_DEAD, true, DEADSOUND_REPEAT_MODE_OFF, 40); this->action = TEKTITE_FALL_APART; EnTite_SetupAction(this, EnTite_FallApart); - BodyBreak_Alloc(&this->bodyBreak, 24, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 24, play); } /** * Spawn EnPart and drop items */ -void EnTite_FallApart(EnTite* this, GlobalContext* globalCtx) { - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 0xB)) { +void EnTite_FallApart(EnTite* this, PlayState* play) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params + 0xB)) { if (this->actor.params == TEKTITE_BLUE) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); } Actor_Kill(&this->actor); } @@ -787,7 +787,7 @@ void EnTite_SetupFlipOnBack(EnTite* this) { /** * During the flip animation and also while idling on back */ -void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx) { +void EnTite_FlipOnBack(EnTite* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0x7FFF, 1, 4000, 0); // randomly reset the leg wiggling animation whenever timer reaches 0 to give illusion of twitching legs this->vLegTwitchTimer--; @@ -799,7 +799,7 @@ void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 3) { // Upon landing, spawn dust and make noise if (this->actor.bgCheckFlags & 2) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } this->vOnBackTimer--; @@ -823,15 +823,15 @@ void EnTite_SetupFlipUpright(EnTite* this) { EnTite_SetupAction(this, EnTite_FlipUpright); } -void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx) { +void EnTite_FlipUpright(EnTite* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0xFA0, 0); SkelAnime_Update(&this->skelAnime); //! @bug flying tektite: the following condition is never met and tektite stays stuck in this action forever if (this->actor.bgCheckFlags & 2) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); this->actor.shape.yOffset = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); @@ -839,7 +839,7 @@ void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx) { } } -void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_CheckDamage(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; if ((this->collider.base.acFlags & AC_HIT) && (this->action >= TEKTITE_IDLE)) { @@ -874,7 +874,7 @@ void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) { } } // If hammer has recently hit the floor and player is close to tektite, flip over - } else if ((thisx->colChkInfo.health != 0) && (globalCtx->actorCtx.unk_02 != 0) && + } else if ((thisx->colChkInfo.health != 0) && (play->actorCtx.unk_02 != 0) && (thisx->xzDistToPlayer <= 400.0f) && (thisx->bgCheckFlags & 1)) { if (this->flipState == TEKTITE_FLIPPED) { EnTite_SetupFlipUpright(this); @@ -884,49 +884,49 @@ void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Update(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; char pad[0x4]; CollisionPoly* floorPoly; WaterBox* waterBox; f32 waterSurfaceY; - EnTite_CheckDamage(thisx, globalCtx); + EnTite_CheckDamage(thisx, play); // Stay still if hit by immunity damage type this frame if (thisx->colChkInfo.damageEffect != 0xE) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 40.0f, 20.0f, this->unk_2DC); + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 40.0f, 20.0f, this->unk_2DC); // If on water, snap feet to surface and spawn ripples if ((this->actor.params == TEKTITE_BLUE) && (thisx->bgCheckFlags & 0x20)) { floorPoly = thisx->floorPoly; - if ((((globalCtx->gameplayFrames % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->backRightFootPos.x, + if ((((play->gameplayFrames % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->backRightFootPos.x, this->backRightFootPos.z, &waterSurfaceY, &waterBox)) && (this->backRightFootPos.y <= waterSurfaceY)) { this->backRightFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->backRightFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->backRightFootPos, 0, 220, 0); } - if (((((globalCtx->gameplayFrames + 2) % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->backLeftFootPos.x, + if (((((play->gameplayFrames + 2) % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->backLeftFootPos.x, this->backLeftFootPos.z, &waterSurfaceY, &waterBox)) && (this->backLeftFootPos.y <= waterSurfaceY)) { this->backLeftFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->backLeftFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->backLeftFootPos, 0, 220, 0); } - if (((((globalCtx->gameplayFrames + 4) % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->frontLeftFootPos.x, + if (((((play->gameplayFrames + 4) % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->frontLeftFootPos.x, this->frontLeftFootPos.z, &waterSurfaceY, &waterBox)) && (this->frontLeftFootPos.y <= waterSurfaceY)) { this->frontLeftFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->frontLeftFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->frontLeftFootPos, 0, 220, 0); } - if (((((globalCtx->gameplayFrames + 1) % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->frontRightFootPos.x, + if (((((play->gameplayFrames + 1) % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->frontRightFootPos.x, this->frontRightFootPos.z, &waterSurfaceY, &waterBox)) && (this->frontRightFootPos.y <= waterSurfaceY)) { this->frontRightFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->frontRightFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->frontRightFootPos, 0, 220, 0); } thisx->floorPoly = floorPoly; } @@ -951,11 +951,11 @@ void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { thisx->focus.pos = thisx->world.pos; thisx->focus.pos.y += 20.0f; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** limbDList, Vec3s* rot, void* thisx) { +void EnTite_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** limbDList, Vec3s* rot, void* thisx) { EnTite* this = (EnTite*)thisx; switch (limbIndex) { @@ -976,11 +976,11 @@ void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** limbDLis BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 24, 24, limbDList, BODYBREAK_OBJECT_DEFAULT); } -void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Draw(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Collider_UpdateSpheres(0, &this->collider); if (this->actor.params == TEKTITE_BLUE) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(object_tite_Tex_001300)); @@ -991,9 +991,9 @@ void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(object_tite_Tex_001F00)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(object_tite_Tex_002100)); } - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnTite_PostLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnTite_PostLimbDraw, thisx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->spawnIceTimer != 0) { // Spawn chunks of ice all over the tektite's body @@ -1006,7 +1006,7 @@ void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { iceChunk.x = thisx->world.pos.x + sIceChunks[idx].x; iceChunk.y = thisx->world.pos.y + sIceChunks[idx].y; iceChunk.z = thisx->world.pos.z + sIceChunks[idx].z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceChunk, 150, 150, 150, 250, 235, 245, 255, 1.0f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &iceChunk, 150, 150, 150, 250, 235, 245, 255, 1.0f); } } } diff --git a/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.h index 308d0b4c3..2faaadf9c 100755 --- a/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/soh/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -6,7 +6,7 @@ struct EnTite; -typedef void (*EnTiteActionFunc)(struct EnTite*, GlobalContext*); +typedef void (*EnTiteActionFunc)(struct EnTite*, PlayState*); typedef enum { /* -2 */ TEKTITE_BLUE = -2, diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 920a8feea..dafff3010 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -15,15 +15,15 @@ bool heartPieceSpawned; -void EnTk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTk_Init(Actor* thisx, PlayState* play); +void EnTk_Destroy(Actor* thisx, PlayState* play); +void EnTk_Update(Actor* thisx, PlayState* play); +void EnTk_Draw(Actor* thisx, PlayState* play); -s32 EnTk_CheckNextSpot(EnTk* this, GlobalContext* globalCtx); -void EnTk_Rest(EnTk* this, GlobalContext* globalCtx); -void EnTk_Walk(EnTk* this, GlobalContext* globalCtx); -void EnTk_Dig(EnTk* this, GlobalContext* globalCtx); +s32 EnTk_CheckNextSpot(EnTk* this, PlayState* play); +void EnTk_Rest(EnTk* this, PlayState* play); +void EnTk_Walk(EnTk* this, PlayState* play); +void EnTk_Dig(EnTk* this, PlayState* play); const ActorInit En_Tk_InitVars = { ACTOR_EN_TK, @@ -83,7 +83,7 @@ void EnTkEff_Update(EnTk* this) { } } -void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { +void EnTkEff_Draw(EnTk* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; @@ -94,11 +94,11 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { s16 alpha; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfxSetup = 0; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->eff); i++) { if (eff->active != 0) { @@ -115,9 +115,9 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->size, eff->size, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); imageIdx = eff->timeLeft * ((f32)ARRAY_COUNT(dustTextures) / eff->timeTotal); @@ -129,7 +129,7 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { eff++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s32 EnTkEff_CreateDflt(EnTk* this, Vec3f* pos, u8 duration, f32 size, f32 growth, f32 yAccelMax) { @@ -167,7 +167,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -void EnTk_RestAnim(EnTk* this, GlobalContext* globalCtx) { +void EnTk_RestAnim(EnTk* this, PlayState* play) { AnimationHeader* anim = &gDampeRestAnim; Animation_Change(&this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeRestAnim), ANIMMODE_LOOP, @@ -177,7 +177,7 @@ void EnTk_RestAnim(EnTk* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } -void EnTk_WalkAnim(EnTk* this, GlobalContext* globalCtx) { +void EnTk_WalkAnim(EnTk* this, PlayState* play) { AnimationHeader* anim = &gDampeWalkAnim; Animation_Change(&this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeRestAnim), ANIMMODE_LOOP, @@ -186,12 +186,12 @@ void EnTk_WalkAnim(EnTk* this, GlobalContext* globalCtx) { this->actionCountdown = Rand_S16Offset(240, 240); } -void EnTk_DigAnim(EnTk* this, GlobalContext* globalCtx) { +void EnTk_DigAnim(EnTk* this, PlayState* play) { AnimationHeader* anim = &gDampeDigAnim; Animation_Change(&this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeDigAnim), ANIMMODE_LOOP, -10.0f); - if (EnTk_CheckNextSpot(this, globalCtx) >= 0) { + if (EnTk_CheckNextSpot(this, play) >= 0) { this->validDigHere = 1; } } @@ -233,12 +233,12 @@ s32 EnTk_CheckFacingPlayer(EnTk* this) { } } -s32 EnTk_CheckNextSpot(EnTk* this, GlobalContext* globalCtx) { +s32 EnTk_CheckNextSpot(EnTk* this, PlayState* play) { Actor* prop; f32 dxz; f32 dy; - prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if (prop->id != ACTOR_EN_IT) { @@ -278,7 +278,7 @@ void EnTk_CheckCurrentSpot(EnTk* this) { } } -f32 EnTk_Step(EnTk* this, GlobalContext* globalCtx) { +f32 EnTk_Step(EnTk* this, PlayState* play) { f32 stepFrames[] = { 36.0f, 10.0f }; f32 a1_; s32 i; @@ -305,7 +305,7 @@ f32 EnTk_Step(EnTk* this, GlobalContext* globalCtx) { } } -s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) { +s32 EnTk_Orient(EnTk* this, PlayState* play) { Path* path; Vec3s* point; f32 dx; @@ -315,7 +315,7 @@ s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) { return 1; } - path = &globalCtx->setupPathList[0]; + path = &play->setupPathList[0]; point = SEGMENTED_TO_VIRTUAL(path->points); point += this->currentWaypoint; @@ -337,10 +337,10 @@ s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) { } } -u16 func_80B1C54C(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80B1C54C(PlayState* play, Actor* thisx) { u16 ret; - ret = Text_GetFaceReaction(globalCtx, 14); + ret = Text_GetFaceReaction(play, 14); if (ret != 0) { return ret; } @@ -354,10 +354,10 @@ u16 func_80B1C54C(GlobalContext* globalCtx, Actor* thisx) { } } -s16 func_80B1C5A0(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80B1C5A0(PlayState* play, Actor* thisx) { s32 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: break; @@ -371,26 +371,26 @@ s16 func_80B1C5A0(GlobalContext* globalCtx, Actor* thisx) { case TEXT_STATE_DONE_FADING: break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx) && (thisx->textId == 0x5018 || thisx->textId == 0x5019)) { - if (globalCtx->msgCtx.choiceIndex == 1) { + if (Message_ShouldAdvance(play) && (thisx->textId == 0x5018 || thisx->textId == 0x5019)) { + if (play->msgCtx.choiceIndex == 1) { /* "Thanks a lot!" */ thisx->textId = 0x0084; } else if (gSaveContext.rupees < 10) { /* "You don't have enough Rupees!" */ thisx->textId = 0x0085; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; Rupees_ChangeBy(-10); gSaveContext.infTable[13] |= 0x0200; return 2; } - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); gSaveContext.infTable[13] |= 0x0200; } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) { - Message_CloseTextbox(globalCtx); + if (Message_ShouldAdvance(play) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) { + Message_CloseTextbox(play); ret = 0; } break; @@ -408,7 +408,7 @@ s32 EnTk_ChooseReward(EnTk* this) { f32 luck; s32 reward; - if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && !Flags_GetCollectible(gGlobalCtx, 0x1F) && this->heartPieceSpawned == 0) { + if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && !Flags_GetCollectible(gPlayState, 0x1F) && this->heartPieceSpawned == 0) { return 3; } @@ -487,23 +487,23 @@ void EnTk_DigEff(EnTk* this) { } } -void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Init(Actor* thisx, PlayState* play) { EnTk* this = (EnTk*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDampeSkel, NULL, this->jointTable, this->morphTable, 18); + SkelAnime_InitFlex(play, &this->skelAnime, &gDampeSkel, NULL, this->jointTable, this->morphTable, 18); Animation_Change(&this->skelAnime, &gDampeRestAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeRestAnim), ANIMMODE_LOOP, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (gSaveContext.dayTime <= 0xC000 || gSaveContext.dayTime >= 0xE000 || !!LINK_IS_ADULT || - globalCtx->sceneNum != SCENE_SPOT02) { + play->sceneNum != SCENE_SPOT02) { Actor_Kill(&this->actor); return; } @@ -518,13 +518,13 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { heartPieceSpawned = false; } -void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Destroy(Actor* thisx, PlayState* play) { EnTk* this = (EnTk*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { +void EnTk_Rest(EnTk* this, PlayState* play) { s16 v1; s16 a1_; @@ -534,13 +534,13 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { v1 = this->actor.yawTowardsPlayer - v1; if (this->h_1E0 == 2) { - EnTk_DigAnim(this, globalCtx); + EnTk_DigAnim(this, play); this->h_1E0 = 0; this->actionFunc = EnTk_Dig; return; } - func_800343CC(globalCtx, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, + func_800343CC(play, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, func_80B1C5A0); } else if (EnTk_CheckFacingPlayer(this)) { v1 = this->actor.shape.rot.y; @@ -548,9 +548,9 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { v1 = this->actor.yawTowardsPlayer - v1; this->actionCountdown = 0; - func_800343CC(globalCtx, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, + func_800343CC(play, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, func_80B1C5A0); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; v1 = this->actor.yawTowardsPlayer - v1; @@ -558,7 +558,7 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { this->actionCountdown = 0; this->h_1E0 = 1; } else if (DECR(this->actionCountdown) == 0) { - EnTk_WalkAnim(this, globalCtx); + EnTk_WalkAnim(this, play); this->actionFunc = EnTk_Walk; /*! @bug v1 is uninitialized past this branch */ @@ -570,26 +570,26 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRot, a1_, 6, 1000, 1); } -void EnTk_Walk(EnTk* this, GlobalContext* globalCtx) { +void EnTk_Walk(EnTk* this, PlayState* play) { if (this->h_1E0 == 2) { - EnTk_DigAnim(this, globalCtx); + EnTk_DigAnim(this, play); this->h_1E0 = 0; this->actionFunc = EnTk_Dig; } else { - this->actor.speedXZ = EnTk_Step(this, globalCtx); - EnTk_Orient(this, globalCtx); + this->actor.speedXZ = EnTk_Step(this, play); + EnTk_Orient(this, play); Math_SmoothStepToS(&this->headRot, 0, 6, 1000, 1); EnTk_CheckCurrentSpot(this); DECR(this->actionCountdown); if (EnTk_CheckFacingPlayer(this) || this->actionCountdown == 0) { - EnTk_RestAnim(this, globalCtx); + EnTk_RestAnim(this, play); this->actionFunc = EnTk_Rest; } } } -void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { +void EnTk_Dig(EnTk* this, PlayState* play) { Vec3f rewardOrigin; Vec3f rewardPos; s32 rewardParams[] = { @@ -629,17 +629,17 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { if (!(gSaveContext.itemGetInf[1] & 0x1000) && !(gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0))) { gSaveContext.itemGetInf[1] |= 0x1000; this->currentReward = 4; - } else if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && !Flags_GetCollectible(gGlobalCtx, 0x1F) && this->heartPieceSpawned == 0) { + } else if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && !Flags_GetCollectible(gPlayState, 0x1F) && this->heartPieceSpawned == 0) { this->currentReward = 4; } } if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && this->currentReward == 4) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, rewardPos.x, rewardPos.y, rewardPos.z, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, rewardPos.x, rewardPos.y, rewardPos.z, 0, 0, 0, 0x1F06); this->heartPieceSpawned = 1; } else { - Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); + Item_DropCollectible(play, &rewardPos, rewardParams[this->currentReward]); } } else { if (this->currentReward == 3) { @@ -653,14 +653,14 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { if (!heartPieceSpawned && (!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) || CVar_GetS32("gGravediggingTourFix", 0) && - !Flags_GetCollectible(globalCtx, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) { + !Flags_GetCollectible(play, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) { this->currentReward = 4; gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE; heartPieceSpawned = true; } } - EnItem00* reward = Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); + EnItem00* reward = Item_DropCollectible(play, &rewardPos, rewardParams[this->currentReward]); if (this->currentReward == 4) { reward->collectibleFlag = COLLECTFLAG_GRAVEDIGGING_HEART_PIECE; } @@ -686,12 +686,12 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->currentReward < 0) { /* "Nope, nothing here!" */ - Message_StartTextbox(globalCtx, 0x501A, NULL); + Message_StartTextbox(play, 0x501A, NULL); } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } - EnTk_RestAnim(this, globalCtx); + EnTk_RestAnim(this, play); this->currentReward = -1; this->validDigHere = 0; @@ -699,35 +699,35 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { } } -void EnTk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Update(Actor* thisx, PlayState* play) { EnTk* this = (EnTk*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 10.0f, 0.0f, 5); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); EnTkEff_Update(this); EnTk_UpdateEyes(this); } -void func_80B1D200(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_80B1D200(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gDampeShovelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnTk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTk* this = (EnTk*)thisx; switch (limbIndex) { @@ -745,7 +745,7 @@ s32 EnTk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnTk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnTk* this = (EnTk*)thisx; Vec3f sp28 = { 0.0f, 0.0f, 4600.0f }; Vec3f sp1C = { 0.0f, 0.0f, 0.0f }; @@ -758,11 +758,11 @@ void EnTk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec /* Limb 14 - Neck */ if (limbIndex == 14) { Matrix_MultVec3f(&sp28, &this->v3f_304); - func_80B1D200(globalCtx); + func_80B1D200(play); } } -void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Draw(Actor* thisx, PlayState* play) { static void* sEyesSegments[] = { gDampeEyeOpenTex, gDampeEyeHalfTex, @@ -771,17 +771,17 @@ void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx) { EnTk* this = (EnTk*)thisx; Matrix_Push(); - EnTkEff_Draw(this, globalCtx); + EnTkEff_Draw(this, play); Matrix_Pop(); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTk_OverrideLimbDraw, EnTk_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 1dff6a252..9b3458585 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -22,7 +22,7 @@ typedef struct EnTkEff { struct EnTk; -typedef void (*EnTkActionFunc)(struct EnTk*, GlobalContext*); +typedef void (*EnTkActionFunc)(struct EnTk*, PlayState*); typedef struct EnTk { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Torch/z_en_torch.c b/soh/src/overlays/actors/ovl_En_Torch/z_en_torch.c index d8bf2f653..ba4ae7083 100644 --- a/soh/src/overlays/actors/ovl_En_Torch/z_en_torch.c +++ b/soh/src/overlays/actors/ovl_En_Torch/z_en_torch.c @@ -8,7 +8,7 @@ #define FLAGS 0 -void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx); +void EnTorch_Init(Actor* thisx, PlayState* play); const ActorInit En_Torch_InitVars = { ACTOR_EN_TORCH, @@ -27,13 +27,13 @@ static u8 sChestContents[] = { GI_RUPEE_BLUE, GI_RUPEE_RED, GI_RUPEE_GOLD, GI_BOMBS_20, GI_BOMBS_1, GI_BOMBS_1, GI_BOMBS_1, GI_BOMBS_1, }; -void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch_Init(Actor* thisx, PlayState* play) { EnTorch* this = (EnTorch*)thisx; s8 returnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data; /* Spawn chest with desired contents. Contents are passed to en_torch from grotto params via Save Context. */ - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOX, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (sChestContents[(returnData >> 0x5) & 0x7] << 0x5) | 0x5000 | (returnData & 0x1F)); diff --git a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 98597fbda..26708d0a9 100644 --- a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -47,10 +47,10 @@ typedef enum { /* 27 */ BIG_SPIN_2H } PlayerSwordAnimation; -void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTorch2_Init(Actor* thisx, PlayState* play); +void EnTorch2_Destroy(Actor* thisx, PlayState* play); +void EnTorch2_Update(Actor* thisx, PlayState* play); +void EnTorch2_Draw(Actor* thisx, PlayState* play); const ActorInit En_Torch2_InitVars = { ACTOR_EN_TORCH2, @@ -121,8 +121,8 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTorch2_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Player* this = (Player*)thisx; sInput.cur.button = sInput.press.button = sInput.rel.button = 0; @@ -130,7 +130,7 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { this->currentShield = PLAYER_SHIELD_HYLIAN; this->heldItemActionParam = this->heldItemId = PLAYER_AP_SWORD_MASTER; Player_SetModelGroup(this, 2); - globalCtx->playerInit(this, globalCtx, &gDarkLinkSkel); + play->playerInit(this, play, &gDarkLinkSkel); this->actor.naviEnemyId = 0x26; this->cylinder.base.acFlags = AC_ON | AC_TYPE_PLAYER; this->swordQuads[0].base.atFlags = this->swordQuads[1].base.atFlags = AT_ON | AT_TYPE_ENEMY; @@ -144,7 +144,7 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.health = gSaveContext.healthCapacity >> 3; this->actor.colChkInfo.cylRadius = 60; this->actor.colChkInfo.cylHeight = 100; - globalCtx->func_11D54(this, globalCtx); + play->func_11D54(this, play); sActionState = ENTORCH2_WAIT; sDodgeRollState = 0; @@ -158,32 +158,32 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { sSpawnPoint = this->actor.home.pos; } -void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_Destroy(Actor* thisx, PlayState* play) { s32 pad; Player* this = (Player*)thisx; - Effect_Delete(globalCtx, this->swordEffectIndex); + Effect_Delete(play, this->swordEffectIndex); func_800F5B58(); - Collider_DestroyCylinder(globalCtx, &this->cylinder); - Collider_DestroyQuad(globalCtx, &this->swordQuads[0]); - Collider_DestroyQuad(globalCtx, &this->swordQuads[1]); - Collider_DestroyQuad(globalCtx, &this->shieldQuad); + Collider_DestroyCylinder(play, &this->cylinder); + Collider_DestroyQuad(play, &this->swordQuads[0]); + Collider_DestroyQuad(play, &this->swordQuads[1]); + Collider_DestroyQuad(play, &this->shieldQuad); } -Actor* EnTorch2_GetAttackItem(GlobalContext* globalCtx, Player* this) { - Actor* rangedItem = Actor_GetProjectileActor(globalCtx, &this->actor, 4000.0f); +Actor* EnTorch2_GetAttackItem(PlayState* play, Player* this) { + Actor* rangedItem = Actor_GetProjectileActor(play, &this->actor, 4000.0f); if (rangedItem != NULL) { return rangedItem; } else { - return func_80033684(globalCtx, &this->actor); + return func_80033684(play, &this->actor); } } -s32 EnTorch2_SwingSword(GlobalContext* globalCtx, Input* input, Player* this) { +s32 EnTorch2_SwingSword(PlayState* play, Input* input, Player* this) { f32 noAttackChance = 0.0f; s32 attackDelay = 7; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->linearVelocity < 0.0f) || (player->linearVelocity < 0.0f)) { return 0; @@ -195,7 +195,7 @@ s32 EnTorch2_SwingSword(GlobalContext* globalCtx, Input* input, Player* this) { if (sAlpha != 255) { noAttackChance += 2.0f; } - if ((((globalCtx->gameplayFrames & attackDelay) == 0) || (sSwordJumpState != 0)) && + if ((((play->gameplayFrames & attackDelay) == 0) || (sSwordJumpState != 0)) && (noAttackChance <= Rand_ZeroOne())) { if (sSwordJumpState == 0) { switch ((s32)(Rand_ZeroOne() * 7.0f)) { @@ -227,9 +227,9 @@ void EnTorch2_Backflip(Player* this, Input* input, Actor* thisx) { sCounterState = 0; } -void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; - Player* player2 = GET_PLAYER(globalCtx2); +void EnTorch2_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + Player* player2 = GET_PLAYER(play2); Player* player = player2; Player* this = (Player*)thisx; Input* input = &sInput; @@ -247,8 +247,8 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { sp5A = player->actor.shape.rot.y - this->actor.shape.rot.y; input->cur.button = 0; - camera = Gameplay_GetCamera(globalCtx, 0); - attackItem = EnTorch2_GetAttackItem(globalCtx, this); + camera = Play_GetCamera(play, 0); + attackItem = EnTorch2_GetAttackItem(play, this); switch (sActionState) { case ENTORCH2_WAIT: this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -256,7 +256,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->skelAnime.playSpeed = 0.0f; this->actor.world.pos.x = (Math_SinS(this->actor.world.rot.y) * 25.0f) + sSpawnPoint.x; this->actor.world.pos.z = (Math_CosS(this->actor.world.rot.y) * 25.0f) + sSpawnPoint.z; - if ((this->actor.xzDistToPlayer <= 120.0f) || Actor_IsTargeted(globalCtx, &this->actor) || + if ((this->actor.xzDistToPlayer <= 120.0f) || Actor_IsTargeted(play, &this->actor) || (attackItem != NULL)) { if (attackItem != NULL) { sDodgeRollState = 1; @@ -304,8 +304,8 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { } } if ((sCounterState != 0) && (this->swordState != 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->swordQuads[0].base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->swordQuads[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->swordQuads[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->swordQuads[1].base); } // Ignores hits when jumping on Link's sword @@ -331,7 +331,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { (player->swordAnimation == JUMPSLASH_START)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - if (globalCtx->gameplayFrames % 2) { + if (play->gameplayFrames % 2) { sStickAngle = this->actor.yawTowardsPlayer + 0x4000; } else { sStickAngle = this->actor.yawTowardsPlayer - 0x4000; @@ -366,7 +366,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.flags |= ACTOR_FLAG_0; } else if (sSwordJumpState == 1) { if (sSwordJumpTimer < 16) { - EnTorch2_SwingSword(globalCtx, input, this); + EnTorch2_SwingSword(play, input, this); sSwordJumpState++; } else if (sSwordJumpTimer == 19) { func_800F4190(&this->actor.projectedPos, NA_SE_VO_LI_AUTO_JUMP); @@ -381,7 +381,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { // Handles Dark Link's reaction to sword attack other than jumpslashes - if (func_800354B4(globalCtx, &this->actor, 120.0f, 0x7FFF, 0x7FFF, this->actor.world.rot.y)) { + if (func_800354B4(play, &this->actor, 120.0f, 0x7FFF, 0x7FFF, this->actor.world.rot.y)) { if ((player->swordAnimation == STAB_1H) && (this->actor.xzDistToPlayer < 90.0f)) { // Handles the reaction to a one-handed stab. If the conditions are satisfied, @@ -389,7 +389,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->swordState == 0) && (sCounterState == 0) && (player->invincibilityTimer == 0) && (player->swordAnimation == STAB_1H) && (this->actor.xzDistToPlayer <= 85.0f) && - Actor_IsTargeted(globalCtx, &this->actor)) { + Actor_IsTargeted(play, &this->actor)) { sStickTilt = 0.0f; sSwordJumpState = 1; @@ -401,7 +401,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->invincibilityTimer = -7; this->linearVelocity = 0.0f; player->skelAnime.curFrame = 2.0f; - LinkAnimation_Update(globalCtx, &player->skelAnime); + LinkAnimation_Update(play, &player->skelAnime); sHoldShieldTimer = 0; input->cur.button = BTN_A; } else { @@ -442,11 +442,11 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { sp50 = 0.0f; if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && (ABS(sp5A) >= 0x7800) && (this->actor.isTargeted || !(player->stateFlags1 & 0x00400000))) { - EnTorch2_SwingSword(globalCtx, input, this); + EnTorch2_SwingSword(play, input, this); } else if (((this->actor.xzDistToPlayer <= 70.0f) || ((this->actor.xzDistToPlayer <= 80.0f + sp50) && (player->swordState != 0))) && (this->swordState == 0)) { - if (!EnTorch2_SwingSword(globalCtx, input, this) && (this->swordState == 0) && + if (!EnTorch2_SwingSword(play, input, this) && (this->swordState == 0) && (sCounterState == 0)) { EnTorch2_Backflip(this, input, &this->actor); } @@ -468,7 +468,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { EnTorch2_Backflip(this, input, &this->actor); } } else if (((ABS(sp5A) < 0x7800) && (ABS(sp5A) >= 0x3000)) || - !EnTorch2_SwingSword(globalCtx, input, this)) { + !EnTorch2_SwingSword(play, input, this)) { sStickAngle = this->actor.yawTowardsPlayer; sStickTilt = 127.0f; if (!this->actor.isTargeted) { @@ -503,7 +503,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { if (sAlpha) {} sInput.cur.stick_y = stickY; - if ((sAlpha != 255) && ((globalCtx->gameplayFrames % 8) == 0)) { + if ((sAlpha != 255) && ((play->gameplayFrames % 8) == 0)) { sAlpha++; } break; @@ -533,7 +533,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.y = this->actor.floorHeight; } Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); - globalCtx->func_11D54(this, globalCtx); + play->func_11D54(this, play); sActionState = ENTORCH2_ATTACK; sStickTilt = 0.0f; if (sAlpha != 255) { @@ -605,8 +605,8 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_8A2 = this->actor.yawTowardsPlayer + 0x8000; sDeathFlag++; sActionState = ENTORCH2_DEATH; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - Item_DropCollectibleRandom(globalCtx, &this->actor, &thisx->world.pos, 0xC0); + Enemy_StartFinishingBlow(play, &this->actor); + Item_DropCollectibleRandom(play, &this->actor, &thisx->world.pos, 0xC0); this->stateFlags3 &= ~4; } else { func_800F5ACC(NA_BGM_MINI_BOSS); @@ -657,7 +657,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->linearVelocity = 0.0f; } - globalCtx->playerUpdate(this, globalCtx, input); + play->playerUpdate(this, play, input); /* * Handles sword clanks and removes their recoil for both Links. Dark Link staggers @@ -702,9 +702,9 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->swordState = 1; this->skelAnime.curFrame = player->skelAnime.curFrame - player->skelAnime.playSpeed; this->skelAnime.playSpeed = player->skelAnime.playSpeed; - LinkAnimation_Update(globalCtx, &this->skelAnime); - Collider_ResetQuadAT(globalCtx, &this->swordQuads[0].base); - Collider_ResetQuadAT(globalCtx, &this->swordQuads[1].base); + LinkAnimation_Update(play, &this->skelAnime); + Collider_ResetQuadAT(play, &this->swordQuads[0].base); + Collider_ResetQuadAT(play, &this->swordQuads[1].base); } } if (sStaggerTimer != 0) { @@ -752,43 +752,43 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.yOffset = sSwordJumpHeight; } -s32 EnTorch2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnTorch2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { Player* this = (Player*)thisx; - return func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, &this->actor); + return func_8008FCC8(play, limbIndex, dList, pos, rot, &this->actor); } -void EnTorch2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnTorch2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Player* this = (Player*)thisx; - func_80090D20(globalCtx, limbIndex, dList, rot, &this->actor); + func_80090D20(play, limbIndex, dList, rot, &this->actor); } -void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTorch2_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Player* this = (Player*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093C80(globalCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093C80(play); + func_80093D84(play->state.gfxCtx); if (sAlpha == 255) { gDPSetEnvColor(POLY_OPA_DISP++, 255, 0, 0, sAlpha); gSPSegment(POLY_OPA_DISP++, 0x0C, D_80116280 + 2); - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw, this, POLY_OPA_DISP); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, sAlpha); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index af994bbf3..da611dfd7 100644 --- a/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnToryo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnToryo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnToryo_Init(Actor* thisx, PlayState* play); +void EnToryo_Destroy(Actor* thisx, PlayState* play); +void EnToryo_Update(Actor* thisx, PlayState* play); +void EnToryo_Draw(Actor* thisx, PlayState* play); -void func_80B20914(EnToryo* this, GlobalContext* globalCtx); -s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnToryo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +void func_80B20914(EnToryo* this, PlayState* play); +s32 EnToryo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnToryo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Toryo_InitVars = { ACTOR_EN_TORYO, @@ -93,11 +93,11 @@ static AnimationSpeedInfo sEnToryoAnimation = { &object_toryo_Anim_000E50, 1.0f, static Vec3f sMultVec = { 800.0f, 1000.0f, 0.0f }; -void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Init(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; s32 pad; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT09: if (LINK_AGE_IN_YEARS == YEARS_ADULT) { this->stateFlags |= 1; @@ -120,12 +120,12 @@ void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 42.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_toryo_Skel_007150, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, NULL, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); Animation_Change(&this->skelAnime, sEnToryoAnimation.animation, 1.0f, 0.0f, Animation_GetLastFrame(sEnToryoAnimation.animation), sEnToryoAnimation.mode, sEnToryoAnimation.morphFrames); @@ -134,18 +134,18 @@ void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B20914; } -void EnToryo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Destroy(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { +s32 func_80B203D8(EnToryo* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CLOSING: @@ -154,12 +154,12 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { ret = 1; break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { - Message_CloseTextbox(globalCtx); + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + Message_CloseTextbox(play); this->actor.parent = NULL; player->exchangeItemId = EXCH_ITEM_NONE; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actor.textId = 0x601B; ret = 3; } else { @@ -172,27 +172,27 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { switch (this->actor.textId) { case 0x5028: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { gSaveContext.infTable[23] |= 4; ret = 0; } break; case 0x601B: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 4; } break; case 0x606F: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { gSaveContext.infTable[23] |= 2; ret = 0; } break; case 0x606A: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { gSaveContext.infTable[23] |= 1; ret = 0; } @@ -203,7 +203,7 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { case 0x606E: default: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 0; } break; @@ -213,12 +213,12 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { return ret; } -s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) { +s32 func_80B205CC(EnToryo* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 ret = 5; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CLOSING: @@ -228,7 +228,7 @@ s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) { ret = 5; break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 0; } break; @@ -236,7 +236,7 @@ s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) { return ret; } -u32 func_80B20634(EnToryo* this, GlobalContext* globalCtx) { +u32 func_80B20634(EnToryo* this, PlayState* play) { u32 ret; if (this->unk_1E0 != 0) { @@ -255,8 +255,8 @@ u32 func_80B20634(EnToryo* this, GlobalContext* globalCtx) { return ret; } -s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) { - s32 textId = Text_GetFaceReaction(globalCtx, 0); +s32 func_80B206A0(EnToryo* this, PlayState* play) { + s32 textId = Text_GetFaceReaction(play, 0); s32 ret = textId; if (textId == 0) { @@ -284,70 +284,70 @@ s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) { return ret; } -void func_80B20768(EnToryo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B20768(EnToryo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp32; s16 sp30; if (this->unk_1E4 == 3) { - Actor_ProcessTalkRequest(&this->actor, globalCtx); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Actor_ProcessTalkRequest(&this->actor, play); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E4 = 1; } if (this->unk_1E4 == 1) { - this->unk_1E4 = func_80B203D8(this, globalCtx); + this->unk_1E4 = func_80B203D8(this, play); } if (this->unk_1E4 == 5) { - this->unk_1E4 = func_80B205CC(this, globalCtx); + this->unk_1E4 = func_80B205CC(this, play); return; } if (this->unk_1E4 == 2) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E4 = 1; } if (this->unk_1E4 == 4) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->unk_1E4 = 5; } else { if (gSaveContext.n64ddFlag) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_GV_TRADE_SAW, GI_SWORD_BROKEN); - Randomizer_ConsumeAdultTradeItem(globalCtx, ITEM_SAW); - GiveItemEntryFromActor(&this->actor, globalCtx, itemEntry, 100.0f, 10.0f); + Randomizer_ConsumeAdultTradeItem(play, ITEM_SAW); + GiveItemEntryFromActor(&this->actor, play, itemEntry, 100.0f, 10.0f); } else { s32 itemId = GI_SWORD_BROKEN; - func_8002F434(&this->actor, globalCtx, itemId, 100.0f, 10.0f); + func_8002F434(&this->actor, play, itemId, 100.0f, 10.0f); } } return; } if (this->unk_1E4 == 0) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - this->unk_1E0 = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + this->unk_1E0 = func_8002F368(play); if (this->unk_1E0 != 0) { - player->actor.textId = func_80B20634(this, globalCtx); + player->actor.textId = func_80B20634(this, play); this->actor.textId = player->actor.textId; } this->unk_1E4 = 1; return; } - Actor_GetScreenPos(globalCtx, &this->actor, &sp32, &sp30); + Actor_GetScreenPos(play, &this->actor, &sp32, &sp30); if ((sp32 >= 0) && (sp32 < 0x141) && (sp30 >= 0) && (sp30 < 0xF1)) { - this->actor.textId = func_80B206A0(this, globalCtx); - func_8002F298(&this->actor, globalCtx, 100.0f, 10); + this->actor.textId = func_80B206A0(this, play); + func_8002F298(&this->actor, play, 100.0f, 10); } } } -void func_80B20914(EnToryo* this, GlobalContext* globalCtx) { +void func_80B20914(EnToryo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - func_80B20768(this, globalCtx); + func_80B20768(this, play); if (this->unk_1E4 != 0) { this->stateFlags |= 0x10; } else { @@ -355,16 +355,16 @@ void func_80B20914(EnToryo* this, GlobalContext* globalCtx) { } } -void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Update(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; ColliderCylinder* collider = &this->collider; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 rot; Collider_UpdateCylinder(thisx, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider*)collider); + CollisionCheck_SetOC(play, &play->colChkCtx, (Collider*)collider); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->stateFlags & 8)) { this->unk_1EC.unk_18.x = player->actor.focus.pos.x; @@ -385,15 +385,15 @@ void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnToryo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Draw(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnToryo_OverrideLimbDraw, EnToryo_PostLimbDraw, this); } -s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnToryo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnToryo* this = (EnToryo*)thisx; @@ -412,7 +412,7 @@ s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return 0; } -void EnToryo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnToryo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnToryo* this = (EnToryo*)thisx; switch (limbIndex) { diff --git a/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h b/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h index b6963f501..c82f7aec2 100644 --- a/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h +++ b/soh/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h @@ -6,7 +6,7 @@ struct EnToryo; -typedef void (*EnToryoActionFunc)(struct EnToryo* this, GlobalContext* globalCtx); +typedef void (*EnToryoActionFunc)(struct EnToryo* this, PlayState* play); typedef struct EnToryo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 31a909abb..de8785825 100644 --- a/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -9,25 +9,25 @@ #define FLAGS 0 -void EnTp_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTp_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTp_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTp_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTp_Init(Actor* thisx, PlayState* play); +void EnTp_Destroy(Actor* thisx, PlayState* play); +void EnTp_Update(Actor* thisx, PlayState* play); +void EnTp_Draw(Actor* thisx, PlayState* play); void EnTp_Tail_SetupFollowHead(EnTp* this); -void EnTp_Tail_FollowHead(EnTp* this, GlobalContext* globalCtx); +void EnTp_Tail_FollowHead(EnTp* this, PlayState* play); void EnTp_Head_SetupApproachPlayer(EnTp* this); -void EnTp_Head_ApproachPlayer(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_ApproachPlayer(EnTp* this, PlayState* play); void EnTp_SetupDie(EnTp* this); -void EnTp_Die(EnTp* this, GlobalContext* globalCtx); +void EnTp_Die(EnTp* this, PlayState* play); void EnTp_Fragment_SetupFade(EnTp* this); -void EnTp_Fragment_Fade(EnTp* this, GlobalContext* globalCtx); +void EnTp_Fragment_Fade(EnTp* this, PlayState* play); void EnTp_Head_SetupTakeOff(EnTp* this); -void EnTp_Head_TakeOff(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_TakeOff(EnTp* this, PlayState* play); void EnTp_Head_SetupWait(EnTp* this); -void EnTp_Head_Wait(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_Wait(EnTp* this, PlayState* play); void EnTp_Head_SetupBurrowReturnHome(EnTp* this); -void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_BurrowReturnHome(EnTp* this, PlayState* play); typedef enum { /* 0 */ TAILPASARAN_ACTION_FRAGMENT_FADE, @@ -129,8 +129,8 @@ void EnTp_SetupAction(EnTp* this, EnTpActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTp_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTp* this = (EnTp*)thisx; EnTp* now; EnTp* next; @@ -144,8 +144,8 @@ void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.health = 1; now = this; this->alpha = 255; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); if (this->actor.params <= TAILPASARAN_HEAD) { this->actor.naviEnemyId = 0x06; @@ -158,7 +158,7 @@ void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->actor, 1.5f); for (i = 0; i <= 6; i++) { - next = (EnTp*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TP, this->actor.world.pos.x, + next = (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0 * i); if (0 * i) {} // Very fake, but needed to get the s registers right @@ -187,10 +187,10 @@ void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnTp_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTp_Destroy(Actor* thisx, PlayState* play) { EnTp* this = (EnTp*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnTp_Tail_SetupFollowHead(EnTp* this) { @@ -198,7 +198,7 @@ void EnTp_Tail_SetupFollowHead(EnTp* this) { EnTp_SetupAction(this, EnTp_Tail_FollowHead); } -void EnTp_Tail_FollowHead(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Tail_FollowHead(EnTp* this, PlayState* play) { s16 angle; s16 phase; @@ -238,8 +238,8 @@ void EnTp_Head_SetupApproachPlayer(EnTp* this) { EnTp_SetupAction(this, EnTp_Head_ApproachPlayer); } -void EnTp_Head_ApproachPlayer(EnTp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTp_Head_ApproachPlayer(EnTp* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 30.0f, 1.0f, 0.5f, 0.0f); Audio_PlaySoundGeneral(NA_SE_EN_TAIL_FLY - SFX_FLAG, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, @@ -294,7 +294,7 @@ void EnTp_SetupDie(EnTp* this) { /** * Spawns effects and smaller tail segment-like fragments */ -void EnTp_Die(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Die(EnTp* this, PlayState* play) { EnTp* now; s16 i; s32 pad; @@ -308,19 +308,19 @@ void EnTp_Die(EnTp* this, GlobalContext* globalCtx) { effectPos.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; effectPos.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; effectPos.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; - EffectSsDeadDb_Spawn(globalCtx, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, + EffectSsDeadDb_Spawn(play, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); effectPos.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; effectPos.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; effectPos.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; - EffectSsDeadDb_Spawn(globalCtx, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, + EffectSsDeadDb_Spawn(play, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x50); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x50); } else { for (i = 0; i < 1; i++) { now = - (EnTp*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TP, this->actor.world.pos.x, + (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TAILPASARAN_FRAGMENT); if (now != NULL) { @@ -353,7 +353,7 @@ void EnTp_Fragment_SetupFade(EnTp* this) { EnTp_SetupAction(this, EnTp_Fragment_Fade); } -void EnTp_Fragment_Fade(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Fragment_Fade(EnTp* this, PlayState* play) { func_8002D7EC(&this->actor); this->alpha -= 20; @@ -372,9 +372,9 @@ void EnTp_Head_SetupTakeOff(EnTp* this) { /** * Flies up and loops around until it makes for Player */ -void EnTp_Head_TakeOff(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Head_TakeOff(EnTp* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 2.5f, 0.1f, 0.2f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->horizontalVariation, 1.0f, @@ -429,8 +429,8 @@ void EnTp_Head_SetupWait(EnTp* this) { /** * Awaken and rise from the ground when Player is closer than 200 */ -void EnTp_Head_Wait(EnTp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTp_Head_Wait(EnTp* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yaw; this->unk_15C--; @@ -488,7 +488,7 @@ void EnTp_Head_SetupBurrowReturnHome(EnTp* this) { EnTp_SetupAction(this, EnTp_Head_BurrowReturnHome); } -void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Head_BurrowReturnHome(EnTp* this, PlayState* play) { static Vec3f bubbleAccel = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 bubblePrimColor = { 255, 255, 255, 255 }; static Color_RGBA8 bubbleEnvColor = { 150, 150, 150, 0 }; @@ -551,7 +551,7 @@ void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx) { &D_801333E8); } - if (closeToFloor && ((globalCtx->gameplayFrames & 1) != 0)) { + if (closeToFloor && ((play->gameplayFrames & 1) != 0)) { bubblePos = this->actor.world.pos; bubblePos.y = this->actor.floorHeight; @@ -559,13 +559,13 @@ void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx) { bubbleVelocity.y = (Rand_ZeroOne() * 3.5f) + 1.5f; bubbleVelocity.z = Rand_CenteredFloat(5.0f); - EffectSsDtBubble_SpawnCustomColor(globalCtx, &bubblePos, &bubbleVelocity, &bubbleAccel, &bubblePrimColor, + EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVelocity, &bubbleAccel, &bubblePrimColor, &bubbleEnvColor, Rand_S16Offset(100, 50), 20, 0); } } } -void EnTp_UpdateDamage(EnTp* this, GlobalContext* globalCtx) { +void EnTp_UpdateDamage(EnTp* this, PlayState* play) { s32 phi_s2; s32 phi_s4; EnTp* head; // Can eliminate this and just use now, but they're used differently @@ -644,7 +644,7 @@ void EnTp_UpdateDamage(EnTp* this, GlobalContext* globalCtx) { } } -void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTp_Update(Actor* thisx, PlayState* play) { s32 pad; EnTp* this = (EnTp*)thisx; Vec3f kiraVelocity = { 0.0f, 0.0f, 0.0f }; @@ -652,7 +652,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { Vec3f kiraPos; Color_RGBA8 kiraPrimColor = { 0, 0, 255, 255 }; Color_RGBA8 kiraEnvColor = { 0, 0, 0, 0 }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yawToWall; if (player->stateFlags1 & 0x4000000) { // Shielding @@ -660,16 +660,16 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.colChkInfo.health != 0) { - EnTp_UpdateDamage(this, globalCtx); + EnTp_UpdateDamage(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params <= TAILPASARAN_HEAD) { Actor_MoveForward(&this->actor); if (this->actionIndex != TAILPASARAN_ACTION_HEAD_BURROWRETURNHOME) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 15.0f, 10.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 15.0f, 10.0f, 5); } // Turn away from wall @@ -695,7 +695,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionIndex >= TAILPASARAN_ACTION_TAIL_FOLLOWHEAD) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -707,7 +707,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; if (this->damageEffect == TAILPASARAN_DMGEFF_SHOCKING) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->kiraSpawnTimer & 7) == 0) { @@ -718,32 +718,32 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { kiraPos.x = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.x; kiraPos.y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + this->actor.world.pos.y; kiraPos.z = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnSmall(globalCtx, &kiraPos, &kiraVelocity, &kiraAccel, &kiraPrimColor, &kiraEnvColor); + EffectSsKiraKira_SpawnSmall(play, &kiraPos, &kiraVelocity, &kiraAccel, &kiraPrimColor, &kiraEnvColor); } if ((this->actionIndex >= TAILPASARAN_ACTION_TAIL_FOLLOWHEAD) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnTp_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTp_Draw(Actor* thisx, PlayState* play) { s32 pad; EnTp* this = (EnTp*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_150 != 2) { if ((thisx->params <= TAILPASARAN_HEAD) || (thisx->params == TAILPASARAN_HEAD_DYING)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gTailpasaranHeadDL); Matrix_Translate(0.0f, 0.0f, 8.0f, MTXMODE_APPLY); } else { - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->red, 0, 255, this->alpha); gDPPipeSync(POLY_XLU_DISP++); @@ -753,13 +753,13 @@ void EnTp_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gTailpasaranTailSegmentTex)); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gTailpasaranTailSegmentDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if ((thisx->params <= TAILPASARAN_TAIL) || (thisx->params == TAILPASARAN_TAIL_DYING)) { Collider_UpdateSpheres(0, &this->collider); diff --git a/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.h b/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.h index c466304c7..04d4f7663 100644 --- a/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -6,7 +6,7 @@ struct EnTp; -typedef void (*EnTpActionFunc)(struct EnTp*, GlobalContext*); +typedef void (*EnTpActionFunc)(struct EnTp*, PlayState*); typedef struct EnTp { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c index 33e337341..2f1a96436 100644 --- a/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -9,19 +9,19 @@ #define FLAGS ACTOR_FLAG_4 -void EnTr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTr_Init(Actor* thisx, PlayState* play); +void EnTr_Destroy(Actor* thisx, PlayState* play); +void EnTr_Update(Actor* thisx, PlayState* play); +void EnTr_Draw(Actor* thisx, PlayState* play); -void EnTr_DoNothing(EnTr* this, GlobalContext* globalCtx); -void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx); -void EnTr_WaitToReappear(EnTr* this, GlobalContext* globalCtx); -void EnTr_ChooseAction1(EnTr* this, GlobalContext* globalCtx); +void EnTr_DoNothing(EnTr* this, PlayState* play); +void EnTr_ShrinkVanish(EnTr* this, PlayState* play); +void EnTr_WaitToReappear(EnTr* this, PlayState* play); +void EnTr_ChooseAction1(EnTr* this, PlayState* play); -void EnTr_UpdateRotation(EnTr* this, GlobalContext* globalCtx, s32 actionIndex); -void func_80B24038(EnTr* this, GlobalContext* globalCtx, s32 actionIndex); -void EnTr_SetStartPosRot(EnTr* this, GlobalContext* globalCtx, s32 actionIndex); +void EnTr_UpdateRotation(EnTr* this, PlayState* play, s32 actionIndex); +void func_80B24038(EnTr* this, PlayState* play, s32 actionIndex); +void EnTr_SetStartPosRot(EnTr* this, PlayState* play, s32 actionIndex); const ActorInit En_Tr_InitVars = { ACTOR_EN_TR, @@ -85,7 +85,7 @@ void EnTr_SetupAction(EnTr* this, EnTrActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Init(Actor* thisx, PlayState* play) { EnTr* this = (EnTr*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); @@ -96,7 +96,7 @@ void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case TR_KOUME: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tr_Skel_011688, &object_tr_Anim_003FC8, + SkelAnime_InitFlex(play, &this->skelAnime, &object_tr_Skel_011688, &object_tr_Anim_003FC8, this->jointTable, this->morphTable, 27); Animation_PlayOnce(&this->skelAnime, &object_tr_Anim_003FC8); this->animation = NULL; @@ -105,7 +105,7 @@ void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { break; case TR_KOTAKE: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tr_Skel_00C530, &object_tr_Anim_001CDC, + SkelAnime_InitFlex(play, &this->skelAnime, &object_tr_Skel_00C530, &object_tr_Anim_001CDC, this->jointTable, this->morphTable, 27); Animation_PlayOnce(&this->skelAnime, &object_tr_Anim_001CDC); this->animation = NULL; @@ -119,10 +119,10 @@ void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Destroy(Actor* thisx, PlayState* play) { } -void EnTr_CrySpellcast(EnTr* this, GlobalContext* globalCtx) { +void EnTr_CrySpellcast(EnTr* this, PlayState* play) { if (this->timer == 11) { // Both cry in the title screen cutscene, but only Kotake in the in-game cutscene if ((this->actor.params != TR_KOUME) || (gSaveContext.sceneSetupIndex == 6)) { @@ -139,13 +139,13 @@ void EnTr_CrySpellcast(EnTr* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } -void EnTr_DoNothing(EnTr* this, GlobalContext* globalCtx) { +void EnTr_DoNothing(EnTr* this, PlayState* play) { } -void EnTr_ChooseAction2(EnTr* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->actionIndex] != NULL) { - switch (globalCtx->csCtx.npcActions[this->actionIndex]->action) { +void EnTr_ChooseAction2(EnTr* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->actionIndex] != NULL) { + switch (play->csCtx.npcActions[this->actionIndex]->action) { case 4: Actor_SetScale(&this->actor, 0.01f); @@ -160,15 +160,15 @@ void EnTr_ChooseAction2(EnTr* this, GlobalContext* globalCtx) { EnTr_SetupAction(this, EnTr_CrySpellcast); this->animation = D_80B24378[this->actor.params]; this->timer = 39; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->actor.params + 9); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_MASIC1); break; default: - func_80B24038(this, globalCtx, this->actionIndex); - EnTr_UpdateRotation(this, globalCtx, this->actionIndex); + func_80B24038(this, play, this->actionIndex); + EnTr_UpdateRotation(this, play, this->actionIndex); break; } func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); @@ -176,18 +176,18 @@ void EnTr_ChooseAction2(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_FlyKidnapCutscene(EnTr* this, GlobalContext* globalCtx) { +void EnTr_FlyKidnapCutscene(EnTr* this, PlayState* play) { Vec3f originalPos = this->actor.world.pos; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->actionIndex] != NULL) { - if (globalCtx->csCtx.npcActions[this->actionIndex]->action == 8) { - func_80B24038(this, globalCtx, this->actionIndex); + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->actionIndex] != NULL) { + if (play->csCtx.npcActions[this->actionIndex]->action == 8) { + func_80B24038(this, play, this->actionIndex); this->actor.world.rot.y = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 10, 0x400, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; } else { - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); this->actor.world.pos.x += Math_SinS(this->timer) * 150.0f; this->actor.world.pos.y += -100.0f; this->actor.world.pos.z += Math_CosS(this->timer) * 150.0f; @@ -200,21 +200,21 @@ void EnTr_FlyKidnapCutscene(EnTr* this, GlobalContext* globalCtx) { this->actor.velocity.z = this->actor.world.pos.z - originalPos.z; } - if (globalCtx->csCtx.frames < 670) { + if (play->csCtx.frames < 670) { func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } } } } -void func_80B23254(EnTr* this, GlobalContext* globalCtx, s32 arg2, f32 arg3, f32 scale) { +void func_80B23254(EnTr* this, PlayState* play, s32 arg2, f32 arg3, f32 scale) { Vec3f pos; Vec3f velocity; Vec3f accel; Vec3f sp58; Color_RGBA8* primColor; Color_RGBA8* envColor; - Vec3f cameraEye = GET_ACTIVE_CAM(globalCtx)->eye; + Vec3f cameraEye = GET_ACTIVE_CAM(play)->eye; s16 yaw = Math_Vec3f_Yaw(&cameraEye, &this->actor.world.pos); s16 reversePitch = -Math_Vec3f_Pitch(&cameraEye, &this->actor.world.pos); f32 sp3C; @@ -238,10 +238,10 @@ void func_80B23254(EnTr* this, GlobalContext* globalCtx, s32 arg2, f32 arg3, f32 pos.x = sp58.x + ((D_80B24388[arg2] * scale) * Math_CosS(yaw)); pos.y = sp58.y + (D_80B243A4[arg2] * scale); pos.z = sp58.z - ((D_80B24388[arg2] * scale) * Math_SinS(yaw)); - func_8002829C(globalCtx, &pos, &velocity, &accel, primColor, envColor, (s32)(800.0f * scale), (s32)(80.0f * scale)); + func_8002829C(play, &pos, &velocity, &accel, primColor, envColor, (s32)(800.0f * scale), (s32)(80.0f * scale)); } -void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx) { +void EnTr_ShrinkVanish(EnTr* this, PlayState* play) { if (this->timer >= 17) { this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; } else { @@ -251,8 +251,8 @@ void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx) { } else if (this->timer > 0) { s32 temp_hi = (this->timer * 2) % 7; - func_80B23254(this, globalCtx, temp_hi, 5.0f, 0.2f); - func_80B23254(this, globalCtx, (temp_hi + 1) % 7, 5.0f, 0.2f); + func_80B23254(this, play, temp_hi, 5.0f, 0.2f); + func_80B23254(this, play, (temp_hi + 1) % 7, 5.0f, 0.2f); Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; } else { @@ -270,12 +270,12 @@ void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_Reappear(EnTr* this, GlobalContext* globalCtx) { +void EnTr_Reappear(EnTr* this, PlayState* play) { if (this->timer >= 31) { s32 temp_hi = (this->timer * 2) % 7; - func_80B23254(this, globalCtx, temp_hi, 5.0f, 1.0f); - func_80B23254(this, globalCtx, (temp_hi + 1) % 7, 5.0f, 1.0f); + func_80B23254(this, play, temp_hi, 5.0f, 1.0f); + func_80B23254(this, play, (temp_hi + 1) % 7, 5.0f, 1.0f); } else if (this->timer == 30) { this->actor.draw = EnTr_Draw; this->actor.shape.rot.y += this->timer * 0x1A6; @@ -293,14 +293,14 @@ void EnTr_Reappear(EnTr* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } -void EnTr_WaitToReappear(EnTr* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[this->actionIndex] != NULL) && - ((globalCtx->csCtx.npcActions[this->actionIndex]->action == 3) || - (globalCtx->csCtx.npcActions[this->actionIndex]->action == 5))) { +void EnTr_WaitToReappear(EnTr* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[this->actionIndex] != NULL) && + ((play->csCtx.npcActions[this->actionIndex]->action == 3) || + (play->csCtx.npcActions[this->actionIndex]->action == 5))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM); this->timer = 34; - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); EnTr_SetupAction(this, EnTr_Reappear); Animation_PlayLoop(&this->skelAnime, &object_tr_Anim_0049C8); this->animation = NULL; @@ -309,12 +309,12 @@ void EnTr_WaitToReappear(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_TakeOff(EnTr* this, GlobalContext* globalCtx) { +void EnTr_TakeOff(EnTr* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(D_80B24378[this->actor.params]); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[this->actionIndex] != NULL) && - (globalCtx->csCtx.npcActions[this->actionIndex]->action == 3)) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[this->actionIndex] != NULL) && + (play->csCtx.npcActions[this->actionIndex]->action == 3)) { Animation_Change(&this->skelAnime, D_80B24378[this->actor.params], 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP, -10.0f); this->animation = NULL; @@ -323,12 +323,12 @@ void EnTr_TakeOff(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_TurnLookOverShoulder(EnTr* this, GlobalContext* globalCtx) { +void EnTr_TurnLookOverShoulder(EnTr* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(D_80B24368[this->actor.params]); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[this->actionIndex] != NULL) && - (globalCtx->csCtx.npcActions[this->actionIndex]->action == 2)) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[this->actionIndex] != NULL) && + (play->csCtx.npcActions[this->actionIndex]->action == 2)) { Animation_Change(&this->skelAnime, D_80B24368[this->actor.params], 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -4.0f); this->animation = D_80B24370[this->actor.params]; @@ -337,19 +337,19 @@ void EnTr_TurnLookOverShoulder(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_ChooseAction1(EnTr* this, GlobalContext* globalCtx) { - u32 frames = globalCtx->gameplayFrames; +void EnTr_ChooseAction1(EnTr* this, PlayState* play) { + u32 frames = play->gameplayFrames; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->actionIndex] != NULL) { - switch (globalCtx->csCtx.npcActions[this->actionIndex]->action) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->actionIndex] != NULL) { + switch (play->csCtx.npcActions[this->actionIndex]->action) { case 1: - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); EnTr_SetupAction(this, EnTr_TurnLookOverShoulder); break; case 3: - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); EnTr_SetupAction(this, EnTr_ChooseAction2); Animation_PlayLoop(&this->skelAnime, &object_tr_Anim_0049C8); this->animation = NULL; @@ -372,12 +372,12 @@ void EnTr_ChooseAction1(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Update(Actor* thisx, PlayState* play) { s32 pad; EnTr* this = (EnTr*)thisx; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 5); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 5); + this->actionFunc(this, play); if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->animation != NULL) { @@ -411,7 +411,7 @@ void EnTr_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnTr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTr_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Vec3f src = { 2300.0f, 0.0f, -600.0f }; Vec3f dest = { 0.0f, 0.0f, 0.0f }; EnTr* this = (EnTr*)thisx; @@ -419,55 +419,55 @@ s32 EnTr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if ((child != NULL) && (limbIndex == 19)) { Matrix_MultVec3f(&src, &dest); - dest.x -= (10.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)))); - dest.z -= (10.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)))); + dest.x -= (10.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)))); + dest.z -= (10.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)))); child->world.pos = dest; } return 0; } -void EnTr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Draw(Actor* thisx, PlayState* play) { s32 pad; EnTr* this = (EnTr*)thisx; - if ((globalCtx->csCtx.state == CS_STATE_IDLE) || (globalCtx->csCtx.npcActions[this->actionIndex] == 0)) { + if ((play->csCtx.state == CS_STATE_IDLE) || (play->csCtx.npcActions[this->actionIndex] == 0)) { this->actor.shape.shadowDraw = NULL; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_800943C8(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTr_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -f32 func_80B23FDC(GlobalContext* globalCtx, s32 actionIndex) { - f32 phi_f2 = Environment_LerpWeight(globalCtx->csCtx.npcActions[actionIndex]->endFrame, - globalCtx->csCtx.npcActions[actionIndex]->startFrame, globalCtx->csCtx.frames); +f32 func_80B23FDC(PlayState* play, s32 actionIndex) { + f32 phi_f2 = Environment_LerpWeight(play->csCtx.npcActions[actionIndex]->endFrame, + play->csCtx.npcActions[actionIndex]->startFrame, play->csCtx.frames); phi_f2 = CLAMP_MAX(phi_f2, 1.0f); return phi_f2; } -void func_80B24038(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { +void func_80B24038(EnTr* this, PlayState* play, s32 actionIndex) { Vec3f startPos; Vec3f endPos; f32 temp_f0; f32 temp_f0_2; f32 phi_f12; - startPos.x = globalCtx->csCtx.npcActions[actionIndex]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[actionIndex]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[actionIndex]->startPos.z; + startPos.x = play->csCtx.npcActions[actionIndex]->startPos.x; + startPos.y = play->csCtx.npcActions[actionIndex]->startPos.y; + startPos.z = play->csCtx.npcActions[actionIndex]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[actionIndex]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[actionIndex]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[actionIndex]->endPos.z; + endPos.x = play->csCtx.npcActions[actionIndex]->endPos.x; + endPos.y = play->csCtx.npcActions[actionIndex]->endPos.y; + endPos.z = play->csCtx.npcActions[actionIndex]->endPos.z; - temp_f0 = func_80B23FDC(globalCtx, actionIndex); + temp_f0 = func_80B23FDC(play, actionIndex); startPos.x = ((endPos.x - startPos.x) * temp_f0) + startPos.x; startPos.y = ((endPos.y - startPos.y) * temp_f0) + startPos.y; @@ -492,8 +492,8 @@ void func_80B24038(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { func_8002D7EC(&this->actor); } -void EnTr_UpdateRotation(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { - s16 rotY = globalCtx->csCtx.npcActions[actionIndex]->rot.y; +void EnTr_UpdateRotation(EnTr* this, PlayState* play, s32 actionIndex) { + s16 rotY = play->csCtx.npcActions[actionIndex]->rot.y; s32 rotDiff = this->actor.world.rot.y - rotY; s32 rotSign; @@ -515,13 +515,13 @@ void EnTr_UpdateRotation(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnTr_SetStartPosRot(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { +void EnTr_SetStartPosRot(EnTr* this, PlayState* play, s32 actionIndex) { Vec3f startPos; - startPos.x = globalCtx->csCtx.npcActions[actionIndex]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[actionIndex]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[actionIndex]->startPos.z; + startPos.x = play->csCtx.npcActions[actionIndex]->startPos.x; + startPos.y = play->csCtx.npcActions[actionIndex]->startPos.y; + startPos.z = play->csCtx.npcActions[actionIndex]->startPos.z; this->actor.world.pos = startPos; - this->actor.world.rot.y = this->actor.shape.rot.y = globalCtx->csCtx.npcActions[actionIndex]->rot.y; + this->actor.world.rot.y = this->actor.shape.rot.y = play->csCtx.npcActions[actionIndex]->rot.y; } diff --git a/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.h b/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.h index 4e890b3fb..57dbf78ec 100644 --- a/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.h +++ b/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.h @@ -6,7 +6,7 @@ struct EnTr; -typedef void (*EnTrActionFunc)(struct EnTr*, GlobalContext*); +typedef void (*EnTrActionFunc)(struct EnTr*, PlayState*); typedef struct EnTr { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/soh/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 43bf9b4e5..b64e9af2b 100644 --- a/soh/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/soh/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -29,10 +29,10 @@ #define vClosestDirection genericVar1 // relative to spike trap's facing angle if moving out, absolute if moving in #define vMovementMetric genericVar2 -void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTrap_Init(Actor* thisx, PlayState* play); +void EnTrap_Destroy(Actor* thisx, PlayState* play); +void EnTrap_Update(Actor* thisx, PlayState* play); +void EnTrap_Draw(Actor* thisx, PlayState* play); const ActorInit En_Trap_InitVars = { ACTOR_EN_TRAP, @@ -60,7 +60,7 @@ static ColliderCylinderInit sCylinderInit = { { 30, 20, 0, { 0, 0, 0 } }, }; -void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTrap_Init(Actor* thisx, PlayState* play) { f32 trapDist; f32 trapSpeed; s16 zSpeed; @@ -89,7 +89,7 @@ void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx) { trapSpeed = 10.0f; thisx->params = 0xF; } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 10.0f, 20.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 20.0f, 20.0f, 0x1D); thisx->home.pos = thisx->world.pos; this->targetPosLeft.x = thisx->world.pos.x + (trapDist * Math_CosS(thisx->world.rot.y)); this->targetPosLeft.z = thisx->world.pos.z - (trapDist * Math_SinS(thisx->world.rot.y)); @@ -108,19 +108,19 @@ void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx) { this->moveSpeedLeftRight.z = this->moveSpeedForwardBack.x = xSpeed; } thisx->focus.pos = thisx->world.pos; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 0.0f); thisx->targetMode = 3; thisx->colChkInfo.mass = 0xFF; } -void EnTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTrap_Destroy(Actor* thisx, PlayState* play) { EnTrap* this = (EnTrap*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTrap_Update(Actor* thisx, PlayState* play) { EnTrap* this = (EnTrap*)thisx; Vec3f posTemp; s16 angleToKnockPlayer; @@ -152,12 +152,12 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetColorFilter(thisx, 0, 250, 0, 250); icePos.y += 10.0f; icePos.z += 10.0f; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); icePos.x += 10.0f; icePos.z -= 20.0f; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); icePos.x -= 20.0f; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); } // If not frozen: if (thisx->colorFilterTimer == 0) { @@ -174,8 +174,8 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } else { angleToKnockPlayer = thisx->yawTowardsPlayer; } - globalCtx->damagePlayer(globalCtx, -4); - func_8002F7A0(globalCtx, thisx, 6.0f, angleToKnockPlayer, 6.0f); + play->damagePlayer(play, -4); + func_8002F7A0(play, thisx, 6.0f, angleToKnockPlayer, 6.0f); this->playerDmgTimer = 15; } if (thisx->params & SPIKETRAP_MODE_LINEAR) { @@ -189,7 +189,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { posAhead.x = (Math_SinS(thisx->world.rot.y) * 30.0f) + thisx->world.pos.x; posAhead.z = (Math_CosS(thisx->world.rot.y) * 30.0f) + thisx->world.pos.z; posAhead.y = thisx->world.pos.y; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &thisx->world.pos, &posAhead, &colPoint, &colPoly, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, &posAhead, &colPoint, &colPoly, true, true, false, true, &bgId) == true) { this->vContinue = 0.0f; } @@ -307,7 +307,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } break; } - if (!Actor_TestFloorInDirection(thisx, globalCtx, 50.0f, this->vClosestDirection)) { + if (!Actor_TestFloorInDirection(thisx, play, 50.0f, this->vClosestDirection)) { this->vMovementMetric = 0.0f; } // if in initial position: @@ -374,20 +374,20 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params & SPIKETRAP_MODE_LINEAR) { posTemp = thisx->world.pos; } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 20.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 20.0f, 20.0f, 0x1D); if (thisx->params & SPIKETRAP_MODE_LINEAR) { thisx->world.pos.x = posTemp.x; thisx->world.pos.z = posTemp.z; } } Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (thisx->colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { - func_8002EBCC(thisx, globalCtx, 1); - Gfx_DrawDListOpa(globalCtx, gSlidingBladeTrapDL); +void EnTrap_Draw(Actor* thisx, PlayState* play) { + func_8002EBCC(thisx, play, 1); + Gfx_DrawDListOpa(play, gSlidingBladeTrapDL); } diff --git a/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 51ee17756..b8441ee94 100644 --- a/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -11,14 +11,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTuboTrap_Init(Actor* thisx, PlayState* play); +void EnTuboTrap_Destroy(Actor* thisx, PlayState* play); +void EnTuboTrap_Update(Actor* thisx, PlayState* play); +void EnTuboTrap_Draw(Actor* thisx, PlayState* play); -void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx); -void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx); -void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx); +void EnTuboTrap_WaitForProximity(EnTuboTrap* this, PlayState* play); +void EnTuboTrap_Levitate(EnTuboTrap* this, PlayState* play); +void EnTuboTrap_Fly(EnTuboTrap* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -53,34 +53,34 @@ const ActorInit En_Tubo_Trap_InitVars = { NULL, }; -void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Init(Actor* thisx, PlayState* play) { EnTuboTrap* this = (EnTuboTrap*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 2.0f); osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 壷トラップ ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); // "Urn Trap" - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.1f); this->actionFunc = EnTuboTrap_WaitForProximity; } -void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Destroy(Actor* thisx, PlayState* play) { EnTuboTrap* this = (EnTuboTrap*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_DropCollectible(EnTuboTrap* this, PlayState* play) { s16 params = this->actor.params; s16 param3FF = (params >> 6) & 0x3FF; if (param3FF >= 0 && param3FF < 0x1A) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, param3FF | ((params & 0x3F) << 8)); + Item_DropCollectible(play, &this->actor.world.pos, param3FF | ((params & 0x3F) << 8)); } } -void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, PlayState* play) { f32 rand; f32 cos; f32 sin; @@ -115,15 +115,15 @@ void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, GlobalContext* globalCtx) { arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, actorPos, -240, arg5, 10, 10, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, actorPos, -240, arg5, 10, 10, 0, (Rand_ZeroOne() * 65.0f) + 15.0f, 0, 32, 60, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gPotFragmentDL); } - func_80033480(globalCtx, actorPos, 30.0f, 4, 20, 50, 0); + func_80033480(play, actorPos, 30.0f, 4, 20, 50, 0); } -void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, PlayState* play) { f32 rand; f32 cos; f32 sin; @@ -137,7 +137,7 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) pos = *actorPos; pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 0, 400); for (i = 0, var = 0; i < 15; i++, var += 20000) { sin = Math_SinS(var); @@ -161,40 +161,40 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, actorPos, -180, arg5, 30, 30, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, actorPos, -180, arg5, 30, 30, 0, (Rand_ZeroOne() * 65.0f) + 15.0f, 0, 32, 70, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gPotFragmentDL); } } -void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); +void EnTuboTrap_HandleImpact(EnTuboTrap* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { - EnTuboTrap_SpawnEffectsInWater(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsInWater(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; - EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsOnLand(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsOnLand(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } @@ -202,26 +202,26 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (this->collider.base.at == &player->actor) { - EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsOnLand(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } } if ((this->actor.bgCheckFlags & 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_Kill(&this->actor); return; } } -void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTuboTrap_WaitForProximity(EnTuboTrap* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 targetHeight; if (BREG(2) != 0) { @@ -231,7 +231,7 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { } if (this->actor.xzDistToPlayer < 200.0f && this->actor.world.pos.y <= player->actor.world.pos.y) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.flags |= ACTOR_FLAG_0; targetHeight = 40.0f + -10.0f * gSaveContext.linkAge; @@ -246,7 +246,7 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { } } -void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_Levitate(EnTuboTrap* this, PlayState* play) { this->actor.shape.rot.y += 5000; Math_ApproachF(&this->actor.world.pos.y, this->targetY, 0.8f, 3.0f); @@ -257,7 +257,7 @@ void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) { } } -void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_Fly(EnTuboTrap* this, PlayState* play) { f32 dx = this->originPos.x - this->actor.world.pos.x; f32 dy = this->originPos.y - this->actor.world.pos.y; f32 dz = this->originPos.z - this->actor.world.pos.z; @@ -269,22 +269,22 @@ void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += 5000; - EnTuboTrap_HandleImpact(this, globalCtx); + EnTuboTrap_HandleImpact(this, play); } -void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Update(Actor* thisx, PlayState* play) { EnTuboTrap* this = (EnTuboTrap*)thisx; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 20.0f, 0x1D); Actor_SetFocus(&this->actor, 0.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } -void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gPotDL); +void EnTuboTrap_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gPotDL); } diff --git a/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h b/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h index d15ab4816..17dc2f205 100644 --- a/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h +++ b/soh/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h @@ -6,7 +6,7 @@ struct EnTuboTrap; -typedef void (*EnTuboTrapActionFunc)(struct EnTuboTrap*, GlobalContext*); +typedef void (*EnTuboTrapActionFunc)(struct EnTuboTrap*, PlayState*); typedef struct EnTuboTrap { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c index b0a7da102..203189b6a 100644 --- a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -9,25 +9,25 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12) -void EnVali_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVali_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVali_Update(Actor* thisx, GlobalContext* globalCtx); -void EnVali_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVali_Init(Actor* thisx, PlayState* play); +void EnVali_Destroy(Actor* thisx, PlayState* play); +void EnVali_Update(Actor* thisx, PlayState* play); +void EnVali_Draw(Actor* thisx, PlayState* play); void EnVali_SetupLurk(EnVali* this); void EnVali_SetupDropAppear(EnVali* this); -void EnVali_Lurk(EnVali* this, GlobalContext* globalCtx); -void EnVali_DropAppear(EnVali* this, GlobalContext* globalCtx); -void EnVali_FloatIdle(EnVali* this, GlobalContext* globalCtx); -void EnVali_Attacked(EnVali* this, GlobalContext* globalCtx); -void EnVali_Retaliate(EnVali* this, GlobalContext* globalCtx); -void EnVali_MoveArmsDown(EnVali* this, GlobalContext* globalCtx); -void EnVali_Burnt(EnVali* this, GlobalContext* globalCtx); -void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx); -void EnVali_Stunned(EnVali* this, GlobalContext* globalCtx); -void EnVali_Frozen(EnVali* this, GlobalContext* globalCtx); -void EnVali_ReturnToLurk(EnVali* this, GlobalContext* globalCtx); +void EnVali_Lurk(EnVali* this, PlayState* play); +void EnVali_DropAppear(EnVali* this, PlayState* play); +void EnVali_FloatIdle(EnVali* this, PlayState* play); +void EnVali_Attacked(EnVali* this, PlayState* play); +void EnVali_Retaliate(EnVali* this, PlayState* play); +void EnVali_MoveArmsDown(EnVali* this, PlayState* play); +void EnVali_Burnt(EnVali* this, PlayState* play); +void EnVali_DivideAndDie(EnVali* this, PlayState* play); +void EnVali_Stunned(EnVali* this, PlayState* play); +void EnVali_Frozen(EnVali* this, PlayState* play); +void EnVali_ReturnToLurk(EnVali* this, PlayState* play); const ActorInit En_Vali_InitVars = { ACTOR_EN_VALI, @@ -134,7 +134,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 5000, ICHAIN_STOP), }; -void EnVali_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Init(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; s32 bgId; @@ -142,21 +142,21 @@ void EnVali_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBariSkel, &gBariLurkingAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBariSkel, &gBariLurkingAnim, this->jointTable, this->morphTable, EN_VALI_LIMB_MAX); - Collider_InitQuad(globalCtx, &this->leftArmCollider); - Collider_SetQuad(globalCtx, &this->leftArmCollider, &this->actor, &sQuadInit); - Collider_InitQuad(globalCtx, &this->rightArmCollider); - Collider_SetQuad(globalCtx, &this->rightArmCollider, &this->actor, &sQuadInit); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit); + Collider_InitQuad(play, &this->leftArmCollider); + Collider_SetQuad(play, &this->leftArmCollider, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->rightArmCollider); + Collider_SetQuad(play, &this->rightArmCollider, &this->actor, &sQuadInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); EnVali_SetupLurk(this); this->actor.flags &= ~ACTOR_FLAG_0; - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); this->actor.params = BARI_TYPE_NORMAL; @@ -165,12 +165,12 @@ void EnVali_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnVali_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Destroy(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; - Collider_DestroyQuad(globalCtx, &this->leftArmCollider); - Collider_DestroyQuad(globalCtx, &this->rightArmCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); + Collider_DestroyQuad(play, &this->leftArmCollider); + Collider_DestroyQuad(play, &this->rightArmCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); } void EnVali_SetupLurk(EnVali* this) { @@ -235,20 +235,20 @@ void EnVali_SetupBurnt(EnVali* this) { this->actionFunc = EnVali_Burnt; } -void EnVali_SetupDivideAndDie(EnVali* this, GlobalContext* globalCtx) { +void EnVali_SetupDivideAndDie(EnVali* this, PlayState* play) { s32 i; for (i = 0; i < 3; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BILI, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BILI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); this->actor.world.rot.y += 0x10000 / 3; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x50); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x50); this->timer = Rand_S16Offset(10, 10); this->bodyCollider.base.acFlags &= ~AC_ON; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_BARI_SPLIT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BARI_SPLIT); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.draw = NULL; this->actionFunc = EnVali_DivideAndDie; @@ -280,7 +280,7 @@ void EnVali_SetupReturnToLurk(EnVali* this) { this->actionFunc = EnVali_ReturnToLurk; } -void EnVali_DischargeLightning(EnVali* this, GlobalContext* globalCtx) { +void EnVali_DischargeLightning(EnVali* this, PlayState* play) { static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 200, 255, 255, 255 }; Vec3f pos; @@ -290,28 +290,28 @@ void EnVali_DischargeLightning(EnVali* this, GlobalContext* globalCtx) { s16 yaw; for (i = 0; i < 4; i++) { - cos = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); - sin = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + cos = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + sin = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); if (!((this->lightningTimer + (i << 1)) % 4)) { yaw = (s16)Rand_CenteredFloat(12288.0f) + (i * 0x4000) + 0x2000; pos.x = this->actor.world.pos.x + (Math_SinS(yaw) * 12.0f * cos); pos.y = this->actor.world.pos.y - (Math_CosS(yaw) * 12.0f) + 10.0f; pos.z = this->actor.world.pos.z + (Math_SinS(yaw) * 12.0f * sin); - EffectSsLightning_Spawn(globalCtx, &pos, &primColor, &envColor, 17, yaw, 6, 2); + EffectSsLightning_Spawn(play, &pos, &primColor, &envColor, 17, yaw, 6, 2); } } func_8002F974(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); } -void EnVali_Lurk(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Lurk(EnVali* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { EnVali_SetupDropAppear(this); } } -void EnVali_DropAppear(EnVali* this, GlobalContext* globalCtx) { +void EnVali_DropAppear(EnVali* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.velocity.y *= 1.5f; this->actor.velocity.y = CLAMP_MAX(this->actor.velocity.y, 40.0f); @@ -322,7 +322,7 @@ void EnVali_DropAppear(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_FloatIdle(EnVali* this, GlobalContext* globalCtx) { +void EnVali_FloatIdle(EnVali* this, PlayState* play) { s32 curFrame; SkelAnime_Update(&this->skelAnime); @@ -354,12 +354,12 @@ void EnVali_FloatIdle(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Attacked(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Attacked(EnVali* this, PlayState* play) { if (this->lightningTimer != 0) { this->lightningTimer--; } - EnVali_DischargeLightning(this, globalCtx); + EnVali_DischargeLightning(this, play); if (this->lightningTimer == 0) { this->actor.flags |= ACTOR_FLAG_0; @@ -376,33 +376,33 @@ void EnVali_Attacked(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Retaliate(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Retaliate(EnVali* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { EnVali_SetupMoveArmsDown(this); } else { - EnVali_SetupDivideAndDie(this, globalCtx); + EnVali_SetupDivideAndDie(this, play); } } } -void EnVali_MoveArmsDown(EnVali* this, GlobalContext* globalCtx) { +void EnVali_MoveArmsDown(EnVali* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnVali_SetupFloatIdle(this); } } -void EnVali_Burnt(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Burnt(EnVali* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - EnVali_SetupDivideAndDie(this, globalCtx); + EnVali_SetupDivideAndDie(this, play); } } -void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx) { +void EnVali_DivideAndDie(EnVali* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; s16 scale; @@ -421,9 +421,9 @@ void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx) { scale = Rand_S16Offset(40, 40); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 0, 1); } } @@ -432,7 +432,7 @@ void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Stunned(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Stunned(EnVali* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -454,7 +454,7 @@ void EnVali_Stunned(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Frozen(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Frozen(EnVali* this, PlayState* play) { Vec3f pos; s32 temp_v0; s32 temp_v1; @@ -474,19 +474,19 @@ void EnVali_Frozen(EnVali* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + ((temp_v0 & 2) ? 12.0f : -12.0f); pos.z = this->actor.world.pos.z + ((temp_v0 & 1) ? 12.0f : -12.0f); - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 1.3f); } } else if (this->timer == 0) { this->actor.velocity.y += 1.0f; if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { - EnVali_SetupDivideAndDie(this, globalCtx); + EnVali_SetupDivideAndDie(this, play); this->actor.colorFilterTimer = 0; } } } -void EnVali_ReturnToLurk(EnVali* this, GlobalContext* globalCtx) { +void EnVali_ReturnToLurk(EnVali* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 15.0f, 0.1f) < 0.01f) { @@ -494,7 +494,7 @@ void EnVali_ReturnToLurk(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_UpdateDamage(EnVali* this, GlobalContext* globalCtx) { +void EnVali_UpdateDamage(EnVali* this, PlayState* play) { if (this->bodyCollider.base.acFlags & AC_HIT) { this->bodyCollider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->bodyCollider.info, 1); @@ -502,7 +502,7 @@ void EnVali_UpdateDamage(EnVali* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != BARI_DMGEFF_NONE) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BARI_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } else if ((this->actor.colChkInfo.damageEffect != BARI_DMGEFF_STUN) && (this->actor.colChkInfo.damageEffect != BARI_DMGEFF_SLINGSHOT)) { @@ -536,7 +536,7 @@ void EnVali_UpdateDamage(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Update(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; @@ -548,23 +548,23 @@ void EnVali_Update(Actor* thisx, GlobalContext* globalCtx) { EnVali_SetupAttacked(this); } - EnVali_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnVali_UpdateDamage(this, play); + this->actionFunc(this, play); if ((this->actionFunc != EnVali_DivideAndDie) && (this->actionFunc != EnVali_Lurk)) { Collider_UpdateCylinder(&this->actor, &this->bodyCollider); if (this->actionFunc == EnVali_FloatIdle) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->leftArmCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->rightArmCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->leftArmCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->rightArmCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->bodyCollider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); Actor_SetFocus(&this->actor, 0.0f); } } @@ -671,7 +671,7 @@ s32 EnVali_SetArmLength(EnVali* this, f32 curFrame) { } } -s32 EnVali_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnVali_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnVali* this = (EnVali*)thisx; f32 curFrame; @@ -693,7 +693,7 @@ s32 EnVali_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnVali_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnVali_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { static Vec3f D_80B28970 = { 3000.0f, 0.0f, 0.0f }; static Vec3f D_80B2897C = { -1000.0f, 0.0f, 0.0f }; Vec3f sp3C; @@ -716,21 +716,21 @@ void EnVali_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnVali_DrawBody(EnVali* this, GlobalContext* globalCtx) { +void EnVali_DrawBody(EnVali* this, PlayState* play) { MtxF mtx; f32 cos; f32 sin; f32 curFrame; Vec3f scale = { 1.0f, 1.0f, 1.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Get(&mtx); curFrame = this->skelAnime.curFrame; EnVali_PulseInsides(this, curFrame, &scale); Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariInnerHoodDL); @@ -740,19 +740,19 @@ void EnVali_DrawBody(EnVali* this, GlobalContext* globalCtx) { cos = Math_CosS(this->actor.shape.rot.y); sin = Math_SinS(this->actor.shape.rot.y); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); Matrix_Translate((506.0f * cos) + (372.0f * sin), 1114.0f, (372.0f * cos) - (506.0f * sin), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); Matrix_Translate((-964.0f * cos) - (804.0f * sin), -108.0f, (-804.0f * cos) + (964.0f * sin), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); @@ -763,13 +763,13 @@ void EnVali_DrawBody(EnVali* this, GlobalContext* globalCtx) { EnVali_PulseOutside(this, curFrame, &scale); Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariOuterHoodDL); Matrix_Put(&mtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static Gfx D_80B28998[] = { @@ -784,15 +784,15 @@ static Gfx D_80B289A8[] = { gsSPEndDisplayList(), }; -void EnVali_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Draw(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (127 - (globalCtx->gameplayFrames * 12)) % 128, 32, 32)); + Gfx_TexScroll(play->state.gfxCtx, 0, (127 - (play->gameplayFrames * 12)) % 128, 32, 32)); if ((this->lightningTimer % 2) != 0) { gSPSegment(POLY_XLU_DISP++, 0x09, D_80B28998); @@ -800,10 +800,10 @@ void EnVali_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x09, D_80B289A8); } - EnVali_DrawBody(this, globalCtx); + EnVali_DrawBody(this, play); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVali_OverrideLimbDraw, EnVali_PostLimbDraw, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.h b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.h index 9c98ca3fc..0c94d9228 100644 --- a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -6,7 +6,7 @@ struct EnVali; -typedef void (*EnValiActionFunc)(struct EnVali*, GlobalContext*); +typedef void (*EnValiActionFunc)(struct EnVali*, PlayState*); typedef enum { /* 0x00 */ EN_VALI_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Vase/z_en_vase.c b/soh/src/overlays/actors/ovl_En_Vase/z_en_vase.c index 6afb210ef..cb18428e2 100644 --- a/soh/src/overlays/actors/ovl_En_Vase/z_en_vase.c +++ b/soh/src/overlays/actors/ovl_En_Vase/z_en_vase.c @@ -9,9 +9,9 @@ #define FLAGS ACTOR_FLAG_4 -void EnVase_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVase_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVase_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVase_Init(Actor* thisx, PlayState* play); +void EnVase_Destroy(Actor* thisx, PlayState* play); +void EnVase_Draw(Actor* thisx, PlayState* play); const ActorInit En_Vase_InitVars = { ACTOR_EN_VASE, @@ -26,7 +26,7 @@ const ActorInit En_Vase_InitVars = { NULL, }; -void EnVase_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVase_Init(Actor* thisx, PlayState* play) { EnVase* this = (EnVase*)thisx; Actor_SetScale(&this->actor, 0.01f); @@ -34,9 +34,9 @@ void EnVase_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 6.0f); } -void EnVase_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVase_Destroy(Actor* thisx, PlayState* play) { } -void EnVase_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gUnusedVaseDL); +void EnVase_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gUnusedVaseDL); } diff --git a/soh/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/soh/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index 0ca14d594..ac77c09d7 100644 --- a/soh/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/soh/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -11,10 +11,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVbBall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx); -void EnVbBall_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVbBall_Init(Actor* thisx, PlayState* play); +void EnVbBall_Destroy(Actor* thisx, PlayState* play); +void EnVbBall_Update(Actor* thisx, PlayState* play); +void EnVbBall_Draw(Actor* thisx, PlayState* play); const ActorInit En_Vb_Ball_InitVars = { 0, @@ -49,7 +49,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 30, 10, { 0, 0, 0 } }, }; -void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVbBall_Init(Actor* thisx, PlayState* play) { s32 pad; EnVbBall* this = (EnVbBall*)thisx; s32 pad2; @@ -64,8 +64,8 @@ void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.velocity.z = 2.0f * cosf(angle); this->actor.gravity = -0.8f; } else { // Volvagia's rocks - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, this->actor.world.rot.z / 10000.0f); this->collider.dim.radius = this->actor.scale.y * 3000.0f; this->collider.dim.height = this->actor.scale.y * 5000.0f; @@ -76,16 +76,16 @@ void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnVbBall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVbBall_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnVbBall* this = (EnVbBall*)thisx; if (this->actor.params < 200) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnVbBall_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void EnVbBall_SpawnDebris(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { s16 i; @@ -103,7 +103,7 @@ void EnVbBall_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* } } -void EnVbBall_SpawnDust(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void EnVbBall_SpawnDust(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { s16 i; @@ -120,14 +120,14 @@ void EnVbBall_SpawnDust(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* p } } -void EnVbBall_UpdateBones(EnVbBall* this, GlobalContext* globalCtx) { +void EnVbBall_UpdateBones(EnVbBall* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; f32 pad2; f32 pad1; f32 angle; s16 i; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 4); if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y <= 0.0f)) { this->xRotVel = Rand_CenteredFloat((f32)0x4000); this->yRotVel = Rand_CenteredFloat((f32)0x4000); @@ -154,7 +154,7 @@ void EnVbBall_UpdateBones(EnVbBall* this, GlobalContext* globalCtx) { dustPos.y = this->actor.floorHeight + 10.0f; dustPos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDust(globalCtx, bossFd->effects, &dustPos, &dustVel, &dustAcc, + EnVbBall_SpawnDust(play, bossFd->effects, &dustPos, &dustVel, &dustAcc, Rand_ZeroFloat(80.0f) + 200.0f); } } @@ -163,8 +163,8 @@ void EnVbBall_UpdateBones(EnVbBall* this, GlobalContext* globalCtx) { } } -void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnVbBall_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnVbBall* this = (EnVbBall*)thisx; BossFd* bossFd = (BossFd*)this->actor.parent; f32 radius; @@ -182,18 +182,18 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.gravity = -1.0f; func_8002D7EC(&this->actor); if (this->actor.params >= 200) { - EnVbBall_UpdateBones(this, globalCtx); + EnVbBall_UpdateBones(this, play); } else { Math_ApproachF(&this->shadowOpacity, 175.0f, 1.0f, 40.0f); radius = this->actor.scale.y * 1700.0f; this->actor.world.pos.y -= radius; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 4); this->actor.world.pos.y += radius; if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y <= 0.0f)) { if ((this->actor.params == 100) || (this->actor.params == 101)) { Actor_Kill(&this->actor); if (this->actor.params == 100) { - func_80033E88(&this->actor, globalCtx, 5, 0xA); + func_80033E88(&this->actor, play, 5, 0xA); } if (this->actor.params == 100) { spawnNum = 2; @@ -214,7 +214,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { spawnOffset.y = Rand_ZeroFloat(3.0f) + 4.0f; spawnOffset.z = Rand_CenteredFloat(10.0f); } - newActor = (EnVbBall*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + newActor = (EnVbBall*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x + spawnOffset.x, this->actor.world.pos.y + spawnOffset.y, this->actor.world.pos.z + spawnOffset.z, 0, 0, @@ -246,7 +246,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { debrisPos1.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; debrisPos1.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDebris(globalCtx, bossFd->effects, &debrisPos1, &debrisVel1, &debrisAcc1, + EnVbBall_SpawnDebris(play, bossFd->effects, &debrisPos1, &debrisVel1, &debrisAcc1, (s16)Rand_ZeroFloat(12.0f) + 15); } for (i = 0; i < 10; i++) { @@ -264,7 +264,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { dustPos.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; dustPos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDust(globalCtx, bossFd->effects, &dustPos, &dustVel, &dustAcc, + EnVbBall_SpawnDust(play, bossFd->effects, &dustPos, &dustVel, &dustAcc, Rand_ZeroFloat(100.0f) + 350.0f); } } else { @@ -281,45 +281,45 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { debrisPos2.y = Rand_CenteredFloat(5.0f) + this->actor.world.pos.y; debrisPos2.z = Rand_CenteredFloat(5.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDebris(globalCtx, bossFd->effects, &debrisPos2, &debrisVel2, &debrisAcc2, + EnVbBall_SpawnDebris(play, bossFd->effects, &debrisPos2, &debrisVel2, &debrisAcc2, (s16)Rand_ZeroFloat(12.0f) + 15); } Actor_Kill(&this->actor); } } if (this->collider.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->collider.base.atFlags &= ~AT_HIT; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void EnVbBall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnVbBall_Draw(Actor* thisx, PlayState* play) { s32 pad; EnVbBall* this = (EnVbBall*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params >= 200) { gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gVolvagiaRibsDL)); } else { gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gVolvagiaRockDL)); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s8)this->shadowOpacity); Matrix_Translate(this->actor.world.pos.x, 100.0f, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->shadowSize, 1.0f, this->shadowSize, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gCircleShadowDL)); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index bf0442880..6b6f5b8ab 100644 --- a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -18,16 +18,16 @@ #define FLAGS ACTOR_FLAG_4 -void EnViewer_Init(Actor* thisx, GlobalContext* globalCtx); -void EnViewer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnViewer_Update(Actor* thisx, GlobalContext* globalCtx); -void EnViewer_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnViewer_Init(Actor* thisx, PlayState* play); +void EnViewer_Destroy(Actor* thisx, PlayState* play); +void EnViewer_Update(Actor* thisx, PlayState* play); +void EnViewer_Draw(Actor* thisx, PlayState* play); -void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx); -void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx); -void EnViewer_UpdateGanondorfCape(GlobalContext* globalCtx, EnViewer* this); -void EnViewer_InitImpl(EnViewer* this, GlobalContext* globalCtx); -void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx); +void EnViewer_UpdatePosition(EnViewer* this, PlayState* play); +void EnViewer_DrawFireEffects(EnViewer* this2, PlayState* play); +void EnViewer_UpdateGanondorfCape(PlayState* play, EnViewer* this); +void EnViewer_InitImpl(EnViewer* this, PlayState* play); +void EnViewer_UpdateImpl(EnViewer* this, PlayState* play); static u8 sHorseSfxPlayed = false; @@ -89,7 +89,7 @@ void EnViewer_SetupAction(EnViewer* this, EnViewerActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnViewer_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Init(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; u8 type; @@ -102,29 +102,29 @@ void EnViewer_Init(Actor* thisx, GlobalContext* globalCtx) { this->isVisible = false; if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { - sGanondorfCape = (EnGanonMant*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + sGanondorfCape = (EnGanonMant*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GANON_MANT, 0.0f, 0.0f, 0.0f, 0, 0, 0, 35); } } -void EnViewer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Destroy(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; - Skin_Free(globalCtx, &this->skin); + Skin_Free(play, &this->skin); } -void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg, +void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { s16 type = this->actor.params >> 8; if (type == ENVIEWER_TYPE_2_ZELDA || type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { - SkelAnime_InitFlex(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } else { - SkelAnime_Init(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); + SkelAnime_Init(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 1.0f); @@ -133,16 +133,16 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, GlobalContext* globalCtx, } } -void EnViewer_InitAnimImpa(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg, AnimationHeader* anim) { - SkelAnime_InitFlex(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animObjBankIndex].segment); +void EnViewer_InitAnimImpa(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { + SkelAnime_InitFlex(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 3.0f); } -void EnViewer_InitAnimHorse(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg, AnimationHeader* anim) { +void EnViewer_InitAnimHorse(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { u8 type; - Skin_Init(globalCtx, &this->skin, skeletonHeaderSeg, anim); + Skin_Init(play, &this->skin, skeletonHeaderSeg, anim); type = this->actor.params >> 8; if (!(type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_4_HORSE_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || @@ -166,42 +166,42 @@ static ActorShadowFunc sShadowDrawFuncs[] = { ActorShadow_DrawHorse, }; -void EnViewer_InitImpl(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_InitImpl(EnViewer* this, PlayState* play) { EnViewerInitData* initData = &sInitData[this->actor.params >> 8]; - s32 skelObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, initData->skeletonObject); + s32 skelObjBankIndex = Object_GetIndex(&play->objectCtx, initData->skeletonObject); ASSERT(skelObjBankIndex >= 0); - this->animObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, initData->animObject); + this->animObjBankIndex = Object_GetIndex(&play->objectCtx, initData->animObject); ASSERT(this->animObjBankIndex >= 0); - if (!Object_IsLoaded(&globalCtx->objectCtx, skelObjBankIndex) || - !Object_IsLoaded(&globalCtx->objectCtx, this->animObjBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, skelObjBankIndex) || + !Object_IsLoaded(&play->objectCtx, this->animObjBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_6; return; } this->isVisible = true; this->actor.objBankIndex = skelObjBankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, initData->scale / 100.0f); ActorShape_Init(&this->actor.shape, initData->yOffset * 100, sShadowDrawFuncs[initData->shadowType], initData->shadowScale); this->drawFuncIndex = initData->drawType; - sInitAnimFuncs[this->drawFuncIndex](this, globalCtx, initData->skeletonHeaderSeg, initData->anim); + sInitAnimFuncs[this->drawFuncIndex](this, play, initData->skeletonHeaderSeg, initData->anim); EnViewer_SetupAction(this, EnViewer_UpdateImpl); } static s16 sTimer = 0; -void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { u8 type = this->actor.params >> 8; u16 csFrames; s32 animationEnded; if (type == ENVIEWER_TYPE_2_ZELDA) { if (gSaveContext.sceneSetupIndex == 5) { - csFrames = globalCtx->csCtx.frames; + csFrames = play->csCtx.frames; if (csFrames == 792) { Audio_PlayActorSound2(&this->actor, NA_SE_VO_Z0_SURPRISE); } else if (csFrames == 845) { @@ -215,7 +215,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { this->actor.uncullZoneDownward = 10000.0f; } else if (type == ENVIEWER_TYPE_3_GANONDORF) { if (gSaveContext.sceneSetupIndex == 4) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 20: case 59: case 71: @@ -232,18 +232,18 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } } if (gSaveContext.sceneSetupIndex == 5) { - if (globalCtx->csCtx.frames == 1508) { + if (play->csCtx.frames == 1508) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_ST_LAUGH); } - if (globalCtx->csCtx.frames == 1545) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, 32.0f, 101.0f, 1226.0f, + if (play->csCtx.frames == 1545) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, 32.0f, 101.0f, 1226.0f, 0, 0, 0, 0xC); } } - if (globalCtx->csCtx.frames == 1020) { + if (play->csCtx.frames == 1020) { Audio_QueueSeqCmd(SEQ_PLAYER_FANFARE << 24 | NA_BGM_OPENING_GANON); } - if (globalCtx->csCtx.frames == 960) { + if (play->csCtx.frames == 960) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_GROAN, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -274,13 +274,13 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { sTimer--; } - EnViewer_UpdatePosition(this, globalCtx); + EnViewer_UpdatePosition(this, play); Actor_MoveForward(&this->actor); // has no effect, speed/velocity and gravity are 0 animationEnded = SkelAnime_Update(&this->skin.skelAnime); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_4_HORSE_GANONDORF) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL) { - if (globalCtx->csCtx.npcActions[1]->action == 2 && sTimer == 0) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL) { + if (play->csCtx.npcActions[1]->action == 2 && sTimer == 0) { if (type == ENVIEWER_TYPE_3_GANONDORF) { if (this->skin.skelAnime.animation != &gYoungGanondorfHorsebackIdleAnim) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &gYoungGanondorfHorsebackIdleAnim, 1.0f); @@ -288,7 +288,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (this->skin.skelAnime.animation != &gHorseGanonIdleAnim) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &gHorseGanonIdleAnim, 1.0f); } - } else if (globalCtx->csCtx.npcActions[1]->action == 1) { + } else if (play->csCtx.npcActions[1]->action == 1) { sTimer = 100; if (type == ENVIEWER_TYPE_3_GANONDORF) { if (this->skin.skelAnime.animation != &gYoungGanondorfHorsebackRearAnim) { @@ -300,7 +300,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (type == ENVIEWER_TYPE_3_GANONDORF) { switch (this->state) { case 0: - if (globalCtx->csCtx.npcActions[1]->action == 4) { + if (play->csCtx.npcActions[1]->action == 4) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &gYoungGanondorfHorsebackLookSidewaysStartAnim, -5.0f); this->state++; } @@ -312,7 +312,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 2: - if (globalCtx->csCtx.npcActions[1]->action == 5) { + if (play->csCtx.npcActions[1]->action == 5) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &gYoungGanondorfHorsebackMagicChargeUpStartAnim, -5.0f); this->state++; } @@ -324,19 +324,19 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 4: - if (globalCtx->csCtx.npcActions[1]->action == 11) { + if (play->csCtx.npcActions[1]->action == 11) { Animation_MorphToLoop(&this->skin.skelAnime, &gYoungGanondorfHorsebackLookSidewaysLoopAnim, -20.0f); this->state++; } break; case 5: - if (globalCtx->csCtx.npcActions[1]->action == 8) { + if (play->csCtx.npcActions[1]->action == 8) { Animation_MorphToLoop(&this->skin.skelAnime, &gYoungGanondorfHorsebackIdleAnim, -15.0f); this->state++; } break; case 6: - if (globalCtx->csCtx.npcActions[1]->action == 12) { + if (play->csCtx.npcActions[1]->action == 12) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_VOICE_DEMO); Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &gYoungGanondorfHorsebackRideAnim, 3.0f); this->state++; @@ -347,34 +347,34 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { break; } } else if (this->skin.skelAnime.animation != &gHorseGanonGallopingAnim && - globalCtx->csCtx.npcActions[1]->action == 12) { + play->csCtx.npcActions[1]->action == 12) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &gHorseGanonGallopingAnim, 3.0f); } } } else if (type == ENVIEWER_TYPE_1_IMPA) { if (gSaveContext.sceneSetupIndex == 5) { - if (globalCtx->csCtx.frames == 845) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, + if (play->csCtx.frames == 845) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2600.0f, 0, 0, 0, 0); } } else { - if (globalCtx->csCtx.frames == 195) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, + if (play->csCtx.frames == 195) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2035.0f, 0, 0, 0, 1); } } switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 6 && + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL && + play->csCtx.npcActions[0]->action == 6 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_002574) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_002574, 1.5f); this->state++; } break; case 1: - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 2 && + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL && + play->csCtx.npcActions[0]->action == 2 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_0029CC) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_0029CC, 3.0f); this->state++; @@ -382,11 +382,11 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { break; } } else if (type == ENVIEWER_TYPE_2_ZELDA) { - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[0] != NULL && globalCtx->csCtx.npcActions[0]->action == 6 && + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[0] != NULL && play->csCtx.npcActions[0]->action == 6 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_001410) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_001410, 1.5f); this->state++; @@ -394,8 +394,8 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 1: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[0] != NULL && globalCtx->csCtx.npcActions[0]->action == 2 && + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[0] != NULL && play->csCtx.npcActions[0]->action == 2 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_000450) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_000450, 3.0f); this->state++; @@ -411,7 +411,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { this->state++; break; case 1: - if (globalCtx->csCtx.npcActions[0]->action == 11) { + if (play->csCtx.npcActions[0]->action == 11) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &object_opening_demo1_Anim_00420C, -5.0f); this->state++; } @@ -429,8 +429,8 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (type == ENVIEWER_TYPE_7_GANONDORF) { switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL && - globalCtx->csCtx.npcActions[1]->action == 7) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL && + play->csCtx.npcActions[1]->action == 7) { Audio_PlaySoundGeneral(NA_SE_EN_GANON_LAUGH, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Animation_MorphToPlayOnce(&this->skin.skelAnime, &gYoungGanondorfLaughStartAnim, -5.0f); this->state++; @@ -446,15 +446,15 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (type == ENVIEWER_TYPE_8_GANONDORF) { switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[1] != NULL && globalCtx->csCtx.npcActions[1]->action == 9) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[1] != NULL && play->csCtx.npcActions[1]->action == 9) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &gYoungGanondorfWalkAnim, 1.0f); this->state++; } } break; case 1: - if (globalCtx->csCtx.npcActions[1]->action == 10) { + if (play->csCtx.npcActions[1]->action == 10) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &gYoungGanondorfKneelStartAnim, -10.0f); this->state++; } @@ -466,7 +466,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 3: - if (globalCtx->csCtx.npcActions[1]->action == 4) { + if (play->csCtx.npcActions[1]->action == 4) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &gYoungGanondorfKneelLookSidewaysAnim, -5.0f); this->state++; } @@ -478,23 +478,23 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } } -void EnViewer_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Update(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animObjBankIndex].segment); - this->actionFunc(this, globalCtx); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); + this->actionFunc(this, play); } -s32 EnViewer_Ganondorf3OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnViewer_Ganondorf3OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if (gSaveContext.sceneSetupIndex == 4) { - if (globalCtx->csCtx.frames >= 400) { + if (play->csCtx.frames >= 400) { if (limbIndex == 5) { *dList = gYoungGanondorfOpenLeftHandDL; } } } else { - if (globalCtx->csCtx.frames >= 1510 && globalCtx->csCtx.frames <= 1650) { + if (play->csCtx.frames >= 1510 && play->csCtx.frames <= 1650) { if (limbIndex == 5) { *dList = gYoungGanondorfOpenLeftHandDL; } @@ -503,18 +503,18 @@ s32 EnViewer_Ganondorf3OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, return false; } -void EnViewer_Ganondorf9PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnViewer_Ganondorf9PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(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++, SEGMENTED_TO_VIRTUAL(gGanondorfEyesDL)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnViewer_GanondorfPostLimbDrawUpdateCapeVec(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, +void EnViewer_GanondorfPostLimbDrawUpdateCapeVec(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -523,11 +523,11 @@ void EnViewer_GanondorfPostLimbDrawUpdateCapeVec(GlobalContext* globalCtx, s32 l } } -void EnViewer_DrawGanondorf(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { s16 frames = 0; s16 type; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); type = this->actor.params >> 8; if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { @@ -535,15 +535,15 @@ void EnViewer_DrawGanondorf(EnViewer* this, GlobalContext* globalCtx) { frames = 149; } - if (frames + 1127 >= globalCtx->csCtx.frames) { + if (frames + 1127 >= play->csCtx.frames) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&gYoungGanondorfEyeOpenTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&gYoungGanondorfEyeOpenTex)); - } else if (frames + 1128 >= globalCtx->csCtx.frames) { + } else if (frames + 1128 >= play->csCtx.frames) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&gYoungGanondorfEyeHalfTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&gYoungGanondorfEyeHalfTex)); - } else if (frames + 1129 >= globalCtx->csCtx.frames) { + } else if (frames + 1129 >= play->csCtx.frames) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&gYoungGanondorfEyeClosedTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&gYoungGanondorfEyeClosedTex)); @@ -556,34 +556,34 @@ void EnViewer_DrawGanondorf(EnViewer* this, GlobalContext* globalCtx) { } if (type == ENVIEWER_TYPE_9_GANONDORF) { - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, NULL, EnViewer_Ganondorf9PostLimbDraw, this); } else if (type == ENVIEWER_TYPE_3_GANONDORF) { - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, EnViewer_Ganondorf3OverrideLimbDraw, EnViewer_GanondorfPostLimbDrawUpdateCapeVec, this); - EnViewer_UpdateGanondorfCape(globalCtx, this); + EnViewer_UpdateGanondorfCape(play, this); } else if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) { - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[1] != NULL)) { + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, NULL, EnViewer_GanondorfPostLimbDrawUpdateCapeVec, this); - EnViewer_UpdateGanondorfCape(globalCtx, this); + EnViewer_UpdateGanondorfCape(play, this); } } else { - SkelAnime_DrawOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, NULL, NULL, this); + SkelAnime_DrawOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, NULL, NULL, this); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnViewer_DrawHorse(EnViewer* this, GlobalContext* globalCtx) { - func_800A6330(&this->actor, globalCtx, &this->skin, NULL, true); +void EnViewer_DrawHorse(EnViewer* this, PlayState* play) { + func_800A6330(&this->actor, play, &this->skin, NULL, true); } -s32 EnViewer_ZeldaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnViewer_ZeldaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field if (limbIndex == 2) { *dList = gChildZeldaCutsceneDressDL; } @@ -606,37 +606,37 @@ s32 EnViewer_ZeldaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return false; } -void EnViewer_ZeldaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnViewer_ZeldaPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s32 pad; - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { if (limbIndex == 16) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gChildZeldaOcarinaOfTimeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void EnViewer_DrawZelda(EnViewer* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field - if (globalCtx->csCtx.frames < 771) { +void EnViewer_DrawZelda(EnViewer* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field + if (play->csCtx.frames < 771) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeInTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeOutTex)); - } else if (globalCtx->csCtx.frames < 772) { + } else if (play->csCtx.frames < 772) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); - } else if (globalCtx->csCtx.frames < 773) { + } else if (play->csCtx.frames < 773) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); - } else if (globalCtx->csCtx.frames < 791) { + } else if (play->csCtx.frames < 791) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeWideTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeWideTex)); - } else if (globalCtx->csCtx.frames < 792) { + } else if (play->csCtx.frames < 792) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); - } else if (globalCtx->csCtx.frames < 793) { + } else if (play->csCtx.frames < 793) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); } else { @@ -647,9 +647,9 @@ void EnViewer_DrawZelda(EnViewer* this, GlobalContext* globalCtx) { if (gSaveContext.sceneSetupIndex == 6) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex)); } else { - if (globalCtx->csCtx.frames < 758) { + if (play->csCtx.frames < 758) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthWorriedTex)); - } else if (globalCtx->csCtx.frames < 848) { + } else if (play->csCtx.frames < 848) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex)); } else { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthWorriedTex)); @@ -660,13 +660,13 @@ void EnViewer_DrawZelda(EnViewer* this, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthWorriedTex)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, EnViewer_ZeldaOverrideLimbDraw, EnViewer_ZeldaPostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnViewer_ImpaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnViewer_ImpaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if (limbIndex == 16) { *dList = gImpaHeadMaskedDL; @@ -674,15 +674,15 @@ s32 EnViewer_ImpaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnViewer_DrawImpa(EnViewer* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnViewer_DrawImpa(EnViewer* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gImpaEyeOpenTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gImpaEyeOpenTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, EnViewer_ImpaOverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static EnViewerDrawFunc sDrawFuncs[] = { @@ -692,37 +692,37 @@ static EnViewerDrawFunc sDrawFuncs[] = { EnViewer_DrawImpa, }; -void EnViewer_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Draw(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; s32 pad; s16 type; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->isVisible) { type = this->actor.params >> 8; if (type <= ENVIEWER_TYPE_2_ZELDA) { // zelda's horse, impa and zelda - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL) { - func_80093D18(globalCtx->state.gfxCtx); - sDrawFuncs[this->drawFuncIndex](this, globalCtx); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL) { + func_80093D18(play->state.gfxCtx); + sDrawFuncs[this->drawFuncIndex](this, play); } - } else if ((globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL) || + } else if ((play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL) || type == ENVIEWER_TYPE_9_GANONDORF) { - func_80093D18(globalCtx->state.gfxCtx); - sDrawFuncs[this->drawFuncIndex](this, globalCtx); + func_80093D18(play->state.gfxCtx); + sDrawFuncs[this->drawFuncIndex](this, play); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_UpdatePosition(EnViewer* this, PlayState* play) { Vec3f startPos; Vec3f endPos; f32 lerpFactor; s16 type = this->actor.params >> 8; if (type <= ENVIEWER_TYPE_2_ZELDA) { // zelda's horse, impa and zelda - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.frames < globalCtx->csCtx.npcActions[0]->endFrame) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL && + play->csCtx.frames < play->csCtx.npcActions[0]->endFrame) { if (type == ENVIEWER_TYPE_0_HORSE_ZELDA) { if (!sHorseSfxPlayed) { sHorseSfxPlayed = true; @@ -732,34 +732,34 @@ void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_HORSE_RUN_LEVEL - SFX_FLAG); } - startPos.x = globalCtx->csCtx.npcActions[0]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[0]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[0]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[0]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[0]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[0]->endPos.z; - lerpFactor = Environment_LerpWeight(globalCtx->csCtx.npcActions[0]->endFrame, - globalCtx->csCtx.npcActions[0]->startFrame, globalCtx->csCtx.frames); + startPos.x = play->csCtx.npcActions[0]->startPos.x; + startPos.y = play->csCtx.npcActions[0]->startPos.y; + startPos.z = play->csCtx.npcActions[0]->startPos.z; + endPos.x = play->csCtx.npcActions[0]->endPos.x; + endPos.y = play->csCtx.npcActions[0]->endPos.y; + endPos.z = play->csCtx.npcActions[0]->endPos.z; + lerpFactor = Environment_LerpWeight(play->csCtx.npcActions[0]->endFrame, + play->csCtx.npcActions[0]->startFrame, play->csCtx.frames); this->actor.world.pos.x = (endPos.x - startPos.x) * lerpFactor + startPos.x; this->actor.world.pos.y = (endPos.y - startPos.y) * lerpFactor + startPos.y; this->actor.world.pos.z = (endPos.z - startPos.z) * lerpFactor + startPos.z; } } else { // ganondorf and ganondorf's horse - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL && - globalCtx->csCtx.frames < globalCtx->csCtx.npcActions[1]->endFrame) { - startPos.x = globalCtx->csCtx.npcActions[1]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[1]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[1]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[1]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[1]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[1]->endPos.z; - lerpFactor = Environment_LerpWeight(globalCtx->csCtx.npcActions[1]->endFrame, - globalCtx->csCtx.npcActions[1]->startFrame, globalCtx->csCtx.frames); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL && + play->csCtx.frames < play->csCtx.npcActions[1]->endFrame) { + startPos.x = play->csCtx.npcActions[1]->startPos.x; + startPos.y = play->csCtx.npcActions[1]->startPos.y; + startPos.z = play->csCtx.npcActions[1]->startPos.z; + endPos.x = play->csCtx.npcActions[1]->endPos.x; + endPos.y = play->csCtx.npcActions[1]->endPos.y; + endPos.z = play->csCtx.npcActions[1]->endPos.z; + lerpFactor = Environment_LerpWeight(play->csCtx.npcActions[1]->endFrame, + play->csCtx.npcActions[1]->startFrame, play->csCtx.frames); this->actor.world.pos.x = (endPos.x - startPos.x) * lerpFactor + startPos.x; this->actor.world.pos.y = (endPos.y - startPos.y) * lerpFactor + startPos.y; this->actor.world.pos.z = (endPos.z - startPos.z) * lerpFactor + startPos.z; - if (globalCtx->csCtx.npcActions[1]->action == 12) { + if (play->csCtx.npcActions[1]->action == 12) { s16 yaw = Math_Vec3f_Yaw(&startPos, &endPos); Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 0xA, 0x3E8, 1); @@ -767,22 +767,22 @@ void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx) { } if (type == ENVIEWER_TYPE_9_GANONDORF) { - this->actor.world.rot.x = globalCtx->csCtx.npcActions[1]->urot.x; - this->actor.world.rot.y = globalCtx->csCtx.npcActions[1]->urot.y; - this->actor.world.rot.z = globalCtx->csCtx.npcActions[1]->urot.z; - this->actor.shape.rot.x = globalCtx->csCtx.npcActions[1]->urot.x; - this->actor.shape.rot.y = globalCtx->csCtx.npcActions[1]->urot.y; - this->actor.shape.rot.z = globalCtx->csCtx.npcActions[1]->urot.z; + this->actor.world.rot.x = play->csCtx.npcActions[1]->urot.x; + this->actor.world.rot.y = play->csCtx.npcActions[1]->urot.y; + this->actor.world.rot.z = play->csCtx.npcActions[1]->urot.z; + this->actor.shape.rot.x = play->csCtx.npcActions[1]->urot.x; + this->actor.shape.rot.y = play->csCtx.npcActions[1]->urot.y; + this->actor.shape.rot.z = play->csCtx.npcActions[1]->urot.z; } } if (type == ENVIEWER_TYPE_5_GANONDORF) { Audio_PlaySoundGeneral(NA_SE_EV_BURNING - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - EnViewer_DrawFireEffects(this, globalCtx); + EnViewer_DrawFireEffects(this, play); } } } -void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { +void EnViewer_InitFireEffect(EnViewer* this, PlayState* play, s16 i) { EnViewerFireEffect* eff; if ((i % 2) == 0) { @@ -809,15 +809,15 @@ void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { if (this) {} } -void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { +void EnViewer_DrawFireEffects(EnViewer* this2, PlayState* play) { EnViewer* this = this2; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->fireEffects); i++) { switch (this->fireEffects[i].state) { case 0: - EnViewer_InitFireEffect(this, globalCtx, i); + EnViewer_InitFireEffect(this, play, i); this->fireEffects[i].lerpFactor = (i >> 1) * 0.1f; this->fireEffects[i].lerpFactorSpeed = 0.01f; this->fireEffects[i].state++; @@ -839,7 +839,7 @@ void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { } break; case 2: - EnViewer_InitFireEffect(this, globalCtx, i); + EnViewer_InitFireEffect(this, play, i); this->fireEffects[i].lerpFactor = 0.0f; this->fireEffects[i].lerpFactorSpeed = 0.01f; this->fireEffects[i].state--; @@ -847,25 +847,25 @@ void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { } FrameInterpolation_RecordOpenChild(&this->fireEffects[i], this->fireEffects[i].epoch); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->fireEffects[i].pos.x, this->fireEffects[i].pos.y, this->fireEffects[i].pos.z, MTXMODE_NEW); Matrix_Scale(this->fireEffects[i].scale, this->fireEffects[i].scale, this->fireEffects[i].scale, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (10 * i - 20 * globalCtx->state.frames) % 512, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + (10 * i - 20 * play->state.frames) % 512, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 00, 255); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnViewer_UpdateGanondorfCape(GlobalContext* globalCtx, EnViewer* this) { +void EnViewer_UpdateGanondorfCape(PlayState* play, EnViewer* this) { static s16 yOscillationPhase = 0; Vec3f forearmModelOffset; Vec3f forearmWorldOffset; diff --git a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index c6ca0eb80..25961976a 100644 --- a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -6,9 +6,9 @@ struct EnViewer; -typedef void (*EnViewerActionFunc)(struct EnViewer*, GlobalContext*); -typedef void (*EnViewerDrawFunc)(struct EnViewer*, GlobalContext*); -typedef void (*EnViewerInitAnimFunc)(struct EnViewer*, GlobalContext*, void*, AnimationHeader*); +typedef void (*EnViewerActionFunc)(struct EnViewer*, PlayState*); +typedef void (*EnViewerDrawFunc)(struct EnViewer*, PlayState*); +typedef void (*EnViewerInitAnimFunc)(struct EnViewer*, PlayState*, void*, AnimationHeader*); typedef enum { /* 0 */ ENVIEWER_TYPE_0_HORSE_ZELDA, diff --git a/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.c index f5a9a249f..0f5b8b4c1 100644 --- a/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -11,17 +11,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4) -void EnVm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVm_Init(Actor* thisx, PlayState* play); +void EnVm_Destroy(Actor* thisx, PlayState* play); +void EnVm_Update(Actor* thisx, PlayState* play); +void EnVm_Draw(Actor* thisx, PlayState* play); void EnVm_SetupWait(EnVm* this); -void EnVm_Wait(EnVm* this, GlobalContext* globalCtx); +void EnVm_Wait(EnVm* this, PlayState* play); void EnVm_SetupAttack(EnVm* this); -void EnVm_Attack(EnVm* this, GlobalContext* globalCtx); -void EnVm_Stun(EnVm* this, GlobalContext* globalCtx); -void EnVm_Die(EnVm* this, GlobalContext* globalCtx); +void EnVm_Attack(EnVm* this, PlayState* play); +void EnVm_Stun(EnVm* this, PlayState* play); +void EnVm_Die(EnVm* this, PlayState* play); const ActorInit En_Vm_InitVars = { ACTOR_EN_VM, @@ -132,17 +132,17 @@ void EnVm_SetupAction(EnVm* this, EnVmActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnVm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Init(Actor* thisx, PlayState* play) { EnVm* this = (EnVm*)thisx; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBeamosSkel, &gBeamosAnim, this->jointTable, this->morphTable, 11); + SkelAnime_Init(play, &this->skelAnime, &gBeamosSkel, &gBeamosAnim, this->jointTable, this->morphTable, 11); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, thisx, &sCylinderInit); - Collider_InitQuad(globalCtx, &this->colliderQuad1); - Collider_SetQuad(globalCtx, &this->colliderQuad1, thisx, &sQuadInit1); - Collider_InitQuad(globalCtx, &this->colliderQuad2); - Collider_SetQuad(globalCtx, &this->colliderQuad2, thisx, &sQuadInit2); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, thisx, &sCylinderInit); + Collider_InitQuad(play, &this->colliderQuad1); + Collider_SetQuad(play, &this->colliderQuad1, thisx, &sQuadInit1); + Collider_InitQuad(play, &this->colliderQuad2); + Collider_SetQuad(play, &this->colliderQuad2, thisx, &sQuadInit2); this->beamSightRange = (thisx->params >> 8) * 40.0f; thisx->params &= 0xFF; thisx->naviEnemyId = 0x39; @@ -158,10 +158,10 @@ void EnVm_Init(Actor* thisx, GlobalContext* globalCtx) { EnVm_SetupWait(this); } -void EnVm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Destroy(Actor* thisx, PlayState* play) { EnVm* this = (EnVm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } void EnVm_SetupWait(EnVm* this) { @@ -174,8 +174,8 @@ void EnVm_SetupWait(EnVm* this) { EnVm_SetupAction(this, EnVm_Wait); } -void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnVm_Wait(EnVm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 dist; s16 headRot; s16 pad; @@ -241,7 +241,7 @@ void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } else { this->skelAnime.curFrame = 6.0f; - EffectSsDeadDd_Spawn(globalCtx, &this->beamPos2, &D_80B2EAEC, &D_80B2EAEC, 150, -25, 0, 0, 255, 0, 255, 255, + EffectSsDeadDd_Spawn(play, &this->beamPos2, &D_80B2EAEC, &D_80B2EAEC, 150, -25, 0, 0, 255, 0, 255, 255, 255, 16, 20); EnVm_SetupAttack(this); } @@ -258,8 +258,8 @@ void EnVm_SetupAttack(EnVm* this) { EnVm_SetupAction(this, EnVm_Attack); } -void EnVm_Attack(EnVm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnVm_Attack(EnVm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 pitch = Math_Vec3f_Pitch(&this->beamPos1, &player->actor.world.pos); f32 dist; Vec3f playerPos; @@ -305,7 +305,7 @@ void EnVm_Attack(EnVm* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIMOS_LAZER - SFX_FLAG); if (this->unk_260 > 2) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderQuad1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad1.base); } this->unk_260 = 3; @@ -329,7 +329,7 @@ void EnVm_SetupStun(EnVm* this) { EnVm_SetupAction(this, EnVm_Stun); } -void EnVm_Stun(EnVm* this, GlobalContext* globalCtx) { +void EnVm_Stun(EnVm* this, PlayState* play) { if (this->timer == 0) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_25E++; @@ -368,7 +368,7 @@ void EnVm_SetupDie(EnVm* this) { EnVm_SetupAction(this, EnVm_Die); } -void EnVm_Die(EnVm* this, GlobalContext* globalCtx) { +void EnVm_Die(EnVm* this, PlayState* play) { EnBom* bomb; this->beamRot.x += 0x5DC; @@ -376,22 +376,22 @@ void EnVm_Die(EnVm* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (--this->timer == 0) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xA0); Actor_Kill(&this->actor); } } -void EnVm_CheckHealth(EnVm* this, GlobalContext* globalCtx) { +void EnVm_CheckHealth(EnVm* this, PlayState* play) { EnBom* bomb; - if (Actor_GetCollidedExplosive(globalCtx, &this->colliderCylinder.base) != NULL) { + if (Actor_GetCollidedExplosive(play, &this->colliderCylinder.base) != NULL) { this->actor.colChkInfo.health--; osSyncPrintf("hp down %d\n", this->actor.colChkInfo.health); } else { @@ -405,7 +405,7 @@ void EnVm_CheckHealth(EnVm* this, GlobalContext* globalCtx) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); EnVm_SetupStun(this); } else { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0, 0, 0x601, BOMB_BODY); if (bomb != NULL) { @@ -416,21 +416,21 @@ void EnVm_CheckHealth(EnVm* this, GlobalContext* globalCtx) { } } -void EnVm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Update(Actor* thisx, PlayState* play) { EnVm* this = (EnVm*)thisx; - CollisionCheckContext* colChkCtx = &globalCtx->colChkCtx; + CollisionCheckContext* colChkCtx = &play->colChkCtx; if (this->actor.colChkInfo.health != 0) { - EnVm_CheckHealth(this, globalCtx); + EnVm_CheckHealth(this, play); } if (this->unk_260 == 4) { - EffectSsDeadDs_SpawnStationary(globalCtx, &this->beamPos3, 20, -1, 255, 20); - func_80033480(globalCtx, &this->beamPos3, 6.0f, 1, 120, 20, 1); + EffectSsDeadDs_SpawnStationary(play, &this->beamPos3, 20, -1, 255, 20); + func_80033480(play, &this->beamPos3, 6.0f, 1, 120, 20, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIMOS_LAZER_GND - SFX_FLAG); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->beamTexScroll += 0xC; if (this->actor.colChkInfo.health != 0 && this->unk_21C != 2) { @@ -438,18 +438,18 @@ void EnVm_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, colChkCtx, &this->colliderCylinder.base); if (this->actor.colorFilterTimer == 0 && this->actor.colChkInfo.health != 0) { - CollisionCheck_SetAC(globalCtx, colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, colChkCtx, &this->colliderCylinder.base); } - CollisionCheck_SetAC(globalCtx, colChkCtx, &this->colliderQuad2.base); + CollisionCheck_SetAC(play, colChkCtx, &this->colliderQuad2.base); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += (6500.0f + this->actor.shape.yOffset) * this->actor.scale.y; } -s32 EnVm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnVm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnVm* this = (EnVm*)thisx; if (limbIndex == 2) { @@ -464,7 +464,7 @@ s32 EnVm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnVm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnVm* this = (EnVm*)thisx; Vec3f sp80 = D_80B2EAF8; Vec3f sp74 = D_80B2EB04; @@ -484,7 +484,7 @@ void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec sp80.z = (this->beamScale.z + 500.0f) * (this->actor.scale.y * 10000.0f); Matrix_MultVec3f(&sp80, &this->beamPos3); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->beamPos1, &this->beamPos3, &posResult, &poly, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->beamPos1, &this->beamPos3, &posResult, &poly, true, true, false, true, &bgId) == true) { this->beamScale.z = Math_Vec3f_DistXYZ(&this->beamPos1, &posResult) - 5.0f; this->unk_260 = 4; @@ -515,43 +515,43 @@ void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnVm_Draw(Actor* thisx, PlayState* play2) { EnVm* this = (EnVm*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Vec3f actorPos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVm_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVm_OverrideLimbDraw, EnVm_PostLimbDraw, this); actorPos = this->actor.world.pos; - func_80033C30(&actorPos, &D_80B2EB7C, 255, globalCtx); + func_80033C30(&actorPos, &D_80B2EB7C, 255, play); if (this->unk_260 >= 3) { Matrix_Translate(this->beamPos3.x, this->beamPos3.y + 10.0f, this->beamPos3.z, MTXMODE_NEW); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 168); - func_80094BC4(globalCtx->state.gfxCtx); + func_80094BC4(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[globalCtx->gameplayFrames % 8])); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[play->gameplayFrames % 8])); gSPDisplayList(POLY_XLU_DISP++, gEffEnemyDeathFlameDL); Matrix_RotateY(32767.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[(globalCtx->gameplayFrames + 4) % 8])); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[(play->gameplayFrames + 4) % 8])); gSPDisplayList(POLY_XLU_DISP++, gEffEnemyDeathFlameDL); } - gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(globalCtx->state.gfxCtx, 0, this->beamTexScroll)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(play->state.gfxCtx, 0, this->beamTexScroll)); Matrix_Translate(this->beamPos1.x, this->beamPos1.y, this->beamPos1.z, MTXMODE_NEW); Matrix_RotateZYX(this->beamRot.x, this->beamRot.y, this->beamRot.z, MTXMODE_APPLY); Matrix_Scale(this->beamScale.x * 0.1f, this->beamScale.x * 0.1f, this->beamScale.z * 0.0015f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBeamosLaserDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.h b/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.h index b7bd00e8c..2be67637c 100644 --- a/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.h +++ b/soh/src/overlays/actors/ovl_En_Vm/z_en_vm.h @@ -6,7 +6,7 @@ struct EnVm; -typedef void (*EnVmActionFunc)(struct EnVm*, GlobalContext*); +typedef void (*EnVmActionFunc)(struct EnVm*, PlayState*); typedef struct EnVm { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index 0d30c2d4f..edb0b3d3f 100644 --- a/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -12,13 +12,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnWallTubo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWallTubo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWallTubo_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWallTubo_Init(Actor* thisx, PlayState* play); +void EnWallTubo_Destroy(Actor* thisx, PlayState* play); +void EnWallTubo_Update(Actor* thisx, PlayState* play); -void EnWallTubo_FindGirl(EnWallTubo* this, GlobalContext* globalCtx); -void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx); -void EnWallTubo_SetWallFall(EnWallTubo* this, GlobalContext* globalCtx); +void EnWallTubo_FindGirl(EnWallTubo* this, PlayState* play); +void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play); +void EnWallTubo_SetWallFall(EnWallTubo* this, PlayState* play); const ActorInit En_Wall_Tubo_InitVars = { ACTOR_EN_WALL_TUBO, @@ -33,7 +33,7 @@ const ActorInit En_Wall_Tubo_InitVars = { NULL, }; -void EnWallTubo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWallTubo_Init(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; osSyncPrintf("\n\n"); @@ -43,13 +43,13 @@ void EnWallTubo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnWallTubo_FindGirl; } -void EnWallTubo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWallTubo_Destroy(Actor* thisx, PlayState* play) { } -void EnWallTubo_FindGirl(EnWallTubo* this, GlobalContext* globalCtx) { +void EnWallTubo_FindGirl(EnWallTubo* this, PlayState* play) { Actor* lookForGirl; - lookForGirl = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + lookForGirl = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (lookForGirl != NULL) { if (lookForGirl->id != ACTOR_EN_BOM_BOWL_MAN) { @@ -63,7 +63,7 @@ void EnWallTubo_FindGirl(EnWallTubo* this, GlobalContext* globalCtx) { this->actionFunc = EnWallTubo_DetectChu; } -void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { +void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play) { EnBomChu* chu; s32 pad; Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; @@ -72,8 +72,8 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { s16 quakeIndex; if (this->chuGirl->minigamePlayStatus != 0) { - if (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_CHU_BOWLING) { - chu = (EnBomChu*)globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + if (play->cameraPtrs[MAIN_CAM]->setting == CAM_SET_CHU_BOWLING) { + chu = (EnBomChu*)play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (chu != NULL) { if ((&chu->actor == &this->actor) || (chu->actor.id != ACTOR_EN_BOM_CHU)) { @@ -91,8 +91,8 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { chu->timer = 2; func_80078884(NA_SE_SY_TRE_BOX_APPEAR); this->timer = 60; - EffectSsBomb2_SpawnLayered(globalCtx, &this->explosionCenter, &effVelocity, &effAccel, 200, 40); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + EffectSsBomb2_SpawnLayered(play, &this->explosionCenter, &effVelocity, &effAccel, 200, 40); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 100, 0, 0, 0); Quake_SetCountdown(quakeIndex, 100); @@ -106,18 +106,18 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { } } -void EnWallTubo_SetWallFall(EnWallTubo* this, GlobalContext* globalCtx) { +void EnWallTubo_SetWallFall(EnWallTubo* this, PlayState* play) { BgBowlWall* wall; Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f effPos; - if ((globalCtx->gameplayFrames & 1) == 0) { + if ((play->gameplayFrames & 1) == 0) { effPos.x = this->explosionCenter.x + Rand_CenteredFloat(300.0f); effPos.y = this->explosionCenter.y + Rand_CenteredFloat(300.0f); effPos.z = this->explosionCenter.z; - EffectSsBomb2_SpawnLayered(globalCtx, &effPos, &effVelocity, &effAccel, 100, 30); - EffectSsHahen_SpawnBurst(globalCtx, &effPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsBomb2_SpawnLayered(play, &effPos, &effVelocity, &effAccel, 100, 30); + EffectSsHahen_SpawnBurst(play, &effPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); } @@ -138,18 +138,18 @@ void EnWallTubo_SetWallFall(EnWallTubo* this, GlobalContext* globalCtx) { } } -void EnWallTubo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWallTubo_Update(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0, 0, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h b/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h index e1de7c881..1e7eead00 100644 --- a/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h +++ b/soh/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h @@ -7,7 +7,7 @@ struct EnWallTubo; -typedef void (*EnWallTuboActionFunc)(struct EnWallTubo*, GlobalContext*); +typedef void (*EnWallTuboActionFunc)(struct EnWallTubo*, PlayState*); typedef struct EnWallTubo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index e7d5185d5..06851c2d0 100644 --- a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -18,27 +18,27 @@ #define DAMAGE_EFFECT_STUN_WHITE 4 #define DAMAGE_EFFECT_STUN_BLUE 1 -void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWallmas_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWallmas_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWallmas_Init(Actor* thisx, PlayState* play); +void EnWallmas_Destroy(Actor* thisx, PlayState* play); +void EnWallmas_Update(Actor* thisx, PlayState* play); +void EnWallmas_Draw(Actor* thisx, PlayState* play); -void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_TimerInit(EnWallmas* this, PlayState* play); void EnWallmas_ProximityOrSwitchInit(EnWallmas* this); -void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Cooldown(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play); +void EnWallmas_Drop(EnWallmas* this, PlayState* play); +void EnWallmas_Land(EnWallmas* this, PlayState* play); +void EnWallmas_Stand(EnWallmas* this, PlayState* play); +void EnWallmas_JumpToCeiling(EnWallmas* this, PlayState* play); +void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play); +void EnWallmas_TakeDamage(EnWallmas* this, PlayState* play); +void EnWallmas_Cooldown(EnWallmas* this, PlayState* play); +void EnWallmas_Die(EnWallmas* this, PlayState* play); +void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play); +void EnWallmas_WaitForProximity(EnWallmas* this, PlayState* play); +void EnWallmas_WaitForSwitchFlag(EnWallmas* this, PlayState* play); +void EnWallmas_Stun(EnWallmas* this, PlayState* play); +void EnWallmas_Walk(EnWallmas* this, PlayState* play); const ActorInit En_Wallmas_InitVars = { ACTOR_EN_WALLMAS, @@ -116,22 +116,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1500, ICHAIN_STOP), }; -void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Init(Actor* thisx, PlayState* play) { EnWallmas* this = (EnWallmas*)thisx; Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0, NULL, 0.5f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, this->morphTable, 25); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); this->switchFlag = (u8)(thisx->params >> 0x8); thisx->params = thisx->params & 0xFF; if (thisx->params == WMT_FLAG) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { + if (Flags_GetSwitch(play, this->switchFlag) != 0) { Actor_Kill(thisx); return; } @@ -140,18 +140,18 @@ void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { } else if (thisx->params == WMT_PROXIMITY) { EnWallmas_ProximityOrSwitchInit(this); } else { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } } -void EnWallmas_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Destroy(Actor* thisx, PlayState* play) { EnWallmas* this = (EnWallmas*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_TimerInit(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.flags |= ACTOR_FLAG_5; @@ -163,8 +163,8 @@ void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { this->actionFunc = EnWallmas_WaitToDrop; } -void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_SetupDrop(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); AnimationHeader* objSegChangee = &gWallmasterLungeAnim; Animation_Change(&this->skelAnime, objSegChangee, 0.0f, 20.0f, Animation_GetLastFrame(&gWallmasterLungeAnim), @@ -179,14 +179,14 @@ void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { this->actionFunc = EnWallmas_Drop; } -void EnWallmas_SetupLand(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupLand(EnWallmas* this, PlayState* play) { AnimationHeader* objSegFrameCount = &gWallmasterJumpAnim; AnimationHeader* objSegChangee = &gWallmasterJumpAnim; Animation_Change(&this->skelAnime, objSegChangee, 1.0f, 41.0f, Animation_GetLastFrame(objSegFrameCount), ANIMMODE_ONCE, -3.0f); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_LAND); this->actionFunc = EnWallmas_Land; } @@ -242,19 +242,19 @@ void EnWallmas_SetupCooldown(EnWallmas* this) { this->actionFunc = EnWallmas_Cooldown; } -void EnWallmas_SetupDie(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupDie(EnWallmas* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, 250, -10, 255, 255, 255, 255, 0, 0, 255, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, 250, -10, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xC0); this->actionFunc = EnWallmas_Die; } -void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupTakePlayer(EnWallmas* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterHoverAnim, -5.0f); this->timer = -0x1E; this->actionFunc = EnWallmas_TakePlayer; @@ -262,8 +262,8 @@ void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->yTarget = this->actor.yDistToPlayer; - func_8002DF38(globalCtx, &this->actor, 0x25); - OnePointCutscene_Init(globalCtx, 9500, 9999, &this->actor, MAIN_CAM); + func_8002DF38(play, &this->actor, 0x25); + OnePointCutscene_Init(play, 9500, 9999, &this->actor, MAIN_CAM); } void EnWallmas_ProximityOrSwitchInit(EnWallmas* this) { @@ -292,8 +292,8 @@ void EnWallmas_SetupStun(EnWallmas* this) { this->actionFunc = EnWallmas_Stun; } -void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; this->actor.world.pos = *playerPos; @@ -315,27 +315,27 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - EnWallmas_SetupDrop(this, globalCtx); + EnWallmas_SetupDrop(this, play); } } -void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_Drop(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Player_InCsMode(globalCtx) && !(player->stateFlags2 & 0x10) && (player->invincibilityTimer >= 0) && + if (!Player_InCsMode(play) && !(player->stateFlags2 & 0x10) && (player->invincibilityTimer >= 0) && (this->actor.xzDistToPlayer < 30.0f) && (this->actor.yDistToPlayer < -5.0f) && (-(f32)(player->cylinder.dim.height + 10) < this->actor.yDistToPlayer)) { - EnWallmas_SetupTakePlayer(this, globalCtx); + EnWallmas_SetupTakePlayer(this, play); } } -void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Land(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupStand(this); } } -void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Stand(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupWalk(this); } @@ -343,7 +343,7 @@ void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 0xB6); } -void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Walk(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupJumpToCeiling(this); } @@ -356,14 +356,14 @@ void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { } } -void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_JumpToCeiling(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupReturnToCeiling(this); } } -void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame > 20.0f) { this->timer += 9; @@ -382,17 +382,17 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { if (this->actor.params == WMT_TIMER || Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f) { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } else { EnWallmas_ProximityOrSwitchInit(this); } } } -void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_TakeDamage(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->actor.colChkInfo.health == 0) { - EnWallmas_SetupDie(this, globalCtx); + EnWallmas_SetupDie(this, play); } else { EnWallmas_SetupCooldown(this); } @@ -404,24 +404,24 @@ void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); } -void EnWallmas_Cooldown(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Cooldown(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupReturnToCeiling(this); } } -void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Die(EnWallmas* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0015) != 0) { Actor_SetScale(&this->actor, 0.01f); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xC0); Actor_Kill(&this->actor); } this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; } -void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Animation_OnFrame(&this->skelAnime, 1.0f) != 0) { if (!LINK_IS_ADULT) { @@ -469,25 +469,25 @@ void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { if (this->timer == 0x1E) { func_80078884(NA_SE_OC_ABYSS); - Gameplay_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); } } -void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_WaitForProximity(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f) { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } } -void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { - EnWallmas_TimerInit(this, globalCtx); +void EnWallmas_WaitForSwitchFlag(EnWallmas* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag) != 0) { + EnWallmas_TimerInit(this, play); this->timer = 0x51; } } -void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Stun(EnWallmas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -495,20 +495,20 @@ void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { if (this->timer == 0) { if (this->actor.colChkInfo.health == 0) { - EnWallmas_SetupDie(this, globalCtx); + EnWallmas_SetupDie(this, play); } else { EnWallmas_SetupReturnToCeiling(this); } } } -void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_ColUpdate(EnWallmas* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) != 0) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, 1); if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DEAD); this->actor.flags &= ~ACTOR_FLAG_0; } else { @@ -524,7 +524,7 @@ void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { } } else { if (this->actor.colChkInfo.damageEffect == DAMAGE_EFFECT_BURN) { - EffectSsFCircle_Spawn(globalCtx, &this->actor, &this->actor.world.pos, 40, 40); + EffectSsFCircle_Spawn(play, &this->actor, &this->actor.world.pos, 40, 40); } EnWallmas_SetupTakeDamage(this); @@ -533,12 +533,12 @@ void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { } } -void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Update(Actor* thisx, PlayState* play) { EnWallmas* this = (EnWallmas*)thisx; char pad[4]; - EnWallmas_ColUpdate(this, globalCtx); - this->actionFunc(this, globalCtx); + EnWallmas_ColUpdate(this, play); + this->actionFunc(this, play); if ((this->actionFunc == EnWallmas_WaitToDrop) || (this->actionFunc == EnWallmas_WaitForProximity) || (this->actionFunc == EnWallmas_TakePlayer) || (this->actionFunc == EnWallmas_WaitForSwitchFlag)) { @@ -550,20 +550,20 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != EnWallmas_Drop) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 25.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, 0x1D); } else if (this->actor.world.pos.y <= this->yTarget) { this->actor.world.pos.y = this->yTarget; this->actor.velocity.y = 0.0f; - EnWallmas_SetupLand(this, globalCtx); + EnWallmas_SetupLand(this, play); } if ((this->actionFunc != EnWallmas_Die) && (this->actionFunc != EnWallmas_Drop)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if ((this->actionFunc != EnWallmas_TakeDamage) && (this->actor.bgCheckFlags & 1) != 0 && (this->actor.freezeTimer == 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -576,7 +576,7 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_DrawXlu(EnWallmas* this, PlayState* play) { s32 pad; f32 xzScale; MtxF mf; @@ -585,9 +585,9 @@ void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); func_80038A28(this->actor.floorPoly, this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, @@ -602,13 +602,13 @@ void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { } Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnWallMas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnWallMas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnWallmas* this = (EnWallmas*)thisx; @@ -622,9 +622,9 @@ s32 EnWallMas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnWallMas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnWallMas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 2) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); @@ -632,23 +632,23 @@ void EnWallMas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_RotateZ(DEGREE_15_RAD, MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gWallmasterFingerDL); 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 = (EnWallmas*)thisx; if (this->actionFunc != EnWallmas_WaitToDrop) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnWallMas_OverrideLimbDraw, EnWallMas_PostLimbDraw, this); } - EnWallmas_DrawXlu(this, globalCtx); + EnWallmas_DrawXlu(this, play); } diff --git a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h index fde6f4bb4..8b2f8d7ba 100644 --- a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -12,7 +12,7 @@ typedef enum { struct EnWallmas; -typedef void (*EnWallmasActionFunc)(struct EnWallmas*, GlobalContext*); +typedef void (*EnWallmasActionFunc)(struct EnWallmas*, PlayState*); typedef struct EnWallmas { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 67667cb8d..17ab87188 100644 --- a/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -9,25 +9,25 @@ #define FLAGS ACTOR_FLAG_4 -void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWeatherTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWeatherTag_Init(Actor* thisx, PlayState* play); +void EnWeatherTag_Destroy(Actor* thisx, PlayState* play); +void EnWeatherTag_Update(Actor* thisx, PlayState* play); -void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx); +void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, PlayState* play); #define WEATHER_TAG_RANGE100(x) ((x >> 8) * 100.0f) @@ -48,10 +48,10 @@ void EnWeatherTag_SetupAction(EnWeatherTag* this, EnWeatherTagActionFunc actionF this->actionFunc = actionFunc; } -void EnWeatherTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Destroy(Actor* thisx, PlayState* play) { } -void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag* this = (EnWeatherTag*)thisx; this->actor.flags &= ~ACTOR_FLAG_0; @@ -128,32 +128,32 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, GlobalContext* globalCtx, u8 arg2, u8 arg3, u8 arg4, u8 arg5, +u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, PlayState* play, u8 arg2, u8 arg3, u8 arg4, u8 arg5, u16 arg6, u8 weatherMode) { s32 pad; u8 ret = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { - if ((globalCtx->envCtx.indoors != 0) || !gSkyboxBlendingEnabled || - (globalCtx->skyboxId != SKYBOX_NORMAL_SKY && globalCtx->envCtx.unk_1F == globalCtx->envCtx.unk_20)) { + if ((play->envCtx.indoors != 0) || !gSkyboxBlendingEnabled || + (play->skyboxId != SKYBOX_NORMAL_SKY && play->envCtx.unk_1F == play->envCtx.unk_20)) { D_8011FB38 = 1; - if (globalCtx->envCtx.gloomySkyMode == 0 && - (globalCtx->envCtx.indoors != 0 || (globalCtx->envCtx.unk_1F != 1 && globalCtx->envCtx.unk_21 == 0))) { + if (play->envCtx.gloomySkyMode == 0 && + (play->envCtx.indoors != 0 || (play->envCtx.unk_1F != 1 && play->envCtx.unk_21 == 0))) { D_8011FB38 = 0; if (gWeatherMode != weatherMode) { gWeatherMode = weatherMode; - if (globalCtx->envCtx.gloomySkyMode == 0) { - globalCtx->envCtx.unk_19 = 1; - globalCtx->envCtx.unk_17 = arg2; - globalCtx->envCtx.unk_18 = arg3; - globalCtx->envCtx.unk_1A = arg6; - globalCtx->envCtx.unk_21 = 1; - globalCtx->envCtx.unk_1F = arg4; - globalCtx->envCtx.unk_20 = arg5; + if (play->envCtx.gloomySkyMode == 0) { + play->envCtx.unk_19 = 1; + play->envCtx.unk_17 = arg2; + play->envCtx.unk_18 = arg3; + play->envCtx.unk_1A = arg6; + play->envCtx.unk_21 = 1; + play->envCtx.unk_1F = arg4; + play->envCtx.unk_20 = arg5; D_8011FB34 = arg5; - globalCtx->envCtx.unk_24 = arg6; - globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; + play->envCtx.unk_24 = arg6; + play->envCtx.unk_22 = play->envCtx.unk_24; } } ret = true; @@ -168,30 +168,30 @@ u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, GlobalContext* global return ret; } -u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, GlobalContext* globalCtx, u8 arg2, u8 arg3, u8 arg4, u8 arg5, +u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, PlayState* play, u8 arg2, u8 arg3, u8 arg4, u8 arg5, u16 arg6) { s32 pad; u8 ret = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((WEATHER_TAG_RANGE100(this->actor.params) + 100.0f) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { - if (globalCtx->envCtx.indoors != 0 || !gSkyboxBlendingEnabled || - (globalCtx->skyboxId != SKYBOX_NORMAL_SKY && globalCtx->envCtx.unk_1F == globalCtx->envCtx.unk_20)) { + if (play->envCtx.indoors != 0 || !gSkyboxBlendingEnabled || + (play->skyboxId != SKYBOX_NORMAL_SKY && play->envCtx.unk_1F == play->envCtx.unk_20)) { D_8011FB38 = 1; - if ((globalCtx->envCtx.gloomySkyMode == 0) && - (globalCtx->envCtx.indoors != 0 || (globalCtx->envCtx.unk_1F != 1 && globalCtx->envCtx.unk_21 == 0))) { + if ((play->envCtx.gloomySkyMode == 0) && + (play->envCtx.indoors != 0 || (play->envCtx.unk_1F != 1 && play->envCtx.unk_21 == 0))) { D_8011FB38 = 0; gWeatherMode = 0; - globalCtx->envCtx.unk_19 = 1; - globalCtx->envCtx.unk_17 = arg2; - globalCtx->envCtx.unk_18 = arg3; - globalCtx->envCtx.unk_1A = arg6; - globalCtx->envCtx.unk_21 = 1; - globalCtx->envCtx.unk_1F = arg4; - globalCtx->envCtx.unk_20 = arg5; + play->envCtx.unk_19 = 1; + play->envCtx.unk_17 = arg2; + play->envCtx.unk_18 = arg3; + play->envCtx.unk_1A = arg6; + play->envCtx.unk_21 = 1; + play->envCtx.unk_1F = arg4; + play->envCtx.unk_20 = arg5; D_8011FB34 = arg5; - globalCtx->envCtx.unk_24 = arg6; - globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; + play->envCtx.unk_24 = arg6; + play->envCtx.unk_22 = play->envCtx.unk_24; ret = true; } @@ -202,132 +202,132 @@ u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, GlobalContext* globalCtx, return ret; } -void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 3, 60, 1)) { +void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 3, 60, 1)) { EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyHyruleMarket); } } -void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 3, 0, 60)) { +void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 3, 0, 60)) { EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyHyruleMarket); } } -void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 100, 2)) { +void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 100, 2)) { EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyLonLonRanch); } } -void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 100)) { +void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 100)) { EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyLonLonRanch); } } -void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 60, 2)) { +void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 60, 2)) { EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyDeathMountain); } } -void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 60)) { +void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 60)) { EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyLonLonRanch); } } -void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 60, 3)) { - globalCtx->envCtx.unk_EE[3] = 64; +void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 60, 3)) { + play->envCtx.unk_EE[3] = 64; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudySnow); } } -void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 60)) { - globalCtx->envCtx.unk_EE[3] = 0; +void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 60)) { + play->envCtx.unk_EE[3] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudySnow); } } -void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 100, 4)) { - Environment_PlayStormNatureAmbience(globalCtx); - globalCtx->envCtx.unk_EE[0] = 25; +void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 100, 4)) { + Environment_PlayStormNatureAmbience(play); + play->envCtx.unk_EE[0] = 25; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledRainLakeHylia); } } -void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 100)) { - Environment_StopStormNatureAmbience(globalCtx); - globalCtx->envCtx.unk_EE[0] = 0; +void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 100)) { + Environment_StopStormNatureAmbience(play); + play->envCtx.unk_EE[0] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledRainLakeHylia); } } -void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 4, 100, 5)) { - Environment_PlayStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON; - globalCtx->envCtx.unk_EE[0] = 30; +void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 4, 100, 5)) { + Environment_PlayStormNatureAmbience(play); + play->envCtx.lightningMode = LIGHTNING_MODE_ON; + play->envCtx.unk_EE[0] = 30; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyRainThunderKakariko); } } -void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 4, 0, 100)) { - Environment_StopStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; - globalCtx->envCtx.unk_EE[0] = 0; +void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 4, 0, 100)) { + Environment_StopStormNatureAmbience(play); + play->envCtx.lightningMode = LIGHTNING_MODE_LAST; + play->envCtx.unk_EE[0] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyRainThunderKakariko); } } -void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { - Math_SmoothStepToS(&globalCtx->envCtx.adjFogNear, -0x50, 1, 2, 1); - Math_SmoothStepToS(&globalCtx->envCtx.adjFogFar, -0x7D0, 1, 50, 1); + Math_SmoothStepToS(&play->envCtx.adjFogNear, -0x50, 1, 2, 1); + Math_SmoothStepToS(&play->envCtx.adjFogFar, -0x7D0, 1, 50, 1); } else { - Math_SmoothStepToS(&globalCtx->envCtx.adjFogNear, 0, 1, 1, 1); - Math_SmoothStepToS(&globalCtx->envCtx.adjFogFar, 0, 1, 25, 1); + Math_SmoothStepToS(&play->envCtx.adjFogNear, 0, 1, 1, 1); + Math_SmoothStepToS(&play->envCtx.adjFogFar, 0, 1, 25, 1); } } -void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { - Environment_PlayStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON; - globalCtx->envCtx.unk_EE[0] = 25; + Environment_PlayStormNatureAmbience(play); + play->envCtx.lightningMode = LIGHTNING_MODE_ON; + play->envCtx.unk_EE[0] = 25; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledRainThunder); } } -void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((WEATHER_TAG_RANGE100(this->actor.params) + 10.0f) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { - Environment_StopStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; - globalCtx->envCtx.unk_EE[0] = 0; - globalCtx->envCtx.unk_EE[1] = 10; + Environment_StopStormNatureAmbience(play); + play->envCtx.lightningMode = LIGHTNING_MODE_LAST; + play->envCtx.unk_EE[0] = 0; + play->envCtx.unk_EE[1] = 10; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledRainThunder); } } -void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Update(Actor* thisx, PlayState* play) { EnWeatherTag* this = (EnWeatherTag*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h b/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h index 791bf67f9..ec7c17734 100644 --- a/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h +++ b/soh/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h @@ -6,7 +6,7 @@ struct EnWeatherTag; -typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, GlobalContext*); +typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, PlayState*); typedef struct EnWeatherTag { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index fb867e533..d69634cab 100644 --- a/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -9,22 +9,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnWeiyer_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWeiyer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWeiyer_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWeiyer_Init(Actor* thisx, PlayState* play); +void EnWeiyer_Destroy(Actor* thisx, PlayState* play); +void EnWeiyer_Update(Actor* thisx, PlayState* play); +void EnWeiyer_Draw(Actor* thisx, PlayState* play); -void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B33338(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx); +void func_80B32804(EnWeiyer* this, PlayState* play); +void func_80B328E8(EnWeiyer* this, PlayState* play); +void func_80B32C2C(EnWeiyer* this, PlayState* play); +void func_80B32D30(EnWeiyer* this, PlayState* play); +void func_80B32E34(EnWeiyer* this, PlayState* play); +void func_80B33018(EnWeiyer* this, PlayState* play); +void func_80B331CC(EnWeiyer* this, PlayState* play); +void func_80B333B8(EnWeiyer* this, PlayState* play); +void func_80B332B4(EnWeiyer* this, PlayState* play); +void func_80B33338(EnWeiyer* this, PlayState* play); +void func_80B3349C(EnWeiyer* this, PlayState* play); const ActorInit En_Weiyer_InitVars = { ACTOR_EN_WEIYER, @@ -101,23 +101,23 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_STOP), }; -void EnWeiyer_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Init(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&this->actor.shape, 1000.0f, ActorShadow_DrawCircle, 65.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, 19); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->actionFunc = func_80B32804; } -void EnWeiyer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Destroy(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80B32384(EnWeiyer* this) { @@ -213,15 +213,15 @@ void func_80B327D8(EnWeiyer* this) { this->actionFunc = func_80B3349C; } -void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B32804(EnWeiyer* this, PlayState* play) { WaterBox* waterBox; s32 bgId; this->actor.world.pos.y += 0.5f; - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); - if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->actor.home.pos.y, &waterBox) || ((this->actor.home.pos.y - 5.0f) <= this->actor.floorHeight)) { Actor_Kill(&this->actor); @@ -232,7 +232,7 @@ void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B328E8(EnWeiyer* this, PlayState* play) { s32 sp34; f32 curFrame; @@ -279,7 +279,7 @@ void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f) + this->actor.floorHeight; } } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->actor.bgCheckFlags & 1) { this->unk_280 = @@ -296,7 +296,7 @@ void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B32C2C(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_194 == 0) { @@ -312,7 +312,7 @@ void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y < this->actor.home.pos.y) { if (this->actor.shape.rot.x > 0) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK); } @@ -323,7 +323,7 @@ void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B32D30(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -344,8 +344,8 @@ void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx) { } } -s16 func_80B32DEC(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s16 func_80B32DEC(EnWeiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f vec; vec.x = player->actor.world.pos.x; @@ -355,8 +355,8 @@ s16 func_80B32DEC(EnWeiyer* this, GlobalContext* globalCtx) { return Actor_WorldPitchTowardPoint(&this->actor, &vec); } -void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B32E34(EnWeiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -384,7 +384,7 @@ void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) { this->actor.world.pos.y = this->actor.home.pos.y; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1000, 2, 0x100, 0x40); } else { - Math_SmoothStepToS(&this->actor.shape.rot.x, func_80B32DEC(this, globalCtx), 2, 0x100, 0x40); + Math_SmoothStepToS(&this->actor.shape.rot.x, func_80B32DEC(this, play), 2, 0x100, 0x40); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x200, 0x80); @@ -396,7 +396,7 @@ void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B33018(EnWeiyer* this, PlayState* play) { f32 curFrame; SkelAnime_Update(&this->skelAnime); @@ -437,7 +437,7 @@ void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B331CC(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_194 != 0) { @@ -461,7 +461,7 @@ void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B332B4(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x400); this->actor.shape.rot.z += 0x1000; @@ -475,17 +475,17 @@ void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B33338(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B33338(EnWeiyer* this, PlayState* play) { this->actor.shape.shadowAlpha = CLAMP_MIN((s16)(this->actor.shape.shadowAlpha - 5), 0); this->actor.world.pos.y -= 2.0f; if (this->actor.shape.shadowAlpha == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } -void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B333B8(EnWeiyer* this, PlayState* play) { if (this->unk_194 != 0) { this->unk_194--; } @@ -512,8 +512,8 @@ void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3349C(EnWeiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a1; s32 phi_a0; @@ -526,7 +526,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { func_80B32538(this); } else if (this->actor.yDistToWater < 0.0f) { this->unk_194 = 10; - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP); } } else { @@ -539,7 +539,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { if (this->unk_194 == 0) { phi_a1 = 0x1800; } else { - phi_a1 = func_80B32DEC(this, globalCtx); + phi_a1 = func_80B32DEC(this, play); phi_a1 = CLAMP_MIN(phi_a1, 0); } @@ -550,7 +550,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1) { func_80B32434(this); } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.shape.rot.x > 0)) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK); func_80B32538(this); } else { @@ -559,7 +559,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B3368C(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B3368C(EnWeiyer* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, 1); @@ -570,7 +570,7 @@ void func_80B3368C(EnWeiyer* this, GlobalContext* globalCtx) { func_80B32660(this); } } else if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_DEAD); this->actor.flags &= ~ACTOR_FLAG_0; func_80B32724(this); @@ -581,13 +581,13 @@ void func_80B3368C(EnWeiyer* this, GlobalContext* globalCtx) { } } -void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Update(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; s32 pad; this->actor.home.pos.y = this->actor.yDistToWater + this->actor.world.pos.y - 5.0f; - func_80B3368C(this, globalCtx); - this->actionFunc(this, globalCtx); + func_80B3368C(this, play); + this->actionFunc(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.x = -this->actor.shape.rot.x; @@ -597,7 +597,7 @@ void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D97C(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 30.0f, 45.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 30.0f, 45.0f, 7); Actor_SetFocus(&this->actor, 0.0f); if (this->collider.base.atFlags & AT_HIT) { @@ -608,17 +608,17 @@ void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AT_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnWeiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnWeiyer_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { if (limbIndex == 1) { pos->z += 2000.0f; @@ -627,24 +627,24 @@ s32 EnWeiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return 0; } -void EnWeiyer_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Draw(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc != func_80B33338) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnWeiyer_OverrideLimbDraw, NULL, &this->actor, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[0]); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->actor.shape.shadowAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnWeiyer_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h b/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h index 77874b31e..fbaefbd9a 100644 --- a/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h +++ b/soh/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h @@ -6,7 +6,7 @@ struct EnWeiyer; -typedef void (*EnWeiyerActionFunc)(struct EnWeiyer*, GlobalContext*); +typedef void (*EnWeiyerActionFunc)(struct EnWeiyer*, PlayState*); typedef struct EnWeiyer { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c index c81a3a35f..831c19c63 100644 --- a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -11,37 +11,37 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnWf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWf_Init(Actor* thisx, PlayState* play); +void EnWf_Destroy(Actor* thisx, PlayState* play); +void EnWf_Update(Actor* thisx, PlayState* play); +void EnWf_Draw(Actor* thisx, PlayState* play); void EnWf_SetupWaitToAppear(EnWf* this); -void EnWf_WaitToAppear(EnWf* this, GlobalContext* globalCtx); +void EnWf_WaitToAppear(EnWf* this, PlayState* play); void EnWf_SetupWait(EnWf* this); -void EnWf_Wait(EnWf* this, GlobalContext* globalCtx); -void EnWf_SetupRunAtPlayer(EnWf* this, GlobalContext* globalCtx); -void EnWf_RunAtPlayer(EnWf* this, GlobalContext* globalCtx); +void EnWf_Wait(EnWf* this, PlayState* play); +void EnWf_SetupRunAtPlayer(EnWf* this, PlayState* play); +void EnWf_RunAtPlayer(EnWf* this, PlayState* play); void EnWf_SetupSearchForPlayer(EnWf* this); -void EnWf_SearchForPlayer(EnWf* this, GlobalContext* globalCtx); +void EnWf_SearchForPlayer(EnWf* this, PlayState* play); void EnWf_SetupRunAroundPlayer(EnWf* this); -void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx); +void EnWf_RunAroundPlayer(EnWf* this, PlayState* play); void EnWf_SetupSlash(EnWf* this); -void EnWf_Slash(EnWf* this, GlobalContext* globalCtx); -void EnWf_RecoilFromBlockedSlash(EnWf* this, GlobalContext* globalCtx); +void EnWf_Slash(EnWf* this, PlayState* play); +void EnWf_RecoilFromBlockedSlash(EnWf* this, PlayState* play); void EnWf_SetupBackflipAway(EnWf* this); -void EnWf_BackflipAway(EnWf* this, GlobalContext* globalCtx); -void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx); -void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx); +void EnWf_BackflipAway(EnWf* this, PlayState* play); +void EnWf_Stunned(EnWf* this, PlayState* play); +void EnWf_Damaged(EnWf* this, PlayState* play); void EnWf_SetupSomersaultAndAttack(EnWf* this); -void EnWf_SomersaultAndAttack(EnWf* this, GlobalContext* globalCtx); +void EnWf_SomersaultAndAttack(EnWf* this, PlayState* play); void EnWf_SetupBlocking(EnWf* this); -void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx); -void EnWf_SetupSidestep(EnWf* this, GlobalContext* globalCtx); -void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx); +void EnWf_Blocking(EnWf* this, PlayState* play); +void EnWf_SetupSidestep(EnWf* this, PlayState* play); +void EnWf_Sidestep(EnWf* this, PlayState* play); void EnWf_SetupDie(EnWf* this); -void EnWf_Die(EnWf* this, GlobalContext* globalCtx); -s32 EnWf_DodgeRanged(GlobalContext* globalCtx, EnWf* this); +void EnWf_Die(EnWf* this, PlayState* play); +s32 EnWf_DodgeRanged(PlayState* play, EnWf* this); static ColliderJntSphElementInit sJntSphItemsInit[4] = { { @@ -209,7 +209,7 @@ void EnWf_SetupAction(EnWf* this, EnWfActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Init(Actor* thisx, PlayState* play) { s32 pad; EnWf* this = (EnWf*)thisx; @@ -226,20 +226,20 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { this->eyeIndex = 0; this->unk_2F4 = 10.0f; // Set and not used - Collider_InitJntSph(globalCtx, &this->colliderSpheres); - Collider_SetJntSph(globalCtx, &this->colliderSpheres, thisx, &sJntSphInit, this->colliderSpheresElements); - Collider_InitCylinder(globalCtx, &this->colliderCylinderBody); - Collider_SetCylinder(globalCtx, &this->colliderCylinderBody, thisx, &sBodyCylinderInit); - Collider_InitCylinder(globalCtx, &this->colliderCylinderTail); - Collider_SetCylinder(globalCtx, &this->colliderCylinderTail, thisx, &sTailCylinderInit); + Collider_InitJntSph(play, &this->colliderSpheres); + Collider_SetJntSph(play, &this->colliderSpheres, thisx, &sJntSphInit, this->colliderSpheresElements); + Collider_InitCylinder(play, &this->colliderCylinderBody); + Collider_SetCylinder(play, &this->colliderCylinderBody, thisx, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinderTail); + Collider_SetCylinder(play, &this->colliderCylinderTail, thisx, &sTailCylinderInit); if (thisx->params == WOLFOS_NORMAL) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_LIMB_MAX); Actor_SetScale(thisx, 0.0075f); thisx->naviEnemyId = 0x4C; // Wolfos } else { // WOLFOS_WHITE - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_LIMB_MAX); Actor_SetScale(thisx, 0.01f); this->colliderSpheres.elements[0].info.toucher.damage = this->colliderSpheres.elements[1].info.toucher.damage = @@ -249,17 +249,17 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { EnWf_SetupWaitToAppear(this); - if ((this->switchFlag != 0xFF) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag != 0xFF) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(thisx); } } -void EnWf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; - Collider_DestroyJntSph(globalCtx, &this->colliderSpheres); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinderBody); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinderTail); + Collider_DestroyJntSph(play, &this->colliderSpheres); + Collider_DestroyCylinder(play, &this->colliderCylinderBody); + Collider_DestroyCylinder(play, &this->colliderCylinderTail); if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF)) { func_800F5B58(); @@ -281,8 +281,8 @@ void EnWf_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { - Player* player = GET_PLAYER(globalCtx); +s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { + Player* player = GET_PLAYER(play); s32 pad; s16 wallYawDiff; s16 playerYawDiff; @@ -293,19 +293,19 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { playerYawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; playerYawDiff = ABS(playerYawDiff); - if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y)) { if (player->swordAnimation == 0x11) { EnWf_SetupBlocking(this); return true; } - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); return true; } } - if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if ((this->actor.bgCheckFlags & 8) && (ABS(wallYawDiff) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { @@ -314,7 +314,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { } else if (player->swordAnimation == 0x11) { EnWf_SetupBlocking(this); return true; - } else if ((this->actor.xzDistToPlayer < 80.0f) && (globalCtx->gameplayFrames % 2) != 0) { + } else if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); return true; } else { @@ -323,7 +323,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { } } - explosive = Actor_FindNearby(globalCtx, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); if (explosive != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -334,7 +334,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { EnWf_SetupSomersaultAndAttack(this); return true; } else { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); return true; } } else { @@ -347,14 +347,14 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { s16 playerFacingAngleDiff; if (playerYawDiff >= 0x1B58) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); return true; } playerFacingAngleDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - (((globalCtx->gameplayFrames % 8) != 0) || (ABS(playerFacingAngleDiff) < 0x38E0))) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 8) != 0) || (ABS(playerFacingAngleDiff) < 0x38E0))) { EnWf_SetupSlash(this); return true; } @@ -377,7 +377,7 @@ void EnWf_SetupWaitToAppear(EnWf* this) { EnWf_SetupAction(this, EnWf_WaitToAppear); } -void EnWf_WaitToAppear(EnWf* this, GlobalContext* globalCtx) { +void EnWf_WaitToAppear(EnWf* this, PlayState* play) { if (this->actionTimer >= 6) { this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; @@ -416,12 +416,12 @@ void EnWf_SetupWait(EnWf* this) { EnWf_SetupAction(this, EnWf_Wait); } -void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Wait(EnWf* this, PlayState* play) { Player* player; s32 pad; s16 angle; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->unk_2E2 != 0) { @@ -438,7 +438,7 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; angle = ABS(angle); - if (!EnWf_DodgeRanged(globalCtx, this)) { + if (!EnWf_DodgeRanged(play, this)) { // Only use of unk_2E0: never not zero, so this if block never runs if (this->unk_2E0 != 0) { this->unk_2E0--; @@ -448,7 +448,7 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { } this->unk_2E0 = 0; } else { - if (EnWf_ChangeAction(globalCtx, this, false)) { + if (EnWf_ChangeAction(play, this, false)) { return; } } @@ -465,14 +465,14 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { if (this->actionTimer == 0) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.3f) { - EnWf_SetupRunAtPlayer(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); } else { EnWf_SetupRunAroundPlayer(this); } } else { EnWf_SetupSearchForPlayer(this); } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -480,7 +480,7 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_SetupRunAtPlayer(EnWf* this, GlobalContext* globalCtx) { +void EnWf_SetupRunAtPlayer(EnWf* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gWolfosRunningAnim); Animation_Change(&this->skelAnime, &gWolfosRunningAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); @@ -488,20 +488,20 @@ void EnWf_SetupRunAtPlayer(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupAction(this, EnWf_RunAtPlayer); } -void EnWf_RunAtPlayer(EnWf* this, GlobalContext* globalCtx) { +void EnWf_RunAtPlayer(EnWf* this, PlayState* play) { s32 animPrevFrame; s32 sp58; s32 pad; f32 baseRange = 0.0f; s16 playerFacingAngleDiff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 playSpeed; - if (!EnWf_DodgeRanged(globalCtx, this)) { + if (!EnWf_DodgeRanged(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 150.0f; } @@ -541,23 +541,23 @@ void EnWf_RunAtPlayer(EnWf* this, GlobalContext* globalCtx) { } else if (this->actor.xzDistToPlayer < (90.0f + baseRange)) { s16 temp_v1 = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + if (!Actor_OtherIsTargeted(play, &this->actor) && ((Rand_ZeroOne() > 0.03f) || ((this->actor.xzDistToPlayer <= 80.0f) && (ABS(temp_v1) < 0x38E0)))) { EnWf_SetupSlash(this); - } else if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + } else if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnWf_SetupBackflipAway(this); } else { EnWf_SetupRunAroundPlayer(this); } } - if (!EnWf_ChangeAction(globalCtx, this, false)) { - if ((globalCtx->gameplayFrames & 95) == 0) { + if (!EnWf_ChangeAction(play, this, false)) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } if ((animPrevFrame != (s32)this->skelAnime.curFrame) && (sp58 <= 0) && ((playSpeed + animPrevFrame) > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } } } @@ -569,12 +569,12 @@ void EnWf_SetupSearchForPlayer(EnWf* this) { EnWf_SetupAction(this, EnWf_SearchForPlayer); } -void EnWf_SearchForPlayer(EnWf* this, GlobalContext* globalCtx) { +void EnWf_SearchForPlayer(EnWf* this, PlayState* play) { s16 yawDiff; s16 phi_v1; f32 phi_f2; - if (!EnWf_DodgeRanged(globalCtx, this) && !EnWf_ChangeAction(globalCtx, this, false)) { + if (!EnWf_DodgeRanged(play, this) && !EnWf_ChangeAction(play, this, false)) { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; phi_v1 = (yawDiff > 0) ? (yawDiff * 0.25f) + 2000.0f : (yawDiff * 0.25f) - 2000.0f; this->actor.shape.rot.y += phi_v1; @@ -595,11 +595,11 @@ void EnWf_SearchForPlayer(EnWf* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() > 0.8f) { EnWf_SetupRunAroundPlayer(this); } else { - EnWf_SetupRunAtPlayer(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); } } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -626,7 +626,7 @@ void EnWf_SetupRunAroundPlayer(EnWf* this) { EnWf_SetupAction(this, EnWf_RunAroundPlayer); } -void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { +void EnWf_RunAroundPlayer(EnWf* this, PlayState* play) { s16 angle1; s16 angle2; s32 pad; @@ -634,17 +634,17 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { s32 animPrevFrame; s32 animFrameSpeedDiff; s32 animSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->runAngle, 1, 4000, 1); - if (!EnWf_DodgeRanged(globalCtx, this) && !EnWf_ChangeAction(globalCtx, this, false)) { + if (!EnWf_DodgeRanged(play, this) && !EnWf_ChangeAction(play, this, false)) { this->actor.world.rot.y = this->actor.shape.rot.y; angle1 = player->actor.shape.rot.y + this->runAngle + 0x8000; // Actor_TestFloorInDirection is useless here (see comment below) if ((this->actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y)) { angle2 = (this->actor.bgCheckFlags & 8) ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle : 0; @@ -656,7 +656,7 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 150.0f; } @@ -688,21 +688,21 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { if ((animPrevFrame != (s32)this->skelAnime.curFrame) && (animFrameSpeedDiff <= 0) && (animSpeed + animPrevFrame > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } - if ((Math_CosS(angle1 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && + if ((Math_CosS(angle1 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 80.0f)) { EnWf_SetupSlash(this); } else { this->actionTimer--; if (this->actionTimer == 0) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnWf_SetupBackflipAway(this); } else { EnWf_SetupWait(this); @@ -726,8 +726,8 @@ void EnWf_SetupSlash(EnWf* this) { EnWf_SetupAction(this, EnWf_Slash); } -void EnWf_Slash(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWf_Slash(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 shapeAngleDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; s16 yawAngleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s32 curFrame = this->skelAnime.curFrame; @@ -746,12 +746,12 @@ void EnWf_Slash(EnWf* this, GlobalContext* globalCtx) { this->slashStatus = 0; } - if (((curFrame == 15) && !Actor_IsTargeted(globalCtx, &this->actor) && + if (((curFrame == 15) && !Actor_IsTargeted(play, &this->actor) && (!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) || SkelAnime_Update(&this->skelAnime)) { if ((curFrame != 15) && (this->actionTimer != 0)) { this->actor.shape.rot.y += (s16)(3276.0f * (1.5f + (this->actionTimer - 4) * 0.4f)); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); this->actionTimer--; } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (curFrame != 15)) { EnWf_SetupWait(this); @@ -767,13 +767,13 @@ void EnWf_Slash(EnWf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); } else if (shapeAngleDiff <= 10000) { if (yawAngleDiff > 16000) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnWf_SetupRunAroundPlayer(this); } else { - EnWf_ChangeAction(globalCtx, this, true); + EnWf_ChangeAction(play, this, true); } } else { EnWf_SetupRunAroundPlayer(this); @@ -796,8 +796,8 @@ void EnWf_SetupRecoilFromBlockedSlash(EnWf* this) { EnWf_SetupAction(this, EnWf_RecoilFromBlockedSlash); } -void EnWf_RecoilFromBlockedSlash(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWf_RecoilFromBlockedSlash(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 angle1 = player->actor.shape.rot.y - this->actor.shape.rot.y; s16 angle2 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -820,13 +820,13 @@ void EnWf_RecoilFromBlockedSlash(EnWf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); } else if (angle1 <= 0x2710) { if (angle2 > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnWf_SetupRunAroundPlayer(this); } else { - EnWf_ChangeAction(globalCtx, this, true); + EnWf_ChangeAction(play, this, true); } } else { EnWf_SetupRunAroundPlayer(this); @@ -847,18 +847,18 @@ void EnWf_SetupBackflipAway(EnWf* this) { EnWf_SetupAction(this, EnWf_BackflipAway); } -void EnWf_BackflipAway(EnWf* this, GlobalContext* globalCtx) { +void EnWf_BackflipAway(EnWf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && + if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { - EnWf_SetupRunAtPlayer(this, globalCtx); - } else if ((globalCtx->gameplayFrames % 2) != 0) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); + } else if ((play->gameplayFrames % 2) != 0) { + EnWf_SetupSidestep(this, play); } else { EnWf_SetupWait(this); } } - if ((globalCtx->state.frames & 95) == 0) { + if ((play->state.frames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -874,7 +874,7 @@ void EnWf_SetupStunned(EnWf* this) { EnWf_SetupAction(this, EnWf_Stunned); } -void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Stunned(EnWf* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; } @@ -891,7 +891,7 @@ void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health == 0) { EnWf_SetupDie(this); } else { - EnWf_ChangeAction(globalCtx, this, true); + EnWf_ChangeAction(play, this, true); } } } @@ -913,7 +913,7 @@ void EnWf_SetupDamaged(EnWf* this) { EnWf_SetupAction(this, EnWf_Damaged); } -void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Damaged(EnWf* this, PlayState* play) { s16 angleToWall; if (this->actor.bgCheckFlags & 2) { @@ -930,16 +930,16 @@ void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); - if (!EnWf_ChangeAction(globalCtx, this, false) && SkelAnime_Update(&this->skelAnime)) { + if (!EnWf_ChangeAction(play, this, false) && SkelAnime_Update(&this->skelAnime)) { if (this->actor.bgCheckFlags & 1) { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; angleToWall = ABS(angleToWall); if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 12000) && (this->actor.xzDistToPlayer < 120.0f)) { EnWf_SetupSomersaultAndAttack(this); - } else if (!EnWf_DodgeRanged(globalCtx, this)) { - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - ((globalCtx->gameplayFrames % 8) != 0)) { + } else if (!EnWf_DodgeRanged(play, this)) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + ((play->gameplayFrames % 8) != 0)) { EnWf_SetupSlash(this); } else if (Rand_ZeroOne() > 0.5f) { EnWf_SetupWait(this); @@ -967,13 +967,13 @@ void EnWf_SetupSomersaultAndAttack(EnWf* this) { EnWf_SetupAction(this, EnWf_SomersaultAndAttack); } -void EnWf_SomersaultAndAttack(EnWf* this, GlobalContext* globalCtx) { +void EnWf_SomersaultAndAttack(EnWf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); if (this->actor.velocity.y >= 5.0f) { //! @bug unk_4C8 and unk_4BC are used but not set (presumably intended to be feet positions like other actors) - func_800355B8(globalCtx, &this->unk_4C8); - func_800355B8(globalCtx, &this->unk_4BC); + func_800355B8(play, &this->unk_4C8); + func_800355B8(play, &this->unk_4BC); } if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (1 | 2))) { @@ -982,7 +982,7 @@ void EnWf_SomersaultAndAttack(EnWf* this, GlobalContext* globalCtx) { this->actor.speedXZ = this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!Actor_OtherIsTargeted(play, &this->actor)) { EnWf_SetupSlash(this); } else { EnWf_SetupWait(this); @@ -1005,8 +1005,8 @@ void EnWf_SetupBlocking(EnWf* this) { EnWf_SetupAction(this, EnWf_Blocking); } -void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWf_Blocking(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (this->actionTimer != 0) { @@ -1020,10 +1020,10 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { if ((ABS(yawDiff) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && (ABS(this->actor.yDistToPlayer) < 50.0f)) { - if (func_800354B4(globalCtx, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { if (player->swordAnimation == 0x11) { EnWf_SetupBlocking(this); - } else if ((globalCtx->gameplayFrames % 2) != 0) { + } else if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); } else { EnWf_SetupBackflipAway(this); @@ -1032,8 +1032,8 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { } else { s16 angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && - (((globalCtx->gameplayFrames % 2) != 0) || (ABS(angleFacingLink) < 0x38E0))) { + if (!Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 2) != 0) || (ABS(angleFacingLink) < 0x38E0))) { EnWf_SetupSlash(this); } else { EnWf_SetupRunAroundPlayer(this); @@ -1043,10 +1043,10 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupRunAroundPlayer(this); } } else if (this->actionTimer == 0) { - if (func_800354B4(globalCtx, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { if (player->swordAnimation == 0x11) { EnWf_SetupBlocking(this); - } else if ((globalCtx->gameplayFrames % 2) != 0) { + } else if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); } else { EnWf_SetupBackflipAway(this); @@ -1055,14 +1055,14 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_SetupSidestep(EnWf* this, GlobalContext* globalCtx) { +void EnWf_SetupSidestep(EnWf* this, PlayState* play) { s16 angle; Player* player; f32 lastFrame = Animation_GetLastFrame(&gWolfosRunningAnim); Animation_Change(&this->skelAnime, &gWolfosRunningAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); angle = player->actor.shape.rot.y + this->runAngle; if (Math_SinS(angle - this->actor.yawTowardsPlayer) > 0.0f) { @@ -1085,9 +1085,9 @@ void EnWf_SetupSidestep(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupAction(this, EnWf_Sidestep); } -void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Sidestep(EnWf* this, PlayState* play) { s16 angleDiff1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 animPrevFrame; s32 animFrameSpeedDiff; s32 animSpeed; @@ -1097,7 +1097,7 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { // Actor_TestFloorInDirection is useless here (see comment below) if ((this->actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y)) { s16 angle = (this->actor.bgCheckFlags & 8) ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle : 0; @@ -1110,7 +1110,7 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 150.0f; } @@ -1140,7 +1140,7 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { animFrameSpeedDiff = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed); animSpeed = (f32)ABS(this->skelAnime.playSpeed); - if (!EnWf_ChangeAction(globalCtx, this, false)) { + if (!EnWf_ChangeAction(play, this, false)) { this->actionTimer--; if (this->actionTimer == 0) { @@ -1151,16 +1151,16 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupWait(this); this->actionTimer = (Rand_ZeroOne() * 3.0f) + 1.0f; } else { - Player* player2 = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(play); s16 angleDiff2 = player2->actor.shape.rot.y - this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - (((globalCtx->gameplayFrames % 4) == 0) || (ABS(angleDiff2) < 0x38E0))) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 4) == 0) || (ABS(angleDiff2) < 0x38E0))) { EnWf_SetupSlash(this); } else { - EnWf_SetupRunAtPlayer(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); } } } @@ -1168,10 +1168,10 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { if ((animPrevFrame != (s32)this->skelAnime.curFrame) && (animFrameSpeedDiff <= 0) && ((animSpeed + animPrevFrame) > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -1195,7 +1195,7 @@ void EnWf_SetupDie(EnWf* this) { EnWf_SetupAction(this, EnWf_Die); } -void EnWf_Die(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Die(EnWf* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; } @@ -1206,10 +1206,10 @@ void EnWf_Die(EnWf* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); if (this->switchFlag != 0xFF) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); @@ -1224,13 +1224,13 @@ void EnWf_Die(EnWf* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; pos.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z; pos.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f); - EffectSsDeadDb_Spawn(globalCtx, &pos, &velAndAccel, &velAndAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, + EffectSsDeadDb_Spawn(play, &pos, &velAndAccel, &velAndAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } } } -void func_80B36F40(EnWf* this, GlobalContext* globalCtx) { +void func_80B36F40(EnWf* this, PlayState* play) { if ((this->action == WOLFOS_ACTION_WAIT) && (this->unk_2E2 != 0)) { this->unk_4D4.y = Math_SinS(this->unk_2E2 * 4200) * 8920.0f; } else if (this->action != WOLFOS_ACTION_STUNNED) { @@ -1243,7 +1243,7 @@ void func_80B36F40(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_UpdateDamage(EnWf* this, GlobalContext* globalCtx) { +void EnWf_UpdateDamage(EnWf* this, PlayState* play) { if (this->colliderSpheres.base.acFlags & AC_BOUNCED) { this->colliderSpheres.base.acFlags &= ~(AC_HIT | AC_BOUNCED); this->colliderCylinderBody.base.acFlags &= ~AC_HIT; @@ -1283,7 +1283,7 @@ void EnWf_UpdateDamage(EnWf* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor) == 0) { EnWf_SetupDie(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { EnWf_SetupDamaged(this); } @@ -1293,17 +1293,17 @@ void EnWf_UpdateDamage(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Update(Actor* thisx, PlayState* play) { s32 pad; EnWf* this = (EnWf*)thisx; - EnWf_UpdateDamage(this, globalCtx); + EnWf_UpdateDamage(this, play); if (this->actor.colChkInfo.damageEffect != ENWF_DMGEFF_ICE_MAGIC) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 60.0f, 0x1D); - this->actionFunc(this, globalCtx); - func_80B36F40(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, 0x1D); + this->actionFunc(this, play); + func_80B36F40(this, play); } if (this->actor.bgCheckFlags & (1 | 2)) { @@ -1313,23 +1313,23 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 1000, 0); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSpheres.base); if (this->action >= WOLFOS_ACTION_WAIT) { if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { Collider_UpdateCylinder(&this->actor, &this->colliderCylinderBody); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinderTail.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinderTail.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinderBody.base); } } if (this->action == WOLFOS_ACTION_BLOCKING) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSpheres.base); } if (this->slashStatus > 0) { if (!(this->colliderSpheres.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSpheres.base); } else { EnWf_SetupRecoilFromBlockedSlash(this); } @@ -1339,7 +1339,7 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 25.0f; if (this->eyeIndex == 0) { - if ((Rand_ZeroOne() < 0.2f) && ((globalCtx->gameplayFrames % 4) == 0) && (this->actor.colorFilterTimer == 0)) { + if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames % 4) == 0) && (this->actor.colorFilterTimer == 0)) { this->eyeIndex++; } } else { @@ -1347,7 +1347,7 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnWf* this = (EnWf*)thisx; if ((limbIndex == WOLFOS_LIMB_HEAD) || (limbIndex == WOLFOS_LIMB_EYES)) { @@ -1357,7 +1357,7 @@ s32 EnWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnWf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f colliderVec = { 1200.0f, 0.0f, 0.0f }; static Vec3f bodyPartVec = { 0.0f, 0.0f, 0.0f }; EnWf* this = (EnWf*)thisx; @@ -1427,15 +1427,15 @@ static void* sWolfosNormalEyeTextures[] = { gWolfosNormalEyeOpenTex, gWolfosNorm static void* sWolfosWhiteEyeTextures[] = { gWolfosWhiteEyeOpenTex, gWolfosWhiteEyeHalfTex, gWolfosWhiteEyeNarrowTex, gWolfosWhiteEyeHalfTex }; -void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Draw(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // This conditional will always evaluate to true, since unk_300 is false whenever action is // WOLFOS_ACTION_WAIT_TO_APPEAR. if ((this->action != WOLFOS_ACTION_WAIT_TO_APPEAR) || !this->unk_300) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actor.params == WOLFOS_NORMAL) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sWolfosNormalEyeTextures[this->eyeIndex])); @@ -1443,7 +1443,7 @@ void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sWolfosWhiteEyeTextures[this->eyeIndex])); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); if (this->fireTimer != 0) { @@ -1453,16 +1453,16 @@ void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->fireTimer % 4) == 0) { s32 fireIndex = this->fireTimer >> 2; - EffectSsEnFire_SpawnVec3s(globalCtx, &this->actor, &this->bodyPartsPos[fireIndex], 75, 0, 0, fireIndex); + EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->bodyPartsPos[fireIndex], 75, 0, 0, fireIndex); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnWf_DodgeRanged(GlobalContext* globalCtx, EnWf* this) { - Actor* actor = Actor_GetProjectileActor(globalCtx, &this->actor, 600.0f); +s32 EnWf_DodgeRanged(PlayState* play, EnWf* this) { + Actor* actor = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (actor != NULL) { s16 angleToFacing; @@ -1478,7 +1478,7 @@ s32 EnWf_DodgeRanged(GlobalContext* globalCtx, EnWf* this) { } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; if ((ABS(angleToFacing) < 0x2000) || (ABS(angleToFacing) > 0x5FFF)) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); this->actor.speedXZ *= 2.0f; } else if (ABS(angleToFacing) < 0x5FFF) { EnWf_SetupBackflipAway(this); diff --git a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.h b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.h index b99bb8092..36afdccf5 100644 --- a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -6,7 +6,7 @@ struct EnWf; -typedef void (*EnWfActionFunc)(struct EnWf*, GlobalContext*); +typedef void (*EnWfActionFunc)(struct EnWf*, PlayState*); typedef enum { /* 0 */ WOLFOS_LIMB_NONE, diff --git a/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index 17e2feba4..8d7f66c84 100644 --- a/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWonderItem_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWonderItem_Init(Actor* thisx, PlayState* play); +void EnWonderItem_Destroy(Actor* thisx, PlayState* play); +void EnWonderItem_Update(Actor* thisx, PlayState* play); -void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_ProximityDrop(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_InteractSwitch(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_BombSoldier(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_RollDrop(EnWonderItem* this, GlobalContext* globalCtx); +void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play); +void EnWonderItem_ProximityDrop(EnWonderItem* this, PlayState* play); +void EnWonderItem_InteractSwitch(EnWonderItem* this, PlayState* play); +void EnWonderItem_ProximitySwitch(EnWonderItem* this, PlayState* play); +void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play); +void EnWonderItem_BombSoldier(EnWonderItem* this, PlayState* play); +void EnWonderItem_RollDrop(EnWonderItem* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -57,16 +57,16 @@ const ActorInit En_Wonder_Item_InitVars = { static Vec3f sTagPointsFree[9]; static Vec3f sTagPointsOrdered[9]; -void EnWonderItem_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderItem_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnWonderItem* this = (EnWonderItem*)thisx; if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnWonderItem_DropCollectible(EnWonderItem* this, GlobalContext* globalCtx, s32 autoCollect) { +void EnWonderItem_DropCollectible(EnWonderItem* this, PlayState* play, s32 autoCollect) { static s16 dropTable[] = { ITEM00_NUTS, ITEM00_HEART_PIECE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_SMALL, ITEM00_HEART, ITEM00_ARROWS_SMALL, ITEM00_ARROWS_MEDIUM, ITEM00_ARROWS_LARGE, @@ -83,26 +83,26 @@ void EnWonderItem_DropCollectible(EnWonderItem* this, GlobalContext* globalCtx, for (i = this->dropCount; i > 0; i--) { if (this->itemDrop < WONDERITEM_DROP_RANDOM) { if ((this->itemDrop == WONDERITEM_DROP_FLEXIBLE) || !autoCollect) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, dropTable[this->itemDrop]); + Item_DropCollectible(play, &this->actor.world.pos, dropTable[this->itemDrop]); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, dropTable[this->itemDrop] | 0x8000); + Item_DropCollectible(play, &this->actor.world.pos, dropTable[this->itemDrop] | 0x8000); } } else { randomDrop = this->itemDrop - WONDERITEM_DROP_RANDOM; if (!autoCollect) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, randomDrop); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, randomDrop); } else { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, randomDrop | 0x8000); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, randomDrop | 0x8000); } } } if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } -void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderItem_Init(Actor* thisx, PlayState* play) { static u32 collisionTypes[] = { 0x00000702 /* sword slash */, 0x0001F820 /* arrow */, 0x00000040 /* hammer */, 0x00000008 /* bomb */, 0x00000004 /* slingshot */, 0x00000010 /* boomerang */, 0x00000080 /* hookshot */, @@ -125,7 +125,7 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = -1; } this->actor.targetMode = 1; - if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); return; @@ -153,8 +153,8 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { break; case WONDERITEM_INTERACT_SWITCH: colTypeIndex = this->actor.world.rot.z & 0xFF; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.info.bumper.dmgFlags = collisionTypes[colTypeIndex]; this->collider.dim.radius = 20; this->collider.dim.height = 30; @@ -182,8 +182,8 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { this->updateFunc = EnWonderItem_ProximitySwitch; break; case WONDERITEM_BOMB_SOLDIER: - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.info.bumper.dmgFlags = 0x00000004; // slingshot this->unkPos = this->actor.world.pos; this->collider.dim.radius = 35; @@ -200,8 +200,8 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevTagFlags = this->tagFlags; s32 i; s32 mask; @@ -221,7 +221,7 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { if (BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsFree[i].x, sTagPointsFree[i].y, sTagPointsFree[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 255, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } } @@ -231,40 +231,40 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { } if (this->tagCount == this->numTagPoints) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_ProximityDrop(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_ProximityDrop(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.xzDistToPlayer < 50.0f) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_InteractSwitch(EnWonderItem* this, GlobalContext* globalCtx) { +void EnWonderItem_InteractSwitch(EnWonderItem* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - EnWonderItem_DropCollectible(this, globalCtx, false); + EnWonderItem_DropCollectible(this, play, false); } } -void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_ProximitySwitch(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.xzDistToPlayer < 50.0f) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } } -void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevTagFlags = this->tagFlags; s32 i; s32 mask; @@ -291,7 +291,7 @@ void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) } else if (BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsOrdered[i].x, sTagPointsOrdered[i].y, sTagPointsOrdered[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 0, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } } } @@ -300,36 +300,36 @@ void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) return; } if (this->tagCount == this->numTagPoints) { - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_BombSoldier(EnWonderItem* this, GlobalContext* globalCtx) { +void EnWonderItem_BombSoldier(EnWonderItem* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HEISHI2, this->actor.world.pos.x, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HEISHI2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.yawTowardsPlayer, 0, 9) != NULL) { // "Careless soldier spawned" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ うっかり兵セット完了 ☆☆☆☆☆ \n" VT_RST); } if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } } -void EnWonderItem_RollDrop(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_RollDrop(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.xzDistToPlayer < 50.0f) && (player->invincibilityTimer < 0) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderItem_Update(Actor* thisx, PlayState* play) { static s16 debugArrowColors[] = { 255, 255, 0, 255, 0, 255, 0, 255, 255, 255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128, 128, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 0, 0, 128, 0, 0, 0, 128, @@ -341,14 +341,14 @@ void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); if (this->wonderMode == WONDERITEM_UNUSED) { Actor_SetFocus(&this->actor, this->unkHeight); } if ((this->wonderMode == WONDERITEM_INTERACT_SWITCH) || (this->wonderMode == WONDERITEM_BOMB_SOLDIER)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } colorIndex = this->wonderMode; @@ -359,6 +359,6 @@ void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, debugArrowColors[colorIndex], debugArrowColors[colorIndex + 1], - debugArrowColors[colorIndex + 2], 255, 4, globalCtx->state.gfxCtx); + debugArrowColors[colorIndex + 2], 255, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h b/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h index fc2f2e816..0626afd60 100644 --- a/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h +++ b/soh/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h @@ -6,7 +6,7 @@ struct EnWonderItem; -typedef void (*EnWonderItemUpdateFunc)(struct EnWonderItem*, GlobalContext*); +typedef void (*EnWonderItemUpdateFunc)(struct EnWonderItem*, PlayState*); typedef struct EnWonderItem { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index 46289fee2..dd5b8dc81 100644 --- a/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) -void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWonderTalk_Init(Actor* thisx, PlayState* play); +void EnWonderTalk_Destroy(Actor* thisx, PlayState* play); +void EnWonderTalk_Update(Actor* thisx, PlayState* play); -void func_80B391CC(EnWonderTalk* this, GlobalContext* globalCtx); -void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx); -void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx); +void func_80B391CC(EnWonderTalk* this, PlayState* play); +void func_80B395F0(EnWonderTalk* this, PlayState* play); +void func_80B3943C(EnWonderTalk* this, PlayState* play); const ActorInit En_Wonder_Talk_InitVars = { ACTOR_EN_WONDER_TALK, @@ -30,10 +30,10 @@ const ActorInit En_Wonder_Talk_InitVars = { NULL, }; -void EnWonderTalk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk_Destroy(Actor* thisx, PlayState* play) { } -void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk_Init(Actor* thisx, PlayState* play) { EnWonderTalk* this = (EnWonderTalk*)thisx; osSyncPrintf("\n\n"); @@ -48,7 +48,7 @@ void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx) { } this->actor.targetMode = 1; if (this->switchFlag >= 0) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); return; @@ -58,8 +58,8 @@ void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 40.0f; } -void func_80B391CC(EnWonderTalk* this, GlobalContext* globalCtx) { - if (this->switchFlag < 0 || !Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_80B391CC(EnWonderTalk* this, PlayState* play) { + if (this->switchFlag < 0 || !Flags_GetSwitch(play, this->switchFlag)) { switch (this->unk_150) { case 1: // "Slate GO!" @@ -129,7 +129,7 @@ void func_80B391CC(EnWonderTalk* this, GlobalContext* globalCtx) { } } -void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx) { +void func_80B3943C(EnWonderTalk* this, PlayState* play) { s16 yawDiff; s16 yawDiffTemp; @@ -138,17 +138,17 @@ void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - if (this->switchFlag < 0 || !Flags_GetSwitch(globalCtx, this->switchFlag)) { - if ((Actor_ProcessTalkRequest(&this->actor, globalCtx))) { + if (this->switchFlag < 0 || !Flags_GetSwitch(play, this->switchFlag)) { + if ((Actor_ProcessTalkRequest(&this->actor, play))) { if (this->unk_156 != TEXT_STATE_DONE) { // not if we're rando'd in the temple of time talking to the altar - if(!(gSaveContext.n64ddFlag && globalCtx->sceneNum == 67)) { + if(!(gSaveContext.n64ddFlag && play->sceneNum == 67)) { this->actionFunc = func_80B395F0; } } else { if (this->switchFlag >= 0) { this->actor.flags &= ~ACTOR_FLAG_0; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } this->actionFunc = func_80B391CC; } @@ -170,25 +170,25 @@ void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); } this->unk_15A = 0; - func_8002F2CC(&this->actor, globalCtx, this->unk_15C); + func_8002F2CC(&this->actor, play, this->unk_15C); } } } } -void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx) { - if (this->unk_156 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { +void func_80B395F0(EnWonderTalk* this, PlayState* play) { + if (this->unk_156 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->switchFlag >= 0) { this->actor.flags &= ~ACTOR_FLAG_0; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } switch (this->unk_150) { case 1: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_80B391CC; break; case 2: - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (!LINK_IS_ADULT) { // "I'm still a child!" @@ -208,13 +208,13 @@ void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx) { } this->unk_156 = TEXT_STATE_DONE; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80B391CC; break; case 3: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (this->unk_164 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_POH, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_POH, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 2); this->unk_164 = 1; } @@ -222,9 +222,9 @@ void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx) { this->actionFunc = func_80B391CC; break; case 5: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (this->unk_164 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_POH, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_POH, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 3); this->unk_164 = 1; } @@ -234,13 +234,13 @@ void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx) { } } -void EnWonderTalk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk_Update(Actor* thisx, PlayState* play) { EnWonderTalk* this = (EnWonderTalk*)thisx; if (this->unk_158 != 0) { this->unk_158--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->height); if (BREG(0) != 0) { @@ -248,12 +248,12 @@ void EnWonderTalk_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->unk_15A & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 10, 10, 10, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 10, 10, 10, 255, 4, play->state.gfxCtx); } } else { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 255, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } } diff --git a/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h b/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h index 50b370b31..ae21c5b41 100644 --- a/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h +++ b/soh/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h @@ -6,7 +6,7 @@ struct EnWonderTalk; -typedef void (*EnWonderTalkFunc)(struct EnWonderTalk*, GlobalContext*); +typedef void (*EnWonderTalkFunc)(struct EnWonderTalk*, PlayState*); typedef struct EnWonderTalk { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 314092d49..f7ecbaf19 100644 --- a/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) -void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk2_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWonderTalk2_Init(Actor* thisx, PlayState* play); +void EnWonderTalk2_Destroy(Actor* thisx, PlayState* play); +void EnWonderTalk2_Update(Actor* thisx, PlayState* play); -void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx); -void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx); -void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx); -void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx); -void EnWonderTalk2_DoNothing(EnWonderTalk2* this, GlobalContext* globalCtx); +void func_80B3A10C(EnWonderTalk2* this, PlayState* play); +void func_80B3A4F8(EnWonderTalk2* this, PlayState* play); +void func_80B3A15C(EnWonderTalk2* this, PlayState* play); +void func_80B3A3D4(EnWonderTalk2* this, PlayState* play); +void EnWonderTalk2_DoNothing(EnWonderTalk2* this, PlayState* play); const ActorInit En_Wonder_Talk2_InitVars = { ACTOR_EN_WONDER_TALK2, @@ -34,10 +34,10 @@ const ActorInit En_Wonder_Talk2_InitVars = { static s16 D_80B3A8E0[] = { 6, 0, 1, 2, 3, 4, 5 }; -void EnWonderTalk2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk2_Destroy(Actor* thisx, PlayState* play) { } -void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk2_Init(Actor* thisx, PlayState* play) { s32 pad; EnWonderTalk2* this = (EnWonderTalk2*)thisx; @@ -80,12 +80,12 @@ void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->switchFlag == 0x3F) { this->switchFlag = -1; } - if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); return; } - if ((this->talkMode == 1) && (globalCtx->sceneNum == SCENE_MEN) && (this->switchFlag != 0x08) && + if ((this->talkMode == 1) && (play->sceneNum == SCENE_MEN) && (this->switchFlag != 0x08) && (this->switchFlag != 0x16) && (this->switchFlag != 0x2F)) { this->unk_15A = false; @@ -99,7 +99,7 @@ void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx) { +void func_80B3A10C(EnWonderTalk2* this, PlayState* play) { this->actor.textId = 0x200; this->actor.textId |= this->baseMsgId; if (this->talkMode == 1 || this->talkMode == 4) { @@ -109,18 +109,18 @@ void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx) { } } -void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3A15C(EnWonderTalk2* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_158++; - if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { if (!this->unk_15A) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_15A = true; } - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->switchFlag >= 0) && (this->talkMode != 2)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); // "I saved it! All of it!" osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ セーブしたよ!おもいっきり! %x\n" VT_RST, this->switchFlag); } @@ -162,30 +162,30 @@ void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) { } this->unk_158 = 0; - func_8002F1C4(&this->actor, globalCtx, this->triggerRange + 50.0f, 100.0f, EXCH_ITEM_NONE); + func_8002F1C4(&this->actor, play, this->triggerRange + 50.0f, 100.0f, EXCH_ITEM_NONE); } } } -void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx) { +void func_80B3A3D4(EnWonderTalk2* this, PlayState* play) { if (BREG(2) != 0) { // "Oh" - osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ わー %d\n" VT_RST, Message_GetState(&globalCtx->msgCtx)); + osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ わー %d\n" VT_RST, Message_GetState(&play->msgCtx)); } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_EVENT: case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - Message_CloseTextbox(globalCtx); + if (Message_ShouldAdvance(play)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + Message_CloseTextbox(play); } } else { break; } case TEXT_STATE_NONE: if ((this->switchFlag >= 0) && (this->talkMode != 4)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); // "(Forced) I saved it! All of it!" osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ (強制)セーブしたよ!おもいっきり! %x\n" VT_RST, this->switchFlag); } @@ -194,19 +194,19 @@ void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx) { this->unk_15A = true; } this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_4); - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->unk_156 = true; this->actionFunc = func_80B3A4F8; break; } } -void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { +void func_80B3A4F8(EnWonderTalk2* this, PlayState* play) { Player* player; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_158++; - if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) { if (!this->unk_15A) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_15A = true; @@ -218,7 +218,7 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { } if (((this->actor.xzDistToPlayer < (40.0f + this->triggerRange)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f)) && - !Gameplay_InCsMode(globalCtx)) { + !Play_InCsMode(play)) { if (this->unk_158 >= 2) { osSyncPrintf("\n\n"); // "Transparent Message Kimi Seto" @@ -256,7 +256,7 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { bool randoSkipText = false; if (gSaveContext.n64ddFlag) { // Scenes for which all of this type of wonder talk should be skipped. - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case 0x0007: // Shadow Temple randoSkipText = true; break; @@ -283,8 +283,8 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { //} } if (!(randoSkipText)) { - Message_StartTextbox(globalCtx, this->actor.textId, NULL); - func_8002DF54(globalCtx, NULL, 8); + Message_StartTextbox(play, this->actor.textId, NULL); + func_8002DF54(play, NULL, 8); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_4; this->actionFunc = func_80B3A3D4; } @@ -296,14 +296,14 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { } } -void EnWonderTalk2_DoNothing(EnWonderTalk2* this, GlobalContext* globalCtx) { +void EnWonderTalk2_DoNothing(EnWonderTalk2* this, PlayState* play) { } -void EnWonderTalk2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk2_Update(Actor* thisx, PlayState* play) { s32 pad; EnWonderTalk2* this = (EnWonderTalk2*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.world.pos.y = this->initPos.y; Actor_SetFocus(&this->actor, this->height); @@ -313,12 +313,12 @@ void EnWonderTalk2_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->unk_158 & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 70, 70, 70, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 70, 70, 70, 255, 4, play->state.gfxCtx); } } else { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 0, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } } } diff --git a/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h b/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h index 5e450998e..f58775426 100644 --- a/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h +++ b/soh/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h @@ -6,7 +6,7 @@ struct EnWonderTalk2; -typedef void (*EnWonderTalk2Func)(struct EnWonderTalk2*, GlobalContext*); +typedef void (*EnWonderTalk2Func)(struct EnWonderTalk2*, PlayState*); typedef struct EnWonderTalk2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 7e6c3fcd3..3ee7c7089 100644 --- a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWood02_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWood02_Init(Actor* thisx, PlayState* play); +void EnWood02_Destroy(Actor* thisx, PlayState* play); +void EnWood02_Update(Actor* thisx, PlayState* play); +void EnWood02_Draw(Actor* thisx, PlayState* play); /** * WOOD_SPAWN_SPAWNER is also used by some individual trees: EnWood02_Update also checks for parent before running any @@ -98,14 +98,14 @@ static f32 sSpawnCos; static f32 sSpawnSin; -s32 EnWood02_SpawnZoneCheck(EnWood02* this, GlobalContext* globalCtx, Vec3f* pos) { +s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* pos) { f32 phi_f12; if (CVar_GetS32("gDisableDrawDistance", 0) != 0) { return true; } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, pos, &this->actor.projectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, pos, &this->actor.projectedPos, &this->actor.projectedW); phi_f12 = ((this->actor.projectedW == 0.0f) ? 1000.0f : fabsf(1.0f / this->actor.projectedW)); @@ -122,7 +122,7 @@ s32 EnWood02_SpawnZoneCheck(EnWood02* this, GlobalContext* globalCtx, Vec3f* pos /** Spawns similar-looking trees or bushes only when the player is sufficiently close. Presumably done this way to keep * memory usage down in Hyrule Field. */ -void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { +void EnWood02_SpawnOffspring(EnWood02* this, PlayState* play) { EnWood02* childWood; s16* childSpawnAngle; Vec3f childPos; @@ -142,13 +142,13 @@ void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { childPos.x = (sSpawnDistance[i] * sSpawnSin) + this->actor.home.pos.x; childPos.y = this->actor.home.pos.y; childPos.z = (sSpawnDistance[i] * sSpawnCos) + this->actor.home.pos.z; - if (EnWood02_SpawnZoneCheck(this, globalCtx, &childPos)) { + if (EnWood02_SpawnZoneCheck(this, play, &childPos)) { if ((this->unk_14E[i] & 0x80) != 0) { childParams = (0xFF00 | (this->actor.params + 1)); } else { childParams = (((this->drawType & 0xF0) << 4) | (this->actor.params + 1)); } - childWood = (EnWood02*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + childWood = (EnWood02*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_WOOD02, childPos.x, childPos.y, childPos.z, this->actor.world.rot.x, *childSpawnAngle, 0, childParams); if (childWood != NULL) { @@ -163,10 +163,10 @@ void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { } } -void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnWood02_Init(Actor* thisx, PlayState* play2) { s16 spawnType; f32 actorScale; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnWood02* this = (EnWood02*)thisx; CollisionPoly* outPoly; s32 bgId; @@ -189,8 +189,8 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(&this->actor, sInitChain); if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } switch (this->actor.params) { @@ -270,7 +270,7 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { if (spawnType == WOOD_SPAWN_SPAWNER) { this->drawType |= this->unk_14C << 4; - EnWood02_SpawnOffspring(this, globalCtx); + EnWood02_SpawnOffspring(this, play); sSpawnCos = Math_CosS(sSpawnAngle[5] + this->actor.world.rot.y + extraRot); sSpawnSin = Math_SinS(sSpawnAngle[5] + this->actor.world.rot.y + extraRot); this->actor.world.pos.x += (sSpawnSin * sSpawnDistance[5]); @@ -281,7 +281,7 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { // Snap to floor, or remove if over void this->actor.world.pos.y += 200.0f; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &outPoly, &bgId, &this->actor, &this->actor.world.pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &outPoly, &bgId, &this->actor, &this->actor.world.pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY; @@ -295,16 +295,16 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; } -void EnWood02_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWood02_Destroy(Actor* thisx, PlayState* play) { EnWood02* this = (EnWood02*)thisx; if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnWood02_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWood02* this = (EnWood02*)thisx; f32 wobbleAmplitude; u8 new_var; @@ -329,7 +329,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { return; } } else if (this->spawnType == WOOD_SPAWN_SPAWNER) { - EnWood02_SpawnOffspring(this, globalCtx); + EnWood02_SpawnOffspring(this, play); } if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { @@ -343,12 +343,12 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { dropsSpawnPt.y += 200.0f; if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &dropsSpawnPt, this->unk_14C << 4); + Item_DropCollectibleRandom(play, &this->actor, &dropsSpawnPt, this->unk_14C << 4); } else { if (this->actor.home.rot.z != 0) { this->actor.home.rot.z &= 0x1FFF; this->actor.home.rot.z |= 0xE000; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, dropsSpawnPt.x, dropsSpawnPt.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, 0, this->actor.world.rot.y, 0, this->actor.home.rot.z); this->actor.home.rot.z = 0; } @@ -365,7 +365,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TREE_SWING); for (i = 3; i >= 0; i--) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, 0, Rand_CenteredFloat(65535.0f), 0, leavesParams); } } @@ -375,11 +375,11 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } else if (this->actor.params < 0x17) { // Bush - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unk_14C >= -1) { if (((player->rideActor == NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 20.0) && @@ -387,7 +387,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { ((player->rideActor != NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 60.0) && (player->rideActor->speedXZ != 0.0f))) { if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, ((this->unk_14C << 4) | 0x8000)); } this->unk_14C = -0x15; @@ -416,10 +416,10 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWood02_Draw(Actor* thisx, PlayState* play) { EnWood02* this = (EnWood02*)thisx; s16 type; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 red; u8 green; u8 blue; @@ -446,9 +446,9 @@ void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.params == WOOD_LEAF_GREEN) || (this->actor.params == WOOD_LEAF_YELLOW)) { func_80093D18(gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, red, green, blue, 127); - Gfx_DrawDListOpa(globalCtx, object_wood02_DL_000700); + Gfx_DrawDListOpa(play, object_wood02_DL_000700); } else if (D_80B3BF70[this->drawType & 0xF] != NULL) { - Gfx_DrawDListOpa(globalCtx, D_80B3BF54[this->drawType & 0xF]); + Gfx_DrawDListOpa(play, D_80B3BF54[this->drawType & 0xF]); gDPSetEnvColor(POLY_XLU_DISP++, red, green, blue, 0); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c index ba4e62585..4eae7c311 100644 --- a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -16,18 +16,18 @@ #define FLAGS ACTOR_FLAG_4 -void EnXc_Init(Actor* thisx, GlobalContext* globalCtx); -void EnXc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnXc_Update(Actor* thisx, GlobalContext* globalCtx); -void EnXc_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnXc_Init(Actor* thisx, PlayState* play); +void EnXc_Destroy(Actor* thisx, PlayState* play); +void EnXc_Update(Actor* thisx, PlayState* play); +void EnXc_Draw(Actor* thisx, PlayState* play); void EnXc_Reset(void); -void EnXc_DrawNothing(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawDefault(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawPullingOutHarp(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawHarp(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawTriforce(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawSquintingEyes(Actor* thisx, GlobalContext* globalCtx); +void EnXc_DrawNothing(Actor* thisx, PlayState* play); +void EnXc_DrawDefault(Actor* thisx, PlayState* play); +void EnXc_DrawPullingOutHarp(Actor* thisx, PlayState* play); +void EnXc_DrawHarp(Actor* thisx, PlayState* play); +void EnXc_DrawTriforce(Actor* thisx, PlayState* play); +void EnXc_DrawSquintingEyes(Actor* thisx, PlayState* play); static ColliderCylinderInitType1 sCylinderInit = { { @@ -54,30 +54,30 @@ static void* sEyeTextures[] = { gSheikEyeShutTex, }; -void EnXc_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_InitCollider(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void EnXc_UpdateCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_UpdateCollider(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; Collider* colliderBase = &this->collider.base; s32 pad[3]; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, colliderBase); + CollisionCheck_SetOC(play, &play->colChkCtx, colliderBase); } -void EnXc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Destroy(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnXc_CalculateHeadTurn(EnXc* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnXc_CalculateHeadTurn(EnXc* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->npcInfo.unk_18 = player->actor.world.pos; this->npcInfo.unk_14 = kREG(16) - 3.0f; @@ -99,7 +99,7 @@ void EnXc_SetEyePattern(EnXc* this) { } } -void EnXc_SpawnNut(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SpawnNut(EnXc* this, PlayState* play) { s32 pad; Vec3f* pos = &this->actor.world.pos; s16 angle = this->actor.shape.rot.y; @@ -107,29 +107,29 @@ void EnXc_SpawnNut(EnXc* this, GlobalContext* globalCtx) { f32 y = pos->y + 3.0f; f32 z = (Math_CosS(angle) * 30.0f) + pos->z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, x, y, z, 0xFA0, this->actor.shape.rot.y, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, x, y, z, 0xFA0, this->actor.shape.rot.y, 0, ARROW_CS_NUT); } -void EnXc_BgCheck(EnXc* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 4); +void EnXc_BgCheck(EnXc* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 4); } s32 EnXc_AnimIsFinished(EnXc* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnXc_GetCsCmd(GlobalContext* globalCtx, s32 npcActionIdx) { +CsCmdActorAction* EnXc_GetCsCmd(PlayState* play, s32 npcActionIdx) { CsCmdActorAction* action = NULL; - if (globalCtx->csCtx.state != 0) { - action = globalCtx->csCtx.npcActions[npcActionIdx]; + if (play->csCtx.state != 0) { + action = play->csCtx.npcActions[npcActionIdx]; } return action; } -s32 EnXc_CompareCsAction(EnXc* this, GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdActorAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +s32 EnXc_CompareCsAction(EnXc* this, PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdActorAction = EnXc_GetCsCmd(play, npcActionIdx); if (csCmdActorAction != NULL && csCmdActorAction->action == action) { return true; @@ -137,8 +137,8 @@ s32 EnXc_CompareCsAction(EnXc* this, GlobalContext* globalCtx, u16 action, s32 n return false; } -s32 EnXc_CsActionsAreNotEqual(EnXc* this, GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +s32 EnXc_CsActionsAreNotEqual(EnXc* this, PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); if (csCmdNPCAction && csCmdNPCAction->action != action) { return true; @@ -146,8 +146,8 @@ s32 EnXc_CsActionsAreNotEqual(EnXc* this, GlobalContext* globalCtx, u16 action, return false; } -void func_80B3C588(EnXc* this, GlobalContext* globalCtx, u32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +void func_80B3C588(EnXc* this, PlayState* play, u32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); Actor* thisx = &this->actor; if (csCmdNPCAction != NULL) { @@ -160,8 +160,8 @@ void func_80B3C588(EnXc* this, GlobalContext* globalCtx, u32 npcActionIdx) { } } -void func_80B3C620(EnXc* this, GlobalContext* globalCtx, s32 npcActionIdx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +void func_80B3C620(EnXc* this, PlayState* play, s32 npcActionIdx) { + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, npcActionIdx); Vec3f* xcPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -173,7 +173,7 @@ void func_80B3C620(EnXc* this, GlobalContext* globalCtx, s32 npcActionIdx) { if (npcAction != NULL) { unk = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 0, 0); + Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 0, 0); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -223,8 +223,8 @@ void func_80B3C7D4(EnXc* this, s32 action1, s32 action2, s32 action3) { } } -s32 EnXc_NoCutscenePlaying(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == 0) { +s32 EnXc_NoCutscenePlaying(PlayState* play) { + if (play->csCtx.state == 0) { return true; } return false; @@ -236,31 +236,31 @@ void func_80B3C820(EnXc* this) { this->action = SHEIK_ACTION_53; } -void func_80B3C888(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_NoCutscenePlaying(globalCtx) && this->actor.params == SHEIK_TYPE_4) { +void func_80B3C888(EnXc* this, PlayState* play) { + if (EnXc_NoCutscenePlaying(play) && this->actor.params == SHEIK_TYPE_4) { func_80B3C820(this); } } -void func_80B3C8CC(EnXc* this, GlobalContext* globalCtx) { +void func_80B3C8CC(EnXc* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->jointTable[0].y >= skelAnime->baseTransl.y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } -void func_80B3C924(EnXc* this, GlobalContext* globalCtx) { +void func_80B3C924(EnXc* this, PlayState* play) { this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80B3C964(EnXc* this, GlobalContext* globalCtx) { +void func_80B3C964(EnXc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80B3C9DC(EnXc* this) { @@ -278,7 +278,7 @@ void func_80B3C9EC(EnXc* this) { return; } -void func_80B3CA38(EnXc* this, GlobalContext* globalCtx) { +void func_80B3CA38(EnXc* this, PlayState* play) { // If Player is adult but hasn't learned Minuet of Forest if (!(gSaveContext.eventChkInf[5] & 1) && LINK_IS_ADULT) { this->action = SHEIK_ACTION_INIT; @@ -287,17 +287,17 @@ void func_80B3CA38(EnXc* this, GlobalContext* globalCtx) { } } -void GivePlayerRandoRewardSheikSong(EnXc* sheik, GlobalContext* globalCtx, RandomizerCheck check, int sheikType, GetItemID ogSongId) { - Player* player = GET_PLAYER(globalCtx); +void GivePlayerRandoRewardSheikSong(EnXc* sheik, PlayState* play, RandomizerCheck check, int sheikType, GetItemID ogSongId) { + Player* player = GET_PLAYER(play); if (!(gSaveContext.eventChkInf[5] & sheikType)) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, ogSongId); - if (check == RC_SHEIK_AT_TEMPLE && !Flags_GetTreasure(globalCtx, 0x1F)) { - if (GiveItemEntryFromActor(&sheik->actor, globalCtx, getItemEntry, 10000.0f, 100.0f)) { + if (check == RC_SHEIK_AT_TEMPLE && !Flags_GetTreasure(play, 0x1F)) { + if (GiveItemEntryFromActor(&sheik->actor, play, getItemEntry, 10000.0f, 100.0f)) { player->pendingFlag.flagID = 0x1F; player->pendingFlag.flagType = FLAG_SCENE_TREASURE; } } else if (check != RC_SHEIK_AT_TEMPLE) { - if (GiveItemEntryFromActor(&sheik->actor, globalCtx, getItemEntry, 10000.0f, 100.0f)) { + if (GiveItemEntryFromActor(&sheik->actor, play, getItemEntry, 10000.0f, 100.0f)) { player->pendingFlag.flagID = (0x5 << 4) | (sheikType & 0xF) >> 1; player->pendingFlag.flagType = FLAG_EVENT_CHECK_INF; } @@ -305,20 +305,20 @@ void GivePlayerRandoRewardSheikSong(EnXc* sheik, GlobalContext* globalCtx, Rando } } -s32 EnXc_MinuetCS(EnXc* this, GlobalContext* globalCtx) { +s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { if (this->actor.params == SHEIK_TYPE_MINUET) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 z = player->actor.world.pos.z; if (z < -2225.0f) { - if (!Gameplay_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { if (!gSaveContext.n64ddFlag) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gMinuetCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gMinuetCs); gSaveContext.cutsceneTrigger = 1; gSaveContext.eventChkInf[5] |= 1; - Item_Give(globalCtx, ITEM_SONG_MINUET); + Item_Give(play, ITEM_SONG_MINUET); } else { - GivePlayerRandoRewardSheikSong(this, globalCtx, RC_SHEIK_IN_FOREST, 1, RG_MINUET_OF_FOREST); + GivePlayerRandoRewardSheikSong(this, play, RC_SHEIK_IN_FOREST, 1, RG_MINUET_OF_FOREST); return false; } return true; @@ -329,7 +329,7 @@ s32 EnXc_MinuetCS(EnXc* this, GlobalContext* globalCtx) { return true; } -void func_80B3CB58(EnXc* this, GlobalContext* globalCtx) { +void func_80B3CB58(EnXc* this, PlayState* play) { // If hasn't learned Bolero and Player is Adult if (!(gSaveContext.eventChkInf[5] & 2) && LINK_IS_ADULT) { this->action = SHEIK_ACTION_INIT; @@ -338,23 +338,23 @@ void func_80B3CB58(EnXc* this, GlobalContext* globalCtx) { } } -s32 EnXc_BoleroCS(EnXc* this, GlobalContext* globalCtx) { +s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { Player* player; PosRot* posRot; if (this->actor.params == SHEIK_TYPE_BOLERO) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); posRot = &player->actor.world; if ((posRot->pos.x > -784.0f) && (posRot->pos.x < -584.0f) && (posRot->pos.y > 447.0f) && (posRot->pos.y < 647.0f) && (posRot->pos.z > -446.0f) && (posRot->pos.z < -246.0f) && - !Gameplay_InCsMode(globalCtx)) { + !Play_InCsMode(play)) { if (!gSaveContext.n64ddFlag) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gDeathMountainCraterBoleroCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gDeathMountainCraterBoleroCs); gSaveContext.cutsceneTrigger = 1; gSaveContext.eventChkInf[5] |= 2; - Item_Give(globalCtx, ITEM_SONG_BOLERO); + Item_Give(play, ITEM_SONG_BOLERO); } else { - GivePlayerRandoRewardSheikSong(this, globalCtx, RC_SHEIK_IN_CRATER, 2, RG_BOLERO_OF_FIRE); + GivePlayerRandoRewardSheikSong(this, play, RC_SHEIK_IN_CRATER, 2, RG_BOLERO_OF_FIRE); return false; } return true; @@ -364,7 +364,7 @@ s32 EnXc_BoleroCS(EnXc* this, GlobalContext* globalCtx) { return true; } -void EnXc_SetupSerenadeAction(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupSerenadeAction(EnXc* this, PlayState* play) { if (gSaveContext.n64ddFlag) { this->action = SHEIK_ACTION_SERENADE; return; @@ -380,22 +380,22 @@ void EnXc_SetupSerenadeAction(EnXc* this, GlobalContext* globalCtx) { } } -s32 EnXc_SerenadeCS(EnXc* this, GlobalContext* globalCtx) { +s32 EnXc_SerenadeCS(EnXc* this, PlayState* play) { if (this->actor.params == SHEIK_TYPE_SERENADE) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 stateFlags = player->stateFlags1; if (((CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1) && !gSaveContext.n64ddFlag) || - (Flags_GetTreasure(globalCtx, 2) && gSaveContext.n64ddFlag)) && + (Flags_GetTreasure(play, 2) && gSaveContext.n64ddFlag)) && !(gSaveContext.eventChkInf[5] & 4) && !(stateFlags & 0x20000000) && - !Gameplay_InCsMode(globalCtx)) { + !Play_InCsMode(play)) { if (!gSaveContext.n64ddFlag) { - Cutscene_SetSegment(globalCtx, &gIceCavernSerenadeCs); + Cutscene_SetSegment(play, &gIceCavernSerenadeCs); gSaveContext.cutsceneTrigger = 1; gSaveContext.eventChkInf[5] |= 4; // Learned Serenade of Water Flag - Item_Give(globalCtx, ITEM_SONG_SERENADE); + Item_Give(play, ITEM_SONG_SERENADE); } else { - GivePlayerRandoRewardSheikSong(this, globalCtx, RC_SHEIK_IN_ICE_CAVERN, 4, RG_SERENADE_OF_WATER); + GivePlayerRandoRewardSheikSong(this, play, RC_SHEIK_IN_ICE_CAVERN, 4, RG_SERENADE_OF_WATER); return false; } osSyncPrintf("ブーツを取った!!!!!!!!!!!!!!!!!!\n"); @@ -407,10 +407,10 @@ s32 EnXc_SerenadeCS(EnXc* this, GlobalContext* globalCtx) { return true; } -void EnXc_DoNothing(EnXc* this, GlobalContext* globalCtx) { +void EnXc_DoNothing(EnXc* this, PlayState* play) { } -void EnXc_SetWalkingSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetWalkingSFX(EnXc* this, PlayState* play) { s32 pad[2]; u32 sfxId; s32 pad2; @@ -418,13 +418,13 @@ void EnXc_SetWalkingSFX(EnXc* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 11.0f) || Animation_OnFrame(&this->skelAnime, 23.0f)) { if (this->actor.bgCheckFlags & 1) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } } -void EnXc_SetNutThrowSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetNutThrowSFX(EnXc* this, PlayState* play) { s32 pad[2]; u32 sfxId; s32 pad2; @@ -432,7 +432,7 @@ void EnXc_SetNutThrowSFX(EnXc* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { if (this->actor.bgCheckFlags & 1) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } @@ -441,50 +441,50 @@ void EnXc_SetNutThrowSFX(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetLandingSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { u32 sfxId; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum != SCENE_SPOT11)) { if (Animation_OnFrame(&this->skelAnime, 11.0f)) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } } -void EnXc_SetColossusAppearSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { static Vec3f sXyzDist; s16 sceneNum; if (gSaveContext.sceneSetupIndex == 4) { - sceneNum = globalCtx->sceneNum; + sceneNum = play->sceneNum; if (sceneNum == SCENE_SPOT11) { - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; u16 frameCount = csCtx->frames; f32 wDest[2]; if (frameCount == 119) { Vec3f pos = { -611.0f, 728.0f, -2.0f }; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &sXyzDist, wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &sXyzDist, wDest); func_80078914(&sXyzDist, NA_SE_EV_JUMP_CONC); } else if (frameCount == 164) { Vec3f pos = { -1069.0f, 38.0f, 0.0f }; s32 pad; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &sXyzDist, wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &sXyzDist, wDest); func_80078914(&sXyzDist, NA_SE_PL_WALK_CONCRETE); } } } } -void func_80B3D118(GlobalContext* globalCtx) { +void func_80B3D118(PlayState* play) { s16 sceneNum; - if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum = globalCtx->sceneNum, sceneNum != SCENE_SPOT11)) { + if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum = play->sceneNum, sceneNum != SCENE_SPOT11)) { func_800788CC(NA_SE_PL_SKIP); } } @@ -492,21 +492,21 @@ void func_80B3D118(GlobalContext* globalCtx) { static Vec3f D_80B42DA0; s32 D_80B41D90 = 0; -void EnXc_SetColossusWindSFX(GlobalContext* globalCtx) { +void EnXc_SetColossusWindSFX(PlayState* play) { if (gSaveContext.sceneSetupIndex == 4) { static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; static f32 sMaxSpeed = 0.0f; static Vec3f D_80B42DB0; s32 pad; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; if (sceneNum == SCENE_SPOT11) { - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; u16 frameCount = csCtx->frames; if ((frameCount >= 120) && (frameCount < 164)) { s32 pad; - Vec3f* eye = &globalCtx->view.eye; + Vec3f* eye = &play->view.eye; if (D_80B41D90 != 0) { f32 speed = Math3D_Vec3f_DistXYZ(&D_80B42DB0, eye) / 7.058922f; @@ -529,22 +529,22 @@ void EnXc_SetColossusWindSFX(GlobalContext* globalCtx) { } s32 sEnXcFlameSpawned = false; -void EnXc_SpawnFlame(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SpawnFlame(EnXc* this, PlayState* play) { if (!sEnXcFlameSpawned) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); f32 xPos = npcAction->startPos.x; f32 yPos = npcAction->startPos.y; f32 zPos = npcAction->startPos.z; - this->flameActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5); + this->flameActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5); sEnXcFlameSpawned = true; } } -void EnXc_SetupFlamePos(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupFlamePos(EnXc* this, PlayState* play) { Vec3f* attachedPos; - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); if (this->flameActor != NULL) { attachedPos = &this->flameActor->world.pos; @@ -564,18 +564,18 @@ void EnXc_DestroyFlame(EnXc* this) { } s32 D_80B41DA8 = 1; -void EnXc_InitFlame(EnXc* this, GlobalContext* globalCtx) { +void EnXc_InitFlame(EnXc* this, PlayState* play) { s32 pad; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; if (sceneNum == SCENE_SPOT17) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { s32 action = npcAction->action; if (D_80B41DA8 != action) { if (action != 1) { - EnXc_SpawnFlame(this, globalCtx); + EnXc_SpawnFlame(this, play); } if (action == 1) { @@ -585,29 +585,29 @@ void EnXc_InitFlame(EnXc* this, GlobalContext* globalCtx) { D_80B41DA8 = action; } - EnXc_SetupFlamePos(this, globalCtx); + EnXc_SetupFlamePos(this, play); } } } -void func_80B3D48C(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3D48C(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* linkAction = csCtx->linkAction; s16 yaw; if (linkAction != NULL) { yaw = linkAction->urot.y + 0x8000; } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); yaw = player->actor.world.rot.y + 0x8000; } this->actor.shape.rot.y = this->actor.world.rot.y = yaw; } -AnimationHeader* EnXc_GetCurrentHarpAnim(GlobalContext* globalCtx, s32 index) { +AnimationHeader* EnXc_GetCurrentHarpAnim(PlayState* play, s32 index) { AnimationHeader* animation = &gSheikPlayingHarp5Anim; - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, index); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, index); if (npcAction != NULL) { u16 action = npcAction->action; @@ -670,15 +670,15 @@ void func_80B3D730(EnXc* this) { EnXc_CalcXZSpeed(this); } -void func_80B3D750(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_MinuetCS(this, globalCtx) && EnXc_BoleroCS(this, globalCtx)) { +void func_80B3D750(EnXc* this, PlayState* play) { + if (EnXc_MinuetCS(this, play) && EnXc_BoleroCS(this, play)) { this->action = SHEIK_ACTION_WAIT; } } -void EnXc_SetupFallFromSkyAction(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupFallFromSkyAction(EnXc* this, PlayState* play) { s32 pad; - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { CsCmdActorAction* npcAction = csCtx->npcActions[4]; @@ -696,15 +696,15 @@ void EnXc_SetupFallFromSkyAction(EnXc* this, GlobalContext* globalCtx) { pos->y = npcAction->startPos.y; pos->z = npcAction->startPos.z; - func_80B3D48C(this, globalCtx); - func_80B3C964(this, globalCtx); + func_80B3D48C(this, play); + func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikFallingFromSkyAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); - func_80B3D118(globalCtx); + func_80B3D118(play); } } } -void func_80B3D8A4(EnXc* this, GlobalContext* globalCtx, s32 animFinished) { +void func_80B3D8A4(EnXc* this, PlayState* play, s32 animFinished) { if (animFinished) { SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikWalkingAnim); @@ -718,7 +718,7 @@ void func_80B3D8A4(EnXc* this, GlobalContext* globalCtx, s32 animFinished) { this->actor.gravity = -((kREG(1) * 0.01f) + 13.0f); this->actor.minVelocityY = -((kREG(1) * 0.01f) + 13.0f); } else { - func_80B3C8CC(this, globalCtx); + func_80B3C8CC(this, play); } } @@ -755,8 +755,8 @@ void EnXc_SetupStoppedAction(EnXc* this) { } } -void func_80B3DAF0(EnXc* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 4); +void func_80B3DAF0(EnXc* this, PlayState* play) { + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 4); u16 action; if (npcAction && @@ -783,7 +783,7 @@ void EnXc_SetupInitialHarpAction(EnXc* this, s32 animFinished) { } } -void EnXc_SetupPlayingHarpAction(EnXc* this, GlobalContext* globalCtx, s32 animFinished) { +void EnXc_SetupPlayingHarpAction(EnXc* this, PlayState* play, s32 animFinished) { s32 pad; SkelAnime* skelAnime; AnimationHeader* animation; @@ -791,7 +791,7 @@ void EnXc_SetupPlayingHarpAction(EnXc* this, GlobalContext* globalCtx, s32 animF if (animFinished) { skelAnime = &this->skelAnime; - animation = EnXc_GetCurrentHarpAnim(globalCtx, 4); + animation = EnXc_GetCurrentHarpAnim(play, 4); frameCount = Animation_GetLastFrame(animation); Animation_Change(skelAnime, animation, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, -8.0f); this->action = SHEIK_PLAYING_HARP; @@ -799,11 +799,11 @@ void EnXc_SetupPlayingHarpAction(EnXc* this, GlobalContext* globalCtx, s32 animF } } -void func_80B3DCA8(EnXc* this, GlobalContext* globalCtx) { +void func_80B3DCA8(EnXc* this, PlayState* play) { f32 frameCount; - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; + if (play->csCtx.state != 0) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 8) { frameCount = Animation_GetLastFrame(&gSheikInitialHarpAnim); @@ -814,11 +814,11 @@ void func_80B3DCA8(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetupHarpPutawayAction(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupHarpPutawayAction(EnXc* this, PlayState* play) { f32 curFrame; f32 animFrameCount; - if (EnXc_CompareCsAction(this, globalCtx, 5, 4)) { + if (EnXc_CompareCsAction(this, play, 5, 4)) { curFrame = this->skelAnime.curFrame; animFrameCount = this->skelAnime.endFrame; if (curFrame >= animFrameCount) { @@ -826,8 +826,8 @@ void EnXc_SetupHarpPutawayAction(EnXc* this, GlobalContext* globalCtx) { Animation_GetLastFrame(&gSheikInitialHarpAnim), 0.0f, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_PUT_HARP_AWAY; } - } else if (EnXc_CsActionsAreNotEqual(this, globalCtx, 8, 4)) { - EnXc_SetupPlayingHarpAction(this, globalCtx, true); + } else if (EnXc_CsActionsAreNotEqual(this, play, 8, 4)) { + EnXc_SetupPlayingHarpAction(this, play, true); } } @@ -850,9 +850,9 @@ void func_80B3DE78(EnXc* this, s32 animFinished) { } } -void EnXc_SetupReverseAccel(EnXc* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; +void EnXc_SetupReverseAccel(EnXc* this, PlayState* play) { + if (play->csCtx.state != 0) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 4) { Animation_Change(&this->skelAnime, &gSheikWalkingAnim, -1.0f, Animation_GetLastFrame(&gSheikWalkingAnim), @@ -894,20 +894,20 @@ void EnXc_SetupNutThrow(EnXc* this) { } } -void func_80B3E164(EnXc* this, GlobalContext* globalCtx) { +void func_80B3E164(EnXc* this, PlayState* play) { this->timer++; if (this->timer >= 30.0f) { this->action = SHEIK_ACTION_DELETE; - EnXc_SpawnNut(this, globalCtx); + EnXc_SpawnNut(this, play); } } -void EnXc_SetupDisappear(EnXc* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; +void EnXc_SetupDisappear(EnXc* this, PlayState* play) { + if (play->csCtx.state != 0) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 9) { - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; // Sheik fades away if end of Bolero CS, kill actor otherwise if (sceneNum == SCENE_SPOT17) { @@ -921,166 +921,166 @@ void EnXc_SetupDisappear(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_ActionFunc0(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetColossusAppearSFX(this, globalCtx); - EnXc_SetColossusWindSFX(globalCtx); - func_80B3D750(this, globalCtx); +void EnXc_ActionFunc0(EnXc* this, PlayState* play) { + EnXc_SetColossusAppearSFX(this, play); + EnXc_SetColossusWindSFX(play); + func_80B3D750(this, play); } -void EnXc_ActionFunc1(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetColossusAppearSFX(this, globalCtx); - EnXc_SetColossusWindSFX(globalCtx); - EnXc_SetupFallFromSkyAction(this, globalCtx); +void EnXc_ActionFunc1(EnXc* this, PlayState* play) { + EnXc_SetColossusAppearSFX(this, play); + EnXc_SetColossusWindSFX(play); + EnXc_SetupFallFromSkyAction(this, play); } -void EnXc_GracefulFall(EnXc* this, GlobalContext* globalCtx) { +void EnXc_GracefulFall(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetLandingSFX(this, globalCtx); - EnXc_SetColossusAppearSFX(this, globalCtx); - EnXc_SetColossusWindSFX(globalCtx); - func_80B3D8A4(this, globalCtx, animFinished); + EnXc_SetLandingSFX(this, play); + EnXc_SetColossusAppearSFX(this, play); + EnXc_SetColossusWindSFX(play); + func_80B3D8A4(this, play, animFinished); } -void EnXc_Accelerate(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Accelerate(EnXc* this, PlayState* play) { EnXc_CalcXZAccel(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); EnXc_SetupWalkAction(this); } -void EnXc_Walk(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Walk(EnXc* this, PlayState* play) { func_80B3D644(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); EnXc_SetupHaltAction(this); } -void EnXc_Stopped(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Stopped(EnXc* this, PlayState* play) { EnXc_CalcXZSpeed(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); EnXc_SetupStoppedAction(this); } -void EnXc_ActionFunc6(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc6(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - func_80B3DAF0(this, globalCtx); + func_80B3DAF0(this, play); } -void EnXc_ActionFunc7(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc7(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupInitialHarpAction(this, animFinished); } -void EnXc_ActionFunc8(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc8(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupPlayingHarpAction(this, globalCtx, animFinished); + EnXc_SetupPlayingHarpAction(this, play, animFinished); } -void EnXc_ActionFunc9(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc9(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - func_80B3DCA8(this, globalCtx); + func_80B3DCA8(this, play); } -void EnXc_ActionFunc10(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc10(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupHarpPutawayAction(this, globalCtx); + EnXc_SetupHarpPutawayAction(this, play); } -void EnXc_ActionFunc11(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc11(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); func_80B3DE00(this, animFinished); } -void EnXc_ActionFunc12(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc12(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); func_80B3DE78(this, animFinished); } -void EnXc_ActionFunc13(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc13(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_InitFlame(this, globalCtx); - EnXc_SetupReverseAccel(this, globalCtx); + EnXc_InitFlame(this, play); + EnXc_SetupReverseAccel(this, play); } -void EnXc_ReverseAccelerate(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ReverseAccelerate(EnXc* this, PlayState* play) { func_80B3D6F0(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_InitFlame(this, play); EnXc_SetupReverseWalkAction(this); } -void EnXc_ActionFunc15(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc15(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_InitFlame(this, play); EnXc_SetupReverseHaltAction(this); } -void EnXc_HaltAndWaitToThrowNut(EnXc* this, GlobalContext* globalCtx) { +void EnXc_HaltAndWaitToThrowNut(EnXc* this, PlayState* play) { func_80B3D730(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_InitFlame(this, play); EnXc_SetupNutThrow(this); } -void EnXc_ThrowNut(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ThrowNut(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetNutThrowSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); - func_80B3E164(this, globalCtx); + EnXc_SetNutThrowSFX(this, play); + EnXc_InitFlame(this, play); + func_80B3E164(this, play); } -void EnXc_Delete(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Delete(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_InitFlame(this, globalCtx); - EnXc_SetupDisappear(this, globalCtx); + EnXc_InitFlame(this, play); + EnXc_SetupDisappear(this, play); } -void EnXc_Fade(EnXc* this, GlobalContext* globalCtx) { - EnXc_InitFlame(this, globalCtx); +void EnXc_Fade(EnXc* this, PlayState* play) { + EnXc_InitFlame(this, play); } void func_80B3E87C(Gfx** dList, EnXc* this) { @@ -1091,7 +1091,7 @@ void func_80B3E87C(Gfx** dList, EnXc* this) { } } -s32 EnXc_PullingOutHarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnXc_PullingOutHarpOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnXc* this = (EnXc*)thisx; @@ -1102,7 +1102,7 @@ s32 EnXc_PullingOutHarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, return 0; } -s32 EnXc_HarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnXc_HarpOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnXc* this = (EnXc*)thisx; @@ -1113,13 +1113,13 @@ s32 EnXc_HarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return 0; } -void EnXc_DrawPullingOutHarp(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawPullingOutHarp(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 pad; s16 eyePattern = this->eyeIdx; void* eyeTexture = sEyeTextures[eyePattern]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad2; OPEN_DISPS(gfxCtx); @@ -1129,19 +1129,19 @@ void EnXc_DrawPullingOutHarp(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 60, 0, 0, 0); func_80093D18(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_PullingOutHarpOverrideLimbDraw, NULL, this); CLOSE_DISPS(gfxCtx); } -void EnXc_DrawHarp(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawHarp(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 pad; s16 eyePattern = this->eyeIdx; void* eyeTexture = sEyeTextures[eyePattern]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad2; OPEN_DISPS(gfxCtx); @@ -1152,13 +1152,13 @@ void EnXc_DrawHarp(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 60, 0, 0, 0); func_80093D18(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_HarpOverrideLimbDraw, NULL, this); CLOSE_DISPS(gfxCtx); } -void func_80B3EBF0(EnXc* this, GlobalContext* globalCtx) { +void func_80B3EBF0(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_20; } @@ -1166,8 +1166,8 @@ void func_80B3EC00(EnXc* this) { this->action = SHEIK_ACTION_21; } -void func_80B3EC0C(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3EC0C(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { CsCmdActorAction* npcAction = csCtx->npcActions[4]; @@ -1189,8 +1189,8 @@ void func_80B3EC0C(EnXc* this, GlobalContext* globalCtx) { } } -void func_80B3EC90(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3EC90(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { CsCmdActorAction* npcAction = csCtx->npcActions[4]; @@ -1209,51 +1209,51 @@ void func_80B3ECD8(EnXc* this) { } } -void EnXc_ActionFunc20(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc20(EnXc* this, PlayState* play) { func_80B3EC00(this); } -void EnXc_ActionFunc21(EnXc* this, GlobalContext* globalCtx) { - func_80B3EC0C(this, globalCtx); +void EnXc_ActionFunc21(EnXc* this, PlayState* play) { + func_80B3EC0C(this, play); } -void EnXc_ActionFunc22(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc22(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - func_80B3EC90(this, globalCtx); + func_80B3EC90(this, play); } -void EnXc_ActionFunc23(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc23(EnXc* this, PlayState* play) { func_80B3D6F0(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); func_80B3ECD8(this); } -void EnXc_ActionFunc24(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc24(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc25(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc25(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc26(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc26(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc27(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc27(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc28(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc28(EnXc* this, PlayState* play) { } -void func_80B3EE64(EnXc* this, GlobalContext* globalCtx) { +void func_80B3EE64(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_SERENADE; } -void func_80B3EE74(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_SerenadeCS(this, globalCtx)) { +void func_80B3EE74(EnXc* this, PlayState* play) { + if (EnXc_SerenadeCS(this, play)) { this->action = SHEIK_ACTION_30; } } @@ -1321,89 +1321,89 @@ void func_80B3F100(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_43, SHEIK_ACTION_44); } -void EnXc_Serenade(EnXc* this, GlobalContext* globalCtx) { - func_80B3EE74(this, globalCtx); +void EnXc_Serenade(EnXc* this, PlayState* play) { + func_80B3EE74(this, play); } -void EnXc_ActionFunc30(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc21(this, globalCtx); +void EnXc_ActionFunc30(EnXc* this, PlayState* play) { + EnXc_ActionFunc21(this, play); func_80B3EEA4(this); } -void EnXc_ActionFunc31(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc6(this, globalCtx); - func_80B3C588(this, globalCtx, 4); +void EnXc_ActionFunc31(EnXc* this, PlayState* play) { + EnXc_ActionFunc6(this, play); + func_80B3C588(this, play, 4); func_80B3EEC8(this); } -void EnXc_ActionFunc32(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc7(this, globalCtx); +void EnXc_ActionFunc32(EnXc* this, PlayState* play) { + EnXc_ActionFunc7(this, play); func_80B3EEEC(this); } -void EnXc_ActionFunc33(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc8(this, globalCtx); +void EnXc_ActionFunc33(EnXc* this, PlayState* play) { + EnXc_ActionFunc8(this, play); func_80B3EF10(this); } -void EnXc_ActionFunc34(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc9(this, globalCtx); +void EnXc_ActionFunc34(EnXc* this, PlayState* play) { + EnXc_ActionFunc9(this, play); func_80B3EF34(this); } -void EnXc_ActionFunc35(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc10(this, globalCtx); +void EnXc_ActionFunc35(EnXc* this, PlayState* play) { + EnXc_ActionFunc10(this, play); func_80B3EF58(this); } -void EnXc_ActionFunc36(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc11(this, globalCtx); +void EnXc_ActionFunc36(EnXc* this, PlayState* play) { + EnXc_ActionFunc11(this, play); func_80B3EF80(this); } -void EnXc_ActionFunc37(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc12(this, globalCtx); +void EnXc_ActionFunc37(EnXc* this, PlayState* play) { + EnXc_ActionFunc12(this, play); func_80B3EFA4(this); } -void EnXc_ActionFunc38(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc13(this, globalCtx); +void EnXc_ActionFunc38(EnXc* this, PlayState* play) { + EnXc_ActionFunc13(this, play); func_80B3EFC8(this); } -void EnXc_ActionFunc39(EnXc* this, GlobalContext* globalCtx) { - EnXc_ReverseAccelerate(this, globalCtx); +void EnXc_ActionFunc39(EnXc* this, PlayState* play) { + EnXc_ReverseAccelerate(this, play); func_80B3EFEC(this); } -void EnXc_ActionFunc40(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc40(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); func_80B3F010(this); } -void EnXc_ActionFunc41(EnXc* this, GlobalContext* globalCtx) { - EnXc_HaltAndWaitToThrowNut(this, globalCtx); +void EnXc_ActionFunc41(EnXc* this, PlayState* play) { + EnXc_HaltAndWaitToThrowNut(this, play); func_80B3F0B8(this); } -void EnXc_ActionFunc42(EnXc* this, GlobalContext* globalCtx) { - EnXc_ThrowNut(this, globalCtx); +void EnXc_ActionFunc42(EnXc* this, PlayState* play) { + EnXc_ThrowNut(this, play); func_80B3F0DC(this); } -void EnXc_ActionFunc43(EnXc* this, GlobalContext* globalCtx) { - EnXc_Delete(this, globalCtx); +void EnXc_ActionFunc43(EnXc* this, PlayState* play) { + EnXc_Delete(this, play); func_80B3F100(this); } -void EnXc_ActionFunc44(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc44(EnXc* this, PlayState* play) { } -void func_80B3F3C8(EnXc* this, GlobalContext* globalCtx) { +void func_80B3F3C8(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_45; } @@ -1411,15 +1411,15 @@ void func_80B3F3D8() { func_800788CC(NA_SE_PL_SKIP); } -void EnXc_PlayDiveSFX(Vec3f* src, GlobalContext* globalCtx) { +void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) { f32 wDest[2]; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, src, &D_80B42DA0, wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, src, &D_80B42DA0, wDest); func_80078914(&D_80B42DA0, NA_SE_EV_DIVE_INTO_WATER); } -void EnXc_LakeHyliaDive(GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = npcAction = EnXc_GetCsCmd(globalCtx, 0); +void EnXc_LakeHyliaDive(PlayState* play) { + CsCmdActorAction* npcAction = npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { Vec3f startPos; @@ -1428,27 +1428,27 @@ void EnXc_LakeHyliaDive(GlobalContext* globalCtx) { startPos.y = npcAction->startPos.y; startPos.z = npcAction->startPos.z; - EffectSsGRipple_Spawn(globalCtx, &startPos, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &startPos, 100, 500, 10); - EffectSsGRipple_Spawn(globalCtx, &startPos, 100, 500, 20); - EffectSsGSplash_Spawn(globalCtx, &startPos, NULL, NULL, 1, 0); - EnXc_PlayDiveSFX(&startPos, globalCtx); + EffectSsGRipple_Spawn(play, &startPos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &startPos, 100, 500, 10); + EffectSsGRipple_Spawn(play, &startPos, 100, 500, 20); + EffectSsGSplash_Spawn(play, &startPos, NULL, NULL, 1, 0); + EnXc_PlayDiveSFX(&startPos, play); } } -void func_80B3F534(GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3F534(PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; u16 frameCount = csCtx->frames; if (frameCount == 310) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, -1044.0f, -1243.0f, 7458.0f, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, -1044.0f, -1243.0f, 7458.0f, 0, 0, 0, WARP_DESTINATION); } } s32 D_80B41DAC = 1; -void func_80B3F59C(EnXc* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); +void func_80B3F59C(EnXc* this, PlayState* play) { + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { s32 action = npcAction->action; @@ -1459,7 +1459,7 @@ void func_80B3F59C(EnXc* this, GlobalContext* globalCtx) { func_80B3F3D8(); break; case 3: - EnXc_LakeHyliaDive(globalCtx); + EnXc_LakeHyliaDive(play); break; default: break; @@ -1477,8 +1477,8 @@ void func_80B3F644(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_46, SHEIK_ACTION_47); } -void func_80B3F668(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 4, 4)) { +void func_80B3F668(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 4, 4)) { EnXc_ChangeAnimation(this, &gSheikWalkingAnim, ANIMMODE_LOOP, -12.0f, true); this->action = SHEIK_ACTION_48; this->actor.world.rot.y += 0x8000; @@ -1490,81 +1490,81 @@ void func_80B3F6DC(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_48, SHEIK_ACTION_49); } -void EnXc_SetupKneelAction(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 16, 4)) { +void EnXc_SetupKneelAction(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 16, 4)) { EnXc_ChangeAnimation(this, &gSheikKneelingAnim, ANIMMODE_LOOP, 0.0f, false); this->action = SHEIK_ACTION_KNEEL; } } -void func_80B3F754(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 22, 4)) { +void func_80B3F754(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 22, 4)) { EnXc_ChangeAnimation(this, &gSheikAnim_01A048, ANIMMODE_LOOP, 0.0f, false); this->action = SHEIK_ACTION_51; - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); } } -void func_80B3F7BC(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 9, 4)) { +void func_80B3F7BC(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 9, 4)) { this->action = SHEIK_ACTION_52; this->drawMode = SHEIK_DRAW_NOTHING; } } -void EnXc_ActionFunc45(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc20(this, globalCtx); +void EnXc_ActionFunc45(EnXc* this, PlayState* play) { + EnXc_ActionFunc20(this, play); func_80B3F620(this); } -void EnXc_ActionFunc46(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc21(this, globalCtx); +void EnXc_ActionFunc46(EnXc* this, PlayState* play) { + EnXc_ActionFunc21(this, play); func_80B3F644(this); } -void EnXc_ActionFunc47(EnXc* this, GlobalContext* globalCtx) { - func_80B3F534(globalCtx); +void EnXc_ActionFunc47(EnXc* this, PlayState* play) { + func_80B3F534(play); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - func_80B3C588(this, globalCtx, 4); - func_80B3F668(this, globalCtx); + EnXc_BgCheck(this, play); + func_80B3C588(this, play, 4); + func_80B3F668(this, play); } -void EnXc_ActionFunc48(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc23(this, globalCtx); +void EnXc_ActionFunc48(EnXc* this, PlayState* play) { + EnXc_ActionFunc23(this, play); func_80B3F6DC(this); } -void EnXc_ActionFunc49(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc49(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_SetupKneelAction(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_SetupKneelAction(this, play); } -void EnXc_Kneel(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Kneel(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - func_80B3F59C(this, globalCtx); - func_80B3C588(this, globalCtx, 4); - func_80B3F754(this, globalCtx); + EnXc_BgCheck(this, play); + func_80B3F59C(this, play); + func_80B3C588(this, play, 4); + func_80B3F754(this, play); } -void EnXc_ActionFunc51(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc51(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - func_80B3F59C(this, globalCtx); - func_80B3C620(this, globalCtx, 4); - func_80B3F7BC(this, globalCtx); + EnXc_BgCheck(this, play); + func_80B3F59C(this, play); + func_80B3C620(this, play, 4); + func_80B3F7BC(this, play); } -void EnXc_ActionFunc52(EnXc* this, GlobalContext* globalCtx) { - func_80B3F59C(this, globalCtx); +void EnXc_ActionFunc52(EnXc* this, PlayState* play) { + func_80B3F59C(this, play); } -void func_80B3FA08(EnXc* this, GlobalContext* globalCtx) { +void func_80B3FA08(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_53; this->triforceAngle = kREG(24) + 0x53FC; } @@ -1573,7 +1573,7 @@ void func_80B3FA2C(void) { func_800F3F3C(1); } -void EnXc_PlayTriforceSFX(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_PlayTriforceSFX(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; if (this->unk_2A8) { @@ -1584,8 +1584,8 @@ void EnXc_PlayTriforceSFX(Actor* thisx, GlobalContext* globalCtx) { f32 wDest; Matrix_MultVec3f(&sp1C, &src); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &src, &pos, &wDest); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &pos, 80, NA_SE_EV_TRIFORCE_MARK); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &src, &pos, &wDest); + SoundSource_PlaySfxAtFixedWorldPos(play, &pos, 80, NA_SE_EV_TRIFORCE_MARK); this->unk_2A8 = 0; } } @@ -1597,16 +1597,16 @@ void func_80B3FAE0(EnXc* this) { } } -void EnXc_CalcTriforce(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_CalcTriforce(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; - if (EnXc_CompareCsAction(this, globalCtx, 21, 4)) { + if (EnXc_CompareCsAction(this, play, 21, 4)) { this->unk_274 = 1; if (this->unk_2AC == 0) { this->unk_2AC = 1; this->unk_2A8 = 1; } - } else if (EnXc_CompareCsAction(this, globalCtx, 19, 4)) { + } else if (EnXc_CompareCsAction(this, play, 19, 4)) { this->unk_274 = 2; } if (this->unk_274 != 0) { @@ -1650,12 +1650,12 @@ void EnXc_CalcTriforce(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B3FF0C(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CsActionsAreNotEqual(this, globalCtx, 1, 4)) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3FF0C(EnXc* this, PlayState* play) { + if (EnXc_CsActionsAreNotEqual(this, play, 1, 4)) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL) { PosRot* posRot = &this->actor.world; @@ -1675,8 +1675,8 @@ void func_80B3FF0C(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetupShowTriforceAction(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 10, 4)) { +void EnXc_SetupShowTriforceAction(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 10, 4)) { Animation_Change(&this->skelAnime, &gSheikShowingTriforceOnHandAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikShowingTriforceOnHandAnim), ANIMMODE_ONCE, -8.0f); this->action = SHEIK_ACTION_SHOW_TRIFORCE; @@ -1691,44 +1691,44 @@ void EnXc_SetupShowTriforceIdleAction(EnXc* this, s32 animFinished) { this->action = SHEIK_ACTION_SHOW_TRIFORCE_IDLE; } } -void func_80B400AC(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 9, 4)) { +void func_80B400AC(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 9, 4)) { Actor_Kill(&this->actor); } } -void EnXc_ActionFunc53(EnXc* this, GlobalContext* globalCtx) { - func_80B3FF0C(this, globalCtx); +void EnXc_ActionFunc53(EnXc* this, PlayState* play) { + func_80B3FF0C(this, play); } -void EnXc_ActionFunc54(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc54(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupShowTriforceAction(this, globalCtx); - func_80B3C888(this, globalCtx); + EnXc_SetupShowTriforceAction(this, play); + func_80B3C888(this, play); } -void EnXc_ShowTriforce(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ShowTriforce(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_CalcTriforce(&this->actor, globalCtx); + EnXc_CalcTriforce(&this->actor, play); func_80B3FAE0(this); EnXc_SetupShowTriforceIdleAction(this, animFinished); - func_80B3C888(this, globalCtx); + func_80B3C888(this, play); } -void EnXc_ShowTriforceIdle(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ShowTriforceIdle(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_CalcTriforce(&this->actor, globalCtx); - func_80B400AC(this, globalCtx); + EnXc_CalcTriforce(&this->actor, play); + func_80B400AC(this, play); } -s32 EnXc_TriforceOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnXc_TriforceOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if (limbIndex == 15) { *dList = gSheikDL_011620; @@ -1736,25 +1736,25 @@ s32 EnXc_TriforceOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void EnXc_TriforcePostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnXc_TriforcePostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s32 pad[2]; EnXc* this = (EnXc*)thisx; if (limbIndex == 15) { Vec3f vec = { 0.0f, 0.0f, 0.0f }; - EnXc_PlayTriforceSFX(&this->actor, globalCtx); + EnXc_PlayTriforceSFX(&this->actor, play); Matrix_MultVec3f(&vec, &this->handPos); this->unk_2BC = 1; } } -void EnXc_DrawTriforce(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawTriforce(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 pad; s16 eyeIdx = this->eyeIdx; void* eyeTexture = sEyeTextures[eyeIdx]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad2; OPEN_DISPS(gfxCtx); @@ -1777,16 +1777,16 @@ void EnXc_DrawTriforce(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gSheikDL_012970); } - func_8002EBCC(thisx, globalCtx, 0); - func_80093D18(globalCtx->state.gfxCtx); + func_8002EBCC(thisx, play, 0); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_TriforceOverrideLimbDraw, EnXc_TriforcePostLimbDraw, this); CLOSE_DISPS(gfxCtx); } -void func_80B40590(EnXc* this, GlobalContext* globalCtx) { +void func_80B40590(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_NOCTURNE_INIT; this->drawMode = SHEIK_DRAW_SQUINT; } @@ -1806,14 +1806,14 @@ void EnXc_SetThrownAroundSFX(EnXc* this) { } } -void EnXc_PlayLinkScreamSFX(EnXc* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 1455) { +void EnXc_PlayLinkScreamSFX(EnXc* this, PlayState* play) { + if (play->csCtx.frames == 1455) { func_800F3F3C(7); } } -void EnXc_SetCrySFX(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void EnXc_SetCrySFX(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->frames == 869) { func_80078914(&this->actor.projectedPos, NA_SE_VO_SK_CRY_0); @@ -1830,14 +1830,14 @@ void func_80B406F8(Actor* thisx) { this->actor.shape.shadowAlpha = 0; } -void EnXc_SetupIdleInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupIdleInNocturne(EnXc* this, PlayState* play) { s32 pad; ActorShape* actorShape = &this->actor.shape; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_IDLE; this->drawMode = SHEIK_DRAW_SQUINT; @@ -1854,14 +1854,14 @@ void EnXc_SetupDefenseStance(Actor* thisx) { this->drawMode = SHEIK_DRAW_DEFAULT; } -void EnXc_SetupContortions(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupContortions(EnXc* this, PlayState* play) { s32 pad; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - func_80B3C588(this, globalCtx, 4); - func_80B3C964(this, globalCtx); + func_80B3C588(this, play, 4); + func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikContortionsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikContortionsAnim), ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_CONTORT; @@ -1869,14 +1869,14 @@ void EnXc_SetupContortions(EnXc* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 255; } -void EnXc_SetupFallInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupFallInNocturne(EnXc* this, PlayState* play) { s32 pad; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - func_80B3C588(this, globalCtx, 4); - func_80B3C964(this, globalCtx); + func_80B3C588(this, play, 4); + func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikFallingFromContortionsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikFallingFromContortionsAnim), ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_FALL; @@ -1884,47 +1884,47 @@ void EnXc_SetupFallInNocturne(EnXc* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 255; } -void EnXc_SetupHittingGroundInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupHittingGroundInNocturne(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikHittingGroundAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikHittingGroundAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_HIT_GROUND; this->drawMode = SHEIK_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 255; } -void func_80B40A78(EnXc* this, GlobalContext* globalCtx) { +void func_80B40A78(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikHittingGroundAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikHittingGroundAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_63; this->drawMode = SHEIK_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 255; } -void EnXc_SetupKneelInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupKneelInNocturne(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikKneelingAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikKneelingAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_KNEEL; this->drawMode = SHEIK_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 255; } -void func_80B40BB4(EnXc* this, GlobalContext* globalCtx) { +void func_80B40BB4(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->action = SHEIK_ACTION_65; this->drawMode = SHEIK_DRAW_DEFAULT; @@ -1990,8 +1990,8 @@ void func_80B40E88(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_77, SHEIK_ACTION_78); } -s32 EnXc_SetupNocturneState(Actor* thisx, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 4); +s32 EnXc_SetupNocturneState(Actor* thisx, PlayState* play) { + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 4); if (npcAction != NULL) { s32 action = npcAction->action; @@ -2004,28 +2004,28 @@ s32 EnXc_SetupNocturneState(Actor* thisx, GlobalContext* globalCtx) { func_80B406F8(thisx); break; case 6: - EnXc_SetupIdleInNocturne(this, globalCtx); + EnXc_SetupIdleInNocturne(this, play); break; case 20: EnXc_SetupDefenseStance(thisx); break; case 18: - EnXc_SetupContortions(this, globalCtx); + EnXc_SetupContortions(this, play); break; case 14: - EnXc_SetupFallInNocturne(this, globalCtx); + EnXc_SetupFallInNocturne(this, play); break; case 19: - EnXc_SetupHittingGroundInNocturne(this, globalCtx); + EnXc_SetupHittingGroundInNocturne(this, play); break; case 15: - func_80B40A78(this, globalCtx); + func_80B40A78(this, play); break; case 16: - EnXc_SetupKneelInNocturne(this, globalCtx); + EnXc_SetupKneelInNocturne(this, play); break; case 17: - func_80B40BB4(this, globalCtx); + func_80B40BB4(this, play); break; case 9: Actor_Kill(thisx); @@ -2042,171 +2042,171 @@ s32 EnXc_SetupNocturneState(Actor* thisx, GlobalContext* globalCtx) { return 0; } -void EnXc_InitialNocturneAction(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetupNocturneState(&this->actor, globalCtx); +void EnXc_InitialNocturneAction(EnXc* this, PlayState* play) { + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_IdleInNocturne(EnXc* this, GlobalContext* globalCtx) { - func_80B3C588(this, globalCtx, 4); +void EnXc_IdleInNocturne(EnXc* this, PlayState* play) { + func_80B3C588(this, play, 4); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_BgCheck(this, play); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_DefenseStance(EnXc* this, GlobalContext* globalCtx) { +void EnXc_DefenseStance(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_Contort(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetCrySFX(this, globalCtx); +void EnXc_Contort(EnXc* this, PlayState* play) { + EnXc_SetCrySFX(this, play); EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); - if (!EnXc_SetupNocturneState(&this->actor, globalCtx)) { - func_80B3C924(this, globalCtx); - EnXc_BgCheck(this, globalCtx); + if (!EnXc_SetupNocturneState(&this->actor, play)) { + func_80B3C924(this, play); + EnXc_BgCheck(this, play); } } -void EnXc_FallInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_FallInNocturne(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); EnXc_SetThrownAroundSFX(this); - if (!EnXc_SetupNocturneState(&this->actor, globalCtx)) { - func_80B3C8CC(this, globalCtx); - EnXc_BgCheck(this, globalCtx); + if (!EnXc_SetupNocturneState(&this->actor, play)) { + func_80B3C8CC(this, play); + EnXc_BgCheck(this, play); } } -void EnXc_HitGroundInNocturne(EnXc* this, GlobalContext* globalCtx) { - EnXc_BgCheck(this, globalCtx); +void EnXc_HitGroundInNocturne(EnXc* this, PlayState* play) { + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_ActionFunc63(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc63(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_PlayLinkScreamSFX(this, globalCtx); - EnXc_BgCheck(this, globalCtx); + EnXc_PlayLinkScreamSFX(this, play); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_KneelInNocturneCS(EnXc* this, GlobalContext* globalCtx) { +void EnXc_KneelInNocturneCS(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_ActionFunc65(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc6(this, globalCtx); - func_80B3C588(this, globalCtx, 4); +void EnXc_ActionFunc65(EnXc* this, PlayState* play) { + EnXc_ActionFunc6(this, play); + func_80B3C588(this, play, 4); func_80B40C50(this); } -void EnXc_ActionFunc66(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc7(this, globalCtx); +void EnXc_ActionFunc66(EnXc* this, PlayState* play) { + EnXc_ActionFunc7(this, play); func_80B40C74(this); } -void EnXc_ActionFunc67(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc8(this, globalCtx); +void EnXc_ActionFunc67(EnXc* this, PlayState* play) { + EnXc_ActionFunc8(this, play); func_80B40C98(this); } -void EnXc_ActionFunc68(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc9(this, globalCtx); +void EnXc_ActionFunc68(EnXc* this, PlayState* play) { + EnXc_ActionFunc9(this, play); func_80B40CBC(this); } -void EnXc_ActionFunc69(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc10(this, globalCtx); +void EnXc_ActionFunc69(EnXc* this, PlayState* play) { + EnXc_ActionFunc10(this, play); func_80B40CE0(this); } -void EnXc_ActionFunc70(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc11(this, globalCtx); +void EnXc_ActionFunc70(EnXc* this, PlayState* play) { + EnXc_ActionFunc11(this, play); func_80B40D08(this); } -void EnXc_ActionFunc71(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc12(this, globalCtx); +void EnXc_ActionFunc71(EnXc* this, PlayState* play) { + EnXc_ActionFunc12(this, play); func_80B40D2C(this); } -void EnXc_ActionFunc72(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc13(this, globalCtx); +void EnXc_ActionFunc72(EnXc* this, PlayState* play) { + EnXc_ActionFunc13(this, play); func_80B40D50(this); } -void EnXc_ReverseAccelInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_ReverseAccelerate(this, globalCtx); +void EnXc_ReverseAccelInNocturneCS(EnXc* this, PlayState* play) { + EnXc_ReverseAccelerate(this, play); func_80B40D74(this); } -void EnXc_ReverseWalkInNocturneCS(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ReverseWalkInNocturneCS(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupReverseHaltInNocturneCS(this); } -void EnXc_ReverseHaltInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_HaltAndWaitToThrowNut(this, globalCtx); +void EnXc_ReverseHaltInNocturneCS(EnXc* this, PlayState* play) { + EnXc_HaltAndWaitToThrowNut(this, play); func_80B40E40(this); } -void EnXc_ThrowNutInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_ThrowNut(this, globalCtx); +void EnXc_ThrowNutInNocturneCS(EnXc* this, PlayState* play) { + EnXc_ThrowNut(this, play); func_80B40E64(this); } -void EnXc_DeleteInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_Delete(this, globalCtx); +void EnXc_DeleteInNocturneCS(EnXc* this, PlayState* play) { + EnXc_Delete(this, play); func_80B40E88(this); } -void EnXc_KillInNocturneCS(EnXc* this, GlobalContext* globalCtx) { +void EnXc_KillInNocturneCS(EnXc* this, PlayState* play) { Actor_Kill(&this->actor); } -void EnXc_DrawSquintingEyes(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawSquintingEyes(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); func_80093D18(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gSheikEyeSquintingTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gSheikEyeSquintingTex)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, NULL); CLOSE_DISPS(gfxCtx); } -void EnXc_InitTempleOfTime(EnXc* this, GlobalContext* globalCtx) { +void EnXc_InitTempleOfTime(EnXc* this, PlayState* play) { if (LINK_IS_ADULT) { if (!(gSaveContext.eventChkInf[12] & 0x20)) { gSaveContext.eventChkInf[12] |= 0x20; - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimeFirstAdultCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimeFirstAdultCs); gSaveContext.cutsceneTrigger = 1; - func_80B3EBF0(this, globalCtx); + func_80B3EBF0(this, play); } else if ((!(gSaveContext.eventChkInf[5] & 0x20) && (gSaveContext.eventChkInf[4] & 0x100) && !gSaveContext.n64ddFlag) || (!(gSaveContext.eventChkInf[5] & 0x20) && CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST) && gSaveContext.n64ddFlag)) { if (!gSaveContext.n64ddFlag) { gSaveContext.eventChkInf[5] |= 0x20; - Item_Give(globalCtx, ITEM_SONG_PRELUDE); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimePreludeCs); + Item_Give(play, ITEM_SONG_PRELUDE); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimePreludeCs); gSaveContext.cutsceneTrigger = 1; this->action = SHEIK_ACTION_30; } else { - GivePlayerRandoRewardSheikSong(this, globalCtx, RC_SHEIK_AT_TEMPLE, 0x20, RG_PRELUDE_OF_LIGHT); + GivePlayerRandoRewardSheikSong(this, play, RC_SHEIK_AT_TEMPLE, 0x20, RG_PRELUDE_OF_LIGHT); } } else if (!(gSaveContext.eventChkInf[5] & 0x20)) { func_80B3C9EC(this); @@ -2218,8 +2218,8 @@ void EnXc_InitTempleOfTime(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetupDialogueAction(EnXc* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnXc_SetupDialogueAction(EnXc* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = SHEIK_ACTION_IN_DIALOGUE; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -2228,33 +2228,33 @@ void EnXc_SetupDialogueAction(EnXc* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x700F; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void func_80B41798(EnXc* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B41798(EnXc* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->action = SHEIK_ACTION_BLOCK_PEDESTAL; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } } -void EnXc_BlockingPedestalAction(EnXc* this, GlobalContext* globalCtx) { - EnXc_BgCheck(this, globalCtx); - EnXc_UpdateCollider(&this->actor, globalCtx); - EnXc_CalculateHeadTurn(this, globalCtx); +void EnXc_BlockingPedestalAction(EnXc* this, PlayState* play) { + EnXc_BgCheck(this, play); + EnXc_UpdateCollider(&this->actor, play); + EnXc_CalculateHeadTurn(this, play); EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); - EnXc_SetupDialogueAction(this, globalCtx); + EnXc_SetupDialogueAction(this, play); } -void EnXc_ActionFunc80(EnXc* this, GlobalContext* globalCtx) { - EnXc_BgCheck(this, globalCtx); - EnXc_UpdateCollider(&this->actor, globalCtx); - EnXc_CalculateHeadTurn(this, globalCtx); +void EnXc_ActionFunc80(EnXc* this, PlayState* play) { + EnXc_BgCheck(this, play); + EnXc_UpdateCollider(&this->actor, play); + EnXc_CalculateHeadTurn(this, play); EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); - func_80B41798(this, globalCtx); + func_80B41798(this, play); } static EnXcActionFunc sActionFuncs[] = { @@ -2341,14 +2341,14 @@ static EnXcActionFunc sActionFuncs[] = { EnXc_ActionFunc80, }; -void EnXc_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Update(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 action = this->action; if (this->actor.params == SHEIK_TYPE_9) { if (gSaveContext.n64ddFlag && LINK_IS_ADULT) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST) && !(gSaveContext.eventChkInf[5] & 0x20)) { - GivePlayerRandoRewardSheikSong(this, globalCtx, RC_SHEIK_AT_TEMPLE, 0x20, RG_PRELUDE_OF_LIGHT); + GivePlayerRandoRewardSheikSong(this, play, RC_SHEIK_AT_TEMPLE, 0x20, RG_PRELUDE_OF_LIGHT); } } } @@ -2356,56 +2356,56 @@ void EnXc_Update(Actor* thisx, GlobalContext* globalCtx) { if ((action < 0) || (action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[action] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[action](this, globalCtx); + sActionFuncs[action](this, play); } } -void EnXc_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Init(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSheikSkel, &gSheikIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSheikSkel, &gSheikIdleAnim, this->jointTable, this->morphTable, ARRAY_COUNT(this->jointTable)); - EnXc_InitCollider(thisx, globalCtx); + EnXc_InitCollider(thisx, play); switch (this->actor.params) { case SHEIK_TYPE_1: - func_80B3EBF0(this, globalCtx); + func_80B3EBF0(this, play); break; case SHEIK_TYPE_2: // Beta Serenade Cutscene or Learning Prelude - func_80B3EE64(this, globalCtx); + func_80B3EE64(this, play); break; case SHEIK_TYPE_3: - func_80B3F3C8(this, globalCtx); + func_80B3F3C8(this, play); break; case SHEIK_TYPE_4: - func_80B3FA08(this, globalCtx); + func_80B3FA08(this, play); break; case SHEIK_TYPE_5: - func_80B40590(this, globalCtx); + func_80B40590(this, play); break; case SHEIK_TYPE_MINUET: - func_80B3CA38(this, globalCtx); + func_80B3CA38(this, play); break; case SHEIK_TYPE_BOLERO: - func_80B3CB58(this, globalCtx); + func_80B3CB58(this, play); break; case SHEIK_TYPE_SERENADE: - EnXc_SetupSerenadeAction(this, globalCtx); + EnXc_SetupSerenadeAction(this, play); break; case SHEIK_TYPE_9: - EnXc_InitTempleOfTime(this, globalCtx); + EnXc_InitTempleOfTime(this, play); break; case SHEIK_TYPE_0: - EnXc_DoNothing(this, globalCtx); + EnXc_DoNothing(this, play); break; default: osSyncPrintf(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); - EnXc_DoNothing(this, globalCtx); + EnXc_DoNothing(this, play); } } -s32 EnXc_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnXc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnXc* this = (EnXc*)thisx; if (this->unk_30C != 0) { @@ -2420,7 +2420,7 @@ s32 EnXc_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnXc_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnXc_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 16) { EnXc* this = (EnXc*)thisx; Vec3f src = { 0.0f, 10.0f, 0.0f }; @@ -2436,24 +2436,24 @@ void EnXc_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnXc_DrawNothing(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawNothing(Actor* thisx, PlayState* play) { } -void EnXc_DrawDefault(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawDefault(Actor* thisx, PlayState* play) { s32 pad; EnXc* this = (EnXc*)thisx; s16 eyeIdx = this->eyeIdx; void* eyeSegment = sEyeTextures[eyeIdx]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* localGfxCtx = play->state.gfxCtx; GraphicsContext* gfxCtx = localGfxCtx; OPEN_DISPS(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeSegment)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeSegment)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_OverrideLimbDraw, EnXc_PostLimbDraw, this); CLOSE_DISPS(gfxCtx); } @@ -2463,14 +2463,14 @@ static EnXcDrawFunc sDrawFuncs[] = { EnXc_DrawHarp, EnXc_DrawTriforce, EnXc_DrawSquintingEyes, }; -void EnXc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Draw(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; if (this->drawMode < 0 || this->drawMode > 5 || sDrawFuncs[this->drawMode] == NULL) { // "Draw mode is abnormal!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sDrawFuncs[this->drawMode](thisx, globalCtx); + sDrawFuncs[this->drawMode](thisx, play); } } diff --git a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.h b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.h index 59813e733..8a8dc4850 100644 --- a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.h +++ b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.h @@ -6,8 +6,8 @@ struct EnXc; -typedef void (*EnXcActionFunc)(struct EnXc*, GlobalContext*); -typedef void (*EnXcDrawFunc)(struct Actor*, GlobalContext*); +typedef void (*EnXcActionFunc)(struct EnXc*, PlayState*); +typedef void (*EnXcDrawFunc)(struct Actor*, PlayState*); typedef enum { /* 0 */ SHEIK_TYPE_0, diff --git a/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index ff8630bb0..f8e39ab88 100644 --- a/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx); -void EnYabusameMark_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnYabusameMark_Update(Actor* thisx, GlobalContext* globalCtx); -void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx); +void EnYabusameMark_Init(Actor* thisx, PlayState* play); +void EnYabusameMark_Destroy(Actor* thisx, PlayState* play); +void EnYabusameMark_Update(Actor* thisx, PlayState* play); +void func_80B42F74(EnYabusameMark* this, PlayState* play); static ColliderQuadInit sQuadInit = { { @@ -70,13 +70,13 @@ static f32 sRingDistance[] = { 40.0f, 120.0f, 160.0f, 777.0f, // large }; -void EnYabusameMark_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnYabusameMark_Destroy(Actor* thisx, PlayState* play) { EnYabusameMark* this = (EnYabusameMark*)thisx; - Collider_DestroyQuad(globalCtx, &this->collider); + Collider_DestroyQuad(play, &this->collider); } -void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnYabusameMark_Init(Actor* thisx, PlayState* play) { EnYabusameMark* this = (EnYabusameMark*)thisx; osSyncPrintf("\n\n"); @@ -102,8 +102,8 @@ void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx) { this->subTypeIndex = 4; break; } - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit); this->worldPos = this->actor.world.pos; this->actor.flags |= ACTOR_FLAG_4; if (gSaveContext.sceneSetupIndex != 4) { @@ -115,7 +115,7 @@ void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B42F74; } -void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx) { +void func_80B42F74(EnYabusameMark* this, PlayState* play) { Vec3f effectAccel = { 0.0f, 0.0f, 0.0f }; Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f arrowHitPos; @@ -135,7 +135,7 @@ void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx) { effectVelocity.y = 15.0f; - EffectSsHitMark_SpawnCustomScale(globalCtx, 0, 700, &arrowHitPos); + EffectSsHitMark_SpawnCustomScale(play, 0, 700, &arrowHitPos); scoreIndex = 2; @@ -182,16 +182,16 @@ void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx) { if (scoreIndex == 0) { func_80078884(NA_SE_SY_DECIDE); } - EffectSsExtra_Spawn(globalCtx, &arrowHitPos, &effectVelocity, &effectAccel, 5, scoreIndex); + EffectSsExtra_Spawn(play, &arrowHitPos, &effectVelocity, &effectAccel, 5, scoreIndex); } } -void EnYabusameMark_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnYabusameMark_Update(Actor* thisx, PlayState* play) { EnYabusameMark* this = (EnYabusameMark*)thisx; Vec3f* vertexArray; u32 arrayIndex; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); arrayIndex = this->typeIndex * 4; vertexArray = &sCollisionVertices[arrayIndex]; @@ -212,10 +212,10 @@ void EnYabusameMark_Update(Actor* thisx, GlobalContext* globalCtx) { this->vertexD.z = vertexArray[3].z + this->actor.world.pos.z; Collider_SetQuadVertices(&this->collider, &this->vertexA, &this->vertexB, &this->vertexC, &this->vertexD); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0, 0xFF, 0, 0xFF, 4, globalCtx->state.gfxCtx); + 1.0f, 0, 0xFF, 0, 0xFF, 4, play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h b/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h index 363fd9cc7..f4ec71bec 100644 --- a/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h +++ b/soh/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h @@ -6,7 +6,7 @@ struct EnYabusameMark; -typedef void (*EnYabusameMarkActionFunc)(struct EnYabusameMark*, GlobalContext*); +typedef void (*EnYabusameMarkActionFunc)(struct EnYabusameMark*, PlayState*); typedef struct EnYabusameMark { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index 7f75d44e6..007c20134 100644 --- a/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnYukabyun_Init(Actor* thisx, GlobalContext* globalCtx); -void EnYukabyun_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx); -void EnYukabyun_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnYukabyun_Init(Actor* thisx, PlayState* play); +void EnYukabyun_Destroy(Actor* thisx, PlayState* play); +void EnYukabyun_Update(Actor* thisx, PlayState* play); +void EnYukabyun_Draw(Actor* thisx, PlayState* play); -void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx); -void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx); -void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx); +void func_80B43A94(EnYukabyun* this, PlayState* play); +void func_80B43AD4(EnYukabyun* this, PlayState* play); +void func_80B43B6C(EnYukabyun* this, PlayState* play); const ActorInit En_Yukabyun_InitVars = { ACTOR_EN_YUKABYUN, @@ -58,25 +58,25 @@ static InitChainEntry sInitChain[] = { static void* D_80B43F64[] = { gFloorTileEnemyTopTex, gFloorTileEnemyBottomTex }; -void EnYukabyun_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Init(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.4f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.params++; this->unk_152 = 0; this->unk_150 = (u8)(this->actor.params) * 0xA + 0x14; this->actionfunc = func_80B43A94; } -void EnYukabyun_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Destroy(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx) { +void func_80B43A94(EnYukabyun* this, PlayState* play) { if (this->unk_150 != 0) { this->unk_150--; } @@ -86,7 +86,7 @@ void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx) { } } -void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx) { +void func_80B43AD4(EnYukabyun* this, PlayState* play) { this->unk_150 += 0xA0; this->actor.shape.rot.y += this->unk_150; if (this->unk_150 >= 0x2000) { @@ -98,7 +98,7 @@ void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_YUKABYUN_FLY - SFX_FLAG); } -void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx) { +void func_80B43B6C(EnYukabyun* this, PlayState* play) { this->actor.shape.rot.y += this->unk_150; if (this->actor.xzDistToPlayer > 5000.0f) { Actor_Kill(&this->actor); @@ -107,13 +107,13 @@ void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_YUKABYUN_FLY - SFX_FLAG); } -void EnYukabyun_Break(EnYukabyun* this, GlobalContext* globalCtx) { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 8.0f, 0, 1300, 300, 15, OBJECT_YUKABYUN, 10, +void EnYukabyun_Break(EnYukabyun* this, PlayState* play) { + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 8.0f, 0, 1300, 300, 15, OBJECT_YUKABYUN, 10, gFloorTileEnemyFragmentDL); Actor_Kill(&this->actor); } -void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Update(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; s32 pad; @@ -124,36 +124,36 @@ void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; this->collider.base.ocFlags1 &= ~OC1_HIT; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_ROCK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_ROCK); this->actionfunc = EnYukabyun_Break; } - this->actionfunc(this, globalCtx); + this->actionfunc(this, play); Actor_MoveForward(&this->actor); if (!(this->actionfunc == func_80B43A94 || this->actionfunc == EnYukabyun_Break)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 20.0f, 8.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 20.0f, 8.0f, 5); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 4.0f); } -void EnYukabyun_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Draw(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B43F64[this->unk_152])); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFloorTileEnemyDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h b/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h index c1e6b00ae..773237fbc 100644 --- a/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h +++ b/soh/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h @@ -6,7 +6,7 @@ struct EnYukabyun; -typedef void (*EnYukabyunActionFunc)(struct EnYukabyun*, GlobalContext*); +typedef void (*EnYukabyunActionFunc)(struct EnYukabyun*, PlayState*); typedef struct EnYukabyun { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c index c7fdb65ad..a54a93cac 100644 --- a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -9,47 +9,47 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnZf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZf_Init(Actor* thisx, PlayState* play); +void EnZf_Destroy(Actor* thisx, PlayState* play); +void EnZf_Update(Actor* thisx, PlayState* play); +void EnZf_Draw(Actor* thisx, PlayState* play); void EnZf_Reset(void); s16 EnZf_FindPlatform(Vec3f* pos, s16 preferredIndex); void EnZf_SetupDropIn(EnZf* this); -void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx); +void EnZf_DropIn(EnZf* this, PlayState* play); void func_80B45384(EnZf* this); -void func_80B4543C(EnZf* this, GlobalContext* globalCtx); -void EnZf_SetupApproachPlayer(EnZf* this, GlobalContext* globalCtx); -void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx); +void func_80B4543C(EnZf* this, PlayState* play); +void EnZf_SetupApproachPlayer(EnZf* this, PlayState* play); +void EnZf_ApproachPlayer(EnZf* this, PlayState* play); void EnZf_SetupJumpForward(EnZf* this); -void EnZf_JumpForward(EnZf* this, GlobalContext* globalCtx); +void EnZf_JumpForward(EnZf* this, PlayState* play); void func_80B4604C(EnZf* this); -void func_80B46098(EnZf* this, GlobalContext* globalCtx); -void func_80B462E4(EnZf* this, GlobalContext* globalCtx); -void func_80B463E4(EnZf* this, GlobalContext* globalCtx); +void func_80B46098(EnZf* this, PlayState* play); +void func_80B462E4(EnZf* this, PlayState* play); +void func_80B463E4(EnZf* this, PlayState* play); void EnZf_SetupSlash(EnZf* this); -void EnZf_Slash(EnZf* this, GlobalContext* globalCtx); -void EnZf_RecoilFromBlockedSlash(EnZf* this, GlobalContext* globalCtx); +void EnZf_Slash(EnZf* this, PlayState* play); +void EnZf_RecoilFromBlockedSlash(EnZf* this, PlayState* play); void EnZf_SetupJumpBack(EnZf* this); -void EnZf_JumpBack(EnZf* this, GlobalContext* globalCtx); -void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx); -void EnZf_SetupSheatheSword(EnZf* this, GlobalContext* globalCtx); -void EnZf_SheatheSword(EnZf* this, GlobalContext* globalCtx); -void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx); -void EnZf_SetupHopAway(EnZf* this, GlobalContext* globalCtx); -void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx); -void EnZf_DrawSword(EnZf* this, GlobalContext* globalCtx); -void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx); +void EnZf_JumpBack(EnZf* this, PlayState* play); +void EnZf_Stunned(EnZf* this, PlayState* play); +void EnZf_SetupSheatheSword(EnZf* this, PlayState* play); +void EnZf_SheatheSword(EnZf* this, PlayState* play); +void EnZf_HopAndTaunt(EnZf* this, PlayState* play); +void EnZf_SetupHopAway(EnZf* this, PlayState* play); +void EnZf_HopAway(EnZf* this, PlayState* play); +void EnZf_DrawSword(EnZf* this, PlayState* play); +void EnZf_Damaged(EnZf* this, PlayState* play); void EnZf_SetupJumpUp(EnZf* this); -void EnZf_JumpUp(EnZf* this, GlobalContext* globalCtx); -void func_80B483E4(EnZf* this, GlobalContext* globalCtx); -void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx); +void EnZf_JumpUp(EnZf* this, PlayState* play); +void func_80B483E4(EnZf* this, PlayState* play); +void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play); void EnZf_SetupDie(EnZf* this); -void EnZf_Die(EnZf* this, GlobalContext* globalCtx); +void EnZf_Die(EnZf* this, PlayState* play); void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speed); -s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this); -s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this); +s32 EnZf_DodgeRangedEngaging(PlayState* play, EnZf* this); +s32 EnZf_DodgeRangedWaiting(PlayState* play, EnZf* this); #define PLATFORM_INDEX_DOWNSTAIRS_MIN 0 #define PLATFORM_INDEX_DOWNSTAIRS_INNER_MAX 5 @@ -214,7 +214,7 @@ void EnZf_SetupAction(EnZf* this, EnZfActionFunc actionFunc) { * Tests if it will still be on a floor after moving forwards a distance determined by dist, in the shape forward * direction. If `dist` is 0, it defaults to a dist depending on speed direction, and params. */ -s32 EnZf_PrimaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { +s32 EnZf_PrimaryFloorCheck(EnZf* this, PlayState* play, f32 dist) { s16 ret; s16 curBgCheckFlags; f32 sin; @@ -236,7 +236,7 @@ s32 EnZf_PrimaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { this->actor.world.pos.x += sin; this->actor.world.pos.z += cos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); this->actor.world.pos = curPos; ret = !(this->actor.bgCheckFlags & 1); this->actor.bgCheckFlags = curBgCheckFlags; @@ -246,14 +246,14 @@ s32 EnZf_PrimaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { /** * Supplementary floor test. */ -s16 EnZf_SecondaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { +s16 EnZf_SecondaryFloorCheck(EnZf* this, PlayState* play, f32 dist) { s16 ret; s16 curBgCheckFlags; f32 sin; f32 cos; Vec3f curPos; - if ((this->actor.speedXZ != 0.0f) && EnZf_PrimaryFloorCheck(this, globalCtx, this->actor.speedXZ)) { + if ((this->actor.speedXZ != 0.0f) && EnZf_PrimaryFloorCheck(this, play, this->actor.speedXZ)) { return true; } @@ -267,17 +267,17 @@ s16 EnZf_SecondaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { this->actor.world.pos.x += sin; this->actor.world.pos.z += cos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); this->actor.world.pos = curPos; ret = !(this->actor.bgCheckFlags & 1); this->actor.bgCheckFlags = curBgCheckFlags; return ret; } -void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Init(Actor* thisx, PlayState* play) { s32 pad; EnZf* this = (EnZf*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EffectBlureInit1 blureInit; f32 posDiff; @@ -307,27 +307,27 @@ void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 75.0f, 45.0f, 45.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, thisx, 75.0f, 45.0f, 45.0f, 0x1D); this->alpha = 255; thisx->colChkInfo.cylRadius = 40; thisx->colChkInfo.cylHeight = 100; - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, thisx, &sBodyCylinderInit); - Collider_InitQuad(globalCtx, &this->swordCollider); - Collider_SetQuad(globalCtx, &this->swordCollider, thisx, &sSwordQuadInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, thisx, &sBodyCylinderInit); + Collider_InitQuad(play, &this->swordCollider); + Collider_SetQuad(play, &this->swordCollider, thisx, &sSwordQuadInit); if (thisx->params == ENZF_TYPE_DINOLFOS) { thisx->colChkInfo.health = 12; thisx->naviEnemyId = 0x10; - SkelAnime_Init(globalCtx, &this->skelAnime, &gZfDinolfosSkel, &gZfCryingAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gZfDinolfosSkel, &gZfCryingAnim, this->jointTable, this->morphTable, ENZF_LIMB_MAX); } else { // Lizalfos thisx->colChkInfo.health = 6; thisx->naviEnemyId = 0x0F; - SkelAnime_Init(globalCtx, &this->skelAnime, &gZfLizalfosSkel, &gZfCryingAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gZfLizalfosSkel, &gZfCryingAnim, this->jointTable, this->morphTable, ENZF_LIMB_MAX); } @@ -343,7 +343,7 @@ void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { } else { // Minibosses posDiff = player->actor.world.pos.y - thisx->world.pos.y; - if ((ABS(posDiff) <= 100.0f) && !Flags_GetSwitch(globalCtx, this->clearFlag)) { + if ((ABS(posDiff) <= 100.0f) && !Flags_GetSwitch(play, this->clearFlag)) { this->homePlatform = this->curPlatform = EnZf_FindPlatform(&thisx->world.pos, 0); EnZf_SetupDropIn(this); D_80B4A1B4 = 1; @@ -353,17 +353,17 @@ void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Destroy(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ && - (Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { + (Actor_FindNearby(play, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { func_800F5B58(); } - Effect_Delete(globalCtx, this->blureIndex); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->swordCollider); + Effect_Delete(play, this->blureIndex); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->swordCollider); } /** @@ -400,10 +400,10 @@ s16 EnZf_FindPlatform(Vec3f* pos, s16 preferredIndex) { return i; } -s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, GlobalContext* globalCtx) { +s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, PlayState* play) { f32 distToCurLoopPlatform; f32 platformMinDist = 585.0f; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 initialPlatform = curPlatform; f32 playerMaxDist = 400.0f; f32 smallMaxRange = 99998.0f; @@ -473,10 +473,10 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, G return nextPlatform; } -s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, GlobalContext* globalCtx) { +s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, PlayState* play) { s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_MAX; s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 nextPlatform = EnZf_FindPlatform(&player->actor.world.pos, -1); f32 minRange = 500.0f; f32 smallMaxRange = 99998.0f; @@ -524,9 +524,9 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Gl } // Player not targeting this or another EnZf? -s32 EnZf_CanAttack(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_CanAttack(PlayState* play, EnZf* this) { Actor* targetedActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss if (player->stateFlags1 & 0x6000) { // Hanging or climbing @@ -535,7 +535,7 @@ s32 EnZf_CanAttack(GlobalContext* globalCtx, EnZf* this) { return true; } } else { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!Actor_OtherIsTargeted(play, &this->actor)) { return true; } if (this->actor.params == ENZF_TYPE_DINOLFOS) { @@ -557,7 +557,7 @@ s32 EnZf_CanAttack(GlobalContext* globalCtx, EnZf* this) { return false; } -void func_80B44DC4(EnZf* this, GlobalContext* globalCtx) { +void func_80B44DC4(EnZf* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (angleDiff < 0) { @@ -565,29 +565,29 @@ void func_80B44DC4(EnZf* this, GlobalContext* globalCtx) { } if (angleDiff >= 0x1B58) { - func_80B483E4(this, globalCtx); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 8) != 0) && - EnZf_CanAttack(globalCtx, this)) { + func_80B483E4(this, play); + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { func_80B45384(this); } } -s32 EnZf_ChooseAction(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_ChooseAction(PlayState* play, EnZf* this) { s16 angleToWall; Actor* explosive; angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; angleToWall = ABS(angleToWall); - if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 80.0f)) { EnZf_SetupJumpUp(this); return true; - } else if ((this->actor.xzDistToPlayer < 90.0f) && ((globalCtx->gameplayFrames % 2) != 0)) { + } else if ((this->actor.xzDistToPlayer < 90.0f) && ((play->gameplayFrames % 2) != 0)) { EnZf_SetupJumpUp(this); return true; } else { @@ -596,7 +596,7 @@ s32 EnZf_ChooseAction(GlobalContext* globalCtx, EnZf* this) { } } - explosive = Actor_FindNearby(globalCtx, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); if (explosive != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -637,7 +637,7 @@ void EnZf_SetupDropIn(EnZf* this) { EnZf_SetupAction(this, EnZf_DropIn); } -void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx) { +void EnZf_DropIn(EnZf* this, PlayState* play) { if (this->unk_3F0 == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.flags |= ACTOR_FLAG_0; @@ -668,14 +668,14 @@ void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~2; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { this->alpha = 255; if (this->actor.params > ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // Only miniboss B - EnZf_SetupSheatheSword(this, globalCtx); + EnZf_SetupSheatheSword(this, play); } else { func_80B45384(this); } @@ -694,15 +694,15 @@ void func_80B45384(EnZf* this) { EnZf_SetupAction(this, func_80B4543C); } -void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B4543C(EnZf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 angleToPlayer = (this->actor.yawTowardsPlayer - this->headRot) - this->actor.shape.rot.y; angleToPlayer = ABS(angleToPlayer); SkelAnime_Update(&this->skelAnime); - if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { + if (!EnZf_DodgeRangedEngaging(play, this)) { if (this->actor.params == ENZF_TYPE_DINOLFOS) { if (this->unk_3F4 != 0) { this->unk_3F4--; @@ -711,7 +711,7 @@ void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { } this->unk_3F4 = 0; - } else if (EnZf_ChooseAction(globalCtx, this)) { + } else if (EnZf_ChooseAction(play, this)) { return; } } @@ -720,7 +720,7 @@ void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 100.0f) && (player->swordState != 0) && (angleToPlayer >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else if (this->unk_3F0 != 0) { this->unk_3F0--; } else { @@ -731,39 +731,39 @@ void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; EnZf_SetupJumpForward(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } else if (Rand_ZeroOne() > 0.3f) { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } else { func_80B4604C(this); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } } } -void EnZf_SetupApproachPlayer(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SetupApproachPlayer(EnZf* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gZfWalkingAnim, -4.0f); this->action = ENZF_ACTION_APPROACH_PLAYER; if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); this->nextPlatform = EnZf_FindNextPlatformTowardsPlayer(&this->actor.world.pos, this->curPlatform, - this->homePlatform, globalCtx); + this->homePlatform, play); this->hopAnimIndex = 0; } this->actor.speedXZ = 0.0f; EnZf_SetupAction(this, EnZf_ApproachPlayer); } -void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { +void EnZf_ApproachPlayer(EnZf* this, PlayState* play) { s32 sp54; s32 sp50; s32 temp; @@ -771,7 +771,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { s16 sp48 = -1; f32 sp44 = 350.0f; f32 sp40 = 0.0f; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp30; if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss @@ -783,10 +783,10 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { } } - if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { + if (!EnZf_DodgeRangedEngaging(play, this)) { if (sp48 != this->curPlatform) { this->nextPlatform = EnZf_FindNextPlatformTowardsPlayer(&this->actor.world.pos, this->curPlatform, - this->homePlatform, globalCtx); + this->homePlatform, play); if ((sp48 < 0) && (this->nextPlatform == this->curPlatform)) { sp48 = this->curPlatform; @@ -801,7 +801,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { if ((this->unk_3F8 && (this->actor.speedXZ > 0.0f)) || ((this->actor.bgCheckFlags & 8) && (temp_v1 >= 0x5C19))) { if ((Actor_WorldDistXZToPoint(&this->actor, &sPlatformPositions[this->nextPlatform]) < sp44) && - !EnZf_PrimaryFloorCheck(this, globalCtx, 191.9956f)) { + !EnZf_PrimaryFloorCheck(this, play, 191.9956f)) { EnZf_SetupJumpForward(this); if (this->actor.bgCheckFlags & 8) { @@ -820,7 +820,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { sp40 = 100.0f; } @@ -840,7 +840,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); return; } } @@ -853,21 +853,21 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { if (sp48 == this->curPlatform) { if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { - func_80B462E4(this, globalCtx); + func_80B462E4(this, play); } else { func_80B45384(this); } } else if (this->actor.xzDistToPlayer < 100.0f) { - if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack(globalCtx, this)) { + if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else if (Rand_ZeroOne() > 0.5f) { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else { func_80B45384(this); } } else { if (this->unk_3F8) { - func_80B462E4(this, globalCtx); + func_80B462E4(this, play); } else if (Rand_ZeroOne() < 0.1f) { func_80B45384(this); } @@ -875,26 +875,26 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - if (EnZf_ChooseAction(globalCtx, this)) { + if (EnZf_ChooseAction(play, this)) { return; } if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 160.0f) && Actor_IsFacingPlayer(&this->actor, 0x71C)) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { if (Rand_ZeroOne() < 0.1f) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; EnZf_SetupJumpForward(this); return; } } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); return; } } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } @@ -925,7 +925,7 @@ void EnZf_SetupJumpForward(EnZf* this) { EnZf_SetupAction(this, EnZf_JumpForward); } -void EnZf_JumpForward(EnZf* this, GlobalContext* globalCtx) { +void EnZf_JumpForward(EnZf* this, PlayState* play) { if ((this->unk_3F0 != 0) && (this->actor.world.pos.y <= this->actor.floorHeight)) { this->actor.world.pos.y = this->actor.floorHeight; this->hopAnimIndex = 0; @@ -941,18 +941,18 @@ void EnZf_JumpForward(EnZf* this, GlobalContext* globalCtx) { } else { this->actor.speedXZ = 0.0f; this->hopAnimIndex = 0; - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & 3)) { - if (EnZf_CanAttack(globalCtx, this)) { + if (EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } } @@ -963,15 +963,15 @@ void func_80B4604C(EnZf* this) { EnZf_SetupAction(this, func_80B46098); } -void func_80B46098(EnZf* this, GlobalContext* globalCtx) { +void func_80B46098(EnZf* this, PlayState* play) { s32 pad; f32 phi_f2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v0; s16 phi_v1; - if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { - if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) { + if (!EnZf_DodgeRangedEngaging(play, this)) { + if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) { temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (temp_v0 > 0) { @@ -1001,19 +1001,19 @@ void func_80B46098(EnZf* this, GlobalContext* globalCtx) { if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); if (this->curPlatform != EnZf_FindPlatform(&player->actor.world.pos, -1)) { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); return; } } if (Actor_IsFacingPlayer(&this->actor, 30 * 0x10000 / 360)) { if (Rand_ZeroOne() > 0.8f) { - func_80B462E4(this, globalCtx); + func_80B462E4(this, play); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } @@ -1021,10 +1021,10 @@ void func_80B46098(EnZf* this, GlobalContext* globalCtx) { } // Conditional setup function -void func_80B462E4(EnZf* this, GlobalContext* globalCtx) { +void func_80B462E4(EnZf* this, PlayState* play) { if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ || - Actor_TestFloorInDirection(&this->actor, globalCtx, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || - Actor_TestFloorInDirection(&this->actor, globalCtx, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { + Actor_TestFloorInDirection(&this->actor, play, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || + Actor_TestFloorInDirection(&this->actor, play, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { Animation_PlayLoop(&this->skelAnime, &gZfSidesteppingAnim); this->actor.speedXZ = Rand_CenteredFloat(12.0f); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1034,24 +1034,24 @@ void func_80B462E4(EnZf* this, GlobalContext* globalCtx) { this->unk_408 = 0.0f; EnZf_SetupAction(this, func_80B463E4); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } -void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { +void func_80B463E4(EnZf* this, PlayState* play) { s16 angleBehindPlayer; s16 phi_v0_3; s32 pad; s32 curKeyFrame; s32 prevKeyFrame; s32 playSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 baseRange = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); - if (!EnZf_DodgeRangedEngaging(globalCtx, this) && - ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this))) { + if (!EnZf_DodgeRangedEngaging(play, this) && + ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this))) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; angleBehindPlayer = player->actor.shape.rot.y + 0x8000; @@ -1072,7 +1072,7 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { this->actor.speedXZ = -this->actor.speedXZ; } } else if ((this->actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF)) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { @@ -1096,7 +1096,7 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 100.0f; } @@ -1108,7 +1108,7 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_408, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, globalCtx, this->unk_408)) { + if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, play, this->unk_408)) { this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_408; this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_408; } @@ -1134,15 +1134,15 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } if ((Math_CosS(angleBehindPlayer - this->actor.shape.rot.y) < -0.85f) || (this->unk_3F0 == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0) && - EnZf_CanAttack(globalCtx, this)) { + if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { func_80B45384(this); @@ -1168,8 +1168,8 @@ void EnZf_SetupSlash(EnZf* this) { EnZf_SetupAction(this, EnZf_Slash); } -void EnZf_Slash(EnZf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnZf_Slash(EnZf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 rotDiff; s16 yawDiff; @@ -1193,7 +1193,7 @@ void EnZf_Slash(EnZf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else { rotDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; rotDiff = ABS(rotDiff); @@ -1204,18 +1204,18 @@ void EnZf_Slash(EnZf* this, GlobalContext* globalCtx) { if (yawDiff > 16000) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else if (player->stateFlags1 & 0x6010) { if (this->actor.isTargeted) { EnZf_SetupSlash(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } else { EnZf_SetupSlash(this); } } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } } @@ -1230,14 +1230,14 @@ void EnZf_SetupRecoilFromBlockedSlash(EnZf* this) { EnZf_SetupAction(this, EnZf_RecoilFromBlockedSlash); } -void EnZf_RecoilFromBlockedSlash(EnZf* this, GlobalContext* globalCtx) { +void EnZf_RecoilFromBlockedSlash(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { func_80B45384(this); - } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack(globalCtx, this)) { + } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } } @@ -1253,7 +1253,7 @@ void EnZf_SetupJumpBack(EnZf* this) { EnZf_SetupAction(this, EnZf_JumpBack); } -void EnZf_JumpBack(EnZf* this, GlobalContext* globalCtx) { +void EnZf_JumpBack(EnZf* this, PlayState* play) { if ((this->unk_3F0 != 0) && (this->actor.world.pos.y <= this->actor.floorHeight)) { this->actor.world.pos.y = this->actor.floorHeight; this->hopAnimIndex = 0; @@ -1266,14 +1266,14 @@ void EnZf_JumpBack(EnZf* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gZfLandingAnim, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); this->unk_3F0 = 10; Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_JUMP); - } else if ((globalCtx->gameplayFrames % 2) != 0) { - func_80B483E4(this, globalCtx); + } else if ((play->gameplayFrames % 2) != 0) { + func_80B483E4(this, play); } else { func_80B45384(this); } } - if ((globalCtx->state.frames & 0x5F) == 0) { + if ((play->state.frames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } @@ -1297,7 +1297,7 @@ void EnZf_SetupStunned(EnZf* this) { EnZf_SetupAction(this, EnZf_Stunned); } -void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { +void EnZf_Stunned(EnZf* this, PlayState* play) { s16 angleToWall; if (this->actor.bgCheckFlags & 2) { @@ -1314,9 +1314,9 @@ void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { if (this->actor.colChkInfo.health == 0) { EnZf_SetupDie(this); - } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) { + } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) { if (D_80B4A1B4 != -1) { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } else { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; angleToWall = ABS(angleToWall); @@ -1325,14 +1325,14 @@ void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; EnZf_SetupJumpUp(this); - } else if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { + } else if (!EnZf_DodgeRangedEngaging(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { - func_80B44DC4(this, globalCtx); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) != 0) && - EnZf_CanAttack(globalCtx, this)) { + func_80B44DC4(this, play); + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) != 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } } } @@ -1340,7 +1340,7 @@ void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_SetupSheatheSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SetupSheatheSword(EnZf* this, PlayState* play) { f32 morphFrames = 0.0f; f32 lastFrame = Animation_GetLastFrame(&gZfSheathingSwordAnim); @@ -1353,12 +1353,12 @@ void EnZf_SetupSheatheSword(EnZf* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, globalCtx); + EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); this->actor.world.rot.y = this->actor.shape.rot.y; EnZf_SetupAction(this, EnZf_SheatheSword); } -void EnZf_SheatheSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SheatheSword(EnZf* this, PlayState* play) { s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &sPlatformPositions[this->nextPlatform]) + 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 1000, 0); @@ -1366,7 +1366,7 @@ void EnZf_SheatheSword(EnZf* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = yaw - 0x8000; - EnZf_SetupHopAway(this, globalCtx); + EnZf_SetupHopAway(this, play); this->swordSheathed = true; } } @@ -1381,7 +1381,7 @@ void EnZf_SetupHopAndTaunt(EnZf* this) { EnZf_SetupAction(this, EnZf_HopAndTaunt); } -void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx) { +void EnZf_HopAndTaunt(EnZf* this, PlayState* play) { f32 lastFrame; f32 maxDist = 400.0f; @@ -1396,10 +1396,10 @@ void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx) { // If player gets too close, run away if ((this->actor.xzDistToPlayer < maxDist) && (this->hopAnimIndex != 1)) { this->actor.shape.rot.y = this->actor.world.rot.y; - EnZf_SetupSheatheSword(this, globalCtx); + EnZf_SetupSheatheSword(this, play); } else { if (this->hopAnimIndex != 1) { - EnZf_DodgeRangedWaiting(globalCtx, this); + EnZf_DodgeRangedWaiting(play, this); } if (SkelAnime_Update(&this->skelAnime)) { @@ -1442,23 +1442,23 @@ void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx) { 0.0f); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } } -void EnZf_SetupHopAway(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SetupHopAway(EnZf* this, PlayState* play) { this->hopAnimIndex = 0; Animation_PlayOnce(&this->skelAnime, sHoppingAnims[0]); this->action = ENZF_ACTION_HOP_AWAY; this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, globalCtx); + EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); EnZf_SetupAction(this, EnZf_HopAway); } -void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { +void EnZf_HopAway(EnZf* this, PlayState* play) { f32 sp74; f32 sp70 = 1.0f; f32 phi_f20 = 550.0f; @@ -1474,7 +1474,7 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { sp74 = Actor_WorldDistXZToPoint(&this->actor, &sPlatformPositions[this->nextPlatform]); sp54 = this->hopAnimIndex; - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } @@ -1491,8 +1491,8 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = sp5A + 0x8000; D_80B4AB30 = 0; this->homePlatform = this->curPlatform; - temp_v1_2 = !EnZf_PrimaryFloorCheck(this, globalCtx, 107.0f); - temp_v1_2 |= !EnZf_PrimaryFloorCheck(this, globalCtx, 220.0f) << 1; + temp_v1_2 = !EnZf_PrimaryFloorCheck(this, play, 107.0f); + temp_v1_2 |= !EnZf_PrimaryFloorCheck(this, play, 220.0f) << 1; this->hopAnimIndex++; switch (temp_v1_2) { @@ -1519,7 +1519,7 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { for (phi_v1 = 20; phi_v1 >= 0; phi_v1--, phi_f20_2 += 10.0f, phi_f0 += 1.2f) { - if (!EnZf_PrimaryFloorCheck(this, globalCtx, phi_f20_2)) { + if (!EnZf_PrimaryFloorCheck(this, play, phi_f20_2)) { this->actor.speedXZ = phi_f0; this->actor.velocity.y = 12.0f; break; @@ -1537,15 +1537,15 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; this->actor.speedXZ = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); if (phi_f20 <= this->actor.xzDistToPlayer) { EnZf_SetupHopAndTaunt(this); } else if (sp74 < 80.0f) { this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); this->nextPlatform = EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, - this->homePlatform, globalCtx); + this->homePlatform, play); } this->hopAnimIndex = 0; @@ -1571,18 +1571,18 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } -void EnZf_SetupDrawSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SetupDrawSword(EnZf* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gZfDrawingSwordAnim); this->actor.world.rot.y += 0x8000; this->action = ENZF_ACTION_DRAW_SWORD; this->actor.speedXZ = 0.0f; this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, globalCtx); + EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); EnZf_SetupAction(this, EnZf_DrawSword); } -void EnZf_DrawSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_DrawSword(EnZf* this, PlayState* play) { s16 yawTowardsPlayer = this->actor.yawTowardsPlayer; if (this->skelAnime.curFrame >= 26.0f) { @@ -1625,7 +1625,7 @@ void EnZf_SetupDamaged(EnZf* this) { EnZf_SetupAction(this, EnZf_Damaged); } -void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { +void EnZf_Damaged(EnZf* this, PlayState* play) { s16 wallYawDiff; if (this->actor.bgCheckFlags & 2) { @@ -1641,7 +1641,7 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); - if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) && + if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { if (D_80B4A1B4 != -1) { @@ -1650,12 +1650,12 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!EnZf_PrimaryFloorCheck(this, globalCtx, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + if (!EnZf_PrimaryFloorCheck(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { EnZf_SetupJumpUp(this); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0)) { + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } } } else { @@ -1666,22 +1666,22 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & 8) && (ABS(wallYawDiff) < 12000) && (this->actor.xzDistToPlayer < 90.0f)) { EnZf_SetupJumpUp(this); - } else if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { + } else if (!EnZf_DodgeRangedEngaging(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!EnZf_PrimaryFloorCheck(this, globalCtx, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + if (!EnZf_PrimaryFloorCheck(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { EnZf_SetupJumpUp(this); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0)) { + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0) && - EnZf_CanAttack(globalCtx, this)) { + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } } } @@ -1700,11 +1700,11 @@ void EnZf_SetupJumpUp(EnZf* this) { EnZf_SetupAction(this, EnZf_JumpUp); } -void EnZf_JumpUp(EnZf* this, GlobalContext* globalCtx) { +void EnZf_JumpUp(EnZf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); if (this->actor.velocity.y >= 5.0f) { - func_800355B8(globalCtx, &this->leftFootPos); - func_800355B8(globalCtx, &this->rightFootPos); + func_800355B8(play, &this->leftFootPos); + func_800355B8(play, &this->rightFootPos); } if (SkelAnime_Update(&this->skelAnime)) { @@ -1724,15 +1724,15 @@ void EnZf_JumpUp(EnZf* this, GlobalContext* globalCtx) { } // Conditional setup function -void func_80B483E4(EnZf* this, GlobalContext* globalCtx) { +void func_80B483E4(EnZf* this, PlayState* play) { s16 playerRotY; Player* player; if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* not miniboss */ || - Actor_TestFloorInDirection(&this->actor, globalCtx, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || - Actor_TestFloorInDirection(&this->actor, globalCtx, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { + Actor_TestFloorInDirection(&this->actor, play, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || + Actor_TestFloorInDirection(&this->actor, play, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { Animation_PlayLoop(&this->skelAnime, &gZfSidesteppingAnim); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); playerRotY = player->actor.shape.rot.y; @@ -1749,14 +1749,14 @@ void func_80B483E4(EnZf* this, GlobalContext* globalCtx) { this->action = ENZF_ACTION_CIRCLE_AROUND_PLAYER; EnZf_SetupAction(this, EnZf_CircleAroundPlayer); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } -void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { +void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { s16 playerRot; s16 phi_v0_4; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 curKeyFrame; s32 prevKeyFrame; s32 playSpeed; @@ -1770,7 +1770,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { this->actor.speedXZ = -this->actor.speedXZ; } } else if ((this->actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF)) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { @@ -1803,7 +1803,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x4000; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 100.0f; } @@ -1815,7 +1815,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_408, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, globalCtx, this->unk_408)) { + if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, play, this->unk_408)) { this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_408; this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_408; } @@ -1842,9 +1842,9 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { (D_80B4A1B4 == this->actor.params)) { EnZf_SetupHopAndTaunt(this); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } - } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) { + } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) { if (this->unk_3F0 == 0) { phi_v0_4 = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -1862,15 +1862,15 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0) && - EnZf_CanAttack(globalCtx, this)) { + if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && - !EnZf_PrimaryFloorCheck(this, globalCtx, 191.9956f) && - ((globalCtx->gameplayFrames % 2) == 0)) { + !EnZf_PrimaryFloorCheck(this, play, 191.9956f) && + ((play->gameplayFrames % 2) == 0)) { EnZf_SetupJumpForward(this); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } } else { @@ -1882,7 +1882,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } @@ -1923,7 +1923,7 @@ void EnZf_SetupDie(EnZf* this) { EnZf_SetupAction(this, EnZf_Die); } -void EnZf_Die(EnZf* this, GlobalContext* globalCtx) { +void EnZf_Die(EnZf* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; @@ -1937,12 +1937,12 @@ void EnZf_Die(EnZf* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.category != ACTORCAT_PROP) { if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ && (D_80B4A1B4 == -1)) { - Flags_SetSwitch(globalCtx, this->clearFlag); + Flags_SetSwitch(play, this->clearFlag); func_800F5B58(); } else { D_80B4A1B4 = -1; } - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } if (this->alpha != 0) { @@ -1960,7 +1960,7 @@ void EnZf_Die(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_UpdateHeadRotation(EnZf* this, GlobalContext* globalCtx) { +void EnZf_UpdateHeadRotation(EnZf* this, PlayState* play) { s16 angleTemp; if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->action == ENZF_ACTION_3) && (this->unk_3F4 != 0)) { @@ -1974,7 +1974,7 @@ void EnZf_UpdateHeadRotation(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_UpdateDamage(EnZf* this, GlobalContext* globalCtx) { +void EnZf_UpdateDamage(EnZf* this, PlayState* play) { s32 pad; s16 dropParams; @@ -2006,8 +2006,8 @@ void EnZf_UpdateDamage(EnZf* this, GlobalContext* globalCtx) { dropParams = 0xE0; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, dropParams); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, dropParams); + Enemy_StartFinishingBlow(play, &this->actor); } else { if ((D_80B4A1B4 != -1) && ((this->actor.colChkInfo.health + this->actor.colChkInfo.damage) >= 4) && (this->actor.colChkInfo.health < 4)) { @@ -2021,20 +2021,20 @@ void EnZf_UpdateDamage(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Update(Actor* thisx, PlayState* play) { s32 pad; EnZf* this = (EnZf*)thisx; s32 pad2; - EnZf_UpdateDamage(this, globalCtx); + EnZf_UpdateDamage(this, play); if (this->actor.colChkInfo.damageEffect != ENZF_DMGEFF_IMMUNE) { this->unk_3F8 = false; if ((this->hopAnimIndex != 1) && (this->action != ENZF_ACTION_HOP_AWAY)) { if (this->actor.speedXZ != 0.0f) { - this->unk_3F8 = EnZf_PrimaryFloorCheck(this, globalCtx, this->actor.speedXZ * 1.5f); + this->unk_3F8 = EnZf_PrimaryFloorCheck(this, play, this->actor.speedXZ * 1.5f); } if (!this->unk_3F8) { - this->unk_3F8 = EnZf_PrimaryFloorCheck(this, globalCtx, 0.0f); + this->unk_3F8 = EnZf_PrimaryFloorCheck(this, play, 0.0f); } } @@ -2042,22 +2042,22 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 30.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, 0x1D); if (!(this->actor.bgCheckFlags & 1)) { this->hopAnimIndex = 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } if (this->actor.colChkInfo.health > 0) { if ((this->action != ENZF_ACTION_SLASH) && (this->action != ENZF_ACTION_STUNNED)) { - EnZf_UpdateHeadRotation(this, globalCtx); + EnZf_UpdateHeadRotation(this, play); } if ((D_80B4A1B0 != 0) && (D_80B4A1B4 != this->actor.params)) { - EnZf_SetupSheatheSword(this, globalCtx); + EnZf_SetupSheatheSword(this, play); D_80B4A1B4 = this->actor.params; D_80B4A1B0 = 0; @@ -2075,7 +2075,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->action <= ENZF_ACTION_HOP_AND_TAUNT) { if ((this->unk_3F4 == 1) && (this->actor.bgCheckFlags & 1)) { if (this->actor.colChkInfo.health > 0) { - EnZf_SetupDrawSword(this, globalCtx); + EnZf_SetupDrawSword(this, play); } this->unk_3F4--; } @@ -2093,13 +2093,13 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->bodyCollider); if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_DAMAGED)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* not miniboss */ || (D_80B4A1B4 != this->actor.params)) { if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } } } @@ -2107,7 +2107,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->action == ENZF_ACTION_SLASH) && (this->skelAnime.curFrame >= 14.0f) && (this->skelAnime.curFrame <= 20.0f)) { if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && !(this->swordCollider.base.acFlags & AC_HIT)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->swordCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } else { this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->swordCollider.base.acFlags &= ~AC_HIT; @@ -2116,7 +2116,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnZf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnZf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZf* this = (EnZf*)thisx; @@ -2141,7 +2141,7 @@ s32 EnZf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnZf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnZf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { static Vec3f sUnused = { 1100.0f, -700.0f, 0.0f }; static Vec3f footOffset = { 300.0f, 0.0f, 0.0f }; static Vec3f D_80B4A2A4 = { 300.0f, -1700.0f, 0.0f }; // Sword tip? @@ -2230,24 +2230,24 @@ static Gfx D_80B4A2F8[] = { gsSPEndDisplayList(), }; -void EnZf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Draw(Actor* thisx, PlayState* play) { s32 pad; EnZf* this = (EnZf*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8002EBCC(thisx, globalCtx, 1); + func_8002EBCC(thisx, play, 1); gSPTexture(D_80B4A2F8, IREG(0), IREG(1), 0, G_TX_RENDERTILE, G_ON); gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4A2F8); if (this->alpha == 255) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_OPA_DISP++, 0x09, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_OPA_DISP); if (this->iceTimer != 0) { @@ -2257,19 +2257,19 @@ void EnZf_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->iceTimer % 4) == 0) { s32 icePosIndex = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &this->bodyPartsPos[icePosIndex], 150, 150, 150, 250, + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &this->bodyPartsPos[icePosIndex], 150, 150, 150, 250, 235, 245, 255, 1.4f); } } } else { // fades out when dead - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x09, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speed) { @@ -2289,13 +2289,13 @@ void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speed) { EnZf_SetupAction(this, EnZf_CircleAroundPlayer); } -s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_DodgeRangedEngaging(PlayState* play, EnZf* this) { Actor* projectileActor; s16 yawToProjectile; s16 phi_t0; s16 phi_v1; - projectileActor = Actor_GetProjectileActor(globalCtx, &this->actor, 600.0f); + projectileActor = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectileActor != NULL) { yawToProjectile = @@ -2304,18 +2304,18 @@ s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { phi_t0 = 0; - if (EnZf_PrimaryFloorCheck(this, globalCtx, -8.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, -8.0f)) { phi_t0 = 1; } - if (EnZf_PrimaryFloorCheck(this, globalCtx, 8.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, 8.0f)) { phi_t0 |= 2; } this->actor.world.rot.y = this->actor.shape.rot.y; if ((((this->actor.xzDistToPlayer < 90.0f) || (phi_t0 == 3)) && - !EnZf_PrimaryFloorCheck(this, globalCtx, 135.0f)) || + !EnZf_PrimaryFloorCheck(this, play, 135.0f)) || (projectileActor->id == ACTOR_ARMS_HOOK)) { EnZf_SetupJumpUp(this); return true; @@ -2324,7 +2324,7 @@ s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; if (phi_t0 == 0) { - phi_v1 = globalCtx->gameplayFrames % 2; + phi_v1 = play->gameplayFrames % 2; } else { phi_v1 = phi_t0; } @@ -2349,25 +2349,25 @@ s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { return false; } -s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_DodgeRangedWaiting(PlayState* play, EnZf* this) { Actor* projectileActor; s16 yawToProjectile; s16 phi_t0; s16 sp1E; s16 sp1C = 0; - projectileActor = Actor_GetProjectileActor(globalCtx, &this->actor, 600.0f); + projectileActor = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectileActor != NULL) { yawToProjectile = Actor_WorldYawTowardActor(&this->actor, projectileActor) - (s16)(u16)this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; // Set to move sideways phi_t0 = 0; - if (EnZf_PrimaryFloorCheck(this, globalCtx, -70.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, -70.0f)) { phi_t0 = 1; } - if (EnZf_PrimaryFloorCheck(this, globalCtx, 70.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, 70.0f)) { phi_t0 |= 2; } @@ -2375,7 +2375,7 @@ s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this) { if ((ABS(yawToProjectile) < 0x2000) || (ABS(yawToProjectile) >= 0x6000)) { if (phi_t0 == 0) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; @@ -2396,7 +2396,7 @@ s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this) { } } else if (ABS(yawToProjectile) < 0x5FFF) { if (phi_t0 == 0) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; diff --git a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.h b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.h index b9b503468..b9bcea800 100644 --- a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -6,7 +6,7 @@ struct EnZf; -typedef void (*EnZfActionFunc)(struct EnZf*, GlobalContext*); +typedef void (*EnZfActionFunc)(struct EnZf*, PlayState*); typedef enum { /* -2 */ ENZF_TYPE_DINOLFOS = -2, diff --git a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 9a770029a..d995ecf09 100644 --- a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -9,19 +9,19 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZl1_Init(Actor* thisx, PlayState* play); +void EnZl1_Destroy(Actor* thisx, PlayState* play); +void EnZl1_Update(Actor* thisx, PlayState* play); +void EnZl1_Draw(Actor* thisx, PlayState* play); void func_80B4AE18(EnZl1* this); -void func_80B4AF18(EnZl1* this, GlobalContext* globalCtx); -void func_80B4B010(EnZl1* this, GlobalContext* globalCtx); -void func_80B4B240(EnZl1* this, GlobalContext* globalCtx); -void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx); -void func_80B4BBC4(EnZl1* this, GlobalContext* globalCtx); -void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx); -void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx); +void func_80B4AF18(EnZl1* this, PlayState* play); +void func_80B4B010(EnZl1* this, PlayState* play); +void func_80B4B240(EnZl1* this, PlayState* play); +void func_80B4B8B4(EnZl1* this, PlayState* play); +void func_80B4BBC4(EnZl1* this, PlayState* play); +void func_80B4BC78(EnZl1* this, PlayState* play); +void func_80B4BF2C(EnZl1* this, PlayState* play); extern CutsceneData D_80B4C5D0[]; @@ -74,16 +74,16 @@ void func_80B4AB40(void) { void func_80B4AB48(void) { } -void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Init(Actor* thisx, PlayState* play) { f32 frameCount; EnZl1* this = (EnZl1*)thisx; frameCount = Animation_GetLastFrame(&gChildZelda1Anim_12118); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gChildZelda1Skel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gChildZelda1Skel, NULL, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gChildZelda1Anim_12118, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); this->actor.targetMode = 0; @@ -112,11 +112,11 @@ void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZl1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Destroy(Actor* thisx, PlayState* play) { EnZl1* this = (EnZl1*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } void func_80B4AE18(EnZl1* this) { @@ -136,28 +136,28 @@ void func_80B4AE18(EnZl1* this) { } } -void func_80B4AF18(EnZl1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B4AF18(EnZl1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); if (this->unk_1E6 != 0) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1E6 = 0; } - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_1E6 = 1; } else if (this->actor.world.pos.y <= player->actor.world.pos.y) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B4B010(EnZl1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad2; s32 pad3; s32 pad; @@ -166,20 +166,20 @@ void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { Vec3f playerPos = { -398.0f, 84.0f, 0.0f }; s16 rotDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { Animation_Change(&this->skelAnime, &gChildZelda1Anim_10B38, 1.0f, 0.0f, Animation_GetLastFrame(&gChildZelda1Anim_10B38), ANIMMODE_ONCE_INTERP, -10.0f); - this->unk_1E8 = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_1E8, CAM_STAT_ACTIVE); - func_800C0808(globalCtx, this->unk_1E8, player, CAM_SET_FREE0); - globalCtx->envCtx.screenFillColor[0] = 255; - globalCtx->envCtx.screenFillColor[1] = 255; - globalCtx->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.screenFillColor[3] = 24; - globalCtx->envCtx.fillScreen = true; - Gameplay_CameraSetAtEye(globalCtx, this->unk_1E8, &vec1, &vec2); - Gameplay_CameraSetFov(globalCtx, this->unk_1E8, 30.0f); + this->unk_1E8 = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->unk_1E8, CAM_STAT_ACTIVE); + func_800C0808(play, this->unk_1E8, player, CAM_SET_FREE0); + play->envCtx.screenFillColor[0] = 255; + play->envCtx.screenFillColor[1] = 255; + play->envCtx.screenFillColor[2] = 255; + play->envCtx.screenFillColor[3] = 24; + play->envCtx.fillScreen = true; + Play_CameraSetAtEye(play, this->unk_1E8, &vec1, &vec2); + Play_CameraSetFov(play, this->unk_1E8, 30.0f); ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); player->actor.world.pos = playerPos; @@ -190,21 +190,21 @@ void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { } else { rotDiff = ABS(this->actor.yawTowardsPlayer - this->actor.shape.rot.y); if ((rotDiff < 0x238E) && !(player->actor.world.pos.y < this->actor.world.pos.y)) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } -void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4B240(EnZl1* this, PlayState* play) { Vec3f sp74 = { -427.0f, 108.0, 26.0 }; Vec3f sp68 = { -340.0f, 108.0f, 98.0f }; s32 pad; Vec3f sp58 = { -434.0f, 84.0f, 0.0f }; u8 sp54[] = { 0x00, 0x00, 0x02 }; s32 pad2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); AnimationHeader* animHeaderSeg; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; f32 frameCount; s32 sp3C = 0; @@ -223,24 +223,24 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { animHeaderSeg = &gChildZelda1Anim_11348; sp3C = 1; this->actor.textId = 0x702E; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1E2++; break; } break; case 1: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->envCtx.fillScreen = false; - Gameplay_CameraSetAtEye(globalCtx, this->unk_1E8, &sp74, &sp68); - Gameplay_CameraSetFov(globalCtx, this->unk_1E8, 25.0f); + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->envCtx.fillScreen = false; + Play_CameraSetAtEye(play, this->unk_1E8, &sp74, &sp68); + Play_CameraSetFov(play, this->unk_1E8, 25.0f); player->actor.world.pos = sp58; this->actor.textId = 0x702F; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 2: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { animHeaderSeg = &gChildZelda1Anim_13F10; sp3C = 2; @@ -258,27 +258,27 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { animHeaderSeg = &gChildZelda1Anim_143A8; sp3C = 1; this->actor.textId = 0x7032; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 4: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { animHeaderSeg = &gChildZelda1Anim_132D8; sp3C = 2; this->unk_1E2 = 9; } else { this->actor.textId = 0x7034; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } } break; case 5: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0x7033; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2--; } break; @@ -288,26 +288,26 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { animHeaderSeg = &gChildZelda1Anim_12B88; sp3C = 1; this->actor.textId = 0x7031; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 7: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0x7030; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 8: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { animHeaderSeg = &gChildZelda1Anim_138E0; sp3C = 2; this->unk_1E2 = 3; } else { this->actor.textId = 0x7031; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2--; } } @@ -317,7 +317,7 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == frameCount) { animHeaderSeg = &gChildZelda1Anim_00438; sp3C = 1; - globalCtx->csCtx.segment = D_80B4C5D0; + play->csCtx.segment = D_80B4C5D0; gSaveContext.cutsceneTrigger = 1; this->actionFunc = func_80B4B8B4; this->unk_1E2++; @@ -328,7 +328,7 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { frameCount = Animation_GetLastFrame(animHeaderSeg); Animation_Change(&this->skelAnime, animHeaderSeg, 1.0f, 0.0f, frameCount, sp54[sp3C], -10.0f); } - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); } void func_80B4B7F4(CsCmdActorAction* npcAction, Vec3f* pos) { @@ -343,12 +343,12 @@ void func_80B4B834(CsCmdActorAction* npcAction, Vec3f* pos) { pos->z = npcAction->endPos.z; } -void func_80B4B874(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4B874(EnZl1* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4B8B4(EnZl1* this, PlayState* play) { AnimationHeader* spB0[] = { NULL, NULL, @@ -377,13 +377,13 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { Vec3f sp48; SkelAnime_Update(&this->skelAnime); - func_80B4B874(this, globalCtx); - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + func_80B4B874(this, play); + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = func_80B4BBC4; return; } - npcAction = globalCtx->csCtx.npcActions[0]; + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { func_80B4B7F4(npcAction, &sp74); func_80B4B834(npcAction, &sp68); @@ -399,7 +399,7 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { this->unk_1E6 = npcAction->action; } this->actor.velocity = velocity; - if (globalCtx->csCtx.frames < npcAction->endFrame) { + if (play->csCtx.frames < npcAction->endFrame) { actionLength = npcAction->endFrame - npcAction->startFrame; this->actor.velocity.x = (sp68.x - sp74.x) / actionLength; this->actor.velocity.y = (sp68.y - sp74.y) / actionLength; @@ -409,27 +409,27 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { } this->actor.velocity.z = (sp68.z - sp74.z) / actionLength; } - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); - Gameplay_CameraSetAtEye(globalCtx, this->unk_1E8, &sp98, &sp8C); - Gameplay_CameraSetFov(globalCtx, this->unk_1E8, 70.0f); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + Play_CameraSetAtEye(play, this->unk_1E8, &sp98, &sp8C); + Play_CameraSetFov(play, this->unk_1E8, 70.0f); } } -void func_80B4BBC4(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4BBC4(EnZl1* this, PlayState* play) { s32 pad; f32 frameCount = Animation_GetLastFrame(&gChildZelda1Anim_00438); - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); func_8002F7DC(&player->actor, NA_SE_VO_LI_SURPRISE_KID); this->actor.textId = 0x7039; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1E2 = 0; this->actionFunc = func_80B4BF2C; } -void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4BC78(EnZl1* this, PlayState* play) { AnimationHeader* sp90[] = { NULL, NULL, @@ -458,8 +458,8 @@ void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { frameCount = Animation_GetLastFrame(&gChildZelda1Anim_11348); Animation_Change(&this->skelAnime, &gChildZelda1Anim_11348, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, -10.0f); } - func_80B4B874(this, globalCtx); - npcAction = globalCtx->csCtx.npcActions[0]; + func_80B4B874(this, play); + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { func_80B4B7F4(npcAction, &sp70); func_80B4B834(npcAction, &sp64); @@ -474,7 +474,7 @@ void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { this->unk_1E6 = npcAction->action; } this->actor.velocity = velocity; - if (globalCtx->csCtx.frames < npcAction->endFrame) { + if (play->csCtx.frames < npcAction->endFrame) { actionLength = npcAction->endFrame - npcAction->startFrame; this->actor.velocity.x = (sp64.x - sp70.x) / actionLength; this->actor.velocity.y = (sp64.y - sp70.y) / actionLength; @@ -487,51 +487,51 @@ void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { } } -void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4BF2C(EnZl1* this, PlayState* play) { s32 pad; - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); switch (this->unk_1E2) { case 0: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { this->actor.textId = 0x703B; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } else { this->actor.textId = 0x703A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2 = 0; } } break; case 1: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0xFFFF; - globalCtx->talkWithPlayer(globalCtx, &this->actor); - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, 120.0f, 10.0f); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + play->talkWithPlayer(play, &this->actor); + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, 120.0f, 10.0f); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; this->unk_1E2++; } else { break; } case 2: - if (Actor_HasParent(&this->actor, globalCtx)) { - Gameplay_CopyCamera(globalCtx, MAIN_CAM, this->unk_1E8); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->unk_1E8); + if (Actor_HasParent(&this->actor, play)) { + Play_CopyCamera(play, MAIN_CAM, this->unk_1E8); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->unk_1E8); this->actor.parent = NULL; this->unk_1E2++; } else { - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, 120.0f, 10.0f); + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, 120.0f, 10.0f); } break; case 3: - if ((Message_GetState(msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actor.textId = 0x703C; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); Flags_SetEventChkInf(0x40); this->unk_1E2 = 6; } @@ -540,42 +540,42 @@ void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) { if (player->actor.world.pos.y < this->actor.world.pos.y) { break; } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_1E2++; } else { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } break; case 5: - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1E2--; } break; case 6: - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - func_8002DF54(globalCtx, &this->actor, 7); + if (Actor_TextboxIsClosing(&this->actor, play)) { + func_8002DF54(play, &this->actor, 7); Interface_ChangeAlpha(50); this->actor.flags &= ~ACTOR_FLAG_8; this->unk_1E2 = 4; } break; } - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); } -void EnZl1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Update(Actor* thisx, PlayState* play) { s32 pad; EnZl1* this = (EnZl1*)thisx; if ((this->actionFunc != func_80B4B8B4) && (this->actionFunc != func_80B4BC78)) { SkelAnime_Update(&this->skelAnime); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 5); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 5); + this->actionFunc(this, play); if (this->actionFunc != func_80B4B8B4) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x, 0xA, 0x3E8, 1); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 0xA, 0x3E8, 1); @@ -583,7 +583,7 @@ void EnZl1_Update(Actor* thisx, GlobalContext* globalCtx) { func_80B4AE18(this); } -s32 EnZl1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnZl1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnZl1* this = (EnZl1*)thisx; if ((limbIndex == 4) || (limbIndex == 3) || (limbIndex == 6) || (limbIndex == 5)) { @@ -604,7 +604,7 @@ s32 EnZl1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnZl1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnZl1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f vec = { 0.0f, 0.0f, 0.0f }; EnZl1* this = (EnZl1*)thisx; @@ -613,18 +613,18 @@ void EnZl1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnZl1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Draw(Actor* thisx, PlayState* play) { EnZl1* this = (EnZl1*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(this->unk_1F4)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(this->unk_1F8)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(this->unk_1EC)); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnZl1_OverrideLimbDraw, EnZl1_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h index 59ca2fd9e..8971f6911 100644 --- a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h +++ b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h @@ -6,7 +6,7 @@ struct EnZl1; -typedef void (*EnZl1ActionFunc)(struct EnZl1*, GlobalContext*); +typedef void (*EnZl1ActionFunc)(struct EnZl1*, PlayState*); typedef struct EnZl1 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 802e38278..bb60e362b 100644 --- a/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -13,52 +13,52 @@ #define FLAGS ACTOR_FLAG_4 -void EnZl2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZl2_Init(Actor* thisx, PlayState* play); +void EnZl2_Destroy(Actor* thisx, PlayState* play); +void EnZl2_Update(Actor* thisx, PlayState* play); +void EnZl2_Draw(Actor* thisx, PlayState* play); -s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx); +s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx); -void func_80B50BBC(EnZl2* this, GlobalContext* globalCtx); -void func_80B50BEC(EnZl2* this, GlobalContext* globalCtx); -void func_80B50C40(EnZl2* this, GlobalContext* globalCtx); -void func_80B50CA8(EnZl2* this, GlobalContext* globalCtx); -void func_80B50CFC(EnZl2* this, GlobalContext* globalCtx); -void func_80B50D50(EnZl2* this, GlobalContext* globalCtx); -void func_80B50D94(EnZl2* this, GlobalContext* globalCtx); -void func_80B50DE8(EnZl2* this, GlobalContext* globalCtx); -void func_80B50E3C(EnZl2* this, GlobalContext* globalCtx); -void func_80B50E90(EnZl2* this, GlobalContext* globalCtx); -void func_80B50EE4(EnZl2* this, GlobalContext* globalCtx); -void func_80B50F38(EnZl2* this, GlobalContext* globalCtx); -void func_80B50F8C(EnZl2* this, GlobalContext* globalCtx); -void func_80B50FE8(EnZl2* this, GlobalContext* globalCtx); -void func_80B51034(EnZl2* this, GlobalContext* globalCtx); -void func_80B51080(EnZl2* this, GlobalContext* globalCtx); -void func_80B510CC(EnZl2* this, GlobalContext* globalCtx); -void func_80B51118(EnZl2* this, GlobalContext* globalCtx); -void func_80B51164(EnZl2* this, GlobalContext* globalCtx); -void func_80B511B0(EnZl2* this, GlobalContext* globalCtx); -void func_80B511FC(EnZl2* this, GlobalContext* globalCtx); -void func_80B51250(EnZl2* this, GlobalContext* globalCtx); -void func_80B512B8(EnZl2* this, GlobalContext* globalCtx); -void func_80B51310(EnZl2* this, GlobalContext* globalCtx); -void func_80B51A5C(EnZl2* this, GlobalContext* globalCtx); -void func_80B51A8C(EnZl2* this, GlobalContext* globalCtx); -void func_80B51AE4(EnZl2* this, GlobalContext* globalCtx); -void func_80B51B44(EnZl2* this, GlobalContext* globalCtx); -void func_80B51BA8(EnZl2* this, GlobalContext* globalCtx); -void func_80B51C0C(EnZl2* this, GlobalContext* globalCtx); -void func_80B51C64(EnZl2* this, GlobalContext* globalCtx); -void func_80B51CA8(EnZl2* this, GlobalContext* globalCtx); -void func_80B52068(EnZl2* this, GlobalContext* globalCtx); -void func_80B52098(EnZl2* this, GlobalContext* globalCtx); -void func_80B52108(EnZl2* this, GlobalContext* globalCtx); -void func_80B521A0(EnZl2* this, GlobalContext* globalCtx); -void func_80B523BC(EnZl2* this, GlobalContext* globalCtx); -void func_80B523C8(EnZl2* this, GlobalContext* globalCtx); -void func_80B525D4(EnZl2* this, GlobalContext* globalCtx); +void func_80B50BBC(EnZl2* this, PlayState* play); +void func_80B50BEC(EnZl2* this, PlayState* play); +void func_80B50C40(EnZl2* this, PlayState* play); +void func_80B50CA8(EnZl2* this, PlayState* play); +void func_80B50CFC(EnZl2* this, PlayState* play); +void func_80B50D50(EnZl2* this, PlayState* play); +void func_80B50D94(EnZl2* this, PlayState* play); +void func_80B50DE8(EnZl2* this, PlayState* play); +void func_80B50E3C(EnZl2* this, PlayState* play); +void func_80B50E90(EnZl2* this, PlayState* play); +void func_80B50EE4(EnZl2* this, PlayState* play); +void func_80B50F38(EnZl2* this, PlayState* play); +void func_80B50F8C(EnZl2* this, PlayState* play); +void func_80B50FE8(EnZl2* this, PlayState* play); +void func_80B51034(EnZl2* this, PlayState* play); +void func_80B51080(EnZl2* this, PlayState* play); +void func_80B510CC(EnZl2* this, PlayState* play); +void func_80B51118(EnZl2* this, PlayState* play); +void func_80B51164(EnZl2* this, PlayState* play); +void func_80B511B0(EnZl2* this, PlayState* play); +void func_80B511FC(EnZl2* this, PlayState* play); +void func_80B51250(EnZl2* this, PlayState* play); +void func_80B512B8(EnZl2* this, PlayState* play); +void func_80B51310(EnZl2* this, PlayState* play); +void func_80B51A5C(EnZl2* this, PlayState* play); +void func_80B51A8C(EnZl2* this, PlayState* play); +void func_80B51AE4(EnZl2* this, PlayState* play); +void func_80B51B44(EnZl2* this, PlayState* play); +void func_80B51BA8(EnZl2* this, PlayState* play); +void func_80B51C0C(EnZl2* this, PlayState* play); +void func_80B51C64(EnZl2* this, PlayState* play); +void func_80B51CA8(EnZl2* this, PlayState* play); +void func_80B52068(EnZl2* this, PlayState* play); +void func_80B52098(EnZl2* this, PlayState* play); +void func_80B52108(EnZl2* this, PlayState* play); +void func_80B521A0(EnZl2* this, PlayState* play); +void func_80B523BC(EnZl2* this, PlayState* play); +void func_80B523C8(EnZl2* this, PlayState* play); +void func_80B525D4(EnZl2* this, PlayState* play); static void* sEyeTextures[] = { gZelda2EyeOpenTex, gZelda2EyeHalfTex, gZelda2EyeShutTex, gZelda2Eye03Tex, gZelda2Eye04Tex, gZelda2Eye05Tex, @@ -98,10 +98,10 @@ const ActorInit En_Zl2_InitVars = { NULL, }; -void EnZl2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Destroy(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void EnZl2_UpdateEyes(EnZl2* this) { @@ -203,23 +203,23 @@ void EnZl2_setMouthIndex(EnZl2* this, s16 index) { this->mouthTexIndex = index; } -void func_80B4ED2C(EnZl2* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void func_80B4ED2C(EnZl2* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } s32 EnZl2_UpdateSkelAnime(EnZl2* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnZl2_GetNpcAction(GlobalContext* globalCtx, s32 idx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[idx]; +CsCmdActorAction* EnZl2_GetNpcAction(PlayState* play, s32 idx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[idx]; } return NULL; } -void func_80B4EDB8(EnZl2* this, GlobalContext* globalCtx, s32 arg2) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, arg2); +void func_80B4EDB8(EnZl2* this, PlayState* play, s32 arg2) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, arg2); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -433,7 +433,7 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { this->unk_20C[arg2] = arg1; } -s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { s32 pad; EnZl2* this = (EnZl2*)thisx; @@ -444,7 +444,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p s16* unk_1DC = this->unk_1DC; if (limbIndex == 14) { - sp74 = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 7); + sp74 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); gSPSegment((*gfx)++, 0x0C, sp74); Matrix_Push(); @@ -454,7 +454,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 0); func_80B4F230(this, sp2C.x, 1); func_80B4EF64(this, sp2C.z, 2); @@ -464,7 +464,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp74[0]); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 3); func_80B4F230(this, sp2C.x, 4); } @@ -473,7 +473,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp74[1]); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 6); func_80B4F230(this, sp2C.x, 7); } @@ -485,7 +485,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 9); func_80B4F230(this, sp2C.x, 10); func_80B4EF64(this, sp2C.z, 11); @@ -495,7 +495,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp74[3]); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 12); func_80B4F230(this, sp2C.x, 13); func_80B4EF64(this, sp2C.z, 14); @@ -508,7 +508,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 15); func_80B4F230(this, sp2C.x, 16); func_80B4EF64(this, sp2C.z, 17); @@ -518,7 +518,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp74[5]); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 18); func_80B4F230(this, sp2C.x, 19); func_80B4EF64(this, sp2C.z, 20); @@ -533,24 +533,24 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnZl2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl2* this = (EnZl2*)thisx; s32 pad[2]; if (limbIndex == 10) { - if ((this->unk_254 != 0) && (globalCtx->csCtx.frames >= 900)) { + if ((this->unk_254 != 0) && (play->csCtx.frames >= 900)) { gSPDisplayList((*gfx)++, gZelda2OcarinaDL); } { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Matrix_Push(); if (player->rightHandType == 0xFF) { Matrix_Put(&player->shieldMf); Matrix_Translate(180.0f, 979.0f, -375.0f, MTXMODE_APPLY); Matrix_RotateZYX(-0x5DE7, -0x53E9, 0x3333, MTXMODE_APPLY); Matrix_Scale(1.2f, 1.2f, 1.2f, MTXMODE_APPLY); - gSPMatrix((*gfx)++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix((*gfx)++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, gZelda2OcarinaDL); } @@ -559,10 +559,10 @@ void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void func_80B4FCCC(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FCCC(EnZl2* this, PlayState* play) { s32 unk_274 = this->unk_274; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[unk_274].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[unk_274].segment); } void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 transitionRate, s32 arg4) { @@ -584,7 +584,7 @@ void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 transit Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, transitionRate); } -void func_80B4FD90(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FD90(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00B5FC, 0, 0.0f, 0); this->action = 1; } @@ -595,8 +595,8 @@ void func_80B4FDD4(EnZl2* this) { } } -void func_80B4FE10(GlobalContext* globalCtx) { - if ((globalCtx->csCtx.frames >= 830) && (globalCtx->csCtx.frames < 1081)) { +void func_80B4FE10(PlayState* play) { + if ((play->csCtx.frames >= 830) && (play->csCtx.frames < 1081)) { func_800788CC(NA_SE_EV_EARTHQUAKE - SFX_FLAG); } } @@ -621,24 +621,24 @@ void func_80B4FED8(EnZl2* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_Z1_CRY_0); } -void EnZl2_GiveLightArrows(EnZl2* this, GlobalContext* globalCtx) { +void EnZl2_GiveLightArrows(EnZl2* this, PlayState* play) { Player* player; f32 posX; f32 posY; f32 posZ; if (this->unk_244 == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); posX = player->actor.world.pos.x; posY = player->actor.world.pos.y + 80.0f; posZ = player->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0x17); - Item_Give(globalCtx, ITEM_ARROW_LIGHT); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0x17); + Item_Give(play, ITEM_ARROW_LIGHT); this->unk_244 = 1; } } -void func_80B4FF84(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FF84(EnZl2* this, PlayState* play) { f32 posX; f32 posY; f32 posZ; @@ -648,12 +648,12 @@ void func_80B4FF84(EnZl2* this, GlobalContext* globalCtx) { posY = this->actor.world.pos.y; posZ = this->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_YELLOW); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_YELLOW); this->unk_250 = 1; } } -void func_80B4FFF0(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FFF0(EnZl2* this, PlayState* play) { f32 posX; f32 posY; f32 posZ; @@ -663,7 +663,7 @@ void func_80B4FFF0(EnZl2* this, GlobalContext* globalCtx) { posY = this->actor.world.pos.y + (kREG(5) + -26.0f); posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, 0, WARP_PURPLE_CRYSTAL); this->unk_248 = 1; } @@ -679,8 +679,8 @@ void func_80B5008C(EnZl2* this) { } } -void func_80B500E0(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B500E0(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); Vec3f* thisPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -692,7 +692,7 @@ void func_80B500E0(EnZl2* this, GlobalContext* globalCtx) { if (npcAction != NULL) { someFloat = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 8, 8); + Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 8, 8); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -711,25 +711,25 @@ void func_80B501C4(EnZl2* this, s32 alpha) { } } -void func_80B501E8(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B501E8(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { this->actor.shape.shadowAlpha = this->alpha = - (1.0f - Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames)) * + (1.0f - Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames)) * 255.0f; func_80B501C4(this, this->alpha); } } -void func_80B50260(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50260(EnZl2* this, PlayState* play) { this->action = 1; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; } -void func_80B50278(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B50278(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); this->actor.world.pos.x = npcAction->startPos.x; this->actor.world.pos.y = npcAction->startPos.y; @@ -740,10 +740,10 @@ void func_80B50278(EnZl2* this, GlobalContext* globalCtx) { this->drawConfig = 1; } -void func_80B50304(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50304(EnZl2* this, PlayState* play) { s32 pad[2]; ActorShape* shape = &this->actor.shape; - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); f32 actionXDelta; f32 actionZDelta; @@ -757,15 +757,15 @@ void func_80B50304(EnZl2* this, GlobalContext* globalCtx) { this->actor.world.rot.y = shape->rot.y = Math_FAtan2F(actionXDelta, actionZDelta) * (0x8000 / M_PI); } -void func_80B503DC(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B503DC(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); - if ((npcAction != NULL) && (globalCtx->csCtx.frames >= npcAction->endFrame)) { + if ((npcAction != NULL) && (play->csCtx.frames >= npcAction->endFrame)) { this->action = 4; } } -void func_80B5042C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5042C(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_0022D0, 2, -8.0f, 0); this->action = 5; this->drawConfig = 1; @@ -781,7 +781,7 @@ void func_80B50488(EnZl2* this, s32 arg1) { } } -void func_80B504D4(EnZl2* this, GlobalContext* globalCtx) { +void func_80B504D4(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00325C, 2, -8.0f, 0); this->action = 7; this->drawConfig = 1; @@ -797,7 +797,7 @@ void func_80B5053C(EnZl2* this, s32 arg1) { } } -void func_80B50580(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50580(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_000A50, 2, -8.0f, 0); this->action = 9; this->drawConfig = 1; @@ -811,24 +811,24 @@ void func_80B505D4(EnZl2* this, s32 arg1) { } } -void func_80B50618(EnZl2* this, GlobalContext* globalCtx) { - EnZl2_GiveLightArrows(this, globalCtx); +void func_80B50618(EnZl2* this, PlayState* play) { + EnZl2_GiveLightArrows(this, play); this->action = 11; } -void func_80B50644(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FF84(this, globalCtx); +void func_80B50644(EnZl2* this, PlayState* play) { + func_80B4FF84(this, play); this->action = 12; } -void func_80B50670(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50670(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00B5FC, 0, -8.0f, 0); this->action = 13; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; } -void func_80B506C4(EnZl2* this, GlobalContext* globalCtx) { +void func_80B506C4(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00AAD4, 2, -8.0f, 0); this->action = 14; this->drawConfig = 1; @@ -845,12 +845,12 @@ void func_80B5073C(EnZl2* this, s32 arg1) { } } -void func_80B50780(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50780(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_001670, 2, -8.0f, 0); this->action = 16; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; - func_80B4FFF0(this, globalCtx); + func_80B4FFF0(this, play); EnZl2_setEyesIndex(this, 3); } @@ -861,7 +861,7 @@ void func_80B507E8(EnZl2* this, s32 arg1) { } } -void func_80B5082C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5082C(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_002B14, 2, -8.0f, 0); this->action = 18; this->drawConfig = 1; @@ -876,7 +876,7 @@ void func_80B50880(EnZl2* this, s32 arg1) { } } -void func_80B508C8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B508C8(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_001010, 2, -8.0f, 0); this->action = 20; this->drawConfig = 1; @@ -892,21 +892,21 @@ void func_80B50928(EnZl2* this, s32 arg1) { } } -void func_80B50970(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50970(EnZl2* this, PlayState* play) { this->action = 22; } -void func_80B50980(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50980(EnZl2* this, PlayState* play) { this->action = 23; this->drawConfig = 2; this->alpha = 255; } -void func_80B509A0(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B509A0(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { - if (globalCtx->csCtx.frames >= npcAction->endFrame) { + if (play->csCtx.frames >= npcAction->endFrame) { this->action = 24; this->drawConfig = 0; func_80B4FE6C(this); @@ -914,8 +914,8 @@ void func_80B509A0(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B50A04(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B50A04(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 newAction; s32 unk_240; @@ -925,49 +925,49 @@ void func_80B50A04(EnZl2* this, GlobalContext* globalCtx) { if (newAction != unk_240) { switch (newAction) { case 1: - func_80B50260(this, globalCtx); + func_80B50260(this, play); break; case 2: - func_80B50278(this, globalCtx); + func_80B50278(this, play); break; case 3: - func_80B50304(this, globalCtx); + func_80B50304(this, play); break; case 4: - func_80B5042C(this, globalCtx); + func_80B5042C(this, play); break; case 5: - func_80B504D4(this, globalCtx); + func_80B504D4(this, play); break; case 6: - func_80B50580(this, globalCtx); + func_80B50580(this, play); break; case 7: - func_80B50618(this, globalCtx); + func_80B50618(this, play); break; case 8: - func_80B50670(this, globalCtx); + func_80B50670(this, play); break; case 9: - func_80B506C4(this, globalCtx); + func_80B506C4(this, play); break; case 10: - func_80B50780(this, globalCtx); + func_80B50780(this, play); break; case 11: - func_80B5082C(this, globalCtx); + func_80B5082C(this, play); break; case 12: - func_80B508C8(this, globalCtx); + func_80B508C8(this, play); break; case 13: - func_80B50970(this, globalCtx); + func_80B50970(this, play); break; case 14: - func_80B50980(this, globalCtx); + func_80B50980(this, play); break; case 15: - func_80B50644(this, globalCtx); + func_80B50644(this, play); break; default: osSyncPrintf("En_Zl2_inAgain_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); @@ -977,188 +977,188 @@ void func_80B50A04(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B50BBC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B50A04(this, globalCtx); +void func_80B50BBC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B50A04(this, play); } -void func_80B50BEC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50BEC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50C40(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); +void func_80B50C40(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); func_80B4FDD4(this); - func_80B4ED2C(this, globalCtx); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B500E0(this, globalCtx); - func_80B503DC(this, globalCtx); + func_80B500E0(this, play); + func_80B503DC(this, play); } -void func_80B50CA8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50CA8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50CFC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50CFC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); func_80B4EA40(this); func_80B50488(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B50D50(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50D50(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50D94(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50D94(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); func_80B4EAF4(this); func_80B5053C(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B50DE8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50DE8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50E3C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50E3C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); func_80B505D4(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B50E90(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50E90(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50EE4(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50EE4(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50F38(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50F38(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50F8C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50F8C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50FE8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50FE8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B5073C(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B51034(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51034(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B51080(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51080(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B507E8(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B510CC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B510CC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B51118(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51118(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B50880(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B51164(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51164(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B511B0(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B511B0(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B50928(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B511FC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B511FC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); func_80B5008C(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B51250(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); +void func_80B51250(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); func_80B4FE48(this); - func_80B4ED2C(this, globalCtx); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B500E0(this, globalCtx); + func_80B500E0(this, play); func_80B5008C(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B512B8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B512B8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B501E8(this, globalCtx); - func_80B509A0(this, globalCtx); + func_80B501E8(this, play); + func_80B509A0(this, play); } -void func_80B51310(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51310(EnZl2* this, PlayState* play) { Actor* child; - if (EnZl2_GetNpcAction(globalCtx, 0) == NULL) { + if (EnZl2_GetNpcAction(play, 0) == NULL) { child = this->actor.child; if (child != NULL) { Actor_Kill(child); @@ -1167,44 +1167,44 @@ void func_80B51310(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B5135C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5135C(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00A15C, 0, 0.0f, 0); this->action = 25; this->unk_254 = 1; } -void func_80B513A8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B513A8(EnZl2* this, PlayState* play) { Player* player; f32 posX; f32 posY; f32 posZ; if (this->unk_250 == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); posX = player->actor.world.pos.x; posY = player->actor.world.pos.y; posZ = player->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_UNK_7); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_UNK_7); this->unk_250 = 1; } } -void func_80B51418(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51418(EnZl2* this, PlayState* play) { EnZl2_UpdateEyes(this); - if (globalCtx->csCtx.frames < 431) { + if (play->csCtx.frames < 431) { EnZl2_setMouthIndex(this, 1); } else { EnZl2_setMouthIndex(this, 0); } } -void func_80B5146C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5146C(EnZl2* this, PlayState* play) { func_80B4EA40(this); EnZl2_setMouthIndex(this, 0); } -void func_80B5149C(EnZl2* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames < 988) { +void func_80B5149C(EnZl2* this, PlayState* play) { + if (play->csCtx.frames < 988) { EnZl2_setEyesIndex(this, 7); EnZl2_setEyeIndex2(this, 8); } else { @@ -1213,22 +1213,22 @@ void func_80B5149C(EnZl2* this, GlobalContext* globalCtx) { EnZl2_setMouthIndex(this, 0); } -void func_80B514F8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B514F8(EnZl2* this, PlayState* play) { EnZl2_UpdateEyes(this); - if (globalCtx->csCtx.frames < 1190) { + if (play->csCtx.frames < 1190) { EnZl2_setMouthIndex(this, 1); } else { EnZl2_setMouthIndex(this, 0); } } -void func_80B5154C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5154C(EnZl2* this, PlayState* play) { CutsceneContext* csCtx; if (this->skelAnime.mode != 0) { EnZl2_UpdateEyes(this); } else { - csCtx = &globalCtx->csCtx; + csCtx = &play->csCtx; if (csCtx->frames < 0x5F0) { func_80B4EBB8(this); } else if (csCtx->frames == 0x5F0) { @@ -1245,9 +1245,9 @@ void func_80B515C4(EnZl2* this) { this->actor.shape.shadowAlpha = 0; } -void func_80B515D8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B515D8(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00A15C, 0, -8.0f, 0); - func_80B4EDB8(this, globalCtx, 0); + func_80B4EDB8(this, play, 0); this->action = 26; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; @@ -1325,8 +1325,8 @@ void func_80B518C0(EnZl2* this) { this->unk_27C = 0.0f; } -void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51948(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 newAction; s32 unk_240; @@ -1339,7 +1339,7 @@ void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { func_80B515C4(this); break; case 2: - func_80B515D8(this, globalCtx); + func_80B515D8(this, play); break; case 16: func_80B51678(this); @@ -1357,7 +1357,7 @@ void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { func_80B518C0(this); break; case 21: - func_80B513A8(this, globalCtx); + func_80B513A8(this, play); break; default: osSyncPrintf("En_Zl2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); @@ -1367,72 +1367,72 @@ void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B51A5C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B51948(this, globalCtx); +void func_80B51A5C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B51948(this, play); } -void func_80B51A8C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B51418(this, globalCtx); +void func_80B51A8C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B51418(this, play); EnZl2_UpdateSkelAnime(this); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51AE4(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51AE4(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); func_80B51644(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51B44(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B5149C(this, globalCtx); +void func_80B51B44(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B5149C(this, play); func_80B516D0(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51BA8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B514F8(this, globalCtx); +void func_80B51BA8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B514F8(this, play); func_80B5175C(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51C0C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B5146C(this, globalCtx); +void func_80B51C0C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B5146C(this, play); func_80B517E0(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B51C64(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51C64(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51CA8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B5154C(this, globalCtx); +void func_80B51CA8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B5154C(this, play); func_80B5187C(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51D0C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51D0C(EnZl2* this, PlayState* play) { this->action = 33; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; } -void func_80B51D24(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51D24(EnZl2* this, PlayState* play) { s32 pad[2]; u32 sfxId; SkelAnime* skelAnime = &this->skelAnime; @@ -1440,14 +1440,14 @@ void func_80B51D24(EnZl2* this, GlobalContext* globalCtx) { if (Animation_OnFrame(skelAnime, 6.0f) || Animation_OnFrame(skelAnime, 0.0f)) { if (this->actor.bgCheckFlags & 1) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } } -void func_80B51DA4(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51DA4(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); Vec3f* thisPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -1459,7 +1459,7 @@ void func_80B51DA4(EnZl2* this, GlobalContext* globalCtx) { if (npcAction != NULL) { someFloat = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 0, 8); + Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 0, 8); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -1469,7 +1469,7 @@ void func_80B51DA4(EnZl2* this, GlobalContext* globalCtx) { thisPos->x = ((endX - startX) * someFloat) + startX; thisPos->y = ((endY - startY) * someFloat) + startY; thisPos->z = ((endZ - startZ) * someFloat) + startZ; - if (npcAction->endFrame < globalCtx->csCtx.frames) { + if (npcAction->endFrame < play->csCtx.frames) { Actor_Kill(&this->actor); } } @@ -1481,9 +1481,9 @@ void func_80B51EA8(EnZl2* this) { this->actor.shape.shadowAlpha = 0; } -void func_80B51EBC(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51EBC(EnZl2* this, PlayState* play) { ActorShape* shape = &this->actor.shape; - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 pad[2]; this->actor.world.rot.y = shape->rot.y = npcAction->rot.y; @@ -1493,19 +1493,19 @@ void func_80B51EBC(EnZl2* this, GlobalContext* globalCtx) { shape->shadowAlpha = 255; } -void func_80B51F38(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51F38(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { - if (globalCtx->csCtx.frames - 8 >= npcAction->endFrame) { + if (play->csCtx.frames - 8 >= npcAction->endFrame) { func_80B4FD00(this, &gZelda2Anime1Anim_00B5FC, 0, -8.0f, 0); this->action = 35; } } } -void func_80B51FA8(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51FA8(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 action; s32 unk_240; @@ -1518,7 +1518,7 @@ void func_80B51FA8(EnZl2* this, GlobalContext* globalCtx) { func_80B51EA8(this); break; case 2: - func_80B51EBC(this, globalCtx); + func_80B51EBC(this, play); break; case 14: Actor_Kill(&this->actor); @@ -1532,44 +1532,44 @@ void func_80B51FA8(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B52068(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B51FA8(this, globalCtx); +void func_80B52068(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B51FA8(this, play); } -void func_80B52098(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B52098(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B51D24(this, globalCtx); - func_80B51F38(this, globalCtx); - func_80B51DA4(this, globalCtx); + func_80B51D24(this, play); + func_80B51F38(this, play); + func_80B51DA4(this, play); } -void func_80B52108(EnZl2* this, GlobalContext* globalCtx) { +void func_80B52108(EnZl2* this, PlayState* play) { } -void func_80B52114(EnZl2* this, GlobalContext* globalCtx) { +void func_80B52114(EnZl2* this, PlayState* play) { switch (this->actor.params) { case 1: - func_80B5135C(this, globalCtx); + func_80B5135C(this, play); break; case 4: - func_80B51D0C(this, globalCtx); + func_80B51D0C(this, play); break; case 0: - func_80B4FD90(this, globalCtx); + func_80B4FD90(this, play); break; default: osSyncPrintf(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); - func_80B4FD90(this, globalCtx); + func_80B4FD90(this, play); } } -void func_80B521A0(EnZl2* this, GlobalContext* globalCtx) { +void func_80B521A0(EnZl2* this, PlayState* play) { s32 pad; - ObjectContext* objectCtx = &globalCtx->objectCtx; + ObjectContext* objectCtx = &play->objectCtx; s32 bankIndex = Object_GetIndex(objectCtx, OBJECT_ZL2_ANIME1); s32 pad2; @@ -1580,30 +1580,30 @@ void func_80B521A0(EnZl2* this, GlobalContext* globalCtx) { if (Object_IsLoaded(objectCtx, bankIndex)) { this->unk_274 = bankIndex; - func_80B4FCCC(this, globalCtx); + func_80B4FCCC(this, play); this->unk_278 = Animation_GetLastFrame(&gZelda2Anime1Anim_0022D0); - func_80B52114(this, globalCtx); + func_80B52114(this, play); } } -void EnZl2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Update(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; if (this->action < 0 || this->action >= 0x24 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnZl2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Init(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; ActorShape* shape = &thisx->shape; s32 pad; ActorShape_Init(shape, 0.0f, ActorShadow_DrawCircle, 30.0f); shape->shadowAlpha = 0; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZelda2Skel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gZelda2Skel, NULL, NULL, NULL, 0); switch (thisx->params) { case 1: @@ -1615,7 +1615,7 @@ void EnZl2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnZl2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnZl2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl2* this = (EnZl2*)thisx; @@ -1624,13 +1624,13 @@ s32 EnZl2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, osSyncPrintf(VT_FGCOL(RED) "描画前処理モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return 0; } - return sOverrideLimbDrawFuncs[this->overrideLimbDrawConfig](globalCtx, limbIndex, dList, pos, rot, thisx, gfx); + return sOverrideLimbDrawFuncs[this->overrideLimbDrawConfig](play, limbIndex, dList, pos, rot, thisx, gfx); } -void func_80B523BC(EnZl2* this, GlobalContext* globalCtx) { +void func_80B523BC(EnZl2* this, PlayState* play) { } -void func_80B523C8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B523C8(EnZl2* this, PlayState* play) { s32 pad[3]; s16 eyeTexIndex = this->eyeTexIndex; s16 eyeTexIndex2 = this->eyeTexIndex2; @@ -1641,9 +1641,9 @@ void func_80B523C8(EnZl2* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex2)); @@ -1651,13 +1651,13 @@ void func_80B523C8(EnZl2* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0B, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl2_OverrideLimbDraw, EnZl2_PostLimbDraw, this, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { +void func_80B525D4(EnZl2* this, PlayState* play) { s32 pad[2]; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTex = sEyeTextures[eyeTexIndex]; @@ -1666,9 +1666,9 @@ void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -1676,18 +1676,18 @@ void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0B, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl2_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnZl2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Draw(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; if ((this->drawConfig < 0) || (this->drawConfig >= 3) || (sDrawFuncs[this->drawConfig] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h b/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h index acc850b9f..24ba15405 100644 --- a/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h +++ b/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h @@ -6,8 +6,8 @@ struct EnZl2; -typedef void (*EnZl2ActionFunc)(struct EnZl2*, GlobalContext*); -typedef void (*EnZl2DrawFunc)(struct EnZl2*, GlobalContext*); +typedef void (*EnZl2ActionFunc)(struct EnZl2*, PlayState*); +typedef void (*EnZl2DrawFunc)(struct EnZl2*, PlayState*); typedef struct EnZl2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index d9fb860ad..fc77c5695 100644 --- a/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -14,11 +14,11 @@ #define FLAGS ACTOR_FLAG_4 -void EnZl3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl3_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80B59AD0(EnZl3* this, GlobalContext* globalCtx); +void EnZl3_Init(Actor* thisx, PlayState* play); +void EnZl3_Destroy(Actor* thisx, PlayState* play); +void EnZl3_Update(Actor* thisx, PlayState* play); +void EnZl3_Draw(Actor* thisx, PlayState* play); +void func_80B59AD0(EnZl3* this, PlayState* play); void EnZl3_Reset(void); static ColliderCylinderInitType1 sCylinderInit = { @@ -65,34 +65,34 @@ static Vec3f D_80B5A4B0 = { 42.0f, 260.0f, 13.0f }; u32 D_80B5A4BC = 0; -void func_80B533B0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B533B0(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void func_80B533FC(EnZl3* this, GlobalContext* globalCtx) { +void func_80B533FC(EnZl3* this, PlayState* play) { ColliderCylinder* collider = &this->collider; s32 pad[4]; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); } -void EnZl3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Destroy(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80B53468(void) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ESCAPE); } -BossGanon2* func_80B53488(EnZl3* this, GlobalContext* globalCtx) { +BossGanon2* func_80B53488(EnZl3* this, PlayState* play) { if (this->ganon == NULL) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actorIt != NULL) { if (actorIt->id == ACTOR_BOSS_GANON2) { @@ -127,22 +127,22 @@ void EnZl3_setMouthIndex(EnZl3* this, s16 index) { this->mouthTexIndex = index; } -void func_80B5357C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5357C(EnZl3* this, PlayState* play) { Vec3f* thisPos = &this->actor.world.pos; Vec3f sp20; sp20.x = thisPos->x + ((Rand_ZeroOne() - 0.5f) * 10.0f); sp20.y = thisPos->y; sp20.z = thisPos->z + ((Rand_ZeroOne() - 0.5f) * 10.0f); - Item_DropCollectible(globalCtx, &sp20, 3); + Item_DropCollectible(play, &sp20, 3); } -void func_80B53614(EnZl3* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_RIVER_SOUND, -442.0f, 4102.0f, -371.0f, 0, 0, 0, 0x12); +void func_80B53614(EnZl3* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RIVER_SOUND, -442.0f, 4102.0f, -371.0f, 0, 0, 0, 0x12); } -void func_80B5366C(EnZl3* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); +void func_80B5366C(EnZl3* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } void func_80B536B4(EnZl3* this) { @@ -160,8 +160,8 @@ void func_80B536C4(EnZl3* this) { Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100); } -void func_80B53764(EnZl3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B53764(EnZl3* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_3F8.unk_18 = player->actor.world.pos; this->unk_3F8.unk_14 = kREG(16) - 16.0f; @@ -595,7 +595,7 @@ void func_80B54360(EnZl3* this, s16 arg1, s32 arg2) { this->unk_2BC[arg2] = arg1; } -s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { s32 pad[3]; EnZl3* this = (EnZl3*)thisx; @@ -607,7 +607,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Vec3s* unk_3F8_unk_0E = &this->unk_3F8.unk_0E; if (limbIndex == 14) { - sp78 = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 7); + sp78 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); rot->x += unk_3F8_unk_08->y; rot->z += unk_3F8_unk_08->x; gSPSegment((*gfx)++, 0x0C, sp78); @@ -619,7 +619,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 0); func_80B54360(this, sp30.x, 1); func_80B53B64(this, sp30.z, 2); @@ -629,7 +629,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp78[0]); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 3); } Matrix_RotateZYX(unk_28C[3] + kREG(34), unk_28C[4] + kREG(35), unk_28C[5] + kREG(36), MTXMODE_APPLY); @@ -637,7 +637,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp78[1]); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B54360(this, sp30.x, 7); } Matrix_RotateZYX(unk_28C[6] + kREG(37), unk_28C[7] + kREG(38), unk_28C[8] + kREG(39), MTXMODE_APPLY); @@ -648,7 +648,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 9); func_80B54360(this, sp30.x, 10); func_80B53B64(this, sp30.z, 11); @@ -658,7 +658,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp78[3]); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 12); func_80B54360(this, sp30.x, 13); func_80B53B64(this, sp30.z, 14); @@ -671,7 +671,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 15); func_80B54360(this, sp30.x, 16); func_80B53B64(this, sp30.z, 17); @@ -681,7 +681,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p MATRIX_TOMTX(&sp78[5]); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 18); func_80B54360(this, sp30.x, 19); func_80B53B64(this, sp30.z, 20); @@ -699,7 +699,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnZl3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnZl3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl3* this = (EnZl3*)thisx; s32 pad; Vec3f sp34; @@ -740,10 +740,10 @@ s32 func_80B54DD4(EnZl3* this) { return params & 0xF; } -void func_80B54DE0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54DE0(EnZl3* this, PlayState* play) { s32 idx = this->unk_318; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[idx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[idx].segment); } void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 transitionRate, s32 arg4) { @@ -765,38 +765,38 @@ void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 transit Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, transitionRate); } -void func_80B54EA4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54EA4(EnZl3* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EG, posX, posY, posZ, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EG, posX, posY, posZ, 0, 0, 0, 0); } void func_80B54EF4(EnZl3* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_Z1_PAIN); } -void func_80B54F18(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54F18(EnZl3* this, PlayState* play) { if (this->unk_2F8 == 0) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y + (kREG(5) + -26.0f); f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, 0, WARP_PURPLE_CRYSTAL); this->unk_2F8 = 1; } } -void func_80B54FB4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54FB4(EnZl3* this, PlayState* play) { osSyncPrintf("ゼルダ姫のEn_Zl3_Actor_inFinal_Init通すよ!!!!!!!!!!!!!!!!!!!!!!!!!\n"); func_80B54E14(this, &gZelda2Anime2Anim_008AD0, 0, 0.0f, 0); EnZl3_setEyeIndex(this, 4); EnZl3_setMouthIndex(this, 2); this->action = 1; this->drawConfig = 1; - func_80B54F18(this, globalCtx); + func_80B54F18(this, play); this->actor.shape.rot.z = 0; this->unk_3C4 = this->actor.world.rot.z; this->actor.world.rot.z = this->actor.shape.rot.z; @@ -893,8 +893,8 @@ void func_80B553B4(EnZl3* this, s32 arg1) { } } -void func_80B553E8(EnZl3* this, GlobalContext* globalCtx) { - func_80B59AD0(this, globalCtx); +void func_80B553E8(EnZl3* this, PlayState* play) { + func_80B59AD0(this, play); } void func_80B55408(EnZl3* this) { @@ -906,7 +906,7 @@ void func_80B55408(EnZl3* this) { Actor_Kill(&this->actor); } -void func_80B55444(EnZl3* this, GlobalContext* globalCtx) { +void func_80B55444(EnZl3* this, PlayState* play) { s32 temp_v0 = func_80B5396C(this); if (temp_v0 >= 0) { @@ -934,7 +934,7 @@ void func_80B55444(EnZl3* this, GlobalContext* globalCtx) { func_80B55368(this); break; case 7: - func_80B553E8(this, globalCtx); + func_80B553E8(this, play); break; case 2: func_80B55408(this); @@ -949,57 +949,57 @@ void func_80B55444(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B55550(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B55550(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateSkelAnime(this); func_80B550F0(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B555A4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B555A4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_setEyeIndex(this, 2); func_80B550F0(this); func_80B55054(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B55604(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B55604(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); func_80B55144(this); func_80B552A8(this, EnZl3_UpdateSkelAnime(this)); func_80B55054(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B5566C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5566C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55334(this, EnZl3_UpdateSkelAnime(this)); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B556CC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B556CC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B553B4(this, EnZl3_UpdateSkelAnime(this)); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B5572C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5572C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B55780(EnZl3* this, GlobalContext* globalCtx) { +void func_80B55780(EnZl3* this, PlayState* play) { osSyncPrintf("ゼルダ姫のEn_Zl3_Actor_inFinal2_Init通すよ!!!!!!!!!!!!!!!!!!!!!!!!!\n"); func_80B54E14(this, &gZelda2Anime2Anim_005A0C, 0, 0.0f, 0); this->action = 7; @@ -1048,8 +1048,8 @@ void func_80B559C4(EnZl3* this) { thisPos->z = unk_32C->z + (temp_f0 * (unk_338->z - unk_32C->z)); } -void func_80B55A58(EnZl3* this, GlobalContext* globalCtx) { - if (globalCtx->activeCamera == MAIN_CAM) { +void func_80B55A58(EnZl3* this, PlayState* play) { + if (play->activeCamera == MAIN_CAM) { func_80B537E8(this); } } @@ -1113,22 +1113,22 @@ void func_80B55CCC(EnZl3* this, s32 arg1) { } } -void func_80B55D00(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B55D00(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = 13; } else if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.flags |= ACTOR_FLAG_0; this->actor.textId = 0x70D5; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; } } -void func_80B55DB0(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B55DB0(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; this->action = 12; @@ -1169,17 +1169,17 @@ void func_80B55F38(EnZl3* this, s32 arg1) { } } -void func_80B55F6C(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B55F6C(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = 0x12; } else if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) { - BossGanon2* bossGanon2 = func_80B53488(this, globalCtx); + BossGanon2* bossGanon2 = func_80B53488(this, play); if ((bossGanon2 != NULL) && (bossGanon2->unk_324 <= (10.0f / 81.0f))) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.flags |= ACTOR_FLAG_0; this->actor.textId = 0x7059; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } else { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); @@ -1206,8 +1206,8 @@ void func_80B56090(EnZl3* this, s32 arg1) { } } -void func_80B56108(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B56108(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; this->action = 16; @@ -1230,18 +1230,18 @@ void func_80B561E0(EnZl3* this, s32 arg1) { } } -void func_80B56214(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B56214(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = 21; } else if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) { - BossGanon2* bossGanon2 = func_80B53488(this, globalCtx); + BossGanon2* bossGanon2 = func_80B53488(this, play); if (bossGanon2 != NULL) { if (bossGanon2->unk_324 <= (10.0f / 81.0f)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.flags |= ACTOR_FLAG_0; this->actor.textId = 0x7059; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } else { @@ -1250,8 +1250,8 @@ void func_80B56214(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B562F4(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B562F4(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; this->action = 20; @@ -1291,7 +1291,7 @@ void func_80B56474(EnZl3* this, s32 arg1) { } } -void func_80B564A8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B564A8(EnZl3* this, PlayState* play) { s32 temp_v0; s32* val = &D_80B5A494; @@ -1364,171 +1364,171 @@ void func_80B564A8(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B56658(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56658(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B566AC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B566AC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55B04(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5670C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5670C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55B78(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5676C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5676C(EnZl3* this, PlayState* play) { s32 something; - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); something = EnZl3_UpdateSkelAnime(this); func_80B559C4(this); func_80B55C4C(this, something); } -void func_80B567CC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B567CC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5682C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B55A58(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5682C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B55A58(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55CCC(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); - func_80B55D00(this, globalCtx); + func_80B564A8(this, play); + func_80B55D00(this, play); } -void func_80B568B4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B568B4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B55DB0(this, globalCtx); + func_80B55DB0(this, play); } -void func_80B5691C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5691C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55E48(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5697C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5697C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55EBC(this, EnZl3_UpdateSkelAnime(this)); func_80B5585C(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B569E4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); +void func_80B569E4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); func_80B537E8(this); - func_80B5366C(this, globalCtx); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55F38(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); - func_80B55F6C(this, globalCtx); + func_80B564A8(this, play); + func_80B55F6C(this, play); } -void func_80B56A68(EnZl3* this, GlobalContext* globalCtx) { +void func_80B56A68(EnZl3* this, PlayState* play) { s32 something; - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); + func_80B54DE0(this, play); + func_80B533FC(this, play); func_80B537E8(this); - func_80B5366C(this, globalCtx); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); something = EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); func_80B56090(this, something); } -void func_80B56AE0(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); +void func_80B56AE0(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); func_80B537E8(this); - func_80B5366C(this, globalCtx); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55F38(this, EnZl3_UpdateSkelAnime(this)); - func_80B56108(this, globalCtx); + func_80B56108(this, play); } -void func_80B56B54(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56B54(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B56BA8(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56BA8(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B561E0(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); - func_80B56214(this, globalCtx); + func_80B564A8(this, play); + func_80B56214(this, play); } -void func_80B56C24(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56C24(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B562F4(this, globalCtx); + func_80B562F4(this, play); } -void func_80B56C84(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56C84(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B5638C(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B56CE4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56CE4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B56400(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B56D44(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56D44(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B56474(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } void func_80B56DA4(EnZl3* this) { @@ -1547,29 +1547,29 @@ void func_80B56DEC(EnZl3* this) { } } -void func_80B56E38(EnZl3* this, GlobalContext* globalCtx) { +void func_80B56E38(EnZl3* this, PlayState* play) { s32 pad[2]; s32 sfxId; SkelAnime* sp20 = &this->skelAnime; if ((Animation_OnFrame(sp20, 6.0f) || Animation_OnFrame(sp20, 0.0f)) && (this->actor.bgCheckFlags & 1)) { sfxId = 0x800; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } -void func_80B56EB8(EnZl3* this, GlobalContext* globalCtx) { - Flags_SetSwitch(globalCtx, func_80B54DB4(this)); +void func_80B56EB8(EnZl3* this, PlayState* play) { + Flags_SetSwitch(play, func_80B54DB4(this)); } -s32 func_80B56EE4(EnZl3* this, GlobalContext* globalCtx) { - return Flags_GetSwitch(globalCtx, func_80B54DB4(this)); +s32 func_80B56EE4(EnZl3* this, PlayState* play) { + return Flags_GetSwitch(play, func_80B54DB4(this)); } -void func_80B56F10(EnZl3* this, GlobalContext* globalCtx) { +void func_80B56F10(EnZl3* this, PlayState* play) { s32 waypoint; - Path* pathHead = globalCtx->setupPathList; + Path* pathHead = play->setupPathList; if (pathHead != NULL) { waypoint = func_80B54DC4(this); @@ -1668,8 +1668,8 @@ void func_80B57298(EnZl3* this) { this->actor.shape.rot.y = *rotY; } -u16 func_80B572F0(GlobalContext* globalCtx) { - s16 sceneNum = globalCtx->sceneNum; +u16 func_80B572F0(PlayState* play) { + s16 sceneNum = play->sceneNum; u16 ret; if (sceneNum == SCENE_GANON_SONOGO) { @@ -1682,32 +1682,32 @@ u16 func_80B572F0(GlobalContext* globalCtx) { return ret; } -s32 func_80B57324(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80B57324(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return 1; } return 0; } -void func_80B57350(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57350(EnZl3* this, PlayState* play) { s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(temp_v0) <= 0x4300) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->actor.textId = func_80B572F0(globalCtx); - func_8002F2F4(&this->actor, globalCtx); + this->actor.textId = func_80B572F0(play); + func_8002F2F4(&this->actor, play); } } -s32 func_80B573C8(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s32 func_80B573C8(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 1; } return 0; } -s32 func_80B573FC(EnZl3* this, GlobalContext* globalCtx, f32 arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B573FC(EnZl3* this, PlayState* play, f32 arg2) { + Player* player = GET_PLAYER(play); f32 playerX = player->actor.world.pos.x; f32 playerZ = player->actor.world.pos.z; f32 thisX = this->actor.world.pos.x; @@ -1719,11 +1719,11 @@ s32 func_80B573FC(EnZl3* this, GlobalContext* globalCtx, f32 arg2) { return 0; } -s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57458(EnZl3* this, PlayState* play) { Vec3f* thisPos = &this->actor.world.pos; f32 thisX = thisPos->x; f32 thisZ = thisPos->z; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; s32 pad; f32 playerX = playerPos->x; @@ -1741,30 +1741,30 @@ s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) { if (temp_v0 < 0x1555) { return 1; - } else if ((temp_v0 < 0x4000) && func_80B573FC(this, globalCtx, 150.0f)) { + } else if ((temp_v0 < 0x4000) && func_80B573FC(this, play, 150.0f)) { return 1; } else { return 0; } } -s32 func_80B57564(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B573FC(this, globalCtx, 50.0f) || func_80B57458(this, globalCtx)) { +s32 func_80B57564(EnZl3* this, PlayState* play) { + if (func_80B573FC(this, play, 50.0f) || func_80B57458(this, play)) { return 1; } return 0; } -s32 func_80B575B0(EnZl3* this, GlobalContext* globalCtx) { - return func_80B573FC(this, globalCtx, 150.0f); +s32 func_80B575B0(EnZl3* this, PlayState* play) { + return func_80B573FC(this, play, 150.0f); } -s32 func_80B575D0(EnZl3* this, GlobalContext* globalCtx) { - return func_80B573FC(this, globalCtx, 50.0f); +s32 func_80B575D0(EnZl3* this, PlayState* play) { + return func_80B573FC(this, play, 50.0f); } -s32 func_80B575F0(EnZl3* this, GlobalContext* globalCtx) { - s16 sceneNum = globalCtx->sceneNum; +s32 func_80B575F0(EnZl3* this, PlayState* play) { + s16 sceneNum = play->sceneNum; if ((sceneNum == SCENE_GANON_SONOGO) && (func_80B54DB4(this) == 0x26)) { s32 unk_314 = this->unk_314; @@ -1776,69 +1776,69 @@ s32 func_80B575F0(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B5764C(EnZl3* this, GlobalContext* globalCtx) { - s16 sceneNum = globalCtx->sceneNum; +void func_80B5764C(EnZl3* this, PlayState* play) { + s16 sceneNum = play->sceneNum; if ((sceneNum == SCENE_GANON_SONOGO) && (func_80B54DB4(this) == 0x26)) { s32 unk_314 = this->unk_314 + 1; - if ((unk_314 == 1) && !Gameplay_InCsMode(globalCtx)) { - OnePointCutscene_Init(globalCtx, 1000, 40, &this->actor, MAIN_CAM); + if ((unk_314 == 1) && !Play_InCsMode(play)) { + OnePointCutscene_Init(play, 1000, 40, &this->actor, MAIN_CAM); } } } -s32 func_80B576C8(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B575F0(this, globalCtx) && (this->unk_3D8 == 0)) { +s32 func_80B576C8(EnZl3* this, PlayState* play) { + if (func_80B575F0(this, play) && (this->unk_3D8 == 0)) { return 1; } return 0; } -void func_80B57704(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57704(EnZl3* this, PlayState* play) { s32 unk_3C4 = this->unk_3C4; - Flags_SetSwitch(globalCtx, unk_3C4); + Flags_SetSwitch(play, unk_3C4); } -void func_80B5772C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5772C(EnZl3* this, PlayState* play) { s32 unk_3C4 = this->unk_3C4; - Flags_UnsetSwitch(globalCtx, unk_3C4); + Flags_UnsetSwitch(play, unk_3C4); } -void func_80B57754(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57754(EnZl3* this, PlayState* play) { if (gSaveContext.unk_13F0 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OCEFF_WIPE4, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_OCEFF_WIPE4, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1); func_80B56DA4(this); } } -void func_80B577BC(GlobalContext* globalCtx, Vec3f* vec) { +void func_80B577BC(PlayState* play, Vec3f* vec) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; f32 posX = vec->x; f32 posY = vec->y; f32 posZ = vec->z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, posX, posY, posZ, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TEST, posX, posY, posZ, 0, (Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ) * (0x8000 / M_PI)), 0, 5); } -void func_80B57858(GlobalContext* globalCtx) { - func_80B577BC(globalCtx, &D_80B5A498); - func_80B577BC(globalCtx, &D_80B5A4A4); +void func_80B57858(PlayState* play) { + func_80B577BC(play, &D_80B5A498); + func_80B577BC(play, &D_80B5A4A4); } -s32 func_80B57890(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57890(EnZl3* this, PlayState* play) { s8 pad[2]; - u8 curSpawn = globalCtx->curSpawn; - s16 sceneNum = globalCtx->sceneNum; + u8 curSpawn = play->curSpawn; + s16 sceneNum = play->sceneNum; s32 result = func_80B54DB4(this); - if (globalCtx) {} // Needed to match, this if can be almost anywhere and it still matches + if (play) {} // Needed to match, this if can be almost anywhere and it still matches if (sceneNum == SCENE_GANON_SONOGO) { if ((result == 0x24) && (curSpawn == 0)) { @@ -1857,9 +1857,9 @@ s32 func_80B57890(EnZl3* this, GlobalContext* globalCtx) { return 1; } } else if (sceneNum == SCENE_GANON_FINAL) { - if ((result == 0x20) && (curSpawn == 0) && Flags_GetSwitch(globalCtx, 0x37)) { - if ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)) { + if ((result == 0x20) && (curSpawn == 0) && Flags_GetSwitch(play, 0x37)) { + if ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)) { return 1; } } @@ -1883,8 +1883,8 @@ s32 func_80B57890(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B57A74(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +void func_80B57A74(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_PROP].head; //! @bug checks for encount2 in ACTORCAT_PROP but encount2 is in ACTORCAT_ENEMY so this condition is never met while (actorIt != NULL) { if (actorIt->id == ACTOR_EN_ENCOUNT2) { @@ -1900,7 +1900,7 @@ void func_80B57AAC(EnZl3* this, s32 arg1, AnimationHeader* arg2) { } } -void func_80B57AE0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57AE0(EnZl3* this, PlayState* play) { s32 pad; s16 shapeRotY = this->actor.shape.rot.y; s32 pad2; @@ -1940,7 +1940,7 @@ s32 func_80B57C54(EnZl3* this) { return 0; } -s32 func_80B57C7C(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57C7C(EnZl3* this, PlayState* play) { return 1; } @@ -1948,7 +1948,7 @@ s32 func_80B57C8C(EnZl3* this) { return !func_80B56F8C(this, this->unk_314 + 2); } -void func_80B57CB4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57CB4(EnZl3* this, PlayState* play) { Vec3f* unk_348 = &this->unk_348; Vec3f* unk_354 = &this->unk_354; Vec3f* thisPos = &this->actor.world.pos; @@ -1961,15 +1961,15 @@ void func_80B57CB4(EnZl3* this, GlobalContext* globalCtx) { thisPos->z = unk_348->z + (temp_f0 * (unk_354->z - unk_348->z)); } -void func_80B57D60(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57D60(EnZl3* this, PlayState* play) { func_80B57240(this); } -s32 func_80B57D80(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57D80(EnZl3* this, PlayState* play) { s32 pad; s16* sp32 = &this->actor.shape.rot.y; struct_80034A14_arg1* unk_3F8 = &this->unk_3F8; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 unk_314 = this->unk_314; s16 temp_v0 = func_80B57104(this, unk_314); s32 pad2; @@ -1991,85 +1991,85 @@ s32 func_80B57D80(EnZl3* this, GlobalContext* globalCtx) { return phi_v1; } -void func_80B57EAC(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B57324(this, globalCtx)) { +void func_80B57EAC(EnZl3* this, PlayState* play) { + if (func_80B57324(this, play)) { this->action = 26; } else { - func_80B57350(this, globalCtx); + func_80B57350(this, play); } } -void func_80B57EEC(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B573C8(this, globalCtx)) { +void func_80B57EEC(EnZl3* this, PlayState* play) { + if (func_80B573C8(this, play)) { this->action = 27; } } -void func_80B57F1C(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B57D80(this, globalCtx) == 0) { +void func_80B57F1C(EnZl3* this, PlayState* play) { + if (func_80B57D80(this, play) == 0) { func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0); this->action = 34; this->unk_314 -= 1; - func_80B57AE0(this, globalCtx); + func_80B57AE0(this, play); } } -s32 func_80B57F84(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B575D0(this, globalCtx) && func_80B57C7C(this, globalCtx) && !Gameplay_InCsMode(globalCtx)) { +s32 func_80B57F84(EnZl3* this, PlayState* play) { + if (func_80B575D0(this, play) && func_80B57C7C(this, play) && !Play_InCsMode(play)) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -8.0f, 0); this->action = 36; this->unk_2EC = 0.0f; - func_80B57A74(globalCtx); + func_80B57A74(play); return 1; } return 0; } -void func_80B58014(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58014(EnZl3* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; - if (func_80B57324(this, globalCtx)) { + if (func_80B57324(this, play)) { func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -11.0f, 0); this->action = 29; func_80B538B0(this); - } else if (func_80B57C8C(this) && func_80B57F84(this, globalCtx)) { - OnePointCutscene_Init(globalCtx, 4000, -99, &this->actor, MAIN_CAM); + } else if (func_80B57C8C(this) && func_80B57F84(this, play)) { + OnePointCutscene_Init(play, 4000, -99, &this->actor, MAIN_CAM); this->unk_3D0 = 0; - } else if (func_80B576C8(this, globalCtx) && func_80B575B0(this, globalCtx) && !Gameplay_InCsMode(globalCtx)) { + } else if (func_80B576C8(this, play) && func_80B575B0(this, play) && !Play_InCsMode(play)) { this->action = 0x1F; this->unk_3CC = 0.0f; func_80B537E8(this); this->unk_3D8 = 1; - OnePointCutscene_Init(globalCtx, 4010, -99, &this->actor, MAIN_CAM); - } else if (!func_80B57C8C(this) && !func_80B576C8(this, globalCtx) && func_80B57564(this, globalCtx)) { + OnePointCutscene_Init(play, 4010, -99, &this->actor, MAIN_CAM); + } else if (!func_80B57C8C(this) && !func_80B576C8(this, play) && func_80B57564(this, play)) { func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0); - func_80B5764C(this, globalCtx); + func_80B5764C(this, play); this->action = 34; this->unk_3D0 = 0; - func_80B57AE0(this, globalCtx); + func_80B57AE0(this, play); } else if ((invincibilityTimer > 0) || (player->fallDistance >= 0x33)) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -11.0f, 0); this->action = 30; func_80B537E8(this); func_80B56DC8(this); } else { - func_80B57350(this, globalCtx); + func_80B57350(this, play); func_80B538B0(this); } } -void func_80B58214(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B573C8(this, globalCtx)) { +void func_80B58214(EnZl3* this, PlayState* play) { + if (func_80B573C8(this, play)) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -11.0f, 0); this->action = 28; this->unk_3D0 = 0; } } -void func_80B58268(EnZl3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B58268(EnZl3* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer <= 0) && (player->fallDistance <= 50)) { @@ -2079,23 +2079,23 @@ void func_80B58268(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B582C8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B582C8(EnZl3* this, PlayState* play) { f32* unk_3CC = &this->unk_3CC; s32 pad; if (*unk_3CC == kREG(14) + 10.0f) { *unk_3CC += 1.0f; func_80B54E14(this, &gZelda2Anime2Anim_008050, 0, -12.0f, 0); - func_80B57704(this, globalCtx); + func_80B57704(this, play); } else if (*unk_3CC == kREG(15) + 20.0f) { *unk_3CC += 1.0f; func_80B56DC8(this); func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -12.0f, 0); } else if (*unk_3CC == kREG(16) + 30.0f) { *unk_3CC += 1.0f; - func_80B57858(globalCtx); + func_80B57858(play); } else if (*unk_3CC == kREG(17) + 40.0f) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); *unk_3CC += 1.0f; } else if (*unk_3CC >= ((kREG(17) + 40.0f) + 1.0f)) { this->action = 32; @@ -2105,27 +2105,27 @@ void func_80B582C8(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B584B4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B584B4(EnZl3* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; - Actor* nearbyEnTest = Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f); + Actor* nearbyEnTest = Actor_FindNearby(play, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f); if (D_80B5A4BC == 0) { - if ((nearbyEnTest == NULL) && (!Gameplay_InCsMode(globalCtx))) { + if ((nearbyEnTest == NULL) && (!Play_InCsMode(play))) { this->action = 33; - OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 4011, -99, &this->actor, MAIN_CAM); } else if (invincibilityTimer > 0) { func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -12.0f, 0); D_80B5A4BC = 1; func_80B56DC8(this); } } else { - if ((nearbyEnTest == NULL) && (!Gameplay_InCsMode(globalCtx))) { + if ((nearbyEnTest == NULL) && (!Play_InCsMode(play))) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -12.0f, 0); D_80B5A4BC = 0; this->action = 33; - OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 4011, -99, &this->actor, MAIN_CAM); } else if (invincibilityTimer <= 0) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -12.0f, 0); D_80B5A4BC = 0; @@ -2133,32 +2133,32 @@ void func_80B584B4(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B58624(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58624(EnZl3* this, PlayState* play) { s32 pad[4]; f32* unk_3CC = &this->unk_3CC; if (*unk_3CC == (kREG(18) + 10.0f)) { *unk_3CC += 1.0f; func_80B54E14(this, &gZelda2Anime2Anim_008050, 0, -12.0f, 0); - func_80B5772C(this, globalCtx); + func_80B5772C(this, play); } else if (*unk_3CC == kREG(19) + 20.0f) { *unk_3CC += 1.0f; this->actor.textId = 0x71AC; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -12.0f, 0); } else if (*unk_3CC == ((kREG(19) + 20.0f) + 1.0f)) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { *unk_3CC += 1.0f; - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); + func_80B5357C(this, play); + func_80B5357C(this, play); + func_80B5357C(this, play); + func_80B5357C(this, play); + func_80B5357C(this, play); } } else { if (*unk_3CC >= kREG(20) + 30.0f) { this->action = 28; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -12.0f, 0); *unk_3CC = 0.0f; } else { @@ -2167,25 +2167,25 @@ void func_80B58624(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B5884C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5884C(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_0038C0, 2, -8.0f, 0); this->action = 37; this->unk_36C = 1; } -void func_80B58898(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58898(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_0038C0, 2, -8.0f, 1); this->action = 38; this->unk_374 = 1; } -void func_80B588E8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B588E8(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0); - func_80B57AE0(this, globalCtx); + func_80B57AE0(this, play); this->action = 39; } -s32 func_80B58938(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B58938(EnZl3* this, PlayState* play) { if (func_80B57C54(this)) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -8.0f, 0); this->action = 28; @@ -2195,9 +2195,9 @@ s32 func_80B58938(EnZl3* this, GlobalContext* globalCtx) { return 0; } -s32 func_80B5899C(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B5899C(EnZl3* this, PlayState* play) { if ((this->actor.bgCheckFlags & 1)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer > 0) || (player->fallDistance >= 0x33)) { @@ -2210,14 +2210,14 @@ s32 func_80B5899C(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B58A1C(EnZl3* this, GlobalContext* globalCtx) { - if (!func_80B58938(this, globalCtx)) { - func_80B5899C(this, globalCtx); +void func_80B58A1C(EnZl3* this, PlayState* play) { + if (!func_80B58938(this, play)) { + func_80B5899C(this, play); } } -void func_80B58A50(EnZl3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B58A50(EnZl3* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer <= 0) && (player->fallDistance <= 50)) { @@ -2226,24 +2226,24 @@ void func_80B58A50(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B58AAC(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58AAC(EnZl3* this, PlayState* play) { f32* unk_2EC = &this->unk_2EC; *unk_2EC += 1.0f; if ((*unk_2EC >= kREG(7) + 24.0f) && (this->unk_36C == 0)) { - func_80B57754(this, globalCtx); - func_80B5884C(this, globalCtx); + func_80B57754(this, play); + func_80B5884C(this, play); } else if ((*unk_2EC >= kREG(8) + 50.0f) && (this->unk_370 == 0)) { - func_80B56EB8(this, globalCtx); + func_80B56EB8(this, play); this->unk_370 = 1; } else if ((*unk_2EC >= kREG(9) + 56.0f) && (this->unk_374 == 0)) { - func_80B58898(this, globalCtx); + func_80B58898(this, play); } else if (*unk_2EC >= kREG(10) + 82.0f) { - func_80B588E8(this, globalCtx); + func_80B588E8(this, play); } } -void func_80B58C08(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58C08(EnZl3* this, PlayState* play) { s32 pad[2]; Vec3f* unk_348 = &this->unk_348; Vec3f* unk_354 = &this->unk_354; @@ -2274,177 +2274,177 @@ void func_80B58C08(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B58D50(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B58D50(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57EAC(this, globalCtx); + func_80B57EAC(this, play); } -void func_80B58DB0(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B58DB0(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57EEC(this, globalCtx); + func_80B57EEC(this, play); } -void func_80B58E10(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58E10(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57F1C(this, globalCtx); + func_80B57F1C(this, play); } -void func_80B58E7C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B53764(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B58E7C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B53764(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58014(this, globalCtx); + func_80B58014(this, play); func_80B536B4(this); } -void func_80B58EF4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58EF4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B538B0(this); - func_80B53764(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B53764(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58214(this, globalCtx); + func_80B58214(this, play); } -void func_80B58F6C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58F6C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58268(this, globalCtx); + func_80B58268(this, play); } -void func_80B58FDC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58FDC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B582C8(this, globalCtx); + func_80B582C8(this, play); } -void func_80B5904C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B5904C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B584B4(this, globalCtx); + func_80B584B4(this, play); } -void func_80B590BC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B590BC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58624(this, globalCtx); + func_80B58624(this, play); } -void func_80B5912C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B5912C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); - func_80B56E38(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); + func_80B56E38(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57CB4(this, globalCtx); - func_80B57D60(this, globalCtx); - func_80B58A1C(this, globalCtx); + func_80B57CB4(this, play); + func_80B57D60(this, play); + func_80B58A1C(this, play); } -void func_80B591BC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B591BC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B538B0(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58A50(this, globalCtx); + func_80B58A50(this, play); } -void func_80B5922C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B5922C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58AAC(this, globalCtx); + func_80B58AAC(this, play); } -void func_80B592A8(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B592A8(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B57AAC(this, EnZl3_UpdateSkelAnime(this), &gZelda2Anime2Anim_003D20); func_80B56DEC(this); - func_80B58AAC(this, globalCtx); + func_80B58AAC(this, play); } -void func_80B59340(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B59340(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B57AAC(this, EnZl3_UpdateSkelAnime(this), &gZelda2Anime2Anim_009FBC); - func_80B58AAC(this, globalCtx); + func_80B58AAC(this, play); } -void func_80B593D0(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B593D0(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); - func_80B5366C(this, globalCtx); - func_80B56E38(this, globalCtx); + func_80B5366C(this, play); + func_80B56E38(this, play); Actor_SetFocus(&this->actor, 60.0f); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58C08(this, globalCtx); + func_80B58C08(this, play); } -s32 func_80B5944C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 func_80B5944C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { if (limbIndex == 14) { - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 7); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); EnZl3* this = (EnZl3*)thisx; Vec3s* vec = &this->unk_3F8.unk_08; @@ -2480,13 +2480,13 @@ s32 func_80B5944C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -s32 func_80B59698(EnZl3* this, GlobalContext* globalCtx) { - s32 cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); +s32 func_80B59698(EnZl3* this, PlayState* play) { + s32 cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (cond) { - u8 curSpawn = globalCtx->curSpawn; + u8 curSpawn = play->curSpawn; if ((func_80B54DB4(this) == 0x20) && (curSpawn == 0) && ((gSaveContext.timer2Value <= 0) || (gSaveContext.timer2State == 0))) { @@ -2496,13 +2496,13 @@ s32 func_80B59698(EnZl3* this, GlobalContext* globalCtx) { return 0; } -s32 func_80B59768(EnZl3* this, GlobalContext* globalCtx) { - s32 cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); +s32 func_80B59768(EnZl3* this, PlayState* play) { + s32 cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (cond) { - u8 curSpawn = globalCtx->curSpawn; + u8 curSpawn = play->curSpawn; if ((func_80B54DB4(this) == 0x20) && (curSpawn == 0) && (gSaveContext.timer2Value <= 0)) { return 1; @@ -2511,13 +2511,13 @@ s32 func_80B59768(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B59828(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B59698(this, globalCtx) || (!func_80B56EE4(this, globalCtx) && func_80B57890(this, globalCtx))) { +void func_80B59828(EnZl3* this, PlayState* play) { + if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { s16 newRotY; func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, 0.0f, 0); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - func_80B56F10(this, globalCtx); + func_80B56F10(this, play); newRotY = func_80B571A8(this); this->actor.shape.rot.y = newRotY; this->actor.world.rot.y = newRotY; @@ -2530,63 +2530,63 @@ void func_80B59828(EnZl3* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } - if (func_80B59698(this, globalCtx) != 0) { + if (func_80B59698(this, play) != 0) { func_80088AA0(180); func_80B53468(); gSaveContext.healthAccumulator = 320; - Magic_Fill(globalCtx); - if (Flags_GetSwitch(globalCtx, 0x20)) { - Flags_UnsetSwitch(globalCtx, 0x20); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_ZG, -144.0f, 3544.0f, -43.0f, 0, 0x2000, 0, 0x2000); + Magic_Fill(play); + if (Flags_GetSwitch(play, 0x20)) { + Flags_UnsetSwitch(play, 0x20); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_ZG, -144.0f, 3544.0f, -43.0f, 0, 0x2000, 0, 0x2000); } - Flags_UnsetSwitch(globalCtx, 0x21); - Flags_UnsetSwitch(globalCtx, 0x22); - Flags_UnsetSwitch(globalCtx, 0x23); - Flags_UnsetSwitch(globalCtx, 0x24); - Flags_UnsetSwitch(globalCtx, 0x25); - Flags_UnsetSwitch(globalCtx, 0x26); - Flags_UnsetSwitch(globalCtx, 0x27); - Flags_UnsetSwitch(globalCtx, 0x28); - Flags_UnsetSwitch(globalCtx, 0x29); - Flags_UnsetSwitch(globalCtx, 0x2A); + Flags_UnsetSwitch(play, 0x21); + Flags_UnsetSwitch(play, 0x22); + Flags_UnsetSwitch(play, 0x23); + Flags_UnsetSwitch(play, 0x24); + Flags_UnsetSwitch(play, 0x25); + Flags_UnsetSwitch(play, 0x26); + Flags_UnsetSwitch(play, 0x27); + Flags_UnsetSwitch(play, 0x28); + Flags_UnsetSwitch(play, 0x29); + Flags_UnsetSwitch(play, 0x2A); } if (func_80B54DB4(this) == 0x20) { s32 cond; - func_80B54EA4(this, globalCtx); - cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); + func_80B54EA4(this, play); + cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (cond) { - func_80B53614(this, globalCtx); + func_80B53614(this, play); } } } -void func_80B59A80(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B59768(this, globalCtx)) { +void func_80B59A80(EnZl3* this, PlayState* play) { + if (func_80B59768(this, play)) { Audio_PlaySoundGeneral(NA_SE_OC_REVENGE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } -void func_80B59AD0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59AD0(EnZl3* this, PlayState* play) { // todo look into Actor* thisx = &this->actor; // unused, necessary to use 'this' first to fix regalloc - Flags_SetSwitch(globalCtx, 0x36); + Flags_SetSwitch(play, 0x36); func_80088AA0(180); - func_80B54EA4(this, globalCtx); - func_80B53614(this, globalCtx); + func_80B54EA4(this, play); + func_80B53614(this, play); gSaveContext.eventChkInf[12] &= ~0x80; - func_80B56F10(this, globalCtx); + func_80B56F10(this, play); gSaveContext.healthAccumulator = 320; - Magic_Fill(globalCtx); + Magic_Fill(play); this->action = 27; this->drawConfig = 1; } -void func_80B59B6C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59B6C(EnZl3* this, PlayState* play) { s32 sp2C = func_80B54DD4(this); this->unk_3DC = Animation_GetLastFrame(SEGMENTED_TO_VIRTUAL(&gZelda2Anime2Anim_0091D8)); @@ -2599,13 +2599,13 @@ void func_80B59B6C(EnZl3* this, GlobalContext* globalCtx) { switch (sp2C) { case 0: - func_80B54FB4(this, globalCtx); + func_80B54FB4(this, play); break; case 1: - func_80B55780(this, globalCtx); + func_80B55780(this, play); break; case 3: - func_80B59828(this, globalCtx); + func_80B59828(this, play); break; default: osSyncPrintf(VT_FGCOL(RED) " En_Oa3 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); @@ -2613,9 +2613,9 @@ void func_80B59B6C(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B59DB8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59DB8(EnZl3* this, PlayState* play) { s32 pad; - ObjectContext* objCtx = &globalCtx->objectCtx; + ObjectContext* objCtx = &play->objectCtx; s32 objIndex = Object_GetIndex(objCtx, OBJECT_ZL2_ANIME2); s32 pad2; @@ -2626,8 +2626,8 @@ void func_80B59DB8(EnZl3* this, GlobalContext* globalCtx) { if (Object_IsLoaded(objCtx, objIndex)) { this->unk_318 = objIndex; - func_80B54DE0(this, globalCtx); - func_80B59B6C(this, globalCtx); + func_80B54DE0(this, play); + func_80B59B6C(this, play); } } @@ -2640,17 +2640,17 @@ static EnZl3ActionFunc sActionFuncs[] = { func_80B591BC, func_80B5922C, func_80B592A8, func_80B59340, func_80B593D0, }; -void EnZl3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Update(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnZl3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Init(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; ActorShape* shape = &this->actor.shape; s32 pad; @@ -2658,15 +2658,15 @@ void EnZl3_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("ゼルダ姫のEn_Zl3_Actor_ct通すよ!!!!!!!!!!!!!!!!!!!!!!!!!\n"); ActorShape_Init(shape, 0.0f, ActorShadow_DrawCircle, 30.0f); shape->shadowAlpha = 0; - func_80B533B0(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZelda2Skel, NULL, this->jointTable, this->morphTable, 15); + func_80B533B0(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gZelda2Skel, NULL, this->jointTable, this->morphTable, 15); switch (func_80B54DD4(this)) { case 1: gSaveContext.timer2State = 0; break; case 3: - func_80B59A80(this, globalCtx); + func_80B59A80(this, play); break; } @@ -2678,7 +2678,7 @@ static OverrideLimbDraw sOverrideLimbDrawFuncs[] = { func_80B5944C, }; -s32 EnZl3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnZl3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl3* this = (EnZl3*)thisx; @@ -2687,13 +2687,13 @@ s32 EnZl3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, osSyncPrintf(VT_FGCOL(RED) "描画前処理モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return 0; } - return sOverrideLimbDrawFuncs[this->unk_308](globalCtx, limbIndex, dList, pos, rot, thisx, gfx); + return sOverrideLimbDrawFuncs[this->unk_308](play, limbIndex, dList, pos, rot, thisx, gfx); } -void func_80B59FE8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59FE8(EnZl3* this, PlayState* play) { } -void func_80B59FF4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59FF4(EnZl3* this, PlayState* play) { s32 pad[2]; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTex = sEyeTextures[eyeTexIndex]; @@ -2702,9 +2702,9 @@ void func_80B59FF4(EnZl3* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x9, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2712,13 +2712,13 @@ void func_80B59FF4(EnZl3* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0xB, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl3_OverrideLimbDraw, EnZl3_PostLimbDraw, this, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B5A1D0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5A1D0(EnZl3* this, PlayState* play) { s32 pad[2]; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTex = sEyeTextures[eyeTexIndex]; @@ -2727,9 +2727,9 @@ void func_80B5A1D0(EnZl3* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 9, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2737,10 +2737,10 @@ void func_80B5A1D0(EnZl3* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 11, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl3_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static EnZl3DrawFunc sDrawFuncs[] = { @@ -2749,14 +2749,14 @@ static EnZl3DrawFunc sDrawFuncs[] = { func_80B5A1D0, }; -void EnZl3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Draw(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } const ActorInit En_Zl3_InitVars = { diff --git a/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h b/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h index cf30576c3..13b9a86dd 100644 --- a/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h +++ b/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h @@ -8,8 +8,8 @@ struct EnZl3; -typedef void (*EnZl3ActionFunc)(struct EnZl3*, GlobalContext*); -typedef void (*EnZl3DrawFunc)(struct EnZl3*, GlobalContext*); +typedef void (*EnZl3ActionFunc)(struct EnZl3*, PlayState*); +typedef void (*EnZl3DrawFunc)(struct EnZl3*, PlayState*); typedef struct EnZl3 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 96bf18aef..22cd49add 100644 --- a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -49,14 +49,14 @@ typedef enum { /* 6 */ ZL4_EYE_LOOK_IN } EnZl4EyeState; -void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl4_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl4_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZl4_Init(Actor* thisx, PlayState* play); +void EnZl4_Destroy(Actor* thisx, PlayState* play); +void EnZl4_Update(Actor* thisx, PlayState* play); +void EnZl4_Draw(Actor* thisx, PlayState* play); -void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx); -void EnZl4_Idle(EnZl4* this, GlobalContext* globalCtx); -void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx); +void EnZl4_Cutscene(EnZl4* this, PlayState* play); +void EnZl4_Idle(EnZl4* this, PlayState* play); +void EnZl4_TheEnd(EnZl4* this, PlayState* play); const ActorInit En_Zl4_InitVars = { ACTOR_EN_ZL4, @@ -179,8 +179,8 @@ static AnimationInfo sAnimationInfo[] = { #include "z_en_zl4_cutscene_data.c" -void EnZl4_SetCsCameraAngle(GlobalContext* globalCtx, s16 index) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); +void EnZl4_SetCsCameraAngle(PlayState* play, s16 index) { + Camera* activeCam = GET_ACTIVE_CAM(play); Camera_ChangeSetting(activeCam, CAM_SET_FREE0); activeCam->at = sCsCameraAngle[index].at; @@ -189,9 +189,9 @@ void EnZl4_SetCsCameraAngle(GlobalContext* globalCtx, s16 index) { activeCam->fov = sCsCameraAngle[index].fov; } -void EnZl4_SetCsCameraMove(GlobalContext* globalCtx, s16 index) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); - Player* player = GET_PLAYER(globalCtx); +void EnZl4_SetCsCameraMove(PlayState* play, s16 index) { + Camera* activeCam = GET_ACTIVE_CAM(play); + Player* player = GET_PLAYER(play); Camera_ChangeSetting(activeCam, CAM_SET_CS_0); Camera_ResetAnim(activeCam); @@ -199,8 +199,8 @@ void EnZl4_SetCsCameraMove(GlobalContext* globalCtx, s16 index) { sCsCameraMove[index].relativeToPlayer); } -u16 EnZl4_GetText(GlobalContext* globalCtx, Actor* thisx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 22); +u16 EnZl4_GetText(PlayState* play, Actor* thisx) { + u16 faceReaction = Text_GetFaceReaction(play, 22); u16 stoneCount; s16 ret; @@ -227,24 +227,24 @@ u16 EnZl4_GetText(GlobalContext* globalCtx, Actor* thisx) { return ret; } -void GivePlayerRandoRewardZeldaChild(EnZl4* zelda, GlobalContext* globalCtx, RandomizerCheck check) { - if (zelda->actor.parent != NULL && zelda->actor.parent->id == GET_PLAYER(globalCtx)->actor.id && - !Flags_GetTreasure(globalCtx, 0x1E)) { - Flags_SetTreasure(globalCtx, 0x1E); - } else if (!Flags_GetTreasure(globalCtx, 0x1E) && !Randomizer_GetSettingValue(RSK_SKIP_CHILD_ZELDA) && Actor_TextboxIsClosing(&zelda->actor, globalCtx) && - (globalCtx->msgCtx.textId == 0x703C || globalCtx->msgCtx.textId == 0x703D)) { +void GivePlayerRandoRewardZeldaChild(EnZl4* zelda, PlayState* play, RandomizerCheck check) { + if (zelda->actor.parent != NULL && zelda->actor.parent->id == GET_PLAYER(play)->actor.id && + !Flags_GetTreasure(play, 0x1E)) { + Flags_SetTreasure(play, 0x1E); + } else if (!Flags_GetTreasure(play, 0x1E) && !Randomizer_GetSettingValue(RSK_SKIP_CHILD_ZELDA) && Actor_TextboxIsClosing(&zelda->actor, play) && + (play->msgCtx.textId == 0x703C || play->msgCtx.textId == 0x703D)) { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(check, GI_LETTER_ZELDA); - GiveItemEntryFromActor(&zelda->actor, globalCtx, getItemEntry, 10000.0f, 100.0f); - } else if (Flags_GetTreasure(globalCtx, 0x1E) && !Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) { + GiveItemEntryFromActor(&zelda->actor, play, getItemEntry, 10000.0f, 100.0f); + } else if (Flags_GetTreasure(play, 0x1E) && !Player_InBlockingCsMode(play, GET_PLAYER(play))) { gSaveContext.unk_13EE = 0x32; gSaveContext.eventChkInf[4] |= 1; } } -s16 func_80B5B9B0(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80B5B9B0(PlayState* play, Actor* thisx) { EnZl4* this = (EnZl4*)thisx; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return false; } @@ -315,13 +315,13 @@ void EnZl4_UpdateFace(EnZl4* this) { } } -void EnZl4_SetMove(EnZl4* this, GlobalContext* globalCtx) { +void EnZl4_SetMove(EnZl4* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80B5BB78(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B5BB78(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_1E0.unk_18 = player->actor.world.pos; func_80034A14(&this->actor, &this->unk_1E0, 2, 2); @@ -333,12 +333,12 @@ void EnZl4_GetActionStartPos(CsCmdActorAction* action, Vec3f* vec) { vec->z = action->startPos.z; } -s32 EnZl4_SetupFromLegendCs(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Actor* playerx = &GET_PLAYER(globalCtx)->actor; +s32 EnZl4_SetupFromLegendCs(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Actor* playerx = &GET_PLAYER(play)->actor; s16 rotY; - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); playerx->world.pos = this->actor.world.pos; rotY = this->actor.shape.rot.y; playerx->world.pos.x += 56.0f * Math_SinS(rotY); @@ -346,7 +346,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, GlobalContext* globalCtx) { player->linearVelocity = playerx->speedXZ = 0.0f; - EnZl4_SetCsCameraMove(globalCtx, 5); + EnZl4_SetCsCameraMove(play, 5); ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); this->talkTimer2 = 0; @@ -374,15 +374,15 @@ s32 EnZl4_InMovingAnim(EnZl4* this) { return false; } -void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Init(Actor* thisx, PlayState* play) { s32 pad; EnZl4* this = (EnZl4*)thisx; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gChildZeldaSkel, NULL, this->jointTable, this->morphTable, 18); + SkelAnime_InitFlex(play, &this->skelAnime, &gChildZeldaSkel, NULL, this->jointTable, this->morphTable, 18); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_21); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; @@ -407,7 +407,7 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { this->csState = ZL4_CS_WAIT; this->talkState = 0; } else { - EnZl4_SetupFromLegendCs(this, globalCtx); + EnZl4_SetupFromLegendCs(this, play); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->csState = ZL4_CS_LEGEND; this->talkState = 0; @@ -417,11 +417,11 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZl4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnZl4* this = (EnZl4*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 EnZl4_SetNextAnim(EnZl4* this, s32 nextAnim) { @@ -441,20 +441,20 @@ void EnZl4_ReverseAnimation(EnZl4* this) { this->skelAnime.playSpeed = -1.0f; } -s32 EnZl4_CsWaitForPlayer(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Actor* playerx = &GET_PLAYER(globalCtx)->actor; +s32 EnZl4_CsWaitForPlayer(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Actor* playerx = &GET_PLAYER(play)->actor; s16 rotY; s16 yawDiff; s16 absYawDiff; - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { yawDiff = (f32)this->actor.yawTowardsPlayer - this->actor.shape.rot.y; absYawDiff = ABS(yawDiff); if ((playerx->world.pos.y != this->actor.world.pos.y) || (absYawDiff >= 0x3FFC)) { return false; } else { - func_8002F2CC(&this->actor, globalCtx, this->collider.dim.radius + 60.0f); + func_8002F2CC(&this->actor, play, this->collider.dim.radius + 60.0f); return false; } } @@ -468,7 +468,7 @@ s32 EnZl4_CsWaitForPlayer(EnZl4* this, GlobalContext* globalCtx) { return true; } -s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsMeetPlayer(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: if (this->skelAnime.curFrame == 50.0f) { @@ -477,24 +477,24 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { if (!EnZl4_SetNextAnim(this, ZL4_ANIM_4)) { break; } else { - Message_StartTextbox(globalCtx, 0x702E, NULL); + Message_StartTextbox(play, 0x702E, NULL); this->talkState++; } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 1); - Message_StartTextbox(globalCtx, 0x702F, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 1); + Message_StartTextbox(play, 0x702F, NULL); this->talkTimer2 = 0; this->talkState++; } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardMeetCs); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardMeetCs); gSaveContext.cutsceneTrigger = 1; - EnZl4_SetCsCameraMove(globalCtx, 0); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + EnZl4_SetCsCameraMove(play, 0); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; } @@ -502,14 +502,14 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { case 3: this->talkTimer2++; if (this->talkTimer2 >= 45) { - Message_StartTextbox(globalCtx, 0x70F9, NULL); + Message_StartTextbox(play, 0x70F9, NULL); this->talkState++; } break; case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 1); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraMove(play, 1); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; } @@ -517,60 +517,60 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { case 5: this->talkTimer2++; if (this->talkTimer2 >= 10) { - Message_StartTextbox(globalCtx, 0x70FA, NULL); + Message_StartTextbox(play, 0x70FA, NULL); this->talkState++; } break; case 6: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 2); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_22); this->mouthExpression = ZL4_MOUTH_NEUTRAL; this->talkTimer2 = 0; this->talkState++; - Message_StartTextbox(globalCtx, 0x70FB, NULL); + Message_StartTextbox(play, 0x70FB, NULL); } break; } return (this->talkState == 7) ? 1 : 0; } -s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsAskStone(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: if (EnZl4_SetNextAnim(this, ZL4_ANIM_25)) { this->talkState++; } case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 3); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 3); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer1 = 40; this->talkState = 2; } break; case 2: if (DECR(this->talkTimer1) == 0) { - Message_StartTextbox(globalCtx, 0x7030, NULL); + Message_StartTextbox(play, 0x7030, NULL); this->talkState++; } break; case 3: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraAngle(globalCtx, 4); + } else if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetCsCameraAngle(play, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x7032, NULL); + Message_StartTextbox(play, 0x7032, NULL); this->talkState = 7; } else { - EnZl4_SetCsCameraAngle(globalCtx, 2); + EnZl4_SetCsCameraAngle(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; - Message_StartTextbox(globalCtx, 0x7031, NULL); + Message_StartTextbox(play, 0x7031, NULL); this->talkState++; } break; @@ -582,8 +582,8 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 5: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; EnZl4_ReverseAnimation(this); @@ -592,8 +592,8 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { break; case 6: this->mouthExpression = ZL4_MOUTH_NEUTRAL; - EnZl4_SetCsCameraAngle(globalCtx, 3); - Message_StartTextbox(globalCtx, 0x7030, NULL); + EnZl4_SetCsCameraAngle(play, 3); + Message_StartTextbox(play, 0x7030, NULL); this->talkState = 12; break; case 12: @@ -601,21 +601,21 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState = 13; } case 13: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraAngle(globalCtx, 4); + } else if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetCsCameraAngle(play, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x7032, NULL); + Message_StartTextbox(play, 0x7032, NULL); this->talkState = 7; } else { - EnZl4_SetCsCameraAngle(globalCtx, 2); + EnZl4_SetCsCameraAngle(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; - Message_StartTextbox(globalCtx, 0x7031, NULL); + Message_StartTextbox(play, 0x7031, NULL); this->talkState = 4; } break; @@ -627,29 +627,29 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 8: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 2); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraMove(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_NEUTRAL; - Message_StartTextbox(globalCtx, 0x70FC, NULL); + Message_StartTextbox(play, 0x70FC, NULL); this->talkState = 9; } break; case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 5); - Message_StartTextbox(globalCtx, 0x70FD, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 5); + Message_StartTextbox(play, 0x70FD, NULL); this->talkState++; } break; case 10: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_5); this->eyeExpression = ZL4_EYES_OPEN; this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x70FE, NULL); + Message_StartTextbox(play, 0x70FE, NULL); this->talkState++; } break; @@ -657,7 +657,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 11) ? 1 : 0; } -s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsAskName(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: if (EnZl4_SetNextAnim(this, ZL4_ANIM_4)) { @@ -665,14 +665,14 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 6); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 6); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_1); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_NEUTRAL; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - Message_StartTextbox(globalCtx, 0x70FF, NULL); + play->msgCtx.msgMode = MSGMODE_PAUSED; + Message_StartTextbox(play, 0x70FF, NULL); this->talkState++; } break; @@ -681,25 +681,25 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 3: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_16); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 4; } break; case 4: if (EnZl4_SetNextAnim(this, ZL4_ANIM_17)) { - Message_StartTextbox(globalCtx, 0x2073, NULL); + Message_StartTextbox(play, 0x2073, NULL); this->talkState++; } break; case 5: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 3); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraMove(play, 3); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState = 6; } @@ -707,15 +707,15 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { case 6: this->talkTimer2++; if (this->talkTimer2 >= 15) { - Message_StartTextbox(globalCtx, 0x2074, NULL); + Message_StartTextbox(play, 0x2074, NULL); this->talkState++; } break; case 7: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_6); this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x2075, NULL); + Message_StartTextbox(play, 0x2075, NULL); this->talkState++; } break; @@ -724,23 +724,23 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x7033, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x7033, NULL); this->talkState = 10; } break; case 10: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraMove(globalCtx, 4); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetCsCameraMove(play, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_33); this->mouthExpression = ZL4_MOUTH_NEUTRAL; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState = 15; } else { - EnZl4_SetCsCameraAngle(globalCtx, 6); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + EnZl4_SetCsCameraAngle(play, 6); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer1 = 20; this->talkState++; this->skelAnime.playSpeed = 0.0f; @@ -753,7 +753,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_LOOK_RIGHT; this->mouthExpression = ZL4_MOUTH_WORRIED; - Message_StartTextbox(globalCtx, 0x7034, NULL); + Message_StartTextbox(play, 0x7034, NULL); this->talkState++; } break; @@ -765,41 +765,41 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 13: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_6); this->blinkTimer = 3; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_HAPPY; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 14; } break; case 14: if (EnZl4_SetNextAnim(this, ZL4_ANIM_25)) { - Message_StartTextbox(globalCtx, 0x7033, NULL); + Message_StartTextbox(play, 0x7033, NULL); this->talkState = 10; } break; case 15: this->talkTimer2++; if (this->talkTimer2 >= 30) { - Message_StartTextbox(globalCtx, 0x7035, NULL); + Message_StartTextbox(play, 0x7035, NULL); this->talkState++; } break; case 16: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } case 17: this->talkTimer2++; if (this->talkTimer2 == 130) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - globalCtx->nextEntranceIndex = 0xA0; + play->msgCtx.msgMode = MSGMODE_PAUSED; + play->nextEntranceIndex = 0xA0; gSaveContext.nextCutsceneIndex = 0xFFF7; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; } break; } @@ -809,48 +809,48 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { return false; } -s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); +s32 EnZl4_CsTellLegend(EnZl4* this, PlayState* play) { + Camera* activeCam = GET_ACTIVE_CAM(play); switch (this->talkState) { case 0: this->talkTimer2++; if (this->talkTimer2 >= 60) { - Message_StartTextbox(globalCtx, 0x7037, NULL); + Message_StartTextbox(play, 0x7037, NULL); this->talkState++; } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 7); - Message_StartTextbox(globalCtx, 0x2076, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 7); + Message_StartTextbox(play, 0x2076, NULL); this->talkState++; } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 6); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraMove(play, 6); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; case 3: if (activeCam->animState == 2) { - Message_StartTextbox(globalCtx, 0x2077, NULL); + Message_StartTextbox(play, 0x2077, NULL); this->talkState++; } break; case 4: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraAngle(globalCtx, 8); - Message_StartTextbox(globalCtx, 0x7005, NULL); + } else if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetCsCameraAngle(play, 8); + Message_StartTextbox(play, 0x7005, NULL); this->talkState = 9; } else { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_5); this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x7038, NULL); + Message_StartTextbox(play, 0x7038, NULL); this->talkState++; Audio_PlayActorSound2(&this->actor, NA_SE_VO_Z0_HURRY); } @@ -860,29 +860,29 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 6: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_33); this->mouthExpression = ZL4_MOUTH_NEUTRAL; - Message_StartTextbox(globalCtx, 0x7037, NULL); + Message_StartTextbox(play, 0x7037, NULL); this->talkState++; } break; case 7: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x2076, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x2076, NULL); this->talkState++; } break; case 8: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x2077, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x2077, NULL); this->talkState = 4; } break; case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_26); - Message_StartTextbox(globalCtx, 0x2078, NULL); + Message_StartTextbox(play, 0x2078, NULL); this->talkState++; } break; @@ -891,19 +891,19 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 11: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + } else if (play->msgCtx.choiceIndex == 0) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 13; } else { - Message_StartTextbox(globalCtx, 0x700B, NULL); + Message_StartTextbox(play, 0x700B, NULL); this->talkState = 12; } break; case 12: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 13; } break; @@ -911,43 +911,43 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 13) ? 1 : 0; } -s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsLookWindow(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: - EnZl4_SetCsCameraMove(globalCtx, 7); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardWindowCs); + EnZl4_SetCsCameraMove(play, 7); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardWindowCs); gSaveContext.cutsceneTrigger = 1; this->talkState++; break; case 1: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.frames == 90) { - globalCtx->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.frames == 90) { + play->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; } } else { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardGanonCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardGanonCs); gSaveContext.cutsceneTrigger = 1; this->talkState++; - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); } break; case 2: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.frames == 209) { - globalCtx->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.frames == 209) { + play->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; } } else { func_800AA000(0.0f, 0xA0, 0xA, 0x28); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_30); - EnZl4_SetCsCameraAngle(globalCtx, 11); - Message_StartTextbox(globalCtx, 0x7039, NULL); + EnZl4_SetCsCameraAngle(play, 11); + Message_StartTextbox(play, 0x7039, NULL); this->talkState++; } break; case 3: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; @@ -955,8 +955,8 @@ s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 4) ? 1 : 0; } -s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnZl4_CsWarnAboutGanon(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 rotY; switch (this->talkState) { @@ -965,13 +965,13 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { rotY = this->actor.shape.rot.y - 0x3FFC; player->actor.world.pos.x += 34.0f * Math_SinS(rotY); player->actor.world.pos.z += 34.0f * Math_CosS(rotY); - EnZl4_SetCsCameraMove(globalCtx, 8); + EnZl4_SetCsCameraMove(play, 8); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_WIDE; this->mouthExpression = ZL4_MOUTH_WORRIED; this->talkTimer2 = 0; this->talkState++; - Message_StartTextbox(globalCtx, 0x2079, NULL); + Message_StartTextbox(play, 0x2079, NULL); case 1: this->talkTimer2++; if (this->talkTimer2 >= 20) { @@ -979,9 +979,9 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 9); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraMove(play, 9); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; } @@ -989,49 +989,49 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { case 3: this->talkTimer2++; if (this->talkTimer2 >= 20) { - Message_StartTextbox(globalCtx, 0x207A, NULL); + Message_StartTextbox(play, 0x207A, NULL); this->talkState++; } break; case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 12); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 12); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_23); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; case 5: if (EnZl4_SetNextAnim(this, ZL4_ANIM_24)) { - Message_StartTextbox(globalCtx, 0x207B, NULL); + Message_StartTextbox(play, 0x207B, NULL); this->talkState++; } break; case 6: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x703A, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x703A, NULL); this->talkState++; } break; case 7: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { + } else if (play->msgCtx.choiceIndex == 0) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_31); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x703B, NULL); + Message_StartTextbox(play, 0x703B, NULL); this->talkState = 11; } else { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_13); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_LOOK_LEFT; this->mouthExpression = ZL4_MOUTH_WORRIED; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; @@ -1040,20 +1040,20 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { this->blinkTimer = 3; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x7073, NULL); + Message_StartTextbox(play, 0x7073, NULL); this->talkState++; } break; case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_14); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; case 10: if (EnZl4_SetNextAnim(this, ZL4_ANIM_24)) { - Message_StartTextbox(globalCtx, 0x703A, NULL); + Message_StartTextbox(play, 0x703A, NULL); this->talkState = 7; } break; @@ -1062,8 +1062,8 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 12: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 13; } break; @@ -1071,31 +1071,31 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 13) ? 1 : 0; } -s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsMakePlan(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_18); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_WORRIED; - EnZl4_SetCsCameraMove(globalCtx, 10); + EnZl4_SetCsCameraMove(play, 10); this->talkTimer2 = 0; this->talkState++; case 1: this->talkTimer2++; if (this->talkTimer2 >= 10) { - Message_StartTextbox(globalCtx, 0x7123, NULL); + Message_StartTextbox(play, 0x7123, NULL); this->talkState++; } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 13); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetCsCameraAngle(play, 13); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_19); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x207C, NULL); + Message_StartTextbox(play, 0x207C, NULL); this->talkState++; } break; @@ -1104,8 +1104,8 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x207D, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x207D, NULL); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_7); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; @@ -1119,24 +1119,24 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 6: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play))) { break; } else { - Camera_ChangeSetting(GET_ACTIVE_CAM(globalCtx), 1); + Camera_ChangeSetting(GET_ACTIVE_CAM(play), 1); this->talkState = 7; - globalCtx->talkWithPlayer(globalCtx, &this->actor); - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, + play->talkWithPlayer(play, &this->actor); + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } break; case 7: - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->talkState++; } else { - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } // no break here is required for matching @@ -1144,12 +1144,12 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 8) ? 1 : 0; } -void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnZl4_Cutscene(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->csState) { case ZL4_CS_WAIT: - if (EnZl4_CsWaitForPlayer(this, globalCtx)) { + if (EnZl4_CsWaitForPlayer(this, play)) { this->talkState = 0; this->csState++; } @@ -1160,51 +1160,51 @@ void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; Audio_PlayFanfare(NA_BGM_APPEAR); - EnZl4_SetCsCameraAngle(globalCtx, 0); + EnZl4_SetCsCameraAngle(play, 0); Interface_ChangeAlpha(2); ShrinkWindow_SetVal(0x20); this->talkState = 0; this->csState++; break; case ZL4_CS_MEET: - if (EnZl4_CsMeetPlayer(this, globalCtx)) { + if (EnZl4_CsMeetPlayer(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_STONE: - if (EnZl4_CsAskStone(this, globalCtx)) { + if (EnZl4_CsAskStone(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_NAMES: - if (EnZl4_CsAskName(this, globalCtx)) { + if (EnZl4_CsAskName(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_LEGEND: - if (EnZl4_CsTellLegend(this, globalCtx)) { + if (EnZl4_CsTellLegend(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_WINDOW: - if (EnZl4_CsLookWindow(this, globalCtx)) { + if (EnZl4_CsLookWindow(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_GANON: - if (EnZl4_CsWarnAboutGanon(this, globalCtx)) { + if (EnZl4_CsWarnAboutGanon(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_PLAN: - if (EnZl4_CsMakePlan(this, globalCtx)) { - func_8002DF54(globalCtx, &this->actor, 7); + if (EnZl4_CsMakePlan(this, play)) { + func_8002DF54(play, &this->actor, 7); gSaveContext.unk_13EE = 0x32; gSaveContext.eventChkInf[4] |= 1; this->actionFunc = EnZl4_Idle; @@ -1214,23 +1214,23 @@ void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { this->unk_1E0.unk_18 = player->actor.world.pos; func_80034A14(&this->actor, &this->unk_1E0, 2, (this->csState == ZL4_CS_WINDOW) ? 2 : 1); if (EnZl4_InMovingAnim(this)) { - EnZl4_SetMove(this, globalCtx); + EnZl4_SetMove(this, play); } } -void EnZl4_Idle(EnZl4* this, GlobalContext* globalCtx) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 60.0f, EnZl4_GetText, +void EnZl4_Idle(EnZl4* this, PlayState* play) { + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 60.0f, EnZl4_GetText, func_80B5B9B0); - func_80B5BB78(this, globalCtx); + func_80B5BB78(this, play); if (gSaveContext.n64ddFlag) { - GivePlayerRandoRewardZeldaChild(this, globalCtx, RC_HC_ZELDAS_LETTER); + GivePlayerRandoRewardZeldaChild(this, play, RC_HC_ZELDAS_LETTER); return; } } -void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { +void EnZl4_TheEnd(EnZl4* this, PlayState* play) { s32 animIndex[] = { ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_26, ZL4_ANIM_21, ZL4_ANIM_3 }; CsCmdActorAction* npcAction; @@ -1240,17 +1240,17 @@ void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_4); } if (EnZl4_InMovingAnim(this)) { - EnZl4_SetMove(this, globalCtx); + EnZl4_SetMove(this, play); } - if (globalCtx->csCtx.frames == 100) { + if (play->csCtx.frames == 100) { this->eyeExpression = ZL4_EYES_LOOK_LEFT; } - if (globalCtx->csCtx.frames == 450) { + if (play->csCtx.frames == 450) { this->blinkTimer = 3; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; } - npcAction = globalCtx->csCtx.npcActions[0]; + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { EnZl4_GetActionStartPos(npcAction, &pos); if (this->lastAction == 0) { @@ -1266,7 +1266,7 @@ void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { } } -void EnZl4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Update(Actor* thisx, PlayState* play) { s32 pad; EnZl4* this = (EnZl4*)thisx; @@ -1274,13 +1274,13 @@ void EnZl4_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } EnZl4_UpdateFace(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnZl4_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnZl4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnZl4* this = (EnZl4*)thisx; Vec3s sp1C; @@ -1302,7 +1302,7 @@ s32 EnZl4_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnZl4_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnZl4_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnZl4* this = (EnZl4*)thisx; @@ -1311,7 +1311,7 @@ void EnZl4_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnZl4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Draw(Actor* thisx, PlayState* play) { EnZl4* this = (EnZl4*)thisx; void* mouthTex[] = { gChildZeldaMouthNeutralTex, gChildZeldaMouthHappyTex, gChildZeldaMouthWorriedTex, gChildZeldaMouthSurprisedTex }; @@ -1320,12 +1320,12 @@ void EnZl4_Draw(Actor* thisx, GlobalContext* globalCtx) { gChildZeldaEyeSquintTex, gChildZeldaEyeOutTex, gChildZeldaEyeInTex, }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex[this->rightEyeState])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex[this->leftEyeState])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTex[this->mouthState])); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnZl4_OverrideLimbDraw, EnZl4_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h index ace675ddc..05d6a2655 100644 --- a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h +++ b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h @@ -6,8 +6,8 @@ struct EnZl4; -typedef void (*EnZl4ActionFunc)(struct EnZl4*, GlobalContext*); -typedef void (*EnZl4DrawFunc)(struct EnZl4*, GlobalContext*); +typedef void (*EnZl4ActionFunc)(struct EnZl4*, PlayState*); +typedef void (*EnZl4DrawFunc)(struct EnZl4*, PlayState*); typedef struct EnZl4 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 9c1d281d3..8157a6e39 100644 --- a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -18,17 +18,17 @@ typedef enum { /* 3 */ ENZO_EFFECT_BUBBLE } EnZoEffectType; -void EnZo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZo_Init(Actor* thisx, PlayState* play); +void EnZo_Destroy(Actor* thisx, PlayState* play); +void EnZo_Update(Actor* thisx, PlayState* play); +void EnZo_Draw(Actor* thisx, PlayState* play); // Actions -void EnZo_Standing(EnZo* this, GlobalContext* globalCtx); -void EnZo_Submerged(EnZo* this, GlobalContext* globalCtx); -void EnZo_Surface(EnZo* this, GlobalContext* globalCtx); -void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx); -void EnZo_Dive(EnZo* this, GlobalContext* globalCtx); +void EnZo_Standing(EnZo* this, PlayState* play); +void EnZo_Submerged(EnZo* this, PlayState* play); +void EnZo_Surface(EnZo* this, PlayState* play); +void EnZo_TreadWater(EnZo* this, PlayState* play); +void EnZo_Dive(EnZo* this, PlayState* play); void EnZo_Ripple(EnZo* this, Vec3f* pos, f32 scale, f32 targetScale, u8 alpha) { EnZoEffect* effect; @@ -172,15 +172,15 @@ void EnZo_UpdateSplashes(EnZo* this) { } } -void EnZo_DrawRipples(EnZo* this, GlobalContext* globalCtx) { +void EnZo_DrawRipples(EnZo* this, PlayState* play) { EnZoEffect* effect; s16 i; u8 setup; effect = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); setup = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++) { if (effect->type == ENZO_EFFECT_RIPPLE) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); @@ -194,24 +194,24 @@ void EnZo_DrawRipples(EnZo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->color.a); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesModelDL); FrameInterpolation_RecordCloseChild(); } effect++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) { +void EnZo_DrawBubbles(EnZo* this, PlayState* play) { EnZoEffect* effect = this->effects; s16 i; u8 setup; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); setup = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++) { if (effect->type == ENZO_EFFECT_BUBBLE) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); @@ -225,28 +225,28 @@ void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesModelDL); FrameInterpolation_RecordCloseChild(); } effect++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnZo_DrawSplashes(EnZo* this, GlobalContext* globalCtx) { +void EnZo_DrawSplashes(EnZo* this, PlayState* play) { EnZoEffect* effect; s16 i; u8 setup; effect = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); setup = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++) { if (effect->type == ENZO_EFFECT_SPLASH) { FrameInterpolation_RecordOpenChild(effect, effect->epoch); @@ -259,9 +259,9 @@ void EnZo_DrawSplashes(EnZo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->color.a); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesModelDL); @@ -269,7 +269,7 @@ void EnZo_DrawSplashes(EnZo* this, GlobalContext* globalCtx) { } effect++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnZo_TreadWaterRipples(EnZo* this, f32 scale, f32 targetScale, u8 alpha) { @@ -361,10 +361,10 @@ void EnZo_SpawnSplashes(EnZo* this) { } } -u16 func_80B61024(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80B61024(PlayState* play, Actor* thisx) { u16 textId; - textId = Text_GetFaceReaction(globalCtx, 29); + textId = Text_GetFaceReaction(play, 29); if (textId != 0) { return textId; } @@ -447,8 +447,8 @@ u16 func_80B61024(GlobalContext* globalCtx, Actor* thisx) { return 0x4006; } -s16 func_80B61298(GlobalContext* globalCtx, Actor* thisx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 func_80B61298(PlayState* play, Actor* thisx) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -474,20 +474,20 @@ s16 func_80B61298(GlobalContext* globalCtx, Actor* thisx) { return 0; case TEXT_STATE_CHOICE: - switch (Message_ShouldAdvance(globalCtx)) { + switch (Message_ShouldAdvance(play)) { case 0: return 1; default: if (thisx->textId == 0x400C) { - thisx->textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x400D : 0x400E; - Message_ContinueTextbox(globalCtx, thisx->textId); + thisx->textId = (play->msgCtx.choiceIndex == 0) ? 0x400D : 0x400E; + Message_ContinueTextbox(play, thisx->textId); } break; } return 1; case TEXT_STATE_EVENT: - switch (Message_ShouldAdvance(globalCtx)) { + switch (Message_ShouldAdvance(play)) { case 0: return 1; default: @@ -508,8 +508,8 @@ void EnZo_Blink(EnZo* this) { } } -void EnZo_Dialog(EnZo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnZo_Dialog(EnZo* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_194.unk_18 = player->actor.world.pos; if (this->actionFunc == EnZo_Standing) { @@ -520,12 +520,12 @@ void EnZo_Dialog(EnZo* this, GlobalContext* globalCtx) { } func_80034A14(&this->actor, &this->unk_194, 11, this->unk_64C); if (this->canSpeak == true) { - func_800343CC(globalCtx, &this->actor, &this->unk_194.unk_00, this->dialogRadius, func_80B61024, func_80B61298); + func_800343CC(play, &this->actor, &this->unk_194.unk_00, this->dialogRadius, func_80B61024, func_80B61298); } } -s32 EnZo_PlayerInProximity(EnZo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnZo_PlayerInProximity(EnZo* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f surfacePos; f32 yDist; f32 hDist; @@ -575,13 +575,13 @@ void EnZo_SetAnimation(EnZo* this) { } } -void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Init(Actor* thisx, PlayState* play) { EnZo* this = (EnZo*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInit); if (LINK_IS_ADULT && ((this->actor.params & 0x3F) == 8)) { @@ -596,7 +596,7 @@ void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_64C = 1; this->canSpeak = false; this->unk_194.unk_00 = 0; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius, 0.0f, 5); if (this->actor.yDistToWater < 54.0f || (this->actor.params & 0x3F) == 8) { @@ -612,13 +612,13 @@ void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Destroy(Actor* thisx, PlayState* play) { } -void EnZo_Standing(EnZo* this, GlobalContext* globalCtx) { +void EnZo_Standing(EnZo* this, PlayState* play) { s16 angle; - func_80034F54(globalCtx, this->unk_656, this->unk_67E, 20); + func_80034F54(play, this->unk_656, this->unk_67E, 20); EnZo_SetAnimation(this); if (this->unk_194.unk_00 != 0) { this->unk_64C = 4; @@ -627,7 +627,7 @@ void EnZo_Standing(EnZo* this, GlobalContext* globalCtx) { angle = ABS((s16)((f32)this->actor.yawTowardsPlayer - (f32)this->actor.shape.rot.y)); if (angle < 0x4718) { - if (EnZo_PlayerInProximity(this, globalCtx)) { + if (EnZo_PlayerInProximity(this, play)) { this->unk_64C = 2; } else { this->unk_64C = 1; @@ -637,14 +637,14 @@ void EnZo_Standing(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_Submerged(EnZo* this, GlobalContext* globalCtx) { - if (EnZo_PlayerInProximity(this, globalCtx)) { +void EnZo_Submerged(EnZo* this, PlayState* play) { + if (EnZo_PlayerInProximity(this, play)) { this->actionFunc = EnZo_Surface; this->actor.velocity.y = 4.0f; } } -void EnZo_Surface(EnZo* this, GlobalContext* globalCtx) { +void EnZo_Surface(EnZo* this, PlayState* play) { if (this->actor.yDistToWater < 54.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_OUT_OF_WATER); EnZo_SpawnSplashes(this); @@ -659,8 +659,8 @@ void EnZo_Surface(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_656, this->unk_67E, 20); +void EnZo_TreadWater(EnZo* this, PlayState* play) { + func_80034F54(play, this->unk_656, this->unk_67E, 20); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->canSpeak = true; this->unk_64C = 4; @@ -679,7 +679,7 @@ void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { this->rippleTimer = 12; } - if (EnZo_PlayerInProximity(this, globalCtx) != 0) { + if (EnZo_PlayerInProximity(this, play) != 0) { this->timeToDive = Rand_S16Offset(40, 40); } else if (DECR(this->timeToDive) == 0) { f32 startFrame; @@ -695,7 +695,7 @@ void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_Dive(EnZo* this, GlobalContext* globalCtx) { +void EnZo_Dive(EnZo* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_DIVE_WATER); EnZo_SpawnSplashes(this); @@ -721,7 +721,7 @@ void EnZo_Dive(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Update(Actor* thisx, PlayState* play) { EnZo* this = (EnZo*)thisx; u32 pad; Vec3f pos; @@ -732,12 +732,12 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, this->collider.dim.radius, this->collider.dim.height * 0.25f, 0.0f, 5); - this->actionFunc(this, globalCtx); - EnZo_Dialog(this, globalCtx); + Actor_UpdateBgCheckInfo(play, thisx, this->collider.dim.radius, this->collider.dim.height * 0.25f, 0.0f, 5); + this->actionFunc(this, play); + EnZo_Dialog(this, play); // Spawn air bubbles - if (globalCtx->state.frames & 8) { + if (play->state.frames & 8) { pos = this->actor.world.pos; pos.y += (Rand_ZeroOne() - 0.5f) * 10.0f + 18.0f; @@ -748,7 +748,7 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { if ((s32)this->alpha != 0) { Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } EnZo_UpdateRipples(this); @@ -756,7 +756,7 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { EnZo_UpdateSplashes(this); } -s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZo* this = (EnZo*)thisx; Vec3s vec; @@ -783,7 +783,7 @@ s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnZo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZo* this = (EnZo*)thisx; Vec3f vec = { 0.0f, 600.0f, 0.0f }; @@ -792,27 +792,27 @@ void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Draw(Actor* thisx, PlayState* play) { EnZo* this = (EnZo*)thisx; void* eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; Matrix_Push(); - EnZo_DrawRipples(this, globalCtx); - EnZo_DrawBubbles(this, globalCtx); - EnZo_DrawSplashes(this, globalCtx); + EnZo_DrawRipples(this, play); + EnZo_DrawBubbles(this, play); + EnZo_DrawSplashes(this, play); Matrix_Pop(); if ((s32)this->alpha != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha == 255.0f) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexture])); - func_80034BA0(globalCtx, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); + func_80034BA0(play, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); } else { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexture])); - func_80034CC4(globalCtx, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); + func_80034CC4(play, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.h index 8911ce399..ba3960f98 100644 --- a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -18,7 +18,7 @@ typedef struct { u32 epoch; } EnZoEffect; // size = 0x38 -typedef void (*EnZoActionFunc)(struct EnZo*, GlobalContext*); +typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); typedef struct EnZo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index ad29739a5..93a09e68a 100644 --- a/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -31,19 +31,19 @@ typedef enum { /* 15 */ INTRO_READY = 15 } EnfHGIntroState; -void EnfHG_Init(Actor* thisx, GlobalContext* globalCtx); -void EnfHG_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx); -void EnfHG_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnfHG_Init(Actor* thisx, PlayState* play); +void EnfHG_Destroy(Actor* thisx, PlayState* play); +void EnfHG_Update(Actor* thisx, PlayState* play); +void EnfHG_Draw(Actor* thisx, PlayState* play); -void EnfHG_SetupIntro(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingIndex); -void EnfHG_Approach(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Retreat(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Done(EnfHG* this, GlobalContext* globalCtx); +void EnfHG_SetupIntro(EnfHG* this, PlayState* play); +void EnfHG_Intro(EnfHG* this, PlayState* play); +void EnfHG_SetupApproach(EnfHG* this, PlayState* play, s16 paintingIndex); +void EnfHG_Approach(EnfHG* this, PlayState* play); +void EnfHG_Attack(EnfHG* this, PlayState* play); +void EnfHG_Damage(EnfHG* this, PlayState* play); +void EnfHG_Retreat(EnfHG* this, PlayState* play); +void EnfHG_Done(EnfHG* this, PlayState* play); const ActorInit En_fHG_InitVars = { ACTOR_EN_FHG, @@ -69,37 +69,37 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_STOP), }; -void EnfHG_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnfHG_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnfHG* this = (EnfHG*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Flags_SetSwitch(globalCtx, 0x14); + Flags_SetSwitch(play, 0x14); Actor_SetScale(&this->actor, 0.011499999f); this->actor.gravity = -3.5f; ActorShape_Init(&this->actor.shape, -2600.0f, NULL, 20.0f); this->actor.speedXZ = 0.0f; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gPhantomHorseSkel, &gPhantomHorseRunningAnim); + Skin_Init(play, &this->skin, &gPhantomHorseSkel, &gPhantomHorseRunningAnim); if (this->actor.params >= GND_FAKE_BOSS) { - EnfHG_SetupApproach(this, globalCtx, this->actor.params - GND_FAKE_BOSS); + EnfHG_SetupApproach(this, play, this->actor.params - GND_FAKE_BOSS); } else { - EnfHG_SetupIntro(this, globalCtx); + EnfHG_SetupIntro(this, play); } } -void EnfHG_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnfHG_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnfHG* this = (EnfHG*)thisx; osSyncPrintf("F DT1\n"); - Skin_Free(globalCtx, &this->skin); + Skin_Free(play, &this->skin); osSyncPrintf("F DT2\n"); } -void EnfHG_SetupIntro(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_SetupIntro(EnfHG* this, PlayState* play) { Animation_PlayLoop(&this->skin.skelAnime, &gPhantomHorseIdleAnim); this->actionFunc = EnfHG_Intro; this->actor.world.pos.x = GND_BOSSROOM_CENTER_X; @@ -107,10 +107,10 @@ void EnfHG_SetupIntro(EnfHG* this, GlobalContext* globalCtx) { this->actor.world.pos.z = GND_BOSSROOM_CENTER_Z; } -void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Intro(EnfHG* this, PlayState* play) { static Vec3f audioVec = { 0.0f, 0.0f, 50.0f }; s32 pad64; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent; s32 pad58; s32 pad54; @@ -137,7 +137,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { case INTRO_START: if (gSaveContext.eventChkInf[7] & 4) { if (this->timers[0] == 55) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, GND_BOSSROOM_CENTER_X + 0.0f, GND_BOSSROOM_CENTER_Y - 97.0f, GND_BOSSROOM_CENTER_Z + 308.0f, 0, 0, 0, (SHUTTER_PG_BARS << 6)); } @@ -146,22 +146,22 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } if (this->timers[0] == 0) { - EnfHG_SetupApproach(this, globalCtx, Rand_ZeroOne() * 5.99f); + EnfHG_SetupApproach(this, play, Rand_ZeroOne() * 5.99f); this->bossGndSignal = FHG_START_FIGHT; } break; } - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->cutsceneCamera = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cutsceneCamera, CAM_STAT_ACTIVE); this->cutsceneState = INTRO_FENCE; this->timers[0] = 60; this->actor.world.pos.y = GND_BOSSROOM_CENTER_Y - 7.0f; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); gSaveContext.eventChkInf[7] |= 4; - Flags_SetSwitch(globalCtx, 0x23); + Flags_SetSwitch(play, 0x23); case INTRO_FENCE: player->actor.world.pos.x = GND_BOSSROOM_CENTER_X + 0.0f; player->actor.world.pos.y = GND_BOSSROOM_CENTER_Y + 7.0f; @@ -175,7 +175,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { this->cameraAt.y = GND_BOSSROOM_CENTER_Y + 47.0f; this->cameraAt.z = GND_BOSSROOM_CENTER_Z + 315.0f; if (this->timers[0] == 25) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, GND_BOSSROOM_CENTER_X + 0.0f, GND_BOSSROOM_CENTER_Y - 97.0f, GND_BOSSROOM_CENTER_Z + 308.0f, 0, 0, 0, (SHUTTER_PG_BARS << 6)); } @@ -192,7 +192,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_HORSE_GROAN); } if (this->timers[0] == 20) { - func_8002DF54(globalCtx, &this->actor, 9); + func_8002DF54(play, &this->actor, 9); } if (this->timers[0] == 1) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_OPENING_GANON); @@ -273,8 +273,8 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { -10.0f); } if (this->timers[0] == 90) { - globalCtx->envCtx.unk_BF = 2; - globalCtx->envCtx.unk_D6 = 0x14; + play->envCtx.unk_BF = 2; + play->envCtx.unk_D6 = 0x14; } if (this->timers[0] == 100) { this->bossGndSignal = FHG_LIGHTNING; @@ -331,7 +331,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 2.0f * Math_SinS(this->gallopTimer * 0x5DC); Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, 0.05f); if (this->timers[0] == 75) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gPhantomGanonTitleCardTex), 160, 180, 128, 40, true); } if (this->timers[0] == 0) { @@ -353,7 +353,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { this->bossGndSignal = FHG_FINISH; } if (this->timers[0] == 170) { - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_MASIC2); } Math_ApproachF(&this->cameraEye.z, this->cameraPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, @@ -365,7 +365,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { if ((fabsf(this->actor.world.pos.z - (GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f)) < 300.0f) && !this->spawnedWarp) { this->spawnedWarp = true; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, GND_BOSSROOM_CENTER_X + 0.0f, this->actor.world.pos.y + 50.0f, GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f, 0, this->actor.shape.rot.y, 0, FHGFIRE_WARP_RETREAT); @@ -375,8 +375,8 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { Math_ApproachF(&this->cameraAt.z, this->actor.world.pos.z, 0.2f, 50.0f); osSyncPrintf("TIME %d-------------------------------------------------\n", this->timers[0]); if (fabsf(this->actor.world.pos.z - (GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f)) < 1.0f) { - globalCtx->envCtx.unk_BF = 0; - globalCtx->envCtx.unk_D6 = 0x14; + play->envCtx.unk_BF = 0; + play->envCtx.unk_D6 = 0x14; this->cutsceneState = INTRO_FINISH; Animation_MorphToLoop(&this->skin.skelAnime, &gPhantomHorseRunningAnim, -3.0f); this->bossGndSignal = FHG_START_FIGHT; @@ -385,32 +385,32 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { } break; case INTRO_FINISH: - EnfHG_Retreat(this, globalCtx); + EnfHG_Retreat(this, play); Math_ApproachF(&this->cameraEye.z, this->cameraPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, this->cameraSpeedMod * 1.5f); Math_ApproachF(&this->cameraPanZ, -100.0f, 0.1f, 1.0f); Math_ApproachF(&this->cameraAt.y, (this->actor.world.pos.y + 70.0f) - 20.0f, 0.1f, this->cameraSpeedMod * 10.0f); if (this->timers[1] == 0) { - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* camera = Play_GetCamera(play, 0); camera->eye = this->cameraEye; camera->eyeNext = this->cameraEye; camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->cutsceneCamera, 0); + func_800C08AC(play, this->cutsceneCamera, 0); this->cutsceneCamera = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->actionFunc = EnfHG_Retreat; } break; } if (this->cutsceneCamera != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &this->cameraAt, &this->cameraEye); + Play_CameraSetAtEye(play, this->cutsceneCamera, &this->cameraAt, &this->cameraEye); } } -void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingIndex) { +void EnfHG_SetupApproach(EnfHG* this, PlayState* play, s16 paintingIndex) { s16 oppositeIndex[6] = { 3, 4, 5, 0, 1, 2 }; Animation_MorphToLoop(&this->skin.skelAnime, &gPhantomHorseRunningAnim, 0.0f); @@ -448,9 +448,9 @@ void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingInde this->actor.scale.z = 0.001f; this->approachRate = 0.0f; - this->warpColorFilterR = globalCtx->lightCtx.fogColor[0]; - this->warpColorFilterG = globalCtx->lightCtx.fogColor[1]; - this->warpColorFilterB = globalCtx->lightCtx.fogColor[2]; + this->warpColorFilterR = play->lightCtx.fogColor[0]; + this->warpColorFilterG = play->lightCtx.fogColor[1]; + this->warpColorFilterB = play->lightCtx.fogColor[2]; this->warpColorFilterUnk1 = 0.0f; this->warpColorFilterUnk2 = 0.0f; this->turnRot = 0; @@ -458,7 +458,7 @@ void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingInde this->spawnedWarp = false; } -void EnfHG_Approach(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Approach(EnfHG* this, PlayState* play) { osSyncPrintf("STANDBY !!\n"); osSyncPrintf("XP2 = %f\n", this->actor.world.pos.x); osSyncPrintf("ZP2 = %f\n", this->actor.world.pos.z); @@ -486,7 +486,7 @@ void EnfHG_Approach(EnfHG* this, GlobalContext* globalCtx) { this->actionFunc = EnfHG_Attack; Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_HORSE_NEIGH); this->timers[0] = 40; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, this->actor.world.pos.y + 50.0f, this->actor.world.pos.z, 0, this->actor.shape.rot.y + 0x8000, 0, FHGFIRE_WARP_EMERGE); this->fhgFireKillWarp = false; @@ -494,7 +494,7 @@ void EnfHG_Approach(EnfHG* this, GlobalContext* globalCtx) { } } -void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Attack(EnfHG* this, PlayState* play) { osSyncPrintf("KABE OUT !!\n"); this->bossGndInPainting = false; SkelAnime_Update(&this->skin.skelAnime); @@ -510,9 +510,9 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { Math_ApproachF(&this->warpColorFilterB, 255.0f, 1.0f, 10.0f); Math_ApproachF(&this->warpColorFilterUnk1, -60.0f, 1.0f, 5.0f); } else { - Math_ApproachF(&this->warpColorFilterR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterG, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterB, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterG, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterB, play->lightCtx.fogColor[0], 1.0f, 10.0f); Math_ApproachF(&this->warpColorFilterUnk1, 0.0f, 1.0f, 5.0f); if (this->timers[1] == 29) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_MASIC2); @@ -520,7 +520,7 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { } if (this->hitTimer == 0) { if (this->timers[1] == 24) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, (this->actor.world.pos.y + 100.0f) + 25.0f, this->actor.world.pos.z, 0, 0, 0, FHGFIRE_LIGHTNING_STRIKE); } @@ -558,7 +558,7 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { } if ((dxz < 300.0f) && !this->spawnedWarp) { this->spawnedWarp = true; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, this->actor.world.pos.y + 50.0f, this->inPaintingPos.z, 0, this->actor.shape.rot.y, 0, FHGFIRE_WARP_RETREAT); this->fhgFireKillWarp = true; @@ -576,16 +576,16 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { } } -void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Damage(EnfHG* this, PlayState* play) { f32 dx; f32 dz; f32 dxz2; osSyncPrintf("REVISE !!\n"); SkelAnime_Update(&this->skin.skelAnime); - Math_ApproachF(&this->warpColorFilterR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterG, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterB, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterG, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterB, play->lightCtx.fogColor[0], 1.0f, 10.0f); Math_ApproachF(&this->warpColorFilterUnk1, 0.0f, 1.0f, 5.0f); Math_ApproachF(&this->actor.scale.z, 0.011499999f, 1.0f, 0.002f); if (this->timers[0] != 0) { @@ -607,7 +607,7 @@ void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx) { dxz2 = sqrtf(SQ(dx) + SQ(dz)); if ((dxz2 < 300.0f) && (!this->spawnedWarp)) { this->spawnedWarp = true; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, this->actor.world.pos.y + 50.0f, this->inPaintingPos.z, 0, this->actor.shape.rot.y + 0x8000, 0, FHGFIRE_WARP_RETREAT); } @@ -626,7 +626,7 @@ void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx) { } } -void EnfHG_Retreat(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Retreat(EnfHG* this, PlayState* play) { osSyncPrintf("KABE IN !!\n"); if (this->turnTarget != 0) { Math_ApproachS(&this->turnRot, this->turnTarget, 5, 2000); @@ -660,23 +660,23 @@ void EnfHG_Retreat(EnfHG* this, GlobalContext* globalCtx) { this->actor.draw = NULL; } else { paintingIdxReal = Rand_ZeroOne() * 5.99f; - EnfHG_SetupApproach(this, globalCtx, paintingIdxReal); + EnfHG_SetupApproach(this, play, paintingIdxReal); do { paintingIdxFake = Rand_ZeroOne() * 5.99f; } while (paintingIdxFake == paintingIdxReal); osSyncPrintf("ac1 = %x `````````````````````````````````````````````````\n", - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANONDROF, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANONDROF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, paintingIdxFake + GND_FAKE_BOSS)); } } } -void EnfHG_Done(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Done(EnfHG* this, PlayState* play) { this->bossGndInPainting = false; } -void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnfHG_Update(Actor* thisx, PlayState* play) { s32 pad; EnfHG* this = (EnfHG*)thisx; u8 i; @@ -693,7 +693,7 @@ void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->hitTimer != 0) { this->hitTimer--; @@ -707,23 +707,23 @@ void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = (s16)(Math_SinS(this->hitTimer * 0x7000) * 1500.0f) * (this->hitTimer / 20.0f); } -void EnfHG_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnfHG_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } -void EnfHG_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnfHG_Draw(Actor* thisx, PlayState* play) { EnfHG* this = (EnfHG*)thisx; BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); POLY_OPA_DISP = ((bossGnd->work[GND_INVINC_TIMER] & 4) && (bossGnd->flyMode == GND_FLY_PAINTING)) ? Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099) : Gfx_SetFog(POLY_OPA_DISP, (u32)this->warpColorFilterR, (u32)this->warpColorFilterG, (u32)this->warpColorFilterB, 0, (s32)this->warpColorFilterUnk1 + 995, (s32)this->warpColorFilterUnk2 + 1000); - func_800A6330(&this->actor, globalCtx, &this->skin, EnfHG_PostDraw, SKIN_TRANSFORM_IS_FHG); - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + func_800A6330(&this->actor, play, &this->skin, EnfHG_PostDraw, SKIN_TRANSFORM_IS_FHG); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.h b/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.h index befbbc49d..146590a1f 100644 --- a/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.h +++ b/soh/src/overlays/actors/ovl_En_fHG/z_en_fhg.h @@ -6,7 +6,7 @@ struct EnfHG; -typedef void (*EnfHGActionFunc)(struct EnfHG*, GlobalContext*); +typedef void (*EnfHGActionFunc)(struct EnfHG*, PlayState*); typedef enum { /* 0 */ FHG_NO_SIGNAL, diff --git a/soh/src/overlays/actors/ovl_End_Title/z_end_title.c b/soh/src/overlays/actors/ovl_End_Title/z_end_title.c index 6e00807f2..8be68b6bf 100644 --- a/soh/src/overlays/actors/ovl_End_Title/z_end_title.c +++ b/soh/src/overlays/actors/ovl_End_Title/z_end_title.c @@ -8,11 +8,11 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EndTitle_Init(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_Update(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_DrawNintendoLogo(Actor* thisx, GlobalContext* globalCtx); +void EndTitle_Init(Actor* thisx, PlayState* play); +void EndTitle_Destroy(Actor* thisx, PlayState* play); +void EndTitle_Update(Actor* thisx, PlayState* play); +void EndTitle_DrawFull(Actor* thisx, PlayState* play); +void EndTitle_DrawNintendoLogo(Actor* thisx, PlayState* play); const ActorInit End_Title_InitVars = { ACTOR_END_TITLE, @@ -29,7 +29,7 @@ const ActorInit End_Title_InitVars = { #include "overlays/ovl_End_Title/ovl_End_Title.h" -void EndTitle_Init(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_Init(Actor* thisx, PlayState* play) { EndTitle* this = (EndTitle*)thisx; this->endAlpha = 0; @@ -40,37 +40,37 @@ void EndTitle_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EndTitle_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_Destroy(Actor* thisx, PlayState* play) { } -void EndTitle_Update(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_Update(Actor* thisx, PlayState* play) { } // Used in the castle courtyard -void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_DrawFull(Actor* thisx, PlayState* play) { MtxF* mf; EndTitle* this = (EndTitle*)thisx; - s32 frameCount = globalCtx->csCtx.frames; - Player* player = GET_PLAYER(globalCtx); + s32 frameCount = play->csCtx.frames; + Player* player = GET_PLAYER(play); mf = &player->mf_9E0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // Draw the Triforce on Link's left hand - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Mult(mf, MTXMODE_NEW); Matrix_Translate(0.0f, 150.0f, 170.0f, MTXMODE_APPLY); Matrix_Scale(0.13f, 0.13f, 0.13f, MTXMODE_APPLY); Matrix_RotateX(0xBB8 * M_PI / 0x8000, MTXMODE_APPLY); Matrix_RotateY(0.0f, MTXMODE_APPLY); Matrix_RotateZ(0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sTriforceDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // Draw title cards on the screen if ((frameCount > 890) && (this->endAlpha < 200)) { @@ -112,24 +112,24 @@ void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx) { 1 << 10); if (D_801614B0.a > 0) gsSPGrayscale(OVERLAY_DISP++, true); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Used in the Temple of Time -void EndTitle_DrawNintendoLogo(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_DrawNintendoLogo(Actor* thisx, PlayState* play) { EndTitle* this = (EndTitle*)thisx; s32 pad; - s32 frames = globalCtx->csCtx.frames; + s32 frames = play->csCtx.frames; if ((frames >= 1101) && (this->endAlpha < 255)) { this->endAlpha += 3; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); OVERLAY_DISP = func_80093F34(OVERLAY_DISP); gDPSetPrimColor(OVERLAY_DISP++, 0, 0x80, 0, 0, 0, this->endAlpha); gSPDisplayList(OVERLAY_DISP++, sPresentedByNintendoDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c index 402633330..570fcae82 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -14,14 +14,14 @@ #define FLAGS ACTOR_FLAG_4 -#define WATER_SURFACE_Y(globalCtx) globalCtx->colCtx.colHeader->waterBoxes->ySurface +#define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->ySurface -void Fishing_Init(Actor* thisx, GlobalContext* globalCtx); -void Fishing_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx); -void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx); -void Fishing_DrawFish(Actor* thisx, GlobalContext* globalCtx); -void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx); +void Fishing_Init(Actor* thisx, PlayState* play); +void Fishing_Destroy(Actor* thisx, PlayState* play); +void Fishing_UpdateFish(Actor* thisx, PlayState* play); +void Fishing_UpdateOwner(Actor* thisx, PlayState* play); +void Fishing_DrawFish(Actor* thisx, PlayState* play); +void Fishing_DrawOwner(Actor* thisx, PlayState* play); typedef struct { /* 0x00 */ u8 unk_00; @@ -754,7 +754,7 @@ static FishingPropInit sPondPropInits[POND_PROP_COUNT + 1] = { { FS_PROP_INIT_STOP, { 0 } }, }; -void Fishing_InitPondProps(Fishing* this, GlobalContext* globalCtx) { +void Fishing_InitPondProps(Fishing* this, PlayState* play) { FishingProp* prop = &sPondProps[0]; Vec3f colliderPos; s16 i; @@ -825,8 +825,8 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Fishing_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Fishing* this = (Fishing*)thisx; u16 fishCount; s16 i; @@ -843,12 +843,12 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { if (thisx->params < 100) { D_80B7E074 = 0; sFishingMain = this; - Collider_InitJntSph(globalCtx, &sFishingMain->collider); - Collider_SetJntSph(globalCtx, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements); + Collider_InitJntSph(play, &sFishingMain->collider); + Collider_SetJntSph(play, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements); thisx->params = 1; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingOwnerSkel, &gFishingOwnerAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingOwnerSkel, &gFishingOwnerAnim, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingOwnerAnim, 0.0f); thisx->update = Fishing_UpdateOwner; @@ -876,7 +876,7 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } D_80B7A684 = 20; - globalCtx->specialEffects = sFishingEffects; + play->specialEffects = sFishingEffects; gTimeIncrement = 1; D_80B7E0AC = 0; D_80B7E0A6 = 10; @@ -899,10 +899,10 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { D_80B7E07D = (HIGH_SCORE(HS_FISHING) & 0xFF0000) >> 0x10; if ((D_80B7E07D & 7) == 7) { - globalCtx->roomCtx.unk_74[0] = 90; + play->roomCtx.unk_74[0] = 90; D_80B7E076 = 1; } else { - globalCtx->roomCtx.unk_74[0] = 40; + play->roomCtx.unk_74[0] = 40; D_80B7E076 = 0; } @@ -962,10 +962,10 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - Fishing_InitPondProps(this, globalCtx); - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_KANBAN, 53.0f, -17.0f, 982.0f, 0, 0, 0, + Fishing_InitPondProps(this, play); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_KANBAN, 53.0f, -17.0f, 982.0f, 0, 0, 0, ENKANBAN_FISHING); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); + Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); if ((KREG(1) == 1) || ((D_80B7E07D & 3) == 3)) { if (sLinkAge != 1) { @@ -978,15 +978,15 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } for (i = 0; i < fishCount; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_FISHING, sFishInits[i].pos.x, sFishInits[i].pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, sFishInits[i].pos.x, sFishInits[i].pos.y, sFishInits[i].pos.z, 0, Rand_ZeroFloat(0x10000), 0, 100 + i); } } else { if ((thisx->params < 115) || (thisx->params == 200)) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); } @@ -994,10 +994,10 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { if (thisx->params == 200) { this->unk_158 = 100; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); thisx->targetMode = 0; thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } else { this->unk_158 = 10; this->unk_15A = 10; @@ -1023,20 +1023,20 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void Fishing_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Fishing_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Fishing* this = (Fishing*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); if (thisx->params == 200) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } else if (thisx->params == 1) { - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } } -void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { +void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) { f32 rippleY; s16 i; @@ -1069,7 +1069,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { Math_ApproachF(&effect->unk_30, effect->unk_34, 0.1f, 0.1f); effect->alpha -= 10; - if (effect->pos.y > (WATER_SURFACE_Y(globalCtx) - 5.0f)) { + if (effect->pos.y > (WATER_SURFACE_Y(play) - 5.0f)) { effect->accel.y = 0.0f; effect->vel.y = 0.0f; effect->alpha -= 5; @@ -1080,7 +1080,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { } } else if (effect->type == FS_EFF_BUBBLE) { if (effect->unk_2C == 0) { - rippleY = WATER_SURFACE_Y(globalCtx); + rippleY = WATER_SURFACE_Y(play); } else { rippleY = 69.0f; } @@ -1091,7 +1091,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.3f) { Vec3f pos = effect->pos; pos.y = rippleY; - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 20.0f, 60.0f, 150, 90); + Fishing_SpawnRipple(NULL, play->specialEffects, &pos, 20.0f, 60.0f, 150, 90); } } } else if (effect->type == FS_EFF_DUST_SPLASH) { @@ -1100,25 +1100,25 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { effect->accel.y = 0.0f; } - if (effect->pos.y <= WATER_SURFACE_Y(globalCtx)) { + if (effect->pos.y <= WATER_SURFACE_Y(play)) { effect->type = FS_EFF_NONE; if (Rand_ZeroOne() < 0.5f) { Vec3f pos = effect->pos; - pos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 40.0f, 110.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &pos, 40.0f, 110.0f, 150, 90); } } } else if (effect->type == FS_EFF_RAIN_DROP) { - if (effect->pos.y < WATER_SURFACE_Y(globalCtx)) { + if (effect->pos.y < WATER_SURFACE_Y(play)) { f32 sqDistXZ = SQ(effect->pos.x) + SQ(effect->pos.z); if (sqDistXZ > SQ(920.0f)) { - effect->pos.y = WATER_SURFACE_Y(globalCtx) + ((sqrtf(sqDistXZ) - 920.0f) * 0.11f); + effect->pos.y = WATER_SURFACE_Y(play) + ((sqrtf(sqDistXZ) - 920.0f) * 0.11f); effect->timer = KREG(17) + 2; effect->type = FS_EFF_RAIN_SPLASH; effect->unk_30 = (KREG(18) + 30) * 0.001f; } else { - effect->pos.y = WATER_SURFACE_Y(globalCtx) + 3.0f; + effect->pos.y = WATER_SURFACE_Y(play) + 3.0f; effect->timer = 0; if (Rand_ZeroOne() < 0.75f) { effect->type = FS_EFF_RAIN_RIPPLE; @@ -1148,7 +1148,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { Math_ApproachS(&sEffOwnerHatRot.z, -0x4000, 20, 100); sqDistXZ = SQ(effect->pos.x) + SQ(effect->pos.z); - bottomY = WATER_SURFACE_Y(globalCtx) + ((sqrtf(sqDistXZ) - 920.0f) * 0.147f); + bottomY = WATER_SURFACE_Y(play) + ((sqrtf(sqDistXZ) - 920.0f) * 0.147f); if (effect->pos.y > (bottomY - 10.0f)) { effect->pos.y -= 0.1f; @@ -1156,8 +1156,8 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { if ((effect->timer % 16) == 0) { Vec3f pos = effect->pos; - pos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 30.0f, 300.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &pos, 30.0f, 300.0f, 150, 90); } if (effect->unk_2C >= 0) { @@ -1165,12 +1165,12 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { } if (effect->unk_2C == 30) { - Message_StartTextbox(globalCtx, 0x40B3, NULL); + Message_StartTextbox(play, 0x40B3, NULL); } - if ((effect->unk_2C >= 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT)) { - if (Message_ShouldAdvance(globalCtx) || (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - Message_CloseTextbox(globalCtx); + if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) { + if (Message_ShouldAdvance(play) || (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + Message_CloseTextbox(play); Rupees_ChangeBy(-50); effect->unk_2C = -1; } @@ -1182,14 +1182,14 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { } } -void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { +void Fishing_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(); @@ -1209,7 +1209,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->unk_30, 1.0f, effect->unk_30, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRippleModelDL); @@ -1232,10 +1232,10 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingDustSplashModelDL); @@ -1258,14 +1258,14 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 40, 90, 80, effect->alpha); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, effect->timer + (i * 3), + 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), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingWaterDustModelDL); @@ -1287,10 +1287,10 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingBubbleModelDL); @@ -1317,7 +1317,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_RotateZ(effect->unk_3C, MTXMODE_APPLY); Matrix_Scale(0.002f, 1.0f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRainDropModelDL); @@ -1326,7 +1326,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { effect++; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); effect = firstEffect + 30; flag = 0; @@ -1343,7 +1343,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->unk_30, 1.0f, effect->unk_30, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRippleModelDL); @@ -1370,11 +1370,11 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateY(rotY, MTXMODE_APPLY); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRainSplashModelDL); @@ -1393,7 +1393,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Scale(effect->unk_30, effect->unk_30, effect->unk_30, MTXMODE_APPLY); Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL); @@ -1402,28 +1402,28 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Fishing_DrawStreamSplash(GlobalContext* globalCtx) { +void Fishing_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), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFishingStreamSplashDL)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s32 func_80B6C2EC(Vec3f* vec) { @@ -1437,7 +1437,7 @@ s32 func_80B6C2EC(Vec3f* vec) { return false; } -void Fishing_UpdateLine(GlobalContext* globalCtx, Vec3f* basePos, Vec3f* pos, Vec3f* rot, Vec3f* unk) { +void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, Vec3f* unk) { s16 i; s16 k; f32 dx; @@ -1502,14 +1502,14 @@ void Fishing_UpdateLine(GlobalContext* globalCtx, Vec3f* basePos, Vec3f* pos, Ve sqDistXZ = SQ((pos + i)->x) + SQ((pos + i)->z); if (sqDistXZ > SQ(920.0f)) { - phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.11f) + WATER_SURFACE_Y(globalCtx); + phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play); } else { - phi_f12 = WATER_SURFACE_Y(globalCtx); + phi_f12 = WATER_SURFACE_Y(play); } if (D_80B7E0B6 == 2) { if (spD8 < phi_f12) { - phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.147f) + WATER_SURFACE_Y(globalCtx); + phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.147f) + WATER_SURFACE_Y(play); if (spD8 > phi_f12) { phi_f2 = (spD8 - phi_f12) * 0.05f; if (phi_f2 > 0.29999998f) { @@ -1594,7 +1594,7 @@ void Fishing_UpdateLinePos(Vec3f* pos) { } } -void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u8 hookIndex) { +void Fishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookIndex) { f32 dx; f32 dy; f32 dz; @@ -1604,15 +1604,15 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u f32 offsetY; Vec3f posSrc = { 0.0f, 0.0f, 1.0f }; Vec3f posStep; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - if ((D_80B7A694 == 3) && ((pos->y > WATER_SURFACE_Y(globalCtx)) || ((D_80B7A68C != 0) && hookIndex))) { + if ((D_80B7A694 == 3) && ((pos->y > WATER_SURFACE_Y(play)) || ((D_80B7A68C != 0) && hookIndex))) { offsetY = 0.0f; - } else if (pos->y < WATER_SURFACE_Y(globalCtx)) { + } else if (pos->y < WATER_SURFACE_Y(play)) { offsetY = -1.0f; } else { offsetY = -3.0f; @@ -1647,13 +1647,13 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u Matrix_Scale(0.0039999997f, 0.0039999997f, 0.005f, MTXMODE_APPLY); Matrix_RotateY(M_PI, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); @@ -1663,7 +1663,7 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u Matrix_Push(); if (D_80B7A690 != 0) { - FishingEffect* effect = globalCtx->specialEffects; + FishingEffect* effect = play->specialEffects; MtxF mf; Matrix_MultVec3f(&sZeroVec, &effect->pos); @@ -1683,17 +1683,17 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 Fishing_UpdateSinkingLure(GlobalContext* globalCtx) { +void Fishing_UpdateSinkingLure(PlayState* play) { s16 i; f32 dx; f32 dy; @@ -1708,7 +1708,7 @@ void Fishing_UpdateSinkingLure(GlobalContext* globalCtx) { Vec3f sp88; f32 offsetX; f32 offsetZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); posSrc.z = 0.85f; @@ -1716,7 +1716,7 @@ void Fishing_UpdateSinkingLure(GlobalContext* globalCtx) { if (D_80B7A6D4 != 0) { offsetY = -1.0f; - } else if (sLurePos.y < WATER_SURFACE_Y(globalCtx)) { + } else if (sLurePos.y < WATER_SURFACE_Y(play)) { offsetY = 0.5f; } else { offsetY = -5.0f; @@ -1763,16 +1763,16 @@ static f32 sSinkingLureSizes[] = { 0.9f, 0.85f, 0.8f, 0.7f, 0.8f, 1.0f, 1.2f, 1.1f, 1.0f, 0.8f, }; -void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { +void Fishing_DrawSinkingLure(PlayState* play) { s16 i; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - Fishing_UpdateSinkingLure(globalCtx); + Fishing_UpdateSinkingLure(play); - if (sLurePos.y < WATER_SURFACE_Y(globalCtx)) { - func_80093D18(globalCtx->state.gfxCtx); + if (sLurePos.y < WATER_SURFACE_Y(play)) { + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentMaterialDL); @@ -1782,16 +1782,16 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentModelDL); FrameInterpolation_RecordCloseChild(); } } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentMaterialDL); @@ -1801,9 +1801,9 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentModelDL); FrameInterpolation_RecordCloseChild(); @@ -1811,27 +1811,27 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* lineRot) { +void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) { Vec3f posSrc; Vec3f posStep; Vec3f hookPos[2]; s16 i; s16 spB4 = D_80B7E144; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Push(); if (D_80B7A6D4 != 0) { Vec3f posTemp = sLurePos; sLurePos = sSinkingLureBasePos; - Fishing_DrawSinkingLure(globalCtx); + Fishing_DrawSinkingLure(play); sLurePos = posTemp; } @@ -1867,9 +1867,9 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_RotateY(M_PI / 2, MTXMODE_APPLY); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureFloatDL); @@ -1881,12 +1881,12 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li posSrc.x = 500.0f; posSrc.z = -300.0f; Matrix_MultVec3f(&posSrc, &hookPos[0]); - Fishing_DrawLureHook(globalCtx, &hookPos[0], &sLureHookRefPos[0], 0); + Fishing_DrawLureHook(play, &hookPos[0], &sLureHookRefPos[0], 0); posSrc.x = 2100.0f; posSrc.z = -50.0f; Matrix_MultVec3f(&posSrc, &hookPos[1]); - Fishing_DrawLureHook(globalCtx, &hookPos[1], &sLureHookRefPos[1], 1); + Fishing_DrawLureHook(play, &hookPos[1], &sLureHookRefPos[1], 1); } POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); @@ -1917,7 +1917,7 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateX(rx, MTXMODE_APPLY); Matrix_Scale(D_80B7E14C, 1.0f, dist, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineModelDL); } else { @@ -1945,7 +1945,7 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateX(rx, MTXMODE_APPLY); Matrix_Scale(D_80B7E14C, 1.0f, dist, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineModelDL); break; @@ -1956,16 +1956,16 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateX((lineRot + i)->x, MTXMODE_APPLY); Matrix_Scale(D_80B7E14C, 1.0f, 0.005f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineModelDL); } } Matrix_Pop(); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static f32 sRodScales[22] = { @@ -1981,16 +1981,16 @@ static f32 sRodBendRatios[22] = { static Vec3f sRodTipOffset = { 0.0f, 0.0f, 0.0f }; -void Fishing_DrawRod(GlobalContext* globalCtx) { +void Fishing_DrawRod(PlayState* play) { s16 i; f32 spC8; f32 spC4; f32 spC0; - Input* input = &globalCtx->state.input[0]; - Player* player = GET_PLAYER(globalCtx); + Input* input = &play->state.input[0]; + Player* player = GET_PLAYER(play); s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (D_80B7FDA8 != 0) { D_80B7FDA8--; @@ -2058,7 +2058,7 @@ void Fishing_DrawRod(GlobalContext* globalCtx) { } } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFishingRodMaterialDL); @@ -2094,7 +2094,7 @@ void Fishing_DrawRod(GlobalContext* globalCtx) { Matrix_Push(); Matrix_Scale(sRodScales[i], sRodScales[i], 0.52f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (i < 5) { @@ -2118,12 +2118,12 @@ void Fishing_DrawRod(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static Vec3f D_80B7AF94 = { 0.0f, 0.0f, 0.0f }; -void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { +void Fishing_UpdateLure(Fishing* this, PlayState* play) { f32 spE4; f32 spE0; s16 phi_v0; @@ -2134,12 +2134,12 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { f32 phi_f16; f32 spC8; s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f spA8; Vec3f sp9C; Vec3f sp90; - Input* input = &globalCtx->state.input[0]; + Input* input = &play->state.input[0]; Vec3f sp80; f32 sp7C; f32 sp78; @@ -2210,7 +2210,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sLurePos, &D_80B7AF94, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sLurePos, &D_80B7AF94, &sProjectedW); if (D_80B7A694 == 0) { Math_ApproachF(&D_80B7E108, -800.0f, 1.0f, 20.0f); @@ -2240,7 +2240,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { if (D_80B7E0B4 == 0) { if ((D_80B7E0B0 == 0) && (player->unk_860 == 1)) { D_80B7E0B4 = 37; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } else { sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; @@ -2310,7 +2310,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { (sLurePos.z > 1350.0f) || (sLurePos.z < 1100.0f) || (sLurePos.y < 45.0f)) { sp80 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 30.0f, 0x43); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, 0x43); this->actor.world.pos = sp80; if (this->actor.bgCheckFlags & 0x10) { @@ -2329,7 +2329,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } - spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(globalCtx); + spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play); if (sLurePos.y <= spE4) { sLurePos.y = spE4; D_80B7E0E8.x = D_80B7E0E8.y = D_80B7E0E8.z = 0.0f; @@ -2340,7 +2340,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { func_80078914(&D_80B7AF94, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG); } } else { - spE4 = WATER_SURFACE_Y(globalCtx); + spE4 = WATER_SURFACE_Y(play); if (sLurePos.y <= spE4) { D_80B7A694 = 2; @@ -2353,7 +2353,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { D_80B7E0A2 = 10; } - if ((sLurePos.y <= spE4) && (spE4 < spE0) && (spE4 == WATER_SURFACE_Y(globalCtx))) { + if ((sLurePos.y <= spE4) && (spE4 < spE0) && (spE4 == WATER_SURFACE_Y(play))) { D_80B7E114 = 10; func_80078914(&D_80B7AF94, NA_SE_EV_BOMB_DROP_WATER); D_80B7E0F8.y = 0.0f; @@ -2369,15 +2369,15 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { spA8 = sLurePos; spA8.x += (sp9C.x * 3.0f); - spA8.y = WATER_SURFACE_Y(globalCtx); + spA8.y = WATER_SURFACE_Y(play); spA8.z += (sp9C.z * 3.0f); - Fishing_SpawnDustSplash(NULL, globalCtx->specialEffects, &spA8, &sp9C, + Fishing_SpawnDustSplash(NULL, play->specialEffects, &spA8, &sp9C, Rand_ZeroFloat(0.02f) + 0.025f); } spA8 = sLurePos; - spA8.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &spA8, 100.0f, 800.0f, 150, 90); + spA8.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &spA8, 100.0f, 800.0f, 150, 90); } } else { Math_ApproachZeroF(&D_80B7E148, 1.0f, 0.05f); @@ -2394,13 +2394,13 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { break; case 2: - if (sLurePos.y <= WATER_SURFACE_Y(globalCtx)) { + if (sLurePos.y <= WATER_SURFACE_Y(play)) { sLurePos.y += D_80B7E0E8.y; Math_ApproachZeroF(&D_80B7E0E8.y, 1.0f, 1.0f); if (D_80B7E0B6 != 2) { - Math_ApproachF(&sLurePos.y, WATER_SURFACE_Y(globalCtx), 0.5f, 1.0f); + Math_ApproachF(&sLurePos.y, WATER_SURFACE_Y(play), 0.5f, 1.0f); } } @@ -2432,7 +2432,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } spDC = 0x4000; - spE4 = WATER_SURFACE_Y(globalCtx); + spE4 = WATER_SURFACE_Y(play); spC8 = SQ(sLurePos.x) + SQ(sLurePos.z); if (spC8 < SQ(920.0f)) { @@ -2506,7 +2506,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } } else { - spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(globalCtx); + spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play); if (sLurePos.y <= spE4) { sLurePos.y = spE4; spDC = 0x500; @@ -2556,11 +2556,11 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } else { D_80B7E104 = -0.5f; } - } else if (sReelLinePos[LINE_SEG_COUNT - 1].y < (WATER_SURFACE_Y(globalCtx) + phi_f0)) { + } else if (sReelLinePos[LINE_SEG_COUNT - 1].y < (WATER_SURFACE_Y(play) + phi_f0)) { if (D_80B7E0B6 == 2) { sp58 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 30.0f, 0x44); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, 0x44); this->actor.world.pos = sp58; D_80B7E128.y += -0.5f; @@ -2575,7 +2575,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { D_80B7E120 = 1; } } else { - D_80B7E128.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(globalCtx)) * 0.2f; + D_80B7E128.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(play)) * 0.2f; if (D_80B7E128.y > 1.5f) { D_80B7E128.y = 1.5f; } @@ -2603,7 +2603,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { Math_ApproachF(&D_80B7E154, 1000.0f, 1.0f, 0.2f); } - if (sReelLinePos[LINE_SEG_COUNT - 1].y > (WATER_SURFACE_Y(globalCtx) + 4.0f)) { + if (sReelLinePos[LINE_SEG_COUNT - 1].y > (WATER_SURFACE_Y(play) + 4.0f)) { Math_ApproachF(&D_80B7E148, 3.0f, 1.0f, 0.2f); } else { Math_ApproachF(&D_80B7E148, 1.0f, 1.0f, 0.2f); @@ -2629,8 +2629,8 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { D_80B7A6CC = 3; } - if ((sLurePos.y <= (WATER_SURFACE_Y(globalCtx) + 4.0f)) && - (sLurePos.y >= (WATER_SURFACE_Y(globalCtx) - 4.0f))) { + if ((sLurePos.y <= (WATER_SURFACE_Y(play) + 4.0f)) && + (sLurePos.y >= (WATER_SURFACE_Y(play) - 4.0f))) { phi_v0 = 63; if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (D_80B7E138 > 1.0f)) { @@ -2639,8 +2639,8 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { if ((D_80B7E0AE & phi_v0) == 0) { spA8 = sLurePos; - spA8.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &spA8, 30.0f, 300.0f, 150, 90); + spA8.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &spA8, 30.0f, 300.0f, 150, 90); } } break; @@ -2679,7 +2679,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } -s32 func_80B70A2C(Fishing* this, GlobalContext* globalCtx, u8 ignorePosCheck) { +s32 func_80B70A2C(Fishing* this, PlayState* play, u8 ignorePosCheck) { s16 i; s16 count; f32 scale; @@ -2688,7 +2688,7 @@ s32 func_80B70A2C(Fishing* this, GlobalContext* globalCtx, u8 ignorePosCheck) { f32 speedXZ; f32 angle; - if ((this->actor.world.pos.y < (WATER_SURFACE_Y(globalCtx) - 10.0f)) && !ignorePosCheck) { + if ((this->actor.world.pos.y < (WATER_SURFACE_Y(play) - 10.0f)) && !ignorePosCheck) { return false; } @@ -2710,24 +2710,24 @@ s32 func_80B70A2C(Fishing* this, GlobalContext* globalCtx, u8 ignorePosCheck) { pos = this->actor.world.pos; pos.x += vel.x * 3.0f; - pos.y = WATER_SURFACE_Y(globalCtx); + pos.y = WATER_SURFACE_Y(play); pos.z += vel.z * 3.0f; - Fishing_SpawnDustSplash(&this->actor.projectedPos, globalCtx->specialEffects, &pos, &vel, + Fishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &vel, (Rand_ZeroFloat(0.02f) + 0.025f) * scale); } pos = this->actor.world.pos; - pos.y = WATER_SURFACE_Y(globalCtx); + pos.y = WATER_SURFACE_Y(play); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &pos, 100.0f, 800.0f, 150, 90); + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 100.0f, 800.0f, 150, 90); this->unk_151 = 30; return true; } -void func_80B70CF0(Fishing* this, GlobalContext* globalCtx) { +void func_80B70CF0(Fishing* this, PlayState* play) { s16 count; s16 i; f32 scale; @@ -2757,7 +2757,7 @@ void func_80B70CF0(Fishing* this, GlobalContext* globalCtx) { pos.y += (vel.y * 3.0f); pos.z += (vel.z * 3.0f); - Fishing_SpawnDustSplash(&this->actor.projectedPos, globalCtx->specialEffects, &pos, &vel, + Fishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &vel, (Rand_ZeroFloat(0.02f) + 0.025f) * scale); } } @@ -2852,7 +2852,7 @@ void func_80B71278(Fishing* this, u8 arg1) { Audio_PlayActorSound2(&this->actor, sfxId); } -void Fishing_HandleAquariumDialog(Fishing* this, GlobalContext* globalCtx) { +void Fishing_HandleAquariumDialog(Fishing* this, PlayState* play) { if (sLinkAge == 1) { if ((HIGH_SCORE(HS_FISHING) & 0x7F) != 0) { if (HIGH_SCORE(HS_FISHING) & 0x80) { @@ -2879,17 +2879,17 @@ void Fishing_HandleAquariumDialog(Fishing* this, GlobalContext* globalCtx) { if (this->unk_1D4 == 0) { this->actor.flags |= ACTOR_FLAG_0; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { D_80B7A678 = D_80B7E078; this->unk_1D3 = 1; } else { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } else { this->unk_1D4--; this->actor.flags &= ~ACTOR_FLAG_0; } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1D3 = 0; this->unk_1D4 = 20; } @@ -2920,7 +2920,7 @@ bool getFishNeverEscape() { return CVar_GetS32("gFishNeverEscape", 0); } -void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { +void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { s16 i; s16 sp134 = 10; f32 sp130; @@ -2942,9 +2942,9 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { s16 spF0; s16 spEE; Fishing* this = (Fishing*)thisx; - GlobalContext* globalCtx = globalCtx2; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + PlayState* play = play2; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; f32 spD8; f32 phi_f0; f32 phi_f2; @@ -3014,7 +3014,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } else { phi_f0 = 1.0f; phi_f2 = 1.0f; - if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { phi_f0 = (KREG(64) * 0.1f) + 1.5f; phi_f2 = 3.0f; } @@ -3075,7 +3075,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { switch (this->unk_158) { case 100: - Fishing_HandleAquariumDialog(this, globalCtx); + Fishing_HandleAquariumDialog(this, play); this->actor.uncullZoneForward = 500.0f; this->actor.uncullZoneScale = 300.0f; @@ -3085,8 +3085,8 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { 255, 255, 255); this->unk_1AC = D_80B7E078; - sp100.y = (f32)Math_SinS(globalCtx->gameplayFrames * 300) * 1; - sp100.z = (f32)Math_SinS(globalCtx->gameplayFrames * 230) * 2; + sp100.y = (f32)Math_SinS(play->gameplayFrames * 300) * 1; + sp100.z = (f32)Math_SinS(play->gameplayFrames * 230) * 2; this->actor.world.pos.x = 130.0f; this->actor.world.pos.y = 55.0f + sp100.y; this->actor.world.pos.z = 1300.0f + sp100.z; @@ -3096,7 +3096,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { spC4.x = Rand_CenteredFloat(5.0f) + 130.0f; spC4.y = 40.0f; spC4.z = Rand_CenteredFloat(5.0f) + 1280.0f; - Fishing_SpawnBubble(NULL, globalCtx->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1); + Fishing_SpawnBubble(NULL, play->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1); } Math_ApproachS(&this->unk_172, (Math_SinS(this->unk_15C * 0x800) * 2500.0f) + 2500.0f, 2, 0x7D0); @@ -3148,7 +3148,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_17A[1] = 50; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if ((gSaveContext.dayTime >= 0xC000) && (gSaveContext.dayTime <= 0xC01B)) { this->unk_158 = 7; this->unk_17A[3] = (s16)Rand_ZeroFloat(150.0f) + 200; @@ -3177,7 +3177,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_158 = 1; this->unk_17A[0] = (s16)Rand_ZeroFloat(30.0f) + 10; this->unk_1B4.x = Rand_CenteredFloat(300.0f); - this->unk_1B4.y = (WATER_SURFACE_Y(globalCtx) - 50.0f) - Rand_ZeroFloat(50.0f); + this->unk_1B4.y = (WATER_SURFACE_Y(play) - 50.0f) - Rand_ZeroFloat(50.0f); this->unk_1B4.z = Rand_CenteredFloat(300.0f); this->unk_190 = 1.0f; this->unk_194 = 2000.0f; @@ -3239,7 +3239,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_194 = 4000.0f; Math_ApproachF(&this->unk_1B0, 4096.0f, 1.0f, 256.0f); - if ((globalCtx->gameplayFrames % 32) == 0) { + if ((play->gameplayFrames % 32) == 0) { this->unk_1B4.x = Rand_CenteredFloat(600.0f); this->unk_1B4.z = Rand_CenteredFloat(600.0f); this->unk_1B4.y = -120.0f; @@ -3263,7 +3263,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { KREG(2) = 0; this->unk_158 = -2; this->actor.world.rot.x = this->actor.shape.rot.x = 0; - this->unk_1B4.y = WATER_SURFACE_Y(globalCtx) + 10.0f; + this->unk_1B4.y = WATER_SURFACE_Y(play) + 10.0f; this->unk_1B4.x = Rand_ZeroFloat(50.0f); this->unk_1B4.z = Rand_ZeroFloat(50.0f); } @@ -3281,13 +3281,13 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_166, -0x1000, 0x14, 0x100); - if (this->actor.world.pos.y < (WATER_SURFACE_Y(globalCtx) - 20.0f)) { + if (this->actor.world.pos.y < (WATER_SURFACE_Y(play) - 20.0f)) { Math_ApproachF(&this->actor.speedXZ, 0.5f, 1.0f, 0.1f); } else { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.01f); if ((this->actor.speedXZ == 0.0f) || - (this->actor.world.pos.y > (WATER_SURFACE_Y(globalCtx) - 5.0f))) { + (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 5.0f))) { this->unk_1B4.x = Rand_ZeroFloat(300.0f); this->unk_1B4.z = Rand_ZeroFloat(300.0f); this->unk_1B4.y = this->actor.floorHeight + 10.0f; @@ -3295,10 +3295,10 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B0 = 0.0f; spB8 = this->fishMouthPos; - spB8.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &spB8, 10.0f, 300.0f, + spB8.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &spB8, 10.0f, 300.0f, 150, 90); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &spB8, 30.0f, 400.0f, + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &spB8, 30.0f, 400.0f, 150, 90); Audio_PlayActorSound2(&this->actor, NA_SE_PL_CATCH_BOOMERANG); @@ -3478,7 +3478,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B0 = 4096.0f; Math_ApproachF(&this->actor.speedXZ, this->unk_188 * 0.8f, 1.0f, 1.0f); - if ((D_80B7A694 != 3) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_80B7A694 != 3) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_158 = this->unk_15A; this->unk_17A[0] = 0; @@ -3503,7 +3503,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B4 = sLurePos; Math_ApproachF(&this->actor.speedXZ, this->unk_188, 1.0f, 1.0f); - if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_17A[0] = 0; @@ -3511,7 +3511,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_190 = 1.0f; this->unk_194 = 2000.0f; } else if (sp124 < 10.0f) { - if (func_80B70A2C(this, globalCtx, false)) { + if (func_80B70A2C(this, play, false)) { func_80B71278(this, 0); } @@ -3566,7 +3566,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B4 = sLurePos; Math_ApproachF(&this->actor.speedXZ, 2.0f, 1.0f, 1.0f); - if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_17A[0] = 0; @@ -3574,12 +3574,12 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_158 = this->unk_15A; this->unk_194 = 2000.0f; } else if (sp124 < 10.0f) { - if (sLurePos.y > (WATER_SURFACE_Y(globalCtx) - 10.0f)) { + if (sLurePos.y > (WATER_SURFACE_Y(play) - 10.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_JUMP_OUT_WATER); func_80078884(NA_SE_PL_CATCH_BOOMERANG); } - func_80B70A2C(this, globalCtx, false); + func_80B70A2C(this, play, false); this->unk_158 = 5; this->unk_190 = 1.2f; this->unk_194 = 5000.0f; @@ -3657,7 +3657,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } } - if (this->actor.world.pos.y < WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y < WATER_SURFACE_Y(play)) { if (this->unk_17A[1] > 30) { phi_v0_2 = 7; } else { @@ -3867,7 +3867,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { player->unk_860 = 3; func_800A9F6C(0.0f, 1, 3, 1); D_80B7E084++; - func_80064520(globalCtx, &globalCtx->csCtx); + func_80064520(play, &play->csCtx); D_80B7A6CC = 100; D_80B7FEC8 = 45.0f; D_80B7A694 = 5; @@ -3875,9 +3875,9 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_194 = 500.0f; this->unk_19C = 5000.0f; - if (this->actor.world.pos.y <= WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y <= WATER_SURFACE_Y(play)) { func_80B71278(this, 1); - func_80B70A2C(this, globalCtx, true); + func_80B70A2C(this, play, true); } goto case_6; } @@ -3954,11 +3954,11 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_17A[0] <= 50) { switch (this->unk_1D5) { case 0: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - if (Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + if (Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex == 0) { if (D_80B7A670 == 0.0f) { D_80B7A670 = this->unk_1AC; D_80B7E07C = this->unk_150; @@ -3968,7 +3968,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { ((s16)this->unk_1AC < (s16)D_80B7A670)) { this->unk_1D5 = 1; this->unk_17A[0] = 0x3C; - Message_StartTextbox(globalCtx, 0x4098, NULL); + Message_StartTextbox(play, 0x4098, NULL); } else { f32 temp1 = D_80B7A670; s16 temp2 = D_80B7E07C; @@ -3986,11 +3986,11 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - if (Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - if (globalCtx->msgCtx.choiceIndex != 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + if (Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex != 0) { f32 temp1 = D_80B7A670; s16 temp2 = D_80B7E07C; D_80B7A670 = this->unk_1AC; @@ -4014,13 +4014,13 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_17A[0] = 0; this->unk_190 = 1.0f; this->unk_194 = 2000.0f; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); if (this->unk_150 == 0) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, 0, 0, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, 0, 0, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, 0, 0, + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, 0, 0, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); } @@ -4055,7 +4055,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { if (sp124 < 20.0f) { Math_ApproachS(&this->unk_170, 0x4E20, 2, 0xFA0); - if ((this->unk_17A[2] == 0) && func_80B70A2C(this, globalCtx, false)) { + if ((this->unk_17A[2] == 0) && func_80B70A2C(this, play, false)) { func_80B71278(this, Rand_ZeroFloat(1.99f)); this->unk_17A[2] = (s16)Rand_ZeroFloat(20.0f) + 20; } @@ -4079,7 +4079,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_172, (Math_SinS(this->unk_15C * 0x1000) * 5000.0f) + 5000.0f, 2, 0x7D0); if (this->unk_158 != 6) { - if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { this->unk_190 = 1.5f; this->unk_194 = 5000.0f; @@ -4154,31 +4154,31 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.rot.y = this->actor.world.rot.y; if ((this->unk_158 != -1) && (this->unk_158 != -2) && (this->unk_158 != -25)) { - if ((this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) && - (this->actor.prevPos.y <= WATER_SURFACE_Y(globalCtx))) { - func_80B70A2C(this, globalCtx, true); + if ((this->actor.world.pos.y > WATER_SURFACE_Y(play)) && + (this->actor.prevPos.y <= WATER_SURFACE_Y(play))) { + func_80B70A2C(this, play, true); func_80B71278(this, 1); this->unk_184 = this->actor.velocity.y; this->actor.velocity.y = 0.0f; this->unk_16A = Rand_CenteredFloat(32768.0f); - } else if ((this->actor.world.pos.y < WATER_SURFACE_Y(globalCtx)) && - (this->actor.prevPos.y >= WATER_SURFACE_Y(globalCtx))) { + } else if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) && + (this->actor.prevPos.y >= WATER_SURFACE_Y(play))) { if (this->unk_184 < -5.0f) { this->unk_184 = -5.0f; } this->actor.world.rot.x = -0xFA0; - func_80B70A2C(this, globalCtx, true); + func_80B70A2C(this, play, true); this->unk_1D2 = 20; func_80B71278(this, 0); } } - if ((this->actor.world.pos.y < WATER_SURFACE_Y(globalCtx)) && - (this->actor.world.pos.y > (WATER_SURFACE_Y(globalCtx) - 10.0f)) && ((this->unk_15C & 1) == 0) && + if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) && + (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 10.0f)) && ((this->unk_15C & 1) == 0) && (this->actor.speedXZ > 0.0f)) { Vec3f pos = this->actor.world.pos; - pos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &pos, 80.0f, 500.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 80.0f, 500.0f, 150, 90); } if ((this->actor.speedXZ > 0.0f) || (this->unk_158 == 5)) { @@ -4189,7 +4189,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.y -= spD8; this->actor.prevPos.y -= spD8; this->actor.velocity.y = -1.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 100.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, 0x45); this->actor.world.pos.y += spD8; this->actor.prevPos.y += spD8; @@ -4200,13 +4200,13 @@ void Fishing_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_184 = Rand_ZeroFloat(3.0f) + 3.0f; this->actor.velocity.x = this->actor.world.pos.x * -0.003f; this->actor.velocity.z = this->actor.world.pos.z * -0.003f; Audio_PlayActorSound2(&this->actor, NA_SE_EV_FISH_LEAP); - func_80B70CF0(this, globalCtx); + func_80B70CF0(this, play); if (Rand_ZeroOne() < 0.5f) { this->unk_16A = 0x4000; @@ -4233,7 +4233,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x; pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; pos.y = this->actor.floorHeight + 5.0f; - Fishing_SpawnWaterDust(&this->actor.projectedPos, globalCtx->specialEffects, &pos, + Fishing_SpawnWaterDust(&this->actor.projectedPos, play->specialEffects, &pos, (this->unk_1AC * 0.005f) + 0.15f); } } @@ -4252,13 +4252,13 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { pos.x = Rand_CenteredFloat(range) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(range) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(range) + this->actor.world.pos.z; - Fishing_SpawnBubble(&this->actor.projectedPos, globalCtx->specialEffects, &pos, + Fishing_SpawnBubble(&this->actor.projectedPos, play->specialEffects, &pos, Rand_ZeroFloat(0.035f) + 0.04f, 0); } } } -s32 Fishing_FishOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 Fishing_FishOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; @@ -4281,7 +4281,7 @@ s32 Fishing_FishOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void Fishing_FishPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void Fishing_FishPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; if (limbIndex == 0xD) { @@ -4289,7 +4289,7 @@ void Fishing_FishPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -s32 Fishing_LoachOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 Fishing_LoachOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; @@ -4304,7 +4304,7 @@ s32 Fishing_LoachOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void Fishing_LoachPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void Fishing_LoachPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f sLoachMouthOffset = { 500.0f, 500.0f, 0.0f }; Fishing* this = (Fishing*)thisx; @@ -4313,10 +4313,10 @@ void Fishing_LoachPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } } -void Fishing_DrawFish(Actor* thisx, GlobalContext* globalCtx) { +void Fishing_DrawFish(Actor* thisx, PlayState* play) { Fishing* this = (Fishing*)thisx; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateY(((this->unk_162 + this->actor.shape.rot.y) / 32768.0f) * M_PI, MTXMODE_APPLY); @@ -4328,7 +4328,7 @@ void Fishing_DrawFish(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY((this->unk_16C * (M_PI / 32768)) - (M_PI / 2), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, this->unk_16C * 10.0f * 0.01f, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, Fishing_FishOverrideLimbDraw, Fishing_FishPostLimbDraw, this); } else { Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY); @@ -4336,7 +4336,7 @@ void Fishing_DrawFish(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, -3000.0f, MTXMODE_APPLY); Matrix_RotateY(-(M_PI / 2), MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, Fishing_LoachOverrideLimbDraw, Fishing_LoachPostLimbDraw, this); } @@ -4374,9 +4374,9 @@ void Fishing_HandleLilyPadContact(FishingProp* prop, Vec3f* entityPos, u8 fishTi } } -void Fishing_UpdatePondProps(GlobalContext* globalCtx) { +void Fishing_UpdatePondProps(PlayState* play) { FishingProp* prop = &sPondProps[0]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* actor; s16 i; @@ -4385,7 +4385,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { prop->shouldDraw = false; prop->timer++; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &prop->pos, &prop->projectedPos, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &prop->pos, &prop->projectedPos, &sProjectedW); if ((prop->projectedPos.z < prop->drawDistance) && (fabsf(prop->projectedPos.x) < (100.0f + prop->projectedPos.z))) { @@ -4396,7 +4396,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { if (prop->type == FS_PROP_REED) { Fishing_HandleReedContact(prop, &player->actor.world.pos); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actor = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actor != NULL) { if (!((actor->id == ACTOR_FISHING) && (actor->params >= 100))) { actor = actor->next; @@ -4410,7 +4410,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { } else if (prop->type == FS_PROP_LILY_PAD) { Fishing_HandleLilyPadContact(prop, &player->actor.world.pos, 0); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actor = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actor != NULL) { if (!((actor->id == ACTOR_FISHING) && (actor->params >= 100))) { actor = actor->next; @@ -4422,7 +4422,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { Math_ApproachS(&prop->lilyPadAngle, 0, 20, 80); prop->pos.y = - (Math_SinS(prop->timer * 0x1000) * prop->lilyPadOffset) + (WATER_SURFACE_Y(globalCtx) + 2.0f); + (Math_SinS(prop->timer * 0x1000) * prop->lilyPadOffset) + (WATER_SURFACE_Y(play) + 2.0f); Math_ApproachZeroF(&prop->lilyPadOffset, 0.1f, 0.02f); } } @@ -4432,17 +4432,17 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { } if (sCameraId == 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &sFishingMain->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &sFishingMain->collider.base); } } -void Fishing_DrawPondProps(GlobalContext* globalCtx) { +void Fishing_DrawPondProps(PlayState* play) { u8 flag = 0; FishingProp* prop = &sPondProps[0]; s16 i; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -4461,7 +4461,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_RotateX(prop->rotX, MTXMODE_APPLY); Matrix_RotateY(prop->reedAngle, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingReedModelDL); FrameInterpolation_RecordCloseChild(); @@ -4485,7 +4485,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingWoodPostModelDL); FrameInterpolation_RecordCloseChild(); @@ -4512,7 +4512,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 20.0f, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLilyPadModelDL); FrameInterpolation_RecordCloseChild(); @@ -4537,7 +4537,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingRockModelDL); FrameInterpolation_RecordCloseChild(); @@ -4549,12 +4549,12 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { +void Fishing_UpdateGroupFishes(PlayState* play) { s16 groupContactFlags = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); FishingGroupFish* fish = &sGroupFishes[0]; f32 dy; f32 dx; @@ -4592,7 +4592,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 1; } else if (D_80B7A898 != 0.0f) { sFishGroupAngle1 += 0.05f; - basePos[0].y = WATER_SURFACE_Y(globalCtx) - 5.0f; + basePos[0].y = WATER_SURFACE_Y(play) - 5.0f; } else { Math_ApproachF(&sFishGroupAngle1, 0.7f, 1.0f, 0.001f); } @@ -4609,7 +4609,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 2; } else if (D_80B7A898 != 0.0f) { sFishGroupAngle2 -= 0.05f; - basePos[1].y = WATER_SURFACE_Y(globalCtx) - 5.0f; + basePos[1].y = WATER_SURFACE_Y(play) - 5.0f; } else { Math_ApproachF(&sFishGroupAngle2, 2.3f, 1.0f, 0.001f); } @@ -4626,7 +4626,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 4; } else if (D_80B7A898 != 0.0f) { sFishGroupAngle3 -= 0.05f; - basePos[2].y = WATER_SURFACE_Y(globalCtx) - 5.0f; + basePos[2].y = WATER_SURFACE_Y(play) - 5.0f; } else { Math_ApproachF(&sFishGroupAngle3, 4.6f, 1.0f, 0.001f); } @@ -4641,7 +4641,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { if (fish->type != FS_GROUP_FISH_NONE) { fish->timer++; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &fish->pos, &fish->projectedPos, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &fish->pos, &fish->projectedPos, &sProjectedW); if ((fish->projectedPos.z < 400.0f) && (fabsf(fish->projectedPos.x) < (100.0f + fish->projectedPos.z))) { fish->shouldDraw = true; @@ -4679,8 +4679,8 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { } ripplePos = fish->pos; - ripplePos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(&fish->projectedPos, globalCtx->specialEffects, &ripplePos, 20.0f, + ripplePos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(&fish->projectedPos, play->specialEffects, &ripplePos, 20.0f, Rand_ZeroFloat(50.0f) + 100.0f, 150, 90); if (fish->unk_28 < 1.5f) { @@ -4738,7 +4738,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { D_80B7A898 = 0.0f; } -void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { +void Fishing_DrawGroupFishes(PlayState* play) { u8 flag = 0; FishingGroupFish* fish = &sGroupFishes[0]; f32 scale; @@ -4751,7 +4751,7 @@ void Fishing_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) { @@ -4768,7 +4768,7 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { Matrix_RotateX((-(f32)fish->unk_3C * M_PI) / 32768.0f, MTXMODE_APPLY); 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++, gFishingGroupFishModelDL); FrameInterpolation_RecordCloseChild(); @@ -4777,12 +4777,12 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { fish++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static u16 D_80B7AFB8[] = { 0x4096, 0x408D, 0x408E, 0x408F, 0x4094, 0x4095 }; -void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { +void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { switch (this->unk_15C) { case 0: if (D_80B7E0AC == 0) { @@ -4801,7 +4801,7 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { this->actor.textId = 0x4097; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (D_80B7E0AC == 0) { this->unk_15C = 1; if (sLinkAge != 1) { @@ -4813,15 +4813,15 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { this->unk_15C = 10; } } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees >= 20) { Rupees_ChangeBy(-20); @@ -4830,15 +4830,15 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x407D; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_15C = 2; } else { - Message_ContinueTextbox(globalCtx, 0x407E); + Message_ContinueTextbox(play, 0x407E); this->unk_15C = 3; } break; case 1: - Message_ContinueTextbox(globalCtx, 0x2D); + Message_ContinueTextbox(play, 0x2D); this->unk_15C = 3; break; } @@ -4846,46 +4846,46 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - Message_ContinueTextbox(globalCtx, 0x407F); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + Message_ContinueTextbox(play, 0x407F); this->unk_15C = 4; } break; case 3: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->unk_15C = 0; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { this->unk_15C = 0; } break; case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: D_80B7A678 = D_80B7E078; - Message_ContinueTextbox(globalCtx, 0x4080); + Message_ContinueTextbox(play, 0x4080); this->unk_15C = 5; break; case 1: - Message_ContinueTextbox(globalCtx, 0x407F); + Message_ContinueTextbox(play, 0x407F); break; } } break; case 5: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - globalCtx->interfaceCtx.unk_260 = 1; - globalCtx->startPlayerFishing(globalCtx); + play->interfaceCtx.unk_260 = 1; + play->startPlayerFishing(play); D_80B7E0AC = 1; D_80B7A684 = 20; this->unk_15C = 0; @@ -4898,12 +4898,12 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { case 10: if (D_80B7A68C != 0) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_ContinueTextbox(globalCtx, 0x40B2); + Message_ContinueTextbox(play, 0x40B2); D_80B7A688 = 1; D_80B7A68C = 0; this->unk_15C = 20; @@ -4914,10 +4914,10 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { } } } else { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (D_80B7A670 == 0.0f) { this->actor.textId = 0x408C; @@ -4943,12 +4943,12 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { this->actor.textId = 0x4086; this->unk_15C = 11; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; case 1: if (D_80B7A680 > 36000) { D_80B7A680 = 30000; - Message_ContinueTextbox(globalCtx, 0x4088); + Message_ContinueTextbox(play, 0x4088); } else { if (D_80B7E076 == 0) { if (D_80B7E082 == 0) { @@ -4957,9 +4957,9 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { } if ((D_80B7E0B6 == 2) && (D_80B7AFB8[D_80B7E082] == 0x408D)) { - Message_ContinueTextbox(globalCtx, 0x40AF); + Message_ContinueTextbox(play, 0x40AF); } else { - Message_ContinueTextbox(globalCtx, D_80B7AFB8[D_80B7E082]); + Message_ContinueTextbox(play, D_80B7AFB8[D_80B7E082]); } D_80B7E082++; @@ -4978,9 +4978,9 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 2: if (D_80B7E084 == 0) { - Message_ContinueTextbox(globalCtx, 0x4085); + Message_ContinueTextbox(play, 0x4085); } else if (sLinkAge == 1) { - Message_ContinueTextbox(globalCtx, 0x4092); + Message_ContinueTextbox(play, 0x4092); } this->unk_15C = 22; break; @@ -4990,13 +4990,13 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 11: - if (((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) && - Message_ShouldAdvance(globalCtx)) { + if (((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) && + Message_ShouldAdvance(play)) { s32 getItemId; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (D_80B7E07C == 0) { D_80B7E078 = D_80B7A670; @@ -5078,34 +5078,34 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { this->actor.parent = NULL; if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { - func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, getItemId, 2000.0f, 1000.0f); } else { - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); } this->unk_15C = 23; } break; case 20: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->unk_15C = 0; } break; case 21: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: this->unk_15C = 0; break; case 1: if (D_80B7E084 == 0) { - Message_ContinueTextbox(globalCtx, 0x4085); + Message_ContinueTextbox(play, 0x4085); } else if (sLinkAge == 1) { - Message_ContinueTextbox(globalCtx, 0x4092); + Message_ContinueTextbox(play, 0x4092); } this->unk_15C = 22; break; @@ -5114,12 +5114,12 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 22: - if (globalCtx) {} + if (play) {} - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->unk_15C = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (gSaveContext.temporaryWeapon) { player->currentSwordItem = ITEM_NONE; @@ -5133,32 +5133,32 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { D_80B7A68C = 0; } D_80B7E0AC = 0; - globalCtx->interfaceCtx.unk_260 = 0; + play->interfaceCtx.unk_260 = 0; } break; case 23: D_80B7A674 = false; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->unk_15C = 24; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_SCALE_GOLD, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, GI_SCALE_GOLD, 2000.0f, 1000.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_ADULT_FISHING, GI_SCALE_GOLD); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); } } break; case 24: D_80B7A674 = false; - if (((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) || - (gSaveContext.n64ddFlag && GET_PLAYER(globalCtx)->getItemId == GI_ICE_TRAP)) { + if (((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) || + (gSaveContext.n64ddFlag && GET_PLAYER(play)->getItemId == GI_ICE_TRAP)) { if (D_80B7E07C == 0) { this->unk_15C = 0; } else { - Message_StartTextbox(globalCtx, 0x409C, NULL); + Message_StartTextbox(play, 0x409C, NULL); this->unk_15C = 20; } } @@ -5177,8 +5177,8 @@ static Vec3s sSinkingLureLocationPos[] = { { 553, -48, -508 }, }; -void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Fishing* this = (Fishing*)thisx; Vec3f sp114; Vec3f sp108; @@ -5189,8 +5189,8 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { f32 camAtFraction; f32 lureDistXZ; s32 pad; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; if (0) { // Strings existing only in rodata @@ -5213,13 +5213,13 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { SkelAnime_Update(&this->skelAnime); - if ((D_80B7A684 != 0) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((D_80B7A684 != 0) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { this->actor.flags &= ~ACTOR_FLAG_0; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_5; } - if ((this->actor.xzDistToPlayer < 120.0f) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((this->actor.xzDistToPlayer < 120.0f) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { headRotTarget = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; } else { headRotTarget = 0; @@ -5233,7 +5233,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_164, headRotTarget, 3, 0x1388); - if (((globalCtx->gameplayFrames % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { + if (((play->gameplayFrames % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { this->unk_162 = 4; } @@ -5256,7 +5256,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { KREG(77) = 0; D_80B7A688 = 0; D_80B7A68C = 1; - Message_StartTextbox(globalCtx, 0x4087, NULL); + Message_StartTextbox(play, 0x4087, NULL); } } @@ -5274,22 +5274,22 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if (D_80B7A67C != 0) { D_80B7A67C--; if (D_80B7A67C == 0) { - Message_StartTextbox(globalCtx, D_80B7E086, NULL); + Message_StartTextbox(play, D_80B7E086, NULL); } } - Fishing_HandleOwnerDialog(this, globalCtx); + Fishing_HandleOwnerDialog(this, play); D_80B7E14C = 0.0015f; D_80B7A680++; if ((D_80B7E0AC != 0) && D_80B7A674) { - Fishing_UpdateLure(this, globalCtx); + Fishing_UpdateLure(this, play); } - Fishing_UpdateEffects(globalCtx->specialEffects, globalCtx); - Fishing_UpdatePondProps(globalCtx); - Fishing_UpdateGroupFishes(globalCtx); + Fishing_UpdateEffects(play->specialEffects, play); + Fishing_UpdatePondProps(play); + Fishing_UpdateGroupFishes(play); if ((D_80B7E0AC != 0) && (D_80B7A6CC == 0) && (player->actor.world.pos.z > 1360.0f) && (fabsf(player->actor.world.pos.x) < 25.0f)) { @@ -5332,10 +5332,10 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { case 1: { Camera* camera; - sCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCameraId, CAM_STAT_ACTIVE); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + sCameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCameraId, CAM_STAT_ACTIVE); + camera = Play_GetCamera(play, MAIN_CAM); sCameraEye.x = camera->eye.x; sCameraEye.y = camera->eye.y; sCameraEye.z = camera->eye.z; @@ -5443,17 +5443,17 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 3: { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(play, MAIN_CAM); camera->eye = sCameraEye; camera->eyeNext = sCameraEye; camera->at = sCameraAt; - func_800C08AC(globalCtx, sCameraId, 0); - func_80064534(globalCtx, &globalCtx->csCtx); + func_800C08AC(play, sCameraId, 0); + func_80064534(play, &play->csCtx); D_80B7A6CC = 0; sCameraId = 0; - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; player->unk_860 = -5; D_80B7E0B0 = 5; break; @@ -5462,19 +5462,19 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { case 10: { Camera* camera; - func_80064520(globalCtx, &globalCtx->csCtx); - sCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCameraId, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 5); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + func_80064520(play, &play->csCtx); + sCameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCameraId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 5); + camera = Play_GetCamera(play, MAIN_CAM); 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_80B7A6CC = 11; func_800A9F6C(0.0f, 150, 10, 10); // fallthrough @@ -5484,39 +5484,39 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { player->actor.world.pos.z = 1360.0f; player->actor.speedXZ = 0.0f; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { + Camera* camera = Play_GetCamera(play, MAIN_CAM); camera->eye = sCameraEye; camera->eyeNext = sCameraEye; camera->at = sCameraAt; - func_800C08AC(globalCtx, sCameraId, 0); - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_800C08AC(play, sCameraId, 0); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); D_80B7A6CC = 0; sCameraId = 0; D_80B7A6D0 = 30; - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; } break; case 20: { Camera* camera; - func_80064520(globalCtx, &globalCtx->csCtx); - sCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCameraId, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 5); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + func_80064520(play, &play->csCtx); + sCameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sCameraId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 5); + camera = Play_GetCamera(play, MAIN_CAM); 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_80B7A6CC = 21; D_80B7FEC8 = 45.0f; D_80B7A6D0 = 10; @@ -5524,10 +5524,10 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } case 21: - if ((D_80B7A6D0 == 0) && Message_ShouldAdvance(globalCtx)) { + if ((D_80B7A6D0 == 0) && Message_ShouldAdvance(play)) { D_80B7A6CC = 22; D_80B7A6D0 = 40; - func_8002DF54(globalCtx, &this->actor, 0x1C); + func_8002DF54(play, &this->actor, 0x1C); D_80B7FEE4 = 0.0f; } break; @@ -5542,7 +5542,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachF(&D_80B7FEE4, 71.0f, 0.5f, 3.0f); Matrix_RotateY((player->actor.shape.rot.y / 32768.0f) * M_PI, MTXMODE_NEW); - sp114.x = Math_SinS(globalCtx->gameplayFrames * 0x1000); + sp114.x = Math_SinS(play->gameplayFrames * 0x1000); sp114.y = D_80B7FEE4; sp114.z = -5.0f; if (sLinkAge == 1) { @@ -5580,13 +5580,13 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (D_80B7A6D0 == 0) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - if (Message_ShouldAdvance(globalCtx)) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + if (Message_ShouldAdvance(play)) { + Camera* camera = Play_GetCamera(play, MAIN_CAM); - Message_CloseTextbox(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex == 0) { D_80B7E0B6 = 2; D_80B7E082 = 0; } @@ -5594,17 +5594,17 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { camera->eye = sCameraEye; camera->eyeNext = sCameraEye; camera->at = sCameraAt; - func_800C08AC(globalCtx, sCameraId, 0); - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_800C08AC(play, sCameraId, 0); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); D_80B7A6CC = 0; sCameraId = 0; player->unk_860 = -5; D_80B7E0B0 = 5; D_80B7A6D4 = 0; D_80B7E0A6 = 20; - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; } } } @@ -5615,36 +5615,36 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (sCameraId != 0) { - Gameplay_CameraSetAtEye(globalCtx, sCameraId, &sCameraAt, &sCameraEye); + Play_CameraSetAtEye(play, sCameraId, &sCameraAt, &sCameraEye); Math_ApproachF(&D_80B7FECC, 1.0f, 1.0f, 0.02f); - if (sCameraEye.y <= (WATER_SURFACE_Y(globalCtx) + 1.0f)) { - Environment_EnableUnderwaterLights(globalCtx, 1); + if (sCameraEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { + Environment_EnableUnderwaterLights(play, 1); if (D_80B7E076 != 0) { - globalCtx->envCtx.adjFogNear = -0xB2; + play->envCtx.adjFogNear = -0xB2; } else { - globalCtx->envCtx.adjFogNear = -0x2E; + play->envCtx.adjFogNear = -0x2E; } } else { - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; } } - if ((player->actor.floorHeight < (WATER_SURFACE_Y(globalCtx) - 3.0f)) && + if ((player->actor.floorHeight < (WATER_SURFACE_Y(play) - 3.0f)) && (player->actor.world.pos.y < (player->actor.floorHeight + 3.0f)) && (player->actor.speedXZ > 1.0f) && - ((globalCtx->gameplayFrames % 2) == 0)) { + ((play->gameplayFrames % 2) == 0)) { Vec3f pos; pos.x = Rand_CenteredFloat(20.0f) + player->actor.world.pos.x; pos.z = Rand_CenteredFloat(20.0f) + player->actor.world.pos.z; pos.y = player->actor.floorHeight + 5.0f; - Fishing_SpawnWaterDust(NULL, globalCtx->specialEffects, &pos, 0.5f); + Fishing_SpawnWaterDust(NULL, play->specialEffects, &pos, 0.5f); } - if ((player->actor.floorHeight < WATER_SURFACE_Y(globalCtx)) && - (player->actor.floorHeight > (WATER_SURFACE_Y(globalCtx) - 10.0f)) && (player->actor.speedXZ >= 4.0f) && - ((globalCtx->gameplayFrames % 4) == 0)) { + if ((player->actor.floorHeight < WATER_SURFACE_Y(play)) && + (player->actor.floorHeight > (WATER_SURFACE_Y(play) - 10.0f)) && (player->actor.speedXZ >= 4.0f) && + ((play->gameplayFrames % 4) == 0)) { s16 i; for (i = 0; i < 10; i++) { @@ -5662,18 +5662,18 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { pos = player->actor.world.pos; pos.x += 2.0f * vel.x; - pos.y = WATER_SURFACE_Y(globalCtx); + pos.y = WATER_SURFACE_Y(play); pos.z += 2.0f * vel.z; - Fishing_SpawnDustSplash(NULL, globalCtx->specialEffects, &pos, &vel, Rand_ZeroFloat(0.01f) + 0.020000001f); + Fishing_SpawnDustSplash(NULL, play->specialEffects, &pos, &vel, Rand_ZeroFloat(0.01f) + 0.020000001f); } } if (sREG(15) != 0) { if (D_80B7A654 != (sREG(15) - 1)) { if (D_80B7A654 == 0) { - globalCtx->envCtx.gloomySkyMode = 1; + play->envCtx.gloomySkyMode = 1; } else { - globalCtx->envCtx.gloomySkyMode = 2; + play->envCtx.gloomySkyMode = 2; } } @@ -5681,10 +5681,10 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (sREG(14) == 1) { - globalCtx->envCtx.gloomySkyMode = 1; + play->envCtx.gloomySkyMode = 1; } if (sREG(14) == -1) { - globalCtx->envCtx.gloomySkyMode = 2; + play->envCtx.gloomySkyMode = 2; } sREG(14) = 0; @@ -5697,16 +5697,16 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { D_80B7E077--; } - if ((D_80B7E077 == 1) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) && + if ((D_80B7E077 == 1) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && ((D_80B7A680 & 0xFFF) == 0xFFF)) { D_80B7E077 = 200; if (Rand_ZeroOne() < 0.5f) { D_80B7A654 = (u8)Rand_ZeroFloat(10.0f) + 5; - globalCtx->envCtx.gloomySkyMode = 1; + play->envCtx.gloomySkyMode = 1; } else { D_80B7A654 = 0; - globalCtx->envCtx.gloomySkyMode = 2; + play->envCtx.gloomySkyMode = 2; } } @@ -5736,12 +5736,12 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachZeroF(&D_80B7A658, 1.0f, 2.0f); } - globalCtx->envCtx.adjLight1Color[0] = globalCtx->envCtx.adjLight1Color[1] = globalCtx->envCtx.adjLight1Color[2] = + play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = D_80B7A658; if ((u8)D_80B7A650 > 0) { s32 pad; - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(play, MAIN_CAM); s16 i; s32 pad1; Vec3f pos; @@ -5754,23 +5754,23 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { rot.z = (Camera_GetInputDirYaw(camera) * -(M_PI / 32768)) + rot.y; for (i = 0; i < (u8)D_80B7A650; i++) { - pos.x = Rand_CenteredFloat(700.0f) + globalCtx->view.eye.x; + pos.x = Rand_CenteredFloat(700.0f) + play->view.eye.x; pos.y = (Rand_ZeroFloat(100.0f) + 150.0f) - 170.0f; - pos.z = Rand_CenteredFloat(700.0f) + globalCtx->view.eye.z; + pos.z = Rand_CenteredFloat(700.0f) + play->view.eye.z; if (pos.z < 1160.0f) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &projectedPos, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &projectedPos, &sProjectedW); if (projectedPos.z < 0.0f) { i--; } else { - Fishing_SpawnRainDrop(globalCtx->specialEffects, &pos, &rot); + Fishing_SpawnRainDrop(play->specialEffects, &pos, &rot); } } } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, &sProjectedW); func_80078914(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); @@ -5779,13 +5779,13 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if (BREG(26) != 0) { BREG(26) = 0; - Message_StartTextbox(globalCtx, 0x407B + BREG(27), NULL); + Message_StartTextbox(play, 0x407B + BREG(27), NULL); } osSyncPrintf("HI_SCORE = %x\n", HIGH_SCORE(HS_FISHING)); } -s32 Fishing_OwnerOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 Fishing_OwnerOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; @@ -5796,9 +5796,9 @@ s32 Fishing_OwnerOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void Fishing_OwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void Fishing_OwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 8) { // Head - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&sZeroVec, &sOwnerHeadPos); if (D_80B7A688 == 1) { @@ -5807,7 +5807,7 @@ void Fishing_OwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gFishingOwnerHairDL)); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -5817,29 +5817,29 @@ static void* sFishingOwnerEyeTexs[] = { gFishingOwnerEyeClosedTex, }; -void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { +void Fishing_DrawOwner(Actor* thisx, PlayState* play) { s32 pad; Fishing* this = (Fishing*)thisx; - Input* input = &globalCtx->state.input[0]; + Input* input = &play->state.input[0]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if ((this->actor.projectedPos.z < 1500.0f) && (fabsf(this->actor.projectedPos.x) < (100.0f + this->actor.projectedPos.z))) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFishingOwnerEyeTexs[this->unk_160])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, Fishing_OwnerOverrideLimbDraw, Fishing_OwnerPostLimbDraw, this); } - Fishing_DrawPondProps(globalCtx); - Fishing_DrawEffects(globalCtx->specialEffects, globalCtx); - Fishing_DrawGroupFishes(globalCtx); - Fishing_DrawStreamSplash(globalCtx); + Fishing_DrawPondProps(play); + Fishing_DrawEffects(play->specialEffects, play); + Fishing_DrawGroupFishes(play); + Fishing_DrawStreamSplash(play); if (D_80B7E0A6 != 0) { D_80B7E0A6--; @@ -5860,10 +5860,10 @@ void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { } if ((D_80B7E0AC != 0) && D_80B7A674) { - Fishing_DrawRod(globalCtx); + Fishing_DrawRod(play); Fishing_UpdateLinePos(sReelLinePos); - Fishing_UpdateLine(globalCtx, &sRodTipPos, sReelLinePos, sReelLineRot, sReelLineUnk); - Fishing_DrawLureAndLine(globalCtx, sReelLinePos, sReelLineRot); + Fishing_UpdateLine(play, &sRodTipPos, sReelLinePos, sReelLineRot, sReelLineUnk); + Fishing_DrawLureAndLine(play, sReelLinePos, sReelLineRot); D_80B7A6C4 = input->rel.stick_x; D_80B7A6C8 = input->rel.stick_y; @@ -5874,17 +5874,17 @@ void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(130.0f, 40.0f, 1300.0f, MTXMODE_NEW); Matrix_Scale(0.08f, 0.12f, 0.14f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - 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_OPA_DISP++, gFishingAquariumBottomDL); gSPDisplayList(POLY_XLU_DISP++, gFishingAquariumContainerDL); if ((D_80B7E0AC != 0) && (D_80B7E0B6 == 2)) { - Fishing_DrawSinkingLure(globalCtx); + Fishing_DrawSinkingLure(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/soh/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index b785d35fa..cebd0f4d7 100644 --- a/soh/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/soh/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -9,12 +9,12 @@ #define FLAGS 0 -void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemBHeart_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemBHeart_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemBHeart_Init(Actor* thisx, PlayState* play); +void ItemBHeart_Destroy(Actor* thisx, PlayState* play); +void ItemBHeart_Update(Actor* thisx, PlayState* play); +void ItemBHeart_Draw(Actor* thisx, PlayState* play); -void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx); +void func_80B85264(ItemBHeart* this, PlayState* play); const ActorInit Item_B_Heart_InitVars = { ACTOR_ITEM_B_HEART, @@ -36,10 +36,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Init(Actor* thisx, PlayState* play) { ItemBHeart* this = (ItemBHeart*)thisx; - if (Flags_GetCollectible(globalCtx, 0x1F)) { + if (Flags_GetCollectible(play, 0x1F)) { Actor_Kill(&this->actor); } else { Actor_ProcessInitChain(&this->actor, sInitChain); @@ -47,28 +47,28 @@ void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ItemBHeart_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Destroy(Actor* thisx, PlayState* play) { } -void ItemBHeart_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Update(Actor* thisx, PlayState* play) { ItemBHeart* this = (ItemBHeart*)thisx; - func_80B85264(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, 0x1F); + func_80B85264(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, 0x1F); Actor_Kill(&this->actor); } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_HEART_CONTAINER_2, 30.0f, 40.0f); + func_8002F434(&this->actor, play, GI_HEART_CONTAINER_2, 30.0f, 40.0f); } else { - GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->actor.params, GI_HEART_CONTAINER_2); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 30.0f, 40.0f); + GetItemEntry getItemEntry = Randomizer_GetItemFromActor(this->actor.id, play->sceneNum, this->actor.params, GI_HEART_CONTAINER_2); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 30.0f, 40.0f); } } } -void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx) { +void func_80B85264(ItemBHeart* this, PlayState* play) { f32 yOffset; this->unk_164++; @@ -81,14 +81,14 @@ void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx) { this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; } -void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Draw(Actor* thisx, PlayState* play) { ItemBHeart* this = (ItemBHeart*)thisx; Actor* actorIt; u8 flag = false; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + actorIt = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (actorIt != NULL) { if ((actorIt->id == ACTOR_DOOR_WARP1) && (actorIt->projectedPos.z > this->actor.projectedPos.z)) { @@ -99,23 +99,23 @@ void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (gSaveContext.n64ddFlag) { - GetItemEntry_Draw(globalCtx, Randomizer_GetItemFromActor(this->actor.id, - globalCtx->sceneNum,this->actor.params, GI_HEART_CONTAINER_2)); + GetItemEntry_Draw(play, Randomizer_GetItemFromActor(this->actor.id, + play->sceneNum,this->actor.params, GI_HEART_CONTAINER_2)); } else { if (flag) { - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(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++, gGiHeartBorderDL); gSPDisplayList(POLY_XLU_DISP++, gGiHeartContainerDL); } else { - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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++, gGiHeartBorderDL); gSPDisplayList(POLY_OPA_DISP++, gGiHeartContainerDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index 91b4546f1..790eedb1a 100644 --- a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -8,20 +8,20 @@ #define FLAGS ACTOR_FLAG_4 -void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemEtcetera_Init(Actor* thisx, PlayState* play); +void ItemEtcetera_Destroy(Actor* thisx, PlayState* play); +void ItemEtcetera_Update(Actor* thisx, PlayState* play); +void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play); +void ItemEtcetera_Draw(Actor* thisx, PlayState* play); -void func_80B857D0(ItemEtcetera* this, GlobalContext* globalCtx); -void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx); -void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx); -void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx); -void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, GlobalContext* globalCtx); -void func_80B85B28(ItemEtcetera* this, GlobalContext* globalCtx); -void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, GlobalContext* globalCtx); -GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, GlobalContext* globalCtx); +void func_80B857D0(ItemEtcetera* this, PlayState* play); +void func_80B85824(ItemEtcetera* this, PlayState* play); +void func_80B858B4(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, PlayState* play); +void func_80B85B28(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, PlayState* play); +GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, PlayState* play); const ActorInit Item_Etcetera_InitVars = { ACTOR_ITEM_ETCETERA, @@ -58,7 +58,7 @@ void ItemEtcetera_SetupAction(ItemEtcetera* this, ItemEtceteraActionFunc actionF this->actionFunc = actionFunc; } -void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Init(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; s32 pad; s32 type; @@ -66,7 +66,7 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { type = this->actor.params & 0xFF; osSyncPrintf("no = %d\n", type); - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[type]); + objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[type]); osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { ASSERT(objBankIndex < 0); @@ -84,7 +84,7 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.5f); this->futureActionFunc = func_80B858B4; if ((gSaveContext.eventChkInf[3] & 2 && !gSaveContext.n64ddFlag) || - (gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1E))) { + (gSaveContext.n64ddFlag && Flags_GetTreasure(play, 0x1E))) { Actor_Kill(&this->actor); } break; @@ -108,48 +108,48 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Destroy(Actor* thisx, PlayState* play) { } -void func_80B857D0(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void func_80B857D0(ItemEtcetera* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; this->actor.draw = this->drawFunc; this->actionFunc = this->futureActionFunc; } } -void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B85824(ItemEtcetera* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if ((this->actor.params & 0xFF) == 7) { if (gSaveContext.n64ddFlag) { - Flags_SetTreasure(globalCtx, 0x1F); + Flags_SetTreasure(play, 0x1F); } } if ((this->actor.params & 0xFF) == 1) { gSaveContext.eventChkInf[3] |= 2; - Flags_SetSwitch(globalCtx, 0xB); + Flags_SetSwitch(play, 0xB); } Actor_Kill(&this->actor); } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); + func_8002F434(&this->actor, play, this->getItemId, 30.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_SUN, GI_ARROW_FIRE); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 30.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 30.0f, 50.0f); } } } -void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B858B4(ItemEtcetera* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if ((this->actor.params & 0xFF) == 1) { gSaveContext.eventChkInf[3] |= 2; - Flags_SetSwitch(globalCtx, 0xB); + Flags_SetSwitch(play, 0xB); if (gSaveContext.n64ddFlag) { - Flags_SetTreasure(globalCtx, 0x1E); + Flags_SetTreasure(play, 0x1E); } } Actor_Kill(&this->actor); @@ -157,19 +157,19 @@ void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) { if (0) {} // Necessary to match if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); + func_8002F434(&this->actor, play, this->getItemId, 30.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_UNDERWATER_ITEM, GI_LETTER_RUTO); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 30.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 30.0f, 50.0f); } - if ((globalCtx->gameplayFrames & 0xD) == 0) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); + if ((play->gameplayFrames & 0xD) == 0) { + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); } } } -void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx) { +void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.2f, 0.0f }; static Vec3f accel = { 0.0f, 0.05f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; @@ -183,29 +183,29 @@ void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(12.0f) + this->actor.world.pos.x; pos.y = (Rand_ZeroOne() * 6.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(12.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 5000, 16); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 5000, 16); } -void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 5); +void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 5); Actor_MoveForward(&this->actor); if (!(this->actor.bgCheckFlags & 1)) { - ItemEtcetera_SpawnSparkles(this, globalCtx); + ItemEtcetera_SpawnSparkles(this, play); } this->actor.shape.rot.y += 0x400; - func_80B85824(this, globalCtx); + func_80B85824(this, play); } -void func_80B85B28(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Flags_GetTreasure(globalCtx, (this->actor.params >> 8) & 0x1F)) { +void func_80B85B28(ItemEtcetera* this, PlayState* play) { + if (Flags_GetTreasure(play, (this->actor.params >> 8) & 0x1F)) { Actor_Kill(&this->actor); } } -void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[0] != NULL)) { - LOG_NUM("(game_play->demo_play.npcdemopnt[0]->dousa)", globalCtx->csCtx.npcActions[0]->action); - if (globalCtx->csCtx.npcActions[0]->action == 2) { +void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL)) { + LOG_NUM("(game_play->demo_play.npcdemopnt[0]->dousa)", play->csCtx.npcActions[0]->action); + if (play->csCtx.npcActions[0]->action == 2) { this->actor.draw = ItemEtcetera_Draw; this->actor.gravity = -0.1f; this->actor.minVelocityY = -4.0f; @@ -218,31 +218,31 @@ void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, GlobalContext* globalCtx) } } -void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Update(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; - if (globalCtx->actorCtx.lensActive) { - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); + if (play->actorCtx.lensActive) { + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); - if(gSaveContext.n64ddFlag && globalCtx->sceneNum == 16) { - GetItemEntry randoGetItem = GetChestGameRandoGetItem(this->actor.room, this->giDrawId, globalCtx); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItem); + if(gSaveContext.n64ddFlag && play->sceneNum == 16) { + GetItemEntry randoGetItem = GetChestGameRandoGetItem(this->actor.room, this->giDrawId, play); + EnItem00_CustomItemsParticles(&this->actor, play, randoGetItem); if (randoGetItem.itemId != ITEM_NONE) { - GetItemEntry_Draw(globalCtx, randoGetItem); + GetItemEntry_Draw(play, randoGetItem); return; } } - GetItem_Draw(globalCtx, this->giDrawId); + GetItem_Draw(play, this->giDrawId); } } -void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Draw(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; s32 type = this->actor.params & 0xFF; @@ -254,17 +254,17 @@ void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx) { randoGetItem = Randomizer_GetItemFromKnownCheck(RC_LH_UNDERWATER_ITEM, GI_LETTER_RUTO); } - EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItem); + EnItem00_CustomItemsParticles(&this->actor, play, randoGetItem); if (randoGetItem.itemId != ITEM_NONE) { - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - GetItemEntry_Draw(globalCtx, randoGetItem); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + GetItemEntry_Draw(play, randoGetItem); return; } } - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->giDrawId); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, this->giDrawId); } diff --git a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h index d72c64ea9..cb881828e 100644 --- a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -6,7 +6,7 @@ struct ItemEtcetera; -typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, GlobalContext*); +typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, PlayState*); typedef struct ItemEtcetera { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c index 8f68e811a..ff19d095e 100644 --- a/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void ItemInbox_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemInbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemInbox_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemInbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemInbox_Init(Actor* thisx, PlayState* play); +void ItemInbox_Destroy(Actor* thisx, PlayState* play); +void ItemInbox_Update(Actor* thisx, PlayState* play); +void ItemInbox_Draw(Actor* thisx, PlayState* play); -void ItemInbox_Wait(ItemInbox* this, GlobalContext* globalCtx); +void ItemInbox_Wait(ItemInbox* this, PlayState* play); const ActorInit Item_Inbox_InitVars = { ACTOR_ITEM_INBOX, @@ -28,32 +28,32 @@ const ActorInit Item_Inbox_InitVars = { NULL, }; -void ItemInbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Init(Actor* thisx, PlayState* play) { ItemInbox* this = (ItemInbox*)thisx; this->actionFunc = ItemInbox_Wait; Actor_SetScale(&this->actor, 0.2); } -void ItemInbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Destroy(Actor* thisx, PlayState* play) { } -void ItemInbox_Wait(ItemInbox* this, GlobalContext* globalCtx) { - if (Flags_GetTreasure(globalCtx, (this->actor.params >> 8) & 0x1F)) { +void ItemInbox_Wait(ItemInbox* this, PlayState* play) { + if (Flags_GetTreasure(play, (this->actor.params >> 8) & 0x1F)) { Actor_Kill(&this->actor); } } -void ItemInbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Update(Actor* thisx, PlayState* play) { ItemInbox* this = (ItemInbox*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemInbox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Draw(Actor* thisx, PlayState* play) { ItemInbox* this = (ItemInbox*)thisx; - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->actor.params & 0xFF); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, this->actor.params & 0xFF); } diff --git a/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h b/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h index 0845653ab..3bf3cf157 100644 --- a/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h +++ b/soh/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h @@ -6,7 +6,7 @@ struct ItemInbox; -typedef void (*ItemInboxActionFunc)(struct ItemInbox*, GlobalContext*); +typedef void (*ItemInboxActionFunc)(struct ItemInbox*, PlayState*); typedef struct ItemInbox { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c index 1e793fc85..73b31a90f 100644 --- a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c +++ b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c @@ -9,18 +9,18 @@ #define FLAGS ACTOR_FLAG_4 -void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemOcarina_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemOcarina_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemOcarina_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemOcarina_Init(Actor* thisx, PlayState* play); +void ItemOcarina_Destroy(Actor* thisx, PlayState* play); +void ItemOcarina_Update(Actor* thisx, PlayState* play); +void ItemOcarina_Draw(Actor* thisx, PlayState* play); -void ItemOcarina_GetThrown(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_WaitInWater(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_StartSoTCutscene(ItemOcarina* this, GlobalContext* globalCtx); -void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx); -void func_80B865E0(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_DoNothing(ItemOcarina* this, GlobalContext* globalCtx); +void ItemOcarina_GetThrown(ItemOcarina* this, PlayState* play); +void ItemOcarina_Fly(ItemOcarina* this, PlayState* play); +void ItemOcarina_WaitInWater(ItemOcarina* this, PlayState* play); +void ItemOcarina_StartSoTCutscene(ItemOcarina* this, PlayState* play); +void func_80B864EC(ItemOcarina* this, PlayState* play); +void func_80B865E0(ItemOcarina* this, PlayState* play); +void ItemOcarina_DoNothing(ItemOcarina* this, PlayState* play); const ActorInit Item_Ocarina_InitVars = { ACTOR_ITEM_OCARINA, @@ -39,7 +39,7 @@ void ItemOcarina_SetupAction(ItemOcarina* this, ItemOcarinaActionFunc actionFunc this->actionFunc = actionFunc; } -void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Init(Actor* thisx, PlayState* play) { ItemOcarina* this = (ItemOcarina*)thisx; s32 params = thisx->params; @@ -62,7 +62,7 @@ void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(thisx); return; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ELF_MSG2, 299.0f, -140.0f, 884.0f, 0, 4, 1, 0x3800); + Actor_Spawn(&play->actorCtx, play, ACTOR_ELF_MSG2, 299.0f, -140.0f, 884.0f, 0, 4, 1, 0x3800); Actor_SetScale(thisx, 0.2f); break; default: @@ -74,10 +74,10 @@ void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx) { this->spinRotOffset = 0x400; } -void ItemOcarina_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Destroy(Actor* thisx, PlayState* play) { } -void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { +void ItemOcarina_Fly(ItemOcarina* this, PlayState* play) { Vec3f ripplePos; func_8002D7EC(&this->actor); @@ -91,7 +91,7 @@ void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.frames == 881) { + if (play->csCtx.frames == 881) { this->actor.world.pos.x = 250.0f; this->actor.world.pos.y = 60.0f; this->actor.world.pos.z = 1075.0f; @@ -100,9 +100,9 @@ void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { this->actor.velocity.z = -7.0f; } - if (globalCtx->csCtx.frames == 897) { - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, 100, 500, 0); - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, 0, 0, 1, 0); + if (play->csCtx.frames == 897) { + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 100, 500, 0); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, 0, 0, 1, 0); this->actor.velocity.x = 0.0f; this->actor.velocity.y = 0.0f; this->actor.velocity.z = 0.0f; @@ -113,15 +113,15 @@ void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { } // landed in water - if (globalCtx->csCtx.frames == 906) { + if (play->csCtx.frames == 906) { ripplePos.x = 274.0f; ripplePos.y = -60.0f; ripplePos.z = 907.0f; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0); } } -void ItemOcarina_GetThrown(ItemOcarina* this, GlobalContext* globalCtx) { +void ItemOcarina_GetThrown(ItemOcarina* this, PlayState* play) { this->actor.gravity = -0.3f; this->actor.minVelocityY = -5.0f; this->actor.velocity.x = 0.0f; @@ -130,7 +130,7 @@ void ItemOcarina_GetThrown(ItemOcarina* this, GlobalContext* globalCtx) { ItemOcarina_SetupAction(this, ItemOcarina_Fly); } -void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx) { +void func_80B864EC(ItemOcarina* this, PlayState* play) { func_8002D7EC(&this->actor); this->actor.shape.rot.x += this->spinRotOffset * 2; this->actor.shape.rot.y += this->spinRotOffset * 3; @@ -143,7 +143,7 @@ void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.frames == 220) { + if (play->csCtx.frames == 220) { this->actor.world.pos.x = 144.0f; this->actor.world.pos.y = 80.0f; this->actor.world.pos.z = 1686.0f; @@ -155,7 +155,7 @@ void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx) { } } -void func_80B865E0(ItemOcarina* this, GlobalContext* globalCtx) { +void func_80B865E0(ItemOcarina* this, PlayState* play) { this->actor.gravity = -0.3f; this->actor.minVelocityY = -5.0f; this->actor.velocity.x = 0.0f; @@ -164,62 +164,62 @@ void func_80B865E0(ItemOcarina* this, GlobalContext* globalCtx) { ItemOcarina_SetupAction(this, func_80B864EC); } -void ItemOcarina_DoNothing(ItemOcarina* this, GlobalContext* globalCtx) { +void ItemOcarina_DoNothing(ItemOcarina* this, PlayState* play) { } -void ItemOcarina_StartSoTCutscene(ItemOcarina* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void ItemOcarina_StartSoTCutscene(ItemOcarina* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (!gSaveContext.n64ddFlag) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gHyruleFieldZeldaSongOfTimeCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gHyruleFieldZeldaSongOfTimeCs); gSaveContext.cutsceneTrigger = 1; } else { - globalCtx->sceneLoadFlag = 0x14; - globalCtx->fadeTransition = 3; + play->sceneLoadFlag = 0x14; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; - globalCtx->nextEntranceIndex = 0x050F; + play->nextEntranceIndex = 0x050F; gSaveContext.nextCutsceneIndex = 0; } } } -void ItemOcarina_WaitInWater(ItemOcarina* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void ItemOcarina_WaitInWater(ItemOcarina* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { gSaveContext.eventChkInf[4] |= 8; - Flags_SetSwitch(globalCtx, 3); + Flags_SetSwitch(play, 3); this->actionFunc = ItemOcarina_StartSoTCutscene; this->actor.draw = NULL; } else { if (!gSaveContext.n64ddFlag) { - func_8002F434(&this->actor, globalCtx, GI_OCARINA_OOT, 30.0f, 50.0f); + func_8002F434(&this->actor, play, GI_OCARINA_OOT, 30.0f, 50.0f); } else { GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_HF_OCARINA_OF_TIME_ITEM, GI_OCARINA_OOT); - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 30.0f, 50.0f); + GiveItemEntryFromActor(&this->actor, play, getItemEntry, 30.0f, 50.0f); } - if ((globalCtx->gameplayFrames & 13) == 0) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); + if ((play->gameplayFrames & 13) == 0) { + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); } } } -void ItemOcarina_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Update(Actor* thisx, PlayState* play) { ItemOcarina* this = (ItemOcarina*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemOcarina_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Draw(Actor* thisx, PlayState* play) { ItemOcarina* this = (ItemOcarina*)thisx; - func_8002EBCC(thisx, globalCtx, 0); - func_8002ED80(thisx, globalCtx, 0); + func_8002EBCC(thisx, play, 0); + func_8002ED80(thisx, play, 0); if (gSaveContext.n64ddFlag) { GetItemEntry randoGetItem = Randomizer_GetItemFromKnownCheck(RC_HF_OCARINA_OF_TIME_ITEM, GI_OCARINA_OOT); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItem); - GetItemEntry_Draw(globalCtx, randoGetItem); + EnItem00_CustomItemsParticles(&this->actor, play, randoGetItem); + GetItemEntry_Draw(play, randoGetItem); return; } - GetItem_Draw(globalCtx, GID_OCARINA_TIME); + GetItem_Draw(play, GID_OCARINA_TIME); } diff --git a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h index f653ae443..9a02b99ed 100644 --- a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h +++ b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h @@ -6,7 +6,7 @@ struct ItemOcarina; -typedef void (*ItemOcarinaActionFunc)(struct ItemOcarina*, GlobalContext*); +typedef void (*ItemOcarinaActionFunc)(struct ItemOcarina*, PlayState*); typedef struct ItemOcarina { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index 5a17b5b92..9eda477a6 100644 --- a/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void ItemShield_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemShield_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemShield_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemShield_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemShield_Init(Actor* thisx, PlayState* play); +void ItemShield_Destroy(Actor* thisx, PlayState* play); +void ItemShield_Update(Actor* thisx, PlayState* play); +void ItemShield_Draw(Actor* thisx, PlayState* play); -void func_80B86F68(ItemShield* this, GlobalContext* globalCtx); -void func_80B86BC8(ItemShield* this, GlobalContext* globalCtx); +void func_80B86F68(ItemShield* this, PlayState* play); +void func_80B86BC8(ItemShield* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -58,7 +58,7 @@ void ItemShield_SetupAction(ItemShield* this, ItemShieldActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ItemShield_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Init(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; s32 i; @@ -86,25 +86,25 @@ void ItemShield_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetScale(&this->actor, 0.01f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); osSyncPrintf(VT_FGCOL(GREEN) "Item_Shild %d \n" VT_RST, this->actor.params); } -void ItemShield_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Destroy(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B86AC8(ItemShield* this, GlobalContext* globalCtx) { +void func_80B86AC8(ItemShield* this, PlayState* play) { Actor_MoveForward(&this->actor); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Actor_Kill(&this->actor); return; } - func_8002F434(&this->actor, globalCtx, GI_SHIELD_DEKU, 30.0f, 50.0f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 5); + func_8002F434(&this->actor, play, GI_SHIELD_DEKU, 30.0f, 50.0f); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 5); if (this->actor.bgCheckFlags & 1) { this->timer--; if (this->timer < 60) { @@ -120,12 +120,12 @@ void func_80B86AC8(ItemShield* this, GlobalContext* globalCtx) { } } -void func_80B86BC8(ItemShield* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B86BC8(ItemShield* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { Actor_Kill(&this->actor); return; } - func_8002F434(&this->actor, globalCtx, GI_SHIELD_DEKU, 30.0f, 50.0f); + func_8002F434(&this->actor, play, GI_SHIELD_DEKU, 30.0f, 50.0f); if (this->collider.base.acFlags & AC_HIT) { ItemShield_SetupAction(this, func_80B86AC8); this->actor.velocity.y = 4.0f; @@ -135,11 +135,11 @@ void func_80B86BC8(ItemShield* this, GlobalContext* globalCtx) { this->timer = 160; } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { +void func_80B86CA8(ItemShield* this, PlayState* play) { static Vec3f D_80B871F4 = { 0.0f, 0.0f, 0.0f }; static f32 D_80B87200[] = { 0.3f, 0.6f, 0.9f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.85f, 0.7f, 0.55f, 0.4f, 0.25f, 0.1f, 0.0f }; @@ -149,7 +149,7 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { s32 temp; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 5); this->actor.shape.yOffset = ABS(Math_SinS(this->actor.shape.rot.x)) * 1500.0f; for (i = 0; i < 8; i++) { @@ -157,7 +157,7 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { D_80B871F4.x = this->unk_1A8[i].x; D_80B871F4.y = this->unk_1A8[i].y + (this->actor.shape.yOffset * 0.01f) + (D_80B87200[temp] * -10.0f * 0.2f); D_80B871F4.z = this->unk_1A8[i].z; - EffectSsFireTail_SpawnFlame(globalCtx, &this->actor, &D_80B871F4, D_80B87200[temp] * 0.2f, -1, + EffectSsFireTail_SpawnFlame(play, &this->actor, &D_80B871F4, D_80B87200[temp] * 0.2f, -1, D_80B87240[temp]); if (this->unk_19E[i] != 0) { this->unk_19E[i]--; @@ -183,9 +183,9 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { } } -void func_80B86F68(ItemShield* this, GlobalContext* globalCtx) { +void func_80B86F68(ItemShield* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); MtxF* shield = &player->shieldMf; this->actor.world.pos.x = shield->xw; @@ -210,21 +210,21 @@ void func_80B86F68(ItemShield* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0; } -void ItemShield_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Update(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemShield_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Draw(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; if (!(this->unk_19C & 2)) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(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++, SEGMENTED_TO_VIRTUAL(gLinkChildDekuShieldDL)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.h b/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.h index 7daf0d013..c7984f4a4 100644 --- a/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.h +++ b/soh/src/overlays/actors/ovl_Item_Shield/z_item_shield.h @@ -6,7 +6,7 @@ struct ItemShield; -typedef void (*ItemShieldActionFunc)(struct ItemShield*, GlobalContext*); +typedef void (*ItemShieldActionFunc)(struct ItemShield*, PlayState*); typedef struct ItemShield { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 374cecea1..4079eb473 100644 --- a/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void MagicDark_Init(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_OrbUpdate(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx); +void MagicDark_Init(Actor* thisx, PlayState* play); +void MagicDark_Destroy(Actor* thisx, PlayState* play); +void MagicDark_OrbUpdate(Actor* thisx, PlayState* play); +void MagicDark_OrbDraw(Actor* thisx, PlayState* play); +void MagicDark_DiamondUpdate(Actor* thisx, PlayState* play); +void MagicDark_DiamondDraw(Actor* thisx, PlayState* play); -void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity); +void MagicDark_DimLighting(PlayState* play, f32 intensity); const ActorInit Magic_Dark_InitVars = { ACTOR_MAGIC_DARK, @@ -36,9 +36,9 @@ const ActorInit Magic_Dark_InitVars = { // unused static Color_RGBA8 D_80B88B10[] = { { 50, 100, 150, 200 }, { 255, 200, 150, 100 } }; -void MagicDark_Init(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_Init(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!LINK_IS_ADULT) { this->scale = 0.4f; @@ -63,19 +63,19 @@ void MagicDark_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicDark_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_Destroy(Actor* thisx, PlayState* play) { if (gSaveContext.nayrusLoveTimer == 0) { - func_800876C8(globalCtx); + func_800876C8(play); } } -void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_DiamondUpdate(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; u8 phi_a0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 pad; s16 nayrusLoveTimer = gSaveContext.nayrusLoveTimer; - s32 msgMode = globalCtx->msgCtx.msgMode; + s32 msgMode = play->msgCtx.msgMode; if ((msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || (msgMode == MSGMODE_SONG_PLAYED)) { Actor_Kill(thisx); @@ -121,7 +121,7 @@ void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { } thisx->world.rot.y += 0x3E8; - thisx->shape.rot.y = thisx->world.rot.y + Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + thisx->shape.rot.y = thisx->world.rot.y + Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); this->timer++; gSaveContext.nayrusLoveTimer = nayrusLoveTimer + 1; @@ -132,12 +132,12 @@ void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { +void MagicDark_DimLighting(PlayState* play, f32 intensity) { s32 i; f32 colorScale; f32 fogScale; - if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5) { + if (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5) { intensity = CLAMP_MIN(intensity, 0.0f); intensity = CLAMP_MAX(intensity, 1.0f); fogScale = intensity - 0.2f; @@ -146,11 +146,11 @@ void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { fogScale = 0.0f; } - globalCtx->envCtx.adjFogNear = (850.0f - globalCtx->envCtx.lightSettings.fogNear) * fogScale; + play->envCtx.adjFogNear = (850.0f - play->envCtx.lightSettings.fogNear) * fogScale; if (intensity == 0.0f) { - for (i = 0; i < ARRAY_COUNT(globalCtx->envCtx.adjFogColor); i++) { - globalCtx->envCtx.adjFogColor[i] = 0; + for (i = 0; i < ARRAY_COUNT(play->envCtx.adjFogColor); i++) { + play->envCtx.adjFogColor[i] = 0; } } else { colorScale = intensity * 5.0f; @@ -159,28 +159,28 @@ void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { colorScale = 1.0f; } - for (i = 0; i < ARRAY_COUNT(globalCtx->envCtx.adjFogColor); i++) { - globalCtx->envCtx.adjFogColor[i] = -(s16)(globalCtx->envCtx.lightSettings.fogColor[i] * colorScale); + for (i = 0; i < ARRAY_COUNT(play->envCtx.adjFogColor); i++) { + play->envCtx.adjFogColor[i] = -(s16)(play->envCtx.lightSettings.fogColor[i] * colorScale); } } } } -void MagicDark_OrbUpdate(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_OrbUpdate(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_8002F974(&this->actor, NA_SE_PL_MAGIC_SOUL_BALL - SFX_FLAG); if (this->timer < 35) { - MagicDark_DimLighting(globalCtx, this->timer * (1 / 45.0f)); + MagicDark_DimLighting(play, this->timer * (1 / 45.0f)); Math_SmoothStepToF(&thisx->scale.x, this->scale * (1 / 12.000001f), 0.05f, 0.01f, 0.0001f); Actor_SetScale(&this->actor, thisx->scale.x); } else if (this->timer < 55) { Actor_SetScale(&this->actor, thisx->scale.x * 0.9f); Math_SmoothStepToF(&this->orbOffset.y, player->bodyPartsPos[0].y, 0.5f, 3.0f, 1.0f); if (this->timer > 48) { - MagicDark_DimLighting(globalCtx, (54 - this->timer) * 0.2f); + MagicDark_DimLighting(play, (54 - this->timer) * 0.2f); } } else { thisx->update = MagicDark_DiamondUpdate; @@ -194,21 +194,21 @@ void MagicDark_OrbUpdate(Actor* thisx, GlobalContext* globalCtx) { this->timer++; } -void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_DiamondDraw(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; s32 pad; - u16 gameplayFrames = globalCtx->gameplayFrames; + u16 gameplayFrames = play->gameplayFrames; Color_RGB8 Spell_env_ori = {0, 100, 255}; Color_RGB8 Spell_col_ori = {170, 255, 255}; Color_RGB8 Spell_env = CVar_GetRGB("gNL_Diamond_Env", Spell_env_ori); Color_RGB8 Spell_col = CVar_GetRGB("gNL_Diamond_Col", Spell_col_ori); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 heightDiff; this->actor.world.pos.x = player->bodyPartsPos[0].x; @@ -222,7 +222,7 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); Matrix_RotateY(this->actor.shape.rot.y * (M_PI / 0x8000), 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 (CVar_GetS32("gUseSpellsCol",0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (s32)(this->primAlpha * 0.6f) & 0xFF); @@ -233,20 +233,20 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { } gSPDisplayList(POLY_XLU_DISP++, sDiamondMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 2, gameplayFrames * -4, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 2, gameplayFrames * -4, 32, 32, 1, 0, gameplayFrames * -16, 64, 32)); gSPDisplayList(POLY_XLU_DISP++, sDiamondModelDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_OrbDraw(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; Vec3f pos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; - f32 sp6C = globalCtx->state.frames & 0x1F; + f32 sp6C = play->state.frames & 0x1F; if (this->timer < 32) { pos.x = (player->bodyPartsPos[12].x + player->bodyPartsPos[15].x) * 0.5f; @@ -262,30 +262,30 @@ void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx) { return; } - pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * - Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); - pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); - pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * - Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); + pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); + pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); + pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 255); Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_RotateZ(sp6C * (M_PI / 32), MTXMODE_APPLY); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); Matrix_RotateZ(-sp6C * (M_PI / 32), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index 7fbd62cdd..16f1e0bf6 100644 --- a/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void MagicFire_Init(Actor* thisx, GlobalContext* globalCtx); -void MagicFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx); -void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void MagicFire_Init(Actor* thisx, PlayState* play); +void MagicFire_Destroy(Actor* thisx, PlayState* play); +void MagicFire_Update(Actor* thisx, PlayState* play); +void MagicFire_Draw(Actor* thisx, PlayState* play); -void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx); +void MagicFire_UpdateBeforeCast(Actor* thisx, PlayState* play); typedef enum { /* 0x00 */ DF_ACTION_INITIALIZE, @@ -75,7 +75,7 @@ static u8 sVertexIndices[] = { 14, 20, 21, 23, 28, 30, 33, 34, 40, 41, 43, 48, 50, 55, 57, 62, 64, 65, 73, 74, }; -void MagicFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_Init(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -84,24 +84,24 @@ void MagicFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionTimer = 0; this->alphaMultiplier = -3.0f; Actor_SetScale(&this->actor, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.update = MagicFire_UpdateBeforeCast; this->actionTimer = 20; this->actor.room = -1; } -void MagicFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void MagicFire_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); } -void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_UpdateBeforeCast(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || - (globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { + if ((play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || + (play->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { Actor_Kill(&this->actor); return; } @@ -114,14 +114,14 @@ void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos = player->actor.world.pos; } -void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_Update(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; this->actor.world.pos = player->actor.world.pos; - if ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || - (globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { + if ((play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || + (play->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { Actor_Kill(&this->actor); return; } @@ -134,7 +134,7 @@ void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.radius = (this->actor.scale.x * 325.0f); this->collider.dim.height = (this->actor.scale.y * 450.0f); this->collider.dim.yShift = (this->actor.scale.y * -225.0f); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); switch (this->action) { case DF_ACTION_INITIALIZE: @@ -209,10 +209,10 @@ void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_Draw(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; s32 pad1; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; s32 pad2; s32 i; u8 alpha; @@ -222,7 +222,7 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { Color_RGB8 Spell_col = CVar_GetRGB("gDF_Col", Spell_col_ori); if (this->action > 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (u8)(s32)(60 * this->screenTintIntensity), (u8)(s32)(20 * this->screenTintIntensity), (u8)(s32)(0 * this->screenTintIntensity), @@ -230,7 +230,7 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); gDPFillRectangle(POLY_XLU_DISP++, 0, 0, 319, 239); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (CVar_GetS32("gUseSpellsCol",0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (u8)(this->alphaMultiplier * 255)); gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, (u8)(this->alphaMultiplier * 255)); @@ -239,7 +239,7 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, Spell_env_ori.r, Spell_env_ori.g, Spell_env_ori.b, (u8)(this->alphaMultiplier * 255)); } Matrix_Scale(0.15f, 0.15f, 0.15f, 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++); gSPTexture(POLY_XLU_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); @@ -251,11 +251,11 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetTileSize(POLY_XLU_DISP++, 1, 0, 0, 252, 252); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 512, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 511 - ((gameplayFrames * 5) % 512), 64, 64, 1, (gameplayFrames * 2) % 256, 255 - ((gameplayFrames * 20) % 256), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); alpha = (s32)(this->alphaMultiplier * 255); Vtx* vertices = ResourceMgr_LoadVtxByName(sSphereVtx); diff --git a/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index 4c41c6a87..68e30e186 100644 --- a/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -8,16 +8,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx); -void MagicWind_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MagicWind_Update(Actor* thisx, GlobalContext* globalCtx); -void MagicWind_Draw(Actor* thisx, GlobalContext* globalCtx); +void MagicWind_Init(Actor* thisx, PlayState* play); +void MagicWind_Destroy(Actor* thisx, PlayState* play); +void MagicWind_Update(Actor* thisx, PlayState* play); +void MagicWind_Draw(Actor* thisx, PlayState* play); -void MagicWind_Shrink(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_WaitForTimer(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_FadeOut(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_WaitAtFullSize(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_Grow(MagicWind* this, GlobalContext* globalCtx); +void MagicWind_Shrink(MagicWind* this, PlayState* play); +void MagicWind_WaitForTimer(MagicWind* this, PlayState* play); +void MagicWind_FadeOut(MagicWind* this, PlayState* play); +void MagicWind_WaitAtFullSize(MagicWind* this, PlayState* play); +void MagicWind_Grow(MagicWind* this, PlayState* play); const ActorInit Magic_Wind_InitVars = { ACTOR_MAGIC_WIND, @@ -42,11 +42,11 @@ void MagicWind_SetupAction(MagicWind* this, MagicWindFunc actionFunc) { this->actionFunc = actionFunc; } -void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx) { +void MagicWind_Init(Actor* thisx, PlayState* play) { MagicWind* this = (MagicWind*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (SkelCurve_Init(globalCtx, &this->skelCurve, &sSkel, &sAnim) == 0) { + if (SkelCurve_Init(play, &this->skelCurve, &sSkel, &sAnim) == 0) { // "Magic_Wind_Actor_ct (): Construct failed" osSyncPrintf("Magic_Wind_Actor_ct():コンストラクト失敗\n"); } @@ -67,10 +67,10 @@ void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicWind_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MagicWind_Destroy(Actor* thisx, PlayState* play) { MagicWind* this = (MagicWind*)thisx; - SkelCurve_Destroy(globalCtx, &this->skelCurve); - func_800876C8(globalCtx); + SkelCurve_Destroy(play, &this->skelCurve); + func_800876C8(play); // "wipe out" LOG_STRING("消滅"); } @@ -85,8 +85,8 @@ void MagicWind_UpdateAlpha(f32 alpha) { } } -void MagicWind_WaitForTimer(MagicWind* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void MagicWind_WaitForTimer(MagicWind* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer > 0) { this->timer--; @@ -98,17 +98,17 @@ void MagicWind_WaitForTimer(MagicWind* this, GlobalContext* globalCtx) { func_8002F7DC(&player->actor, NA_SE_PL_MAGIC_WIND_NORMAL); MagicWind_UpdateAlpha(1.0f); MagicWind_SetupAction(this, MagicWind_Grow); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); } -void MagicWind_Grow(MagicWind* this, GlobalContext* globalCtx) { - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { +void MagicWind_Grow(MagicWind* this, PlayState* play) { + if (SkelCurve_Update(play, &this->skelCurve)) { MagicWind_SetupAction(this, MagicWind_WaitAtFullSize); this->timer = 50; } } -void MagicWind_WaitAtFullSize(MagicWind* this, GlobalContext* globalCtx) { +void MagicWind_WaitAtFullSize(MagicWind* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -117,7 +117,7 @@ void MagicWind_WaitAtFullSize(MagicWind* this, GlobalContext* globalCtx) { } } -void MagicWind_FadeOut(MagicWind* this, GlobalContext* globalCtx) { +void MagicWind_FadeOut(MagicWind* this, PlayState* play) { if (this->timer > 0) { MagicWind_UpdateAlpha((f32)this->timer * (1.0f / 30.0f)); this->timer--; @@ -126,57 +126,57 @@ void MagicWind_FadeOut(MagicWind* this, GlobalContext* globalCtx) { } } -void MagicWind_Shrink(MagicWind* this, GlobalContext* globalCtx) { - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { +void MagicWind_Shrink(MagicWind* this, PlayState* play) { + if (SkelCurve_Update(play, &this->skelCurve)) { Actor_Kill(&this->actor); } } -void MagicWind_Update(Actor* thisx, GlobalContext* globalCtx) { +void MagicWind_Update(Actor* thisx, PlayState* play) { MagicWind* this = (MagicWind*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || + play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(thisx); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 MagicWind_OverrideLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) { +s32 MagicWind_OverrideLimbDraw(PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) { MagicWind* this = (MagicWind*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 1) { gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 9) & 0xFF, - 0xFF - ((globalCtx->state.frames * 0xF) & 0xFF), 0x40, 0x40, 1, - (globalCtx->state.frames * 0xF) & 0xFF, - 0xFF - ((globalCtx->state.frames * 0x1E) & 0xFF), 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->state.frames * 9) & 0xFF, + 0xFF - ((play->state.frames * 0xF) & 0xFF), 0x40, 0x40, 1, + (play->state.frames * 0xF) & 0xFF, + 0xFF - ((play->state.frames * 0x1E) & 0xFF), 0x40, 0x40)); } else if (limbIndex == 2) { gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 3) & 0xFF, - 0xFF - ((globalCtx->state.frames * 5) & 0xFF), 0x40, 0x40, 1, - (globalCtx->state.frames * 6) & 0xFF, - 0xFF - ((globalCtx->state.frames * 0xA) & 0xFF), 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->state.frames * 3) & 0xFF, + 0xFF - ((play->state.frames * 5) & 0xFF), 0x40, 0x40, 1, + (play->state.frames * 6) & 0xFF, + 0xFF - ((play->state.frames * 0xA) & 0xFF), 0x40, 0x40)); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return true; } -void MagicWind_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void MagicWind_Draw(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MagicWind* this = (MagicWind*)thisx; OPEN_DISPS(gfxCtx); if (this->actionFunc != MagicWind_WaitForTimer) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 25); - SkelCurve_Draw(thisx, globalCtx, &this->skelCurve, MagicWind_OverrideLimbDraw, NULL, 1, NULL); + SkelCurve_Draw(thisx, play, &this->skelCurve, MagicWind_OverrideLimbDraw, NULL, 1, NULL); } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h b/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h index 25b3e7d70..489603c38 100644 --- a/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h +++ b/soh/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h @@ -6,7 +6,7 @@ struct MagicWind; -typedef void (*MagicWindFunc)(struct MagicWind* this, GlobalContext* globalCtx); +typedef void (*MagicWindFunc)(struct MagicWind* this, PlayState* play); typedef struct MagicWind { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index bcee72971..34e142a3b 100644 --- a/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -10,10 +10,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void MirRay_Init(Actor* thisx, GlobalContext* globalCtx); -void MirRay_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MirRay_Update(Actor* thisx, GlobalContext* globalCtx); -void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx); +void MirRay_Init(Actor* thisx, PlayState* play); +void MirRay_Destroy(Actor* thisx, PlayState* play); +void MirRay_Update(Actor* thisx, PlayState* play); +void MirRay_Draw(Actor* thisx, PlayState* play); s32 MirRay_CheckInFrustum(Vec3f* vecA, Vec3f* vecB, f32 pointx, f32 pointy, f32 pointz, s16 radiusA, s16 radiusB); @@ -128,8 +128,8 @@ void MirRay_SetupCollider(MirRay* this) { // Set up a light point between source point and reflection point. Reflection point is the pool point (for windows) or // at the player position (for mirrors) -void MirRay_MakeShieldLight(MirRay* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void MirRay_MakeShieldLight(MirRay* this, PlayState* play) { + Player* player = GET_PLAYER(play); MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; Vec3f reflectionPt; Vec3s lightPt; @@ -160,7 +160,7 @@ void MirRay_MakeShieldLight(MirRay* this, GlobalContext* globalCtx) { } } -void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Init(Actor* thisx, PlayState* play) { s32 pad; MirRay* this = (MirRay*)thisx; MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; @@ -189,7 +189,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; @@ -210,15 +210,15 @@ void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { this->shieldCorners[5].y = -800.0f; if (dataEntry->params & 2) { - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); if (!(dataEntry->params & 4)) { // Beams not from mirrors MirRay_SetupCollider(this); } } - Collider_InitQuad(globalCtx, &this->shieldRay); - Collider_SetQuad(globalCtx, &this->shieldRay, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->shieldRay); + Collider_SetQuad(play, &this->shieldRay, &this->actor, &sQuadInit); // Spirit Temple top room mirrors if ((this->actor.params == 5) || (this->actor.params == 7) || (this->actor.params == 8)) { @@ -226,22 +226,22 @@ void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void MirRay_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Destroy(Actor* thisx, PlayState* play) { MirRay* this = (MirRay*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); if (sMirRayData[this->actor.params].params & 2) { - Collider_DestroyJntSph(globalCtx, &this->colliderSph); + Collider_DestroyJntSph(play, &this->colliderSph); } - Collider_DestroyQuad(globalCtx, &this->shieldRay); + Collider_DestroyQuad(play, &this->shieldRay); } -void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Update(Actor* thisx, PlayState* play) { s32 pad; MirRay* this = (MirRay*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); D_80B8E670 = 0; @@ -250,12 +250,12 @@ void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { if (sMirRayData[this->actor.params].params & 4) { // Beams from mirrors MirRay_SetupCollider(this); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } if (this->reflectIntensity > 0.0f) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->shieldRay.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->shieldRay.base); } - MirRay_MakeShieldLight(this, globalCtx); + MirRay_MakeShieldLight(this, play); if (this->reflectIntensity > 0.0f) { func_8002F8F0(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); @@ -263,13 +263,13 @@ void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { +void MirRay_SetIntensity(MirRay* this, PlayState* play) { f32 sp4C[3]; f32 temp_f0; f32 temp_f0_2; f32 temp_f2_2; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); MtxF* shieldMtx = &player->shieldMf; this->reflectIntensity = 0.0f; @@ -307,8 +307,8 @@ void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { // Draws six images, one for each corner of the shield, by finding the intersection of a line segment from the corner // perpendicular to the shield with the nearest collision (if any). -void MirRay_SetupReflectionPolys(MirRay* this, GlobalContext* globalCtx, MirRayShieldReflection* reflection) { - Player* player = GET_PLAYER(globalCtx); +void MirRay_SetupReflectionPolys(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { + Player* player = GET_PLAYER(play); MtxF* shieldMtx; s32 i; Vec3f posA; @@ -335,7 +335,7 @@ void MirRay_SetupReflectionPolys(MirRay* this, GlobalContext* globalCtx, MirRayS posB.x = sp60.x + posA.x; posB.y = sp60.y + posA.y; posB.z = sp60.z + posA.z; - if (BgCheck_AnyLineTest1(&globalCtx->colCtx, &posA, &posB, &posResult, &outPoly, 1)) { + if (BgCheck_AnyLineTest1(&play->colCtx, &posA, &posB, &posResult, &outPoly, 1)) { reflection[i].reflectionPoly = outPoly; } else { reflection[i].reflectionPoly = NULL; @@ -364,8 +364,8 @@ void MirRay_RemoveSimilarReflections(MirRayShieldReflection* reflection) { } // Creates the reflected beam's collider (to interact with objects) and places and orients the shield images -void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldReflection* reflection) { - Player* player = GET_PLAYER(globalCtx); +void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { + Player* player = GET_PLAYER(play); s32 i; f32 temp_f0; Vec3f vecB; @@ -476,29 +476,29 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe } } -void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Draw(Actor* thisx, PlayState* play) { MirRay* this = (MirRay*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; MirRayShieldReflection reflection[6]; s32 temp; this->reflectIntensity = 0.0f; - if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(globalCtx)) { + if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(play)) { Matrix_Mult(&player->shieldMf, MTXMODE_NEW); - MirRay_SetIntensity(this, globalCtx); + MirRay_SetIntensity(this, play); if (!(this->reflectIntensity <= 0.0f)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Scale(1.0f, 1.0f, this->reflectIntensity * 5.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 150, (s16)(temp = this->reflectIntensity * 100.0f)); gSPDisplayList(POLY_XLU_DISP++, gShieldBeamGlowDL); - MirRay_SetupReflectionPolys(this, globalCtx, reflection); + MirRay_SetupReflectionPolys(this, play, reflection); MirRay_RemoveSimilarReflections(reflection); - MirRay_ReflectedBeam(this, globalCtx, reflection); + MirRay_ReflectedBeam(this, play, reflection); if (reflection[0].reflectionPoly == NULL) { reflection[0].opacity = 0; @@ -516,7 +516,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(reflection[i].pos.x, reflection[i].pos.y, reflection[i].pos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); Matrix_Mult(&reflection[i].mtx, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 150, reflection[0].opacity); @@ -527,7 +527,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { D_80B8E670 = 1; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } diff --git a/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index 35fcb751e..03d46f125 100644 --- a/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -11,21 +11,21 @@ #define FLAGS ACTOR_FLAG_22 -void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBean_Init(Actor* thisx, PlayState* play); +void ObjBean_Destroy(Actor* thisx, PlayState* play); +void ObjBean_Update(Actor* thisx, PlayState* play); +void ObjBean_Draw(Actor* thisx, PlayState* play); -void ObjBean_WaitForPlayer(ObjBean* this, GlobalContext* globalCtx); -void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForPlayer(ObjBean* this, PlayState* play); +void ObjBean_Fly(ObjBean* this, PlayState* play); void ObjBean_SetupFly(ObjBean* this); -void ObjBean_WaitForWater(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForWater(ObjBean* this, PlayState* play); void ObjBean_SetupWaitForWater(ObjBean* this); void ObjBean_SetupGrowWaterPhase1(ObjBean* this); -void ObjBean_GrowWaterPhase1(ObjBean* this, GlobalContext* globalCtx); -void ObjBean_GrowWaterPhase2(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_GrowWaterPhase1(ObjBean* this, PlayState* play); +void ObjBean_GrowWaterPhase2(ObjBean* this, PlayState* play); void ObjBean_SetupGrowWaterPhase2(ObjBean* this); -void ObjBean_GrowWaterPhase3(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_GrowWaterPhase3(ObjBean* this, PlayState* play); void ObjBean_SetupGrowWaterPhase3(ObjBean* this); void ObjBean_SetupGrown(ObjBean* this); void ObjBean_FlattenLeaves(ObjBean* this); @@ -34,32 +34,32 @@ void ObjBean_LeavesStill(ObjBean* this); void ObjBean_SetupShakeLeaves(ObjBean* this); void ObjBean_ShakeLeaves(ObjBean* this); void ObjBean_SetupWaitForBean(ObjBean* this); -void ObjBean_WaitForBean(ObjBean* this, GlobalContext* globalCtx); -void func_80B8FE3C(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForBean(ObjBean* this, PlayState* play); +void func_80B8FE3C(ObjBean* this, PlayState* play); void func_80B8FE00(ObjBean* this); void func_80B8FE6C(ObjBean* this); -void func_80B8FEAC(ObjBean* this, GlobalContext* globalCtx); +void func_80B8FEAC(ObjBean* this, PlayState* play); void func_80B8FF50(ObjBean* this); void ObjBean_SetupGrowWaterPhase4(ObjBean* this); -void func_80B8FF8C(ObjBean* this, GlobalContext* globalCtx); -void func_80B90050(ObjBean* this, GlobalContext* globalCtx); +void func_80B8FF8C(ObjBean* this, PlayState* play); +void func_80B90050(ObjBean* this, PlayState* play); void func_80B90010(ObjBean* this); void func_80B908EC(ObjBean* this); -void func_80B90918(ObjBean* this, GlobalContext* globalCtx); +void func_80B90918(ObjBean* this, PlayState* play); void func_80B90970(ObjBean* this); -void func_80B909B0(ObjBean* this, GlobalContext* globalCtx); +void func_80B909B0(ObjBean* this, PlayState* play); void func_80B909F8(ObjBean* this); -void func_80B90A34(ObjBean* this, GlobalContext* globalCtx); +void func_80B90A34(ObjBean* this, PlayState* play); void ObjBean_SetupWaitForPlayer(ObjBean* this); -void ObjBean_GrowWaterPhase4(ObjBean* this, GlobalContext* globalCtx); -void ObjBean_GrowWaterPhase5(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_GrowWaterPhase4(ObjBean* this, PlayState* play); +void ObjBean_GrowWaterPhase5(ObjBean* this, PlayState* play); void ObjBean_SetupGrowWaterPhase5(ObjBean* this); void ObjBean_SetupShakeLeavesFast(ObjBean* this); void ObjBean_ShakeLeavesFast(ObjBean* this); void ObjBean_Grow(ObjBean* this); void ObjBean_SetupGrow(ObjBean* this); void ObjBean_SetupWaitForStepOff(ObjBean* this); -void ObjBean_WaitForStepOff(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForStepOff(ObjBean* this, PlayState* play); #define BEAN_STATE_DRAW_LEAVES (1 << 0) #define BEAN_STATE_DRAW_SOIL (1 << 1) @@ -126,15 +126,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1600, ICHAIN_STOP), }; -void ObjBean_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_InitCollider(Actor* thisx, PlayState* play) { ObjBean* this = (ObjBean*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); } -void ObjBean_InitDynaPoly(ObjBean* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void ObjBean_InitDynaPoly(ObjBean* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader; s32 pad2; @@ -144,14 +144,14 @@ void ObjBean_InitDynaPoly(ObjBean* this, GlobalContext* globalCtx, CollisionHead DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void ObjBean_FindFloor(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_FindFloor(ObjBean* this, PlayState* play) { Vec3f vec; s32 sp20; @@ -159,7 +159,7 @@ void ObjBean_FindFloor(ObjBean* this, GlobalContext* globalCtx) { vec.y = this->dyna.actor.world.pos.y + 29.999998f; vec.z = this->dyna.actor.world.pos.z; this->dyna.actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &sp20, &this->dyna.actor, &vec); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &sp20, &this->dyna.actor, &vec); } void func_80B8EBC8(ObjBean* this) { @@ -226,18 +226,18 @@ void ObjBean_SetDrawMode(ObjBean* this, u8 drawFlag) { this->stateFlags |= drawFlag; } -void ObjBean_SetupPathCount(ObjBean* this, GlobalContext* globalCtx) { - this->pathCount = globalCtx->setupPathList[(this->dyna.actor.params >> 8) & 0x1F].count - 1; +void ObjBean_SetupPathCount(ObjBean* this, PlayState* play) { + this->pathCount = play->setupPathList[(this->dyna.actor.params >> 8) & 0x1F].count - 1; this->currentPointIndex = 0; this->nextPointIndex = 1; } -void ObjBean_SetupPath(ObjBean* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; +void ObjBean_SetupPath(ObjBean* this, PlayState* play) { + Path* path = &play->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; Math_Vec3s_ToVec3f(&this->pathPoints, SEGMENTED_TO_VIRTUAL(path->points)); } -void ObjBean_FollowPath(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_FollowPath(ObjBean* this, PlayState* play) { Path* path; Vec3f acell; Vec3f pathPointsFloat; @@ -251,7 +251,7 @@ void ObjBean_FollowPath(ObjBean* this, GlobalContext* globalCtx) { f32 mag; Math_StepToF(&this->dyna.actor.speedXZ, sBeanSpeeds[this->unk_1F6].velocity, sBeanSpeeds[this->unk_1F6].accel); - path = &globalCtx->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; + path = &play->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; nextPathPoint = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->nextPointIndex]; Math_Vec3s_ToVec3f(&pathPointsFloat, nextPathPoint); @@ -286,8 +286,8 @@ void ObjBean_FollowPath(ObjBean* this, GlobalContext* globalCtx) { } } -s32 ObjBean_CheckForHorseTrample(ObjBean* this, GlobalContext* globalCtx) { - Actor* currentActor = globalCtx->actorCtx.actorLists[ACTORCAT_BG].head; +s32 ObjBean_CheckForHorseTrample(ObjBean* this, PlayState* play) { + Actor* currentActor = play->actorCtx.actorLists[ACTORCAT_BG].head; while (currentActor != NULL) { if ((currentActor->id == ACTOR_EN_HORSE) && @@ -300,7 +300,7 @@ s32 ObjBean_CheckForHorseTrample(ObjBean* this, GlobalContext* globalCtx) { return false; } -void ObjBean_Break(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_Break(ObjBean* this, PlayState* play) { Vec3f pos; Vec3f velocity; f32 temp_f20; @@ -340,7 +340,7 @@ void ObjBean_Break(ObjBean* this, GlobalContext* globalCtx) { gravity = -100; arg5 = 64; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, gravity, arg5, 40, 3, 0, scale, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, gravity, arg5, 40, 3, 0, scale, 0, 0, (s16)((scale >> 3) + 40), -1, 1, sBreakDlists[i & 1]); } } @@ -464,14 +464,14 @@ void ObjBean_Grown(ObjBean* this) { } } -void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Init(Actor* thisx, PlayState* play) { s32 path; s32 linkAge; ObjBean* this = (ObjBean*)thisx; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || (mREG(1) == 1)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (mREG(1) == 1)) { path = (this->dyna.actor.params >> 8) & 0x1F; if (path == 0x1F) { osSyncPrintf(VT_COL(RED, WHITE)); @@ -482,7 +482,7 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->dyna.actor); return; } - if (globalCtx->setupPathList[path].count < 3) { + if (play->setupPathList[path].count < 3) { osSyncPrintf(VT_COL(RED, WHITE)); // "Incorrect number of path data" osSyncPrintf("パスデータ数が不正(%s %d)(arg_data %xH)\n", __FILE__, __LINE__, @@ -491,24 +491,24 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->dyna.actor); return; } - ObjBean_SetupPathCount(this, globalCtx); - ObjBean_SetupPath(this, globalCtx); + ObjBean_SetupPathCount(this, play); + ObjBean_SetupPath(this, play); ObjBean_Move(this); ObjBean_SetupWaitForPlayer(this); - ObjBean_InitDynaPoly(this, globalCtx, &gMagicBeanPlatformCol, DPM_UNK3); + ObjBean_InitDynaPoly(this, play, &gMagicBeanPlatformCol, DPM_UNK3); this->stateFlags |= BEAN_STATE_DYNAPOLY_SET; - ObjBean_InitCollider(&this->dyna.actor, globalCtx); + ObjBean_InitCollider(&this->dyna.actor, play); this->stateFlags |= BEAN_STATE_COLLIDER_SET; ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 8.8f); - ObjBean_FindFloor(this, globalCtx); + ObjBean_FindFloor(this, play); this->unk_1F6 = this->dyna.actor.home.rot.z & 3; } else { Actor_Kill(&this->dyna.actor); return; } - } else if ((Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) != 0) || (mREG(1) == 1)) { + } else if ((Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) != 0) || (mREG(1) == 1)) { ObjBean_SetupWaitForWater(this); } else { ObjBean_SetupWaitForBean(this); @@ -518,14 +518,14 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(魔法の豆の木リフト)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjBean_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Destroy(Actor* thisx, PlayState* play) { ObjBean* this = (ObjBean*)thisx; if (this->stateFlags & BEAN_STATE_DYNAPOLY_SET) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->stateFlags & BEAN_STATE_COLLIDER_SET) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } if (D_80B90E30 == this) { D_80B90E30 = NULL; @@ -538,14 +538,14 @@ void ObjBean_SetupWaitForBean(ObjBean* this) { this->dyna.actor.textId = 0x2F; } -void ObjBean_WaitForBean(ObjBean* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_BEAN) { +void ObjBean_WaitForBean(ObjBean* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { + if (func_8002F368(play) == EXCH_ITEM_BEAN) { func_80B8FE00(this); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } } else { - func_8002F298(&this->dyna.actor, globalCtx, 40.0f, EXCH_ITEM_BEAN); + func_8002F298(&this->dyna.actor, play, 40.0f, EXCH_ITEM_BEAN); } } @@ -556,7 +556,7 @@ void func_80B8FE00(ObjBean* this) { } // Link is looking at the soft soil -void func_80B8FE3C(ObjBean* this, GlobalContext* globalCtx) { +void func_80B8FE3C(ObjBean* this, PlayState* play) { if (this->timer <= 0) { func_80B8FE6C(this); } @@ -569,7 +569,7 @@ void func_80B8FE6C(ObjBean* this) { } // The leaves are visable and growing -void func_80B8FEAC(ObjBean* this, GlobalContext* globalCtx) { +void func_80B8FEAC(ObjBean* this, PlayState* play) { s32 temp_v1 = true; temp_v1 &= Math_StepToF(&this->dyna.actor.scale.y, 0.16672663f, 0.01f); @@ -592,7 +592,7 @@ void func_80B8FF50(ObjBean* this) { this->unk_1B6.x = 0x33E9; } -void func_80B8FF8C(ObjBean* this, GlobalContext* globalCtx) { +void func_80B8FF8C(ObjBean* this, PlayState* play) { this->unk_1B6.x -= 0x960; this->dyna.actor.scale.y = Math_SinS(this->unk_1B6.x) * 0.17434467f; this->dyna.actor.scale.x = this->dyna.actor.scale.z = Math_CosS(this->unk_1B6.x) * 0.12207746f; @@ -609,7 +609,7 @@ void func_80B90010(ObjBean* this) { } // Control is returned to the player and the leaves start to flatten out -void func_80B90050(ObjBean* this, GlobalContext* globalCtx) { +void func_80B90050(ObjBean* this, PlayState* play) { s16 temp_a0; f32 temp_f2; @@ -631,19 +631,19 @@ void ObjBean_SetupWaitForWater(ObjBean* this) { ObjBean_SetupLeavesStill(this); } -void ObjBean_WaitForWater(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_WaitForWater(ObjBean* this, PlayState* play) { this->transformFunc(this); - if (!(this->stateFlags & BEAN_STATE_BEEN_WATERED) && Flags_GetEnv(globalCtx, 5) && (D_80B90E30 == NULL) && + if (!(this->stateFlags & BEAN_STATE_BEEN_WATERED) && Flags_GetEnv(play, 5) && (D_80B90E30 == NULL) && (this->dyna.actor.xzDistToPlayer < 50.0f)) { ObjBean_SetupGrowWaterPhase1(this); D_80B90E30 = this; - OnePointCutscene_Init(globalCtx, 2210, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(play, 2210, -99, &this->dyna.actor, MAIN_CAM); this->dyna.actor.flags |= ACTOR_FLAG_4; return; } - if ((D_80B90E30 == this) && !Flags_GetEnv(globalCtx, 5)) { + if ((D_80B90E30 == this) && !Flags_GetEnv(play, 5)) { D_80B90E30 = NULL; if (D_80B90E30) {} } @@ -657,7 +657,7 @@ void ObjBean_SetupGrowWaterPhase1(ObjBean* this) { } // Camera moves and leaves move quickly -void ObjBean_GrowWaterPhase1(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase1(ObjBean* this, PlayState* play) { this->transformFunc(this); if (this->timer <= 0) { ObjBean_SetupGrowWaterPhase2(this); @@ -671,7 +671,7 @@ void ObjBean_SetupGrowWaterPhase2(ObjBean* this) { } // BeanStalk is visable and is growing -void ObjBean_GrowWaterPhase2(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase2(ObjBean* this, PlayState* play) { this->transformFunc(this); this->stalkSizeMultiplier += 0.001f; this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y + (s16)(this->stalkSizeMultiplier * 700000.0f); @@ -689,7 +689,7 @@ void ObjBean_SetupGrowWaterPhase3(ObjBean* this) { } // Fully grown and drops items -void ObjBean_GrowWaterPhase3(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase3(ObjBean* this, PlayState* play) { s32 i; Vec3f itemDropPos; @@ -702,7 +702,7 @@ void ObjBean_GrowWaterPhase3(ObjBean* this, GlobalContext* globalCtx) { itemDropPos.y = this->dyna.actor.world.pos.y - 25.0f; itemDropPos.z = this->dyna.actor.world.pos.z; for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &itemDropPos, ITEM00_FLEXIBLE); + Item_DropCollectible(play, &itemDropPos, ITEM00_FLEXIBLE); } this->stateFlags |= BEAN_STATE_BEEN_WATERED; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); @@ -720,7 +720,7 @@ void ObjBean_SetupGrowWaterPhase4(ObjBean* this) { } // Return control back to the player and start to shrink back down -void ObjBean_GrowWaterPhase4(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase4(ObjBean* this, PlayState* play) { this->transformFunc(this); this->stalkSizeMultiplier -= 0.001f; this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y + (s16)(this->stalkSizeMultiplier * 700000.0f); @@ -738,7 +738,7 @@ void ObjBean_SetupGrowWaterPhase5(ObjBean* this) { this->timer = 30; } -void ObjBean_GrowWaterPhase5(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase5(ObjBean* this, PlayState* play) { this->transformFunc(this); if (this->timer <= 0) { func_80B8FF50(this); @@ -751,13 +751,13 @@ void ObjBean_SetupWaitForPlayer(ObjBean* this) { ObjBean_SetDrawMode(this, BEAN_STATE_DRAW_PLANT); } -void ObjBean_WaitForPlayer(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_WaitForPlayer(ObjBean* this, PlayState* play) { if (func_8004356C(&this->dyna)) { // Player is standing on ObjBean_SetupFly(this); - if (globalCtx->sceneNum == SCENE_SPOT10) { // Lost woods - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_LOST_WOODS); + if (play->sceneNum == SCENE_SPOT10) { // Lost woods + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_LOST_WOODS); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_GENERIC); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_GENERIC); } } ObjBean_UpdatePosition(this); @@ -770,17 +770,17 @@ void ObjBean_SetupFly(ObjBean* this) { this->dyna.actor.flags |= ACTOR_FLAG_4; // Never stop updating } -void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_Fly(ObjBean* this, PlayState* play) { Camera* camera; - ObjBean_FollowPath(this, globalCtx); + ObjBean_FollowPath(this, play); if (this->currentPointIndex == this->pathCount) { - ObjBean_SetupPathCount(this, globalCtx); - ObjBean_SetupPath(this, globalCtx); + ObjBean_SetupPathCount(this, play); + ObjBean_SetupPath(this, play); ObjBean_SetupWaitForStepOff(this); this->dyna.actor.flags &= ~ACTOR_FLAG_4; // Never stop updating (disable) - camera = globalCtx->cameraPtrs[MAIN_CAM]; + camera = play->cameraPtrs[MAIN_CAM]; if ((camera->setting == CAM_SET_BEAN_LOST_WOODS) || (camera->setting == CAM_SET_BEAN_GENERIC)) { Camera_ChangeSetting(camera, CAM_SET_NORMAL0); @@ -790,13 +790,13 @@ void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_PL_PLANT_MOVE - SFX_FLAG); - if (globalCtx->sceneNum == SCENE_SPOT10) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_LOST_WOODS); + if (play->sceneNum == SCENE_SPOT10) { + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_LOST_WOODS); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_GENERIC); + Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_GENERIC); } } else if (this->stateFlags & BEAN_STATE_PLAYER_ON_TOP) { - camera = globalCtx->cameraPtrs[MAIN_CAM]; + camera = play->cameraPtrs[MAIN_CAM]; if ((camera->setting == CAM_SET_BEAN_LOST_WOODS) || (camera->setting == CAM_SET_BEAN_GENERIC)) { Camera_ChangeSetting(camera, CAM_SET_NORMAL0); @@ -811,7 +811,7 @@ void ObjBean_SetupWaitForStepOff(ObjBean* this) { ObjBean_SetDrawMode(this, BEAN_STATE_DRAW_PLANT); } -void ObjBean_WaitForStepOff(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_WaitForStepOff(ObjBean* this, PlayState* play) { if (!func_80043590(&this->dyna)) { ObjBean_SetupWaitForPlayer(this); } @@ -823,10 +823,10 @@ void func_80B908EC(ObjBean* this) { ObjBean_SetDrawMode(this, 0); } -void func_80B90918(ObjBean* this, GlobalContext* globalCtx) { +void func_80B90918(ObjBean* this, PlayState* play) { if (!func_8004356C(&this->dyna)) { - ObjBean_SetupPathCount(this, globalCtx); - ObjBean_SetupPath(this, globalCtx); + ObjBean_SetupPathCount(this, play); + ObjBean_SetupPath(this, play); ObjBean_Move(this); func_80B90970(this); } @@ -839,8 +839,8 @@ void func_80B90970(ObjBean* this) { func_80B8EDF4(this); } -void func_80B909B0(ObjBean* this, GlobalContext* globalCtx) { - if (ObjBean_CheckForHorseTrample(this, globalCtx)) { +void func_80B909B0(ObjBean* this, PlayState* play) { + if (ObjBean_CheckForHorseTrample(this, play)) { this->timer = 100; } else if (this->timer <= 0) { func_80B909F8(this); @@ -853,21 +853,21 @@ void func_80B909F8(ObjBean* this) { this->timer = 30; } -void func_80B90A34(ObjBean* this, GlobalContext* globalCtx) { - s32 trampled = ObjBean_CheckForHorseTrample(this, globalCtx); +void func_80B90A34(ObjBean* this, PlayState* play) { + s32 trampled = ObjBean_CheckForHorseTrample(this, play); func_80B8EE24(this); if (trampled) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } if ((this->timer <= 0) && (!trampled)) { func_80B8EBC8(this); ObjBean_SetupWaitForPlayer(this); } } -void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Update(Actor* thisx, PlayState* play) { s32 pad; ObjBean* this = (ObjBean*)thisx; @@ -875,28 +875,28 @@ void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->stateFlags & BEAN_STATE_DRAW_PLANT) { ObjBean_Move(this); if (this->dyna.actor.xzDistToPlayer < 150.0f) { this->collider.dim.radius = this->dyna.actor.scale.x * 640.0f + 0.5f; Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - ObjBean_FindFloor(this, globalCtx); + ObjBean_FindFloor(this, play); this->dyna.actor.shape.shadowDraw = ActorShadow_DrawCircle; this->dyna.actor.shape.shadowScale = this->dyna.actor.scale.x * 88.0f; - if (ObjBean_CheckForHorseTrample(this, globalCtx)) { + if (ObjBean_CheckForHorseTrample(this, play)) { osSyncPrintf(VT_FGCOL(CYAN)); // "Horse and bean tree lift collision" osSyncPrintf("馬と豆の木リフト衝突!!!\n"); osSyncPrintf(VT_RST); - ObjBean_Break(this, globalCtx); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + ObjBean_Break(this, play); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); func_80B908EC(this); } } else { @@ -912,35 +912,35 @@ void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjBean_DrawSoftSoilSpot(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_DrawSoftSoilSpot(ObjBean* this, PlayState* play) { Matrix_Translate(this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, MTXMODE_NEW); Matrix_RotateY(this->dyna.actor.home.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gMagicBeanSoftSoilDL); + Gfx_DrawDListOpa(play, gMagicBeanSoftSoilDL); } -void ObjBean_DrawBeanstalk(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_DrawBeanstalk(ObjBean* this, PlayState* play) { Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateY(this->dyna.actor.shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(0.1f, this->stalkSizeMultiplier, 0.1f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gMagicBeanStemDL); + Gfx_DrawDListOpa(play, gMagicBeanStemDL); } -void ObjBean_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Draw(Actor* thisx, PlayState* play) { ObjBean* this = (ObjBean*)thisx; if (this->stateFlags & BEAN_STATE_DRAW_SOIL) { - Gfx_DrawDListOpa(globalCtx, gMagicBeanSeedlingDL); + Gfx_DrawDListOpa(play, gMagicBeanSeedlingDL); } if (this->stateFlags & BEAN_STATE_DRAW_PLANT) { - Gfx_DrawDListOpa(globalCtx, gMagicBeanPlatformDL); + Gfx_DrawDListOpa(play, gMagicBeanPlatformDL); } if (this->stateFlags & BEAN_STATE_DRAW_LEAVES) { - ObjBean_DrawSoftSoilSpot(this, globalCtx); + ObjBean_DrawSoftSoilSpot(this, play); } if (this->stateFlags & BEAN_STATE_DRAW_STALK) { - ObjBean_DrawBeanstalk(this, globalCtx); + ObjBean_DrawBeanstalk(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h b/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h index aca116f15..317db4821 100644 --- a/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h +++ b/soh/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h @@ -6,7 +6,7 @@ struct ObjBean; -typedef void (*ObjBeanActionFunc)(struct ObjBean*, GlobalContext*); +typedef void (*ObjBeanActionFunc)(struct ObjBean*, PlayState*); typedef void (*ObjBeanTransformFunc)(struct ObjBean*); typedef struct ObjBean { diff --git a/soh/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c b/soh/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c index 660fa144b..dda22c292 100644 --- a/soh/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/soh/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -9,9 +9,9 @@ #define FLAGS 0 -void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBlockstop_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjBlockstop_Init(Actor* thisx, PlayState* play); +void ObjBlockstop_Destroy(Actor* thisx, PlayState* play); +void ObjBlockstop_Update(Actor* thisx, PlayState* play); const ActorInit Obj_Blockstop_InitVars = { ACTOR_OBJ_BLOCKSTOP, @@ -26,29 +26,29 @@ const ActorInit Obj_Blockstop_InitVars = { NULL, }; -void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Init(Actor* thisx, PlayState* play) { ObjBlockstop* this = (ObjBlockstop*)thisx; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { Actor_Kill(&this->actor); } else { this->actor.world.pos.y++; } } -void ObjBlockstop_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Destroy(Actor* thisx, PlayState* play) { } -void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Update(Actor* thisx, PlayState* play) { ObjBlockstop* this = (ObjBlockstop*)thisx; DynaPolyActor* dynaPolyActor; Vec3f sp4C; s32 bgId; s32 pad; - if (BgCheck_EntityLineTest2(&globalCtx->colCtx, &this->actor.home.pos, &this->actor.world.pos, &sp4C, + if (BgCheck_EntityLineTest2(&play->colCtx, &this->actor.home.pos, &this->actor.world.pos, &sp4C, &this->actor.floorPoly, false, false, true, true, &bgId, &this->actor)) { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI) { if ((dynaPolyActor->actor.params & 0x000F) == PUSHBLOCK_HUGE_START_ON || @@ -58,7 +58,7 @@ void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); } - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); Actor_Kill(&this->actor); } } diff --git a/soh/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/soh/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 0ea3eeaa4..b300b6853 100644 --- a/soh/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/soh/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -10,13 +10,13 @@ #define FLAGS 0 -void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_InitCollision(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBombiwa_Init(Actor* thisx, PlayState* play); +void ObjBombiwa_InitCollision(Actor* thisx, PlayState* play); +void ObjBombiwa_Destroy(Actor* thisx, PlayState* play); +void ObjBombiwa_Update(Actor* thisx, PlayState* play); +void ObjBombiwa_Draw(Actor* thisx, PlayState* play); -void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx); +void ObjBombiwa_Break(ObjBombiwa* this, PlayState* play); const ActorInit Obj_Bombiwa_InitVars = { ACTOR_OBJ_BOMBIWA, @@ -64,18 +64,18 @@ static s16 sEffectScales[] = { 17, 14, 10, 8, 7, 5, 3, 2, }; -void ObjBombiwa_InitCollision(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_InitCollision(Actor* thisx, PlayState* play) { ObjBombiwa* this = (ObjBombiwa*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); - ObjBombiwa_InitCollision(thisx, globalCtx); - if ((Flags_GetSwitch(globalCtx, thisx->params & 0x3F) != 0)) { + ObjBombiwa_InitCollision(thisx, play); + if ((Flags_GetSwitch(play, thisx->params & 0x3F) != 0)) { Actor_Kill(thisx); } else { CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); @@ -90,14 +90,14 @@ void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjBombiwa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjBombiwa* this = (ObjBombiwa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { +void ObjBombiwa_Break(ObjBombiwa* this, PlayState* play) { Vec3f pos; Vec3f velocity; Gfx* dlist; @@ -115,21 +115,21 @@ void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { velocity.z = (Rand_ZeroOne() - 0.5f) * 15.0f; scale = sEffectScales[i]; arg5 = (scale >= 11) ? 37 : 33; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -400, arg5, 10, 2, 0, scale, 1, 0, 80, KAKERA_COLOR_NONE, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -400, arg5, 10, 2, 0, scale, 1, 0, 80, KAKERA_COLOR_NONE, OBJECT_BOMBIWA, dlist); } - func_80033480(globalCtx, &this->actor.world.pos, 60.0f, 8, 100, 160, 1); + func_80033480(play, &this->actor.world.pos, 60.0f, 8, 100, 160, 1); } -void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_Update(Actor* thisx, PlayState* play) { ObjBombiwa* this = (ObjBombiwa*)thisx; s32 pad; - if ((func_80033684(globalCtx, &this->actor) != NULL) || + if ((func_80033684(play, &this->actor) != NULL) || ((this->collider.base.acFlags & AC_HIT) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x40000040))) { - ObjBombiwa_Break(this, globalCtx); - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); + ObjBombiwa_Break(this, play); + Flags_SetSwitch(play, this->actor.params & 0x3F); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); if (((this->actor.params >> 0xF) & 1) != 0) { func_80078884(NA_SE_SY_CORRECT_CHIME); } @@ -137,12 +137,12 @@ void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.xzDistToPlayer < 800.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -void ObjBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_bombiwa_DL_0009E0); +void ObjBombiwa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_bombiwa_DL_0009E0); } diff --git a/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index f88abf58b..cdbec8db2 100644 --- a/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -10,15 +10,15 @@ #define FLAGS 0 -void ObjComb_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjComb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjComb_Init(Actor* thisx, PlayState* play); +void ObjComb_Destroy(Actor* thisx, PlayState* play); +void ObjComb_Update(Actor* thisx, PlayState* play); +void ObjComb_Draw(Actor* thisx, PlayState* play); -void ObjComb_Break(ObjComb* this, GlobalContext* globalCtx); -void ObjComb_ChooseItemDrop(ObjComb* this, GlobalContext* globalCtx); +void ObjComb_Break(ObjComb* this, PlayState* play); +void ObjComb_ChooseItemDrop(ObjComb* this, PlayState* play); void ObjComb_SetupWait(ObjComb* this); -void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx); +void ObjComb_Wait(ObjComb* this, PlayState* play); const ActorInit Obj_Comb_InitVars = { ACTOR_OBJ_COMB, @@ -67,7 +67,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 900, ICHAIN_STOP), }; -void ObjComb_Break(ObjComb* this, GlobalContext* globalCtx) { +void ObjComb_Break(ObjComb* this, PlayState* play) { Vec3f pos1; Vec3f pos; Vec3f velocity; @@ -118,22 +118,22 @@ void ObjComb_Break(ObjComb* this, GlobalContext* globalCtx) { arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, gravity, arg5, arg6, 4, 0, scale, 0, 0, 80, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, gravity, arg5, arg6, 4, 0, scale, 0, 0, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, dlist); } pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y - 10.0f; pos.z = this->actor.world.pos.z; - func_80033480(globalCtx, &pos, 40.0f, 6, 70, 60, 1); + func_80033480(play, &pos, 40.0f, 6, 70, 60, 1); } -void ObjComb_ChooseItemDrop(ObjComb* this, GlobalContext* globalCtx) { +void ObjComb_ChooseItemDrop(ObjComb* this, PlayState* play) { s16 params = this->actor.params & 0x1F; if ((params > 0) || (params < 0x1A)) { if (params == 6) { - if (Flags_GetCollectible(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetCollectible(play, (this->actor.params >> 8) & 0x3F)) { params = -1; } else { params = (params | (((this->actor.params >> 8) & 0x3F) << 8)); @@ -142,32 +142,32 @@ void ObjComb_ChooseItemDrop(ObjComb* this, GlobalContext* globalCtx) { params = -1; } if (params >= 0 && !CVar_GetS32("gNoRandomDrops", 0)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, params); + Item_DropCollectible(play, &this->actor.world.pos, params); } } } -void ObjComb_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Init(Actor* thisx, PlayState* play) { ObjComb* this = (ObjComb*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); ObjComb_SetupWait(this); } -void ObjComb_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjComb_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjComb* this = (ObjComb*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void ObjComb_SetupWait(ObjComb* this) { this->actionFunc = ObjComb_Wait; } -void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx) { +void ObjComb_Wait(ObjComb* this, PlayState* play) { s32 dmgFlags; this->unk_1B0 -= 50; @@ -181,33 +181,33 @@ void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx) { if (dmgFlags & 0x4001F866) { this->unk_1B0 = 1500; } else { - ObjComb_Break(this, globalCtx); - ObjComb_ChooseItemDrop(this, globalCtx); + ObjComb_Break(this, play); + ObjComb_ChooseItemDrop(this, play); Actor_Kill(&this->actor); } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actor.update != NULL) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Update(Actor* thisx, PlayState* play) { ObjComb* this = (ObjComb*)thisx; this->unk_1B2 += 0x2EE0; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.x = Math_SinS(this->unk_1B2) * this->unk_1B0 + this->actor.home.rot.x; } -void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Draw(Actor* thisx, PlayState* play) { ObjComb* this = (ObjComb*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + (118.0f * this->actor.scale.y), this->actor.world.pos.z, MTXMODE_NEW); @@ -217,12 +217,12 @@ void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0, -(this->actor.scale.y * 118.0f), 0, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFieldBeehiveDL); Collider_UpdateSpheres(0, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h b/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h index bb690b0b6..3a6ce8641 100644 --- a/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -6,7 +6,7 @@ struct ObjComb; -typedef void (*ObjCombActionFunc)(struct ObjComb*, GlobalContext*); +typedef void (*ObjCombActionFunc)(struct ObjComb*, PlayState*); typedef struct ObjComb { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index f3d2edd86..2331fbbaf 100644 --- a/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDekujr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDekujr_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjDekujr_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjDekujr_Init(Actor* thisx, PlayState* play); +void ObjDekujr_Destroy(Actor* thisx, PlayState* play); +void ObjDekujr_Update(Actor* thisx, PlayState* play); +void ObjDekujr_Draw(Actor* thisx, PlayState* play); -void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx); +void ObjDekujr_ComeUp(ObjDekujr* this, PlayState* play); const ActorInit Obj_Dekujr_InitVars = { ACTOR_OBJ_DEKUJR, @@ -41,7 +41,7 @@ static ColliderCylinderInitToActor sCylinderInit = { { 60, 80, 0, { 0, 0, 0 } }, }; -void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Init(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; @@ -60,16 +60,16 @@ void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(thisx); } else { ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); sCylinderInit.base.actor = thisx; - Collider_SetCylinderToActor(globalCtx, &this->collider, &sCylinderInit); + Collider_SetCylinderToActor(play, &this->collider, &sCylinderInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; - thisx->textId = func_80037C30(globalCtx, 0xF); + thisx->textId = func_80037C30(play, 0xF); Actor_SetScale(thisx, 0.4f); } } -void ObjDekujr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Destroy(Actor* thisx, PlayState* play) { } void ObjDekujr_SetInitialPos(CsCmdActorAction* npcAction, Vec3f* initPos) { @@ -84,7 +84,7 @@ void ObjDekujr_SetFinalPos(CsCmdActorAction* npcAction, Vec3f* finalPos) { finalPos->z = npcAction->endPos.z; } -void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { +void ObjDekujr_ComeUp(ObjDekujr* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; Vec3f initPos; Vec3f finalPos; @@ -92,14 +92,14 @@ void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { f32 actionLength; f32 gravity; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { this->unk_19C = 2; this->unk_19B = 0; } else { - if (globalCtx->csCtx.frames == 351) { + if (play->csCtx.frames == 351) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_COME_UP_DEKU_JR); } - csCmdNPCAction = globalCtx->csCtx.npcActions[1]; + csCmdNPCAction = play->csCtx.npcActions[1]; if (csCmdNPCAction != NULL) { ObjDekujr_SetInitialPos(csCmdNPCAction, &initPos); ObjDekujr_SetFinalPos(csCmdNPCAction, &finalPos); @@ -111,7 +111,7 @@ void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = csCmdNPCAction->urot.y; this->actor.shape.rot.z = csCmdNPCAction->urot.z; this->actor.velocity = velocity; - if (csCmdNPCAction->endFrame >= globalCtx->csCtx.frames) { + if (csCmdNPCAction->endFrame >= play->csCtx.frames) { actionLength = csCmdNPCAction->endFrame - csCmdNPCAction->startFrame; this->actor.velocity.x = (finalPos.x - initPos.x) / actionLength; gravity = this->actor.gravity; @@ -126,46 +126,46 @@ void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { } } -void ObjDekujr_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Update(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if ((gSaveContext.cutsceneIndex >= 0xFFF0) && (this->unk_19B == 0)) { this->unk_19C = 0; this->unk_19B = 1; } if (this->unk_19B == 1) { - ObjDekujr_ComeUp(this, globalCtx); + ObjDekujr_ComeUp(this, play); this->actor.world.pos.x += this->actor.velocity.x; this->actor.world.pos.y += this->actor.velocity.y; this->actor.world.pos.z += this->actor.velocity.z; } else { - func_80037D98(globalCtx, &this->actor, 0xF, &this->unk_1A0); + func_80037D98(play, &this->actor, 0xF, &this->unk_1A0); Actor_SetFocus(&this->actor, 40.0f); } } -void ObjDekujr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Draw(Actor* thisx, PlayState* play) { u32 frameCount; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dekujr_DL_0030D0); - frameCount = globalCtx->state.frames; + frameCount = play->state.frames; gSPSegment( POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frameCount % 128, 0, 32, 32, 1, frameCount % 128, 0, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frameCount % 128, 0, 32, 32, 1, frameCount % 128, 0, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_dekujr_DL_0032D8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index f1b9da0d4..694644a80 100644 --- a/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void ObjElevator_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjElevator_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjElevator_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjElevator_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjElevator_Init(Actor* thisx, PlayState* play); +void ObjElevator_Destroy(Actor* thisx, PlayState* play); +void ObjElevator_Update(Actor* thisx, PlayState* play); +void ObjElevator_Draw(Actor* thisx, PlayState* play); void func_80B92C5C(ObjElevator* this); -void func_80B92C80(ObjElevator* this, GlobalContext* globalCtx); +void func_80B92C80(ObjElevator* this, PlayState* play); void func_80B92D20(ObjElevator* this); -void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx); +void func_80B92D44(ObjElevator* this, PlayState* play); const ActorInit Obj_Elevator_InitVars = { ACTOR_OBJ_ELEVATOR, @@ -44,7 +44,7 @@ void ObjElevator_SetupAction(ObjElevator* this, ObjElevatorActionFunc actionFunc this->actionFunc = actionFunc; } -void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void func_80B92B08(ObjElevator* this, PlayState* play, CollisionHeader* collision, s32 flag) { s16 pad1; CollisionHeader* colHeader = NULL; s16 pad2; @@ -52,18 +52,18 @@ void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, CollisionHeader* DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, thisx->id, thisx->params); } } -void ObjElevator_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjElevator_Init(Actor* thisx, PlayState* play) { ObjElevator* this = (ObjElevator*)thisx; f32 temp_f0; - func_80B92B08(this, globalCtx, &object_d_elevator_Col_000360, DPM_PLAYER); + func_80B92B08(this, play, &object_d_elevator_Col_000360, DPM_PLAYER); Actor_SetScale(thisx, sScales[thisx->params & 1]); Actor_ProcessInitChain(thisx, sInitChain); temp_f0 = (thisx->params >> 8) & 0xF; @@ -72,17 +72,17 @@ void ObjElevator_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(Dungeon Elevator)(arg_data 0x%04x)\n", thisx->params); } -void ObjElevator_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjElevator_Destroy(Actor* thisx, PlayState* play) { ObjElevator* this = (ObjElevator*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B92C5C(ObjElevator* this) { ObjElevator_SetupAction(this, func_80B92C80); } -void func_80B92C80(ObjElevator* this, GlobalContext* globalCtx) { +void func_80B92C80(ObjElevator* this, PlayState* play) { f32 sub; Actor* thisx = &this->dyna.actor; @@ -101,7 +101,7 @@ void func_80B92D20(ObjElevator* this) { ObjElevator_SetupAction(this, func_80B92D44); } -void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx) { +void func_80B92D44(ObjElevator* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (fabsf(Math_SmoothStepToF(&thisx->world.pos.y, this->unk_168, 1.0f, this->unk_16C, 0.0f)) < 0.001f) { @@ -112,15 +112,15 @@ void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx) { } } -void ObjElevator_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjElevator_Update(Actor* thisx, PlayState* play) { ObjElevator* this = (ObjElevator*)thisx; if (this->actionFunc) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } this->unk_170 = this->dyna.unk_160; } -void ObjElevator_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_d_elevator_DL_000180); +void ObjElevator_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_d_elevator_DL_000180); } diff --git a/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h b/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h index 735355f50..e77d04a9a 100644 --- a/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h +++ b/soh/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h @@ -6,7 +6,7 @@ struct ObjElevator; -typedef void (*ObjElevatorActionFunc)(struct ObjElevator*, GlobalContext*); +typedef void (*ObjElevatorActionFunc)(struct ObjElevator*, PlayState*); typedef struct ObjElevator { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/soh/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index ecd25c971..c0c38f4f1 100644 --- a/soh/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/soh/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHamishi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHamishi_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHamishi_Init(Actor* thisx, PlayState* play); +void ObjHamishi_Destroy(Actor* thisx, PlayState* play); +void ObjHamishi_Update(Actor* thisx, PlayState* play); +void ObjHamishi_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Hamishi_InitVars = { ACTOR_OBJ_HAMISHI, @@ -60,11 +60,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 500, ICHAIN_STOP), }; -void ObjHamishi_InitCollision(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_InitCollision(Actor* thisx, PlayState* play) { ObjHamishi* this = (ObjHamishi*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } @@ -91,7 +91,7 @@ void ObjHamishi_Shake(ObjHamishi* this) { } } -void ObjHamishi_Break(ObjHamishi* this, GlobalContext* globalCtx) { +void ObjHamishi_Break(ObjHamishi* this, PlayState* play) { s32 pad; Vec3f velocity; Vec3f pos; @@ -127,30 +127,30 @@ void ObjHamishi_Break(ObjHamishi* this, GlobalContext* globalCtx) { gravity = -320; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, sEffectScales[i], 3, 0, 70, 1, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL); } - func_80033480(globalCtx, &this->actor.world.pos, 140.0f, 6, 180, 90, 1); - func_80033480(globalCtx, &this->actor.world.pos, 140.0f, 12, 80, 90, 1); + func_80033480(play, &this->actor.world.pos, 140.0f, 6, 180, 90, 1); + func_80033480(play, &this->actor.world.pos, 140.0f, 12, 80, 90, 1); } -void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_Init(Actor* thisx, PlayState* play) { ObjHamishi* this = (ObjHamishi*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } if (this->actor.shape.rot.y == 0) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.home.rot.y = Rand_ZeroFloat(65536.0f); } - ObjHamishi_InitCollision(&this->actor, globalCtx); + ObjHamishi_InitCollision(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { Actor_Kill(&this->actor); return; } @@ -158,16 +158,16 @@ void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 80.0f; } -void ObjHamishi_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjHamishi_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjHamishi* this = (ObjHamishi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_Update(Actor* thisx, PlayState* play) { ObjHamishi* this = (ObjHamishi*)thisx; - CollisionCheckContext* colChkCtx = &globalCtx->colChkCtx; + CollisionCheckContext* colChkCtx = &play->colChkCtx; ObjHamishi_Shake(this); @@ -179,30 +179,30 @@ void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx) { this->shakePosSize = 2.0f; this->shakeRotSize = 400.0f; } else { - ObjHamishi_Break(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); + ObjHamishi_Break(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + Flags_SetSwitch(play, this->actor.params & 0x3F); Actor_Kill(&this->actor); } } else { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, colChkCtx, &this->collider.base); } } } -void ObjHamishi_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void ObjHamishi_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 170, 130, 255); gSPDisplayList(POLY_OPA_DISP++, gSilverRockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/soh/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index 5d6e6eb73..4a87c2628 100644 --- a/soh/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/soh/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHana_Init(Actor* thisx, PlayState* play); +void ObjHana_Destroy(Actor* thisx, PlayState* play); +void ObjHana_Update(Actor* thisx, PlayState* play); +void ObjHana_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Hana_InitVars = { ACTOR_OBJ_HANA, @@ -70,7 +70,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Init(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; s16 type = this->actor.params & 3; HanaParams* params = &sHanaParams[type]; @@ -79,8 +79,8 @@ void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, params->scale); this->actor.shape.yOffset = params->yOffset; if (params->radius >= 0) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = params->radius; this->collider.dim.height = params->height; @@ -92,22 +92,22 @@ void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Destroy(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; if (sHanaParams[this->actor.params & 3].radius >= 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Update(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; if (sHanaParams[this->actor.params & 3].radius >= 0 && this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sHanaParams[thisx->params & 3].dList); +void ObjHana_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sHanaParams[thisx->params & 3].dList); } diff --git a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index 6f899621f..5680ad826 100644 --- a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHsblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHsblock_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHsblock_Init(Actor* thisx, PlayState* play); +void ObjHsblock_Destroy(Actor* thisx, PlayState* play); +void ObjHsblock_Update(Actor* thisx, PlayState* play); +void ObjHsblock_Draw(Actor* thisx, PlayState* play); -void func_80B93DF4(ObjHsblock* this, GlobalContext* globalCtx); -void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx); +void func_80B93DF4(ObjHsblock* this, PlayState* play); +void func_80B93E5C(ObjHsblock* this, PlayState* play); void func_80B93D90(ObjHsblock* this); void func_80B93DB0(ObjHsblock* this); @@ -53,34 +53,34 @@ void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc) { this->actionFunc = actionFunc; } -void func_80B93B68(ObjHsblock* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlags) { +void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 moveFlags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2[2]; DynaPolyActor_Init(&this->dyna, moveFlags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, this->dyna.actor.id, this->dyna.actor.params); } } -void func_80B93BF0(ObjHsblock* this, GlobalContext* globalCtx) { +void func_80B93BF0(ObjHsblock* this, PlayState* play) { if ((this->dyna.actor.params >> 5) & 1) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_ICE_POLY, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ICE_POLY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 1); } } -void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Init(Actor* thisx, PlayState* play) { ObjHsblock* this = (ObjHsblock*)thisx; - func_80B93B68(this, globalCtx, sCollisionHeaders[thisx->params & 3], DPM_UNK); + func_80B93B68(this, play, sCollisionHeaders[thisx->params & 3], DPM_UNK); Actor_ProcessInitChain(thisx, sInitChain); - func_80B93BF0(this, globalCtx); + func_80B93BF0(this, play); switch (thisx->params & 3) { case 0: @@ -88,7 +88,7 @@ void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B93D90(this); break; case 1: - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { func_80B93D90(this); } else { func_80B93DB0(this); @@ -100,10 +100,10 @@ void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx) { mREG(15) = 255; } -void ObjHsblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Destroy(Actor* thisx, PlayState* play) { ObjHsblock* this = (ObjHsblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B93D90(ObjHsblock* this) { @@ -116,8 +116,8 @@ void func_80B93DB0(ObjHsblock* this) { ObjHsblock_SetupAction(this, func_80B93DF4); } -void func_80B93DF4(ObjHsblock* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { +void func_80B93DF4(ObjHsblock* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_80B93E38(this); } } @@ -126,7 +126,7 @@ void func_80B93E38(ObjHsblock* this) { ObjHsblock_SetupAction(this, func_80B93E5C); } -void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx) { +void func_80B93E5C(ObjHsblock* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.velocity.y, 16.0f, 0.1f, 0.8f, 0.0f); if (fabsf(Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.3f, this->dyna.actor.velocity.y, 0.3f)) < 0.001f) { @@ -136,27 +136,27 @@ void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx) { } } -void ObjHsblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Update(Actor* thisx, PlayState* play) { ObjHsblock* this = (ObjHsblock*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } Actor_SetFocus(thisx, D_80B940C0[thisx->params & 3]); } -void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Draw(Actor* thisx, PlayState* play) { Color_RGB8* color; Color_RGB8 defaultColor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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); - if (globalCtx->sceneNum == SCENE_HIDAN) { + if (play->sceneNum == SCENE_HIDAN) { color = &sFireTempleColor; } else { defaultColor.r = mREG(13); @@ -168,5 +168,5 @@ void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 255); gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params & 3]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h index ee43e0cad..6548ca9b9 100644 --- a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h +++ b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h @@ -6,7 +6,7 @@ struct ObjHsblock; -typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, GlobalContext*); +typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, PlayState*); typedef struct ObjHsblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index cf572d724..fb27cd29b 100644 --- a/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -9,13 +9,13 @@ #define FLAGS ACTOR_FLAG_4 -void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjIcePoly_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjIcePoly_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjIcePoly_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjIcePoly_Init(Actor* thisx, PlayState* play); +void ObjIcePoly_Destroy(Actor* thisx, PlayState* play); +void ObjIcePoly_Update(Actor* thisx, PlayState* play); +void ObjIcePoly_Draw(Actor* thisx, PlayState* play); -void ObjIcePoly_Idle(ObjIcePoly* this, GlobalContext* globalCtx); -void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx); +void ObjIcePoly_Idle(ObjIcePoly* this, PlayState* play); +void ObjIcePoly_Melt(ObjIcePoly* this, PlayState* play); const ActorInit Obj_Ice_Poly_InitVars = { ACTOR_OBJ_ICE_POLY, @@ -75,7 +75,7 @@ static s16 sOffsetY[] = { -25, 0, -20 }; static Color_RGBA8 sColorWhite = { 250, 250, 250, 255 }; static Color_RGBA8 sColorGray = { 180, 180, 180, 255 }; -void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Init(Actor* thisx, PlayState* play) { ObjIcePoly* this = (ObjIcePoly*)thisx; this->unk_151 = (thisx->params >> 8) & 0xFF; @@ -86,10 +86,10 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetScale(thisx, sScale[thisx->params]); thisx->world.pos.y = sOffsetY[thisx->params] + thisx->home.pos.y; - Collider_InitCylinder(globalCtx, &this->colliderIce); - Collider_SetCylinder(globalCtx, &this->colliderIce, thisx, &sCylinderInitIce); - Collider_InitCylinder(globalCtx, &this->colliderHard); - Collider_SetCylinder(globalCtx, &this->colliderHard, thisx, &sCylinderInitHard); + Collider_InitCylinder(play, &this->colliderIce); + Collider_SetCylinder(play, &this->colliderIce, thisx, &sCylinderInitIce); + Collider_InitCylinder(play, &this->colliderHard); + Collider_SetCylinder(play, &this->colliderHard, thisx, &sCylinderInitHard); Collider_UpdateCylinder(thisx, &this->colliderIce); Collider_UpdateCylinder(thisx, &this->colliderHard); thisx->colChkInfo.mass = MASS_IMMOVABLE; @@ -102,17 +102,17 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = ObjIcePoly_Idle; } -void ObjIcePoly_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjIcePoly* this = (ObjIcePoly*)thisx; if ((this->actor.params >= 0) && (this->actor.params < 3)) { - Collider_DestroyCylinder(globalCtx, &this->colliderIce); - Collider_DestroyCylinder(globalCtx, &this->colliderHard); + Collider_DestroyCylinder(play, &this->colliderIce); + Collider_DestroyCylinder(play, &this->colliderHard); } } -void ObjIcePoly_Idle(ObjIcePoly* this, GlobalContext* globalCtx) { +void ObjIcePoly_Idle(ObjIcePoly* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 pad; Vec3f pos; @@ -120,26 +120,26 @@ void ObjIcePoly_Idle(ObjIcePoly* this, GlobalContext* globalCtx) { if (this->colliderIce.base.acFlags & AC_HIT) { this->meltTimer = -this->colliderIce.info.acHitInfo->toucher.damage; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; - OnePointCutscene_Init(globalCtx, 5120, 40, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 5120, 40, &this->actor, MAIN_CAM); this->actionFunc = ObjIcePoly_Melt; } else if (this->actor.parent != NULL) { this->actor.parent->freezeTimer = 40; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderHard.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderIce.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderIce.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderIce.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderHard.base); } else { Actor_Kill(&this->actor); } pos.x = this->actor.world.pos.x + this->actor.scale.x * (Rand_S16Offset(15, 15) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); pos.y = this->actor.world.pos.y + this->actor.scale.y * Rand_S16Offset(10, 90); pos.z = this->actor.world.pos.z + this->actor.scale.z * (Rand_S16Offset(15, 15) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); - if ((globalCtx->gameplayFrames % 7) == 0) { - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &zeroVec, &zeroVec, &sColorWhite, &sColorGray, 2000, 5); + if ((play->gameplayFrames % 7) == 0) { + EffectSsKiraKira_SpawnDispersed(play, &pos, &zeroVec, &zeroVec, &sColorWhite, &sColorGray, 2000, 5); } } -void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx) { +void ObjIcePoly_Melt(ObjIcePoly* this, PlayState* play) { Vec3f accel; Vec3f vel; Vec3f pos; @@ -158,7 +158,7 @@ void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx) { pos.y = this->actor.world.pos.y + this->actor.scale.y * Rand_ZeroOne() * 50.0f; pos.z = this->actor.world.pos.z + this->actor.scale.x * (Rand_S16Offset(20, 20) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); - func_8002829C(globalCtx, &pos, &vel, &accel, &sColorWhite, &sColorGray, + func_8002829C(play, &pos, &vel, &accel, &sColorWhite, &sColorGray, Rand_S16Offset(0x15E, 0x64) * this->actor.scale.x, this->actor.scale.x * 20.0f); } if (this->meltTimer < 0) { @@ -182,29 +182,29 @@ void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx) { } } -void ObjIcePoly_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Update(Actor* thisx, PlayState* play) { s32 pad; ObjIcePoly* this = (ObjIcePoly*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjIcePoly_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjIcePoly* this = (ObjIcePoly*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); Matrix_RotateZYX(0x500, 0, -0x500, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 % 0x100, 0x20, 0x10, 1, 0, - (globalCtx->gameplayFrames * 2) % 0x100, 0x40, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 0x100, 0x20, 0x10, 1, 0, + (play->gameplayFrames * 2) % 0x100, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->alpha); gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h b/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h index cb1c3e5bf..8ebbe8d12 100644 --- a/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h +++ b/soh/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h @@ -6,7 +6,7 @@ struct ObjIcePoly; -typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, GlobalContext*); +typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, PlayState*); typedef struct ObjIcePoly { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 09a0f20ee..5a1595ed3 100644 --- a/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_26) -void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjKibako_Init(Actor* thisx, PlayState* play); +void ObjKibako_Destroy(Actor* thisx, PlayState* play); +void ObjKibako_Update(Actor* thisx, PlayState* play); +void ObjKibako_Draw(Actor* thisx, PlayState* play); void ObjKibako_SetupIdle(ObjKibako* this); -void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx); +void ObjKibako_Idle(ObjKibako* this, PlayState* play); void ObjKibako_SetupHeld(ObjKibako* this); -void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx); +void ObjKibako_Held(ObjKibako* this, PlayState* play); void ObjKibako_SetupThrown(ObjKibako* this); -void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx); +void ObjKibako_Thrown(ObjKibako* this, PlayState* play); const ActorInit Obj_Kibako_InitVars = { ACTOR_OBJ_KIBAKO, @@ -64,12 +64,12 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void ObjKibako_SpawnCollectible(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_SpawnCollectible(ObjKibako* this, PlayState* play) { s16 collectible; collectible = this->actor.params & 0x1F; if ((collectible >= 0) && (collectible <= 0x19)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, collectible | (((this->actor.params >> 8) & 0x3F) << 8)); } } @@ -81,36 +81,36 @@ void ObjKibako_ApplyGravity(ObjKibako* this) { } } -void ObjKibako_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_InitCollider(Actor* thisx, PlayState* play) { ObjKibako* this = (ObjKibako*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_Init(Actor* thisx, PlayState* play) { s32 pad; ObjKibako* this = (ObjKibako*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.gravity = -1.2f; this->actor.minVelocityY = -13.0f; - ObjKibako_InitCollider(&this->actor, globalCtx); + ObjKibako_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sCCInfoInit); ObjKibako_SetupIdle(this); // "wooden box" osSyncPrintf("(dungeon keep 木箱)(arg_data 0x%04x)\n", this->actor.params); } -void ObjKibako_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjKibako_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjKibako* this = (ObjKibako*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjKibako_AirBreak(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_AirBreak(ObjKibako* this, PlayState* play) { s16 angle; s32 i; Vec3f* breakPos = &this->actor.world.pos; @@ -140,14 +140,14 @@ void ObjKibako_AirBreak(ObjKibako* this, GlobalContext* globalCtx) { } else { phi_s0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, breakPos, -200, phi_s0, 10, 10, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, breakPos, -200, phi_s0, 10, 10, 0, (Rand_ZeroOne() * 30.0f) + 10.0f, 0, 32, 60, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gSmallWoodenBoxFragmentDL); } - func_80033480(globalCtx, &this->actor.world.pos, 40.0f, 3, 50, 140, 1); + func_80033480(play, &this->actor.world.pos, 40.0f, 3, 50, 140, 1); } -void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_WaterBreak(ObjKibako* this, PlayState* play) { s16 angle; s32 i; Vec3f* breakPos = &this->actor.world.pos; @@ -156,7 +156,7 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { pos = *breakPos; pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 500); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 500); for (i = 0, angle = 0; i < 12; i++, angle += 0x4E20) { f32 sn = Math_SinS(angle); @@ -175,7 +175,7 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { pos.z += breakPos->z; temp_rand = Rand_ZeroOne(); phi_s0 = (temp_rand < 0.2f) ? 0x40 : 0x20; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, breakPos, -180, phi_s0, 30, 30, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, breakPos, -180, phi_s0, 30, 30, 0, (Rand_ZeroOne() * 30.0f) + 10.0f, 0, 32, 70, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gSmallWoodenBoxFragmentDL); } @@ -186,36 +186,36 @@ void ObjKibako_SetupIdle(ObjKibako* this) { this->actor.colChkInfo.mass = MASS_HEAVY; } -void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_Idle(ObjKibako* this, PlayState* play) { s32 pad; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { ObjKibako_SetupHeld(this); } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 19.0f)) { - ObjKibako_WaterBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_WaterBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if (this->collider.base.acFlags & AC_HIT) { - ObjKibako_AirBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_AirBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 20.0f, 0.0f, 5); if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 28.0f)) { this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; } if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 180.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } @@ -226,9 +226,9 @@ void ObjKibako_SetupHeld(ObjKibako* this) { func_8002F7DC(&this->actor, NA_SE_PL_PULL_UP_WOODBOX); } -void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void ObjKibako_Held(ObjKibako* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.curRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX); ObjKibako_SetupIdle(this); @@ -238,7 +238,7 @@ void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { ObjKibako_ApplyGravity(this); func_8002D7EC(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 20.0f, 0.0f, 5); } } @@ -249,40 +249,40 @@ void ObjKibako_SetupThrown(ObjKibako* this) { this->actionFunc = ObjKibako_Thrown; } -void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_Thrown(ObjKibako* this, PlayState* play) { s32 pad; s32 pad2; if ((this->actor.bgCheckFlags & 0xB) || (this->collider.base.atFlags & AT_HIT)) { - ObjKibako_AirBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_AirBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if (this->actor.bgCheckFlags & 0x40) { - ObjKibako_WaterBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_WaterBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else { ObjKibako_ApplyGravity(this); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 20.0f, 0.0f, 5); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void ObjKibako_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_Update(Actor* thisx, PlayState* play) { s32 pad; ObjKibako* this = (ObjKibako*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjKibako_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjKibako* this = (ObjKibako*)thisx; - Gfx_DrawDListOpa(globalCtx, gSmallWoodenBoxDL); + Gfx_DrawDListOpa(play, gSmallWoodenBoxDL); } diff --git a/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h b/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h index 1e5d3d48b..9378a51ce 100644 --- a/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h +++ b/soh/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h @@ -6,7 +6,7 @@ struct ObjKibako; -typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, GlobalContext*); +typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, PlayState*); typedef struct ObjKibako { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 930550e58..866b8738e 100644 --- a/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -10,12 +10,12 @@ #define FLAGS 0 -void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Draw(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Idle(ObjKibako2* this, GlobalContext* globalCtx); -void ObjKibako2_Kill(ObjKibako2* this, GlobalContext* globalCtx); +void ObjKibako2_Init(Actor* thisx, PlayState* play); +void ObjKibako2_Destroy(Actor* thisx, PlayState* play); +void ObjKibako2_Update(Actor* thisx, PlayState* play); +void ObjKibako2_Draw(Actor* thisx, PlayState* play); +void ObjKibako2_Idle(ObjKibako2* this, PlayState* play); +void ObjKibako2_Kill(ObjKibako2* this, PlayState* play); const ActorInit Obj_Kibako2_InitVars = { ACTOR_OBJ_KIBAKO2, @@ -57,15 +57,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void ObjKibako2_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_InitCollider(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); } -void ObjKibako2_Break(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Break(ObjKibako2* this, PlayState* play) { s32 pad[2]; Vec3f* thisPos; Vec3f pos; @@ -98,24 +98,24 @@ void ObjKibako2_Break(ObjKibako2* this, GlobalContext* globalCtx) { } else { phi_s0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -200, phi_s0, 28, 2, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -200, phi_s0, 28, 2, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, 0, 0, 70, KAKERA_COLOR_NONE, OBJECT_KIBAKO2, gLargeCrateFragmentDL); } - func_80033480(globalCtx, thisPos, 90.0f, 6, 100, 160, 1); + func_80033480(play, thisPos, 90.0f, 6, 100, 160, 1); } -void ObjKibako2_SpawnCollectible(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_SpawnCollectible(ObjKibako2* this, PlayState* play) { s16 itemDropped; s16 collectibleFlagTemp; collectibleFlagTemp = this->collectibleFlag; itemDropped = this->dyna.actor.home.rot.x; if (itemDropped >= 0 && itemDropped < 0x1A) { - Item_DropCollectible(globalCtx, &this->dyna.actor.world.pos, itemDropped | (collectibleFlagTemp << 8)); + Item_DropCollectible(play, &this->dyna.actor.world.pos, itemDropped | (collectibleFlagTemp << 8)); } } -void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Init(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; s16 pad; CollisionHeader* colHeader = NULL; @@ -123,9 +123,9 @@ void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - ObjKibako2_InitCollider(thisx, globalCtx); + ObjKibako2_InitCollider(thisx, play); CollisionHeader_GetVirtual(&gLargeCrateCol, &colHeader); - bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->collectibleFlag = this->dyna.actor.home.rot.z & 0x3F; this->dyna.bgId = bgId; this->actionFunc = ObjKibako2_Idle; @@ -136,45 +136,45 @@ void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.home.rot.x); } -void ObjKibako2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Destroy(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjKibako2_Idle(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Idle(ObjKibako2* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) || (this->dyna.actor.home.rot.z != 0) || - func_80033684(globalCtx, &this->dyna.actor) != NULL) { - ObjKibako2_Break(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + func_80033684(play, &this->dyna.actor) != NULL) { + ObjKibako2_Break(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); this->dyna.actor.flags |= ACTOR_FLAG_4; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; this->actionFunc = ObjKibako2_Kill; } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void ObjKibako2_Kill(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Kill(ObjKibako2* this, PlayState* play) { s16 params = this->dyna.actor.params; if ((params & 0x8000) == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y, 0, params | 0x8000); } - ObjKibako2_SpawnCollectible(this, globalCtx); + ObjKibako2_SpawnCollectible(this, play); Actor_Kill(&this->dyna.actor); } -void ObjKibako2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Update(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjKibako2_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gLargeCrateDL); +void ObjKibako2_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gLargeCrateDL); } diff --git a/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h b/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h index 04b980a99..73f0e90b6 100644 --- a/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h +++ b/soh/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h @@ -6,7 +6,7 @@ struct ObjKibako2; -typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, GlobalContext*); +typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, PlayState*); typedef struct ObjKibako2 { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 0d43f4992..3e35406af 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -10,18 +10,18 @@ #define FLAGS ACTOR_FLAG_4 -void ObjLift_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjLift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjLift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjLift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjLift_Init(Actor* thisx, PlayState* play); +void ObjLift_Destroy(Actor* thisx, PlayState* play); +void ObjLift_Update(Actor* thisx, PlayState* play); +void ObjLift_Draw(Actor* thisx, PlayState* play); void func_80B9651C(ObjLift* this); void func_80B9664C(ObjLift* this); void func_80B967C0(ObjLift* this); -void func_80B96560(ObjLift* this, GlobalContext* globalCtx); -void func_80B96678(ObjLift* this, GlobalContext* globalCtx); -void func_80B96840(ObjLift* this, GlobalContext* globalCtx); +void func_80B96560(ObjLift* this, PlayState* play); +void func_80B96678(ObjLift* this, PlayState* play); +void func_80B96840(ObjLift* this, PlayState* play); const ActorInit Obj_Lift_InitVars = { ACTOR_OBJ_LIFT, @@ -61,14 +61,14 @@ void ObjLift_SetupAction(ObjLift* this, ObjLiftActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ObjLift_InitDynaPoly(ObjLift* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void ObjLift_InitDynaPoly(ObjLift* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, @@ -76,7 +76,7 @@ void ObjLift_InitDynaPoly(ObjLift* this, GlobalContext* globalCtx, CollisionHead } } -void func_80B96160(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96160(ObjLift* this, PlayState* play) { Vec3f pos; Vec3f velocity; Vec3f* temp_s3; @@ -92,24 +92,24 @@ void func_80B96160(ObjLift* this, GlobalContext* globalCtx) { velocity.x = sFragmentScales[i].x * this->dyna.actor.scale.x * 0.8f; velocity.y = Rand_ZeroOne() * 10.0f + 6.0f; velocity.z = sFragmentScales[i].z * this->dyna.actor.scale.z * 0.8f; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, temp_s3, -256, (Rand_ZeroOne() < 0.5f) ? 64 : 32, 15, 15, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, temp_s3, -256, (Rand_ZeroOne() < 0.5f) ? 64 : 32, 15, 15, 0, (Rand_ZeroOne() * 50.0f + 50.0f) * this->dyna.actor.scale.x, 0, 32, 50, KAKERA_COLOR_NONE, OBJECT_D_LIFT, gCollapsingPlatformDL); } if (((this->dyna.actor.params >> 1) & 1) == 0) { - func_80033480(globalCtx, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1); + func_80033480(play, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1); } else if (((this->dyna.actor.params >> 1) & 1) == 1) { - func_80033480(globalCtx, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1); + func_80033480(play, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1); } } -void ObjLift_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjLift_Init(Actor* thisx, PlayState* play) { ObjLift* this = (ObjLift*)thisx; - ObjLift_InitDynaPoly(this, globalCtx, &gCollapsingPlatformCol, DPM_PLAYER); + ObjLift_InitDynaPoly(this, play, &gCollapsingPlatformCol, DPM_PLAYER); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 2) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F)) { Actor_Kill(&this->dyna.actor); return; } @@ -123,10 +123,10 @@ void ObjLift_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(Dungeon Lift)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjLift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjLift_Destroy(Actor* thisx, PlayState* play) { ObjLift* this = (ObjLift*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B9651C(ObjLift* this) { @@ -134,7 +134,7 @@ void func_80B9651C(ObjLift* this) { ObjLift_SetupAction(this, func_80B96560); } -void func_80B96560(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96560(ObjLift* this, PlayState* play) { s32 pad; s32 quakeIndex; @@ -143,7 +143,7 @@ void func_80B96560(ObjLift* this, GlobalContext* globalCtx) { if (((this->dyna.actor.params >> 8) & 7) == 7) { func_80B967C0(this); } else { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 10000); Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); Quake_SetCountdown(quakeIndex, 20); @@ -160,7 +160,7 @@ void func_80B9664C(ObjLift* this) { ObjLift_SetupAction(this, func_80B96678); } -void func_80B96678(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96678(ObjLift* this, PlayState* play) { if (this->timer <= 0) { func_80B967C0(this); } else { @@ -177,7 +177,7 @@ void func_80B96678(ObjLift* this, GlobalContext* globalCtx) { } if ((this->timer & 3) == 3) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 16, NA_SE_EV_BLOCK_SHAKE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 16, NA_SE_EV_BLOCK_SHAKE); } } @@ -187,7 +187,7 @@ void func_80B967C0(ObjLift* this) { this->dyna.actor.shape.rot = this->dyna.actor.world.rot = this->dyna.actor.home.rot; } -void func_80B96840(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96840(ObjLift* this, PlayState* play) { s32 pad; s32 bgId; Vec3f sp2C; @@ -196,27 +196,27 @@ void func_80B96840(ObjLift* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp2C, &this->dyna.actor.prevPos); sp2C.y += sMaxFallDistances[(this->dyna.actor.params >> 1) & 1]; this->dyna.actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &sp2C); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &sp2C); if ((this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) >= (sMaxFallDistances[(this->dyna.actor.params >> 1) & 1] - 0.001f)) { - func_80B96160(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 2) & 0x3F); + func_80B96160(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK); + Flags_SetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F); Actor_Kill(&this->dyna.actor); } } -void ObjLift_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjLift_Update(Actor* thisx, PlayState* play) { ObjLift* this = (ObjLift*)thisx; if (this->timer > 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjLift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gCollapsingPlatformDL); +void ObjLift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gCollapsingPlatformDL); } diff --git a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h index 7b3f717ac..de25b3c1c 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h +++ b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h @@ -6,7 +6,7 @@ struct ObjLift; -typedef void (*ObjLiftActionFunc)(struct ObjLift*, GlobalContext*); +typedef void (*ObjLiftActionFunc)(struct ObjLift*, PlayState*); typedef struct ObjLift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index e7d08a915..1bc5e543d 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -17,23 +17,23 @@ typedef enum { /* 0x02 */ FACE_EYES_OPEN_SMILING } FaceTextureIndex; -void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjLightswitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjLightswitch_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjLightswitch_Init(Actor* thisx, PlayState* play); +void ObjLightswitch_Destroy(Actor* thisx, PlayState* play); +void ObjLightswitch_Update(Actor* thisx, PlayState* play); +void ObjLightswitch_Draw(Actor* thisx, PlayState* play); void ObjLightswitch_SetupOff(ObjLightswitch* this); -void ObjLightswitch_Off(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_Off(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupTurnOn(ObjLightswitch* this); -void ObjLightswitch_TurnOn(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_TurnOn(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupOn(ObjLightswitch* this); -void ObjLightswitch_On(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_On(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupTurnOff(ObjLightswitch* this); -void ObjLightswitch_TurnOff(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_TurnOff(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupDisappearDelay(ObjLightswitch* this); -void ObjLightswitch_DisappearDelay(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_DisappearDelay(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupDisappear(ObjLightswitch* this); -void ObjLightswitch_Disappear(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_Disappear(ObjLightswitch* this, PlayState* play); const ActorInit Obj_Lightswitch_InitVars = { ACTOR_OBJ_LIGHTSWITCH, @@ -119,18 +119,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_InitCollider(ObjLightswitch* this, PlayState* play) { s32 pad; // Initialize this with the sun switch, so it can't be affected by toggling while the actor is loaded sunLightArrowsEnabledOnSunSwitchLoad = CVar_GetS32("gSunlightArrows", 0) || (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SUNLIGHT_ARROWS)); - Collider_InitJntSph(globalCtx, &this->collider); + Collider_InitJntSph(play, &this->collider); // If "Sunlight Arrows" is enabled, set up the collider to allow Light Arrow hits if (sunLightArrowsEnabledOnSunSwitchLoad) { - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderLightArrowInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderLightArrowInit, this->colliderItems); } else { - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); } Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y), @@ -139,36 +139,36 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx) Collider_UpdateSpheres(0, &this->collider); } -void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, PlayState* play) { Actor* thisx = &this->actor; // required s32 type; - if (!Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { type = this->actor.params >> 4 & 3; - Flags_SetSwitch(globalCtx, this->actor.params >> 8 & 0x3F); + Flags_SetSwitch(play, this->actor.params >> 8 & 0x3F); if (type == OBJLIGHTSWITCH_TYPE_1) { - OnePointCutscene_AttentionSetSfx(globalCtx, thisx, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_TRE_BOX_APPEAR); } else if (type == OBJLIGHTSWITCH_TYPE_BURN) { - OnePointCutscene_AttentionSetSfx(globalCtx, thisx, NA_SE_SY_ERROR); + OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_ERROR); } else { - OnePointCutscene_AttentionSetSfx(globalCtx, thisx, NA_SE_SY_CORRECT_CHIME); + OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_CORRECT_CHIME); } } } -void ObjLightswitch_ClearSwitchFlag(ObjLightswitch* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { - Flags_UnsetSwitch(globalCtx, this->actor.params >> 8 & 0x3F); +void ObjLightswitch_ClearSwitchFlag(ObjLightswitch* this, PlayState* play) { + if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { + Flags_UnsetSwitch(play, this->actor.params >> 8 & 0x3F); if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_1) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->actor, NA_SE_SY_TRE_BOX_APPEAR); } } } -void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, PlayState* play) { Vec3f pos; f32 s = Math_SinS(this->actor.shape.rot.y); f32 c = Math_CosS(this->actor.shape.rot.y); @@ -194,14 +194,14 @@ void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, GlobalContext* g pos.x = this->actor.world.pos.x + ((z * s) + (x * c)); pos.y = this->actor.world.pos.y + y + 10.0f; pos.z = this->actor.world.pos.z + ((z * c) - (x * s)); - EffectSsDeadDb_Spawn(globalCtx, &pos, &D_80B97F74, &D_80B97F74, 100, 0, 255, 255, 160, 160, 255, 0, 0, 1, 9, + EffectSsDeadDb_Spawn(play, &pos, &D_80B97F74, &D_80B97F74, 100, 0, 255, 255, 160, 160, 255, 0, 0, 1, 9, true); } } -void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightswitch_Init(Actor* thisx, PlayState* play) { ObjLightswitch* this = (ObjLightswitch*)thisx; - s32 switchFlagSet = Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F); + s32 switchFlagSet = Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F); s32 removeSelf = false; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -225,7 +225,7 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.rot.x = this->actor.home.rot.x = this->actor.shape.rot.x; this->actor.world.rot.z = this->actor.home.rot.z = this->actor.shape.rot.z; this->actor.flags |= ACTOR_FLAG_5; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_OBJ_OSHIHIKI, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_OSHIHIKI, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, this->actor.home.rot.y, 0, (0xFF << 8) | PUSHBLOCK_SMALL_START_ON) == NULL) { osSyncPrintf(VT_COL(RED, WHITE)); @@ -236,7 +236,7 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { removeSelf = true; } } - ObjLightswitch_InitCollider(this, globalCtx); + ObjLightswitch_InitCollider(this, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (removeSelf) { Actor_Kill(&this->actor); @@ -245,8 +245,8 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(光スイッチ)(arg_data 0x%04x)\n", this->actor.params); } -void ObjLightswitch_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjLightswitch_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjLightswitch* this = (ObjLightswitch*)thisx; // Unset the switch flag on room exit to prevent the rock in the wall from @@ -260,7 +260,7 @@ void ObjLightswitch_Destroy(Actor* thisx, GlobalContext* globalCtx2) { case OBJLIGHTSWITCH_TYPE_1: // Except for this one, because we want the chain platform to stay down for good if (this->actor.room != 25) { - Flags_UnsetSwitch(globalCtx, this->actor.params >> 8 & 0x3F); + Flags_UnsetSwitch(play, this->actor.params >> 8 & 0x3F); } sunSwitchActivatedByLightArrow = false; break; @@ -269,7 +269,7 @@ void ObjLightswitch_Destroy(Actor* thisx, GlobalContext* globalCtx2) { } } - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void ObjLightswitch_SetupOff(ObjLightswitch* this) { @@ -284,13 +284,13 @@ void ObjLightswitch_SetupOff(ObjLightswitch* this) { } } // A Sun Switch that is currently turned off -void ObjLightswitch_Off(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_Off(ObjLightswitch* this, PlayState* play) { switch (this->actor.params >> 4 & 3) { case OBJLIGHTSWITCH_TYPE_STAY_ON: case OBJLIGHTSWITCH_TYPE_2: if (this->collider.base.acFlags & AC_HIT) { ObjLightswitch_SetupTurnOn(this); - ObjLightswitch_SetSwitchFlag(this, globalCtx); + ObjLightswitch_SetSwitchFlag(this, play); // Remember if we've been activated by a Light Arrow, so we can // prevent the switch from immediately turning back off if (sunLightArrowsEnabledOnSunSwitchLoad) { @@ -303,13 +303,13 @@ void ObjLightswitch_Off(ObjLightswitch* this, GlobalContext* globalCtx) { case OBJLIGHTSWITCH_TYPE_1: if ((this->collider.base.acFlags & AC_HIT) && !(this->prevFrameACflags & AC_HIT)) { ObjLightswitch_SetupTurnOn(this); - ObjLightswitch_SetSwitchFlag(this, globalCtx); + ObjLightswitch_SetSwitchFlag(this, play); } break; case OBJLIGHTSWITCH_TYPE_BURN: if (this->collider.base.acFlags & AC_HIT) { ObjLightswitch_SetupDisappearDelay(this); - ObjLightswitch_SetSwitchFlag(this, globalCtx); + ObjLightswitch_SetSwitchFlag(this, play); } break; } @@ -322,7 +322,7 @@ void ObjLightswitch_SetupTurnOn(ObjLightswitch* this) { this->faceTextureIndex = FACE_EYES_CLOSED; } -void ObjLightswitch_TurnOn(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_TurnOn(ObjLightswitch* this, PlayState* play) { if (func_8005B198() == this->actor.category || this->toggleDelay <= 0) { if (this->timer == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRIFORCE_FLASH); @@ -358,10 +358,10 @@ void ObjLightswitch_SetupOn(ObjLightswitch* this) { this->timer = 0; } // A Sun Switch that is currently turned on -void ObjLightswitch_On(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_On(ObjLightswitch* this, PlayState* play) { switch (this->actor.params >> 4 & 3) { case OBJLIGHTSWITCH_TYPE_STAY_ON: - if (!Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { ObjLightswitch_SetupTurnOff(this); } // If hit by sunlight after already being turned on, then behave as if originally activated by sunlight @@ -374,7 +374,7 @@ void ObjLightswitch_On(ObjLightswitch* this, GlobalContext* globalCtx) { case OBJLIGHTSWITCH_TYPE_1: if (this->collider.base.acFlags & AC_HIT && !(this->prevFrameACflags & AC_HIT)) { ObjLightswitch_SetupTurnOff(this); - ObjLightswitch_ClearSwitchFlag(this, globalCtx); + ObjLightswitch_ClearSwitchFlag(this, play); } break; case OBJLIGHTSWITCH_TYPE_2: @@ -389,7 +389,7 @@ void ObjLightswitch_On(ObjLightswitch* this, GlobalContext* globalCtx) { // If we aren't using Enhanced Light Arrows, let the switch turn off normally if (!sunSwitchActivatedByLightArrow) { ObjLightswitch_SetupTurnOff(this); - ObjLightswitch_ClearSwitchFlag(this, globalCtx); + ObjLightswitch_ClearSwitchFlag(this, play); } } else { this->timer++; @@ -409,7 +409,7 @@ void ObjLightswitch_SetupTurnOff(ObjLightswitch* this) { this->faceTextureIndex = FACE_EYES_OPEN; } -void ObjLightswitch_TurnOff(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_TurnOff(ObjLightswitch* this, PlayState* play) { if ((this->actor.params >> 4 & 3) != OBJLIGHTSWITCH_TYPE_1 || func_8005B198() == this->actor.category || this->toggleDelay <= 0) { this->timer--; @@ -434,7 +434,7 @@ void ObjLightswitch_SetupDisappearDelay(ObjLightswitch* this) { this->toggleDelay = 100; } -void ObjLightswitch_DisappearDelay(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_DisappearDelay(ObjLightswitch* this, PlayState* play) { if (func_8005B198() == this->actor.category || this->toggleDelay <= 0) { ObjLightswitch_SetupDisappear(this); } @@ -445,23 +445,23 @@ void ObjLightswitch_SetupDisappear(ObjLightswitch* this) { this->alpha = 255 << 6; } -void ObjLightswitch_Disappear(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_Disappear(ObjLightswitch* this, PlayState* play) { this->alpha -= 200; - ObjLightswitch_SpawnDisappearEffects(this, globalCtx); + ObjLightswitch_SpawnDisappearEffects(this, play); if (this->alpha < 0) { Actor_Kill(&this->actor); } } -void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx2) { +void ObjLightswitch_Update(Actor* thisx, PlayState* play2) { ObjLightswitch* this = (ObjLightswitch*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->toggleDelay > 0) { this->toggleDelay--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { if ((this->actor.params & 1) == 1) { @@ -473,18 +473,18 @@ void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx2) { this->prevFrameACflags = this->collider.base.acFlags; this->collider.base.acFlags &= ~AC_HIT; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_DrawOpa(ObjLightswitch* this, PlayState* play) { Actor* child; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, (u8)(this->color[0] >> 6), (u8)(this->color[1] >> 6), (u8)(this->color[2] >> 6), (u8)(this->alpha >> 6)); @@ -504,7 +504,7 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { pos.z = this->actor.world.pos.z; } - 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++, 0x08, SEGMENTED_TO_VIRTUAL(sFaceTextures[this->faceTextureIndex])); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000260); @@ -514,27 +514,27 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { rot.z = this->actor.shape.rot.z + this->flameRingRot; Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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); rot.z = this->actor.shape.rot.z - this->flameRingRot; Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 sp68; Vec3s sp60; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->color[0] >> 6), (u8)(this->color[1] >> 6), (u8)(this->color[2] >> 6), (u8)(this->alpha >> 6)); @@ -544,7 +544,7 @@ void ObjLightswitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { sp68.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); sp68.z = this->actor.world.pos.z; - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFaceTextures[this->faceTextureIndex])); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000260); @@ -555,21 +555,21 @@ void ObjLightswitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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); sp60.z = this->actor.shape.rot.z - this->flameRingRot; Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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 = (ObjLightswitch*)thisx; s32 alpha = this->alpha >> 6 & 0xFF; @@ -578,8 +578,8 @@ void ObjLightswitch_Draw(Actor* thisx, GlobalContext* globalCtx) { } if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_BURN && (alpha > 0 || alpha < 255)) { - ObjLightswitch_DrawXlu(this, globalCtx); + ObjLightswitch_DrawXlu(this, play); } else { - ObjLightswitch_DrawOpa(this, globalCtx); + ObjLightswitch_DrawOpa(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h b/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h index eace5a905..b8420f2d4 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -6,7 +6,7 @@ struct ObjLightswitch; -typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, GlobalContext*); +typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, PlayState*); typedef enum { /* 0 */ OBJLIGHTSWITCH_TYPE_STAY_ON, // doesn't turn off unless the switch flag is cleared some other way diff --git a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 033d07f2c..4409978d9 100644 --- a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -9,11 +9,11 @@ #define FLAGS ACTOR_FLAG_4 -void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMakekinsuta_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); +void ObjMakekinsuta_Update(Actor* thisx, PlayState* play); -void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx); -void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, GlobalContext* globalCtx); +void func_80B98320(ObjMakekinsuta* this, PlayState* play); +void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, PlayState* play); const ActorInit Obj_Makekinsuta_InitVars = { ACTOR_OBJ_MAKEKINSUTA, @@ -28,7 +28,7 @@ const ActorInit Obj_Makekinsuta_InitVars = { NULL, }; -void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { ObjMakekinsuta* this = (ObjMakekinsuta*)thisx; if ((this->actor.params & 0x6000) == 0x4000) { @@ -45,10 +45,10 @@ void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B98320; } -void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx) { +void func_80B98320(ObjMakekinsuta* this, PlayState* play) { if (this->unk_152 != 0) { - if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(globalCtx))) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, + if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(play))) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (this->actor.params | 0x8000)); this->actionFunc = ObjMakekinsuta_DoNothing; } else { @@ -59,11 +59,11 @@ void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx) { } } -void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, GlobalContext* globalCtx) { +void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, PlayState* play) { } -void ObjMakekinsuta_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { ObjMakekinsuta* this = (ObjMakekinsuta*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h index 3d7ebd086..72aec99c5 100644 --- a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h +++ b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h @@ -6,7 +6,7 @@ struct ObjMakekinsuta; -typedef void (*ObjMakekinsutaActionFunc)(struct ObjMakekinsuta*, GlobalContext*); +typedef void (*ObjMakekinsutaActionFunc)(struct ObjMakekinsuta*, PlayState*); typedef struct ObjMakekinsuta { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/soh/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index 1c8f851b2..80f79998d 100644 --- a/soh/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/soh/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -10,8 +10,8 @@ #define FLAGS ACTOR_FLAG_5 -void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play); +void ObjMakeoshihiki_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Makeoshihiki_InitVars = { ACTOR_OBJ_MAKEOSHIHIKI, ACTORCAT_PROP, FLAGS, @@ -46,16 +46,16 @@ static BlockConfig sBlocks[] = { static u32 sFlags[3][2] = { { 0, 0 }, { 1, 0 }, { 0, 1 } }; -static void (*sFlagSwitchFuncs[])(GlobalContext* globalCtx, s32 flag) = { Flags_UnsetSwitch, Flags_SetSwitch }; +static void (*sFlagSwitchFuncs[])(PlayState* play, s32 flag) = { Flags_UnsetSwitch, Flags_SetSwitch }; -void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play) { BlockConfig* block = &sBlocks[thisx->home.rot.z & 1]; s32 typeIdx; Vec3f* spawnPos; - if (!((thisx->params >> 6) & 1) && Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (!((thisx->params >> 6) & 1) && Flags_GetSwitch(play, thisx->params & 0x3F)) { typeIdx = 1; - } else if (!((thisx->params >> 0xE) & 1) && Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + } else if (!((thisx->params >> 0xE) & 1) && Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { typeIdx = 2; } else { typeIdx = 0; @@ -63,7 +63,7 @@ void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { spawnPos = &block->posVecs[typeIdx]; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_OSHIHIKI, spawnPos->x, spawnPos->y, + if (Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_OSHIHIKI, spawnPos->x, spawnPos->y, spawnPos->z, 0, block->rotY, 0, ((block->color << 6) & 0xC0) | (block->type & 0xF) | 0xFF00) == NULL) { // "Push-pull block failure" @@ -80,7 +80,7 @@ void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(%s)(arg_data %04xF)(angleZ %d)\n", __FILE__, thisx->params, thisx->home.rot.z); } -void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakeoshihiki_Draw(Actor* thisx, PlayState* play) { BlockConfig* block = &sBlocks[thisx->home.rot.z & 1]; s32 i; s32 sfxCond1; @@ -94,7 +94,7 @@ void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((thisx->params >> 6) & 1) { sfxCond1 = false; } else { - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (Flags_GetSwitch(play, thisx->params & 0x3F)) { cond = true; } else { cond = false; @@ -105,7 +105,7 @@ void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((thisx->params >> 0xE) & 1) { sfxCond2 = false; } else { - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { cond2 = true; } else { cond2 = false; @@ -118,8 +118,8 @@ void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - sFlagSwitchFuncs[sFlags[i][0]](globalCtx, thisx->params & 0x3F); - sFlagSwitchFuncs[sFlags[i][1]](globalCtx, (thisx->params >> 8) & 0x3F); + sFlagSwitchFuncs[sFlags[i][0]](play, thisx->params & 0x3F); + sFlagSwitchFuncs[sFlags[i][1]](play, (thisx->params >> 8) & 0x3F); if (block->unk_24[i] & 2) { ((ObjOshihiki*)thisx->child)->cantMove = true; diff --git a/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index efb3b5fd0..55761ca8c 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -8,13 +8,13 @@ #define FLAGS 0 -void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMure_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMure_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMure_Init(Actor* thisx, PlayState* play); +void ObjMure_Destroy(Actor* thisx, PlayState* play); +void ObjMure_Update(Actor* thisx, PlayState* play); -void ObjMure_InitialAction(ObjMure* this, GlobalContext* globalCtx); -void ObjMure_CulledState(ObjMure* this, GlobalContext* globalCtx); -void ObjMure_ActiveState(ObjMure* this, GlobalContext* globalCtx); +void ObjMure_InitialAction(ObjMure* this, PlayState* play); +void ObjMure_CulledState(ObjMure* this, PlayState* play); +void ObjMure_ActiveState(ObjMure* this, PlayState* play); s32 ObjMure_GetMaxChildSpawns(ObjMure* this); @@ -59,7 +59,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -s32 ObjMure_SetCullingImpl(Actor* thisx, GlobalContext* globalCtx) { +s32 ObjMure_SetCullingImpl(Actor* thisx, PlayState* play) { ObjMure* this = (ObjMure*)thisx; s32 result; @@ -79,14 +79,14 @@ s32 ObjMure_SetCullingImpl(Actor* thisx, GlobalContext* globalCtx) { return result; } -s32 ObjMure_SetCulling(Actor* thisx, GlobalContext* globalCtx) { - if (!ObjMure_SetCullingImpl(thisx, globalCtx)) { +s32 ObjMure_SetCulling(Actor* thisx, PlayState* play) { + if (!ObjMure_SetCullingImpl(thisx, play)) { return false; } return true; } -void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Init(Actor* thisx, PlayState* play) { ObjMure* this = (ObjMure*)thisx; this->chNum = (thisx->params >> 0xC) & 0x0F; @@ -102,7 +102,7 @@ void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("Error 群れな敵 (%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, thisx->params); Actor_Kill(&this->actor); return; - } else if (!ObjMure_SetCulling(thisx, globalCtx)) { + } else if (!ObjMure_SetCulling(thisx, play)) { Actor_Kill(&this->actor); return; } @@ -115,7 +115,7 @@ void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjMure_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Destroy(Actor* thisx, PlayState* play) { } s32 ObjMure_GetMaxChildSpawns(ObjMure* this) { @@ -132,7 +132,7 @@ void ObjMure_GetSpawnPos(Vec3f* outPos, Vec3f* inPos, s32 ptn, s32 idx) { *outPos = *inPos; } -void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { ActorContext* ac; s32 i; Vec3f pos; @@ -149,10 +149,10 @@ void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { case OBJMURE_CHILD_STATE_1: break; case OBJMURE_CHILD_STATE_2: - ac = &globalCtx->actorCtx; + ac = &play->actorCtx; ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, globalCtx, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, + Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { this->children[i]->flags |= ACTOR_FLAG_ENKUSA_CUT; @@ -162,10 +162,10 @@ void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { } break; default: - ac = &globalCtx->actorCtx; + ac = &play->actorCtx; ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, globalCtx, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, + Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { this->children[i]->room = this->actor.room; @@ -177,8 +177,8 @@ void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx) { - ActorContext* ac = (ActorContext*)globalCtx; // fake match +void ObjMure_SpawnActors1(ObjMure* this, PlayState* play) { + ActorContext* ac = (ActorContext*)play; // fake match Actor* actor = &this->actor; Vec3f spawnPos; s32 maxChildren = ObjMure_GetMaxChildSpawns(this); @@ -188,9 +188,9 @@ void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx) { if (this->children[i] != NULL) { osSyncPrintf("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, actor->params); } - ac = &globalCtx->actorCtx; + ac = &play->actorCtx; ObjMure_GetSpawnPos(&spawnPos, &actor->world.pos, this->ptn, i); - this->children[i] = Actor_Spawn(ac, globalCtx, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, + this->children[i] = Actor_Spawn(ac, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, (this->type == 4 && i == 0) ? 1 : sSpawnParams[this->type]); if (this->children[i] != NULL) { @@ -203,18 +203,18 @@ void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_SpawnActors(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_SpawnActors(ObjMure* this, PlayState* play) { switch (this->svNum) { case 0: - ObjMure_SpawnActors0(this, globalCtx); + ObjMure_SpawnActors0(this, play); break; case 1: - ObjMure_SpawnActors1(this, globalCtx); + ObjMure_SpawnActors1(this, play); break; } } -void ObjMure_KillActorsImpl(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_KillActorsImpl(ObjMure* this, PlayState* play) { s32 maxChildren = ObjMure_GetMaxChildSpawns(this); s32 i; @@ -231,7 +231,7 @@ void ObjMure_KillActorsImpl(ObjMure* this, GlobalContext* globalCtx) { break; default: if (this->children[i] != NULL) { - if (Actor_HasParent(this->children[i], globalCtx)) { + if (Actor_HasParent(this->children[i], play)) { this->children[i] = NULL; } else { Actor_Kill(this->children[i]); @@ -243,11 +243,11 @@ void ObjMure_KillActorsImpl(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_KillActors(ObjMure* this, GlobalContext* globalCtx) { - ObjMure_KillActorsImpl(this, globalCtx); +void ObjMure_KillActors(ObjMure* this, PlayState* play) { + ObjMure_KillActorsImpl(this, play); } -void ObjMure_CheckChildren(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_CheckChildren(ObjMure* this, PlayState* play) { s32 maxChildren = ObjMure_GetMaxChildSpawns(this); s32 i; @@ -270,15 +270,15 @@ void ObjMure_CheckChildren(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_InitialAction(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_InitialAction(ObjMure* this, PlayState* play) { this->actionFunc = ObjMure_CulledState; } -void ObjMure_CulledState(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_CulledState(ObjMure* this, PlayState* play) { if (fabsf(this->actor.projectedPos.z) < sZClip[this->type] || CVar_GetS32("gDisableDrawDistance", 0) != 0) { this->actionFunc = ObjMure_ActiveState; this->actor.flags |= ACTOR_FLAG_4; - ObjMure_SpawnActors(this, globalCtx); + ObjMure_SpawnActors(this, play); } } @@ -328,7 +328,7 @@ void ObjMure_SetChildToFollowPlayer(ObjMure* this, s32 idx1) { } // Fish, Bugs -void ObjMure_GroupBehavior0(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_GroupBehavior0(ObjMure* this, PlayState* play) { if (this->unk_1A4 <= 0) { if (this->unk_1A6) { this->unk_1A6 = false; @@ -362,7 +362,7 @@ void ObjMure_GroupBehavior0(ObjMure* this, GlobalContext* globalCtx) { } // Butterflies -void ObjMure_GroupBehavior1(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_GroupBehavior1(ObjMure* this, PlayState* play) { s32 maxChildren; s32 i; @@ -396,23 +396,23 @@ 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) && CVar_GetS32("gDisableDrawDistance", 1) != 0) { this->actionFunc = ObjMure_CulledState; this->actor.flags &= ~ACTOR_FLAG_4; - ObjMure_KillActors(this, globalCtx); + ObjMure_KillActors(this, play); } else if (sTypeGroupBehaviorFunc[this->type] != NULL) { - sTypeGroupBehaviorFunc[this->type](this, globalCtx); + sTypeGroupBehaviorFunc[this->type](this, play); } } -void ObjMure_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Update(Actor* thisx, PlayState* play) { ObjMure* this = (ObjMure*)thisx; if (this->unk_1A4 > 0) { this->unk_1A4--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h b/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h index e7c83d94b..386c6ed0d 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h +++ b/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h @@ -6,7 +6,7 @@ struct ObjMure; -typedef void (*ObjMureActionFunc)(struct ObjMure*, GlobalContext*); +typedef void (*ObjMureActionFunc)(struct ObjMure*, PlayState*); #define OBJMURE_MAX_SPAWNS 15 diff --git a/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c b/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c index 1f04bcea3..81c58138a 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -15,15 +15,15 @@ typedef struct { s16 angle; } Mure2sScatteredShrubInfo; -void ObjMure2_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMure2_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMure2_Init(Actor* thisx, PlayState* play); +void ObjMure2_Update(Actor* thisx, PlayState* play); void ObjMure2_SetPosShrubCircle(Vec3f* vec, ObjMure2* this); void ObjMure2_SetPosShrubScattered(Vec3f* vec, ObjMure2* this); void ObjMure2_SetPosRockCircle(Vec3f* vec, ObjMure2* this); -void ObjMure2_Wait(ObjMure2* this, GlobalContext* globalCtx); -void func_80B9A668(ObjMure2* this, GlobalContext* globalCtx); -void func_80B9A6F8(ObjMure2* this, GlobalContext* globalCtx); +void ObjMure2_Wait(ObjMure2* this, PlayState* play); +void func_80B9A668(ObjMure2* this, PlayState* play); +void func_80B9A6F8(ObjMure2* this, PlayState* play); void ObjMure2_SetupWait(ObjMure2* this); void func_80B9A658(ObjMure2* this); void func_80B9A6E8(ObjMure2* this); @@ -96,7 +96,7 @@ void ObjMure2_SetActorSpawnParams(s16* params, ObjMure2* this) { *params |= (dropTable << 8); } -void ObjMure2_SpawnActors(ObjMure2* this, GlobalContext* globalCtx) { +void ObjMure2_SpawnActors(ObjMure2* this, PlayState* play) { static ObjMure2SetPosFunc setPosFunc[] = { ObjMure2_SetPosShrubCircle, ObjMure2_SetPosShrubScattered, @@ -120,7 +120,7 @@ void ObjMure2_SpawnActors(ObjMure2* this, GlobalContext* globalCtx) { if (((this->currentActorNum >> i) & 1) == 0) { this->actorSpawnPtrList[i] = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, sActorSpawnIDs[actorNum], spawnPos[i].x, spawnPos[i].y, + Actor_Spawn(&play->actorCtx, play, sActorSpawnIDs[actorNum], spawnPos[i].x, spawnPos[i].y, spawnPos[i].z, this->actor.world.rot.x, 0, this->actor.world.rot.z, params); if (this->actorSpawnPtrList[i] != NULL) { this->actorSpawnPtrList[i]->room = this->actor.room; @@ -129,13 +129,13 @@ void ObjMure2_SpawnActors(ObjMure2* this, GlobalContext* globalCtx) { } } -void ObjMure2_CleanupAndDie(ObjMure2* this, GlobalContext* globalCtx) { +void ObjMure2_CleanupAndDie(ObjMure2* this, PlayState* play) { s32 i; for (i = 0; i < D_80B9A818[this->actor.params & 3]; i++) { if (((this->currentActorNum >> i) & 1) == 0) { if (this->actorSpawnPtrList[i] != NULL) { - if (Actor_HasParent(this->actorSpawnPtrList[i], globalCtx)) { + if (Actor_HasParent(this->actorSpawnPtrList[i], play)) { this->currentActorNum |= (1 << i); } else { Actor_Kill(this->actorSpawnPtrList[i]); @@ -166,11 +166,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -void ObjMure2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure2_Init(Actor* thisx, PlayState* play) { ObjMure2* this = (ObjMure2*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1200.0f; } ObjMure2_SetupWait(this); @@ -180,7 +180,7 @@ void ObjMure2_SetupWait(ObjMure2* this) { this->actionFunc = ObjMure2_Wait; } -void ObjMure2_Wait(ObjMure2* this, GlobalContext* globalCtx) { +void ObjMure2_Wait(ObjMure2* this, PlayState* play) { func_80B9A658(this); } @@ -188,12 +188,12 @@ void func_80B9A658(ObjMure2* this) { this->actionFunc = func_80B9A668; } -void func_80B9A668(ObjMure2* this, GlobalContext* globalCtx) { +void func_80B9A668(ObjMure2* this, PlayState* play) { if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < (sDistSquared1[this->actor.params & 3] * this->unk_184) || CVar_GetS32("gDisableDrawDistance", 0) != 0) { this->actor.flags |= ACTOR_FLAG_4; - ObjMure2_SpawnActors(this, globalCtx); + ObjMure2_SpawnActors(this, play); func_80B9A6E8(this); } } @@ -202,7 +202,7 @@ void func_80B9A6E8(ObjMure2* this) { this->actionFunc = func_80B9A6F8; } -void func_80B9A6F8(ObjMure2* this, GlobalContext* globalCtx) { +void func_80B9A6F8(ObjMure2* this, PlayState* play) { func_80B9A534(this); if (CVar_GetS32("gDisableDrawDistance", 0) != 0) { @@ -212,18 +212,18 @@ void func_80B9A6F8(ObjMure2* this, GlobalContext* globalCtx) { if ((sDistSquared2[this->actor.params & 3] * this->unk_184) <= Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z)) { this->actor.flags &= ~ACTOR_FLAG_4; - ObjMure2_CleanupAndDie(this, globalCtx); + ObjMure2_CleanupAndDie(this, play); func_80B9A658(this); } } -void ObjMure2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure2_Update(Actor* thisx, PlayState* play) { ObjMure2* this = (ObjMure2*)thisx; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { this->unk_184 = 1.0f; } else { this->unk_184 = 4.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h b/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h index c89e0139f..a197e9f7b 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h +++ b/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h @@ -6,7 +6,7 @@ struct ObjMure2; -typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, GlobalContext*); +typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, PlayState*); typedef struct ObjMure2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index d99e72563..1c8038bd9 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -8,16 +8,16 @@ #define FLAGS 0 -void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMure3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMure3_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMure3_Init(Actor* thisx, PlayState* play); +void ObjMure3_Destroy(Actor* thisx, PlayState* play); +void ObjMure3_Update(Actor* thisx, PlayState* play); void func_80B9AF24(ObjMure3* this); -void func_80B9AF34(ObjMure3* this, GlobalContext* globalCtx); +void func_80B9AF34(ObjMure3* this, PlayState* play); void func_80B9AF54(ObjMure3* this); -void func_80B9AF64(ObjMure3* this, GlobalContext* globalCtx); +void func_80B9AF64(ObjMure3* this, PlayState* play); void func_80B9AFEC(ObjMure3* this); -void func_80B9AFFC(ObjMure3* this, GlobalContext* globalCtx); +void func_80B9AFFC(ObjMure3* this, PlayState* play); const ActorInit Obj_Mure3_InitVars = { ACTOR_OBJ_MURE3, @@ -40,14 +40,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -void func_80B9A9D0(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9A9D0(ObjMure3* this, PlayState* play) { s32 i; Vec3f spawnPos; Math_Vec3f_Copy(&spawnPos, &this->actor.world.pos); for (i = 0; i < 5; i++, spawnPos.y += 20.0f) { if (!((this->unk_16C >> i) & 1)) { - this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_BLUE); + this->unk_150[i] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_BLUE); if (this->unk_150[i] != NULL) { this->unk_150[i]->actor.room = this->actor.room; } @@ -55,7 +55,7 @@ void func_80B9A9D0(ObjMure3* this, GlobalContext* globalCtx) { } } -void func_80B9AA90(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9AA90(ObjMure3* this, PlayState* play) { s32 i; Vec3f spawnPos; f32 sn = Math_SinS(this->actor.world.rot.y); @@ -68,7 +68,7 @@ void func_80B9AA90(ObjMure3* this, GlobalContext* globalCtx) { if (!((this->unk_16C >> i) & 1)) { spawnPos.x = this->actor.world.pos.x + (sn * radius); spawnPos.z = this->actor.world.pos.z + (cos * radius); - this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); + this->unk_150[i] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); if (this->unk_150[i] != NULL) { this->unk_150[i]->actor.room = this->actor.room; } @@ -76,7 +76,7 @@ void func_80B9AA90(ObjMure3* this, GlobalContext* globalCtx) { } } -void func_80B9ABA0(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9ABA0(ObjMure3* this, PlayState* play) { s32 i; Vec3f spawnPos; s16 yRot; @@ -87,7 +87,7 @@ void func_80B9ABA0(ObjMure3* this, GlobalContext* globalCtx) { if (!((this->unk_16C >> i) & 1)) { spawnPos.x = (Math_SinS(yRot) * 40.0f) + this->actor.world.pos.x; spawnPos.z = (Math_CosS(yRot) * 40.0f) + this->actor.world.pos.z; - this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); + this->unk_150[i] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); if (this->unk_150[i] != NULL) { this->unk_150[i]->actor.room = this->actor.room; } @@ -97,14 +97,14 @@ void func_80B9ABA0(ObjMure3* this, GlobalContext* globalCtx) { if (!((this->unk_16C >> 6) & 1)) { spawnPos.x = this->actor.world.pos.x; spawnPos.z = this->actor.world.pos.z; - this->unk_150[6] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_RED); + this->unk_150[6] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_RED); if (this->unk_150[6] != NULL) { this->unk_150[6]->actor.room = this->actor.room; } } } -void func_80B9ACE4(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9ACE4(ObjMure3* this, PlayState* play) { s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; s32 i; @@ -112,7 +112,7 @@ void func_80B9ACE4(ObjMure3* this, GlobalContext* globalCtx) { EnItem00** collectible = &this->unk_150[i]; if (!((this->unk_16C >> i) & 1) && (*collectible != NULL)) { - if (Actor_HasParent(&(*collectible)->actor, globalCtx) || ((*collectible)->actor.update == NULL)) { + if (Actor_HasParent(&(*collectible)->actor, play) || ((*collectible)->actor.update == NULL)) { this->unk_16C |= (1 << i); } else { Actor_Kill(&(*collectible)->actor); @@ -122,7 +122,7 @@ void func_80B9ACE4(ObjMure3* this, GlobalContext* globalCtx) { } } -void func_80B9ADCC(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9ADCC(ObjMure3* this, PlayState* play) { s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; s32 i; @@ -130,8 +130,8 @@ void func_80B9ADCC(ObjMure3* this, GlobalContext* globalCtx) { EnItem00** collectible = &this->unk_150[i]; if ((*collectible != NULL) && !((this->unk_16C >> i) & 1)) { - if (Actor_HasParent(&(*collectible)->actor, globalCtx)) { - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); + if (Actor_HasParent(&(*collectible)->actor, play)) { + Flags_SetSwitch(play, this->actor.params & 0x3F); } if ((*collectible)->actor.update == NULL) { this->unk_16C |= (1 << i); @@ -141,11 +141,11 @@ void func_80B9ADCC(ObjMure3* this, GlobalContext* globalCtx) { } } -void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure3_Init(Actor* thisx, PlayState* play) { s32 pad; ObjMure3* this = (ObjMure3*)thisx; - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { Actor_Kill(&this->actor); return; } @@ -153,14 +153,14 @@ void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B9AF24(this); } -void ObjMure3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure3_Destroy(Actor* thisx, PlayState* play) { } void func_80B9AF24(ObjMure3* this) { this->actionFunc = func_80B9AF34; } -void func_80B9AF34(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9AF34(ObjMure3* this, PlayState* play) { func_80B9AF54(this); } @@ -168,12 +168,12 @@ void func_80B9AF54(ObjMure3* this) { this->actionFunc = func_80B9AF64; } -void func_80B9AF64(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9AF64(ObjMure3* this, PlayState* play) { static ObjMure3SpawnFunc spawnFuncs[] = { func_80B9A9D0, func_80B9AA90, func_80B9ABA0 }; if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < SQ(1150.0f)) { this->actor.flags |= ACTOR_FLAG_4; - spawnFuncs[(this->actor.params >> 13) & 7](this, globalCtx); + spawnFuncs[(this->actor.params >> 13) & 7](this, play); func_80B9AFEC(this); } } @@ -182,17 +182,17 @@ void func_80B9AFEC(ObjMure3* this) { this->actionFunc = func_80B9AFFC; } -void func_80B9AFFC(ObjMure3* this, GlobalContext* globalCtx) { - func_80B9ADCC(this, globalCtx); +void func_80B9AFFC(ObjMure3* this, PlayState* play) { + func_80B9ADCC(this, play); if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) >= SQ(1450.0f)) { this->actor.flags &= ~ACTOR_FLAG_4; - func_80B9ACE4(this, globalCtx); + func_80B9ACE4(this, play); func_80B9AF54(this); } } -void ObjMure3_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure3_Update(Actor* thisx, PlayState* play) { ObjMure3* this = (ObjMure3*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h b/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h index b4e71c1b9..415babc61 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/soh/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -6,8 +6,8 @@ struct ObjMure3; -typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, GlobalContext*); -typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, GlobalContext*); +typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, PlayState*); +typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, PlayState*); typedef struct ObjMure3 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index c7e637380..c8ea35321 100644 --- a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -10,19 +10,19 @@ #define FLAGS ACTOR_FLAG_4 -void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjOshihiki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjOshihiki_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjOshihiki_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjOshihiki_Init(Actor* thisx, PlayState* play); +void ObjOshihiki_Destroy(Actor* thisx, PlayState* play); +void ObjOshihiki_Update(Actor* thisx, PlayState* play); +void ObjOshihiki_Draw(Actor* thisx, PlayState* play); -void ObjOshihiki_SetupOnScene(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_OnScene(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_SetupOnActor(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_SetupPush(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_SetupFall(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx); +void ObjOshihiki_SetupOnScene(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_SetupPush(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_SetupFall(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play); const ActorInit Obj_Oshihiki_InitVars = { ACTOR_OBJ_OSHIHIKI, @@ -84,14 +84,14 @@ static Vec2f sFaceDirection[] = { { -1.0f, -1.0f }, }; -void ObjOshihiki_InitDynapoly(ObjOshihiki* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void ObjOshihiki_InitDynapoly(ObjOshihiki* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG registration failure" @@ -140,12 +140,12 @@ void ObjOshihiki_ResetFloors(ObjOshihiki* this) { } } -ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) { +ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, PlayState* play) { DynaPolyActor* dynaPolyActor; if ((this->floorBgIds[this->highestFloor] != BGCHECK_SCENE) && (fabsf(this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) < 0.001f)) { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI)) { return (ObjOshihiki*)dynaPolyActor; } @@ -174,7 +174,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) { @@ -184,13 +184,13 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, GlobalCont switch (dyna->actor.params & 0x33) { case 0x20: // Normal blue switch if ((dynaSwitchFlag == ((this->dyna.actor.params >> 8) & 0x3F)) && - Flags_GetSwitch(globalCtx, dynaSwitchFlag)) { + Flags_GetSwitch(play, dynaSwitchFlag)) { return 0; } break; case 0x30: // Inverse blue switch if ((dynaSwitchFlag == ((this->dyna.actor.params >> 8) & 0x3F)) && - !Flags_GetSwitch(globalCtx, dynaSwitchFlag)) { + !Flags_GetSwitch(play, dynaSwitchFlag)) { return 0; } break; @@ -199,7 +199,7 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, GlobalCont return 1; } -void ObjOshihiki_CheckType(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_CheckType(ObjOshihiki* this, PlayState* play) { switch (this->dyna.actor.params & 0xF) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: @@ -209,7 +209,7 @@ void ObjOshihiki_CheckType(ObjOshihiki* this, GlobalContext* globalCtx) { case PUSHBLOCK_MEDIUM_START_OFF: case PUSHBLOCK_LARGE_START_OFF: case PUSHBLOCK_HUGE_START_OFF: - ObjOshihiki_InitDynapoly(this, globalCtx, &gPushBlockCol, 1); + ObjOshihiki_InitDynapoly(this, play, &gPushBlockCol, 1); break; default: // "Error : type cannot be determined" @@ -219,11 +219,11 @@ void ObjOshihiki_CheckType(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetScale(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetScale(ObjOshihiki* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, sScales[this->dyna.actor.params & 0xF]); } -void ObjOshihiki_SetTexture(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetTexture(ObjOshihiki* this, PlayState* play) { switch (this->dyna.actor.params & 0xF) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: @@ -242,7 +242,7 @@ void ObjOshihiki_SetTexture(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play) { Color_RGB8* src; Color_RGB8* color = &this->color; s16 paramsColorIdx; @@ -251,7 +251,7 @@ void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { paramsColorIdx = (this->dyna.actor.params >> 6) & 3; for (i = 0; i < ARRAY_COUNT(sScenes); i++) { - if (sScenes[i] == globalCtx->sceneNum) { + if (sScenes[i] == play->sceneNum) { break; } } @@ -268,14 +268,14 @@ void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjOshihiki_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjOshihiki* this = (ObjOshihiki*)thisx; - ObjOshihiki_CheckType(this, globalCtx); + ObjOshihiki_CheckType(this, play); if ((((this->dyna.actor.params >> 8) & 0xFF) >= 0) && (((this->dyna.actor.params >> 8) & 0xFF) <= 0x3F)) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { switch (this->dyna.actor.params & 0xF) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: @@ -296,25 +296,25 @@ void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - ObjOshihiki_SetScale(this, globalCtx); - ObjOshihiki_SetTexture(this, globalCtx); + ObjOshihiki_SetScale(this, play); + ObjOshihiki_SetTexture(this, play); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - ObjOshihiki_SetColor(this, globalCtx); + ObjOshihiki_SetColor(this, play); ObjOshihiki_ResetFloors(this); - ObjOshihiki_SetupOnActor(this, globalCtx); + ObjOshihiki_SetupOnActor(this, play); // "(dungeon keep push-pull block)" osSyncPrintf("(dungeon keep 押し引きブロック)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjOshihiki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjOshihiki* this = (ObjOshihiki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjOshihiki_SetFloors(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetFloors(ObjOshihiki* this, PlayState* play) { s32 i; for (i = 0; i < 5; i++) { @@ -333,7 +333,7 @@ void ObjOshihiki_SetFloors(ObjOshihiki* this, GlobalContext* globalCtx) { floorPoly = &this->floorPolys[i]; floorBgId = &this->floorBgIds[i]; - this->floorHeights[i] = BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, floorPoly, floorBgId, &this->dyna.actor, + this->floorHeights[i] = BgCheck_EntityRaycastFloor6(&play->colCtx, floorPoly, floorBgId, &this->dyna.actor, &colCheckPoint, 0.0f); } } @@ -369,15 +369,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; @@ -387,7 +387,7 @@ s32 ObjOshihiki_CheckFloor(ObjOshihiki* this, GlobalContext* globalCtx) { return 0; } -s32 ObjOshihiki_CheckGround(ObjOshihiki* this, GlobalContext* globalCtx) { +s32 ObjOshihiki_CheckGround(ObjOshihiki* this, PlayState* play) { if (this->dyna.actor.world.pos.y <= BGCHECK_Y_MIN + 10.0f) { // "Warning : Push-pull block fell too much" osSyncPrintf("Warning : 押し引きブロック落ちすぎた(%s %d)(arg_data 0x%04x)\n", __FILE__, __LINE__, @@ -402,7 +402,7 @@ s32 ObjOshihiki_CheckGround(ObjOshihiki* this, GlobalContext* globalCtx) { return 0; } -s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, ObjOshihiki* this) { +s32 ObjOshihiki_CheckWall(PlayState* play, s16 angle, f32 direction, ObjOshihiki* this) { f32 maxDist = ((direction >= 0.0f) ? 1.0f : -1.0f) * (300.0f * this->dyna.actor.scale.x + 20.0f - 0.5f); f32 sn = Math_SinS(angle); f32 cs = Math_CosS(angle); @@ -426,7 +426,7 @@ s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, Ob faceVtxNext.x = faceVtx.x + maxDist * sn; faceVtxNext.y = faceVtx.y; faceVtxNext.z = faceVtx.z + maxDist * cs; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, true, false, + if (BgCheck_EntityLineTest3(&play->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, true, false, false, true, &bgId, &this->dyna.actor, 0.0f)) { return true; } @@ -434,12 +434,12 @@ s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, Ob return false; } -s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) { +s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, PlayState* play) { s32 pad; - ObjOshihiki* blockUnder = ObjOshihiki_GetBlockUnder(this, globalCtx); + ObjOshihiki* blockUnder = ObjOshihiki_GetBlockUnder(this, play); if ((blockUnder != NULL) && (blockUnder->stateFlags & PUSHBLOCK_SETUP_PUSH) && - !ObjOshihiki_CheckWall(globalCtx, blockUnder->dyna.unk_158, blockUnder->direction, this)) { + !ObjOshihiki_CheckWall(play, blockUnder->dyna.unk_158, blockUnder->direction, this)) { this->blockUnder = blockUnder; } @@ -458,23 +458,23 @@ s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) return false; } -void ObjOshihiki_SetupOnScene(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupOnScene(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_ON_SCENE; this->actionFunc = ObjOshihiki_OnScene; this->dyna.actor.gravity = 0.0f; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; } -void ObjOshihiki_OnScene(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->stateFlags |= PUSHBLOCK_ON_SCENE; if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { if (ObjOshihiki_StrongEnough(this) && - !ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { + !ObjOshihiki_CheckWall(play, this->dyna.unk_158, this->dyna.unk_150, this)) { this->direction = this->dyna.unk_150; - ObjOshihiki_SetupPush(this, globalCtx); + ObjOshihiki_SetupPush(this, play); } else { player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; @@ -485,37 +485,37 @@ void ObjOshihiki_OnScene(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetupOnActor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_ON_ACTOR; this->actionFunc = ObjOshihiki_OnActor; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; } -void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { s32 bgId; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); DynaPolyActor* dynaPolyActor; this->stateFlags |= PUSHBLOCK_ON_ACTOR; Actor_MoveForward(&this->dyna.actor); - if (ObjOshihiki_CheckFloor(this, globalCtx)) { + if (ObjOshihiki_CheckFloor(this, play)) { bgId = this->floorBgIds[this->highestFloor]; if (bgId == BGCHECK_SCENE) { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } else { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL) { func_800434A8(dynaPolyActor); func_80043538(dynaPolyActor); if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { - if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, globalCtx) && - !ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { + if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, play) && + !ObjOshihiki_CheckWall(play, this->dyna.unk_158, this->dyna.unk_150, this)) { this->direction = this->dyna.unk_150; - ObjOshihiki_SetupPush(this, globalCtx); + ObjOshihiki_SetupPush(this, play); } else { player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; @@ -525,36 +525,36 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; } } else { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } } } else { bgId = this->floorBgIds[this->highestFloor]; if (bgId == BGCHECK_SCENE) { - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } else { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if ((dynaPolyActor != NULL) && (dynaPolyActor->unk_15C & 1)) { func_800434A8(dynaPolyActor); func_80043538(dynaPolyActor); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } else { - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } } } } -void ObjOshihiki_SetupPush(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupPush(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_PUSH; this->actionFunc = ObjOshihiki_Push; this->dyna.actor.gravity = 0.0f; } -void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 pushDistSigned; s32 stopFlag; @@ -566,17 +566,17 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { thisx->world.pos.x = thisx->home.pos.x + (pushDistSigned * this->yawSin); thisx->world.pos.z = thisx->home.pos.z + (pushDistSigned * this->yawCos); - if (!ObjOshihiki_CheckFloor(this, globalCtx)) { + if (!ObjOshihiki_CheckFloor(this, play)) { thisx->home.pos.x = thisx->world.pos.x; thisx->home.pos.z = thisx->world.pos.z; player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; this->pushDist = 0.0f; this->pushSpeed = 0.0f; - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } else if (stopFlag) { - player = GET_PLAYER(globalCtx); - if (ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { + player = GET_PLAYER(play); + if (ObjOshihiki_CheckWall(play, this->dyna.unk_158, this->dyna.unk_150, this)) { Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); } @@ -588,24 +588,24 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { this->pushSpeed = 0.0f; this->timer = 10 - ((CVar_GetS32("gFasterBlockPush", 0) * 3) / 2); if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } else { - ObjOshihiki_SetupOnActor(this, globalCtx); + ObjOshihiki_SetupOnActor(this, play); } } Audio_PlayActorSound2(thisx, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void ObjOshihiki_SetupFall(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupFall(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_FALL; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; - ObjOshihiki_SetGround(this, globalCtx); + ObjOshihiki_SetGround(this, play); this->actionFunc = ObjOshihiki_Fall; } -void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->stateFlags |= PUSHBLOCK_FALL; if (fabsf(this->dyna.unk_150) > 0.001f) { @@ -613,21 +613,21 @@ void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x10; } Actor_MoveForward(&this->dyna.actor); - if (ObjOshihiki_CheckGround(this, globalCtx)) { + if (ObjOshihiki_CheckGround(this, play)) { if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } else { - ObjOshihiki_SetupOnActor(this, globalCtx); + ObjOshihiki_SetupOnActor(this, play); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Audio_PlayActorSound2(&this->dyna.actor, - SurfaceType_GetSfx(&globalCtx->colCtx, this->floorPolys[this->highestFloor], + SurfaceType_GetSfx(&play->colCtx, this->floorPolys[this->highestFloor], this->floorBgIds[this->highestFloor]) + SFX_FLAG); } } -void ObjOshihiki_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Update(Actor* thisx, PlayState* play) { s32 pad; ObjOshihiki* this = (ObjOshihiki*)thisx; @@ -646,26 +646,26 @@ void ObjOshihiki_Update(Actor* thisx, GlobalContext* globalCtx) { this->yawCos = Math_CosS(this->dyna.actor.world.rot.y); if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ObjOshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjOshihiki* this = (ObjOshihiki*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); - if (ObjOshihiki_MoveWithBlockUnder(this, globalCtx)) { + OPEN_DISPS(play->state.gfxCtx); + if (ObjOshihiki_MoveWithBlockUnder(this, play)) { Matrix_Translate(this->underDistX * 10.0f, 0.0f, this->underDistZ * 10.0f, MTXMODE_APPLY); } this->stateFlags &= ~PUSHBLOCK_MOVE_UNDER; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(this->texture)); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BMORI1: @@ -682,5 +682,5 @@ void ObjOshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { } gSPDisplayList(POLY_OPA_DISP++, gPushBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h index 33098f64b..ac4a135c4 100644 --- a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h +++ b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h @@ -27,7 +27,7 @@ typedef enum { #define PUSHBLOCK_SETUP_FALL (1 << 7) #define PUSHBLOCK_MOVE_UNDER (1 << 8) -typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, GlobalContext*); +typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, PlayState*); typedef struct ObjOshihiki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index decb553b7..f71b0589c 100644 --- a/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -8,12 +8,12 @@ #define FLAGS ACTOR_FLAG_4 -void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjRoomtimer_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjRoomtimer_Init(Actor* thisx, PlayState* play); +void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play); +void ObjRoomtimer_Update(Actor* thisx, PlayState* play); -void func_80B9D054(ObjRoomtimer* this, GlobalContext* globalCtx); -void func_80B9D0B0(ObjRoomtimer* this, GlobalContext* globalCtx); +void func_80B9D054(ObjRoomtimer* this, PlayState* play); +void func_80B9D0B0(ObjRoomtimer* this, PlayState* play); const ActorInit Obj_Roomtimer_InitVars = { ACTOR_OBJ_ROOMTIMER, @@ -28,7 +28,7 @@ const ActorInit Obj_Roomtimer_InitVars = { NULL, }; -void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Init(Actor* thisx, PlayState* play) { ObjRoomtimer* this = (ObjRoomtimer*)thisx; s16 params = this->actor.params; @@ -47,7 +47,7 @@ void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B9D054; } -void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play) { ObjRoomtimer* this = (ObjRoomtimer*)thisx; if ((this->actor.params != 0x3FF) && (gSaveContext.timer1Value > 0)) { @@ -55,35 +55,35 @@ void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B9D054(ObjRoomtimer* this, GlobalContext* globalCtx) { +void func_80B9D054(ObjRoomtimer* this, PlayState* play) { if (this->actor.params != 0x3FF) { func_80088B34(this->actor.params); } - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actionFunc = func_80B9D0B0; } -void func_80B9D0B0(ObjRoomtimer* this, GlobalContext* globalCtx) { - if (Flags_GetTempClear(globalCtx, this->actor.room)) { +void func_80B9D0B0(ObjRoomtimer* this, PlayState* play) { + if (Flags_GetTempClear(play, this->actor.room)) { if (this->actor.params != 0x3FF) { gSaveContext.timer1State = 10; } - Flags_SetClear(globalCtx, this->actor.room); - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetClear(play, this->actor.room); + Flags_SetSwitch(play, this->switchFlag); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->actor); } else { if ((this->actor.params != 0x3FF) && (gSaveContext.timer1Value == 0)) { Audio_PlaySoundGeneral(NA_SE_OC_ABYSS, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Gameplay_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); Actor_Kill(&this->actor); } } } -void ObjRoomtimer_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Update(Actor* thisx, PlayState* play) { ObjRoomtimer* this = (ObjRoomtimer*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h b/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h index 6c31a11b5..2f1b08d9c 100644 --- a/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h +++ b/soh/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/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 1220abee6..2e245286e 100644 --- a/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -15,39 +15,39 @@ // switch flag: (this->dyna.actor.params >> 8 & 0x3F) // frozen: this->dyna.actor.params >> 7 & 1 -void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSwitch_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSwitch_Init(Actor* thisx, PlayState* play); +void ObjSwitch_Destroy(Actor* thisx, PlayState* play); +void ObjSwitch_Update(Actor* thisx, PlayState* play); +void ObjSwitch_Draw(Actor* thisx, PlayState* play); void ObjSwitch_FloorUpInit(ObjSwitch* this); -void ObjSwitch_FloorUp(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play); void ObjSwitch_FloorPressInit(ObjSwitch* this); -void ObjSwitch_FloorPress(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorPress(ObjSwitch* this, PlayState* play); void ObjSwitch_FloorDownInit(ObjSwitch* this); -void ObjSwitch_FloorDown(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorDown(ObjSwitch* this, PlayState* play); void ObjSwitch_FloorReleaseInit(ObjSwitch* this); -void ObjSwitch_FloorRelease(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorRelease(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeFrozenInit(ObjSwitch* this); -void ObjSwitch_EyeInit(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeInit(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeOpenInit(ObjSwitch* this); -void ObjSwitch_EyeOpen(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeOpen(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeClosingInit(ObjSwitch* this); -void ObjSwitch_EyeClosing(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeClosing(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeClosedInit(ObjSwitch* this); -void ObjSwitch_EyeClosed(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeClosed(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeOpeningInit(ObjSwitch* this); -void ObjSwitch_EyeOpening(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeOpening(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalOffInit(ObjSwitch* this); -void ObjSwitch_CrystalOff(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalTurnOnInit(ObjSwitch* this); -void ObjSwitch_CrystalTurnOn(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalTurnOn(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalOnInit(ObjSwitch* this); -void ObjSwitch_CrystalOn(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalTurnOffInit(ObjSwitch* this); -void ObjSwitch_CrystalTurnOff(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalTurnOff(ObjSwitch* this, PlayState* play); const ActorInit Obj_Switch_InitVars = { ACTOR_OBJ_SWITCH, @@ -183,14 +183,14 @@ void ObjSwitch_RotateY(Vec3f* dest, Vec3f* src, s16 angle) { dest->z = src->z * c - src->x * s; } -void ObjSwitch_InitDynapoly(ObjSwitch* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void ObjSwitch_InitDynapoly(ObjSwitch* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG registration failure" @@ -199,11 +199,11 @@ void ObjSwitch_InitDynapoly(ObjSwitch* this, GlobalContext* globalCtx, Collision } } -void ObjSwitch_InitJntSphCollider(ObjSwitch* this, GlobalContext* globalCtx, ColliderJntSphInit* colliderJntSphInit) { +void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* colliderJntSphInit) { ColliderJntSph* colliderJntSph = &this->jntSph.col; - Collider_InitJntSph(globalCtx, colliderJntSph); - Collider_SetJntSph(globalCtx, colliderJntSph, &this->dyna.actor, colliderJntSphInit, this->jntSph.items); + Collider_InitJntSph(play, colliderJntSph); + Collider_SetJntSph(play, colliderJntSph, &this->dyna.actor, colliderJntSphInit, this->jntSph.items); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y, @@ -212,14 +212,14 @@ void ObjSwitch_InitJntSphCollider(ObjSwitch* this, GlobalContext* globalCtx, Col Collider_UpdateSpheres(0, colliderJntSph); } -void ObjSwitch_InitTrisCollider(ObjSwitch* this, GlobalContext* globalCtx, ColliderTrisInit* colliderTrisInit) { +void ObjSwitch_InitTrisCollider(ObjSwitch* this, PlayState* play, ColliderTrisInit* colliderTrisInit) { ColliderTris* colliderTris = &this->tris.col; s32 i; s32 j; Vec3f pos[3]; - Collider_InitTris(globalCtx, colliderTris); - Collider_SetTris(globalCtx, colliderTris, &this->dyna.actor, colliderTrisInit, this->tris.items); + Collider_InitTris(play, colliderTris); + Collider_SetTris(play, colliderTris, &this->dyna.actor, colliderTrisInit, this->tris.items); for (i = 0; i < 2; i++) { for (j = 0; j < 3; j++) { @@ -231,42 +231,42 @@ void ObjSwitch_InitTrisCollider(ObjSwitch* this, GlobalContext* globalCtx, Colli } } -Actor* ObjSwitch_SpawnIce(ObjSwitch* this, GlobalContext* globalCtx) { +Actor* ObjSwitch_SpawnIce(ObjSwitch* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - return Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_ICE_POLY, thisx->world.pos.x, + return Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_ICE_POLY, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z, (this->dyna.actor.params >> 8 & 0x3F) << 8); } -void ObjSwitch_SetOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_SetOn(ObjSwitch* this, PlayState* play) { s32 pad; s32 subType; - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { this->cooldownOn = false; } else { subType = (this->dyna.actor.params >> 4 & 7); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F)); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F)); if (subType == 0 || subType == 4) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); } else { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } this->cooldownOn = true; } } -void ObjSwitch_SetOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_SetOff(ObjSwitch* this, PlayState* play) { this->cooldownOn = false; - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F)); + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F)); if ((this->dyna.actor.params >> 4 & 7) == 1) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); this->cooldownOn = true; } } @@ -279,16 +279,16 @@ void ObjSwitch_UpdateTwoTexScrollXY(ObjSwitch* this) { this->y2TexScroll = (this->y2TexScroll - 1) & 0x7F; } -void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Init(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; s32 switchFlagSet; s32 type; - switchFlagSet = Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F)); + switchFlagSet = Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F)); type = (this->dyna.actor.params & 7); if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_RUSTY) { - ObjSwitch_InitDynapoly(this, globalCtx, &gFloorSwitchCol, DPM_PLAYER); + ObjSwitch_InitDynapoly(this, play, &gFloorSwitchCol, DPM_PLAYER); } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -300,11 +300,11 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->dyna.actor, sHeights[type]); if (type == OBJSWITCH_TYPE_FLOOR_RUSTY) { - ObjSwitch_InitTrisCollider(this, globalCtx, &sRustyFloorTrisInit); + ObjSwitch_InitTrisCollider(this, play, &sRustyFloorTrisInit); } else if (type == OBJSWITCH_TYPE_EYE) { - ObjSwitch_InitTrisCollider(this, globalCtx, &trisColliderEye); + ObjSwitch_InitTrisCollider(this, play, &trisColliderEye); } else if (type == OBJSWITCH_TYPE_CRYSTAL || type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { - ObjSwitch_InitJntSphCollider(this, globalCtx, &sCyrstalJntSphereInit); + ObjSwitch_InitJntSphCollider(this, play, &sCyrstalJntSphereInit); } if (type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { @@ -314,7 +314,7 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - if ((this->dyna.actor.params >> 7 & 1) && (ObjSwitch_SpawnIce(this, globalCtx) == NULL)) { + if ((this->dyna.actor.params >> 7 & 1) && (ObjSwitch_SpawnIce(this, play) == NULL)) { osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("Error : 氷発生失敗 (%s %d)\n", __FILE__, __LINE__); osSyncPrintf(VT_RST); @@ -346,24 +346,24 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(Dungeon switch)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Destroy(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; switch ((this->dyna.actor.params & 7)) { case OBJSWITCH_TYPE_FLOOR: case OBJSWITCH_TYPE_FLOOR_RUSTY: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; } switch ((this->dyna.actor.params & 7)) { case OBJSWITCH_TYPE_FLOOR_RUSTY: case OBJSWITCH_TYPE_EYE: - Collider_DestroyTris(globalCtx, &this->tris.col); + Collider_DestroyTris(play, &this->tris.col); break; case OBJSWITCH_TYPE_CRYSTAL: case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE: - Collider_DestroyJntSph(globalCtx, &this->jntSph.col); + Collider_DestroyJntSph(play, &this->jntSph.col); break; } } @@ -373,39 +373,39 @@ void ObjSwitch_FloorUpInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_FloorUp; } -void ObjSwitch_FloorUp(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params & 7) == OBJSWITCH_TYPE_FLOOR_RUSTY) { if (this->tris.col.base.acFlags & AC_HIT) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); this->tris.col.base.acFlags &= ~AC_HIT; } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->tris.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base); } } else { switch ((this->dyna.actor.params >> 4 & 7)) { case OBJSWITCH_SUBTYPE_FLOOR_0: if (func_8004356C(&this->dyna)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } break; case OBJSWITCH_SUBTYPE_FLOOR_1: if ((this->dyna.unk_160 & 2) && !(this->unk_17F & 2)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } break; case OBJSWITCH_SUBTYPE_FLOOR_2: if (func_800435B4(&this->dyna)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } break; case OBJSWITCH_SUBTYPE_FLOOR_3: if (func_800435B4(&this->dyna)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } break; } @@ -417,7 +417,7 @@ void ObjSwitch_FloorPressInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_FloorPress(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorPress(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_FLOOR_3 || !this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->dyna.actor.scale.y -= 99.0f / 2000.0f; @@ -435,28 +435,28 @@ void ObjSwitch_FloorDownInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_FloorDown; } -void ObjSwitch_FloorDown(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorDown(ObjSwitch* this, PlayState* play) { switch ((this->dyna.actor.params >> 4 & 7)) { case OBJSWITCH_SUBTYPE_FLOOR_0: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_FloorReleaseInit(this); } break; case OBJSWITCH_SUBTYPE_FLOOR_1: if ((this->dyna.unk_160 & 2) && !(this->unk_17F & 2)) { ObjSwitch_FloorReleaseInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } break; case OBJSWITCH_SUBTYPE_FLOOR_2: case OBJSWITCH_SUBTYPE_FLOOR_3: - if (!func_800435B4(&this->dyna) && !Player_InCsMode(globalCtx)) { + if (!func_800435B4(&this->dyna) && !Player_InCsMode(play)) { if (this->releaseTimer <= 0) { ObjSwitch_FloorReleaseInit(this); if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_FLOOR_2) { - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } else { - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } } } else { @@ -471,7 +471,7 @@ void ObjSwitch_FloorReleaseInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_FloorRelease(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorRelease(ObjSwitch* this, PlayState* play) { s16 subType = (this->dyna.actor.params >> 4 & 7); if (((subType != OBJSWITCH_SUBTYPE_FLOOR_1) && (subType != OBJSWITCH_SUBTYPE_FLOOR_3)) || !this->cooldownOn || @@ -507,8 +507,8 @@ void ObjSwitch_EyeFrozenInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_EyeInit; } -void ObjSwitch_EyeInit(ObjSwitch* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { +void ObjSwitch_EyeInit(ObjSwitch* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_EyeClosedInit(this); } else { ObjSwitch_EyeOpenInit(this); @@ -520,10 +520,10 @@ void ObjSwitch_EyeOpenInit(ObjSwitch* this) { this->eyeTexIndex = 0; } -void ObjSwitch_EyeOpen(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeOpen(ObjSwitch* this, PlayState* play) { if (ObjSwitch_EyeIsHit(this) || (this->dyna.actor.params >> 7 & 1)) { ObjSwitch_EyeClosingInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); this->dyna.actor.params &= ~0x80; } } @@ -533,7 +533,7 @@ void ObjSwitch_EyeClosingInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_EyeClosing(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeClosing(ObjSwitch* this, PlayState* play) { if (!this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->eyeTexIndex++; if (this->eyeTexIndex >= 3) { @@ -548,10 +548,10 @@ void ObjSwitch_EyeClosedInit(ObjSwitch* this) { this->eyeTexIndex = 3; } -void ObjSwitch_EyeClosed(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeClosed(ObjSwitch* this, PlayState* play) { switch ((this->dyna.actor.params >> 4 & 7)) { case OBJSWITCH_SUBTYPE_EYE_0: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_EyeOpeningInit(this); this->dyna.actor.params &= ~0x80; } @@ -559,7 +559,7 @@ void ObjSwitch_EyeClosed(ObjSwitch* this, GlobalContext* globalCtx) { case OBJSWITCH_SUBTYPE_EYE_1: if (ObjSwitch_EyeIsHit(this) || (this->dyna.actor.params >> 7 & 1)) { ObjSwitch_EyeOpeningInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); this->dyna.actor.params &= ~0x80; } break; @@ -571,7 +571,7 @@ void ObjSwitch_EyeOpeningInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_EyeOpening(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeOpening(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params >> 4 & 7) != OBJSWITCH_SUBTYPE_EYE_1 || !this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->eyeTexIndex--; @@ -590,27 +590,27 @@ void ObjSwitch_CrystalOffInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalOff; } -void ObjSwitch_CrystalOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) { switch ((this->dyna.actor.params >> 4 & 7)) { case OBJSWITCH_SUBTYPE_CRYSTAL_0: if ((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); ObjSwitch_CrystalTurnOnInit(this); } break; case OBJSWITCH_SUBTYPE_CRYSTAL_4: if (((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) || - Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { this->disableAcTimer = 10; - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); ObjSwitch_CrystalTurnOnInit(this); } break; case OBJSWITCH_SUBTYPE_CRYSTAL_1: if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & 2) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); ObjSwitch_CrystalTurnOnInit(this); } ObjSwitch_UpdateTwoTexScrollXY(this); @@ -623,7 +623,7 @@ void ObjSwitch_CrystalTurnOnInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_CrystalTurnOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalTurnOn(ObjSwitch* this, PlayState* play) { if (!this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { ObjSwitch_CrystalOnInit(this); if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_CRYSTAL_1) { @@ -641,20 +641,20 @@ void ObjSwitch_CrystalOnInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalOn; } -void ObjSwitch_CrystalOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play) { switch ((this->dyna.actor.params >> 4 & 7)) { case OBJSWITCH_SUBTYPE_CRYSTAL_0: case OBJSWITCH_SUBTYPE_CRYSTAL_4: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_CrystalTurnOffInit(this); } break; case OBJSWITCH_SUBTYPE_CRYSTAL_1: if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & 2) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; - globalCtx = globalCtx; + play = play; ObjSwitch_CrystalTurnOffInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } break; } @@ -666,7 +666,7 @@ void ObjSwitch_CrystalTurnOffInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_CrystalTurnOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalTurnOff(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params >> 4 & 7) != OBJSWITCH_SUBTYPE_CRYSTAL_1 || !this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { ObjSwitch_CrystalOffInit(this); @@ -675,7 +675,7 @@ void ObjSwitch_CrystalTurnOff(ObjSwitch* this, GlobalContext* globalCtx) { } } -void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Update(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; if (this->releaseTimer > 0) { @@ -685,7 +685,7 @@ void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { this->cooldownTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch ((this->dyna.actor.params & 7)) { case OBJSWITCH_TYPE_FLOOR: @@ -695,34 +695,34 @@ void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { case OBJSWITCH_TYPE_EYE: this->unk_17F = this->tris.col.base.acFlags; this->tris.col.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->tris.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base); break; case OBJSWITCH_TYPE_CRYSTAL: case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE: - if (!Player_InCsMode(globalCtx) && this->disableAcTimer > 0) { + if (!Player_InCsMode(play) && this->disableAcTimer > 0) { this->disableAcTimer--; } this->unk_17F = this->jntSph.col.base.acFlags; this->jntSph.col.base.acFlags &= ~AC_HIT; if (this->disableAcTimer <= 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.col.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.col.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->jntSph.col.base); break; } } -void ObjSwitch_DrawFloor(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawFloor(ObjSwitch* this, PlayState* play) { static Gfx* floorSwitchDLists[] = { gFloorSwitch1DL, gFloorSwitch3DL, gFloorSwitch2DL, gFloorSwitch2DL }; - Gfx_DrawDListOpa(globalCtx, floorSwitchDLists[(this->dyna.actor.params >> 4 & 7)]); + Gfx_DrawDListOpa(play, floorSwitchDLists[(this->dyna.actor.params >> 4 & 7)]); } -void ObjSwitch_DrawFloorRusty(ObjSwitch* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gRustyFloorSwitchDL); +void ObjSwitch_DrawFloorRusty(ObjSwitch* this, PlayState* play) { + Gfx_DrawDListOpa(play, gRustyFloorSwitchDL); } -void ObjSwitch_DrawEye(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawEye(ObjSwitch* this, PlayState* play) { static void* eyeTextures[][4] = { { gEyeSwitchGoldOpenTex, gEyeSwitchGoldOpeningTex, gEyeSwitchGoldClosingTex, gEyeSwitchGoldClosedTex }, { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, gEyeSwitchSilverClosedTex, gEyeSwitchSilverClosedTex }, @@ -731,18 +731,18 @@ void ObjSwitch_DrawEye(ObjSwitch* this, GlobalContext* globalCtx) { s32 pad; s32 subType = (this->dyna.actor.params >> 4 & 7); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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, SEGMENTED_TO_VIRTUAL(eyeTextures[subType][this->eyeTexIndex])); gSPDisplayList(POLY_OPA_DISP++, eyeDlists[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjSwitch_DrawCrystal(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawCrystal(ObjSwitch* this, PlayState* play) { static Gfx* xluDLists[] = { gCrystalSwitchCoreXluDL, gCrystalSwitchDiamondXluDL, NULL, NULL, gCrystalSwitchCoreXluDL }; static Gfx* opaDLists[] = { gCrystalSwitchCoreOpaDL, gCrystalSwitchDiamondOpaDL, NULL, NULL, @@ -752,21 +752,21 @@ void ObjSwitch_DrawCrystal(ObjSwitch* this, GlobalContext* globalCtx) { s32 subType; subType = (this->dyna.actor.params >> 4 & 7); - func_8002ED80(&this->dyna.actor, globalCtx, 0); + func_8002ED80(&this->dyna.actor, play, 0); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(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++, xluDLists[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (subType == OBJSWITCH_SUBTYPE_CRYSTAL_1) { @@ -775,19 +775,19 @@ void ObjSwitch_DrawCrystal(ObjSwitch* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, this->crystalColor.r, this->crystalColor.g, this->crystalColor.b, 128); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->x1TexScroll, this->y1TexScroll, 0x20, 0x20, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->x1TexScroll, this->y1TexScroll, 0x20, 0x20, 1, this->x2TexScroll, this->y2TexScroll, 0x20, 0x20)); gSPDisplayList(POLY_OPA_DISP++, opaDLists[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static ObjSwitchActionFunc sDrawFuncs[] = { ObjSwitch_DrawFloor, ObjSwitch_DrawFloorRusty, ObjSwitch_DrawEye, ObjSwitch_DrawCrystal, ObjSwitch_DrawCrystal, }; -void ObjSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Draw(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; - sDrawFuncs[(this->dyna.actor.params & 7)](this, globalCtx); + sDrawFuncs[(this->dyna.actor.params & 7)](this, play); } diff --git a/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h b/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h index 3a44c8af2..acea2102a 100644 --- a/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h +++ b/soh/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h @@ -6,7 +6,7 @@ struct ObjSwitch; -typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, GlobalContext*); +typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, PlayState*); typedef enum { /* 0 */ OBJSWITCH_TYPE_FLOOR, diff --git a/soh/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/soh/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 572a12791..f887d18c6 100644 --- a/soh/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/soh/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -11,10 +11,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_10) -void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSyokudai_Init(Actor* thisx, PlayState* play); +void ObjSyokudai_Destroy(Actor* thisx, PlayState* play); +void ObjSyokudai_Update(Actor* thisx, PlayState* play); +void ObjSyokudai_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Syokudai_InitVars = { ACTOR_OBJ_SYOKUDAI, @@ -78,7 +78,7 @@ static InitChainEntry sInitChain[] = { static s32 sLitTorchCount; -void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Init(Actor* thisx, PlayState* play) { static u8 sColTypesStand[] = { 0x09, 0x0B, 0x0B }; s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; @@ -87,20 +87,20 @@ void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - Collider_InitCylinder(globalCtx, &this->colliderStand); - Collider_SetCylinder(globalCtx, &this->colliderStand, &this->actor, &sCylInitStand); + Collider_InitCylinder(play, &this->colliderStand); + Collider_SetCylinder(play, &this->colliderStand, &this->actor, &sCylInitStand); this->colliderStand.base.colType = sColTypesStand[this->actor.params >> 0xC]; - Collider_InitCylinder(globalCtx, &this->colliderFlame); - Collider_SetCylinder(globalCtx, &this->colliderFlame, &this->actor, &sCylInitFlame); + Collider_InitCylinder(play, &this->colliderFlame); + Collider_SetCylinder(play, &this->colliderFlame, &this->actor, &sCylInitFlame); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y + 70.0f, this->actor.world.pos.z, 255, 255, 180, -1); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); - if ((this->actor.params & 0x400) || ((torchType != 2) && Flags_GetSwitch(globalCtx, this->actor.params & 0x3F))) { + if ((this->actor.params & 0x400) || ((torchType != 2) && Flags_GetSwitch(play, this->actor.params & 0x3F))) { this->litTimer = -1; } @@ -109,17 +109,17 @@ void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 60.0f); } -void ObjSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colliderStand); - Collider_DestroyCylinder(globalCtx, &this->colliderFlame); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->colliderStand); + Collider_DestroyCylinder(play, &this->colliderFlame); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjSyokudai* this = (ObjSyokudai*)thisx; s32 torchCount = (this->actor.params >> 6) & 0xF; s32 switchFlag = this->actor.params & 0x3F; @@ -141,28 +141,28 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { if (torchCount == 10) { torchCount = 24; } - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, &dummy) && ((waterSurface - this->actor.world.pos.y) > 52.0f)) { this->litTimer = 0; if (torchType == 1) { - Flags_UnsetSwitch(globalCtx, switchFlag); + Flags_UnsetSwitch(play, switchFlag); if (torchCount != 0) { this->litTimer = 1; } } } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); interactionType = 0; if (this->actor.params & 0x400) { this->litTimer = -1; } if (torchCount != 0) { - if (Flags_GetSwitch(globalCtx, switchFlag)) { + if (Flags_GetSwitch(play, switchFlag)) { if (this->litTimer == 0) { this->litTimer = -1; if (torchType == 0) { - OnePointCutscene_Attention(globalCtx, &this->actor); + OnePointCutscene_Attention(play, &this->actor); } } else if (this->litTimer > 0) { this->litTimer = -1; @@ -212,14 +212,14 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { if (torchCount == 0) { this->litTimer = -1; if (torchType != 2) { - Flags_SetSwitch(globalCtx, switchFlag); - OnePointCutscene_Attention(globalCtx, &this->actor); + Flags_SetSwitch(play, switchFlag); + OnePointCutscene_Attention(play, &this->actor); } } else { sLitTorchCount++; if (sLitTorchCount >= torchCount) { - Flags_SetSwitch(globalCtx, switchFlag); - OnePointCutscene_Attention(globalCtx, &this->actor); + Flags_SetSwitch(play, switchFlag); + OnePointCutscene_Attention(play, &this->actor); this->litTimer = -1; } else { this->litTimer = (litTimeScale * 50) + 110; @@ -232,11 +232,11 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { } Collider_UpdateCylinder(&this->actor, &this->colliderStand); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderStand.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderStand.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderStand.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderStand.base); Collider_UpdateCylinder(&this->actor, &this->colliderFlame); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderFlame.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderFlame.base); if (this->litTimer > 0) { this->litTimer--; @@ -257,7 +257,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { this->flameTexScroll++; } -void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { gGoldenTorchDL, gTimedTorchDL, gWoodenTorchDL }; s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; @@ -265,10 +265,10 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { timerMax = (((this->actor.params >> 6) & 0xF) * 50) + 100; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(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++, displayLists[(u16)this->actor.params >> 0xC]); @@ -283,10 +283,10 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { } flameScale *= 0.0027f; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->flameTexScroll * -20) & 0x1FF, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); @@ -294,15 +294,15 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(flameScale, flameScale, flameScale, 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++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index 78cc85704..9de638280 100644 --- a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -9,21 +9,21 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) -void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTimeblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTimeblock_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTimeblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTimeblock_Init(Actor* thisx, PlayState* play); +void ObjTimeblock_Destroy(Actor* thisx, PlayState* play); +void ObjTimeblock_Update(Actor* thisx, PlayState* play); +void ObjTimeblock_Draw(Actor* thisx, PlayState* play); void ObjTimeblock_SetupNormal(ObjTimeblock* this); void ObjTimeblock_SetupAltBehaviorVisible(ObjTimeblock* this); void ObjTimeblock_SetupAltBehaviourNotVisible(ObjTimeblock* this); -s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, GlobalContext* globalCtx); -s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_DoNothing(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_Normal(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, GlobalContext* globalCtx); +s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, PlayState* play); +s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, PlayState* play); +void ObjTimeblock_DoNothing(ObjTimeblock* this, PlayState* play); +void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play); +void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play); +void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, PlayState* play); const ActorInit Obj_Timeblock_InitVars = { ACTOR_OBJ_TIMEBLOCK, @@ -83,21 +83,21 @@ u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) { } } -void ObjTimeblock_SpawnDemoEffect(ObjTimeblock* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, +void ObjTimeblock_SpawnDemoEffect(ObjTimeblock* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, sSizeOptions[(this->dyna.actor.params >> 8) & 1].demoEffectParams); } -void ObjTimeblock_ToggleSwitchFlag(GlobalContext* globalCtx, s32 flag) { - if (Flags_GetSwitch(globalCtx, flag)) { - Flags_UnsetSwitch(globalCtx, flag); +void ObjTimeblock_ToggleSwitchFlag(PlayState* play, s32 flag) { + if (Flags_GetSwitch(play, flag)) { + Flags_UnsetSwitch(play, flag); } else { - Flags_SetSwitch(globalCtx, flag); + Flags_SetSwitch(play, flag); } } -void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Init(Actor* thisx, PlayState* play) { ObjTimeblock* this = (ObjTimeblock*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -107,7 +107,7 @@ void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, sSizeOptions[(this->dyna.actor.params >> 8) & 1].scale); @@ -122,7 +122,7 @@ void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->dyna.actor, sSizeOptions[(this->dyna.actor.params >> 8) & 1].height); - this->unk_174 = (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false; this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false; this->isVisible = ObjTimeblock_CalculateIsVisible(this); @@ -140,14 +140,14 @@ void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { (this->dyna.actor.params >> 10) & 1); } -void ObjTimeblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjTimeblock* this = (ObjTimeblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { +u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, PlayState* play) { if (this->isVisible && func_80043590(&this->dyna)) { return false; } @@ -156,7 +156,7 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { Vec3f distance; f32 blockSize; - func_8002DBD0(&this->dyna.actor, &distance, &GET_PLAYER(globalCtx)->actor.world.pos); + func_8002DBD0(&this->dyna.actor, &distance, &GET_PLAYER(play)->actor.world.pos); blockSize = this->dyna.actor.scale.x * 50.0f + 6.0f; // Return true if player's xz position is not inside the block if (blockSize < fabsf(distance.x) || blockSize < fabsf(distance.z)) { @@ -167,12 +167,12 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { return false; } -s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (ObjTimeblock_PlayerIsInRange(this, globalCtx)) { + if (ObjTimeblock_PlayerIsInRange(this, play)) { if (player->stateFlags2 & 0x1000000) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->songObserverFunc = ObjTimeblock_WaitForSong; } else { player->stateFlags2 |= 0x800000; @@ -181,11 +181,11 @@ s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, GlobalContext* globalCtx) { return false; } -s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { +s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->songObserverFunc = ObjTimeblock_WaitForOcarina; } - if (globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { + if (play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { if (this->unk_172 == 254) { this->songEndTimer = 110; } else { @@ -202,42 +202,42 @@ void ObjTimeblock_SetupDoNothing(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_DoNothing; } -void ObjTimeblock_DoNothing(ObjTimeblock* this, GlobalContext* globalCtx) { +void ObjTimeblock_DoNothing(ObjTimeblock* this, PlayState* play) { } void ObjTimeblock_SetupNormal(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_Normal; } -void ObjTimeblock_Normal(ObjTimeblock* this, GlobalContext* globalCtx) { +void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) { u32 newIsVisible; - if (this->songObserverFunc(this, globalCtx) && this->demoEffectTimer <= 0) { - ObjTimeblock_SpawnDemoEffect(this, globalCtx); + if (this->songObserverFunc(this, play) && this->demoEffectTimer <= 0) { + ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; // Possibly points the camera to this actor - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); // "◯◯◯◯ Time Block Attention Camera (frame counter %d)\n" - osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", globalCtx->state.frames); + osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); this->demoEffectFirstPartTimer = 12; if (this->unk_177 == 0) { this->dyna.actor.params ^= 0x8000; } else { - ObjTimeblock_ToggleSwitchFlag(globalCtx, this->dyna.actor.params & 0x3F); + ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F); } } - this->unk_172 = globalCtx->msgCtx.lastPlayedSong; + this->unk_172 = play->msgCtx.lastPlayedSong; if (this->demoEffectFirstPartTimer > 0) { this->demoEffectFirstPartTimer--; if (this->demoEffectFirstPartTimer == 0) { if (this->unk_177 == 0) { this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false; } else { - this->unk_174 = (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false; } } } @@ -253,35 +253,35 @@ void ObjTimeblock_Normal(ObjTimeblock* this, GlobalContext* globalCtx) { } } -void func_80BA06AC(ObjTimeblock* this, GlobalContext* globalCtx) { +void func_80BA06AC(ObjTimeblock* this, PlayState* play) { s32 switchFlag = this->dyna.actor.params & 0x3F; - this->unk_172 = globalCtx->msgCtx.lastPlayedSong; + this->unk_172 = play->msgCtx.lastPlayedSong; if (this->demoEffectFirstPartTimer > 0 && --this->demoEffectFirstPartTimer == 0) { - this->unk_174 = (Flags_GetSwitch(globalCtx, switchFlag)) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, switchFlag)) ? true : false; } this->isVisible = ObjTimeblock_CalculateIsVisible(this); - this->unk_176 = (Flags_GetSwitch(globalCtx, switchFlag)) ? true : false; + this->unk_176 = (Flags_GetSwitch(play, switchFlag)) ? true : false; } void ObjTimeblock_SetupAltBehaviorVisible(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_AltBehaviorVisible; } -void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, GlobalContext* globalCtx) { - if (this->songObserverFunc(this, globalCtx) && this->demoEffectTimer <= 0) { +void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play) { + if (this->songObserverFunc(this, play) && this->demoEffectTimer <= 0) { this->demoEffectFirstPartTimer = 12; - ObjTimeblock_SpawnDemoEffect(this, globalCtx); + ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); // "Time Block Attention Camera (frame counter)" - osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", globalCtx->state.frames); - ObjTimeblock_ToggleSwitchFlag(globalCtx, this->dyna.actor.params & 0x3F); + osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); + ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F); } - func_80BA06AC(this, globalCtx); + func_80BA06AC(this, play); if (this->demoEffectTimer == 50) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); @@ -296,53 +296,53 @@ void ObjTimeblock_SetupAltBehaviourNotVisible(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_AltBehaviourNotVisible; } -void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, GlobalContext* globalCtx) { +void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, PlayState* play) { s32 switchFlag = this->dyna.actor.params & 0x3F; - s8 switchFlagIsSet = (Flags_GetSwitch(globalCtx, switchFlag)) ? true : false; + s8 switchFlagIsSet = (Flags_GetSwitch(play, switchFlag)) ? true : false; if (this->unk_176 ^ switchFlagIsSet && switchFlagIsSet ^ (((this->dyna.actor.params >> 15) & 1) ? true : false)) { if (this->demoEffectTimer <= 0) { - ObjTimeblock_SpawnDemoEffect(this, globalCtx); + ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; } this->demoEffectFirstPartTimer = 12; } - func_80BA06AC(this, globalCtx); + func_80BA06AC(this, play); if (this->isVisible && this->demoEffectTimer <= 0) { ObjTimeblock_SetupAltBehaviorVisible(this); } } -void ObjTimeblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Update(Actor* thisx, PlayState* play) { ObjTimeblock* this = (ObjTimeblock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->demoEffectTimer > 0) { this->demoEffectTimer--; } if (this->isVisible) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } } -void ObjTimeblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Draw(Actor* thisx, PlayState* play) { if (((ObjTimeblock*)thisx)->isVisible) { Color_RGB8* primColor = &sPrimColors[thisx->home.rot.z & 7]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D18(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, 0, primColor->r, primColor->g, primColor->b, 255); gSPDisplayList(POLY_OPA_DISP++, gSongOfTimeBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h index 7b890b1cb..9bd393b19 100644 --- a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h +++ b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h @@ -6,8 +6,8 @@ struct ObjTimeblock; -typedef s32 (*ObjTimeblockSongObserverFunc)(struct ObjTimeblock*, GlobalContext*); -typedef void (*ObjTimeblockActionFunc)(struct ObjTimeblock*, GlobalContext*); +typedef s32 (*ObjTimeblockSongObserverFunc)(struct ObjTimeblock*, PlayState*); +typedef void (*ObjTimeblockActionFunc)(struct ObjTimeblock*, PlayState*); typedef struct ObjTimeblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 460074f81..157e017a2 100644 --- a/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -11,25 +11,25 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) -void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTsubo_Init(Actor* thisx, PlayState* play); +void ObjTsubo_Destroy(Actor* thisx, PlayState* play); +void ObjTsubo_Update(Actor* thisx, PlayState* play); +void ObjTsubo_Draw(Actor* thisx, PlayState* play); -void ObjTsubo_SpawnCollectible(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play); void ObjTsubo_ApplyGravity(ObjTsubo* this); -s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx); -void ObjTsubo_InitCollider(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx); -void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx); +s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play); +void ObjTsubo_InitCollider(Actor* thisx, PlayState* play); +void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play); +void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupWaitForObject(ObjTsubo* this); -void ObjTsubo_WaitForObject(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupIdle(ObjTsubo* this); -void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_Idle(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupLiftedUp(ObjTsubo* this); -void ObjTsubo_LiftedUp(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupThrown(ObjTsubo* this); -void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play); static s16 D_80BA1B50 = 0; static s16 D_80BA1B54 = 0; @@ -83,11 +83,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ObjTsubo_SpawnCollectible(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) { s16 dropParams = this->actor.params & 0x1F; if ((dropParams >= ITEM00_RUPEE_GREEN) && (dropParams <= ITEM00_BOMBS_SPECIAL)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, (dropParams | (((this->actor.params >> 9) & 0x3F) << 8))); } } @@ -99,7 +99,7 @@ void ObjTsubo_ApplyGravity(ObjTsubo* this) { } } -s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) { +s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play) { CollisionPoly* floorPoly; Vec3f pos; s32 bgID; @@ -108,7 +108,7 @@ s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 20.0f; pos.z = this->actor.world.pos.z; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgID, &this->actor, &pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgID, &this->actor, &pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -119,25 +119,25 @@ s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) { } } -void ObjTsubo_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjTsubo_InitCollider(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTsubo_Init(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - ObjTsubo_InitCollider(&this->actor, globalCtx); + ObjTsubo_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, sColChkInfoInit); - if (!ObjTsubo_SnapToFloor(this, globalCtx)) { + if (!ObjTsubo_SnapToFloor(this, play)) { Actor_Kill(&this->actor); return; } - this->objTsuboBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); + this->objTsuboBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); if (this->objTsuboBankIndex < 0) { osSyncPrintf("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, __FILE__, __LINE__); Actor_Kill(&this->actor); @@ -147,14 +147,14 @@ void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjTsubo* this = (ObjTsubo*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play) { s32 pad; f32 rand; s16 angle; @@ -183,14 +183,14 @@ void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx) { } else { arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 60, KAKERA_COLOR_NONE, sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); } - func_80033480(globalCtx, &this->actor.world.pos, 30.0f, 4, 20, 50, 1); + func_80033480(play, &this->actor.world.pos, 30.0f, 4, 20, 50, 1); } -void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play) { s32 pad[2]; s16 angle; Vec3f pos = this->actor.world.pos; @@ -199,7 +199,7 @@ void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) { s32 i; pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 400); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 400); for (i = 0, angle = 0; i < 15; i++, angle += 0x4E20) { f32 sins = Math_SinS(angle); f32 coss = Math_CosS(angle); @@ -212,7 +212,7 @@ void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) { velocity.z = pos.z * 0.2f; Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); phi_s0 = (Rand_ZeroOne() < .2f) ? 64 : 32; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 70, KAKERA_COLOR_NONE, sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); } @@ -222,8 +222,8 @@ void ObjTsubo_SetupWaitForObject(ObjTsubo* this) { this->actionFunc = ObjTsubo_WaitForObject; } -void ObjTsubo_WaitForObject(ObjTsubo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objTsuboBankIndex)) { +void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objTsuboBankIndex)) { this->actor.draw = ObjTsubo_Draw; this->actor.objBankIndex = this->objTsuboBankIndex; ObjTsubo_SetupIdle(this); @@ -235,39 +235,39 @@ void ObjTsubo_SetupIdle(ObjTsubo* this) { this->actionFunc = ObjTsubo_Idle; } -void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_Idle(ObjTsubo* this, PlayState* play) { s32 pad; s16 temp_v0; s32 phi_v1; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { ObjTsubo_SetupLiftedUp(this); } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { - ObjTsubo_WaterBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); - ObjTsubo_SpawnCollectible(this, globalCtx); + ObjTsubo_WaterBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if ((this->collider.base.acFlags & AC_HIT) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x4FC1FFFC)) { - ObjTsubo_AirBreak(this, globalCtx); - ObjTsubo_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_AirBreak(this, play); + ObjTsubo_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else { if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 150.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.xzDistToPlayer < 100.0f) { - temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y; + temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; phi_v1 = ABS(temp_v0); if (phi_v1 >= 0x5556) { // GI_NONE in this case allows the player to lift the actor - func_8002F434(&this->actor, globalCtx, GI_NONE, 30.0f, 30.0f); + func_8002F434(&this->actor, play, GI_NONE, 30.0f, 30.0f); } } } @@ -280,13 +280,13 @@ void ObjTsubo_SetupLiftedUp(ObjTsubo* this) { this->actor.flags |= ACTOR_FLAG_4; } -void ObjTsubo_LiftedUp(ObjTsubo* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.curRoom.num; ObjTsubo_SetupThrown(this); ObjTsubo_ApplyGravity(this); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, 0x85); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, 0x85); } } @@ -301,18 +301,18 @@ void ObjTsubo_SetupThrown(ObjTsubo* this) { this->actionFunc = ObjTsubo_Thrown; } -void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play) { s32 pad[2]; if ((this->actor.bgCheckFlags & 0xB) || (this->collider.base.atFlags & AT_HIT)) { - ObjTsubo_AirBreak(this, globalCtx); - ObjTsubo_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_AirBreak(this, play); + ObjTsubo_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else if (this->actor.bgCheckFlags & 0x40) { - ObjTsubo_WaterBreak(this, globalCtx); - ObjTsubo_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_WaterBreak(this, play); + ObjTsubo_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else { ObjTsubo_ApplyGravity(this); @@ -321,19 +321,19 @@ void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx) { Math_StepToS(&D_80BA1B5C, D_80BA1B58, 0x64); this->actor.shape.rot.x += D_80BA1B54; this->actor.shape.rot.y += D_80BA1B5C; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, 0x85); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, 0x85); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTsubo_Update(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_80BA1B84[(thisx->params >> 8) & 1]); +void ObjTsubo_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_80BA1B84[(thisx->params >> 8) & 1]); } diff --git a/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h b/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h index c8abce650..62ea296f8 100644 --- a/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -6,7 +6,7 @@ struct ObjTsubo; -typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, GlobalContext*); +typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, PlayState*); typedef struct ObjTsubo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index fe561a49b..02c566751 100644 --- a/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -10,23 +10,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) -void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjWarp2block_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjWarp2block_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjWarp2block_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjWarp2block_Init(Actor* thisx, PlayState* play); +void ObjWarp2block_Destroy(Actor* thisx, PlayState* play); +void ObjWarp2block_Update(Actor* thisx, PlayState* play); +void ObjWarp2block_Draw(Actor* thisx, PlayState* play); -void ObjWarp2block_Spawn(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx); -void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA2304(ObjWarp2block* this, GlobalContext* globalCtx); +void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play); +s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play); +void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play); +s32 func_80BA2218(ObjWarp2block* this, PlayState* play); +s32 func_80BA228C(ObjWarp2block* this, PlayState* play); +s32 func_80BA2304(ObjWarp2block* this, PlayState* play); void ObjWarp2block_SetInactive(ObjWarp2block* this); -void ObjWarp2block_DoNothing(ObjWarp2block* this, GlobalContext* globalCtx); +void ObjWarp2block_DoNothing(ObjWarp2block* this, PlayState* play); void func_80BA24E8(ObjWarp2block* this); -void func_80BA24F8(ObjWarp2block* this, GlobalContext* globalCtx); +void func_80BA24F8(ObjWarp2block* this, PlayState* play); void func_80BA2600(ObjWarp2block* this); -void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx); +void func_80BA2610(ObjWarp2block* this, PlayState* play); const ActorInit Obj_Warp2block_InitVars = { ACTOR_OBJ_WARP2BLOCK, @@ -65,17 +65,17 @@ static Color_RGB8 sColors[] = { { 80, 110, 140 }, { 70, 160, 225 }, { 80, 100, 130 }, { 100, 110, 190 }, }; -void ObjWarp2block_Spawn(ObjWarp2block* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, +void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, sSpawnData[(this->dyna.actor.params >> 8) & 1].params); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.child->world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.child->world.pos.x, this->dyna.actor.child->world.pos.y, this->dyna.actor.child->world.pos.z, 0, 0, 0, sSpawnData[(this->dyna.actor.child->params >> 8) & 1].params); } -s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) { +s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play) { s32 pad; Actor* temp_a3; Player* player; @@ -87,7 +87,7 @@ s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) { } temp_a3 = this->dyna.actor.child; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { @@ -111,7 +111,7 @@ s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) { return 1; } -void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx) { +void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play) { Vec3f tempVec; Vec3s tempRot; s32 temp; @@ -149,18 +149,18 @@ void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx) this->dyna.actor.child->params = (this->dyna.actor.child->params & 0x8000) | (temp & 0x7FFF); if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos) < 0.01f) { - Flags_UnsetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_UnsetSwitch(play, this->dyna.actor.params & 0x3F); } else { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } } -s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BA2218(ObjWarp2block* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_80BA1ECC(this, globalCtx)) { + if (func_80BA1ECC(this, play)) { if (player->stateFlags2 & 0x1000000) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->func_168 = func_80BA228C; } else { player->stateFlags2 |= 0x800000; @@ -170,12 +170,12 @@ s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { +s32 func_80BA228C(ObjWarp2block* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->func_168 = func_80BA2218; } - if (globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { + if (play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { if (this->unk_172 == 0xFE) { this->unk_16E = 0x6E; } else { @@ -188,16 +188,16 @@ s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA2304(ObjWarp2block* this, GlobalContext* globalCtx) { - s32 ret = this->func_168(this, globalCtx); +s32 func_80BA2304(ObjWarp2block* this, PlayState* play) { + s32 ret = this->func_168(this, play); - this->unk_172 = globalCtx->msgCtx.lastPlayedSong; + this->unk_172 = play->msgCtx.lastPlayedSong; return ret; } -void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjWarp2block_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjWarp2block* this = (ObjWarp2block*)thisx; CollisionHeader* collisionHeader; @@ -211,12 +211,12 @@ void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) { if ((this->dyna.actor.params >> 0xF) & 1) { func_80BA24E8(this); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { this->dyna.actor.draw = NULL; } DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &collisionHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, collisionHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, collisionHeader); } else { ObjWarp2block_SetInactive(this); } @@ -225,10 +225,10 @@ void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) { this->dyna.actor.home.rot.z & 7, (this->dyna.actor.params >> 0xB) & 7); } -void ObjWarp2block_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarp2block_Destroy(Actor* thisx, PlayState* play) { ObjWarp2block* this = (ObjWarp2block*)thisx; if ((this->dyna.actor.params >> 0xF) & 1) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -237,22 +237,22 @@ void ObjWarp2block_SetInactive(ObjWarp2block* this) { this->dyna.actor.draw = NULL; } -void ObjWarp2block_DoNothing(ObjWarp2block* this, GlobalContext* globalCtx) { +void ObjWarp2block_DoNothing(ObjWarp2block* this, PlayState* play) { } void func_80BA24E8(ObjWarp2block* this) { this->actionFunc = func_80BA24F8; } -void func_80BA24F8(ObjWarp2block* this, GlobalContext* globalCtx) { - Actor* current = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; +void func_80BA24F8(ObjWarp2block* this, PlayState* play) { + Actor* current = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (current != NULL) { if (current->id == ACTOR_OBJ_WARP2BLOCK && !((current->params >> 0xF) & 1) && ((this->dyna.actor.params & 0x3F) == (current->params & 0x3F))) { this->dyna.actor.child = current; - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { - ObjWarp2block_SwapWithChild(this, globalCtx); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + ObjWarp2block_SwapWithChild(this, play); this->dyna.actor.draw = ObjWarp2block_Draw; } func_80BA2600(this); @@ -275,18 +275,18 @@ void func_80BA2600(ObjWarp2block* this) { this->actionFunc = func_80BA2610; } -void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx) { - if ((func_80BA2304(this, globalCtx) != 0) && (this->unk_16C <= 0)) { - ObjWarp2block_Spawn(this, globalCtx); +void func_80BA2610(ObjWarp2block* this, PlayState* play) { + if ((func_80BA2304(this, play) != 0) && (this->unk_16C <= 0)) { + ObjWarp2block_Spawn(this, play); this->unk_16C = 0xA0; - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_170 = 0xC; } if (this->unk_170 > 0) { this->unk_170--; if (this->unk_170 == 0) { - ObjWarp2block_SwapWithChild(this, globalCtx); + ObjWarp2block_SwapWithChild(this, play); } } if (this->unk_16C == 0x32) { @@ -294,27 +294,27 @@ void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx) { } } -void ObjWarp2block_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarp2block_Update(Actor* thisx, PlayState* play) { ObjWarp2block* this = (ObjWarp2block*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_16C > 0) { this->unk_16C--; } } -void ObjWarp2block_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarp2block_Draw(Actor* thisx, PlayState* play) { Color_RGB8* sp44; sp44 = &sColors[thisx->home.rot.z & 7]; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_80093D18(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); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sp44->r, sp44->g, sp44->b, 255); gSPDisplayList(POLY_OPA_DISP++, gSongOfTimeBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h b/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h index 9b9dd991e..3e09d976c 100644 --- a/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h +++ b/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h @@ -6,8 +6,8 @@ struct ObjWarp2block; -typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, GlobalContext*); -typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, GlobalContext*); +typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, PlayState*); +typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, PlayState*); typedef struct ObjWarp2block { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 6aff36144..413f55634 100644 --- a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -13,28 +13,28 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjectKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjectKankyo_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjectKankyo_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjectKankyo_Init(Actor* thisx, PlayState* play); +void ObjectKankyo_Destroy(Actor* thisx, PlayState* play); +void ObjectKankyo_Update(Actor* thisx, PlayState* play); +void ObjectKankyo_Draw(Actor* thisx, PlayState* play); void ObjectKankyo_Reset(void); void ObjectKankyo_SetupAction(ObjectKankyo* this, ObjectKankyoActionFunc func); -void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_Snow(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_InitBeams(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_Beams(ObjectKankyo* this, GlobalContext* globalCtx); +void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_Snow(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_Lightning(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_InitBeams(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_Beams(ObjectKankyo* this, PlayState* play); -void ObjectKankyo_DrawFairies(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawSnow(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawLightning(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawBeams(ObjectKankyo* this, GlobalContext* globalCtx); +void ObjectKankyo_DrawFairies(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawSnow(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawLightning(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawBeams(ObjectKankyo* this, PlayState* play); static void* sEffLightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, @@ -66,7 +66,7 @@ void ObjectKankyo_SetupAction(ObjectKankyo* this, ObjectKankyoActionFunc action) this->actionFunc = action; } -void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Init(Actor* thisx, PlayState* play) { ObjectKankyo* this = (ObjectKankyo*)thisx; s32 pad; s16 i; @@ -102,7 +102,7 @@ void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: this->effects[0].alpha = 0; this->effects[0].amplitude = 0.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); this->requiredObjectLoaded = false; ObjectKankyo_SetupAction(this, ObjectKankyo_SunGraveSparkInit); break; @@ -183,14 +183,14 @@ void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjectKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Destroy(Actor* thisx, PlayState* play) { Actor_Kill(thisx); } -void ObjectKankyo_Snow(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_Snow(ObjectKankyo* this, PlayState* play) { } -void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { static Vec3f sSoundPos = { 0.0f, 0.0f, 0.0f }; Player* player; f32 dist; @@ -211,14 +211,14 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { s16 i; Vec3f viewForwards; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); - if (globalCtx->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 7) { - dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &globalCtx->view.eye); + if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 7) { + dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &play->view.eye); - this->prevEyePos.x = globalCtx->view.eye.x; - this->prevEyePos.y = globalCtx->view.eye.y; - this->prevEyePos.z = globalCtx->view.eye.z; + this->prevEyePos.x = play->view.eye.x; + this->prevEyePos.y = play->view.eye.y; + this->prevEyePos.z = play->view.eye.z; dist /= 30.0f; if (dist > 1.0f) { @@ -226,7 +226,7 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { } func_800F436C(&sSoundPos, NA_SE_EV_NAVY_FLY - SFX_FLAG, (0.4f * dist) + 0.6f); - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 473: func_800788CC(NA_SE_VO_NA_HELLO_3); break; @@ -245,16 +245,16 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { } } - if (globalCtx->envCtx.unk_EE[3] < 64 && - (gSaveContext.entranceIndex != 0x00EE || gSaveContext.sceneSetupIndex != 4 || globalCtx->envCtx.unk_EE[3])) { - globalCtx->envCtx.unk_EE[3] += 16; + if (play->envCtx.unk_EE[3] < 64 && + (gSaveContext.entranceIndex != 0x00EE || gSaveContext.sceneSetupIndex != 4 || play->envCtx.unk_EE[3])) { + play->envCtx.unk_EE[3] += 16; } - for (i = 0; i < globalCtx->envCtx.unk_EE[3]; i++) { + for (i = 0; i < play->envCtx.unk_EE[3]; i++) { // spawn in front of the camera - dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + dx = play->view.lookAt.x - play->view.eye.x; + dy = play->view.lookAt.y - play->view.eye.y; + dz = play->view.lookAt.z - play->view.eye.z; dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); viewForwards.x = dx / dist; @@ -267,9 +267,9 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { switch (this->effects[i].state) { case 0: // init - this->effects[i].base.x = globalCtx->view.eye.x + viewForwardsX * 80.0f; - this->effects[i].base.y = globalCtx->view.eye.y + viewForwardsY * 80.0f; - this->effects[i].base.z = globalCtx->view.eye.z + viewForwardsZ * 80.0f; + this->effects[i].base.x = play->view.eye.x + viewForwardsX * 80.0f; + this->effects[i].base.y = play->view.eye.y + viewForwardsY * 80.0f; + this->effects[i].base.z = play->view.eye.z + viewForwardsZ * 80.0f; this->effects[i].pos.x = (Rand_ZeroOne() - 0.5f) * 160.0f; this->effects[i].pos.y = 30.0f; @@ -289,9 +289,9 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { case 1: // blinking fairies / inactive fairy trails case 2: // fairy trails this->effects[i].alphaTimer++; - baseX = globalCtx->view.eye.x + viewForwards.x * 80.0f; - baseY = globalCtx->view.eye.y + viewForwards.y * 80.0f; - baseZ = globalCtx->view.eye.z + viewForwards.z * 80.0f; + baseX = play->view.eye.x + viewForwards.x * 80.0f; + baseY = play->view.eye.y + viewForwards.y * 80.0f; + baseZ = play->view.eye.z + viewForwards.z * 80.0f; this->effects[i].prevPos.x = this->effects[i].pos.x; this->effects[i].prevPos.y = this->effects[i].pos.y; @@ -479,53 +479,53 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Update(Actor* thisx, PlayState* play) { ObjectKankyo* this = (ObjectKankyo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjectKankyo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Draw(Actor* thisx, PlayState* play) { ObjectKankyo* this = (ObjectKankyo*)thisx; switch (this->actor.params) { case 0: - ObjectKankyo_DrawFairies(this, globalCtx); + ObjectKankyo_DrawFairies(this, play); break; case 2: - ObjectKankyo_DrawLightning(this, globalCtx); + ObjectKankyo_DrawLightning(this, play); break; case 3: - ObjectKankyo_DrawSnow(this, globalCtx); + ObjectKankyo_DrawSnow(this, play); break; case 4: - ObjectKankyo_DrawSunGraveSpark(this, globalCtx); + ObjectKankyo_DrawSunGraveSpark(this, play); break; case 5: - ObjectKankyo_DrawBeams(this, globalCtx); + ObjectKankyo_DrawBeams(this, play); break; } } -void ObjectKankyo_DrawFairies(ObjectKankyo* this2, GlobalContext* globalCtx2) { +void ObjectKankyo_DrawFairies(ObjectKankyo* this2, PlayState* play2) { ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 alphaScale; Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; Vec3f vec2 = { 0.0f, 0.0f, 0.0f }; s16 i; - if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + if (!(play->cameraPtrs[0]->unk_14C & 0x100)) { + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gSunTex)); gSPDisplayList(POLY_XLU_DISP++, gKokiriDustMoteTextureLoadDL); - for (i = 0; i < globalCtx->envCtx.unk_EE[3]; i++) { + for (i = 0; i < play->envCtx.unk_EE[3]; i++) { FrameInterpolation_RecordOpenChild(&this->effects[i], this->effects[i].epoch); Matrix_Translate(this->effects[i].base.x + this->effects[i].pos.x, this->effects[i].base.y + this->effects[i].pos.y, @@ -588,19 +588,19 @@ void ObjectKankyo_DrawFairies(ObjectKankyo* this2, GlobalContext* globalCtx2) { break; } - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZ(DEG_TO_RAD(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZ(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gKokiriDustMoteDL); FrameInterpolation_RecordCloseChild(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { +void ObjectKankyo_DrawSnow(ObjectKankyo* this2, PlayState* play2) { ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 dist; f32 dx; f32 dy; @@ -616,32 +616,32 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { s32 pad; s32 pad2; - if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100)) { - OPEN_DISPS(globalCtx->state.gfxCtx); - if (globalCtx->envCtx.unk_EE[2] < globalCtx->envCtx.unk_EE[3]) { - if (globalCtx->state.frames % 16 == 0) { - globalCtx->envCtx.unk_EE[2] += 2; + if (!(play->cameraPtrs[0]->unk_14C & 0x100)) { + OPEN_DISPS(play->state.gfxCtx); + if (play->envCtx.unk_EE[2] < play->envCtx.unk_EE[3]) { + if (play->state.frames % 16 == 0) { + play->envCtx.unk_EE[2] += 2; } - } else if (globalCtx->envCtx.unk_EE[2] > globalCtx->envCtx.unk_EE[3]) { - if (globalCtx->state.frames % 16 == 0) { - globalCtx->envCtx.unk_EE[2] -= 2; + } else if (play->envCtx.unk_EE[2] > play->envCtx.unk_EE[3]) { + if (play->state.frames % 16 == 0) { + play->envCtx.unk_EE[2] -= 2; } } - for (i = 0; i < globalCtx->envCtx.unk_EE[2]; i++) { + for (i = 0; i < play->envCtx.unk_EE[2]; i++) { switch (this->effects[i].state) { case 0: // spawn in front of the camera - dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + dx = play->view.lookAt.x - play->view.eye.x; + dy = play->view.lookAt.y - play->view.eye.y; + dz = play->view.lookAt.z - play->view.eye.z; dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); // fake temp = dz / dist; - this->effects[i].base.x = globalCtx->view.eye.x + dx / dist * 80.0f; - this->effects[i].base.y = globalCtx->view.eye.y + dy / dist * 80.0f; - this->effects[i].base.z = globalCtx->view.eye.z + temp * 80.0f; + this->effects[i].base.x = play->view.eye.x + dx / dist * 80.0f; + this->effects[i].base.y = play->view.eye.y + dy / dist * 80.0f; + this->effects[i].base.z = play->view.eye.z + temp * 80.0f; this->effects[i].pos.x = (Rand_ZeroOne() - 0.5f) * 160.0f; this->effects[i].pos.y = 80.0f; @@ -656,14 +656,14 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { break; case 1: - dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + dx = play->view.lookAt.x - play->view.eye.x; + dy = play->view.lookAt.y - play->view.eye.y; + dz = play->view.lookAt.z - play->view.eye.z; dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); - baseX = globalCtx->view.eye.x + dx / dist * 80.0f; - baseY = globalCtx->view.eye.y + dy / dist * 80.0f; - baseZ = globalCtx->view.eye.z + dz / dist * 80.0f; + baseX = play->view.eye.x + dx / dist * 80.0f; + baseY = play->view.eye.y + dy / dist * 80.0f; + baseZ = play->view.eye.z + dz / dist * 80.0f; this->effects[i].dirPhase.x += 0.049999997f * Rand_ZeroOne(); this->effects[i].dirPhase.z += 0.049999997f * Rand_ZeroOne(); @@ -672,7 +672,7 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { this->effects[i].pos.y += -this->effects[i].speed; if (this->effects[i].base.y + this->effects[i].pos.y < this->actor.world.pos.y || - this->effects[i].base.y + this->effects[i].pos.y < globalCtx->view.eye.y - 150.0f) { + this->effects[i].base.y + this->effects[i].pos.y < play->view.eye.y - 150.0f) { this->effects[i].state++; } @@ -718,12 +718,12 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 200, 200, 180); gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 200, 180); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDust5Tex)); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_MODELVIEW | G_MTX_NOPUSH | G_MTX_MUL); gDPPipeSync(POLY_XLU_DISP++); @@ -733,16 +733,16 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { gDPPipeSync(POLY_XLU_DISP++); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[0] != NULL) { +void ObjectKankyo_Lightning(ObjectKankyo* this, PlayState* play) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[0] != NULL) { switch (this->effects[0].state) { case 0: this->effects[0].timer = 0; - if (globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.npcActions[0]->action == 2) { this->effects[0].state++; } break; @@ -754,7 +754,7 @@ void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx) { break; case 2: - if (globalCtx->csCtx.npcActions[0]->action == 1) { + if (play->csCtx.npcActions[0]->action == 1) { this->effects[0].state = 0; } break; @@ -762,34 +762,34 @@ void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_DrawLightning(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_DrawLightning(ObjectKankyo* this, PlayState* play) { s32 pad; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->effects[0].state == 1) { - Matrix_Translate(globalCtx->csCtx.npcActions[0]->startPos.x, globalCtx->csCtx.npcActions[0]->startPos.y, - globalCtx->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); + Matrix_Translate(play->csCtx.npcActions[0]->startPos.x, play->csCtx.npcActions[0]->startPos.y, + play->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); Matrix_RotateX(DEG_TO_RAD(20.0f), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(20.0f), MTXMODE_APPLY); Matrix_Scale(2.0f, 5.0f, 2.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 128); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 128); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEffLightningTextures[this->effects[0].timer])); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_MODELVIEW | G_MTX_NOPUSH | G_MTX_MUL); gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL); gDPPipeSync(POLY_XLU_DISP++); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, GlobalContext* globalCtx) { - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_SPOT02_OBJECTS); +void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, PlayState* play) { + s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_SPOT02_OBJECTS); if (objBankIndex < 0) { ASSERT(objBankIndex < 0); @@ -799,8 +799,8 @@ void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, GlobalContext* globalCtx ObjectKankyo_SetupAction(this, ObjectKankyo_WaitForSunGraveSparkObject); } -void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->requiredObjectLoaded = true; this->effects[0].alpha = 0; this->actor.objBankIndex = this->requiredObjBankIndex; @@ -809,9 +809,9 @@ void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, GlobalContext* } } -void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[1] != NULL && globalCtx->csCtx.npcActions[1]->action == 2) { +void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, PlayState* play) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[1] != NULL && play->csCtx.npcActions[1]->action == 2) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); if ((s16)this->effects[0].alpha + 20 > 255) { this->effects[0].alpha = 255; @@ -823,16 +823,16 @@ void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCtx2) { +void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, PlayState* play2) { ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Vec3f start; Vec3f end; f32 weight; - OPEN_DISPS(globalCtx->state.gfxCtx); - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[1] != NULL && globalCtx->csCtx.npcActions[1]->action == 2 && + OPEN_DISPS(play->state.gfxCtx); + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[1] != NULL && play->csCtx.npcActions[1]->action == 2 && this->requiredObjectLoaded) { // apparently, light waves with larger amplitudes look brighter, so the name 'amplitude' kind of works here if (this->effects[0].state == 0) { @@ -853,20 +853,20 @@ void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCt this->effects[0].timer = 0; } - start.x = globalCtx->csCtx.npcActions[1]->startPos.x; - start.y = globalCtx->csCtx.npcActions[1]->startPos.y; - start.z = globalCtx->csCtx.npcActions[1]->startPos.z; + start.x = play->csCtx.npcActions[1]->startPos.x; + start.y = play->csCtx.npcActions[1]->startPos.y; + start.z = play->csCtx.npcActions[1]->startPos.z; - end.x = globalCtx->csCtx.npcActions[1]->endPos.x; - end.y = globalCtx->csCtx.npcActions[1]->endPos.y; - end.z = globalCtx->csCtx.npcActions[1]->endPos.z; + end.x = play->csCtx.npcActions[1]->endPos.x; + end.y = play->csCtx.npcActions[1]->endPos.y; + end.z = play->csCtx.npcActions[1]->endPos.z; - weight = Environment_LerpWeight(globalCtx->csCtx.npcActions[1]->endFrame, - globalCtx->csCtx.npcActions[1]->startFrame, globalCtx->csCtx.frames); + weight = Environment_LerpWeight(play->csCtx.npcActions[1]->endFrame, + play->csCtx.npcActions[1]->startFrame, play->csCtx.frames); Matrix_Translate((end.x - start.x) * weight + start.x, (end.y - start.y) * weight + start.y, (end.z - start.z) * weight + start.z, MTXMODE_NEW); Matrix_Scale(this->effects[0].size, this->effects[0].size, this->effects[0].size, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (u8)(105 * this->effects[0].amplitude) + 150, 255, (u8)(105 * this->effects[0].amplitude) + 150, this->effects[0].alpha); @@ -874,8 +874,8 @@ void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCt (u8)(255 * this->effects[0].amplitude), 255 - (u8)(255 * this->effects[0].amplitude), this->effects[0].alpha); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80BA5900[this->effects[0].timer])); @@ -886,11 +886,11 @@ void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCt } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjectKankyo_InitBeams(ObjectKankyo* this, GlobalContext* globalCtx) { - s32 objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_DEMO_KEKKAI); +void ObjectKankyo_InitBeams(ObjectKankyo* this, PlayState* play) { + s32 objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_DEMO_KEKKAI); if (objectIndex < 0) { ASSERT(objectIndex < 0); @@ -900,20 +900,20 @@ void ObjectKankyo_InitBeams(ObjectKankyo* this, GlobalContext* globalCtx) { ObjectKankyo_SetupAction(this, ObjectKankyo_WaitForBeamObject); } -void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->requiredObjectLoaded = true; this->actor.objBankIndex = this->requiredObjBankIndex; ObjectKankyo_SetupAction(this, ObjectKankyo_Beams); } } -void ObjectKankyo_Beams(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_Beams(ObjectKankyo* this, PlayState* play) { u8 i; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { for (i = 0; i < 6; i++) { - if (globalCtx->csCtx.npcActions[i + 1] != NULL && globalCtx->csCtx.npcActions[i + 1]->action == 2) { + if (play->csCtx.npcActions[i + 1] != NULL && play->csCtx.npcActions[i + 1]->action == 2) { if (this->effects[i].size == 0.1f) { func_800F3F3C(11); } @@ -923,7 +923,7 @@ void ObjectKankyo_Beams(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { +void ObjectKankyo_DrawBeams(ObjectKankyo* this2, PlayState* play2) { static Color_RGB8 sBeamPrimColors[] = { { 255, 255, 170 }, { 170, 255, 255 }, { 255, 170, 255 }, { 255, 255, 170 }, { 255, 255, 170 }, { 255, 255, 170 }, @@ -932,7 +932,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { { 0, 200, 0 }, { 0, 50, 255 }, { 100, 0, 200 }, { 200, 0, 0 }, { 200, 255, 0 }, { 255, 120, 0 }, }; ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 i; f32 beamX[] = { 430.0f, 860.0f, 430.0f, -426.0f, -862.0f, -440.0f }; f32 beamY[] = { 551.0f, 551.0f, 551.0f, 554.0f, 551.0f, 547.0f }; @@ -940,7 +940,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { f32 beamYaw[] = { 29.9f, 90.0f, 150.0f, 30.0f, 90.0f, -30.1f }; f32 beamPitch[] = { 103.4f, 103.8f, 103.6f, -103.4f, -103.5f, 103.5f }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->requiredObjectLoaded) { for (i = 0; i < 6; i++) { @@ -950,24 +950,24 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { Matrix_RotateY(DEG_TO_RAD(beamYaw[i]), MTXMODE_APPLY); Matrix_RotateX(DEG_TO_RAD(beamPitch[i]), MTXMODE_APPLY); Matrix_Scale(this->effects[i].size, 0.1f, this->effects[i].size, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, sBeamPrimColors[i].r, sBeamPrimColors[i].g, sBeamPrimColors[i].b, 128); gDPSetEnvColor(POLY_XLU_DISP++, sBeamEnvColors[i].r, sBeamEnvColors[i].g, sBeamEnvColors[i].b, 128); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 5, - globalCtx->state.frames * 10, 32, 64, 1, globalCtx->state.frames * 5, - globalCtx->state.frames * 10, 32, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->state.frames * 5, + play->state.frames * 10, 32, 64, 1, play->state.frames * 5, + play->state.frames * 10, 32, 64)); gSPDisplayList(POLY_XLU_DISP++, gDemoKekkaiDL_005FF0); FrameInterpolation_RecordCloseChild(); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void ObjectKankyo_Reset(void) { diff --git a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h index fc45e156e..a60d7dbef 100644 --- a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h +++ b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h @@ -6,7 +6,7 @@ struct ObjectKankyo; -typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, GlobalContext*); +typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, PlayState*); typedef struct ObjectKankyoEffect { /* 0x00 */ u8 state; diff --git a/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index cbd5e1793..f2a0a2221 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffSpot_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffSpot_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffSpot_Init(Actor* thisx, PlayState* play); +void OceffSpot_Destroy(Actor* thisx, PlayState* play); +void OceffSpot_Update(Actor* thisx, PlayState* play); +void OceffSpot_Draw(Actor* thisx, PlayState* play); -void OceffSpot_GrowCylinder(OceffSpot* this, GlobalContext* globalCtx); +void OceffSpot_GrowCylinder(OceffSpot* this, PlayState* play); const ActorInit Oceff_Spot_InitVars = { ACTOR_OCEFF_SPOT, @@ -40,7 +40,7 @@ void OceffSpot_SetupAction(OceffSpot* this, OceffSpotActionFunc actionFunc) { this->actionFunc = actionFunc; } -void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Init(Actor* thisx, PlayState* play) { s32 pad; OceffSpot* this = (OceffSpot*)thisx; @@ -49,11 +49,11 @@ void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->lightInfo1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->lightNode1 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo1); + this->lightNode1 = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo1); Lights_PointNoGlowSetInfo(&this->lightInfo2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->lightNode2 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo2); + this->lightNode2 = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo2); if (YREG(15)) { this->actor.scale.y = 2.4f; } else { @@ -63,27 +63,27 @@ void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_174 = 0.0f; } -void OceffSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Destroy(Actor* thisx, PlayState* play) { s32 pad; OceffSpot* this = (OceffSpot*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode1); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode2); - func_800876C8(globalCtx); - if ((gSaveContext.nayrusLoveTimer != 0) && (globalCtx->actorCtx.actorLists[ACTORCAT_PLAYER].length != 0)) { + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode1); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode2); + func_800876C8(play); + if ((gSaveContext.nayrusLoveTimer != 0) && (play->actorCtx.actorLists[ACTORCAT_PLAYER].length != 0)) { player->stateFlags3 |= 0x40; } } -void OceffSpot_End(OceffSpot* this, GlobalContext* globalCtx) { +void OceffSpot_End(OceffSpot* this, PlayState* play) { if (this->unk_174 > 0.0f) { this->unk_174 -= 0.05f; } else { Actor_Kill(&this->actor); - if (gTimeIncrement != 400 && globalCtx->msgCtx.unk_E40E == 0 && (gSaveContext.eventInf[0] & 0xF) != 1) { - if (globalCtx->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE || - globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_08) { + if (gTimeIncrement != 400 && play->msgCtx.unk_E40E == 0 && (gSaveContext.eventInf[0] & 0xF) != 1) { + if (play->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE || + play->msgCtx.ocarinaMode != OCARINA_MODE_08) { gSaveContext.sunsSongState = SUNSSONG_START; osSyncPrintf(VT_FGCOL(YELLOW)); // "Sun's Song Flag" @@ -91,7 +91,7 @@ void OceffSpot_End(OceffSpot* this, GlobalContext* globalCtx) { osSyncPrintf(VT_RST); } } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; osSyncPrintf(VT_FGCOL(YELLOW)); // "Ocarina End" osSyncPrintf("z_oceff_spot オカリナ終了\n"); @@ -100,7 +100,7 @@ void OceffSpot_End(OceffSpot* this, GlobalContext* globalCtx) { } } -void OceffSpot_Wait(OceffSpot* this, GlobalContext* globalCtx) { +void OceffSpot_Wait(OceffSpot* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -108,7 +108,7 @@ void OceffSpot_Wait(OceffSpot* this, GlobalContext* globalCtx) { } } -void OceffSpot_GrowCylinder(OceffSpot* this, GlobalContext* globalCtx) { +void OceffSpot_GrowCylinder(OceffSpot* this, PlayState* play) { if (this->unk_174 < 1.0f) { this->unk_174 += 0.05f; } else { @@ -117,14 +117,14 @@ void OceffSpot_GrowCylinder(OceffSpot* this, GlobalContext* globalCtx) { } } -void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Update(Actor* thisx, PlayState* play) { OceffSpot* this = (OceffSpot*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 temp; temp = (1.0f - cosf(this->unk_174 * M_PI)) * 0.5f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.scale.z = 0.42f * temp; this->actor.scale.x = 0.42f * temp; @@ -133,7 +133,7 @@ void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y += 5.0f; temp = (2.0f - this->unk_174) * this->unk_174; - Environment_AdjustLights(globalCtx, temp * 0.5F, 880.0f, 0.2f, 0.9f); + Environment_AdjustLights(play, temp * 0.5F, 880.0f, 0.2f, 0.9f); Lights_PointNoGlowSetInfo(&this->lightInfo1, (s16)this->actor.world.pos.x, (s16)this->actor.world.pos.y + 55.0f, (s16)this->actor.world.pos.z, (s32)(255.0f * temp), (s32)(255.0f * temp), @@ -146,20 +146,20 @@ void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { (s32)(255.0f * temp), (s32)(255.0f * temp), (s32)(200.0f * temp), (s16)(100.0f * temp)); } -void OceffSpot_Draw(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Draw(Actor* thisx, PlayState* play) { OceffSpot* this = (OceffSpot*)thisx; - u32 scroll = globalCtx->state.frames & 0xFFFF; + u32 scroll = play->state.frames & 0xFFFF; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - 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++, sCylinderMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 32, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 32, 1, 0, scroll * (-8), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sCylinderModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h b/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h index a63890e53..a96f1878a 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h +++ b/soh/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h @@ -6,7 +6,7 @@ struct OceffSpot; -typedef void (*OceffSpotActionFunc)(struct OceffSpot*, GlobalContext*); +typedef void (*OceffSpotActionFunc)(struct OceffSpot*, PlayState*); typedef struct OceffSpot { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index bdd970471..852d85dc7 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -8,15 +8,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void OceffStorm_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffStorm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffStorm_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffStorm_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffStorm_Init(Actor* thisx, PlayState* play); +void OceffStorm_Destroy(Actor* thisx, PlayState* play); +void OceffStorm_Update(Actor* thisx, PlayState* play); +void OceffStorm_Draw(Actor* thisx, PlayState* play); -void OceffStorm_Draw2(Actor* thisx, GlobalContext* globalCtx); +void OceffStorm_Draw2(Actor* thisx, PlayState* play); -void OceffStorm_DefaultAction(OceffStorm* this, GlobalContext* globalCtx); -void OceffStorm_UnkAction(OceffStorm* this, GlobalContext* globalCtx); +void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play); +void OceffStorm_UnkAction(OceffStorm* this, PlayState* play); const ActorInit Oceff_Storm_InitVars = { ACTOR_OCEFF_STORM, @@ -35,7 +35,7 @@ void OceffStorm_SetupAction(OceffStorm* this, OceffStormActionFunc actionFunc) { this->actionFunc = actionFunc; } -void OceffStorm_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffStorm_Init(Actor* thisx, PlayState* play) { OceffStorm* this = (OceffStorm*)thisx; OceffStorm_SetupAction(this, OceffStorm_DefaultAction); this->posYOffAdd = 0; @@ -51,22 +51,22 @@ void OceffStorm_Init(Actor* thisx, GlobalContext* globalCtx) { OceffStorm_SetupAction(this, OceffStorm_UnkAction); this->actor.draw = OceffStorm_Draw2; } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y - 30.0f, this->actor.world.pos.z, 0, 0, 0, 1); } } -void OceffStorm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffStorm_Destroy(Actor* thisx, PlayState* play) { OceffStorm* this = (OceffStorm*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= 0x40; } } -void OceffStorm_DefaultAction(OceffStorm* this, GlobalContext* globalCtx) { +void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play) { if (this->counter < 20) { this->primColorAlpha = (s8)(this->counter * 5.0f); } else if (this->counter > 80) { @@ -105,29 +105,29 @@ void OceffStorm_DefaultAction(OceffStorm* this, GlobalContext* globalCtx) { } } -void OceffStorm_UnkAction(OceffStorm* this, GlobalContext* globalCtx) { +void OceffStorm_UnkAction(OceffStorm* this, PlayState* play) { if (this->primColorAlpha < 100) { this->primColorAlpha += 5; } //! @bug Actor_Kill is never called so the actor will stay alive forever } -void OceffStorm_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffStorm_Update(Actor* thisx, PlayState* play) { OceffStorm* this = (OceffStorm*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->actor.world.pos = player->actor.world.pos; - this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); - this->actionFunc(this, globalCtx); + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); + this->actionFunc(this, play); } #include "overlays/ovl_Oceff_Storm/ovl_Oceff_Storm.h" -void OceffStorm_Draw2(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffStorm_Draw2(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffStorm* this = (OceffStorm*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); @@ -136,23 +136,23 @@ void OceffStorm_Draw2(Actor* thisx, GlobalContext* globalCtx) { gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 200, 200, 150, this->primColorAlpha); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 8, scroll * 4, 64, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 8, scroll * 4, 64, 64, 1, scroll * 4, scroll * 4, 64, 64)); gSPWideTextureRectangle(POLY_XLU_DISP++, OTRGetRectDimensionFromLeftEdge(0) << 2, 0, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH) << 2, 0x03C0, G_TX_RENDERTILE, 0, 0, 0x008C, -0x008C); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void OceffStorm_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffStorm_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffStorm* this = (OceffStorm*)thisx; Vtx* vtxPtr = ResourceMgr_LoadVtxByName(sCylinderVtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 200, 255); gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 0, 128); @@ -162,15 +162,15 @@ void OceffStorm_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[0].v.cn[3] = vtxPtr[6].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[25].v.cn[3] = this->vtxAlpha >> 1; vtxPtr[10].v.cn[3] = vtxPtr[22].v.cn[3] = this->vtxAlpha; - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sCylinderMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 4, (0 - scroll) * 8, 32, 32, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 4, (0 - scroll) * 8, 32, 32, 1, scroll * 8, (0 - scroll) * 12, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sCylinderModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - OceffStorm_Draw2(&this->actor, globalCtx); + OceffStorm_Draw2(&this->actor, play); } diff --git a/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h b/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h index a566d5896..e4b831a20 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h +++ b/soh/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h @@ -6,7 +6,7 @@ struct OceffStorm; -typedef void (*OceffStormActionFunc)(struct OceffStorm*, GlobalContext*); +typedef void (*OceffStormActionFunc)(struct OceffStorm*, PlayState*); typedef struct OceffStorm { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index e312cb7d8..4234f3cb2 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe_Init(Actor* thisx, PlayState* play); +void OceffWipe_Destroy(Actor* thisx, PlayState* play); +void OceffWipe_Update(Actor* thisx, PlayState* play); +void OceffWipe_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe_InitVars = { ACTOR_OCEFF_WIPE, @@ -27,29 +27,29 @@ const ActorInit Oceff_Wipe_InitVars = { NULL, }; -void OceffWipe_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe_Init(Actor* thisx, PlayState* play) { OceffWipe* this = (OceffWipe*)thisx; Actor_SetScale(&this->actor, 0.1f); this->timer = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe_Destroy(Actor* thisx, PlayState* play) { OceffWipe* this = (OceffWipe*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= 0x40; } } -void OceffWipe_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe_Update(Actor* thisx, PlayState* play) { OceffWipe* this = (OceffWipe*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->timer < 100) { this->timer++; } else { @@ -64,8 +64,8 @@ static u8 sAlphaIndices[] = { 0x10, 0x22, 0x01, 0x20, 0x12, 0x01, 0x12, 0x21, 0x01, 0x02, }; -void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFF; +void OceffWipe_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFF; OceffWipe* this = (OceffWipe*)thisx; f32 z; s32 pad; @@ -75,10 +75,10 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->timer < 32) { z = Math_SinS(this->timer << 9) * 1400; @@ -102,14 +102,14 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[i * 2 + 1].v.cn[3] = alphaTable[sAlphaIndices[i] & 0xF]; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params != OCEFF_WIPE_ZL) { @@ -121,9 +121,9 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { } gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 - scroll, scroll * (-2), 32, 32, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 - scroll, scroll * (-2), 32, 32, 1, 0 - scroll, scroll * (-2), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 746c517de..634f58a38 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe2_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe2_Init(Actor* thisx, PlayState* play); +void OceffWipe2_Destroy(Actor* thisx, PlayState* play); +void OceffWipe2_Update(Actor* thisx, PlayState* play); +void OceffWipe2_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe2_InitVars = { ACTOR_OCEFF_WIPE2, @@ -27,29 +27,29 @@ const ActorInit Oceff_Wipe2_InitVars = { NULL, }; -void OceffWipe2_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe2_Init(Actor* thisx, PlayState* play) { OceffWipe2* this = (OceffWipe2*)thisx; Actor_SetScale(&this->actor, 0.1f); this->timer = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE2 arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe2_Destroy(Actor* thisx, PlayState* play) { OceffWipe2* this = (OceffWipe2*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= 0x40; } } -void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe2_Update(Actor* thisx, PlayState* play) { OceffWipe2* this = (OceffWipe2*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->timer < 100) { this->timer++; } else { @@ -59,8 +59,8 @@ void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx) { #include "overlays/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2.h" -void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFF; +void OceffWipe2_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFF; OceffWipe2* this = (OceffWipe2*)thisx; f32 z; u8 alpha; @@ -69,8 +69,8 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); if (this->timer < 32) { z = Math_SinS(this->timer << 9) * 1330; } else { @@ -88,24 +88,24 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[18].v.cn[3] = vtxPtr[20].v.cn[3] = alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 6, scroll * (-6), 64, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 6, scroll * (-6), 64, 64, 1, scroll * (-6), 0, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 1b5f145c9..09a5a5aaf 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe3_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe3_Init(Actor* thisx, PlayState* play); +void OceffWipe3_Destroy(Actor* thisx, PlayState* play); +void OceffWipe3_Update(Actor* thisx, PlayState* play); +void OceffWipe3_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe3_InitVars = { ACTOR_OCEFF_WIPE3, @@ -29,30 +29,30 @@ const ActorInit Oceff_Wipe3_InitVars = { #include "overlays/ovl_Oceff_Wipe3/ovl_Oceff_Wipe3.h" -void OceffWipe3_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe3_Init(Actor* thisx, PlayState* play) { OceffWipe3* this = (OceffWipe3*)thisx; Actor_SetScale(&this->actor, 0.1f); this->counter = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; // it's actually WIPE3... osSyncPrintf(VT_FGCOL(CYAN) " WIPE2 arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe3_Destroy(Actor* thisx, PlayState* play) { OceffWipe3* this = (OceffWipe3*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= 0x40; } } -void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe3_Update(Actor* thisx, PlayState* play) { OceffWipe3* this = (OceffWipe3*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->counter < 100) { this->counter++; } else { @@ -60,8 +60,8 @@ void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffWipe3_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffWipe3* this = (OceffWipe3*)thisx; f32 z; u8 alpha; @@ -70,8 +70,8 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); if (this->counter < 32) { z = Math_SinS(this->counter << 9) * 1330; } else { @@ -89,24 +89,24 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[17].v.cn[3] = vtxPtr[19].v.cn[3] = vtxPtr[21].v.cn[3] = alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 128); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 12, scroll * (-12), 64, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 12, scroll * (-12), 64, 64, 1, scroll * 8, scroll * (-8), 64, 64)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index f0da9f614..90dfdf2dd 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe4_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe4_Init(Actor* thisx, PlayState* play); +void OceffWipe4_Destroy(Actor* thisx, PlayState* play); +void OceffWipe4_Update(Actor* thisx, PlayState* play); +void OceffWipe4_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe4_InitVars = { ACTOR_OCEFF_WIPE4, @@ -27,25 +27,25 @@ const ActorInit Oceff_Wipe4_InitVars = { NULL, }; -void OceffWipe4_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe4_Init(Actor* thisx, PlayState* play) { OceffWipe4* this = (OceffWipe4*)thisx; Actor_SetScale(&this->actor, 0.1f); this->timer = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE4 arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe4_Destroy(Actor* thisx, PlayState* play) { OceffWipe4* this = (OceffWipe4*)thisx; - func_800876C8(globalCtx); + func_800876C8(play); } -void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe4_Update(Actor* thisx, PlayState* play) { OceffWipe4* this = (OceffWipe4*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->timer < 50) { this->timer++; } else { @@ -55,8 +55,8 @@ void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx) { #include "overlays/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4.h" -void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffWipe4_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffWipe4* this = (OceffWipe4*)thisx; f32 z; u8 alpha; @@ -65,8 +65,8 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); if (this->timer < 16) { z = Math_SinS(this->timer * 1024) * 1330.0f; } else { @@ -84,16 +84,16 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[17].v.cn[3] = vtxPtr[19].v.cn[3] = vtxPtr[21].v.cn[3] = alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params == OCEFF_WIPE4_UNUSED) { @@ -103,9 +103,9 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { } gSPDisplayList(POLY_XLU_DISP++, sMaterial2DL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, 1, scroll * (-1), scroll, 32, 32)); gSPDisplayListOffset(POLY_XLU_DISP++, sMaterial2DL, 11); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 95e356701..0ac79927a 100644 --- a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -11,14 +11,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void ShotSun_Init(Actor* thisx, GlobalContext* globalCtx); -void ShotSun_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ShotSun_Update(Actor* thisx, GlobalContext* globalCtx); +void ShotSun_Init(Actor* thisx, PlayState* play); +void ShotSun_Destroy(Actor* thisx, PlayState* play); +void ShotSun_Update(Actor* thisx, PlayState* play); -void ShotSun_SpawnFairy(ShotSun* this, GlobalContext* globalCtx); -void ShotSun_TriggerFairy(ShotSun* this, GlobalContext* globalCtx); -void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx); -void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx); +void ShotSun_SpawnFairy(ShotSun* this, PlayState* play); +void ShotSun_TriggerFairy(ShotSun* this, PlayState* play); +void func_80BADF0C(ShotSun* this, PlayState* play); +void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play); const ActorInit Shot_Sun_InitVars = { ACTOR_SHOT_SUN, @@ -53,7 +53,7 @@ static ColliderCylinderInit sCylinderInit = { { 30, 60, 0, { 0, 0, 0 } }, }; -void ShotSun_Init(Actor* thisx, GlobalContext* globalCtx) { +void ShotSun_Init(Actor* thisx, PlayState* play) { ShotSun* this = (ShotSun*)thisx; s32 params; @@ -67,23 +67,23 @@ void ShotSun_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80BADF0C; this->actor.flags |= ACTOR_FLAG_27; } else { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actionFunc = ShotSun_UpdateHyliaSun; this->actor.flags &= ~ACTOR_FLAG_0; } } -void ShotSun_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ShotSun_Destroy(Actor* thisx, PlayState* play) { ShotSun* this = (ShotSun*)thisx; s32 params = this->actor.params & 0xFF; if (params != 0x40 && params != 0x41) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void ShotSun_SpawnFairy(ShotSun* this, GlobalContext* globalCtx) { +void ShotSun_SpawnFairy(ShotSun* this, PlayState* play) { s32 params = this->actor.params & 0xFF; s32 fairyType; @@ -100,27 +100,27 @@ void ShotSun_SpawnFairy(ShotSun* this, GlobalContext* globalCtx) { } //! @bug fairyType may be uninitialized - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, fairyType); Actor_Kill(&this->actor); } } -void ShotSun_TriggerFairy(ShotSun* this, GlobalContext* globalCtx) { +void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) { if ((func_8005B198() == this->actor.category) || (this->timer != 0)) { this->actionFunc = ShotSun_SpawnFairy; this->timer = 50; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, this->actor.home.pos.x, this->actor.home.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0x11); func_80078914(&this->actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); } } -void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BADF0C(ShotSun* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s32 params = this->actor.params & 0xFF; @@ -136,13 +136,13 @@ void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { } } if (this->unk_1A4 == 1) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->unk_1A4 = 2; - } else if (this->unk_1A4 == 2 && globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - if ((params == 0x40 && globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) || - (params == 0x41 && globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS)) { + } else if (this->unk_1A4 == 2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if ((params == 0x40 && play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) || + (params == 0x41 && play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS)) { this->actionFunc = ShotSun_TriggerFairy; - OnePointCutscene_Attention(globalCtx, &this->actor); + OnePointCutscene_Attention(play, &this->actor); this->timer = 0; } else { this->unk_1A4 = 0; @@ -152,9 +152,9 @@ void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { } } -void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { +void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { Vec3s cylinderPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnItem00* collectible; s32 pad; Vec3f spawnPos; @@ -163,16 +163,16 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_CORRECT_CHIME); osSyncPrintf(VT_FGCOL(CYAN) "SHOT_SUN HIT!!!!!!!\n" VT_RST); if ((INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE && !gSaveContext.n64ddFlag) || - !Flags_GetTreasure(globalCtx, 0x1F)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, 7); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaFireArrowsCS); + !Flags_GetTreasure(play, 0x1F)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, 7); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaFireArrowsCS); gSaveContext.cutsceneTrigger = 1; } else { spawnPos.x = 700.0f; spawnPos.y = -800.0f; spawnPos.z = 7261.0f; - collectible = Item_DropCollectible(globalCtx, &spawnPos, ITEM00_MAGIC_LARGE); + collectible = Item_DropCollectible(play, &spawnPos, ITEM00_MAGIC_LARGE); if (collectible != NULL) { collectible->unk_15A = 6000; collectible->actor.speedXZ = 0.0f; @@ -181,20 +181,20 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } else { if (!(this->actor.xzDistToPlayer > 120.0f) && gSaveContext.dayTime >= 0x4555 && gSaveContext.dayTime < 0x5000) { - cylinderPos.x = player->bodyPartsPos[7].x + globalCtx->envCtx.sunPos.x * (1.0f / 6.0f); - cylinderPos.y = player->bodyPartsPos[7].y - 30.0f + globalCtx->envCtx.sunPos.y * (1.0f / 6.0f); - cylinderPos.z = player->bodyPartsPos[7].z + globalCtx->envCtx.sunPos.z * (1.0f / 6.0f); + cylinderPos.x = player->bodyPartsPos[7].x + play->envCtx.sunPos.x * (1.0f / 6.0f); + cylinderPos.y = player->bodyPartsPos[7].y - 30.0f + play->envCtx.sunPos.y * (1.0f / 6.0f); + cylinderPos.z = player->bodyPartsPos[7].z + play->envCtx.sunPos.z * (1.0f / 6.0f); this->hitboxPos = cylinderPos; Collider_SetCylinderPosition(&this->collider, &cylinderPos); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void ShotSun_Update(Actor* thisx, GlobalContext* globalCtx) { +void ShotSun_Update(Actor* thisx, PlayState* play) { ShotSun* this = (ShotSun*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h index 19fd705f8..51b2d0e6f 100644 --- a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h +++ b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h @@ -6,7 +6,7 @@ struct ShotSun; -typedef void (*ShotSunActionFunc)(struct ShotSun*, GlobalContext*); +typedef void (*ShotSunActionFunc)(struct ShotSun*, PlayState*); typedef struct ShotSun { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 25a8ea8c1..b53e7a2a1 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -101,7 +101,7 @@ typedef struct { /* 0x00 */ s8 type; /* 0x04 */ union { void* ptr; - void (*func)(GlobalContext*, Player*, CsCmdActorAction*); + void (*func)(PlayState*, Player*, CsCmdActorAction*); }; } struct_80854B18; // size = 0x08 @@ -113,233 +113,233 @@ typedef struct { /* 0x08 */ s16 unk_08; } struct_80858AC8; // size = 0x0A -void func_80833770(GlobalContext* globalCtx, Player* this); -void func_80833790(GlobalContext* globalCtx, Player* this); -void func_8083379C(GlobalContext* globalCtx, Player* this); -void func_8083377C(GlobalContext* globalCtx, Player* this); -void func_808337D4(GlobalContext* globalCtx, Player* this); -void func_80833910(GlobalContext* globalCtx, Player* this); -void func_80833984(GlobalContext* globalCtx, Player* this); -void func_8083399C(GlobalContext* globalCtx, Player* this, s8 actionParam); -s32 func_8083485C(Player* this, GlobalContext* globalCtx); -s32 func_808349DC(Player* this, GlobalContext* globalCtx); -s32 func_80834A2C(Player* this, GlobalContext* globalCtx); -s32 func_80834B5C(Player* this, GlobalContext* globalCtx); -s32 func_80834C74(Player* this, GlobalContext* globalCtx); -s32 func_8083501C(Player* this, GlobalContext* globalCtx); -s32 func_808351D4(Player* this, GlobalContext* globalCtx); -s32 func_808353D8(Player* this, GlobalContext* globalCtx); -s32 func_80835588(Player* this, GlobalContext* globalCtx); -s32 func_808356E8(Player* this, GlobalContext* globalCtx); -s32 func_80835800(Player* this, GlobalContext* globalCtx); -s32 func_80835884(Player* this, GlobalContext* globalCtx); // Start aiming boomerang -s32 func_808358F0(Player* this, GlobalContext* globalCtx); // Aim boomerang -s32 func_808359FC(Player* this, GlobalContext* globalCtx); // Throw boomerang -s32 func_80835B60(Player* this, GlobalContext* globalCtx); // Boomerang active -s32 func_80835C08(Player* this, GlobalContext* globalCtx); -void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item); -void func_80839F90(Player* this, GlobalContext* globalCtx); -s32 func_80838A14(Player* this, GlobalContext* globalCtx); -s32 func_80839800(Player* this, GlobalContext* globalCtx); -s32 func_8083B040(Player* this, GlobalContext* globalCtx); -s32 func_8083B998(Player* this, GlobalContext* globalCtx); -s32 func_8083B644(Player* this, GlobalContext* globalCtx); -s32 func_8083BDBC(Player* this, GlobalContext* globalCtx); -s32 func_8083C1DC(Player* this, GlobalContext* globalCtx); -s32 func_8083C2B0(Player* this, GlobalContext* globalCtx); -s32 func_8083C544(Player* this, GlobalContext* globalCtx); -s32 func_8083C61C(GlobalContext* globalCtx, Player* this); -void func_8083CA20(GlobalContext* globalCtx, Player* this); -void func_8083CA54(GlobalContext* globalCtx, Player* this); -void func_8083CA9C(GlobalContext* globalCtx, Player* this); -s32 func_8083E0FC(Player* this, GlobalContext* globalCtx); -void Player_SetPendingFlag(Player* this, GlobalContext* globalCtx); -s32 func_8083E5A8(Player* this, GlobalContext* globalCtx); -s32 func_8083EB44(Player* this, GlobalContext* globalCtx); -s32 func_8083F7BC(Player* this, GlobalContext* globalCtx); -void func_80840450(Player* this, GlobalContext* globalCtx); -void func_808407CC(Player* this, GlobalContext* globalCtx); -void func_80840BC8(Player* this, GlobalContext* globalCtx); -void func_80840DE4(Player* this, GlobalContext* globalCtx); -void func_808414F8(Player* this, GlobalContext* globalCtx); -void func_8084170C(Player* this, GlobalContext* globalCtx); -void func_808417FC(Player* this, GlobalContext* globalCtx); -void func_8084193C(Player* this, GlobalContext* globalCtx); -void func_80841BA8(Player* this, GlobalContext* globalCtx); -void func_80842180(Player* this, GlobalContext* globalCtx); -void func_8084227C(Player* this, GlobalContext* globalCtx); -void func_8084279C(Player* this, GlobalContext* globalCtx); -void func_808423EC(Player* this, GlobalContext* globalCtx); -void func_8084251C(Player* this, GlobalContext* globalCtx); -void func_80843188(Player* this, GlobalContext* globalCtx); -void func_808435C4(Player* this, GlobalContext* globalCtx); -void func_8084370C(Player* this, GlobalContext* globalCtx); -void func_8084377C(Player* this, GlobalContext* globalCtx); -void func_80843954(Player* this, GlobalContext* globalCtx); -void func_80843A38(Player* this, GlobalContext* globalCtx); -void func_80843CEC(Player* this, GlobalContext* globalCtx); -void func_8084411C(Player* this, GlobalContext* globalCtx); -void func_80844708(Player* this, GlobalContext* globalCtx); -void func_80844A44(Player* this, GlobalContext* globalCtx); -void func_80844AF4(Player* this, GlobalContext* globalCtx); -void func_80844E68(Player* this, GlobalContext* globalCtx); -void func_80845000(Player* this, GlobalContext* globalCtx); -void func_80845308(Player* this, GlobalContext* globalCtx); -void func_80845668(Player* this, GlobalContext* globalCtx); -void func_808458D0(Player* this, GlobalContext* globalCtx); -void func_80845CA4(Player* this, GlobalContext* globalCtx); -void func_80845EF8(Player* this, GlobalContext* globalCtx); -void func_80846050(Player* this, GlobalContext* globalCtx); -void func_80846120(Player* this, GlobalContext* globalCtx); -void func_80846260(Player* this, GlobalContext* globalCtx); -void func_80846358(Player* this, GlobalContext* globalCtx); -void func_80846408(Player* this, GlobalContext* globalCtx); -void func_808464B0(Player* this, GlobalContext* globalCtx); -void func_80846578(Player* this, GlobalContext* globalCtx); -void func_80846648(GlobalContext* globalCtx, Player* this); -void func_80846660(GlobalContext* globalCtx, Player* this); -void func_808467D4(GlobalContext* globalCtx, Player* this); -void func_808468A8(GlobalContext* globalCtx, Player* this); -void func_808468E8(GlobalContext* globalCtx, Player* this); -void func_80846978(GlobalContext* globalCtx, Player* this); -void func_808469BC(GlobalContext* globalCtx, Player* this); -void func_80846A68(GlobalContext* globalCtx, Player* this); -void func_8084B1D8(Player* this, GlobalContext* globalCtx); -void func_8084B530(Player* this, GlobalContext* globalCtx); -void func_8084B78C(Player* this, GlobalContext* globalCtx); -void func_8084B898(Player* this, GlobalContext* globalCtx); -void func_8084B9E4(Player* this, GlobalContext* globalCtx); -void func_8084BBE4(Player* this, GlobalContext* globalCtx); -void func_8084BDFC(Player* this, GlobalContext* globalCtx); -void func_8084BF1C(Player* this, GlobalContext* globalCtx); -void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input); -void func_8084C5F8(Player* this, GlobalContext* globalCtx); -void func_8084C760(Player* this, GlobalContext* globalCtx); -void func_8084C81C(Player* this, GlobalContext* globalCtx); -void func_8084CC98(Player* this, GlobalContext* globalCtx); -void func_8084D3E4(Player* this, GlobalContext* globalCtx); -void func_8084D610(Player* this, GlobalContext* globalCtx); -void func_8084D7C4(Player* this, GlobalContext* globalCtx); -void func_8084D84C(Player* this, GlobalContext* globalCtx); -void func_8084DAB4(Player* this, GlobalContext* globalCtx); -void func_8084DC48(Player* this, GlobalContext* globalCtx); -void func_8084E1EC(Player* this, GlobalContext* globalCtx); -void func_8084E30C(Player* this, GlobalContext* globalCtx); -void func_8084E368(Player* this, GlobalContext* globalCtx); -void func_8084E3C4(Player* this, GlobalContext* globalCtx); -void func_8084E604(Player* this, GlobalContext* globalCtx); -void func_8084E6D4(Player* this, GlobalContext* globalCtx); -void func_8084E9AC(Player* this, GlobalContext* globalCtx); -void func_8084EAC0(Player* this, GlobalContext* globalCtx); -void func_8084ECA4(Player* this, GlobalContext* globalCtx); -void func_8084EED8(Player* this, GlobalContext* globalCtx); -void func_8084EFC0(Player* this, GlobalContext* globalCtx); -void func_8084F104(Player* this, GlobalContext* globalCtx); -void func_8084F390(Player* this, GlobalContext* globalCtx); -void func_8084F608(Player* this, GlobalContext* globalCtx); -void func_8084F698(Player* this, GlobalContext* globalCtx); -void func_8084F710(Player* this, GlobalContext* globalCtx); -void func_8084F88C(Player* this, GlobalContext* globalCtx); -void func_8084F9A0(Player* this, GlobalContext* globalCtx); -void func_8084F9C0(Player* this, GlobalContext* globalCtx); -void func_8084FA54(Player* this, GlobalContext* globalCtx); -void func_8084FB10(Player* this, GlobalContext* globalCtx); -void func_8084FBF4(Player* this, GlobalContext* globalCtx); -s32 func_8084FCAC(Player* this, GlobalContext* globalCtx); +void func_80833770(PlayState* play, Player* this); +void func_80833790(PlayState* play, Player* this); +void func_8083379C(PlayState* play, Player* this); +void func_8083377C(PlayState* play, Player* this); +void func_808337D4(PlayState* play, Player* this); +void func_80833910(PlayState* play, Player* this); +void func_80833984(PlayState* play, Player* this); +void func_8083399C(PlayState* play, Player* this, s8 actionParam); +s32 func_8083485C(Player* this, PlayState* play); +s32 func_808349DC(Player* this, PlayState* play); +s32 func_80834A2C(Player* this, PlayState* play); +s32 func_80834B5C(Player* this, PlayState* play); +s32 func_80834C74(Player* this, PlayState* play); +s32 func_8083501C(Player* this, PlayState* play); +s32 func_808351D4(Player* this, PlayState* play); +s32 func_808353D8(Player* this, PlayState* play); +s32 func_80835588(Player* this, PlayState* play); +s32 func_808356E8(Player* this, PlayState* play); +s32 func_80835800(Player* this, PlayState* play); +s32 func_80835884(Player* this, PlayState* play); // Start aiming boomerang +s32 func_808358F0(Player* this, PlayState* play); // Aim boomerang +s32 func_808359FC(Player* this, PlayState* play); // Throw boomerang +s32 func_80835B60(Player* this, PlayState* play); // Boomerang active +s32 func_80835C08(Player* this, PlayState* play); +void func_80835F44(PlayState* play, Player* this, s32 item); +void func_80839F90(Player* this, PlayState* play); +s32 func_80838A14(Player* this, PlayState* play); +s32 func_80839800(Player* this, PlayState* play); +s32 func_8083B040(Player* this, PlayState* play); +s32 func_8083B998(Player* this, PlayState* play); +s32 func_8083B644(Player* this, PlayState* play); +s32 func_8083BDBC(Player* this, PlayState* play); +s32 func_8083C1DC(Player* this, PlayState* play); +s32 func_8083C2B0(Player* this, PlayState* play); +s32 func_8083C544(Player* this, PlayState* play); +s32 func_8083C61C(PlayState* play, Player* this); +void func_8083CA20(PlayState* play, Player* this); +void func_8083CA54(PlayState* play, Player* this); +void func_8083CA9C(PlayState* play, Player* this); +s32 func_8083E0FC(Player* this, PlayState* play); +void Player_SetPendingFlag(Player* this, PlayState* play); +s32 func_8083E5A8(Player* this, PlayState* play); +s32 func_8083EB44(Player* this, PlayState* play); +s32 func_8083F7BC(Player* this, PlayState* play); +void func_80840450(Player* this, PlayState* play); +void func_808407CC(Player* this, PlayState* play); +void func_80840BC8(Player* this, PlayState* play); +void func_80840DE4(Player* this, PlayState* play); +void func_808414F8(Player* this, PlayState* play); +void func_8084170C(Player* this, PlayState* play); +void func_808417FC(Player* this, PlayState* play); +void func_8084193C(Player* this, PlayState* play); +void func_80841BA8(Player* this, PlayState* play); +void func_80842180(Player* this, PlayState* play); +void func_8084227C(Player* this, PlayState* play); +void func_8084279C(Player* this, PlayState* play); +void func_808423EC(Player* this, PlayState* play); +void func_8084251C(Player* this, PlayState* play); +void func_80843188(Player* this, PlayState* play); +void func_808435C4(Player* this, PlayState* play); +void func_8084370C(Player* this, PlayState* play); +void func_8084377C(Player* this, PlayState* play); +void func_80843954(Player* this, PlayState* play); +void func_80843A38(Player* this, PlayState* play); +void func_80843CEC(Player* this, PlayState* play); +void func_8084411C(Player* this, PlayState* play); +void func_80844708(Player* this, PlayState* play); +void func_80844A44(Player* this, PlayState* play); +void func_80844AF4(Player* this, PlayState* play); +void func_80844E68(Player* this, PlayState* play); +void func_80845000(Player* this, PlayState* play); +void func_80845308(Player* this, PlayState* play); +void func_80845668(Player* this, PlayState* play); +void func_808458D0(Player* this, PlayState* play); +void func_80845CA4(Player* this, PlayState* play); +void func_80845EF8(Player* this, PlayState* play); +void func_80846050(Player* this, PlayState* play); +void func_80846120(Player* this, PlayState* play); +void func_80846260(Player* this, PlayState* play); +void func_80846358(Player* this, PlayState* play); +void func_80846408(Player* this, PlayState* play); +void func_808464B0(Player* this, PlayState* play); +void func_80846578(Player* this, PlayState* play); +void func_80846648(PlayState* play, Player* this); +void func_80846660(PlayState* play, Player* this); +void func_808467D4(PlayState* play, Player* this); +void func_808468A8(PlayState* play, Player* this); +void func_808468E8(PlayState* play, Player* this); +void func_80846978(PlayState* play, Player* this); +void func_808469BC(PlayState* play, Player* this); +void func_80846A68(PlayState* play, Player* this); +void func_8084B1D8(Player* this, PlayState* play); +void func_8084B530(Player* this, PlayState* play); +void func_8084B78C(Player* this, PlayState* play); +void func_8084B898(Player* this, PlayState* play); +void func_8084B9E4(Player* this, PlayState* play); +void func_8084BBE4(Player* this, PlayState* play); +void func_8084BDFC(Player* this, PlayState* play); +void func_8084BF1C(Player* this, PlayState* play); +void Player_UpdateCommon(Player* this, PlayState* play, Input* input); +void func_8084C5F8(Player* this, PlayState* play); +void func_8084C760(Player* this, PlayState* play); +void func_8084C81C(Player* this, PlayState* play); +void func_8084CC98(Player* this, PlayState* play); +void func_8084D3E4(Player* this, PlayState* play); +void func_8084D610(Player* this, PlayState* play); +void func_8084D7C4(Player* this, PlayState* play); +void func_8084D84C(Player* this, PlayState* play); +void func_8084DAB4(Player* this, PlayState* play); +void func_8084DC48(Player* this, PlayState* play); +void func_8084E1EC(Player* this, PlayState* play); +void func_8084E30C(Player* this, PlayState* play); +void func_8084E368(Player* this, PlayState* play); +void func_8084E3C4(Player* this, PlayState* play); +void func_8084E604(Player* this, PlayState* play); +void func_8084E6D4(Player* this, PlayState* play); +void func_8084E9AC(Player* this, PlayState* play); +void func_8084EAC0(Player* this, PlayState* play); +void func_8084ECA4(Player* this, PlayState* play); +void func_8084EED8(Player* this, PlayState* play); +void func_8084EFC0(Player* this, PlayState* play); +void func_8084F104(Player* this, PlayState* play); +void func_8084F390(Player* this, PlayState* play); +void func_8084F608(Player* this, PlayState* play); +void func_8084F698(Player* this, PlayState* play); +void func_8084F710(Player* this, PlayState* play); +void func_8084F88C(Player* this, PlayState* play); +void func_8084F9A0(Player* this, PlayState* play); +void func_8084F9C0(Player* this, PlayState* play); +void func_8084FA54(Player* this, PlayState* play); +void func_8084FB10(Player* this, PlayState* play); +void func_8084FBF4(Player* this, PlayState* play); +s32 func_8084FCAC(Player* this, PlayState* play); void func_8084FF7C(Player* this); void func_8085002C(Player* this); -s32 func_80850224(Player* this, GlobalContext* globalCtx); -void func_808502D0(Player* this, GlobalContext* globalCtx); -void func_808505DC(Player* this, GlobalContext* globalCtx); -void func_8085063C(Player* this, GlobalContext* globalCtx); -void func_8085076C(Player* this, GlobalContext* globalCtx); -void func_808507F4(Player* this, GlobalContext* globalCtx); -void func_80850AEC(Player* this, GlobalContext* globalCtx); -void func_80850C68(Player* this, GlobalContext* globalCtx); -void func_80850E84(Player* this, GlobalContext* globalCtx); -void func_80851008(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851030(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851050(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851094(GlobalContext* globalCtx, Player* this, void* anim); -void func_808510B4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808510D4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808510F4(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851114(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851134(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851154(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851174(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851194(GlobalContext* globalCtx, Player* this, void* anim); -void func_808511B4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808511D4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808511FC(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851248(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851294(GlobalContext* globalCtx, Player* this, void* anim); -void func_808512E0(GlobalContext* globalCtx, Player* this, void* arg2); -void func_80851368(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808513BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808514C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085157C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808515A4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851688(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851750(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851788(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851828(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808518DC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085190C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851998(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808519C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808519EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851A50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851B90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851BE8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851CA4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851D2C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851D80(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851DEC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851E28(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851E64(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851E90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851ECC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851F84(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851FB0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852048(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852080(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852174(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808521B8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808521F4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852234(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085225C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852280(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852358(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852388(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852298(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852328(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852480(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852450(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808524B0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808524D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852514(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852544(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852554(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852564(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808525C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852608(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852648(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085283C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808528C8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852944(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808529D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852E14(Player* this, GlobalContext* globalCtx); -s32 Player_IsDroppingFish(GlobalContext* globalCtx); -s32 Player_StartFishing(GlobalContext* globalCtx); -s32 func_80852F38(GlobalContext* globalCtx, Player* this); -s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode); -void func_80853080(Player* this, GlobalContext* globalCtx); -s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage); -s32 Player_InflictDamageModified(GlobalContext* globalCtx, s32 damage, u8 modified); -void func_80853148(GlobalContext* globalCtx, Actor* actor); +s32 func_80850224(Player* this, PlayState* play); +void func_808502D0(Player* this, PlayState* play); +void func_808505DC(Player* this, PlayState* play); +void func_8085063C(Player* this, PlayState* play); +void func_8085076C(Player* this, PlayState* play); +void func_808507F4(Player* this, PlayState* play); +void func_80850AEC(Player* this, PlayState* play); +void func_80850C68(Player* this, PlayState* play); +void func_80850E84(Player* this, PlayState* play); +void func_80851008(PlayState* play, Player* this, void* anim); +void func_80851030(PlayState* play, Player* this, void* anim); +void func_80851050(PlayState* play, Player* this, void* anim); +void func_80851094(PlayState* play, Player* this, void* anim); +void func_808510B4(PlayState* play, Player* this, void* anim); +void func_808510D4(PlayState* play, Player* this, void* anim); +void func_808510F4(PlayState* play, Player* this, void* anim); +void func_80851114(PlayState* play, Player* this, void* anim); +void func_80851134(PlayState* play, Player* this, void* anim); +void func_80851154(PlayState* play, Player* this, void* anim); +void func_80851174(PlayState* play, Player* this, void* anim); +void func_80851194(PlayState* play, Player* this, void* anim); +void func_808511B4(PlayState* play, Player* this, void* anim); +void func_808511D4(PlayState* play, Player* this, void* anim); +void func_808511FC(PlayState* play, Player* this, void* anim); +void func_80851248(PlayState* play, Player* this, void* anim); +void func_80851294(PlayState* play, Player* this, void* anim); +void func_808512E0(PlayState* play, Player* this, void* arg2); +void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085157C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808515A4(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808518DC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851998(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808519C0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808519EC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851B90(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851DEC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851E28(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851E64(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851E90(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851ECC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851F84(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852048(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852080(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852174(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808521B8(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808521F4(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852234(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085225C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852280(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852480(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808524B0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808524D0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852514(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852544(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852554(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852564(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808525C0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852608(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852648(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852E14(Player* this, PlayState* play); +s32 Player_IsDroppingFish(PlayState* play); +s32 Player_StartFishing(PlayState* play); +s32 func_80852F38(PlayState* play, Player* this); +s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode); +void func_80853080(Player* this, PlayState* play); +s32 Player_InflictDamage(PlayState* play, s32 damage); +s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified); +void func_80853148(PlayState* play, Actor* actor); // .bss part 1 static s32 D_80858AA0; @@ -1057,7 +1057,7 @@ u8 gWalkSpeedToggle1; u8 gWalkSpeedToggle2; // Used to map action params to update functions -static s32 (*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = { +static s32 (*D_80853EDC[])(Player* this, PlayState* play) = { func_8083485C, func_8083485C, func_8083485C, func_808349DC, func_808349DC, func_808349DC, func_8083485C, func_8083485C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_808356E8, func_808356E8, func_80835800, @@ -1071,7 +1071,7 @@ static s32 (*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = { func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, }; -static void (*D_80853FE8[])(GlobalContext* globalCtx, Player* this) = { +static void (*D_80853FE8[])(PlayState* play, Player* this) = { func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_8083377C, func_80833790, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_80833910, func_80833910, func_808337D4, func_808337D4, func_80833984, @@ -1286,26 +1286,26 @@ s32 func_80832224(Player* this) { this->unk_6AD = 0; } -s32 func_8083224C(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 func_8083224C(PlayState* play) { + Player* this = GET_PLAYER(play); return CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_8); } -void func_80832264(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime, anim); +void func_80832264(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayOnce(play, &this->skelAnime, anim); } -void func_80832284(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime, anim); +void func_80832284(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayLoop(play, &this->skelAnime, anim); } -void func_808322A4(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayLoopSetSpeed(globalCtx, &this->skelAnime, anim, 2.0f / 3.0f); +void func_808322A4(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, 2.0f / 3.0f); } -void func_808322D0(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 2.0f / 3.0f); +void func_808322D0(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 2.0f / 3.0f); } void func_808322FC(Player* this) { @@ -1319,13 +1319,13 @@ void func_80832318(Player* this) { this->swordInfo[0].active = this->swordInfo[1].active = this->swordInfo[2].active = 0; } -void func_80832340(GlobalContext* globalCtx, Player* this) { +void func_80832340(PlayState* play, Player* this) { Camera* camera; if (this->unk_46C != SUBCAM_NONE) { - camera = globalCtx->cameraPtrs[this->unk_46C]; + camera = play->cameraPtrs[this->unk_46C]; if ((camera != NULL) && (camera->csId == 1100)) { - OnePointCutscene_EndCutscene(globalCtx, this->unk_46C); + OnePointCutscene_EndCutscene(play, this->unk_46C); this->unk_46C = SUBCAM_NONE; } } @@ -1333,7 +1333,7 @@ void func_80832340(GlobalContext* globalCtx, Player* this) { this->stateFlags2 &= ~(PLAYER_STATE2_10 | PLAYER_STATE2_11); } -void func_808323B4(GlobalContext* globalCtx, Player* this) { +void func_808323B4(PlayState* play, Player* this) { Actor* heldActor = this->heldActor; if ((heldActor != NULL) && !Player_HoldsHookshot(this)) { @@ -1345,12 +1345,12 @@ void func_808323B4(GlobalContext* globalCtx, Player* this) { } if (Player_GetExplosiveHeld(this) >= 0) { - func_8083399C(globalCtx, this, PLAYER_AP_NONE); + func_8083399C(play, this, PLAYER_AP_NONE); this->heldItemId = ITEM_NONE_FE; } } -void func_80832440(GlobalContext* globalCtx, Player* this) { +void func_80832440(PlayState* play, Player* this) { if ((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor == NULL)) { if (this->interactRangeActor != NULL) { if (this->getItemId == GI_NONE) { @@ -1365,8 +1365,8 @@ void func_80832440(GlobalContext* globalCtx, Player* this) { func_80832318(this); this->unk_6AD = 0; - func_80832340(globalCtx, this); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_80832340(play, this); + func_8005B1A4(Play_GetCamera(play, 0)); this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_20 | PLAYER_STATE1_21); this->stateFlags2 &= ~(PLAYER_STATE2_4 | PLAYER_STATE2_7 | PLAYER_STATE2_18); @@ -1377,18 +1377,18 @@ void func_80832440(GlobalContext* globalCtx, Player* this) { this->unk_845 = this->unk_844 = 0; } -s32 func_80832528(GlobalContext* globalCtx, Player* this) { +s32 func_80832528(PlayState* play, Player* this) { if (this->heldItemActionParam >= PLAYER_AP_FISHING_POLE) { - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); return 1; } else { return 0; } } -void func_80832564(GlobalContext* globalCtx, Player* this) { - func_80832440(globalCtx, this); - func_808323B4(globalCtx, this); +void func_80832564(PlayState* play, Player* this) { + func_80832440(play, this); + func_808323B4(play, this); } s32 func_80832594(Player* this, s32 arg1, s32 arg2) { @@ -1403,9 +1403,9 @@ s32 func_80832594(Player* this, s32 arg1, s32 arg2) { return this->unk_850 > arg2; } -void func_80832630(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.freezeFlashTimer == 0) { - globalCtx->actorCtx.freezeFlashTimer = 1; +void func_80832630(PlayState* play) { + if (play->actorCtx.freezeFlashTimer == 0) { + play->actorCtx.freezeFlashTimer = 1; } } @@ -1525,31 +1525,31 @@ void func_80832924(Player* this, struct_80832924* entry) { } while (cont); } -void func_80832B0C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, +void func_80832B0C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); } -void func_80832B78(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 2.0f / 3.0f, 0.0f, Animation_GetLastFrame(anim), +void func_80832B78(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 2.0f / 3.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); } -void func_80832BE8(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); +void func_80832BE8(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); } -void func_80832C2C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); +void func_80832C2C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); } -void func_80832C6C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -16.0f); +void func_80832C6C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -16.0f); } -s32 func_80832CB0(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, anim); +s32 func_80832CB0(PlayState* play, Player* this, LinkAnimationHeader* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, anim); return 1; } else { return 0; @@ -1615,7 +1615,7 @@ void func_80832E48(Player* this, s32 flags) { func_808322FC(this); } -void func_80832F54(GlobalContext* globalCtx, Player* this, s32 flags) { +void func_80832F54(PlayState* play, Player* this, s32 flags) { if (flags & 0x200) { func_80832D20(this); } else if ((flags & 0x100) || (this->skelAnime.moveFlags != 0)) { @@ -1627,44 +1627,44 @@ void func_80832F54(GlobalContext* globalCtx, Player* this, s32 flags) { this->skelAnime.moveFlags = flags; func_80832210(this); - AnimationContext_DisableQueue(globalCtx); + AnimationContext_DisableQueue(play); } -void func_80832FFC(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, playbackSpeed); - func_80832F54(globalCtx, this, flags); +void func_80832FFC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, playbackSpeed); + func_80832F54(play, this, flags); } -void func_8083303C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_80832FFC(globalCtx, this, anim, flags, 1.0f); +void func_8083303C(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_80832FFC(play, this, anim, flags, 1.0f); } -void func_80833064(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_80832FFC(globalCtx, this, anim, flags, 2.0f / 3.0f); +void func_80833064(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_80832FFC(play, this, anim, flags, 2.0f / 3.0f); } -void func_8083308C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - func_80833064(globalCtx, this, anim, 0x1C); +void func_8083308C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + func_80833064(play, this, anim, 0x1C); } -void func_808330AC(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { - LinkAnimation_PlayLoopSetSpeed(globalCtx, &this->skelAnime, anim, playbackSpeed); - func_80832F54(globalCtx, this, flags); +void func_808330AC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, playbackSpeed); + func_80832F54(play, this, flags); } -void func_808330EC(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_808330AC(globalCtx, this, anim, flags, 1.0f); +void func_808330EC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_808330AC(play, this, anim, flags, 1.0f); } -void func_80833114(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_808330AC(globalCtx, this, anim, flags, 2.0f / 3.0f); +void func_80833114(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_808330AC(play, this, anim, flags, 2.0f / 3.0f); } -void func_8083313C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - func_80833114(globalCtx, this, anim, 0x1C); +void func_8083313C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + func_80833114(play, this, anim, 0x1C); } -void func_8083315C(GlobalContext* globalCtx, Player* this) { +void func_8083315C(PlayState* play, Player* this) { s8 phi_v1; s8 phi_v0; @@ -1673,7 +1673,7 @@ void func_8083315C(GlobalContext* globalCtx, Player* this) { func_80077D10(&D_808535D4, &D_808535D8, sControlInput); - D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)) + D_808535D8; + D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + D_808535D8; this->unk_846 = (this->unk_846 + 1) % 4; @@ -1689,8 +1689,8 @@ void func_8083315C(GlobalContext* globalCtx, Player* this) { this->unk_84B[this->unk_846] = phi_v0; } -void func_8083328C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* linkAnim) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, linkAnim, D_808535E8); +void func_8083328C(PlayState* play, Player* this, LinkAnimationHeader* linkAnim) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, linkAnim, D_808535E8); } s32 func_808332B8(Player* this) { @@ -1701,7 +1701,7 @@ s32 func_808332E4(Player* this) { return (this->stateFlags1 & PLAYER_STATE1_24); } -void func_808332F4(Player* this, GlobalContext* globalCtx) { +void func_808332F4(Player* this, PlayState* play) { GetItemEntry giEntry; if (this->getItemEntry.objectId == OBJECT_INVALID) { giEntry = ItemTable_Retrieve(this->getItemId); @@ -1800,7 +1800,7 @@ void func_80833638(Player* this, PlayerFunc82C arg1) { func_808326F0(this); } -void func_80833664(GlobalContext* globalCtx, Player* this, s8 actionParam) { +void func_80833664(PlayState* play, Player* this, s8 actionParam) { LinkAnimationHeader* current = this->skelAnime.animation; LinkAnimationHeader** iter = &D_80853914[0][this->modelAnimType]; u32 i; @@ -1814,7 +1814,7 @@ void func_80833664(GlobalContext* globalCtx, Player* this, s8 actionParam) { iter += ARRAY_COUNT(D_80853914[0]); } - func_8083399C(globalCtx, this, actionParam); + func_8083399C(play, this, actionParam); if (i < ARRAY_COUNT(D_80853914)) { // fake match @@ -1835,17 +1835,17 @@ s8 Player_ItemToActionParam(s32 item) { } } -void func_80833770(GlobalContext* globalCtx, Player* this) { +void func_80833770(PlayState* play, Player* this) { } -void func_8083377C(GlobalContext* globalCtx, Player* this) { +void func_8083377C(PlayState* play, Player* this) { this->unk_85C = 1.0f; } -void func_80833790(GlobalContext* globalCtx, Player* this) { +void func_80833790(PlayState* play, Player* this) { } -void func_8083379C(GlobalContext* globalCtx, Player* this) { +void func_8083379C(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_3; if (this->heldItemActionParam != PLAYER_AP_SLINGSHOT) { @@ -1855,27 +1855,27 @@ void func_8083379C(GlobalContext* globalCtx, Player* this) { } } -void func_808337D4(GlobalContext* globalCtx, Player* this) { +void func_808337D4(PlayState* play, Player* this) { s32 explosiveType; ExplosiveInfo* explosiveInfo; Actor* spawnedActor; if (this->stateFlags1 & PLAYER_STATE1_11) { - func_80832528(globalCtx, this); + func_80832528(play, this); return; } explosiveType = Player_GetExplosiveHeld(this); explosiveInfo = &sExplosiveInfos[explosiveType]; - spawnedActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, explosiveInfo->actorId, + spawnedActor = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, explosiveInfo->actorId, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); if (spawnedActor != NULL) { - if ((explosiveType != 0) && (globalCtx->bombchuBowlingStatus != 0)) { - globalCtx->bombchuBowlingStatus--; - if (globalCtx->bombchuBowlingStatus == 0) { - globalCtx->bombchuBowlingStatus = -1; + if ((explosiveType != 0) && (play->bombchuBowlingStatus != 0)) { + play->bombchuBowlingStatus--; + if (play->bombchuBowlingStatus == 0) { + play->bombchuBowlingStatus = -1; } } else { Inventory_ChangeAmmo(explosiveInfo->itemId, -1); @@ -1890,20 +1890,20 @@ void func_808337D4(GlobalContext* globalCtx, Player* this) { } } -void func_80833910(GlobalContext* globalCtx, Player* this) { +void func_80833910(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_3; this->unk_860 = -3; this->heldActor = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_ARMS_HOOK, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ARMS_HOOK, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); } -void func_80833984(GlobalContext* globalCtx, Player* this) { +void func_80833984(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_24; } -void func_8083399C(GlobalContext* globalCtx, Player* this, s8 actionParam) { +void func_8083399C(PlayState* play, Player* this, s8 actionParam) { this->unk_860 = 0; this->unk_85C = 0.0f; this->unk_858 = 0.0f; @@ -1913,7 +1913,7 @@ void func_8083399C(GlobalContext* globalCtx, Player* this, s8 actionParam) { this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24); - D_80853FE8[actionParam](globalCtx, this); + D_80853FE8[actionParam](play, this); Player_SetModelGroup(this, this->modelGroup); } @@ -2004,11 +2004,11 @@ s32 func_80833C98(s32 item1, s32 actionParam) { } } -s32 func_80833CDC(GlobalContext* globalCtx, s32 index) { +s32 func_80833CDC(PlayState* play, s32 index) { if (index >= ((CVar_GetS32("gDpadEquips", 0) != 0) ? 8 : 4)) { return ITEM_NONE; - } else if (globalCtx->bombchuBowlingStatus != 0) { - return (globalCtx->bombchuBowlingStatus > 0) ? ITEM_BOMBCHU : ITEM_NONE; + } else if (play->bombchuBowlingStatus != 0) { + return (play->bombchuBowlingStatus > 0) ? ITEM_BOMBCHU : ITEM_NONE; } else if (index == 0) { return B_BTN_ITEM; } else if (index == 1) { @@ -2028,7 +2028,7 @@ s32 func_80833CDC(GlobalContext* globalCtx, s32 index) { } } -void func_80833DF8(Player* this, GlobalContext* globalCtx) { +void func_80833DF8(Player* this, PlayState* play) { s32 maskActionParam; s32 item; s32 i; @@ -2074,7 +2074,7 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) { } if (!func_80833C50(this, B_BTN_ITEM) && !func_80833C50(this, C_BTN_ITEM(0)) && !func_80833C50(this, C_BTN_ITEM(1)) && !func_80833C50(this, C_BTN_ITEM(2)) && !hasOnDpad) { - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); return; } } @@ -2085,7 +2085,7 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) { } } - item = func_80833CDC(globalCtx, i); + item = func_80833CDC(play, i); if (item >= ITEM_NONE_FE) { for (i = 0; i < ARRAY_COUNT(D_80854388); i++) { if (CHECK_BTN_ALL(sControlInput->cur.button, D_80854388[i])) { @@ -2093,18 +2093,18 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) { } } - item = func_80833CDC(globalCtx, i); + item = func_80833CDC(play, i); if ((item < ITEM_NONE_FE) && (Player_ItemToActionParam(item) == this->heldItemActionParam)) { D_80853618 = true; } } else { this->heldItemButton = i; - func_80835F44(globalCtx, this, item); + func_80835F44(play, this, item); } } } -void func_808340DC(Player* this, GlobalContext* globalCtx) { +void func_808340DC(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frameCount; f32 startFrame; @@ -2148,26 +2148,26 @@ void func_808340DC(Player* this, GlobalContext* globalCtx) { playSpeed *= 2.0f; } - LinkAnimation_Change(globalCtx, &this->skelAnime2, anim, playSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime2, anim, playSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); this->stateFlags1 &= ~PLAYER_STATE1_8; } -void func_80834298(Player* this, GlobalContext* globalCtx) { +void func_80834298(Player* this, PlayState* play) { if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_8) && ((this->heldItemActionParam == this->itemActionParam) || (this->stateFlags1 & PLAYER_STATE1_22)) && - (gSaveContext.health != 0) && (globalCtx->csCtx.state == CS_STATE_IDLE) && (this->csMode == 0) && - (globalCtx->shootingGalleryStatus == 0) && (globalCtx->activeCamera == MAIN_CAM) && - (globalCtx->sceneLoadFlag != 0x14) && (gSaveContext.timer1State != 10)) { - func_80833DF8(this, globalCtx); + (gSaveContext.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csMode == 0) && + (play->shootingGalleryStatus == 0) && (play->activeCamera == MAIN_CAM) && + (play->sceneLoadFlag != 0x14) && (gSaveContext.timer1State != 10)) { + func_80833DF8(this, play); } if (this->stateFlags1 & PLAYER_STATE1_8) { - func_808340DC(this, globalCtx); + func_808340DC(this, play); } } -s32 func_80834380(GlobalContext* globalCtx, Player* this, s32* itemPtr, s32* typePtr) { +s32 func_80834380(PlayState* play, Player* this, s32* itemPtr, s32* typePtr) { if (LINK_IS_ADULT) { *itemPtr = ITEM_BOW; if (this->stateFlags1 & PLAYER_STATE1_23) { @@ -2181,15 +2181,15 @@ s32 func_80834380(GlobalContext* globalCtx, Player* this, s32* itemPtr, s32* typ } if (gSaveContext.minigameState == 1) { - return globalCtx->interfaceCtx.hbaAmmo; - } else if (globalCtx->shootingGalleryStatus != 0) { - return globalCtx->shootingGalleryStatus; + return play->interfaceCtx.hbaAmmo; + } else if (play->shootingGalleryStatus != 0) { + return play->shootingGalleryStatus; } else { return AMMO(*itemPtr); } } -s32 func_8083442C(Player* this, GlobalContext* globalCtx) { +s32 func_8083442C(Player* this, PlayState* play) { s32 item; s32 arrowType; s32 magicArrowType; @@ -2206,17 +2206,17 @@ s32 func_8083442C(Player* this, GlobalContext* globalCtx) { if (this->unk_860 >= 0) { func_8002F7DC(&this->actor, D_80854398[ABS(this->unk_860) - 1]); - if (!Player_HoldsHookshot(this) && (func_80834380(globalCtx, this, &item, &arrowType) > 0)) { + if (!Player_HoldsHookshot(this) && (func_80834380(play, this, &item, &arrowType) > 0)) { magicArrowType = arrowType - ARROW_FIRE; if (this->unk_860 >= 0) { if ((magicArrowType >= 0) && (magicArrowType <= 2) && - !func_80087708(globalCtx, sMagicArrowCosts[magicArrowType], 0)) { + !func_80087708(play, sMagicArrowCosts[magicArrowType], 0)) { arrowType = ARROW_NORMAL; } this->heldActor = Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ARROW, this->actor.world.pos.x, + &play->actorCtx, &this->actor, play, ACTOR_EN_ARROW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, arrowType); } } @@ -2228,7 +2228,7 @@ s32 func_8083442C(Player* this, GlobalContext* globalCtx) { return 0; } -void func_80834594(GlobalContext* globalCtx, Player* this) { +void func_80834594(PlayState* play, Player* this) { if (this->heldItemActionParam != PLAYER_AP_NONE) { if (func_8008F2BC(this, this->heldItemActionParam) >= 0) { func_808328EC(this, NA_SE_IT_SWORD_PUTAWAY); @@ -2237,7 +2237,7 @@ void func_80834594(GlobalContext* globalCtx, Player* this) { } } - func_80835F44(globalCtx, this, this->heldItemId); + func_80835F44(play, this, this->heldItemId); if (func_8008F2BC(this, this->heldItemActionParam) >= 0) { func_808328EC(this, NA_SE_IT_SWORD_PICKOUT); @@ -2246,21 +2246,21 @@ void func_80834594(GlobalContext* globalCtx, Player* this) { } } -void func_80834644(GlobalContext* globalCtx, Player* this) { +void func_80834644(PlayState* play, Player* this) { if (func_80834A2C == this->func_82C) { - func_80834594(globalCtx, this); + func_80834594(play, this); } func_80833638(this, D_80853EDC[this->heldItemActionParam]); this->unk_834 = 0; this->unk_6AC = 0; - func_808323B4(globalCtx, this); + func_808323B4(play, this); this->stateFlags1 &= ~PLAYER_STATE1_8; } -LinkAnimationHeader* func_808346C4(GlobalContext* globalCtx, Player* this) { +LinkAnimationHeader* func_808346C4(PlayState* play, Player* this) { func_80833638(this, func_80834B5C); - func_808323B4(globalCtx, this); + func_808323B4(play, this); if (this->unk_870 < 0.5f) { return D_808543A4[Player_HoldsTwoHandedWeapon(this) && @@ -2271,18 +2271,18 @@ LinkAnimationHeader* func_808346C4(GlobalContext* globalCtx, Player* this) { } } -s32 func_80834758(GlobalContext* globalCtx, Player* this) { +s32 func_80834758(PlayState* play, Player* this) { LinkAnimationHeader* anim; f32 frame; if (!(this->stateFlags1 & (PLAYER_STATE1_22 | PLAYER_STATE1_23 | PLAYER_STATE1_29)) && - (globalCtx->shootingGalleryStatus == 0) && (this->heldItemActionParam == this->itemActionParam) && + (play->shootingGalleryStatus == 0) && (this->heldItemActionParam == this->itemActionParam) && (this->currentShield != PLAYER_SHIELD_NONE) && !Player_IsChildWithHylianShield(this) && func_80833BCC(this) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { - anim = func_808346C4(globalCtx, this); + anim = func_808346C4(play, this); frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_POSTURE); return 1; @@ -2291,8 +2291,8 @@ s32 func_80834758(GlobalContext* globalCtx, Player* this) { } } -s32 func_8083485C(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this)) { +s32 func_8083485C(Player* this, PlayState* play) { + if (func_80834758(play, this)) { return 1; } else { return 0; @@ -2310,7 +2310,7 @@ void func_80834894(Player* this) { func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_REMOVE); } -void func_808348EC(GlobalContext* globalCtx, Player* this) { +void func_808348EC(PlayState* play, Player* this) { struct_808540F4* ptr = &D_808540F4[this->unk_15A]; f32 frame; @@ -2318,15 +2318,15 @@ void func_808348EC(GlobalContext* globalCtx, Player* this) { frame = (this->skelAnime2.playSpeed < 0.0f) ? frame - 1.0f : frame; if (LinkAnimation_OnFrame(&this->skelAnime2, frame)) { - func_80834594(globalCtx, this); + func_80834594(play, this); } func_80833B54(this); } -s32 func_8083499C(Player* this, GlobalContext* globalCtx) { +s32 func_8083499C(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_8) { - func_808340DC(this, globalCtx); + func_808340DC(this, play); } else { return 0; } @@ -2334,39 +2334,39 @@ s32 func_8083499C(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_808349DC(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this) || func_8083499C(this, globalCtx)) { +s32 func_808349DC(Player* this, PlayState* play) { + if (func_80834758(play, this) || func_8083499C(this, play)) { return 1; } else { return 0; } } -s32 func_80834A2C(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2) || +s32 func_80834A2C(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime2) || ((Player_ItemToActionParam(this->heldItemId) == this->heldItemActionParam) && (D_80853614 = (D_80853614 || - ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (globalCtx->shootingGalleryStatus == 0)))))) { + ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) { func_80833638(this, D_80853EDC[this->heldItemActionParam]); this->unk_834 = 0; this->unk_6AC = 0; D_80853618 = D_80853614; - return this->func_82C(this, globalCtx); + return this->func_82C(this, play); } if (func_80833350(this) != 0) { - func_808348EC(globalCtx, this); - func_80832264(globalCtx, this, func_80833338(this)); + func_808348EC(play, this); + func_80832264(play, this, func_80833338(this)); this->unk_6AC = 0; } else { - func_808348EC(globalCtx, this); + func_808348EC(play, this); } return 1; } -s32 func_80834B5C(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime2); +s32 func_80834B5C(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime2); if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { func_80834894(this); @@ -2378,14 +2378,14 @@ s32 func_80834B5C(Player* this, GlobalContext* globalCtx) { } } -s32 func_80834BD4(Player* this, GlobalContext* globalCtx) { +s32 func_80834BD4(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { - anim = func_808346C4(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime2)) { + anim = func_808346C4(play, this); frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); } this->stateFlags1 |= PLAYER_STATE1_22; @@ -2394,25 +2394,25 @@ s32 func_80834BD4(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_80834C74(Player* this, GlobalContext* globalCtx) { +s32 func_80834C74(Player* this, PlayState* play) { D_80853614 = D_80853618; - if (D_80853614 || LinkAnimation_Update(globalCtx, &this->skelAnime2)) { + if (D_80853614 || LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, D_80853EDC[this->heldItemActionParam]); - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, D_80853914[PLAYER_ANIMGROUP_0][this->modelAnimType]); + LinkAnimation_PlayLoop(play, &this->skelAnime2, D_80853914[PLAYER_ANIMGROUP_0][this->modelAnimType]); this->unk_6AC = 0; - this->func_82C(this, globalCtx); + this->func_82C(this, play); return 0; } return 1; } -s32 func_80834D2C(Player* this, GlobalContext* globalCtx) { +s32 func_80834D2C(Player* this, PlayState* play) { LinkAnimationHeader* anim; if (this->heldItemActionParam != PLAYER_AP_BOOMERANG) { - if (!func_8083442C(this, globalCtx)) { + if (!func_8083442C(this, play)) { return 0; } @@ -2421,38 +2421,38 @@ s32 func_80834D2C(Player* this, GlobalContext* globalCtx) { } else { anim = &gPlayerAnim_link_hook_shot_ready; } - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); } else { func_80833638(this, func_80835884); this->unk_834 = 10; - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_link_boom_throw_wait2waitR); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_boom_throw_wait2waitR); } if (this->stateFlags1 & PLAYER_STATE1_23) { - func_80832284(globalCtx, this, &gPlayerAnim_link_uma_anim_walk); + func_80832284(play, this, &gPlayerAnim_link_uma_anim_walk); } else if ((this->actor.bgCheckFlags & 1) && !func_80833B54(this)) { - func_80832284(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_0][this->modelAnimType]); + func_80832284(play, this, D_80853914[PLAYER_ANIMGROUP_0][this->modelAnimType]); } return 1; } -s32 func_80834E44(GlobalContext* globalCtx) { - return (globalCtx->shootingGalleryStatus > 0) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B); +s32 func_80834E44(PlayState* play) { + return (play->shootingGalleryStatus > 0) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B); } -s32 func_80834E7C(GlobalContext* globalCtx) { +s32 func_80834E7C(PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; if (CVar_GetS32("gDpadEquips", 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } - return (globalCtx->shootingGalleryStatus != 0) && - ((globalCtx->shootingGalleryStatus < 0) || CHECK_BTN_ANY(sControlInput->cur.button, buttonsToCheck)); + return (play->shootingGalleryStatus != 0) && + ((play->shootingGalleryStatus < 0) || CHECK_BTN_ANY(sControlInput->cur.button, buttonsToCheck)); } -s32 func_80834EB8(Player* this, GlobalContext* globalCtx) { +s32 func_80834EB8(Player* this, PlayState* play) { if ((this->unk_6AD == 0) || (this->unk_6AD == 2)) { - if (func_80833BCC(this) || (Camera_CheckValidMode(Gameplay_GetCamera(globalCtx, 0), 7) == 0)) { + if (func_80833BCC(this) || (Camera_CheckValidMode(Play_GetCamera(play, 0), 7) == 0)) { return 1; } this->unk_6AD = 2; @@ -2461,11 +2461,11 @@ s32 func_80834EB8(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_80834F2C(Player* this, GlobalContext* globalCtx) { +s32 func_80834F2C(Player* this, PlayState* play) { if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_25)) { - if (D_80853614 || func_80834E44(globalCtx)) { - if (func_80834D2C(this, globalCtx)) { - return func_80834EB8(this, globalCtx); + if (D_80853614 || func_80834E44(play)) { + if (func_80834D2C(this, play)) { + return func_80834EB8(this, play); } } } @@ -2487,13 +2487,13 @@ s32 func_80834FBC(Player* this) { return 0; } -s32 func_8083501C(Player* this, GlobalContext* globalCtx) { +s32 func_8083501C(Player* this, PlayState* play) { if (this->unk_860 >= 0) { this->unk_860 = -this->unk_860; } - if ((!Player_HoldsHookshot(this) || func_80834FBC(this)) && !func_80834758(globalCtx, this) && - !func_80834F2C(this, globalCtx)) { + if ((!Player_HoldsHookshot(this) || func_80834FBC(this)) && !func_80834758(play, this) && + !func_80834F2C(this, play)) { return 0; } else if (this->rideActor != NULL) { this->unk_6AD = 2; // OTRTODO: THIS IS A BAD IDEA BUT IT FIXES THE HORSE FIRST PERSON? @@ -2502,24 +2502,24 @@ s32 func_8083501C(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_808350A4(GlobalContext* globalCtx, Player* this) { +s32 func_808350A4(PlayState* play, Player* this) { s32 item; s32 arrowType; if (this->heldActor != NULL) { if (!Player_HoldsHookshot(this)) { - func_80834380(globalCtx, this, &item, &arrowType); + func_80834380(play, this, &item, &arrowType); if (gSaveContext.minigameState == 1) { - globalCtx->interfaceCtx.hbaAmmo--; - } else if (globalCtx->shootingGalleryStatus != 0) { - globalCtx->shootingGalleryStatus--; + play->interfaceCtx.hbaAmmo--; + } else if (play->shootingGalleryStatus != 0) { + play->shootingGalleryStatus--; } else { Inventory_ChangeAmmo(item, -1); } - if (globalCtx->shootingGalleryStatus == 1) { - globalCtx->shootingGalleryStatus = -10; + if (play->shootingGalleryStatus == 1) { + play->shootingGalleryStatus = -10; } func_8083264C(this, 150, 10, 150, 0); @@ -2540,7 +2540,7 @@ s32 func_808350A4(GlobalContext* globalCtx, Player* this) { static u16 D_808543DC[] = { NA_SE_IT_BOW_FLICK, NA_SE_IT_SLING_FLICK }; -s32 func_808351D4(Player* this, GlobalContext* globalCtx) { +s32 func_808351D4(Player* this, PlayState* play) { s32 sp2C; if (!Player_HoldsHookshot(this)) { @@ -2554,10 +2554,10 @@ s32 func_808351D4(Player* this, GlobalContext* globalCtx) { if ((this->unk_836 == 0) && (func_80833350(this) == 0) && (this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, D_808543CC[sp2C]); + LinkAnimation_PlayOnce(play, &this->skelAnime2, D_808543CC[sp2C]); this->unk_836 = -1; - } else if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, D_808543D4[sp2C]); + } else if (LinkAnimation_Update(play, &this->skelAnime2)) { + LinkAnimation_PlayLoop(play, &this->skelAnime2, D_808543D4[sp2C]); this->unk_836 = 1; } else if (this->unk_836 == 1) { this->unk_836 = 2; @@ -2567,17 +2567,17 @@ s32 func_808351D4(Player* this, GlobalContext* globalCtx) { this->unk_834--; } - func_80834EB8(this, globalCtx); + func_80834EB8(this, play); - if ((this->unk_836 > 0) && ((this->unk_860 < 0) || (!D_80853618 && !func_80834E7C(globalCtx)))) { + if ((this->unk_836 > 0) && ((this->unk_860 < 0) || (!D_80853618 && !func_80834E7C(play)))) { func_80833638(this, func_808353D8); if (this->unk_860 >= 0) { if (sp2C == 0) { - if (!func_808350A4(globalCtx, this)) { + if (!func_808350A4(play, this)) { func_8002F7DC(&this->actor, D_808543DC[ABS(this->unk_860) - 1]); } } else if (this->actor.bgCheckFlags & 1) { - func_808350A4(globalCtx, this); + func_808350A4(play, this); } } this->unk_834 = 10; @@ -2589,22 +2589,22 @@ s32 func_808351D4(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_808353D8(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime2); +s32 func_808353D8(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime2); if (Player_HoldsHookshot(this) && !func_80834FBC(this)) { return 1; } - if (!func_80834758(globalCtx, this) && - (D_80853614 || ((this->unk_860 < 0) && D_80853618) || func_80834E44(globalCtx))) { + if (!func_80834758(play, this) && + (D_80853614 || ((this->unk_860 < 0) && D_80853618) || func_80834E44(play))) { this->unk_860 = ABS(this->unk_860); - if (func_8083442C(this, globalCtx)) { + if (func_8083442C(this, play)) { if (Player_HoldsHookshot(this)) { this->unk_836 = 1; } else { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_link_bow_bow_shoot_next); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_bow_bow_shoot_next); } } } else { @@ -2623,7 +2623,7 @@ s32 func_808353D8(Player* this, GlobalContext* globalCtx) { func_80833638(this, func_8083501C); } else { func_80833638(this, func_80835588); - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_link_bow_bow_shoot_end); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_bow_bow_shoot_end); } this->unk_834 = 0; @@ -2632,8 +2632,8 @@ s32 func_808353D8(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_80835588(Player* this, GlobalContext* globalCtx) { - if (!(this->actor.bgCheckFlags & 1) || LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_80835588(Player* this, PlayState* play) { + if (!(this->actor.bgCheckFlags & 1) || LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_8083501C); } @@ -2650,37 +2650,37 @@ void func_808355DC(Player* this) { this->targetYaw = this->actor.shape.rot.y; } -s32 func_80835644(GlobalContext* globalCtx, Player* this, Actor* arg2) { +s32 func_80835644(PlayState* play, Player* this, Actor* arg2) { if (arg2 == NULL) { - func_80832564(globalCtx, this); - func_80839F90(this, globalCtx); + func_80832564(play, this); + func_80839F90(this, play); return 1; } return 0; } -void func_80835688(Player* this, GlobalContext* globalCtx) { - if (!func_80835644(globalCtx, this, this->heldActor)) { +void func_80835688(Player* this, PlayState* play) { + if (!func_80835644(play, this, this->heldActor)) { func_80833638(this, func_808356E8); - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, &gPlayerAnim_link_normal_carryB_wait); + LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_link_normal_carryB_wait); } } -s32 func_808356E8(Player* this, GlobalContext* globalCtx) { +s32 func_808356E8(Player* this, PlayState* play) { Actor* heldActor = this->heldActor; if (heldActor == NULL) { - func_80834644(globalCtx, this); + func_80834644(play, this); } - if (func_80834758(globalCtx, this)) { + if (func_80834758(play, this)) { return 1; } if (this->stateFlags1 & PLAYER_STATE1_11) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, &gPlayerAnim_link_normal_carryB_wait); + if (LinkAnimation_Update(play, &this->skelAnime2)) { + LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_link_normal_carryB_wait); } if ((heldActor->id == ACTOR_EN_NIW) && (this->actor.velocity.y <= 0.0f)) { @@ -2692,62 +2692,62 @@ s32 func_808356E8(Player* this, GlobalContext* globalCtx) { return 1; } - return func_8083485C(this, globalCtx); + return func_8083485C(this, play); } void func_808357E8(Player* this, Gfx** dLists) { this->leftHandDLists = &dLists[gSaveContext.linkAge]; } -s32 func_80835800(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this)) { +s32 func_80835800(Player* this, PlayState* play) { + if (func_80834758(play, this)) { return 1; } if (this->stateFlags1 & PLAYER_STATE1_25) { func_80833638(this, func_80835B60); - } else if (func_80834F2C(this, globalCtx)) { + } else if (func_80834F2C(this, play)) { return 1; } return 0; } -s32 func_80835884(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_80835884(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_808358F0); - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, &gPlayerAnim_link_boom_throw_waitR); + LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_link_boom_throw_waitR); } - func_80834EB8(this, globalCtx); + func_80834EB8(this, play); return 1; } -s32 func_808358F0(Player* this, GlobalContext* globalCtx) { +s32 func_808358F0(Player* this, PlayState* play) { LinkAnimationHeader* animSeg = this->skelAnime.animation; if ((func_808334E4(this) == animSeg) || (func_80833528(this) == animSeg) || (func_808335B0(this) == animSeg) || (func_808335F4(this) == animSeg)) { - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime2.jointTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime2.jointTable, this->skelAnime.jointTable); } else { - LinkAnimation_Update(globalCtx, &this->skelAnime2); + LinkAnimation_Update(play, &this->skelAnime2); } - func_80834EB8(this, globalCtx); + func_80834EB8(this, play); if (!D_80853618) { func_80833638(this, func_808359FC); - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, + LinkAnimation_PlayOnce(play, &this->skelAnime2, (this->unk_870 < 0.5f) ? &gPlayerAnim_link_boom_throwR : &gPlayerAnim_link_boom_throwL); } return 1; } -s32 func_808359FC(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_808359FC(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_80835B60); this->unk_834 = 0; } else if (LinkAnimation_OnFrame(&this->skelAnime2, 6.0f)) { @@ -2755,7 +2755,7 @@ s32 func_808359FC(Player* this, GlobalContext* globalCtx) { f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.z; s32 yaw = (this->unk_664 != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; EnBoom* boomerang = - (EnBoom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, + (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, posZ, this->actor.focus.rot.x, yaw, 0, 0); this->boomerangActor = &boomerang->actor; @@ -2775,14 +2775,14 @@ s32 func_808359FC(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_80835B60(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this)) { +s32 func_80835B60(Player* this, PlayState* play) { + if (func_80834758(play, this)) { return 1; } if (!(this->stateFlags1 & PLAYER_STATE1_25)) { func_80833638(this, func_80835C08); - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_link_boom_catch); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_link_boom_catch); func_808357E8(this, D_80125EF8); func_8002F7DC(&this->actor, NA_SE_PL_CATCH_BOOMERANG); func_80832698(this, NA_SE_VO_LI_SWORD_N); @@ -2796,15 +2796,15 @@ s32 func_80835B60(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_80835C08(Player* this, GlobalContext* globalCtx) { - if (!func_80835800(this, globalCtx) && LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_80835C08(Player* this, PlayState* play) { + if (!func_80835800(this, play) && LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_80835800); } return 1; } -s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s32 flags) { +s32 func_80835C58(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { if (func == this->func_674) { return 0; } @@ -2813,7 +2813,7 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3 Audio_OcaSetInstrument(0); this->stateFlags2 &= ~(PLAYER_STATE2_24 | PLAYER_STATE2_25); } else if (func_808507F4 == this->func_674) { - func_80832340(globalCtx, this); + func_80832340(play, this); } this->func_674 = func; @@ -2824,7 +2824,7 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3 } if (!(flags & 1) && (!(this->stateFlags1 & PLAYER_STATE1_11))) { - func_80834644(globalCtx, this); + func_80834644(play, this); this->stateFlags1 &= ~PLAYER_STATE1_22; } @@ -2841,40 +2841,40 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3 return 1; } -void func_80835DAC(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s32 flags) { +void func_80835DAC(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { s32 temp; temp = this->skelAnime.moveFlags; this->skelAnime.moveFlags = 0; - func_80835C58(globalCtx, this, func, flags); + func_80835C58(play, this, func, flags); this->skelAnime.moveFlags = temp; } -void func_80835DE4(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s32 flags) { +void func_80835DE4(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { s32 temp; if (this->itemActionParam >= 0) { temp = this->itemActionParam; this->itemActionParam = this->heldItemActionParam; - func_80835C58(globalCtx, this, func, flags); + func_80835C58(play, this, func, flags); this->itemActionParam = temp; Player_SetModels(this, Player_ActionToModelGroup(this, this->itemActionParam)); } } -void func_80835E44(GlobalContext* globalCtx, s16 camSetting) { - if (!func_800C0CB8(globalCtx)) { +void func_80835E44(PlayState* play, s16 camSetting) { + if (!func_800C0CB8(play)) { if (camSetting == CAM_SET_SCENE_TRANSITION) { Interface_ChangeAlpha(2); } } else { - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), camSetting); + Camera_ChangeSetting(Play_GetCamera(play, 0), camSetting); } } -void func_80835EA4(GlobalContext* globalCtx, s32 arg1) { - func_80835E44(globalCtx, CAM_SET_TURN_AROUND); - Camera_SetCameraData(Gameplay_GetCamera(globalCtx, 0), 4, 0, 0, arg1, 0, 0); +void func_80835EA4(PlayState* play, s32 arg1) { + func_80835E44(play, CAM_SET_TURN_AROUND); + Camera_SetCameraData(Play_GetCamera(play, 0), 4, 0, 0, arg1, 0, 0); } void func_80835EFC(Player* this) { @@ -2889,7 +2889,7 @@ void func_80835EFC(Player* this) { } } -void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { +void func_80835F44(PlayState* play, Player* this, s32 item) { s8 actionParam; s32 temp; s32 nextAnimType; @@ -2907,12 +2907,12 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { ((actionParam == PLAYER_AP_HOOKSHOT) || (actionParam == PLAYER_AP_LONGSHOT))) || ((actionParam >= PLAYER_AP_SHIELD_DEKU) && (actionParam <= PLAYER_AP_BOOTS_HOVER))) { - if ((globalCtx->bombchuBowlingStatus == 0) && + if ((play->bombchuBowlingStatus == 0) && (((actionParam == PLAYER_AP_STICK) && (AMMO(ITEM_STICK) == 0)) || ((actionParam == PLAYER_AP_BEAN) && (AMMO(ITEM_BEAN) == 0)) || (temp = Player_ActionToExplosive(this, actionParam), ((temp >= 0) && ((AMMO(sExplosiveInfos[temp].itemId) == 0) || - (globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3)))))) { + (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3)))))) { func_80078884(NA_SE_SY_ERROR); return; } @@ -2924,7 +2924,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { } else { Inventory_ChangeEquipment(EQUIP_BOOTS, bootsValue); } - Player_SetEquipmentData(globalCtx, this); + Player_SetEquipmentData(play, this); func_808328EC(this, CUR_EQUIP_VALUE(EQUIP_BOOTS) == PLAYER_BOOTS_IRON + 1 ? NA_SE_PL_WALK_HEAVYBOOTS : NA_SE_PL_CHANGE_ARMS); return; @@ -2937,7 +2937,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { } else { Inventory_ChangeEquipment(EQUIP_TUNIC, tunicValue); } - Player_SetEquipmentData(globalCtx, this); + Player_SetEquipmentData(play, this); func_808328EC(this, NA_SE_PL_CHANGE_ARMS); return; } @@ -2948,13 +2948,13 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { } if (actionParam == PLAYER_AP_LENS) { - if (func_80087708(globalCtx, 0, 3)) { - if (globalCtx->actorCtx.lensActive) { - Actor_DisableLens(globalCtx); + if (func_80087708(play, 0, 3)) { + if (play->actorCtx.lensActive) { + Actor_DisableLens(play); } else { - globalCtx->actorCtx.lensActive = true; + play->actorCtx.lensActive = true; } - func_80078884((globalCtx->actorCtx.lensActive) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); + func_80078884((play->actorCtx.lensActive) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); } else { func_80078884(NA_SE_SY_ERROR); } @@ -2963,7 +2963,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { if (actionParam == PLAYER_AP_NUT) { if (AMMO(ITEM_NUT) != 0) { - func_8083C61C(globalCtx, this); + func_8083C61C(play, this); } else { func_80078884(NA_SE_SY_ERROR); } @@ -2998,7 +2998,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { (actionParam >= PLAYER_AP_BOTTLE_FISH)) { if (!func_8008E9C4(this) || ((actionParam >= PLAYER_AP_BOTTLE_POTION_RED) && (actionParam <= PLAYER_AP_BOTTLE_FAIRY))) { - func_8002D53C(globalCtx, &globalCtx->actorCtx.titleCtx); + func_8002D53C(play, &play->actorCtx.titleCtx); this->unk_6AD = 4; this->itemActionParam = actionParam; } @@ -3017,8 +3017,8 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { this->stateFlags1 |= PLAYER_STATE1_8; } else { func_80835EFC(this); - func_808323B4(globalCtx, this); - func_80833664(globalCtx, this, actionParam); + func_808323B4(play, this); + func_80833664(play, this, actionParam); } return; } @@ -3028,16 +3028,16 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { } } -void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { s32 cond = func_808332B8(this); - func_80832564(globalCtx, this); + func_80832564(play, this); - func_80835C58(globalCtx, this, cond ? func_8084E368 : func_80843CEC, 0); + func_80835C58(play, this, cond ? func_8084E368 : func_80843CEC, 0); this->stateFlags1 |= PLAYER_STATE1_7; - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); if (anim == &gPlayerAnim_link_derth_rebirth) { this->skelAnime.endFrame = 84.0f; } @@ -3048,18 +3048,18 @@ void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* if (this->actor.category == ACTORCAT_PLAYER) { func_800F47BC(); - if (Inventory_ConsumeFairy(globalCtx)) { - globalCtx->gameOverCtx.state = GAMEOVER_REVIVE_START; + if (Inventory_ConsumeFairy(play)) { + play->gameOverCtx.state = GAMEOVER_REVIVE_START; this->unk_84F = 1; } else { - globalCtx->gameOverCtx.state = GAMEOVER_DEATH_START; + play->gameOverCtx.state = GAMEOVER_DEATH_START; func_800F6AB0(0); Audio_PlayFanfare(NA_BGM_GAME_OVER); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } - OnePointCutscene_Init(globalCtx, 9806, cond ? 120 : 60, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 9806, cond ? 120 : 60, &this->actor, MAIN_CAM); ShrinkWindow_SetVal(0x20); } } @@ -3072,12 +3072,12 @@ s32 func_808365C8(Player* this) { (Player_ItemToActionParam(this->heldItemId) == this->heldItemActionParam)); } -s32 func_80836670(Player* this, GlobalContext* globalCtx) { +s32 func_80836670(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { - func_80835C58(globalCtx, this, func_80850AEC, 1); + func_80835C58(play, this, func_80850AEC, 1); this->stateFlags3 |= PLAYER_STATE3_7; - func_80832264(globalCtx, this, &gPlayerAnim_link_hook_fly_start); - func_80832F54(globalCtx, this, 0x9B); + func_80832264(play, this, &gPlayerAnim_link_hook_fly_start); + func_80832F54(play, this, 0x9B); func_80832224(this); this->currentYaw = this->actor.shape.rot.y; this->actor.bgCheckFlags &= ~1; @@ -3088,48 +3088,48 @@ s32 func_80836670(Player* this, GlobalContext* globalCtx) { } if (func_808365C8(this)) { - func_80834298(this, globalCtx); + func_80834298(this, play); if (func_8084E604 == this->func_674) { return 1; } } - if (!this->func_82C(this, globalCtx)) { + if (!this->func_82C(this, play)) { return 0; } if (this->unk_830 != 0.0f) { if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { - AnimationContext_SetCopyFalse(globalCtx, this->skelAnime.limbCount, this->skelAnime2.jointTable, + AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnime2.jointTable, this->skelAnime.jointTable, D_80853410); } Math_StepToF(&this->unk_830, 0.0f, 0.25f); - AnimationContext_SetInterp(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, 1.0f - this->unk_830); } else if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, D_80853410); } else { - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable); } return 1; } -s32 func_80836898(GlobalContext* globalCtx, Player* this, PlayerFuncA74 func) { +s32 func_80836898(PlayState* play, Player* this, PlayerFuncA74 func) { this->func_A74 = func; - func_80835C58(globalCtx, this, func_808458D0, 0); + func_80835C58(play, this, func_808458D0, 0); this->stateFlags2 |= PLAYER_STATE2_6; - return func_80832528(globalCtx, this); + return func_80832528(play, this); } -void func_808368EC(Player* this, GlobalContext* globalCtx) { +void func_808368EC(Player* this, PlayState* play) { s16 previousYaw = this->actor.shape.rot.y; if (!(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { if ((this->unk_664 != NULL) && - ((globalCtx->actorCtx.targetCtx.unk_4B != 0) || (this->actor.category != ACTORCAT_PLAYER))) { + ((play->actorCtx.targetCtx.unk_4B != 0) || (this->actor.category != ACTORCAT_PLAYER))) { Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_17) && @@ -3187,7 +3187,7 @@ s32 func_80836AB8(Player* this, s32 arg1) { return var; } -void func_80836BEC(Player* this, GlobalContext* globalCtx) { +void func_80836BEC(Player* this, PlayState* play) { s32 sp1C = 0; s32 zTrigPressed = CHECK_BTN_ALL(sControlInput->cur.button, BTN_Z); Actor* actorToTarget; @@ -3199,7 +3199,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~PLAYER_STATE1_30; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0) || + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0) || (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->stateFlags3 & PLAYER_STATE3_7)) { this->unk_66C = 0; } else if (zTrigPressed || (this->stateFlags2 & PLAYER_STATE2_13) || (this->unk_684 != NULL)) { @@ -3218,7 +3218,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { sp1C = 1; } - cond = func_8083224C(globalCtx); + cond = func_8083224C(play); if (cond || (this->unk_66C != 0) || (this->stateFlags1 & (PLAYER_STATE1_12 | PLAYER_STATE1_25))) { if (!cond) { if (!(this->stateFlags1 & PLAYER_STATE1_25) && @@ -3226,9 +3226,9 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { if (this->actor.category == ACTORCAT_PLAYER) { - actorToTarget = globalCtx->actorCtx.targetCtx.arrowPointedActor; + actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; } else { - actorToTarget = &GET_PLAYER(globalCtx)->actor; + actorToTarget = &GET_PLAYER(play)->actor; } holdTarget = (gSaveContext.zTargetSetting != 0) || (this->actor.category != ACTORCAT_PLAYER); @@ -3236,7 +3236,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_27)) { if ((actorToTarget == this->unk_664) && (this->actor.category == ACTORCAT_PLAYER)) { - actorToTarget = globalCtx->actorCtx.targetCtx.unk_94; + actorToTarget = play->actorCtx.targetCtx.unk_94; } if (actorToTarget != this->unk_664) { @@ -3291,13 +3291,13 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { } } -s32 func_80836FAC(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3, f32 arg4) { +s32 func_80836FAC(PlayState* play, Player* this, f32* arg2, s16* arg3, f32 arg4) { f32 temp_f2; f32 temp_f0; f32 temp_f14; f32 temp_f12; - if ((this->unk_6AD != 0) || (globalCtx->sceneLoadFlag == 0x14) || (this->stateFlags1 & PLAYER_STATE1_0)) { + if ((this->unk_6AD != 0) || (play->sceneLoadFlag == 0x14) || (this->stateFlags1 & PLAYER_STATE1_0)) { *arg2 = 0.0f; *arg3 = this->actor.shape.rot.y; } else { @@ -3342,12 +3342,12 @@ s32 func_8083721C(Player* this) { return Math_StepToF(&this->linearVelocity, 0.0f, REG(43) / 100.0f); } -s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, GlobalContext* globalCtx) { - if (!func_80836FAC(globalCtx, this, arg1, arg2, arg3)) { +s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, PlayState* play) { + if (!func_80836FAC(play, this, arg1, arg2, arg3)) { *arg2 = this->actor.shape.rot.y; if (this->unk_664 != NULL) { - if ((globalCtx->actorCtx.targetCtx.unk_4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { + if ((play->actorCtx.targetCtx.unk_4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { *arg2 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); return 0; } @@ -3357,7 +3357,7 @@ s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, GlobalContext* g return 0; } else { - *arg2 += Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + *arg2 += Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); return 1; } } @@ -3374,17 +3374,17 @@ static s8 D_80854430[] = { 13, 1, 2, 3, 12, 5, 4, 9, 10, 11, 8, 7, -6 }; static s8 D_80854440[] = { 10, 8, -7 }; static s8 D_80854444[] = { 0, 12, 5, -4 }; -static s32 (*D_80854448[])(Player* this, GlobalContext* globalCtx) = { +static s32 (*D_80854448[])(Player* this, PlayState* play) = { func_8083B998, func_80839800, func_8083E5A8, func_8083E0FC, func_8083B644, func_8083F7BC, func_8083C1DC, func_80850224, func_8083C544, func_8083EB44, func_8083BDBC, func_8083C2B0, func_80838A14, func_8083B040, }; -s32 func_80837348(GlobalContext* globalCtx, Player* this, s8* arg2, s32 arg3) { +s32 func_80837348(PlayState* play, Player* this, s8* arg2, s32 arg3) { s32 i; if (!(this->stateFlags1 & (PLAYER_STATE1_0 | PLAYER_STATE1_7 | PLAYER_STATE1_29))) { if (arg3 != 0) { - D_808535E0 = func_80836670(this, globalCtx); + D_808535E0 = func_80836670(this, play); if (func_8084E604 == this->func_674) { return 1; } @@ -3397,13 +3397,13 @@ s32 func_80837348(GlobalContext* globalCtx, Player* this, s8* arg2, s32 arg3) { if (!(this->stateFlags1 & PLAYER_STATE1_8) && (func_80834A2C != this->func_82C)) { while (*arg2 >= 0) { - if (D_80854448[*arg2](this, globalCtx)) { + if (D_80854448[*arg2](this, play)) { return 1; } arg2++; } - if (D_80854448[-(*arg2)](this, globalCtx)) { + if (D_80854448[-(*arg2)](this, play)) { return 1; } } @@ -3412,16 +3412,16 @@ s32 func_80837348(GlobalContext* globalCtx, Player* this, s8* arg2, s32 arg3) { return 0; } -s32 func_808374A0(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, f32 arg3) { +s32 func_808374A0(PlayState* play, Player* this, SkelAnime* skelAnime, f32 arg3) { f32 sp24; s16 sp22; if ((skelAnime->endFrame - arg3) <= skelAnime->curFrame) { - if (func_80837348(globalCtx, this, D_80854418, 1)) { + if (func_80837348(play, this, D_80854418, 1)) { return 0; } - if (func_80837268(this, &sp24, &sp22, 0.018f, globalCtx)) { + if (func_80837268(this, &sp24, &sp22, 0.018f, play)) { return 1; } } @@ -3429,7 +3429,7 @@ s32 func_808374A0(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, return -1; } -void func_80837530(GlobalContext* globalCtx, Player* this, s32 arg2) { +void func_80837530(PlayState* play, Player* this, s32 arg2) { if (arg2 != 0) { this->unk_858 = 0.0f; } else { @@ -3439,7 +3439,7 @@ void func_80837530(GlobalContext* globalCtx, Player* this, s32 arg2) { this->stateFlags1 |= PLAYER_STATE1_12; if (this->actor.category == ACTORCAT_PLAYER) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_M_THUNDER, this->bodyPartsPos[PLAYER_BODYPART_WAIST].x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_M_THUNDER, this->bodyPartsPos[PLAYER_BODYPART_WAIST].x, this->bodyPartsPos[PLAYER_BODYPART_WAIST].y, this->bodyPartsPos[PLAYER_BODYPART_WAIST].z, 0, 0, 0, Player_GetSwordHeld(this) | arg2); } @@ -3482,7 +3482,7 @@ s32 func_808375D8(Player* this) { return 1; } -void func_80837704(GlobalContext* globalCtx, Player* this) { +void func_80837704(PlayState* play, Player* this) { LinkAnimationHeader* anim; if ((this->swordAnimation >= 4) && (this->swordAnimation < 8)) { @@ -3492,14 +3492,14 @@ void func_80837704(GlobalContext* globalCtx, Player* this) { } func_80832318(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 8.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 8.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -9.0f); - func_80837530(globalCtx, this, 0x200); + func_80837530(play, this, 0x200); } -void func_808377DC(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_80844E68, 1); - func_80837704(globalCtx, this); +void func_808377DC(PlayState* play, Player* this) { + func_80835C58(play, this, func_80844E68, 1); + func_80837704(play, this); } static s8 D_80854480[] = { 12, 4, 4, 8 }; @@ -3561,12 +3561,12 @@ static u32 D_80854488[][2] = { { 0x00000002, 0x08000000 }, { 0x00000040, 0x40000000 }, }; -void func_80837948(GlobalContext* globalCtx, Player* this, s32 arg2) { +void func_80837948(PlayState* play, Player* this, s32 arg2) { s32 pad; u32 flags; s32 temp; - func_80835C58(globalCtx, this, func_808502D0, 0); + func_80835C58(play, this, func_808502D0, 0); this->unk_844 = 8; if ((arg2 < 18) || (arg2 >= 20)) { func_80832318(this); @@ -3583,9 +3583,9 @@ void func_80837948(GlobalContext* globalCtx, Player* this, s32 arg2) { this->swordAnimation = arg2; - func_808322D0(globalCtx, this, D_80854190[arg2].unk_00); + func_808322D0(play, this, D_80854190[arg2].unk_00); if ((arg2 != 16) && (arg2 != 17)) { - func_80832F54(globalCtx, this, 0x209); + func_80832F54(play, this, 0x209); } this->currentYaw = this->actor.shape.rot.y; @@ -3620,7 +3620,7 @@ void func_80837AFC(Player* this, s32 timer) { this->unk_88F = 0; } -s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u8 modified) { +s32 func_80837B18_modified(PlayState* play, Player* this, s32 damage, u8 modified) { if ((this->invincibilityTimer != 0) || (this->actor.category != ACTORCAT_PLAYER)) { return 1; } @@ -3630,11 +3630,11 @@ s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u modifiedDamage *= (1 << CVar_GetS32("gDamageMul", 0)); } - return Health_ChangeBy(globalCtx, modifiedDamage); + return Health_ChangeBy(play, modifiedDamage); } -s32 func_80837B18(GlobalContext* globalCtx, Player* this, s32 damage) { - return func_80837B18_modified(globalCtx, this, damage, true); +s32 func_80837B18(PlayState* play, Player* this, s32 damage) { + return func_80837B18_modified(play, this, damage, true); } void func_80837B60(Player* this) { @@ -3642,9 +3642,9 @@ void func_80837B60(Player* this) { func_80832E48(this, 3); } -void func_80837B9C(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084411C, 0); - func_80832284(globalCtx, this, &gPlayerAnim_link_normal_landing_wait); +void func_80837B9C(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084411C, 0); + func_80832284(play, this, &gPlayerAnim_link_normal_landing_wait); this->unk_850 = 1; if (this->unk_6AD != 3) { this->unk_6AD = 0; @@ -3657,7 +3657,7 @@ static LinkAnimationHeader* D_808544B0[] = { &gPlayerAnim_link_normal_back_hit, &gPlayerAnim_link_anchor_back_hitR, }; -void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6) { +void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6) { LinkAnimationHeader* sp2C = NULL; LinkAnimationHeader** sp28; @@ -3669,10 +3669,10 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_8002F7DC(&this->actor, NA_SE_PL_DAMAGE); - if (!func_80837B18(globalCtx, this, 0 - this->actor.colChkInfo.damage)) { + if (!func_80837B18(play, this, 0 - this->actor.colChkInfo.damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; if (!(this->actor.bgCheckFlags & 1) && !(this->stateFlags1 & PLAYER_STATE1_27)) { - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); } return; } @@ -3680,7 +3680,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_80837AE0(this, arg6); if (arg2 == 3) { - func_80835C58(globalCtx, this, func_8084FB10, 0); + func_80835C58(play, this, func_8084FB10, 0); sp2C = &gPlayerAnim_link_normal_ice_down; @@ -3690,18 +3690,18 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_8002F7DC(&this->actor, NA_SE_PL_FREEZE_S); func_80832698(this, NA_SE_VO_LI_FREEZE); } else if (arg2 == 4) { - func_80835C58(globalCtx, this, func_8084FBF4, 0); + func_80835C58(play, this, func_8084FBF4, 0); func_8083264C(this, 255, 80, 150, 0); - func_808322A4(globalCtx, this, &gPlayerAnim_link_normal_electric_shock); + func_808322A4(play, this, &gPlayerAnim_link_normal_electric_shock); func_80832224(this); this->unk_850 = 20; } else { arg5 -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80835C58(globalCtx, this, func_8084E30C, 0); + func_80835C58(play, this, func_8084E30C, 0); func_8083264C(this, 180, 20, 50, 0); this->linearVelocity = 4.0f; @@ -3712,7 +3712,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & 1) || (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) { - func_80835C58(globalCtx, this, func_8084377C, 0); + func_80835C58(play, this, func_8084377C, 0); this->stateFlags3 |= PLAYER_STATE3_1; @@ -3726,7 +3726,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f this->linearVelocity = 3.0f; this->actor.velocity.y = 6.0f; - func_80832C2C(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_3][this->modelAnimType]); + func_80832C2C(play, this, D_80853914[PLAYER_ANIMGROUP_3][this->modelAnimType]); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else { this->actor.speedXZ = arg3; @@ -3758,7 +3758,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f sp28 = D_808544B0; - func_80835C58(globalCtx, this, func_8084370C, 0); + func_80835C58(play, this, func_8084370C, 0); func_80833C3C(this); if (this->actor.colChkInfo.damage < 5) { @@ -3790,12 +3790,12 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f } } - func_80832564(globalCtx, this); + func_80832564(play, this); this->stateFlags1 |= PLAYER_STATE1_26; if (sp2C != NULL) { - func_808322D0(globalCtx, this, sp2C); + func_808322D0(play, this, sp2C); } } @@ -3813,12 +3813,12 @@ s32 func_8083816C(s32 arg0) { return (arg0 == 4) || (arg0 == 7) || (arg0 == 12); } -void func_8083819C(Player* this, GlobalContext* globalCtx) { +void func_8083819C(Player* this, PlayState* play) { if (this->currentShield == PLAYER_SHIELD_DEKU && (CVar_GetS32("gFireproofDekuShield", 0) == 0)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1); - Inventory_DeleteEquipment(globalCtx, EQUIP_SHIELD); - Message_StartTextbox(globalCtx, 0x305F, NULL); + Inventory_DeleteEquipment(play, EQUIP_SHIELD); + Message_StartTextbox(play, 0x305F, NULL); } } @@ -3845,14 +3845,14 @@ void func_808382BC(Player* this) { } } -s32 func_808382DC(Player* this, GlobalContext* globalCtx) { +s32 func_808382DC(Player* this, PlayState* play) { s32 pad; s32 sp68 = false; s32 sp64; if (this->unk_A86 != 0) { - if (!Player_InBlockingCsMode(globalCtx, this)) { - Player_InflictDamageModified(globalCtx, -16 * (1 << CVar_GetS32("gVoidDamageMul", 0)), false); + if (!Player_InBlockingCsMode(play, this)) { + Player_InflictDamageModified(play, -16 * (1 << CVar_GetS32("gVoidDamageMul", 0)), false); this->unk_A86 = 0; } } else { @@ -3862,33 +3862,33 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { func_80832698(this, NA_SE_VO_LI_DAMAGE_S); if (sp68) { - Gameplay_TriggerRespawn(globalCtx); - func_800994A0(globalCtx); + Play_TriggerRespawn(play); + func_800994A0(play); } else { // Special case for getting crushed in Forest Temple's Checkboard Ceiling Hall or Shadow Temple's // Falling Spike Trap Room, to respawn the player in a specific place - if (((globalCtx->sceneNum == SCENE_BMORI1) && (globalCtx->roomCtx.curRoom.num == 15)) || - ((globalCtx->sceneNum == SCENE_HAKADAN) && (globalCtx->roomCtx.curRoom.num == 10))) { + if (((play->sceneNum == SCENE_BMORI1) && (play->roomCtx.curRoom.num == 15)) || + ((play->sceneNum == SCENE_HAKADAN) && (play->roomCtx.curRoom.num == 10))) { static SpecialRespawnInfo checkboardCeilingRespawn = { { 1992.0f, 403.0f, -3432.0f }, 0 }; static SpecialRespawnInfo fallingSpikeTrapRespawn = { { 1200.0f, -1343.0f, 3850.0f }, 0 }; SpecialRespawnInfo* respawnInfo; - if (globalCtx->sceneNum == SCENE_BMORI1) { + if (play->sceneNum == SCENE_BMORI1) { respawnInfo = &checkboardCeilingRespawn; } else { respawnInfo = &fallingSpikeTrapRespawn; } - Gameplay_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0xDFF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF); gSaveContext.respawn[RESPAWN_MODE_DOWN].pos = respawnInfo->pos; gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw = respawnInfo->yaw; } - Gameplay_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } func_80832698(this, NA_SE_VO_LI_TAKEN_AWAY); - globalCtx->unk_11DE9 = 1; + play->unk_11DE9 = 1; func_80078884(NA_SE_OC_ABYSS); } else if ((this->unk_8A1 != 0) && ((this->unk_8A1 >= 2) || (this->invincibilityTimer == 0))) { u8 sp5C[] = { 2, 1, 1 }; @@ -3900,7 +3900,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { } this->actor.colChkInfo.damage += this->unk_8A0; - func_80837C0C(globalCtx, this, sp5C[this->unk_8A1 - 1], this->unk_8A4, this->unk_8A8, this->unk_8A2, 20); + func_80837C0C(play, this, sp5C[this->unk_8A1 - 1], this->unk_8A4, this->unk_8A8, this->unk_8A2, 20); } else { sp64 = (this->shieldQuad.base.acFlags & AC_BOUNCED) != 0; @@ -3919,7 +3919,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { s32 sp54 = func_80843188 == this->func_674; if (!func_808332B8(this)) { - func_80835C58(globalCtx, this, func_808435C4, 0); + func_80835C58(play, this, func_808435C4, 0); } if (!(this->unk_84F = sp54)) { @@ -3934,9 +3934,9 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { !(CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK))]; } - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); } else { - func_80832264(globalCtx, this, + func_80832264(play, this, D_808543C4[Player_HoldsTwoHandedWeapon(this) && !(CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK))]); @@ -3950,7 +3950,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { } if (sp64 && (this->shieldQuad.info.acHitInfo->toucher.effect == 1)) { - func_8083819C(this, globalCtx); + func_8083819C(this, play); } return 0; @@ -3983,7 +3983,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { sp4C = 0; } - func_80837C0C(globalCtx, this, sp4C, 4.0f, 5.0f, Actor_WorldYawTowardActor(ac, &this->actor), 20); + func_80837C0C(play, this, sp4C, 4.0f, 5.0f, Actor_WorldYawTowardActor(ac, &this->actor), 20); } else if (this->invincibilityTimer != 0) { return 0; } else { @@ -3991,15 +3991,15 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { s32 sp48 = func_80838144(D_808535E4); if (((this->actor.wallPoly != NULL) && - SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) || + SurfaceType_IsWallDamage(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) || ((sp48 >= 0) && - SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) && + SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) && (this->unk_A79 >= D_808544F4[sp48])) || ((sp48 >= 0) && ((this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0) || (this->unk_A79 >= D_808544F4[sp48])))) { this->unk_A79 = 0; this->actor.colChkInfo.damage = 4; - func_80837C0C(globalCtx, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } else { return 0; } @@ -4010,11 +4010,11 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { return 1; } -void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, GlobalContext* globalCtx, u16 sfxId) { - func_80835C58(globalCtx, this, func_8084411C, 1); +void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play, u16 sfxId) { + func_80835C58(play, this, func_8084411C, 1); if (anim != NULL) { - func_808322D0(globalCtx, this, anim); + func_808322D0(play, this, anim); } this->actor.velocity.y = arg2 * D_808535E8; @@ -4027,11 +4027,11 @@ void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, GlobalCont this->stateFlags1 |= PLAYER_STATE1_18; } -void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, GlobalContext* globalCtx) { - func_80838940(this, anim, arg2, globalCtx, NA_SE_VO_LI_SWORD_N); +void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play) { + func_80838940(this, anim, arg2, play, NA_SE_VO_LI_SWORD_N); } -s32 func_80838A14(Player* this, GlobalContext* globalCtx) { +s32 func_80838A14(Player* this, PlayState* play) { s32 sp3C; LinkAnimationHeader* sp38; f32 sp34; @@ -4069,7 +4069,7 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { } if (sp3C != 0) { - func_80835C58(globalCtx, this, func_80845668, 0); + func_80835C58(play, this, func_80845668, 0); this->stateFlags1 |= PLAYER_STATE1_18; @@ -4108,8 +4108,8 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags |= 1; - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, sp38, 1.3f); - AnimationContext_DisableQueue(globalCtx); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, sp38, 1.3f); + AnimationContext_DisableQueue(play); this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; @@ -4117,7 +4117,7 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { } } else if ((this->actor.bgCheckFlags & 1) && (this->unk_88C == 1) && (this->unk_88D >= 3)) { temp = (this->wallHeight * 0.08f) + 5.5f; - func_808389E8(this, &gPlayerAnim_link_normal_jump, temp, globalCtx); + func_808389E8(this, &gPlayerAnim_link_normal_jump, temp, play); this->linearVelocity = 2.5f; return 1; @@ -4126,9 +4126,9 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { return 0; } -void func_80838E70(GlobalContext* globalCtx, Player* this, f32 arg2, s16 arg3) { - func_80835C58(globalCtx, this, func_80845CA4, 0); - func_80832440(globalCtx, this); +void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { + func_80835C58(play, this, func_80845CA4, 0); + func_80832440(play, this); this->unk_84F = 1; this->unk_850 = 1; @@ -4136,26 +4136,26 @@ void func_80838E70(GlobalContext* globalCtx, Player* this, f32 arg2, s16 arg3) { this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z; - func_80832264(globalCtx, this, func_80833338(this)); + func_80832264(play, this, func_80833338(this)); } -void func_80838F18(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084D610, 0); - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim_wait); +void func_80838F18(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084D610, 0); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); } -void func_80838F5C(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F88C, 0); +void func_80838F5C(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F88C, 0); this->stateFlags1 |= PLAYER_STATE1_29 | PLAYER_STATE1_31; - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), CAM_SET_FREE0); + Camera_ChangeSetting(Play_GetCamera(play, 0), CAM_SET_FREE0); } -s32 func_80838FB8(GlobalContext* globalCtx, Player* this) { - if ((globalCtx->sceneLoadFlag == 0) && (this->stateFlags1 & PLAYER_STATE1_31)) { - func_80838F5C(globalCtx, this); - func_80832284(globalCtx, this, &gPlayerAnim_link_normal_landing_wait); +s32 func_80838FB8(PlayState* play, Player* this) { + if ((play->sceneLoadFlag == 0) && (this->stateFlags1 & PLAYER_STATE1_31)) { + func_80838F5C(play, this); + func_80832284(play, this, &gPlayerAnim_link_normal_landing_wait); func_80832698(this, NA_SE_VO_LI_FALL_S); func_800788CC(NA_SE_OC_SECRET_WARP_IN); return 1; @@ -4183,7 +4183,7 @@ s16 D_808544F8[] = { u8 D_80854514[] = { 11, 9, 3, 5, 7, 0 }; -s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u32 bgId) { +s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) { s32 sp3C; s32 temp; s32 sp34; @@ -4193,9 +4193,9 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u if (this->actor.category == ACTORCAT_PLAYER) { sp3C = 0; - if (!(this->stateFlags1 & PLAYER_STATE1_7) && (globalCtx->sceneLoadFlag == 0) && (this->csMode == 0) && + if (!(this->stateFlags1 & PLAYER_STATE1_7) && (play->sceneLoadFlag == 0) && (this->csMode == 0) && !(this->stateFlags1 & PLAYER_STATE1_0) && - (((poly != NULL) && (sp3C = SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, poly, bgId), sp3C != 0)) || + (((poly != NULL) && (sp3C = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), sp3C != 0)) || (func_8083816C(D_808535E4) && (this->unk_A7A == 12)))) { sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; @@ -4206,34 +4206,34 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u } if (sp3C == 0) { - Gameplay_TriggerVoidOut(globalCtx); - func_800994A0(globalCtx); + Play_TriggerVoidOut(play); + func_800994A0(play); } else { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[sp3C - 1]; - if (globalCtx->nextEntranceIndex == 0x7FFF) { + play->nextEntranceIndex = play->setupExitList[sp3C - 1]; + if (play->nextEntranceIndex == 0x7FFF) { gSaveContext.respawnFlag = 2; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; - globalCtx->fadeTransition = 3; + play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; + play->fadeTransition = 3; gSaveContext.nextTransition = 3; - } else if (globalCtx->nextEntranceIndex >= 0x7FF9) { - globalCtx->nextEntranceIndex = - D_808544F8[D_80854514[globalCtx->nextEntranceIndex - 0x7FF9] + globalCtx->curSpawn]; - func_800994A0(globalCtx); + } else if (play->nextEntranceIndex >= 0x7FF9) { + play->nextEntranceIndex = + D_808544F8[D_80854514[play->nextEntranceIndex - 0x7FF9] + play->curSpawn]; + func_800994A0(play); } else { - if (SurfaceType_GetSlope(&globalCtx->colCtx, poly, bgId) == 2) { - gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = globalCtx->nextEntranceIndex; - Gameplay_TriggerVoidOut(globalCtx); + if (SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2) { + gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex; + Play_TriggerVoidOut(play); gSaveContext.respawnFlag = -2; } gSaveContext.unk_13C3 = 1; - func_800994A0(globalCtx); + func_800994A0(play); } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_29)) && !(this->stateFlags2 & PLAYER_STATE2_18) && !func_808332B8(this) && - (temp = func_80041D4C(&globalCtx->colCtx, poly, bgId), (temp != 10)) && + (temp = func_80041D4C(&play->colCtx, poly, bgId), (temp != 10)) && ((sp34 < 100) || (this->actor.bgCheckFlags & 1))) { if (temp == 11) { @@ -4260,7 +4260,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u } else { yaw = this->actor.world.rot.y; } - func_80838E70(globalCtx, this, 400.0f, yaw); + func_80838E70(play, this, 400.0f, yaw); } } else { if (!(this->actor.bgCheckFlags & 1)) { @@ -4270,28 +4270,28 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u this->stateFlags1 |= PLAYER_STATE1_0 | PLAYER_STATE1_29; - func_80835E44(globalCtx, 0x2F); + func_80835E44(play, 0x2F); return 1; } else { - if (globalCtx->sceneLoadFlag == 0) { + if (play->sceneLoadFlag == 0) { if ((this->actor.world.pos.y < -4000.0f) || (((this->unk_A7A == 5) || (this->unk_A7A == 12)) && ((D_80853600 < 100.0f) || (this->fallDistance > 400.0f) || - ((globalCtx->sceneNum != SCENE_HAKADAN) && (this->fallDistance > 200.0f)))) || - ((globalCtx->sceneNum == SCENE_GANON_FINAL) && (this->fallDistance > 320.0f))) { + ((play->sceneNum != SCENE_HAKADAN) && (this->fallDistance > 200.0f)))) || + ((play->sceneNum == SCENE_GANON_FINAL) && (this->fallDistance > 320.0f))) { if (this->actor.bgCheckFlags & 1) { if (this->unk_A7A == 5) { - Gameplay_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); } else { - Gameplay_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; func_80078884(NA_SE_OC_ABYSS); } else { - func_80838F5C(globalCtx, this); + func_80838F5C(play, this); this->unk_850 = 9999; if (this->unk_A7A == 5) { this->unk_84F = -1; @@ -4318,28 +4318,28 @@ void func_808395DC(Player* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) { arg3->z = arg1->z + ((arg2->z * cos) - (arg2->x * sin)); } -Actor* Player_SpawnFairy(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Vec3f* arg3, s32 type) { +Actor* Player_SpawnFairy(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3, s32 type) { Vec3f pos; func_808395DC(this, arg2, arg3, &pos); - return Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, pos.x, pos.y, pos.z, 0, 0, 0, type); + return Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, pos.x, pos.y, pos.z, 0, 0, 0, type); } -f32 func_808396F4(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Vec3f* arg3, CollisionPoly** arg4, s32* arg5) { +f32 func_808396F4(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3, CollisionPoly** arg4, s32* arg5) { func_808395DC(this, &this->actor.world.pos, arg2, arg3); - return BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, arg4, arg5, arg3); + return BgCheck_EntityRaycastFloor3(&play->colCtx, arg4, arg5, arg3); } -f32 func_8083973C(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Vec3f* arg3) { +f32 func_8083973C(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3) { CollisionPoly* sp24; s32 sp20; - return func_808396F4(globalCtx, this, arg2, arg3, &sp24, &sp20); + return func_808396F4(play, this, arg2, arg3, &sp24, &sp20); } -s32 func_80839768(GlobalContext* globalCtx, Player* this, Vec3f* arg2, CollisionPoly** arg3, s32* arg4, Vec3f* arg5) { +s32 func_80839768(PlayState* play, Player* this, Vec3f* arg2, CollisionPoly** arg3, s32* arg4, Vec3f* arg5) { Vec3f sp44; Vec3f sp38; @@ -4349,10 +4349,10 @@ s32 func_80839768(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Collision func_808395DC(this, &this->actor.world.pos, arg2, &sp38); - return BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp44, &sp38, arg5, arg3, true, false, false, true, arg4); + return BgCheck_EntityLineTest1(&play->colCtx, &sp44, &sp38, arg5, arg3, true, false, false, true, arg4); } -s32 func_80839800(Player* this, GlobalContext* globalCtx) { +s32 func_80839800(Player* this, PlayState* play) { DoorShutter* doorShutter; EnDoor* door; // Can also be DoorKiller* s32 doorDirection; @@ -4375,7 +4375,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorType <= PLAYER_DOORTYPE_AJAR) { doorActor->textId = 0xD0; - func_80853148(globalCtx, doorActor); + func_80853148(play, doorActor); return 0; } @@ -4396,7 +4396,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { this->linearVelocity = 0.1f; } - func_80838E70(globalCtx, this, 50.0f, this->actor.shape.rot.y); + func_80838E70(play, this, 50.0f, this->actor.shape.rot.y); this->unk_84F = 0; this->unk_447 = this->doorType; @@ -4412,18 +4412,18 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorTimer != 0) { this->unk_850 = 0; - func_80832B0C(globalCtx, this, func_80833338(this)); + func_80832B0C(play, this, func_80833338(this)); this->skelAnime.endFrame = 0.0f; } else { this->linearVelocity = 0.1f; } if (doorShutter->dyna.actor.category == ACTORCAT_DOOR) { - this->unk_46A = globalCtx->transiActorCtx.list[(u16)doorShutter->dyna.actor.params >> 10] + this->unk_46A = play->transiActorCtx.list[(u16)doorShutter->dyna.actor.params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .effects; - Actor_DisableLens(globalCtx); + Actor_DisableLens(play); } } else { // This actor can be either EnDoor or DoorKiller. @@ -4444,8 +4444,8 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { sp5C = D_80853914[PLAYER_ANIMGROUP_12][this->modelAnimType]; } - func_80835C58(globalCtx, this, func_80845EF8, 0); - func_80832528(globalCtx, this); + func_80835C58(play, this, func_80845EF8, 0); + func_80832528(play, this); if (doorDirection < 0) { this->actor.shape.rot.y = doorActor->shape.rot.y; @@ -4459,14 +4459,14 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { this->actor.world.pos.x = doorActor->world.pos.x + sp6C * sp74; this->actor.world.pos.z = doorActor->world.pos.z + sp6C * sp78; - func_8083328C(globalCtx, this, sp5C); + func_8083328C(play, this, sp5C); if (this->doorTimer != 0) { this->skelAnime.endFrame = 0.0f; } func_80832224(this); - func_80832F54(globalCtx, this, 0x28F); + func_80832F54(play, this, 0x28F); if (doorActor->parent != NULL) { doorDirection = -doorDirection; @@ -4476,22 +4476,22 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorType != PLAYER_DOORTYPE_FAKE) { this->stateFlags1 |= PLAYER_STATE1_29; - Actor_DisableLens(globalCtx); + Actor_DisableLens(play); if (((doorActor->params >> 7) & 7) == 3) { sp4C.x = doorActor->world.pos.x - (sp6C * sp74); sp4C.y = doorActor->world.pos.y + 10.0f; sp4C.z = doorActor->world.pos.z - (sp6C * sp78); - BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp58, &sp4C); + BgCheck_EntityRaycastFloor1(&play->colCtx, &sp58, &sp4C); - if (func_80839034(globalCtx, this, sp58, BGCHECK_SCENE)) { + if (func_80839034(play, this, sp58, BGCHECK_SCENE)) { gSaveContext.entranceSpeed = 2.0f; gSaveContext.entranceSound = NA_SE_OC_DOOR_OPEN; } } else { - Camera_ChangeDoorCam(Gameplay_GetCamera(globalCtx, 0), doorActor, - globalCtx->transiActorCtx.list[(u16)doorActor->params >> 10] + Camera_ChangeDoorCam(Play_GetCamera(play, 0), doorActor, + play->transiActorCtx.list[(u16)doorActor->params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .effects, 0, 38.0f * D_808535EC, 26.0f * D_808535EC, 10.0f * D_808535EC); @@ -4500,19 +4500,19 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { } if ((this->doorType != PLAYER_DOORTYPE_FAKE) && (doorActor->category == ACTORCAT_DOOR)) { - frontRoom = globalCtx->transiActorCtx.list[(u16)doorActor->params >> 10] + frontRoom = play->transiActorCtx.list[(u16)doorActor->params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .room; - if ((frontRoom >= 0) && (frontRoom != globalCtx->roomCtx.curRoom.num)) { - func_8009728C(globalCtx, &globalCtx->roomCtx, frontRoom); + if ((frontRoom >= 0) && (frontRoom != play->roomCtx.curRoom.num)) { + func_8009728C(play, &play->roomCtx, frontRoom); } } - doorActor->room = globalCtx->roomCtx.curRoom.num; + doorActor->room = play->roomCtx.curRoom.num; if (((attachedActor = doorActor->child) != NULL) || ((attachedActor = doorActor->parent) != NULL)) { - attachedActor->room = globalCtx->roomCtx.curRoom.num; + attachedActor->room = play->roomCtx.curRoom.num; } return 1; @@ -4522,10 +4522,10 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { return 0; } -void func_80839E88(Player* this, GlobalContext* globalCtx) { +void func_80839E88(Player* this, PlayState* play) { LinkAnimationHeader* anim; - func_80835C58(globalCtx, this, func_80840450, 1); + func_80835C58(play, this, func_80840450, 1); if (this->unk_870 < 0.5f) { anim = func_808334E4(this); @@ -4536,27 +4536,27 @@ void func_80839E88(Player* this, GlobalContext* globalCtx) { } this->unk_874 = this->unk_870; - func_80832284(globalCtx, this, anim); + func_80832284(play, this, anim); this->currentYaw = this->actor.shape.rot.y; } -void func_80839F30(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808407CC, 1); - func_80832B0C(globalCtx, this, func_80833338(this)); +void func_80839F30(Player* this, PlayState* play) { + func_80835C58(play, this, func_808407CC, 1); + func_80832B0C(play, this, func_80833338(this)); this->currentYaw = this->actor.shape.rot.y; } -void func_80839F90(Player* this, GlobalContext* globalCtx) { +void func_80839F90(Player* this, PlayState* play) { if (func_8008E9C4(this)) { - func_80839E88(this, globalCtx); + func_80839E88(this, play); } else if (func_80833B2C(this)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); } else { - func_80853080(this, globalCtx); + func_80853080(this, play); } } -void func_80839FFC(Player* this, GlobalContext* globalCtx) { +void func_80839FFC(Player* this, PlayState* play) { PlayerFunc674 func; if (func_8008E9C4(this)) { @@ -4567,48 +4567,48 @@ void func_80839FFC(Player* this, GlobalContext* globalCtx) { func = func_80840BC8; } - func_80835C58(globalCtx, this, func, 1); + func_80835C58(play, this, func, 1); } -void func_8083A060(Player* this, GlobalContext* globalCtx) { - func_80839FFC(this, globalCtx); +void func_8083A060(Player* this, PlayState* play) { + func_80839FFC(this, play); if (func_8008E9C4(this)) { this->unk_850 = 1; } } -void func_8083A098(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - func_8083A060(this, globalCtx); - func_8083328C(globalCtx, this, anim); +void func_8083A098(Player* this, LinkAnimationHeader* anim, PlayState* play) { + func_8083A060(this, play); + func_8083328C(play, this, anim); } s32 func_8083A0D4(Player* this) { return (this->interactRangeActor != NULL) && (this->heldActor == NULL); } -void func_8083A0F4(GlobalContext* globalCtx, Player* this) { +void func_8083A0F4(PlayState* play, Player* this) { if (func_8083A0D4(this)) { Actor* interactRangeActor = this->interactRangeActor; s32 interactActorId = interactRangeActor->id; if (interactActorId == ACTOR_BG_TOKI_SWD) { this->interactRangeActor->parent = &this->actor; - func_80835C58(globalCtx, this, func_8084F608, 0); + func_80835C58(play, this, func_8084F608, 0); this->stateFlags1 |= PLAYER_STATE1_29; sMaskMemory = PLAYER_MASK_NONE; } else { LinkAnimationHeader* anim; if (interactActorId == ACTOR_BG_HEAVY_BLOCK) { - func_80835C58(globalCtx, this, func_80846120, 0); + func_80835C58(play, this, func_80846120, 0); this->stateFlags1 |= PLAYER_STATE1_29; anim = &gPlayerAnim_link_normal_heavy_carry; } else if ((interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 0xF) == 1)) { - func_80835C58(globalCtx, this, func_80846260, 0); + func_80835C58(play, this, func_80846260, 0); anim = &gPlayerAnim_link_silver_carry; } else if (((interactActorId == ACTOR_EN_BOMBF) || (interactActorId == ACTOR_EN_KUSA)) && (Player_GetStrength() <= PLAYER_STR_NONE)) { - func_80835C58(globalCtx, this, func_80846408, 0); + func_80835C58(play, this, func_80846408, 0); this->actor.world.pos.x = (Math_SinS(interactRangeActor->yawTowardsPlayer) * 20.0f) + interactRangeActor->world.pos.x; this->actor.world.pos.z = @@ -4616,60 +4616,60 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) { this->currentYaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; anim = &gPlayerAnim_link_normal_nocarry_free; } else { - func_80835C58(globalCtx, this, func_80846050, 0); + func_80835C58(play, this, func_80846050, 0); anim = D_80853914[PLAYER_ANIMGROUP_13][this->modelAnimType]; } // Same actor is used for small and large silver rocks, use actor params to identify large ones bool isLargeSilverRock = interactActorId == ACTOR_EN_ISHI && interactRangeActor->params & 1 == 1; if (CVar_GetS32("gFasterHeavyBlockLift", 0) && (isLargeSilverRock || interactActorId == ACTOR_BG_HEAVY_BLOCK)) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 5.0f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 5.0f); } else { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime, anim); + LinkAnimation_PlayOnce(play, &this->skelAnime, anim); } } } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); this->stateFlags1 &= ~PLAYER_STATE1_11; } } -void func_8083A2F8(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084B530, 0); +void func_8083A2F8(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084B530, 0); this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; if (this->actor.textId != 0) { - Message_StartTextbox(globalCtx, this->actor.textId, this->targetActor); + Message_StartTextbox(play, this->actor.textId, this->targetActor); this->unk_664 = this->targetActor; } } -void func_8083A360(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084CC98, 0); +void func_8083A360(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084CC98, 0); } -void func_8083A388(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084B78C, 0); +void func_8083A388(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084B78C, 0); } -void func_8083A3B0(GlobalContext* globalCtx, Player* this) { +void func_8083A3B0(PlayState* play, Player* this) { s32 sp1C = this->unk_850; s32 sp18 = this->unk_84F; - func_80835DAC(globalCtx, this, func_8084BF1C, 0); + func_80835DAC(play, this, func_8084BF1C, 0); this->actor.velocity.y = 0.0f; this->unk_850 = sp1C; this->unk_84F = sp18; } -void func_8083A40C(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084C760, 0); +void func_8083A40C(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084C760, 0); } -void func_8083A434(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084E6D4, 0); +void func_8083A434(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084E6D4, 0); this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_29; @@ -4683,7 +4683,7 @@ void func_8083A434(GlobalContext* globalCtx, Player* this) { } } -s32 func_8083A4A8(Player* this, GlobalContext* globalCtx) { +s32 func_8083A4A8(Player* this, PlayState* play) { s16 yawDiff; LinkAnimationHeader* anim; f32 temp; @@ -4702,19 +4702,19 @@ s32 func_8083A4A8(Player* this, GlobalContext* globalCtx) { temp = (IREG(68) / 100.0f) + ((IREG(69) * this->linearVelocity) / 1000.0f); } - func_80838940(this, anim, temp, globalCtx, NA_SE_VO_LI_AUTO_JUMP); + func_80838940(this, anim, temp, play, NA_SE_VO_LI_AUTO_JUMP); this->unk_850 = 1; return 1; } -void func_8083A5C4(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2, f32 arg3, LinkAnimationHeader* arg4) { +void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, LinkAnimationHeader* arg4) { f32 sp24 = COLPOLY_GET_NORMAL(arg2->normal.x); f32 sp20 = COLPOLY_GET_NORMAL(arg2->normal.z); - func_80835C58(globalCtx, this, func_8084BBE4, 0); - func_80832564(globalCtx, this); - func_80832264(globalCtx, this, arg4); + func_80835C58(play, this, func_8084BBE4, 0); + func_80832564(play, this); + func_80832264(play, this, arg4); this->actor.world.pos.x -= (arg3 + 1.0f) * sp24; this->actor.world.pos.z -= (arg3 + 1.0f) * sp20; @@ -4724,7 +4724,7 @@ void func_8083A5C4(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2, func_80832CFC(this); } -s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { +s32 func_8083A6AC(Player* this, PlayState* play) { CollisionPoly* sp84; s32 sp80; Vec3f sp74; @@ -4746,7 +4746,7 @@ s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { sp74.y = this->actor.world.pos.y; sp74.z = this->actor.prevPos.z + (sp74.z * temp1); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp74, &sp68, &sp84, true, false, false, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp74, &sp68, &sp84, true, false, false, true, &sp80) && ((ABS(sp84->normal.y) < 600) || (CVar_GetS32("gClimbEverything", 0) != 0))) { f32 nx = COLPOLY_GET_NORMAL(sp84->normal.x); @@ -4758,21 +4758,21 @@ s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos); sp50 = D_80853604 == 6; - if (!sp50 && (func_80041DB8(&globalCtx->colCtx, sp84, sp80) & 8)) { + if (!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8)) { sp50 = 1; } - func_8083A5C4(globalCtx, this, sp84, sp54, + func_8083A5C4(play, this, sp84, sp54, sp50 ? &gPlayerAnim_link_normal_Fclimb_startB : &gPlayerAnim_link_normal_fall); if (sp50) { - func_80836898(globalCtx, this, func_8083A3B0); + func_80836898(play, this, func_8083A3B0); this->currentYaw += 0x8000; this->actor.shape.rot.y = this->currentYaw; this->stateFlags1 |= PLAYER_STATE1_21; - func_80832F54(globalCtx, this, 0x9F); + func_80832F54(play, this, 0x9F); this->unk_850 = -1; this->unk_84F = sp50; @@ -4790,14 +4790,14 @@ s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083A9B8(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084BDFC, 0); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 1.3f); +void func_8083A9B8(Player* this, LinkAnimationHeader* anim, PlayState* play) { + func_80835C58(play, this, func_8084BDFC, 0); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f); } static Vec3f D_8085451C = { 0.0f, 0.0f, 100.0f }; -void func_8083AA10(Player* this, GlobalContext* globalCtx) { +void func_8083AA10(Player* this, PlayState* play) { s32 sp5C; CollisionPoly* sp58; s32 sp54; @@ -4809,7 +4809,7 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { this->fallDistance = this->fallStartHeight - (s32)this->actor.world.pos.y; if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) && !(this->actor.bgCheckFlags & 1)) { - if (!func_80838FB8(globalCtx, this)) { + if (!func_80838FB8(play, this)) { if (D_80853604 == 8) { this->actor.world.pos.x = this->actor.prevPos.x; this->actor.world.pos.z = this->actor.prevPos.z; @@ -4833,8 +4833,8 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { sp5C = (s16)(this->currentYaw - this->actor.shape.rot.y); - func_80835C58(globalCtx, this, func_8084411C, 1); - func_80832440(globalCtx, this); + func_80835C58(play, this, func_8084411C, 1); + func_80832440(play, this); this->unk_89E = this->unk_A82; @@ -4844,24 +4844,24 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { if ((D_80853604 == 11) && !(this->stateFlags1 & PLAYER_STATE1_11)) { - sp40 = func_808396F4(globalCtx, this, &D_8085451C, &sp44, &sp58, &sp54); + sp40 = func_808396F4(play, this, &D_8085451C, &sp44, &sp58, &sp54); sp3C = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, sp44.x, sp44.z, &sp3C, &sp50) && + if (WaterBox_GetSurface1(play, &play->colCtx, sp44.x, sp44.z, &sp3C, &sp50) && ((sp3C - sp40) > 50.0f)) { - func_808389E8(this, &gPlayerAnim_link_normal_run_jump_water_fall, 6.0f, globalCtx); - func_80835C58(globalCtx, this, func_80844A44, 0); + func_808389E8(this, &gPlayerAnim_link_normal_run_jump_water_fall, 6.0f, play); + func_80835C58(play, this, func_80844A44, 0); return; } } - func_8083A4A8(this, globalCtx); + func_8083A4A8(this, play); return; } if ((D_80853604 == 9) || (D_80853600 <= this->ageProperties->unk_34) || - !func_8083A6AC(this, globalCtx)) { - func_80832284(globalCtx, this, &gPlayerAnim_link_normal_landing_wait); + !func_8083A6AC(this, play)) { + func_80832284(play, this, &gPlayerAnim_link_normal_landing_wait); return; } } @@ -4871,7 +4871,7 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { } } -s32 func_8083AD4C(GlobalContext* globalCtx, Player* this) { +s32 func_8083AD4C(PlayState* play, Player* this) { s32 cameraMode; if (this->unk_6AD == 2) { @@ -4888,12 +4888,12 @@ s32 func_8083AD4C(GlobalContext* globalCtx, Player* this) { cameraMode = CAM_MODE_FIRSTPERSON; } - return Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), cameraMode); + return Camera_ChangeMode(Play_GetCamera(play, 0), cameraMode); } -s32 func_8083ADD4(GlobalContext* globalCtx, Player* this) { +s32 func_8083ADD4(PlayState* play, Player* this) { if (this->unk_6AD == 3) { - func_80835C58(globalCtx, this, func_80852E14, 0); + func_80835C58(play, this, func_80852E14, 0); if (this->unk_46A != 0) { this->stateFlags1 |= PLAYER_STATE1_29; } @@ -4923,18 +4923,18 @@ void func_8083AE40(Player* this, s16 objectId) { } } -void func_8083AF44(GlobalContext* globalCtx, Player* this, s32 magicSpell) { - func_80835DE4(globalCtx, this, func_808507F4, 0); +void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { + func_80835DE4(play, this, func_808507F4, 0); this->unk_84F = magicSpell - 3; - func_80087708(globalCtx, sMagicSpellCosts[magicSpell], 4); + func_80087708(play, sMagicSpellCosts[magicSpell], 4); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f); if (magicSpell == 5) { - this->unk_46C = OnePointCutscene_Init(globalCtx, 1100, -101, NULL, MAIN_CAM); + this->unk_46C = OnePointCutscene_Init(play, 1100, -101, NULL, MAIN_CAM); } else { - func_80835EA4(globalCtx, 10); + func_80835EA4(play, 10); } } @@ -4959,7 +4959,7 @@ static LinkAnimationHeader* D_80854548[] = { &gPlayerAnim_link_normal_take_out, }; -s32 func_8083B040(Player* this, GlobalContext* globalCtx) { +s32 func_8083B040(Player* this, PlayState* play) { s32 sp2C; s32 sp28; GetItemEntry giEntry; @@ -4968,17 +4968,17 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { if ((this->unk_6AD != 0) && (func_808332B8(this) || (this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_23))) { - if (!func_8083ADD4(globalCtx, this)) { + if (!func_8083ADD4(play, this)) { if (this->unk_6AD == 4) { sp2C = Player_ActionToMagicSpell(this, this->itemActionParam); if (sp2C >= 0) { if ((sp2C != 3) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { - func_8083AF44(globalCtx, this, sp2C); + func_8083AF44(play, this, sp2C); } else { - func_80835C58(globalCtx, this, func_8085063C, 1); + func_80835C58(play, this, func_8085063C, 1); this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; - func_80832264(globalCtx, this, func_80833338(this)); - func_80835EA4(globalCtx, 4); + func_80832264(play, this, func_80833338(this)); + func_80835EA4(play, 4); } func_80832224(this); @@ -4994,8 +4994,8 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { (((this->itemActionParam == PLAYER_AP_BOTTLE_POE) && (this->exchangeItemId == EXCH_ITEM_POE)) || (this->exchangeItemId == EXCH_ITEM_BLUE_FIRE))))))) { - if ((globalCtx->actorCtx.titleCtx.delayTimer == 0) && (globalCtx->actorCtx.titleCtx.alpha == 0)) { - func_80835DE4(globalCtx, this, func_8084F104, 0); + if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { + func_80835DE4(play, this, func_8084F104, 0); if (sp2C >= 0) { if (this->getItemEntry.objectId == OBJECT_INVALID) { @@ -5025,7 +5025,7 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { ((this->exchangeItemId != EXCH_ITEM_BEAN) || (this->itemActionParam == PLAYER_AP_BEAN))) { if (this->exchangeItemId == EXCH_ITEM_BEAN) { Inventory_ChangeAmmo(ITEM_BEAN, -1); - func_80835DE4(globalCtx, this, func_8084279C, 0); + func_80835DE4(play, this, func_8084279C, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->unk_850 = 0x50; this->unk_84F = -1; @@ -5035,20 +5035,20 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { } else if (sp2C == EXCH_ITEM_LETTER_RUTO) { this->unk_84F = 1; this->actor.textId = 0x4005; - func_80835EA4(globalCtx, 1); + func_80835EA4(play, 1); } else { this->unk_84F = 2; this->actor.textId = 0xCF; - func_80835EA4(globalCtx, 4); + func_80835EA4(play, 4); } this->actor.flags |= ACTOR_FLAG_8; this->exchangeItemId = sp2C; if (this->unk_84F < 0) { - func_80832B0C(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_32][this->modelAnimType]); + func_80832B0C(play, this, D_80853914[PLAYER_ANIMGROUP_32][this->modelAnimType]); } else { - func_80832264(globalCtx, this, D_80854548[this->unk_84F]); + func_80832264(play, this, D_80854548[this->unk_84F]); } func_80832224(this); @@ -5059,31 +5059,31 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { sp2C = Player_ActionToBottle(this, this->itemActionParam); if (sp2C >= 0) { if (sp2C == 0xC) { - func_80835DE4(globalCtx, this, func_8084EED8, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_link_bottle_bug_out); - func_80835EA4(globalCtx, 3); + func_80835DE4(play, this, func_8084EED8, 0); + func_808322D0(play, this, &gPlayerAnim_link_bottle_bug_out); + func_80835EA4(play, 3); } else if ((sp2C > 0) && (sp2C < 4)) { - func_80835DE4(globalCtx, this, func_8084EFC0, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_link_bottle_fish_out); - func_80835EA4(globalCtx, (sp2C == 1) ? 1 : 5); + func_80835DE4(play, this, func_8084EFC0, 0); + func_808322D0(play, this, &gPlayerAnim_link_bottle_fish_out); + func_80835EA4(play, (sp2C == 1) ? 1 : 5); } else { - func_80835DE4(globalCtx, this, func_8084EAC0, 0); - func_80832B78(globalCtx, this, &gPlayerAnim_link_bottle_drink_demo_start); - func_80835EA4(globalCtx, 2); + func_80835DE4(play, this, func_8084EAC0, 0); + func_80832B78(play, this, &gPlayerAnim_link_bottle_drink_demo_start); + func_80835EA4(play, 2); } } else { - func_80835DE4(globalCtx, this, func_8084E3C4, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_link_normal_okarina_start); + func_80835DE4(play, this, func_8084E3C4, 0); + func_808322D0(play, this, &gPlayerAnim_link_normal_okarina_start); this->stateFlags2 |= PLAYER_STATE2_27; - func_80835EA4(globalCtx, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); + func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); if (this->unk_6A8 != NULL) { this->stateFlags2 |= PLAYER_STATE2_25; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, this->unk_6A8); + Camera_SetParam(Play_GetCamera(play, 0), 8, this->unk_6A8); } } - } else if (func_8083AD4C(globalCtx, this)) { + } else if (func_8083AD4C(play, this)) { if (!(this->stateFlags1 & PLAYER_STATE1_23)) { - func_80835C58(globalCtx, this, func_8084B1D8, 1); + func_80835C58(play, this, func_8084B1D8, 1); this->unk_850 = 13; func_8083B010(this); } @@ -5107,7 +5107,7 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083B644(Player* this, GlobalContext* globalCtx) { +s32 func_8083B644(Player* this, PlayState* play) { Actor* sp34 = this->targetActor; Actor* sp30 = this->unk_664; Actor* sp2C = NULL; @@ -5173,7 +5173,7 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) { } this->currentMask = D_80858AA4; - func_80853148(globalCtx, sp34); + func_80853148(play, sp34); return 1; } } @@ -5183,9 +5183,9 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083B8F4(Player* this, GlobalContext* globalCtx) { +s32 func_8083B8F4(Player* this, PlayState* play) { if (!(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_23)) && - Camera_CheckValidMode(Gameplay_GetCamera(globalCtx, 0), 6)) { + Camera_CheckValidMode(Play_GetCamera(play, 0), 6)) { if ((this->actor.bgCheckFlags & 1) || (func_808332B8(this) && (this->actor.yDistToWater < this->ageProperties->unk_2C))) { this->unk_6AD = 1; @@ -5196,9 +5196,9 @@ s32 func_8083B8F4(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083B998(Player* this, GlobalContext* globalCtx) { +s32 func_8083B998(Player* this, PlayState* play) { if (this->unk_6AD != 0) { - func_8083B040(this, globalCtx); + func_8083B040(this, play); return 1; } @@ -5207,16 +5207,16 @@ s32 func_8083B998(Player* this, GlobalContext* globalCtx) { this->stateFlags2 |= PLAYER_STATE2_21; } else if ((this->naviTextId == 0 || CVar_GetS32("gNaviOnL", 0)) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && (YREG(15) != 0x10) && (YREG(15) != 0x20) && - !func_8083B8F4(this, globalCtx)) { + !func_8083B8F4(this, play)) { func_80078884(NA_SE_SY_ERROR); } return 0; } -void func_8083BA90(GlobalContext* globalCtx, Player* this, s32 arg2, f32 xzVelocity, f32 yVelocity) { - func_80837948(globalCtx, this, arg2); - func_80835C58(globalCtx, this, func_80844AF4, 0); +void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzVelocity, f32 yVelocity) { + func_80837948(play, this, arg2); + func_80835C58(play, this, func_80844AF4, 0); this->stateFlags3 |= PLAYER_STATE3_1; @@ -5242,32 +5242,32 @@ s32 func_8083BB20(Player* this) { return 0; } -s32 func_8083BBA0(Player* this, GlobalContext* globalCtx) { +s32 func_8083BBA0(Player* this, PlayState* play) { if (func_8083BB20(this) && (D_808535E4 != 7)) { - func_8083BA90(globalCtx, this, 17, 3.0f, 4.5f); + func_8083BA90(play, this, 17, 3.0f, 4.5f); return 1; } return 0; } -void func_8083BC04(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80844708, 0); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_16][this->modelAnimType], +void func_8083BC04(Player* this, PlayState* play) { + func_80835C58(play, this, func_80844708, 0); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_16][this->modelAnimType], 1.25f * D_808535E8); } -s32 func_8083BC7C(Player* this, GlobalContext* globalCtx) { +s32 func_8083BC7C(Player* this, PlayState* play) { if ((this->unk_84B[this->unk_846] == 0) && (D_808535E4 != 7)) { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); return 1; } return 0; } -void func_8083BCD0(Player* this, GlobalContext* globalCtx, s32 arg2) { - func_80838940(this, D_80853D4C[arg2][0], !(arg2 & 1) ? 5.8f : 3.5f, globalCtx, NA_SE_VO_LI_SWORD_N); +void func_8083BCD0(Player* this, PlayState* play, s32 arg2) { + func_80838940(this, D_80853D4C[arg2][0], !(arg2 & 1) ? 5.8f : 3.5f, play, NA_SE_VO_LI_SWORD_N); if (arg2) {} @@ -5282,33 +5282,33 @@ void func_8083BCD0(Player* this, GlobalContext* globalCtx, s32 arg2) { func_8002F7DC(&this->actor, ((arg2 << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); } -s32 func_8083BDBC(Player* this, GlobalContext* globalCtx) { +s32 func_8083BDBC(Player* this, PlayState* play) { s32 sp2C; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && - (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != 7) && - (SurfaceType_GetSlope(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) { + (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != 7) && + (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) { sp2C = this->unk_84B[this->unk_846]; if (sp2C <= 0) { if (func_80833BCC(this)) { if (this->actor.category != ACTORCAT_PLAYER) { if (sp2C < 0) { - func_808389E8(this, &gPlayerAnim_link_normal_jump, REG(69) / 100.0f, globalCtx); + func_808389E8(this, &gPlayerAnim_link_normal_jump, REG(69) / 100.0f, play); } else { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); } } else { if (Player_GetSwordHeld(this) && func_808365C8(this)) { - func_8083BA90(globalCtx, this, 17, 5.0f, 5.0f); + func_8083BA90(play, this, 17, 5.0f, 5.0f); } else { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); } } return 1; } } else { - func_8083BCD0(this, globalCtx, sp2C); + func_8083BCD0(this, play, sp2C); return 1; } } @@ -5316,7 +5316,7 @@ s32 func_8083BDBC(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083BF50(Player* this, GlobalContext* globalCtx) { +void func_8083BF50(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp30; @@ -5341,29 +5341,29 @@ void func_8083BF50(Player* this, GlobalContext* globalCtx) { sp30 /= 12.0f; } - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, 4.0f * sp30); this->currentYaw = this->actor.shape.rot.y; } -void func_8083C0B8(Player* this, GlobalContext* globalCtx) { - func_80839FFC(this, globalCtx); - func_8083BF50(this, globalCtx); +void func_8083C0B8(Player* this, PlayState* play) { + func_80839FFC(this, play); + func_8083BF50(this, play); } -void func_8083C0E8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840BC8, 1); - func_80832264(globalCtx, this, func_80833338(this)); +void func_8083C0E8(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840BC8, 1); + func_80832264(play, this, func_80833338(this)); this->currentYaw = this->actor.shape.rot.y; } -void func_8083C148(Player* this, GlobalContext* globalCtx) { +void func_8083C148(Player* this, PlayState* play) { if (!(this->stateFlags3 & PLAYER_STATE3_7)) { func_8083B010(this); if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } if (this->unk_6AD < 4) { this->unk_6AD = 0; @@ -5373,14 +5373,14 @@ void func_8083C148(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_20); } -s32 func_8083C1DC(Player* this, GlobalContext* globalCtx) { +s32 func_8083C1DC(Player* this, PlayState* play) { if (!func_80833B54(this) && (D_808535E0 == 0) && !(this->stateFlags1 & PLAYER_STATE1_23) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { - if (func_8083BC7C(this, globalCtx)) { + if (func_8083BC7C(this, play)) { return 1; } if ((this->unk_837 == 0) && (this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER)) { - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); } else { this->stateFlags2 ^= PLAYER_STATE2_20; } @@ -5389,18 +5389,18 @@ s32 func_8083C1DC(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083C2B0(Player* this, GlobalContext* globalCtx) { +s32 func_8083C2B0(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; - if ((globalCtx->shootingGalleryStatus == 0) && (this->currentShield != PLAYER_SHIELD_NONE) && + if ((play->shootingGalleryStatus == 0) && (this->currentShield != PLAYER_SHIELD_NONE) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R) && (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->unk_664 == NULL)))) { func_80832318(this); - func_808323B4(globalCtx, this); + func_808323B4(play, this); - if (func_80835C58(globalCtx, this, func_80843188, 0)) { + if (func_80835C58(play, this, func_80843188, 0)) { this->stateFlags1 |= PLAYER_STATE1_22; if (!Player_IsChildWithHylianShield(this)) { @@ -5421,10 +5421,10 @@ s32 func_8083C2B0(Player* this, GlobalContext* globalCtx) { } frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); if (Player_IsChildWithHylianShield(this)) { - func_80832F54(globalCtx, this, 4); + func_80832F54(play, this, 4); } func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_POSTURE); @@ -5457,12 +5457,12 @@ void func_8083C50C(Player* this) { } } -s32 func_8083C544(Player* this, GlobalContext* globalCtx) { +s32 func_8083C544(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetSwordHeld(this) != 0) && (this->unk_844 == 1) && (this->heldItemActionParam != PLAYER_AP_STICK)) { if ((this->heldItemActionParam != PLAYER_AP_SWORD_BGS) || (gSaveContext.swordHealth > 0.0f)) { - func_808377DC(globalCtx, this); + func_808377DC(play, this); return 1; } } @@ -5473,11 +5473,11 @@ s32 func_8083C544(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083C61C(GlobalContext* globalCtx, Player* this) { - if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (this->actor.bgCheckFlags & 1) && +s32 func_8083C61C(PlayState* play, Player* this) { + if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (this->actor.bgCheckFlags & 1) && (AMMO(ITEM_NUT) != 0)) { - func_80835C58(globalCtx, this, func_8084E604, 0); - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_light_bom); + func_80835C58(play, this, func_8084E604, 0); + func_80832264(play, this, &gPlayerAnim_link_normal_light_bom); this->unk_6AD = 0; return 1; } @@ -5490,18 +5490,18 @@ static struct_80854554 D_80854554[] = { { &gPlayerAnim_link_bottle_fish_miss, &gPlayerAnim_link_bottle_fish_in, 5, 3 }, }; -s32 func_8083C6B8(GlobalContext* globalCtx, Player* this) { +s32 func_8083C6B8(PlayState* play, Player* this) { Vec3f sp24; if (D_80853614) { if (Player_GetBottleHeld(this) >= 0) { - func_80835C58(globalCtx, this, func_8084ECA4, 0); + func_80835C58(play, this, func_8084ECA4, 0); if (this->actor.yDistToWater > 12.0f) { this->unk_850 = 1; } - func_808322D0(globalCtx, this, D_80854554[this->unk_850].unk_00); + func_808322D0(play, this, D_80854554[this->unk_850].unk_00); func_8002F7DC(&this->actor, NA_SE_IT_SWORD_SWING); func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); @@ -5515,15 +5515,15 @@ s32 func_8083C6B8(GlobalContext* globalCtx, Player* this) { if (CVar_GetS32("gHoverFishing", 0) ? 0 : !(this->actor.bgCheckFlags & 1) || (this->actor.world.pos.z > 1300.0f) || - BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &sp24, 20.0f)) { + BgCheck_SphVsFirstPoly(&play->colCtx, &sp24, 20.0f)) { func_80078884(NA_SE_SY_ERROR); return 0; } - func_80835C58(globalCtx, this, func_80850C68, 0); + func_80835C58(play, this, func_80850C68, 0); this->unk_860 = 1; func_80832210(this); - func_80832264(globalCtx, this, &gPlayerAnim_link_fishing_throw); + func_80832264(play, this, &gPlayerAnim_link_fishing_throw); return 1; } else { return 0; @@ -5533,7 +5533,7 @@ s32 func_8083C6B8(GlobalContext* globalCtx, Player* this) { return 0; } -void func_8083C858(Player* this, GlobalContext* globalCtx) { +void func_8083C858(Player* this, PlayState* play) { PlayerFunc674 func; if (func_80833BCC(this)) { @@ -5542,64 +5542,64 @@ void func_8083C858(Player* this, GlobalContext* globalCtx) { func = func_80842180; } - func_80835C58(globalCtx, this, func, 1); - func_80832BE8(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_2][this->modelAnimType]); + func_80835C58(play, this, func, 1); + func_80832BE8(play, this, D_80853914[PLAYER_ANIMGROUP_2][this->modelAnimType]); this->unk_89C = 0; this->unk_864 = this->unk_868 = 0.0f; } -void func_8083C8DC(Player* this, GlobalContext* globalCtx, s16 arg2) { +void func_8083C8DC(Player* this, PlayState* play, s16 arg2) { this->actor.shape.rot.y = this->currentYaw = arg2; - func_8083C858(this, globalCtx); + func_8083C858(this, play); } -s32 func_8083C910(GlobalContext* globalCtx, Player* this, f32 arg2) { +s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { WaterBox* sp2C; f32 sp28; sp28 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, &sp2C) != 0) { sp28 -= this->actor.world.pos.y; if (this->ageProperties->unk_24 <= sp28) { - func_80835C58(globalCtx, this, func_8084D7C4, 0); - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim); + func_80835C58(play, this, func_8084D7C4, 0); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); this->stateFlags1 |= PLAYER_STATE1_27 | PLAYER_STATE1_29; this->unk_850 = 20; this->linearVelocity = 2.0f; - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); return 0; } } - func_80838E70(globalCtx, this, arg2, this->actor.shape.rot.y); + func_80838E70(play, this, arg2, this->actor.shape.rot.y); this->stateFlags1 |= PLAYER_STATE1_29; return 1; } -void func_8083CA20(GlobalContext* globalCtx, Player* this) { - if (func_8083C910(globalCtx, this, 180.0f)) { +void func_8083CA20(PlayState* play, Player* this) { + if (func_8083C910(play, this, 180.0f)) { this->unk_850 = -20; } } -void func_8083CA54(GlobalContext* globalCtx, Player* this) { +void func_8083CA54(PlayState* play, Player* this) { this->linearVelocity = 2.0f; gSaveContext.entranceSpeed = 2.0f; - if (func_8083C910(globalCtx, this, 120.0f)) { + if (func_8083C910(play, this, 120.0f)) { this->unk_850 = -15; } } -void func_8083CA9C(GlobalContext* globalCtx, Player* this) { +void func_8083CA9C(PlayState* play, Player* this) { if (gSaveContext.entranceSpeed < 0.1f) { gSaveContext.entranceSpeed = 0.1f; } this->linearVelocity = gSaveContext.entranceSpeed; - if (func_8083C910(globalCtx, this, 800.0f)) { + if (func_8083C910(play, this, 800.0f)) { this->unk_850 = -80 / this->linearVelocity; if (this->unk_850 < -20) { this->unk_850 = -20; @@ -5607,84 +5607,84 @@ void func_8083CA9C(GlobalContext* globalCtx, Player* this) { } } -void func_8083CB2C(Player* this, s16 yaw, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808414F8, 1); - LinkAnimation_CopyJointToMorph(globalCtx, &this->skelAnime); +void func_8083CB2C(Player* this, s16 yaw, PlayState* play) { + func_80835C58(play, this, func_808414F8, 1); + LinkAnimation_CopyJointToMorph(play, &this->skelAnime); this->unk_864 = this->unk_868 = 0.0f; this->currentYaw = yaw; } -void func_8083CB94(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840DE4, 1); - func_80832BE8(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType]); +void func_8083CB94(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840DE4, 1); + func_80832BE8(play, this, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType]); } -void func_8083CBF0(Player* this, s16 yaw, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808423EC, 1); - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_anchor_back_walk, 2.2f, 0.0f, +void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { + func_80835C58(play, this, func_808423EC, 1); + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_walk, 2.2f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_anchor_back_walk), ANIMMODE_ONCE, -6.0f); this->linearVelocity = 8.0f; this->currentYaw = yaw; } -void func_8083CC9C(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084193C, 1); - func_80832BE8(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_25][this->modelAnimType]); +void func_8083CC9C(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084193C, 1); + func_80832BE8(play, this, D_80853914[PLAYER_ANIMGROUP_25][this->modelAnimType]); this->unk_868 = 0.0f; } -void func_8083CD00(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084251C, 1); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, &gPlayerAnim_link_anchor_back_brake, 2.0f); +void func_8083CD00(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084251C, 1); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_brake, 2.0f); } -void func_8083CD54(GlobalContext* globalCtx, Player* this, s16 yaw) { +void func_8083CD54(PlayState* play, Player* this, s16 yaw) { this->currentYaw = yaw; - func_80835C58(globalCtx, this, func_80841BA8, 1); + func_80835C58(play, this, func_80841BA8, 1); this->unk_87E = 1200; this->unk_87E *= D_808535E8; - LinkAnimation_Change(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_26][this->modelAnimType], 1.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_26][this->modelAnimType], 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); } -void func_8083CE0C(Player* this, GlobalContext* globalCtx) { +void func_8083CE0C(Player* this, PlayState* play) { LinkAnimationHeader* anim; - func_80835C58(globalCtx, this, func_80840BC8, 1); + func_80835C58(play, this, func_80840BC8, 1); if (this->unk_870 < 0.5f) { anim = D_80853914[PLAYER_ANIMGROUP_28][this->modelAnimType]; } else { anim = D_80853914[PLAYER_ANIMGROUP_27][this->modelAnimType]; } - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); this->currentYaw = this->actor.shape.rot.y; } -void func_8083CEAC(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840450, 1); - func_80832B0C(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_7][this->modelAnimType]); +void func_8083CEAC(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840450, 1); + func_80832B0C(play, this, D_80853914[PLAYER_ANIMGROUP_7][this->modelAnimType]); this->unk_850 = 1; } -void func_8083CF10(Player* this, GlobalContext* globalCtx) { +void func_8083CF10(Player* this, PlayState* play) { if (this->linearVelocity != 0.0f) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else { - func_8083CE0C(this, globalCtx); + func_8083CE0C(this, play); } } -void func_8083CF5C(Player* this, GlobalContext* globalCtx) { +void func_8083CF5C(Player* this, PlayState* play) { if (this->linearVelocity != 0.0f) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } -s32 func_8083CFA8(GlobalContext* globalCtx, Player* this, f32 arg2, s32 splashScale) { +s32 func_8083CFA8(PlayState* play, Player* this, f32 arg2, s32 splashScale) { f32 sp3C = fabsf(arg2); WaterBox* sp38; f32 sp34; @@ -5695,11 +5695,11 @@ s32 func_8083CFA8(GlobalContext* globalCtx, Player* this, f32 arg2, s32 splashSc splashPos.x = this->bodyPartsPos[PLAYER_BODYPART_WAIST].x; splashPos.z = this->bodyPartsPos[PLAYER_BODYPART_WAIST].z; sp34 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, splashPos.x, splashPos.z, &sp34, &sp38)) { + if (WaterBox_GetSurface1(play, &play->colCtx, splashPos.x, splashPos.z, &sp34, &sp38)) { if ((sp34 - this->actor.world.pos.y) < 100.0f) { splashType = (sp3C <= 10.0f) ? 0 : 1; splashPos.y = sp34; - EffectSsGSplash_Spawn(globalCtx, &splashPos, NULL, NULL, splashType, splashScale); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, splashType, splashScale); return 1; } } @@ -5708,25 +5708,25 @@ s32 func_8083CFA8(GlobalContext* globalCtx, Player* this, f32 arg2, s32 splashSc return 0; } -void func_8083D0A8(GlobalContext* globalCtx, Player* this, f32 arg2) { +void func_8083D0A8(PlayState* play, Player* this, f32 arg2) { this->stateFlags1 |= PLAYER_STATE1_18; this->stateFlags1 &= ~PLAYER_STATE1_27; - func_80832340(globalCtx, this); - if (func_8083CFA8(globalCtx, this, arg2, 500)) { + func_80832340(play, this); + if (func_8083CFA8(play, this, arg2, 500)) { func_8002F7DC(&this->actor, NA_SE_EV_JUMP_OUT_WATER); } - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); } -s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { +s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { if (!(this->stateFlags1 & PLAYER_STATE1_10) && !(this->stateFlags2 & PLAYER_STATE2_10)) { if ((arg2 == NULL) || (CHECK_BTN_ALL(arg2->press.button, BTN_A) && (ABS(this->unk_6C2) < 12000) && (this->currentBoots != PLAYER_BOOTS_IRON))) { - func_80835C58(globalCtx, this, func_8084DC48, 0); - func_80832264(globalCtx, this, &gPlayerAnim_link_swimer_swim_deep_start); + func_80835C58(play, this, func_8084DC48, 0); + func_80832264(play, this, &gPlayerAnim_link_swimer_swim_deep_start); this->unk_6C2 = 0; this->stateFlags2 |= PLAYER_STATE2_10; @@ -5748,7 +5748,7 @@ s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { this->stateFlags2 &= ~PLAYER_STATE2_10; if (arg2 != NULL) { - func_80835C58(globalCtx, this, func_8084E1EC, 1); + func_80835C58(play, this, func_8084E1EC, 1); if (this->stateFlags1 & PLAYER_STATE1_10) { this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; @@ -5757,12 +5757,12 @@ s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { this->unk_850 = 2; } - func_80832340(globalCtx, this); - func_80832B0C(globalCtx, this, + func_80832340(play, this); + func_80832B0C(play, this, (this->stateFlags1 & PLAYER_STATE1_11) ? &gPlayerAnim_link_swimer_swim_get : &gPlayerAnim_link_swimer_swim_deep_end); - if (func_8083CFA8(globalCtx, this, this->actor.velocity.y, 500)) { + if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) { func_8002F7DC(&this->actor, NA_SE_PL_FACE_UP); } @@ -5774,33 +5774,33 @@ s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { return 0; } -void func_8083D330(GlobalContext* globalCtx, Player* this) { - func_80832284(globalCtx, this, &gPlayerAnim_link_swimer_swim); +void func_8083D330(PlayState* play, Player* this) { + func_80832284(play, this, &gPlayerAnim_link_swimer_swim); this->unk_6C2 = 16000; this->unk_850 = 1; } -void func_8083D36C(GlobalContext* globalCtx, Player* this) { +void func_8083D36C(PlayState* play, Player* this) { if ((this->currentBoots != PLAYER_BOOTS_IRON) || !(this->actor.bgCheckFlags & 1)) { - func_80832564(globalCtx, this); + func_80832564(play, this); if ((this->currentBoots != PLAYER_BOOTS_IRON) && (this->stateFlags2 & PLAYER_STATE2_10)) { this->stateFlags2 &= ~PLAYER_STATE2_10; - func_8083D12C(globalCtx, this, 0); + func_8083D12C(play, this, 0); this->unk_84F = 1; } else if (func_80844A44 == this->func_674) { - func_80835C58(globalCtx, this, func_8084DC48, 0); - func_8083D330(globalCtx, this); + func_80835C58(play, this, func_8084DC48, 0); + func_8083D330(play, this); } else { - func_80835C58(globalCtx, this, func_8084D610, 1); - func_80832B0C(globalCtx, this, + func_80835C58(play, this, func_8084D610, 1); + func_80832B0C(play, this, (this->actor.bgCheckFlags & 1) ? &gPlayerAnim_link_swimer_wait2swim_wait : &gPlayerAnim_link_swimer_land2swim_wait); } } if (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->actor.yDistToWater < this->ageProperties->unk_2C)) { - if (func_8083CFA8(globalCtx, this, this->actor.velocity.y, 500)) { + if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) { func_8002F7DC(&this->actor, NA_SE_EV_DIVE_INTO_WATER); if (this->fallDistance > 800.0f) { @@ -5814,10 +5814,10 @@ void func_8083D36C(GlobalContext* globalCtx, Player* this) { this->stateFlags1 &= ~(PLAYER_STATE1_18 | PLAYER_STATE1_19); this->unk_854 = 0.0f; - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); } -void func_8083D53C(GlobalContext* globalCtx, Player* this) { +void func_8083D53C(PlayState* play, Player* this) { if (this->actor.yDistToWater < this->ageProperties->unk_2C) { Audio_SetBaseFilter(0); this->unk_840 = 0; @@ -5836,19 +5836,19 @@ void func_8083D53C(GlobalContext* globalCtx, Player* this) { (func_8084D610 != this->func_674) && (func_8084D84C != this->func_674) && (func_8084DAB4 != this->func_674) && (func_8084DC48 != this->func_674) && (func_8084E1EC != this->func_674) && (func_8084D7C4 != this->func_674))) { - func_8083D36C(globalCtx, this); + func_8083D36C(play, this); return; } } else if ((this->stateFlags1 & PLAYER_STATE1_27) && (this->actor.yDistToWater < this->ageProperties->unk_24)) { if ((this->skelAnime.moveFlags == 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { - func_8083CD54(globalCtx, this, this->actor.shape.rot.y); + func_8083CD54(play, this, this->actor.shape.rot.y); } - func_8083D0A8(globalCtx, this, this->actor.velocity.y); + func_8083D0A8(play, this, this->actor.velocity.y); } } } -void func_8083D6EC(GlobalContext* globalCtx, Player* this) { +void func_8083D6EC(PlayState* play, Player* this) { Vec3f ripplePos; f32 temp1; f32 temp2; @@ -5914,12 +5914,12 @@ void func_8083D6EC(GlobalContext* globalCtx, Player* this) { ripplePos.x = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.x; ripplePos.y = this->actor.world.pos.y + this->actor.yDistToWater; ripplePos.z = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0); if ((this->linearVelocity > 4.0f) && !func_808332B8(this) && ((this->actor.world.pos.y + this->actor.yDistToWater) < this->bodyPartsPos[PLAYER_BODYPART_WAIST].y)) { - func_8083CFA8(globalCtx, this, 20.0f, + func_8083CFA8(play, this, 20.0f, (fabsf(this->linearVelocity) * 50.0f) + (this->actor.yDistToWater * 5.0f)); } } @@ -5938,7 +5938,7 @@ void func_8083D6EC(GlobalContext* globalCtx, Player* this) { } for (i = 0; i < numBubbles; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 20.0f, 10.0f, 20.0f, 0.13f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 20.0f, 10.0f, 20.0f, 0.13f); } } } @@ -5964,7 +5964,7 @@ s32 func_8083DB98(Player* this, s32 arg1) { static Vec3f D_8085456C = { 0.0f, 100.0f, 40.0f }; -void func_8083DC54(Player* this, GlobalContext* globalCtx) { +void func_8083DC54(Player* this, PlayState* play) { s16 sp46; s16 temp2; f32 temp1; @@ -5983,7 +5983,7 @@ void func_8083DC54(Player* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.focus.rot.x, -20000, 10, 4000, 800); } else { sp46 = 0; - temp1 = func_8083973C(globalCtx, this, &D_8085456C, &sp34); + temp1 = func_8083973C(play, this, &D_8085456C, &sp34); if (temp1 > BGCHECK_Y_MIN) { temp2 = Math_Atan2S(40.0f, this->actor.world.pos.y - temp1); sp46 = CLAMP(temp2, -4000, 4000); @@ -5995,7 +5995,7 @@ void func_8083DC54(Player* this, GlobalContext* globalCtx) { func_80836AB8(this, func_8002DD78(this) || func_808334B4(this)); } -void func_8083DDC8(Player* this, GlobalContext* globalCtx) { +void func_8083DDC8(Player* this, PlayState* play) { s16 temp1; s16 temp2; @@ -6010,7 +6010,7 @@ void func_8083DDC8(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_6C0, temp2, 200); this->unk_6AE |= 0x168; } else { - func_8083DC54(this, globalCtx); + func_8083DC54(this, play); } } @@ -6071,7 +6071,7 @@ static struct_80854578 D_80854578[] = { { &gPlayerAnim_link_uma_right_up, -34.16f, 7.91f }, }; -s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { +s32 func_8083E0FC(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; f32 unk_04; f32 unk_08; @@ -6083,7 +6083,7 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { sp38 = Math_CosS(rideActor->actor.shape.rot.y); sp34 = Math_SinS(rideActor->actor.shape.rot.y); - func_80836898(globalCtx, this, func_8083A360); + func_80836898(play, this, func_8083A360); this->stateFlags1 |= PLAYER_STATE1_23; this->actor.bgCheckFlags &= ~0x20; @@ -6104,12 +6104,12 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { this->unk_878 = rideActor->actor.world.pos.y - this->actor.world.pos.y; this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; - Actor_MountHorse(globalCtx, this, &rideActor->actor); - func_80832264(globalCtx, this, D_80854578[temp].anim); - func_80832F54(globalCtx, this, 0x9B); + Actor_MountHorse(play, this, &rideActor->actor); + func_80832264(play, this, D_80854578[temp].anim); + func_80832F54(play, this, 0x9B); this->actor.parent = this->rideActor; func_80832224(this); - Actor_DisableLens(globalCtx); + Actor_DisableLens(play); return 1; } @@ -6129,7 +6129,7 @@ static LinkAnimationHeader* D_80854590[] = { &gPlayerAnim_link_normal_up_slope_slip, }; -s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2) { +s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* arg2) { s32 pad; s16 sp4A; Vec3f sp3C; @@ -6138,8 +6138,8 @@ s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2) { f32 temp2; s16 temp3; - if (!Player_InBlockingCsMode(globalCtx, this) && (func_8084F390 != this->func_674) && - (SurfaceType_GetSlope(&globalCtx->colCtx, arg2, this->actor.floorBgId) == 1)) { + if (!Player_InBlockingCsMode(play, this) && (func_8084F390 != this->func_674) && + (SurfaceType_GetSlope(&play->colCtx, arg2, this->actor.floorBgId) == 1)) { sp4A = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); func_8083E298(arg2, &sp3C, &sp3A); temp3 = sp3A - sp4A; @@ -6153,12 +6153,12 @@ s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2) { this->windDirection = sp3A; Math_StepToF(&this->windSpeed, temp1, temp2); } else { - func_80835C58(globalCtx, this, func_8084F390, 0); - func_80832564(globalCtx, this); + func_80835C58(play, this, func_8084F390, 0); + func_80832564(play, this); if (D_80853610 >= 0) { this->unk_84F = 1; } - func_80832BE8(globalCtx, this, D_80854590[this->unk_84F]); + func_80832BE8(play, this, D_80854590[this->unk_84F]); this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->currentYaw = sp4A; return 1; @@ -6173,36 +6173,36 @@ static s32 D_80854598[] = { 0xFFDB0871, 0xF8310000, 0x00940470, 0xF3980000, 0xFFB504A9, 0x0C9F0000, 0x08010402, }; -void func_8083E4C4(GlobalContext* globalCtx, Player* this, GetItemEntry* giEntry) { +void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { s32 sp1C = giEntry->field & 0x1F; if (!(giEntry->field & 0x80)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, sp1C | 0x8000); + Item_DropCollectible(play, &this->actor.world.pos, sp1C | 0x8000); if ((sp1C != 4) && (sp1C != 8) && (sp1C != 9) && (sp1C != 0xA) && (sp1C != 0) && (sp1C != 1) && (sp1C != 2) && (sp1C != 0x14) && (sp1C != 0x13)) { - Item_Give(globalCtx, giEntry->itemId); + Item_Give(play, giEntry->itemId); } } else { - Item_Give(globalCtx, giEntry->itemId); + Item_Give(play, giEntry->itemId); } func_80078884((this->getItemId < 0 || this->getItemEntry.getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } // Sets a flag according to which type of flag is specified in player->pendingFlag.flagType // and which flag is specified in player->pendingFlag.flagID. -void Player_SetPendingFlag(Player* this, GlobalContext* globalCtx) { +void Player_SetPendingFlag(Player* this, PlayState* play) { switch (this->pendingFlag.flagType) { case FLAG_SCENE_CLEAR: - Flags_SetClear(globalCtx, this->pendingFlag.flagID); + Flags_SetClear(play, this->pendingFlag.flagID); break; case FLAG_SCENE_COLLECTIBLE: - Flags_SetCollectible(globalCtx, this->pendingFlag.flagID); + Flags_SetCollectible(play, this->pendingFlag.flagID); break; case FLAG_SCENE_SWITCH: - Flags_SetSwitch(globalCtx, this->pendingFlag.flagID); + Flags_SetSwitch(play, this->pendingFlag.flagID); break; case FLAG_SCENE_TREASURE: - Flags_SetTreasure(globalCtx, this->pendingFlag.flagID); + Flags_SetTreasure(play, this->pendingFlag.flagID); break; case FLAG_RANDOMIZER_INF: Flags_SetRandomizerInf(this->pendingFlag.flagID); @@ -6218,21 +6218,21 @@ void Player_SetPendingFlag(Player* this, GlobalContext* globalCtx) { this->pendingFlag.flagID = 0; } -s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { +s32 func_8083E5A8(Player* this, PlayState* play) { Actor* interactedActor; if(gSaveContext.pendingIceTrapCount) { gSaveContext.pendingIceTrapCount--; this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); this->actor.colChkInfo.damage = 0; - func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20); + func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry) GET_ITEM_NONE; return 1; } if (iREG(67) || (((interactedActor = this->interactRangeActor) != NULL) && - func_8002D53C(globalCtx, &globalCtx->actorCtx.titleCtx))) { + func_8002D53C(play, &play->actorCtx.titleCtx))) { if (iREG(67) || (this->getItemId > GI_NONE)) { if (iREG(67)) { this->getItemId = iREG(68); @@ -6256,9 +6256,9 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { // RANDOTODO: Abstract this to a function. this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); this->actor.colChkInfo.damage = 0; - func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20); - Player_SetPendingFlag(this, globalCtx); - Message_StartTextbox(globalCtx, 0xF8, NULL); + func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); + Player_SetPendingFlag(this, play); + Message_StartTextbox(play, 0xF8, NULL); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry) GET_ITEM_NONE; @@ -6269,7 +6269,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { // Show the cutscene for picking up an item. In vanilla, this happens in bombchu bowling alley (because getting bombchus need to show the cutscene) // and whenever the player doesn't have the item yet. In rando, we're overruling this because we need to keep showing the cutscene // because those items can be randomized and thus it's important to keep showing the cutscene. - uint8_t showItemCutscene = globalCtx->sceneNum == SCENE_BOWLING || Item_CheckObtainability(giEntry.itemId) == ITEM_NONE || gSaveContext.n64ddFlag; + uint8_t showItemCutscene = play->sceneNum == SCENE_BOWLING || Item_CheckObtainability(giEntry.itemId) == ITEM_NONE || gSaveContext.n64ddFlag; // Only skip cutscenes for drops when they're items/consumables from bushes/rocks/enemies. uint8_t isDropToSkip = (interactedActor->id == ACTOR_EN_ITEM00 && interactedActor->params != 6 && interactedActor->params != 17) || @@ -6288,13 +6288,13 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { // Show cutscene when picking up a item. if (showItemCutscene && !skipItemCutscene && !skipItemCutsceneRando) { - func_808323B4(globalCtx, this); + func_808323B4(play, this); func_8083AE40(this, giEntry.objectId); if (!(this->stateFlags2 & PLAYER_STATE2_10) || (this->currentBoots == PLAYER_BOOTS_IRON)) { - func_80836898(globalCtx, this, func_8083A434); - func_808322D0(globalCtx, this, &gPlayerAnim_link_demo_get_itemB); - func_80835EA4(globalCtx, 9); + func_80836898(play, this, func_8083A434); + func_808322D0(play, this, &gPlayerAnim_link_demo_get_itemB); + func_80835EA4(play, 9); } this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; @@ -6303,7 +6303,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { } // Don't show cutscene when picking up an item. - func_8083E4C4(globalCtx, this, &giEntry); + func_8083E4C4(play, this, &giEntry); this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; } @@ -6329,7 +6329,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { } } - func_80836898(globalCtx, this, func_8083A434); + func_80836898(play, this, func_8083A434); this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; func_8083AE40(this, giEntry.objectId); this->actor.world.pos.x = @@ -6341,12 +6341,12 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { if ((giEntry.itemId != ITEM_NONE) && (giEntry.gi >= 0) && (Item_CheckObtainability(giEntry.itemId) == ITEM_NONE)) { - func_808322D0(globalCtx, this, this->ageProperties->unk_98); - func_80832F54(globalCtx, this, 0x28F); + func_808322D0(play, this, this->ageProperties->unk_98); + func_80832F54(play, this, 0x28F); chest->unk_1F4 = 1; - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), CAM_SET_SLOW_CHEST_CS); + Camera_ChangeSetting(Play_GetCamera(play, 0), CAM_SET_SLOW_CHEST_CS); } else { - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_box_kick); + func_80832264(play, this, &gPlayerAnim_link_normal_box_kick); chest->unk_1F4 = -1; } @@ -6360,13 +6360,13 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { this->itemActionParam = PLAYER_AP_NONE; this->modelAnimType = PLAYER_ANIMTYPE_0; this->heldItemActionParam = this->itemActionParam; - func_80836898(globalCtx, this, func_8083A0F4); + func_80836898(play, this, func_8083A0F4); if (sp24 == PLAYER_AP_SWORD_MASTER) { this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_AP_LAST_USED); - func_8083399C(globalCtx, this, PLAYER_AP_LAST_USED); + func_8083399C(play, this, PLAYER_AP_LAST_USED); } else { - func_80835F44(globalCtx, this, ITEM_LAST_USED); + func_80835F44(play, this, ITEM_LAST_USED); } } else { s32 strength = Player_GetStrength(); @@ -6376,7 +6376,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { return 0; } - func_80836898(globalCtx, this, func_8083A0F4); + func_80836898(play, this, func_8083A0F4); } func_80832224(this); @@ -6389,9 +6389,9 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083EA94(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80846578, 1); - func_80832264(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_29][this->modelAnimType]); +void func_8083EA94(Player* this, PlayState* play) { + func_80835C58(play, this, func_80846578, 1); + func_80832264(play, this, D_80853914[PLAYER_ANIMGROUP_29][this->modelAnimType]); } s32 func_8083EAF0(Player* this, Actor* actor) { @@ -6403,19 +6403,19 @@ s32 func_8083EAF0(Player* this, Actor* actor) { return 1; } -s32 func_8083EB44(Player* this, GlobalContext* globalCtx) { +s32 func_8083EB44(Player* this, PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; if (CVar_GetS32("gDpadEquips", 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if ((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor != NULL) && CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)) { - if (!func_80835644(globalCtx, this, this->heldActor)) { + if (!func_80835644(play, this, this->heldActor)) { if (!func_8083EAF0(this, this->heldActor)) { - func_80835C58(globalCtx, this, func_808464B0, 1); - func_80832264(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_30][this->modelAnimType]); + func_80835C58(play, this, func_808464B0, 1); + func_80832264(play, this, D_80853914[PLAYER_ANIMGROUP_30][this->modelAnimType]); } else { - func_8083EA94(this, globalCtx); + func_8083EA94(this, play); } } return 1; @@ -6424,14 +6424,14 @@ s32 func_8083EB44(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { +s32 func_8083EC18(Player* this, PlayState* play, u32 arg2) { if (this->wallHeight >= 79.0f) { if (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->currentBoots == PLAYER_BOOTS_IRON) || (this->actor.yDistToWater < this->ageProperties->unk_2C)) { s32 sp8C = (arg2 & 8) ? 2 : 0; if ((sp8C != 0) || (arg2 & 2) || - func_80041E4C(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { + func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { f32 phi_f20; CollisionPoly* sp84 = this->actor.wallPoly; f32 sp80; @@ -6451,7 +6451,7 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { Vec3f* sp44 = &sp50[0]; s32 pad; - CollisionPoly_GetVerticesByBgId(sp84, this->actor.wallBgId, &globalCtx->colCtx, sp50); + CollisionPoly_GetVerticesByBgId(sp84, this->actor.wallBgId, &play->colCtx, sp50); sp80 = phi_f12 = sp44->x; sp7C = phi_f14 = sp44->z; @@ -6492,7 +6492,7 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { f32 sp34 = this->wallDistance; LinkAnimationHeader* sp30; - func_80836898(globalCtx, this, func_8083A3B0); + func_80836898(play, this, func_8083A3B0); this->stateFlags1 |= PLAYER_STATE1_21; this->stateFlags1 &= ~PLAYER_STATE1_27; @@ -6521,8 +6521,8 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { this->actor.world.pos.z = (sp34 * sp38) + sp7C; func_80832224(this); Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); - func_80832264(globalCtx, this, sp30); - func_80832F54(globalCtx, this, 0x9F); + func_80832264(play, this, sp30); + func_80832F54(play, this, 0x9F); return 1; } @@ -6533,12 +6533,12 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { return 0; } -void func_8083F070(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - func_80835DAC(globalCtx, this, func_8084C5F8, 0); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, (4.0f / 3.0f)); +void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) { + func_80835DAC(play, this, func_8084C5F8, 0); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f)); } -s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { +s32 func_8083F0C8(Player* this, PlayState* play, u32 arg2) { CollisionPoly* wallPoly; Vec3f wallVertices[3]; f32 tempX; @@ -6549,7 +6549,7 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_27) && (arg2 & 0x30)) { wallPoly = this->actor.wallPoly; - CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &globalCtx->colCtx, wallVertices); + CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &play->colCtx, wallVertices); // compute min and max x/z of wall vertices tempX = temp = wallVertices[0].x; @@ -6583,15 +6583,15 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { f32 wallPolyNormZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); f32 wallDistance = this->wallDistance; - func_80836898(globalCtx, this, func_8083A40C); + func_80836898(play, this, func_8083A40C); this->stateFlags2 |= PLAYER_STATE2_18; this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; this->actor.world.pos.x = tempX + (wallDistance * wallPolyNormX); this->actor.world.pos.z = tempZ + (wallDistance * wallPolyNormZ); func_80832224(this); this->actor.prevPos = this->actor.world.pos; - func_80832264(globalCtx, this, &gPlayerAnim_link_child_tunnel_start); - func_80832F54(globalCtx, this, 0x9D); + func_80832264(play, this, &gPlayerAnim_link_child_tunnel_start); + func_80832F54(play, this, 0x9D); return 1; } @@ -6601,7 +6601,7 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { return 0; } -s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { CollisionPoly* wallPoly; s32 sp78; Vec3f sp6C; @@ -6622,14 +6622,14 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f3 sp60.z = this->actor.world.pos.z + (arg3 * yawCos); sp60.y = sp6C.y = this->actor.world.pos.y + arg1; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp6C, &sp60, &sp54, &this->actor.wallPoly, true, false, false, + if (BgCheck_EntityLineTest1(&play->colCtx, &sp6C, &sp60, &sp54, &this->actor.wallPoly, true, false, false, true, &sp78)) { wallPoly = this->actor.wallPoly; this->actor.bgCheckFlags |= 0x200; this->actor.wallBgId = sp78; - D_808535F0 = func_80041DB8(&globalCtx->colCtx, wallPoly, sp78); + D_808535F0 = func_80041DB8(&play->colCtx, wallPoly, sp78); temp1 = COLPOLY_GET_NORMAL(wallPoly->normal.x); temp2 = COLPOLY_GET_NORMAL(wallPoly->normal.z); @@ -6648,11 +6648,11 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f3 return 0; } -s32 func_8083F524(GlobalContext* globalCtx, Player* this) { - return func_8083F360(globalCtx, this, 26.0f, this->ageProperties->unk_38 + 5.0f, 30.0f, 0.0f); +s32 func_8083F524(PlayState* play, Player* this) { + return func_8083F360(play, this, 26.0f, this->ageProperties->unk_38 + 5.0f, 30.0f, 0.0f); } -s32 func_8083F570(Player* this, GlobalContext* globalCtx) { +s32 func_8083F570(Player* this, PlayState* play) { s16 temp; if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & 8) && (D_808535F0 & 0x30)) { @@ -6663,20 +6663,20 @@ s32 func_8083F570(Player* this, GlobalContext* globalCtx) { } if (ABS(temp) > 0x4000) { - func_80835C58(globalCtx, this, func_8084C81C, 0); + func_80835C58(play, this, func_8084C81C, 0); if (this->linearVelocity > 0.0f) { this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; - func_80832264(globalCtx, this, &gPlayerAnim_link_child_tunnel_end); - func_80832F54(globalCtx, this, 0x9D); - OnePointCutscene_Init(globalCtx, 9601, 999, NULL, MAIN_CAM); + func_80832264(play, this, &gPlayerAnim_link_child_tunnel_end); + func_80832F54(play, this, 0x9D); + OnePointCutscene_Init(play, 9601, 999, NULL, MAIN_CAM); } else { this->actor.shape.rot.y = this->actor.wallYaw; - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, -1.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, -1.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(globalCtx, this, 0x9D); - OnePointCutscene_Init(globalCtx, 9602, 999, NULL, MAIN_CAM); + func_80832F54(play, this, 0x9D); + OnePointCutscene_Init(play, 9602, 999, NULL, MAIN_CAM); } this->currentYaw = this->actor.shape.rot.y; @@ -6689,24 +6689,24 @@ s32 func_8083F570(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083F72C(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - if (!func_80836898(globalCtx, this, func_8083A388)) { - func_80835C58(globalCtx, this, func_8084B78C, 0); +void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { + if (!func_80836898(play, this, func_8083A388)) { + func_80835C58(play, this, func_8084B78C, 0); } - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); func_80832224(this); this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; } -s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { +s32 func_8083F7BC(Player* this, PlayState* play) { DynaPolyActor* wallPolyActor; if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->actor.bgCheckFlags & 0x200) && (D_80853608 < 0x3000)) { - if (((this->linearVelocity > 0.0f) && func_8083EC18(this, globalCtx, D_808535F0)) || - func_8083F0C8(this, globalCtx, D_808535F0)) { + if (((this->linearVelocity > 0.0f) && func_8083EC18(this, play, D_808535F0)) || + func_8083F0C8(this, play, D_808535F0)) { return 1; } @@ -6718,14 +6718,14 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)) { if ((this->actor.wallBgId != BGCHECK_SCENE) && - ((wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId)) != NULL)) { + ((wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId)) != NULL)) { if (wallPolyActor->actor.id == ACTOR_BG_HEAVY_BLOCK) { if (Player_GetStrength() < PLAYER_STR_GOLD_G) { return 0; } - func_80836898(globalCtx, this, func_8083A0F4); + func_80836898(play, this, func_8083A0F4); this->stateFlags1 |= PLAYER_STATE1_11; this->interactRangeActor = &wallPolyActor->actor; this->getItemId = GI_NONE; @@ -6741,7 +6741,7 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { this->unk_3C4 = NULL; } - func_8083F72C(this, &gPlayerAnim_link_normal_push_wait, globalCtx); + func_8083F72C(this, &gPlayerAnim_link_normal_push_wait, play); return 1; } @@ -6751,13 +6751,13 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083F9D0(GlobalContext* globalCtx, Player* this) { +s32 func_8083F9D0(PlayState* play, Player* this) { if ((this->actor.bgCheckFlags & 0x200) && ((this->stateFlags2 & PLAYER_STATE2_4) || CHECK_BTN_ALL(sControlInput->cur.button, BTN_A))) { DynaPolyActor* wallPolyActor = NULL; if (this->actor.wallBgId != BGCHECK_SCENE) { - wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); } if (&wallPolyActor->actor == this->unk_3C4) { @@ -6769,38 +6769,38 @@ s32 func_8083F9D0(GlobalContext* globalCtx, Player* this) { } } - func_80839FFC(this, globalCtx); - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_push_wait_end); + func_80839FFC(this, play); + func_80832264(play, this, &gPlayerAnim_link_normal_push_wait_end); this->stateFlags2 &= ~PLAYER_STATE2_4; return 1; } -void func_8083FAB8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084B898, 0); +void func_8083FAB8(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084B898, 0); this->stateFlags2 |= PLAYER_STATE2_4; - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_push_start); + func_80832264(play, this, &gPlayerAnim_link_normal_push_start); } -void func_8083FB14(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084B9E4, 0); +void func_8083FB14(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084B9E4, 0); this->stateFlags2 |= PLAYER_STATE2_4; - func_80832264(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_35][this->modelAnimType]); + func_80832264(play, this, D_80853914[PLAYER_ANIMGROUP_35][this->modelAnimType]); } -void func_8083FB7C(Player* this, GlobalContext* globalCtx) { +void func_8083FB7C(Player* this, PlayState* play) { this->stateFlags1 &= ~(PLAYER_STATE1_21 | PLAYER_STATE1_27); - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); this->linearVelocity = -0.4f; } -s32 func_8083FBC0(Player* this, GlobalContext* globalCtx) { +s32 func_8083FBC0(Player* this, PlayState* play) { if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (this->actor.bgCheckFlags & 0x200) && ((D_808535F0 & 8) || (D_808535F0 & 2) || - func_80041E4C(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { + func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { return 0; } - func_8083FB7C(this, globalCtx); + func_8083FB7C(this, play); func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); return 1; } @@ -6824,7 +6824,7 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { return 0; } -s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) { +s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { s16 sp2E = *arg2 - this->targetYaw; u16 sp2C = ABS(sp2E); @@ -6847,7 +6847,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) if (this->unk_664 != NULL) { return func_8083FC68(this, *arg1, *arg2); } else { - func_8083DC54(this, globalCtx); + func_8083DC54(this, play); if ((*arg1 != 0.0f) && (sp2C < 6000)) { return 1; } else if (*arg1 > Math_SinS((0x4000 - (sp2C >> 1))) * 200.0f) { @@ -6877,11 +6877,11 @@ s32 func_8083FFB8(Player* this, f32* arg1, s16* arg2) { return 0; } -s32 func_80840058(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) { - func_8083DC54(this, globalCtx); +s32 func_80840058(Player* this, f32* arg1, s16* arg2, PlayState* play) { + func_8083DC54(this, play); if ((*arg1 != 0.0f) || (ABS(this->unk_87C) > 400)) { - s16 temp1 = *arg2 - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + s16 temp1 = *arg2 - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); u16 temp2 = (ABS(temp1) - 0x2000) & 0xFFFF; if ((temp2 < 0x4000) || (this->unk_87C != 0)) { @@ -6908,8 +6908,8 @@ void func_80840138(Player* this, f32 arg1, s16 arg2) { Math_StepToF(&this->unk_870, this->unk_874, 0.3f); } -void func_808401B0(GlobalContext* globalCtx, Player* this) { - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, func_808334E4(this), this->unk_868, func_80833528(this), +void func_808401B0(PlayState* play, Player* this) { + LinkAnimation_BlendToJoint(play, &this->skelAnime, func_808334E4(this), this->unk_868, func_80833528(this), this->unk_868, this->unk_870, this->blendTable); } @@ -6957,7 +6957,7 @@ void func_8084029C(Player* this, f32 arg1) { } } -void func_80840450(Player* this, GlobalContext* globalCtx) { +void func_80840450(Player* this, PlayState* play) { f32 sp44; s16 sp42; s32 temp1; @@ -6974,41 +6974,41 @@ void func_80840450(Player* this, GlobalContext* globalCtx) { } if (this->unk_850 != 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_80832284(globalCtx, this, func_808334E4(this)); + func_80832284(play, this, func_808334E4(this)); this->unk_850 = 0; this->stateFlags3 &= ~PLAYER_STATE3_3; } func_80833C3C(this); } else { - func_808401B0(globalCtx, this); + func_808401B0(play, this); } func_8083721C(this); - if (!func_80837348(globalCtx, this, D_808543E0, 1)) { + if (!func_80837348(play, this, D_808543E0, 1)) { if (!func_80833B54(this) && (!func_80833B2C(this) || (func_80834B5C != this->func_82C))) { - func_8083CF10(this, globalCtx); + func_8083CF10(this, play); return; } - func_80837268(this, &sp44, &sp42, 0.0f, globalCtx); + func_80837268(this, &sp44, &sp42, 0.0f, play); temp1 = func_8083FC68(this, sp44, sp42); if (temp1 > 0) { - func_8083C8DC(this, globalCtx, sp42); + func_8083C8DC(this, play, sp42); return; } if (temp1 < 0) { - func_8083CBF0(this, sp42, globalCtx); + func_8083CBF0(this, sp42, play); return; } if (sp44 > 4.0f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); return; } @@ -7039,58 +7039,58 @@ void func_80840450(Player* this, GlobalContext* globalCtx) { } } -void func_808407CC(Player* this, GlobalContext* globalCtx) { +void func_808407CC(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; s32 temp1; s16 temp2; s32 temp3; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_80832264(globalCtx, this, func_80833338(this)); + func_80832264(play, this, func_80833338(this)); } func_8083721C(this); - if (!func_80837348(globalCtx, this, D_808543E8, 1)) { + if (!func_80837348(play, this, D_808543E8, 1)) { if (func_80833B54(this)) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } if (!func_80833B2C(this)) { - func_80835DAC(globalCtx, this, func_80840BC8, 1); + func_80835DAC(play, this, func_80840BC8, 1); this->currentYaw = this->actor.shape.rot.y; return; } if (func_80834B5C == this->func_82C) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } - func_80837268(this, &sp3C, &sp3A, 0.0f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.0f, play); - temp1 = func_8083FD78(this, &sp3C, &sp3A, globalCtx); + temp1 = func_8083FD78(this, &sp3C, &sp3A, play); if (temp1 > 0) { - func_8083C8DC(this, globalCtx, sp3A); + func_8083C8DC(this, play, sp3A); return; } if (temp1 < 0) { - func_8083CB2C(this, sp3A, globalCtx); + func_8083CB2C(this, sp3A, play); return; } if (sp3C > 4.9f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); func_80833C3C(this); return; } if (sp3C != 0.0f) { - func_8083CB94(this, globalCtx); + func_8083CB94(this, play); return; } @@ -7098,12 +7098,12 @@ void func_808407CC(Player* this, GlobalContext* globalCtx) { temp3 = ABS(temp2); if (temp3 > 800) { - func_8083CD54(globalCtx, this, sp3A); + func_8083CD54(play, this, sp3A); } } } -void func_808409CC(GlobalContext* globalCtx, Player* this) { +void func_808409CC(PlayState* play, Player* this) { LinkAnimationHeader* anim; LinkAnimationHeader** animPtr; s32 heathIsCritical; @@ -7119,7 +7119,7 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { if (this->stateFlags1 & PLAYER_STATE1_11) { anim = func_80833338(this); } else { - sp38 = globalCtx->roomCtx.curRoom.behaviorType2; + sp38 = play->roomCtx.curRoom.behaviorType2; if (heathIsCritical) { if (this->unk_6AC >= 0) { sp38 = 7; @@ -7147,11 +7147,11 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { } } - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f) * D_808535E8, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * D_808535E8, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); } -void func_80840BC8(Player* this, GlobalContext* globalCtx) { +void func_80840BC8(Player* this, PlayState* play) { s32 sp44; s32 sp40; f32 sp3C; @@ -7159,7 +7159,7 @@ void func_80840BC8(Player* this, GlobalContext* globalCtx) { s16 temp; sp44 = func_80833350(this); - sp40 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp40 = LinkAnimation_Update(play, &this->skelAnime); if (sp44 > 0) { func_808333FC(this, sp44 - 1); @@ -7173,47 +7173,47 @@ void func_80840BC8(Player* this, GlobalContext* globalCtx) { this->skelAnime.jointTable[0].y = (this->skelAnime.jointTable[0].y + ((this->unk_850 & 1) * 0x50)) - 0x28; } else { func_80832DBC(this); - func_808409CC(globalCtx, this); + func_808409CC(play, this); } } func_8083721C(this); if (this->unk_850 == 0) { - if (!func_80837348(globalCtx, this, D_80854418, 1)) { + if (!func_80837348(play, this, D_80854418, 1)) { if (func_80833B54(this)) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } if (func_80833B2C(this)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); return; } - func_80837268(this, &sp3C, &sp3A, 0.018f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.018f, play); if (sp3C != 0.0f) { - func_8083C8DC(this, globalCtx, sp3A); + func_8083C8DC(this, play, sp3A); return; } temp = sp3A - this->actor.shape.rot.y; if (ABS(temp) > 800) { - func_8083CD54(globalCtx, this, sp3A); + func_8083CD54(play, this, sp3A); return; } Math_ScaledStepToS(&this->actor.shape.rot.y, sp3A, 1200); this->currentYaw = this->actor.shape.rot.y; if (func_80833338(this) == this->skelAnime.animation) { - func_8083DC54(this, globalCtx); + func_8083DC54(this, play); } } } } -void func_80840DE4(Player* this, GlobalContext* globalCtx) { +void func_80840DE4(Player* this, PlayState* play) { f32 frames; f32 coeff; f32 sp44; @@ -7247,44 +7247,44 @@ void func_80840DE4(Player* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = direction * (this->linearVelocity * coeff); - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 0.0f) || LinkAnimation_OnFrame(&this->skelAnime, frames * 0.5f)) { func_808327F8(this, this->linearVelocity); } - if (!func_80837348(globalCtx, this, D_808543F4, 1)) { + if (!func_80837348(play, this, D_808543F4, 1)) { if (func_80833B54(this)) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } if (!func_80833B2C(this)) { - func_80853080(this, globalCtx); + func_80853080(this, play); return; } - func_80837268(this, &sp44, &sp42, 0.0f, globalCtx); - temp1 = func_8083FD78(this, &sp44, &sp42, globalCtx); + func_80837268(this, &sp44, &sp42, 0.0f, play); + temp1 = func_8083FD78(this, &sp44, &sp42, play); if (temp1 > 0) { - func_8083C8DC(this, globalCtx, sp42); + func_8083C8DC(this, play, sp42); return; } if (temp1 < 0) { - func_8083CB2C(this, sp42, globalCtx); + func_8083CB2C(this, sp42, play); return; } if (sp44 > 4.9f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); func_80833C3C(this); return; } if ((sp44 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); return; } @@ -7303,14 +7303,14 @@ void func_80840DE4(Player* this, GlobalContext* globalCtx) { } } -void func_80841138(Player* this, GlobalContext* globalCtx) { +void func_80841138(Player* this, PlayState* play) { f32 temp1; f32 temp2; if (this->unk_864 < 1.0f) { temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_31][this->modelAnimType], + LinkAnimation_LoadToJoint(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_31][this->modelAnimType], this->unk_868); this->unk_864 += 1 * temp1; if (this->unk_864 >= 1.0f) { @@ -7322,7 +7322,7 @@ void func_80841138(Player* this, GlobalContext* globalCtx) { if (temp2 < 0.0f) { temp1 = 1.0f; func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_31][this->modelAnimType], + LinkAnimation_LoadToJoint(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_31][this->modelAnimType], this->unk_868); } else { temp1 = (REG(37) / 1000.0f) * temp2; @@ -7332,26 +7332,26 @@ void func_80841138(Player* this, GlobalContext* globalCtx) { temp1 = 1.0f; func_8084029C(this, 1.2f + ((REG(38) / 1000.0f) * temp2)); } - LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_31][this->modelAnimType], + LinkAnimation_LoadToMorph(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_31][this->modelAnimType], this->unk_868); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, &gPlayerAnim_link_normal_back_run, + LinkAnimation_LoadToJoint(play, &this->skelAnime, &gPlayerAnim_link_normal_back_run, this->unk_868 * (16.0f / 29.0f)); } } if (temp1 < 1.0f) { - LinkAnimation_InterpJointMorph(globalCtx, &this->skelAnime, 1.0f - temp1); + LinkAnimation_InterpJointMorph(play, &this->skelAnime, 1.0f - temp1); } } -void func_8084140C(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084170C, 1); - func_80832B0C(globalCtx, this, &gPlayerAnim_link_normal_back_brake); +void func_8084140C(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084170C, 1); + func_80832B0C(play, this, &gPlayerAnim_link_normal_back_brake); } -s32 func_80841458(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) { +s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { if (this->linearVelocity > 6.0f) { - func_8084140C(this, globalCtx); + func_8084140C(this, play); return 1; } @@ -7367,31 +7367,31 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) return 0; } -void func_808414F8(Player* this, GlobalContext* globalCtx) { +void func_808414F8(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 sp2C; s16 sp2A; - func_80841138(this, globalCtx); + func_80841138(this, play); - if (!func_80837348(globalCtx, this, D_80854400, 1)) { + if (!func_80837348(play, this, D_80854400, 1)) { if (!func_80833C04(this)) { - func_8083C8DC(this, globalCtx, this->currentYaw); + func_8083C8DC(this, play, this->currentYaw); return; } - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); - sp2C = func_8083FD78(this, &sp34, &sp32, globalCtx); + func_80837268(this, &sp34, &sp32, 0.0f, play); + sp2C = func_8083FD78(this, &sp34, &sp32, play); if (sp2C >= 0) { - if (!func_80841458(this, &sp34, &sp32, globalCtx)) { + if (!func_80841458(this, &sp34, &sp32, play)) { if (sp2C != 0) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else if (sp34 > 4.9f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); } else { - func_8083CB94(this, globalCtx); + func_8083CB94(this, play); } } } else { @@ -7401,53 +7401,53 @@ void func_808414F8(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->currentYaw, sp32, sp2A * 0.1f); if ((sp34 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); } } } } -void func_808416C0(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808417FC, 1); - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_back_brake_end); +void func_808416C0(Player* this, PlayState* play) { + func_80835C58(play, this, func_808417FC, 1); + func_80832264(play, this, &gPlayerAnim_link_normal_back_brake_end); } -void func_8084170C(Player* this, GlobalContext* globalCtx) { +void func_8084170C(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; - sp34 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!func_80837348(globalCtx, this, D_80854400, 1)) { - func_80837268(this, &sp30, &sp2E, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854400, 1)) { + func_80837268(this, &sp30, &sp2E, 0.0f, play); if (this->linearVelocity == 0.0f) { this->currentYaw = this->actor.shape.rot.y; - if (func_8083FD78(this, &sp30, &sp2E, globalCtx) > 0) { - func_8083C858(this, globalCtx); + if (func_8083FD78(this, &sp30, &sp2E, play) > 0) { + func_8083C858(this, play); } else if ((sp30 != 0.0f) || (sp34 != 0)) { - func_808416C0(this, globalCtx); + func_808416C0(this, play); } } } } -void func_808417FC(Player* this, GlobalContext* globalCtx) { +void func_808417FC(Player* this, PlayState* play) { s32 sp1C; - sp1C = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp1C = LinkAnimation_Update(play, &this->skelAnime); - if (!func_80837348(globalCtx, this, D_80854400, 1)) { + if (!func_80837348(play, this, D_80854400, 1)) { if (sp1C != 0) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); } } } -void func_80841860(GlobalContext* globalCtx, Player* this) { +void func_80841860(PlayState* play, Player* this) { f32 frame; // fake match? see func_80833664 LinkAnimationHeader* sp38 = D_80853914[0][this->modelAnimType + PLAYER_ANIMGROUP_24 * ARRAY_COUNT(D_80853914[0])]; @@ -7458,51 +7458,51 @@ void func_80841860(GlobalContext* globalCtx, Player* this) { func_8084029C(this, (REG(30) / 1000.0f) + ((REG(32) / 1000.0f) * this->linearVelocity)); frame = this->unk_868 * (16.0f / 29.0f); - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, sp34, frame, sp38, frame, this->unk_870, this->blendTable); + LinkAnimation_BlendToJoint(play, &this->skelAnime, sp34, frame, sp38, frame, this->unk_870, this->blendTable); } -void func_8084193C(Player* this, GlobalContext* globalCtx) { +void func_8084193C(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; s32 temp1; s16 temp2; s32 temp3; - func_80841860(globalCtx, this); + func_80841860(play, this); - if (!func_80837348(globalCtx, this, D_80854408, 1)) { + if (!func_80837348(play, this, D_80854408, 1)) { if (!func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp3C, &sp3A, 0.0f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.0f, play); if (func_80833B2C(this)) { - temp1 = func_8083FD78(this, &sp3C, &sp3A, globalCtx); + temp1 = func_8083FD78(this, &sp3C, &sp3A, play); } else { temp1 = func_8083FC68(this, sp3C, sp3A); } if (temp1 > 0) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } if (temp1 < 0) { if (func_80833B2C(this)) { - func_8083CB2C(this, sp3A, globalCtx); + func_8083CB2C(this, sp3A, play); } else { - func_8083CBF0(this, sp3A, globalCtx); + func_8083CBF0(this, sp3A, play); } return; } if ((this->linearVelocity < 3.6f) && (sp3C < 4.0f)) { if (!func_8008E9C4(this) && func_80833B2C(this)) { - func_8083CB94(this, globalCtx); + func_8083CB94(this, play); } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } return; } @@ -7525,34 +7525,34 @@ void func_8084193C(Player* this, GlobalContext* globalCtx) { } } -void func_80841BA8(Player* this, GlobalContext* globalCtx) { +void func_80841BA8(Player* this, PlayState* play) { f32 sp34; s16 sp32; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (Player_HoldsTwoHandedWeapon(this)) { - AnimationContext_SetLoadFrame(globalCtx, func_80833338(this), 0, this->skelAnime.limbCount, + AnimationContext_SetLoadFrame(play, func_80833338(this), 0, this->skelAnime.limbCount, this->skelAnime.morphTable); - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime.morphTable, D_80853410); } - func_80837268(this, &sp34, &sp32, 0.018f, globalCtx); + func_80837268(this, &sp34, &sp32, 0.018f, play); - if (!func_80837348(globalCtx, this, D_80854414, 1)) { + if (!func_80837348(play, this, D_80854414, 1)) { if (sp34 != 0.0f) { this->actor.shape.rot.y = sp32; - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, sp32, this->unk_87E)) { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } this->currentYaw = this->actor.shape.rot.y; } } -void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { +void func_80841CC4(Player* this, s32 arg1, PlayState* play) { LinkAnimationHeader* anim; s16 target; f32 rate; @@ -7567,10 +7567,10 @@ void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { if ((this->modelAnimType == PLAYER_ANIMTYPE_3) || ((this->unk_89C == 0) && (this->unk_6C4 <= 0.0f))) { if (arg1 == 0) { - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], + LinkAnimation_LoadToJoint(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], this->unk_868); } else { - LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], + LinkAnimation_LoadToMorph(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], this->unk_868); } return; @@ -7596,15 +7596,15 @@ void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { } if (arg1 == 0) { - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], + LinkAnimation_BlendToJoint(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], this->unk_868, anim, this->unk_868, rate, this->blendTable); } else { - LinkAnimation_BlendToMorph(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], + LinkAnimation_BlendToMorph(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], this->unk_868, anim, this->unk_868, rate, this->blendTable); } } -void func_80841EE4(Player* this, GlobalContext* globalCtx) { +void func_80841EE4(Player* this, PlayState* play) { f32 temp1; f32 temp2; @@ -7612,7 +7612,7 @@ void func_80841EE4(Player* this, GlobalContext* globalCtx) { temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], + LinkAnimation_LoadToJoint(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_1][this->modelAnimType], this->unk_868); this->unk_864 += 1 * temp1; @@ -7628,7 +7628,7 @@ void func_80841EE4(Player* this, GlobalContext* globalCtx) { temp1 = 1.0f; func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); - func_80841CC4(this, 0, globalCtx); + func_80841CC4(this, 0, play); } else { temp1 = (REG(37) / 1000.0f) * temp2; if (temp1 < 1.0f) { @@ -7638,32 +7638,32 @@ void func_80841EE4(Player* this, GlobalContext* globalCtx) { func_8084029C(this, 1.2f + ((REG(38) / 1000.0f) * temp2)); } - func_80841CC4(this, 1, globalCtx); + func_80841CC4(this, 1, play); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, func_80833438(this), + LinkAnimation_LoadToJoint(play, &this->skelAnime, func_80833438(this), this->unk_868 * (20.0f / 29.0f)); } } if (temp1 < 1.0f) { - LinkAnimation_InterpJointMorph(globalCtx, &this->skelAnime, 1.0f - temp1); + LinkAnimation_InterpJointMorph(play, &this->skelAnime, 1.0f - temp1); } } -void func_80842180(Player* this, GlobalContext* globalCtx) { +void func_80842180(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_5; - func_80841EE4(this, globalCtx); + func_80841EE4(this, play); - if (!func_80837348(globalCtx, this, D_80854424, 1)) { + if (!func_80837348(play, this, D_80854424, 1)) { if (func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp2C, &sp2A, 0.018f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.018f, play); if (!func_8083C484(this, &sp2C, &sp2A)) { if (chaosEffectSpeedModifier != 0) { @@ -7695,99 +7695,99 @@ void func_80842180(Player* this, GlobalContext* globalCtx) { } func_8083DF68(this, sp2C, sp2A); - func_8083DDC8(this, globalCtx); + func_8083DDC8(this, play); if ((this->linearVelocity == 0.0f) && (sp2C == 0.0f)) { - func_8083C0B8(this, globalCtx); + func_8083C0B8(this, play); } } } } -void func_8084227C(Player* this, GlobalContext* globalCtx) { +void func_8084227C(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_5; - func_80841EE4(this, globalCtx); + func_80841EE4(this, play); - if (!func_80837348(globalCtx, this, D_80854430, 1)) { + if (!func_80837348(play, this, D_80854430, 1)) { if (!func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.0f, play); if (!func_8083C484(this, &sp2C, &sp2A)) { - if ((func_80833B2C(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, globalCtx) <= 0)) || + if ((func_80833B2C(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, play) <= 0)) || (!func_80833B2C(this) && (func_8083FC68(this, sp2C, sp2A) <= 0))) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); return; } func_8083DF68(this, sp2C, sp2A); - func_8083DDC8(this, globalCtx); + func_8083DDC8(this, play); if ((this->linearVelocity == 0) && (sp2C == 0)) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } } } -void func_808423EC(Player* this, GlobalContext* globalCtx) { +void func_808423EC(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; - sp34 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp34 = LinkAnimation_Update(play, &this->skelAnime); - if (!func_80837348(globalCtx, this, D_80854408, 1)) { + if (!func_80837348(play, this, D_80854408, 1)) { if (!func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp30, &sp2E, 0.0f, globalCtx); + func_80837268(this, &sp30, &sp2E, 0.0f, play); if ((this->skelAnime.morphWeight == 0.0f) && (this->skelAnime.curFrame > 5.0f)) { func_8083721C(this); if ((this->skelAnime.curFrame > 10.0f) && (func_8083FC68(this, sp30, sp2E) < 0)) { - func_8083CBF0(this, sp2E, globalCtx); + func_8083CBF0(this, sp2E, play); return; } if (sp34 != 0) { - func_8083CD00(this, globalCtx); + func_8083CD00(this, play); } } } } -void func_8084251C(Player* this, GlobalContext* globalCtx) { +void func_8084251C(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; - sp34 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!func_80837348(globalCtx, this, D_80854440, 1)) { - func_80837268(this, &sp30, &sp2E, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854440, 1)) { + func_80837268(this, &sp30, &sp2E, 0.0f, play); if (this->linearVelocity == 0.0f) { this->currentYaw = this->actor.shape.rot.y; if (func_8083FC68(this, sp30, sp2E) > 0) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } if ((sp30 != 0.0f) || (sp34 != 0)) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } } @@ -7802,32 +7802,32 @@ void func_8084260C(Vec3f* src, Vec3f* dest, f32 arg2, f32 arg3, f32 arg4) { static Vec3f D_808545B4 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_808545C0 = { 0.0f, 0.0f, 0.0f }; -s32 func_8084269C(GlobalContext* globalCtx, Player* this) { +s32 func_8084269C(PlayState* play, Player* this) { Vec3f sp2C; if ((this->unk_89E == 0) || (this->unk_89E == 1)) { func_8084260C(&this->actor.shape.feetPos[FOOT_LEFT], &sp2C, this->actor.floorHeight - this->actor.shape.feetPos[FOOT_LEFT].y, 7.0f, 5.0f); - func_800286CC(globalCtx, &sp2C, &D_808545B4, &D_808545C0, 50, 30); + func_800286CC(play, &sp2C, &D_808545B4, &D_808545C0, 50, 30); func_8084260C(&this->actor.shape.feetPos[FOOT_RIGHT], &sp2C, this->actor.floorHeight - this->actor.shape.feetPos[FOOT_RIGHT].y, 7.0f, 5.0f); - func_800286CC(globalCtx, &this->actor.shape.feetPos[FOOT_RIGHT], &D_808545B4, &D_808545C0, 50, 30); + func_800286CC(play, &this->actor.shape.feetPos[FOOT_RIGHT], &D_808545B4, &D_808545C0, 50, 30); return 1; } return 0; } -void func_8084279C(Player* this, GlobalContext* globalCtx) { - func_80832CB0(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_33][this->modelAnimType]); +void func_8084279C(Player* this, PlayState* play) { + func_80832CB0(play, this, D_80853914[PLAYER_ANIMGROUP_33][this->modelAnimType]); if (DECR(this->unk_850) == 0) { - if (!func_8083B040(this, globalCtx)) { - func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_34][this->modelAnimType], globalCtx); + if (!func_8083B040(this, play)) { + func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_34][this->modelAnimType], play); } this->actor.flags &= ~ACTOR_FLAG_8; - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Play_GetCamera(play, 0)); } } @@ -7841,12 +7841,12 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) { return 0; } -s32 func_808428D8(Player* this, GlobalContext* globalCtx) { +s32 func_808428D8(Player* this, PlayState* play) { if (Player_IsChildWithHylianShield(this) || !Player_GetSwordHeld(this) || !D_80853614) { return 0; } - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_defense_kiru); + func_80832264(play, this, &gPlayerAnim_link_normal_defense_kiru); this->unk_84F = 1; this->swordAnimation = 0xC; this->currentYaw = this->actor.shape.rot.y + this->unk_6BE; @@ -7873,37 +7873,37 @@ s32 func_808428D8(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_80842964(Player* this, GlobalContext* globalCtx) { - return func_8083B040(this, globalCtx) || func_8083B644(this, globalCtx) || func_8083E5A8(this, globalCtx); +s32 func_80842964(Player* this, PlayState* play) { + return func_8083B040(this, play) || func_8083B644(this, play) || func_8083E5A8(this, play); } -void func_808429B4(GlobalContext* globalCtx, s32 speed, s32 y, s32 countdown) { - s32 quakeIdx = Quake_Add(Gameplay_GetCamera(globalCtx, 0), 3); +void func_808429B4(PlayState* play, s32 speed, s32 y, s32 countdown) { + s32 quakeIdx = Quake_Add(Play_GetCamera(play, 0), 3); Quake_SetSpeed(quakeIdx, speed); Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0); Quake_SetCountdown(quakeIdx, countdown); } -void func_80842A28(GlobalContext* globalCtx, Player* this) { - func_808429B4(globalCtx, 27767, 7, 20); - globalCtx->actorCtx.unk_02 = 4; +void func_80842A28(PlayState* play, Player* this) { + func_808429B4(play, 27767, 7, 20); + play->actorCtx.unk_02 = 4; func_8083264C(this, 255, 20, 150, 0); func_8002F7DC(&this->actor, NA_SE_IT_HAMMER_HIT); } -void func_80842A88(GlobalContext* globalCtx, Player* this) { +void func_80842A88(PlayState* play, Player* this) { Inventory_ChangeAmmo(ITEM_STICK, -1); - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); } -s32 func_80842AC4(GlobalContext* globalCtx, Player* this) { +s32 func_80842AC4(PlayState* play, Player* this) { if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_85C > 0.5f)) { if (AMMO(ITEM_STICK) != 0) { - EffectSsStick_Spawn(globalCtx, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], + EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], this->actor.shape.rot.y + 0x8000); this->unk_85C = 0.5f; - func_80842A88(globalCtx, this); + func_80842A88(play, this); func_8002F7DC(&this->actor, NA_SE_IT_WOODSTICK_BROKEN); } @@ -7913,13 +7913,13 @@ s32 func_80842AC4(GlobalContext* globalCtx, Player* this) { return 0; } -s32 func_80842B7C(GlobalContext* globalCtx, Player* this) { +s32 func_80842B7C(PlayState* play, Player* this) { if (this->heldItemActionParam == PLAYER_AP_SWORD_BGS) { if (!gSaveContext.bgsFlag && (gSaveContext.swordHealth > 0.0f)) { if ((gSaveContext.swordHealth -= 1.0f) <= 0.0f) { - EffectSsStick_Spawn(globalCtx, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], + EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], this->actor.shape.rot.y + 0x8000); - func_800849EC(globalCtx); + func_800849EC(play); func_8002F7DC(&this->actor, NA_SE_IT_MAJIN_SWORD_BROKEN); } } @@ -7930,9 +7930,9 @@ s32 func_80842B7C(GlobalContext* globalCtx, Player* this) { return 0; } -void func_80842CF0(GlobalContext* globalCtx, Player* this) { - func_80842AC4(globalCtx, this); - func_80842B7C(globalCtx, this); +void func_80842CF0(PlayState* play, Player* this) { + func_80842AC4(play, this); + func_80842B7C(play, this); } static LinkAnimationHeader* D_808545CC[] = { @@ -7942,13 +7942,13 @@ static LinkAnimationHeader* D_808545CC[] = { &gPlayerAnim_link_fighter_rebound_longR, }; -void func_80842D20(GlobalContext* globalCtx, Player* this) { +void func_80842D20(PlayState* play, Player* this) { s32 pad; s32 sp28; if (func_80843188 != this->func_674) { - func_80832440(globalCtx, this); - func_80835C58(globalCtx, this, func_808505DC, 0); + func_80832440(play, this); + func_80835C58(play, this, func_808505DC, 0); if (func_8008E9C4(this)) { sp28 = 2; @@ -7956,15 +7956,15 @@ void func_80842D20(GlobalContext* globalCtx, Player* this) { sp28 = 0; } - func_808322D0(globalCtx, this, D_808545CC[Player_HoldsTwoHandedWeapon(this) + sp28]); + func_808322D0(play, this, D_808545CC[Player_HoldsTwoHandedWeapon(this) + sp28]); } func_8083264C(this, 180, 20, 100, 0); this->linearVelocity = -18.0f; - func_80842CF0(globalCtx, this); + func_80842CF0(play, this); } -s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { +s32 func_80842DF4(PlayState* play, Player* this) { f32 phi_f2; CollisionPoly* sp78; s32 sp74; @@ -7988,26 +7988,26 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { sp68.y = this->swordInfo[0].tip.y + (sp50.y * phi_f2); sp68.z = this->swordInfo[0].tip.z + (sp50.z * phi_f2); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp68, &this->swordInfo[0].tip, &sp5C, &sp78, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->swordInfo[0].tip, &sp5C, &sp78, true, false, false, true, &sp74) && - !SurfaceType_IsIgnoredByEntities(&globalCtx->colCtx, sp78, sp74) && - (func_80041D4C(&globalCtx->colCtx, sp78, sp74) != 6) && - (func_8002F9EC(globalCtx, &this->actor, sp78, sp74, &sp5C) == 0)) { + !SurfaceType_IsIgnoredByEntities(&play->colCtx, sp78, sp74) && + (func_80041D4C(&play->colCtx, sp78, sp74) != 6) && + (func_8002F9EC(play, &this->actor, sp78, sp74, &sp5C) == 0)) { if (this->heldItemActionParam == PLAYER_AP_HAMMER) { - func_80832630(globalCtx); - func_80842A28(globalCtx, this); - func_80842D20(globalCtx, this); + func_80832630(play); + func_80842A28(play, this); + func_80842D20(play, this); return 1; } if (this->linearVelocity >= 0.0f) { - sp48 = func_80041F10(&globalCtx->colCtx, sp78, sp74); + sp48 = func_80041F10(&play->colCtx, sp78, sp74); if (sp48 == 0xA) { - CollisionCheck_SpawnShieldParticlesWood(globalCtx, &sp5C, &this->actor.projectedPos); + CollisionCheck_SpawnShieldParticlesWood(play, &sp5C, &this->actor.projectedPos); } else { - CollisionCheck_SpawnShieldParticles(globalCtx, &sp5C); + CollisionCheck_SpawnShieldParticles(play, &sp5C); if (sp48 == 0xB) { func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_SOFT); } else { @@ -8015,15 +8015,15 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { } } - func_80842CF0(globalCtx, this); + func_80842CF0(play, this); this->linearVelocity = -14.0f; func_8083264C(this, 180, 20, 100, 0); } } } } else { - func_80842D20(globalCtx, this); - func_80832630(globalCtx); + func_80842D20(play, this); + func_80832630(play); return 1; } } @@ -8035,16 +8035,16 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { Actor* at = this->swordQuads[temp1 ? 1 : 0].base.at; if ((at != NULL) && (at->id != ACTOR_EN_KANBAN)) { - func_80832630(globalCtx); + func_80832630(play); } } - if ((func_80842AC4(globalCtx, this) == 0) && (this->heldItemActionParam != PLAYER_AP_HAMMER)) { - func_80842B7C(globalCtx, this); + if ((func_80842AC4(play, this) == 0) && (this->heldItemActionParam != PLAYER_AP_HAMMER)) { + func_80842B7C(play, this); if (this->actor.colChkInfo.atHitEffect == 1) { this->actor.colChkInfo.damage = 8; - func_80837C0C(globalCtx, this, 4, 0.0f, 0.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, 4, 0.0f, 0.0f, this->actor.shape.rot.y, 20); return 1; } } @@ -8054,7 +8054,7 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { return 0; } -void func_80843188(Player* this, GlobalContext* globalCtx) { +void func_80843188(Player* this, PlayState* play) { f32 sp54; f32 sp50; s16 sp4E; @@ -8064,9 +8064,9 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { s16 sp46; f32 sp40; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (!Player_IsChildWithHylianShield(this)) { - func_80832284(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_21][this->modelAnimType]); + func_80832284(play, this, D_80853914[PLAYER_ANIMGROUP_21][this->modelAnimType]); } this->unk_850 = 1; this->unk_84F = 0; @@ -8074,7 +8074,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { if (!Player_IsChildWithHylianShield(this)) { this->stateFlags1 |= PLAYER_STATE1_22; - func_80836670(this, globalCtx); + func_80836670(this, play); this->stateFlags1 &= ~PLAYER_STATE1_22; } @@ -8083,7 +8083,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { if (this->unk_850 != 0) { sp54 = sControlInput->rel.stick_y * 100; sp50 = sControlInput->rel.stick_x * -120; - sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); sp40 = Math_CosS(sp4E); sp4C = (Math_SinS(sp4E) * sp50) + (sp54 * sp40); @@ -8109,7 +8109,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_6BE, sp4A, sp46); if (this->unk_84F != 0) { - if (!func_80842DF4(globalCtx, this)) { + if (!func_80842DF4(play, this)) { if (this->skelAnime.curFrame < 2.0f) { func_80833A20(this, 1); } @@ -8117,24 +8117,24 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { this->unk_850 = 1; this->unk_84F = 0; } - } else if (!func_80842964(this, globalCtx)) { - if (func_8083C2B0(this, globalCtx)) { - func_808428D8(this, globalCtx); + } else if (!func_80842964(this, play)) { + if (func_8083C2B0(this, play)) { + func_808428D8(this, play); } else { this->stateFlags1 &= ~PLAYER_STATE1_22; func_80832318(this); if (Player_IsChildWithHylianShield(this)) { - func_8083A060(this, globalCtx); - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_clink_normal_defense_ALL, 1.0f, + func_8083A060(this, play); + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_clink_normal_defense_ALL, 1.0f, Animation_GetLastFrame(&gPlayerAnim_clink_normal_defense_ALL), 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(globalCtx, this, 4); + func_80832F54(play, this, 4); } else { if (this->itemActionParam < 0) { func_8008EC70(this); } - func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_22][this->modelAnimType], globalCtx); + func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_22][this->modelAnimType], play); } func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_REMOVE); @@ -8151,7 +8151,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { this->unk_6AE |= 0xC1; } -void func_808435C4(Player* this, GlobalContext* globalCtx) { +void func_808435C4(Player* this, PlayState* play) { s32 temp; LinkAnimationHeader* anim; f32 frames; @@ -8159,35 +8159,35 @@ void func_808435C4(Player* this, GlobalContext* globalCtx) { func_8083721C(this); if (this->unk_84F == 0) { - D_808535E0 = func_80836670(this, globalCtx); - if ((func_80834B5C == this->func_82C) || (func_808374A0(globalCtx, this, &this->skelAnime2, 4.0f) > 0)) { - func_80835C58(globalCtx, this, func_80840450, 1); + D_808535E0 = func_80836670(this, play); + if ((func_80834B5C == this->func_82C) || (func_808374A0(play, this, &this->skelAnime2, 4.0f) > 0)) { + func_80835C58(play, this, func_80840450, 1); } } else { - temp = func_808374A0(globalCtx, this, &this->skelAnime, 4.0f); - if ((temp != 0) && ((temp > 0) || LinkAnimation_Update(globalCtx, &this->skelAnime))) { - func_80835C58(globalCtx, this, func_80843188, 1); + temp = func_808374A0(play, this, &this->skelAnime, 4.0f); + if ((temp != 0) && ((temp > 0) || LinkAnimation_Update(play, &this->skelAnime))) { + func_80835C58(play, this, func_80843188, 1); this->stateFlags1 |= PLAYER_STATE1_22; Player_SetModelsForHoldingShield(this); anim = D_80853914[PLAYER_ANIMGROUP_20][this->modelAnimType]; frames = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, frames, frames, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frames, frames, ANIMMODE_ONCE, 0.0f); } } } -void func_8084370C(Player* this, GlobalContext* globalCtx) { +void func_8084370C(Player* this, PlayState* play) { s32 sp1C; func_8083721C(this); - sp1C = func_808374A0(globalCtx, this, &this->skelAnime, 16.0f); - if ((sp1C != 0) && (LinkAnimation_Update(globalCtx, &this->skelAnime) || (sp1C > 0))) { - func_80839F90(this, globalCtx); + sp1C = func_808374A0(play, this, &this->skelAnime, 16.0f); + if ((sp1C != 0) && (LinkAnimation_Update(play, &this->skelAnime) || (sp1C > 0))) { + func_80839F90(this, play); } } -void func_8084377C(Player* this, GlobalContext* globalCtx) { +void func_8084377C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; func_808382BC(this); @@ -8208,22 +8208,22 @@ void func_8084377C(Player* this, GlobalContext* globalCtx) { } } - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->actor.bgCheckFlags & 1)) { if (this->unk_850 != 0) { this->unk_850--; if (this->unk_850 == 0) { - func_80853080(this, globalCtx); + func_80853080(this, play); } } else if ((this->stateFlags1 & PLAYER_STATE1_29) || (!(this->cylinder.base.acFlags & AC_HIT) && (this->unk_8A1 == 0))) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->unk_850++; } else { - func_80835C58(globalCtx, this, func_80843954, 0); + func_80835C58(play, this, func_80843954, 0); this->stateFlags1 |= PLAYER_STATE1_26; } - func_80832264(globalCtx, this, + func_80832264(play, this, (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB : &gPlayerAnim_link_normal_back_downB); func_80832698(this, NA_SE_VO_LI_FREEZE); @@ -8235,21 +8235,21 @@ void func_8084377C(Player* this, GlobalContext* globalCtx) { } } -void func_80843954(Player* this, GlobalContext* globalCtx) { +void func_80843954(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; func_808382BC(this); func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->linearVelocity == 0.0f)) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->linearVelocity == 0.0f)) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->unk_850++; } else { - func_80835C58(globalCtx, this, func_80843A38, 0); + func_80835C58(play, this, func_80843A38, 0); this->stateFlags1 |= PLAYER_STATE1_26; } - func_808322D0(globalCtx, this, + func_808322D0(play, this, (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_down_wake : &gPlayerAnim_link_normal_back_down_wake); this->currentYaw = this->actor.shape.rot.y; @@ -8261,18 +8261,18 @@ static struct_80832924 D_808545DC[] = { { 0, -0x401E }, }; -void func_80843A38(Player* this, GlobalContext* globalCtx) { +void func_80843A38(Player* this, PlayState* play) { s32 sp24; this->stateFlags2 |= PLAYER_STATE2_5; func_808382BC(this); if (this->stateFlags1 & PLAYER_STATE1_29) { - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); } else { - sp24 = func_808374A0(globalCtx, this, &this->skelAnime, 16.0f); - if ((sp24 != 0) && (LinkAnimation_Update(globalCtx, &this->skelAnime) || (sp24 > 0))) { - func_80839F90(this, globalCtx); + sp24 = func_808374A0(play, this, &this->skelAnime, 16.0f); + if ((sp24 != 0) && (LinkAnimation_Update(play, &this->skelAnime) || (sp24 > 0))) { + func_80839F90(this, play); } } @@ -8281,17 +8281,17 @@ void func_80843A38(Player* this, GlobalContext* globalCtx) { static Vec3f D_808545E4 = { 0.0f, 0.0f, 5.0f }; -void func_80843AE8(GlobalContext* globalCtx, Player* this) { +void func_80843AE8(PlayState* play, Player* this) { if (this->unk_850 != 0) { if (this->unk_850 > 0) { this->unk_850--; if (this->unk_850 == 0) { if (this->stateFlags1 & PLAYER_STATE1_27) { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_swimer_swim_wait, 1.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_wait, 1.0f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_wait), ANIMMODE_ONCE, -16.0f); } else { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_derth_rebirth, 1.0f, 99.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_derth_rebirth, 1.0f, 99.0f, Animation_GetLastFrame(&gPlayerAnim_link_derth_rebirth), ANIMMODE_ONCE, 0.0f); } if (CVar_GetS32("gFairyReviveEffect", 0)) { @@ -8309,9 +8309,9 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) { } else if (gSaveContext.healthAccumulator == 0) { this->stateFlags1 &= ~PLAYER_STATE1_7; if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else { - func_80853080(this, globalCtx); + func_80853080(this, play); } this->unk_A87 = 20; func_80837AFC(this, -20); @@ -8319,11 +8319,11 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) { } } else if (this->unk_84F != 0) { this->unk_850 = 60; - Player_SpawnFairy(globalCtx, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); + Player_SpawnFairy(play, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); - OnePointCutscene_Init(globalCtx, 9908, 125, &this->actor, MAIN_CAM); - } else if (globalCtx->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { - globalCtx->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; + OnePointCutscene_Init(play, 9908, 125, &this->actor, MAIN_CAM); + } else if (play->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { + play->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; sMaskMemory = PLAYER_MASK_NONE; } } @@ -8335,20 +8335,20 @@ static struct_80832924 D_808545F0[] = { { 0, -0x40AA }, }; -void func_80843CEC(Player* this, GlobalContext* globalCtx) { +void func_80843CEC(Player* this, PlayState* play) { if (this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0) { - if ((globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == 9) || + if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == 9) || ((func_80838144(D_808535E4) >= 0) && - !SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { + !SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { func_8083821C(this); } } func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->actor.category == ACTORCAT_PLAYER) { - func_80843AE8(globalCtx, this); + func_80843AE8(play, this); } return; } @@ -8375,7 +8375,7 @@ static FallImpactInfo D_80854600[] = { { -16, 255, 140, 150, NA_SE_VO_LI_LAND_DAMAGE_S }, }; -s32 func_80843E64(GlobalContext* globalCtx, Player* this) { +s32 func_80843E64(PlayState* play, Player* this) { s32 sp34; if ((D_808535E4 == 6) || (D_808535E4 == 9)) { @@ -8400,13 +8400,13 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) { impactInfo = &D_80854600[impactIndex]; - if (Player_InflictDamageModified(globalCtx, impactInfo->damage * (1 << CVar_GetS32("gFallDamageMul", 0)), + if (Player_InflictDamageModified(play, impactInfo->damage * (1 << CVar_GetS32("gFallDamageMul", 0)), false)) { return -1; } func_80837AE0(this, 40); - func_808429B4(globalCtx, 32967, 2, 30); + func_808429B4(play, 32967, 2, 30); func_8083264C(this, impactInfo->unk_01, impactInfo->unk_02, impactInfo->unk_03, 0); func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT); func_80832698(this, impactInfo->sfxId); @@ -8433,20 +8433,20 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) { return 0; } -void func_8084409C(GlobalContext* globalCtx, Player* this, f32 speedXZ, f32 velocityY) { +void func_8084409C(PlayState* play, Player* this, f32 speedXZ, f32 velocityY) { Actor* heldActor = this->heldActor; - if (!func_80835644(globalCtx, this, heldActor)) { + if (!func_80835644(play, this, heldActor)) { heldActor->world.rot.y = this->actor.shape.rot.y; heldActor->speedXZ = speedXZ; heldActor->velocity.y = velocityY; - func_80834644(globalCtx, this); + func_80834644(play, this); func_8002F7DC(&this->actor, NA_SE_PL_THROW); func_80832698(this, NA_SE_VO_LI_SWORD_N); } } -void func_8084411C(Player* this, GlobalContext* globalCtx) { +void func_8084411C(Player* this, PlayState* play) { f32 sp4C; s16 sp4A; @@ -8456,7 +8456,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { this->actor.gravity = -1.2f; } - func_80837268(this, &sp4C, &sp4A, 0.0f, globalCtx); + func_80837268(this, &sp4C, &sp4A, 0.0f, play); if (!(this->actor.bgCheckFlags & 1)) { if (this->stateFlags1 & PLAYER_STATE1_11) { @@ -8466,21 +8466,21 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { if (CVar_GetS32("gDpadEquips", 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } - if (!func_80835644(globalCtx, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && + if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)) { - func_8084409C(globalCtx, this, this->linearVelocity + 2.0f, this->actor.velocity.y + 2.0f); + func_8084409C(play, this, this->linearVelocity + 2.0f, this->actor.velocity.y + 2.0f); } } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (!(this->stateFlags2 & PLAYER_STATE2_19)) { func_8083DFE0(this, &sp4C, &sp4A); } - func_80836670(this, globalCtx); + func_80836670(this, play); - if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->unk_84F == 2)) || !func_8083BBA0(this, globalCtx)) { + if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->unk_84F == 2)) || !func_8083BBA0(this, play)) { if (this->actor.velocity.y < 0.0f) { if (this->unk_850 >= 0) { if ((this->actor.bgCheckFlags & 8) || (this->unk_850 == 0) || (this->fallDistance > 0)) { @@ -8489,7 +8489,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~PLAYER_STATE1_2; } - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_normal_landing, 1.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_normal_landing, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f); this->unk_850 = -1; } @@ -8502,18 +8502,18 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 0x200) && !(this->stateFlags2 & PLAYER_STATE2_19) && !(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_27)) && (this->linearVelocity > 0.0f)) { if ((this->wallHeight >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { - func_8083EC18(this, globalCtx, D_808535F0); + func_8083EC18(this, play, D_808535F0); } else if ((this->unk_88C >= 2) && (this->wallHeight < 150.0f) && (((this->actor.world.pos.y - this->actor.floorHeight) + this->wallHeight) > (70.0f * this->ageProperties->unk_08))) { - AnimationContext_DisableQueue(globalCtx); + AnimationContext_DisableQueue(play); if (this->stateFlags1 & PLAYER_STATE1_2) { func_80832698(this, NA_SE_VO_LI_HOOKSHOT_HANG); } else { func_80832698(this, NA_SE_VO_LI_HANG); } this->actor.world.pos.y += this->wallHeight; - func_8083A5C4(globalCtx, this, this->actor.wallPoly, this->wallDistance, + func_8083A5C4(play, this, this->actor.wallPoly, this->wallDistance, D_80853914[PLAYER_ANIMGROUP_39][this->modelAnimType]); this->actor.shape.rot.y = this->currentYaw += 0x8000; this->stateFlags1 |= PLAYER_STATE1_13; @@ -8541,14 +8541,14 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { anim = D_80853914[PLAYER_ANIMGROUP_15][this->modelAnimType]; } else if ((this->fallDistance < 800) && (this->unk_84B[this->unk_846] == 0) && !(this->stateFlags1 & PLAYER_STATE1_11)) { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); return; } - sp3C = func_80843E64(globalCtx, this); + sp3C = func_80843E64(play, this); if (sp3C > 0) { - func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_14][this->modelAnimType], globalCtx); + func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_14][this->modelAnimType], play); this->skelAnime.endFrame = 8.0f; if (sp3C == 1) { this->unk_850 = 10; @@ -8556,7 +8556,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { this->unk_850 = 20; } } else if (sp3C == 0) { - func_8083A098(this, anim, globalCtx); + func_8083A098(this, anim, play); } } } @@ -8568,7 +8568,7 @@ static struct_80832924 D_8085460C[] = { { 0, -0x2812 }, }; -void func_80844708(Player* this, GlobalContext* globalCtx) { +void func_80844708(Player* this, PlayState* play) { Actor* cylinderOc; s32 temp; s32 sp44; @@ -8580,19 +8580,19 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { this->stateFlags2 |= PLAYER_STATE2_5; cylinderOc = NULL; - sp44 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp44 = LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { func_80837AFC(this, -10); } - if (func_80842964(this, globalCtx) == 0) { + if (func_80842964(this, play) == 0) { if (this->unk_850 != 0) { Math_StepToF(&this->linearVelocity, 0.0f, 2.0f); - temp = func_808374A0(globalCtx, this, &this->skelAnime, 5.0f); + temp = func_808374A0(play, this, &this->skelAnime, 5.0f); if ((temp != 0) && ((temp > 0) || sp44)) { - func_8083A060(this, globalCtx); + func_8083A060(this, play); } } else { if (this->linearVelocity >= 7.0f) { @@ -8605,15 +8605,15 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { if (cylinderOc != NULL) { cylinderOc->home.rot.y = 1; } else if (this->actor.wallBgId != BGCHECK_SCENE) { - wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if ((wallPolyActor != NULL) && (wallPolyActor->actor.id == ACTOR_OBJ_KIBAKO2)) { wallPolyActor->actor.home.rot.z = 1; } } - func_80832264(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_17][this->modelAnimType]); + func_80832264(play, this, D_80853914[PLAYER_ANIMGROUP_17][this->modelAnimType]); this->linearVelocity = -this->linearVelocity; - func_808429B4(globalCtx, 33267, 3, 12); + func_808429B4(play, 33267, 3, 12); func_8083264C(this, 255, 20, 150, 0); func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT); func_80832698(this, NA_SE_VO_LI_CLIMB_END); @@ -8622,13 +8622,13 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { } } - if ((this->skelAnime.curFrame < 15.0f) || !func_80850224(this, globalCtx)) { + if ((this->skelAnime.curFrame < 15.0f) || !func_80850224(this, play)) { if (this->skelAnime.curFrame >= 20.0f) { - func_8083A060(this, globalCtx); + func_8083A060(this, play); return; } - func_80837268(this, &sp38, &sp36, 0.018f, globalCtx); + func_80837268(this, &sp38, &sp36, 0.018f, play); sp38 *= 1.5f; if ((sp38 < 3.0f) || (this->unk_84B[this->unk_846] != 0)) { @@ -8637,7 +8637,7 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { func_8083DF68(this, sp38, this->actor.shape.rot.y); - if (func_8084269C(globalCtx, this)) { + if (func_8084269C(play, this)) { func_8002F8F0(&this->actor, NA_SE_PL_ROLL_DUST - SFX_FLAG); } @@ -8647,52 +8647,52 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { } } -void func_80844A44(Player* this, GlobalContext* globalCtx) { +void func_80844A44(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_link_normal_run_jump_water_fall_wait); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_link_normal_run_jump_water_fall_wait); } Math_StepToF(&this->linearVelocity, 0.0f, 0.05f); if (this->actor.bgCheckFlags & 1) { this->actor.colChkInfo.damage = 0x10; - func_80837C0C(globalCtx, this, 1, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, 1, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } } -void func_80844AF4(Player* this, GlobalContext* globalCtx) { +void func_80844AF4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_5; this->actor.gravity = -1.2f; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); - if (!func_80842DF4(globalCtx, this)) { + if (!func_80842DF4(play, this)) { func_8084285C(this, 6.0f, 7.0f, 99.0f); if (!(this->actor.bgCheckFlags & 1)) { - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.0f, play); func_8083DFE0(this, &sp2C, &this->currentYaw); return; } - if (func_80843E64(globalCtx, this) >= 0) { + if (func_80843E64(play, this) >= 0) { this->swordAnimation += 2; - func_80837948(globalCtx, this, this->swordAnimation); + func_80837948(play, this, this->swordAnimation); this->unk_845 = 3; func_808328A0(this); } } } -s32 func_80844BE4(Player* this, GlobalContext* globalCtx) { +s32 func_80844BE4(Player* this, PlayState* play) { s32 temp; - if (func_8083ADD4(globalCtx, this)) { + if (func_8083ADD4(play, this)) { this->stateFlags2 |= PLAYER_STATE2_17; } else { if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { @@ -8702,7 +8702,7 @@ s32 func_80844BE4(Player* this, GlobalContext* globalCtx) { temp = D_80854380[Player_HoldsTwoHandedWeapon(this)]; } - func_80837948(globalCtx, this, temp); + func_80837948(play, this, temp); func_80837AFC(this, -8); this->stateFlags2 |= PLAYER_STATE2_17; @@ -8717,25 +8717,25 @@ s32 func_80844BE4(Player* this, GlobalContext* globalCtx) { return 1; } -void func_80844CF8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80845000, 1); +void func_80844CF8(Player* this, PlayState* play) { + func_80835C58(play, this, func_80845000, 1); } -void func_80844D30(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80845308, 1); +void func_80844D30(Player* this, PlayState* play) { + func_80835C58(play, this, func_80845308, 1); } -void func_80844D68(Player* this, GlobalContext* globalCtx) { - func_80839FFC(this, globalCtx); +void func_80844D68(Player* this, PlayState* play) { + func_80839FFC(this, play); func_80832318(this); - func_80832B0C(globalCtx, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); + func_80832B0C(play, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); this->currentYaw = this->actor.shape.rot.y; } -void func_80844DC8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80844E68, 1); +void func_80844DC8(Player* this, PlayState* play) { + func_80835C58(play, this, func_80844E68, 1); this->unk_868 = 0.0f; - func_80832284(globalCtx, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); + func_80832284(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->unk_850 = 1; } @@ -8743,24 +8743,24 @@ void func_80844E3C(Player* this) { Math_StepToF(&this->unk_858, 1.0f, 0.02f); } -void func_80844E68(Player* this, GlobalContext* globalCtx) { +void func_80844E68(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; this->stateFlags1 |= PLAYER_STATE1_12; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); func_808355DC(this); this->stateFlags1 &= ~PLAYER_STATE1_17; - func_80832284(globalCtx, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); + func_80832284(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->unk_850 = -1; } func_8083721C(this); - if (!func_80842964(this, globalCtx) && (this->unk_850 != 0)) { + if (!func_80842964(this, play) && (this->unk_850 != 0)) { func_80844E3C(this); if (this->unk_850 < 0) { @@ -8768,22 +8768,22 @@ void func_80844E68(Player* this, GlobalContext* globalCtx) { this->unk_845 = 0; this->unk_850 = 1; } else if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { - func_80844D68(this, globalCtx); + func_80844D68(this, play); } - } else if (!func_80844BE4(this, globalCtx)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + } else if (!func_80844BE4(this, play)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); - temp = func_80840058(this, &sp34, &sp32, globalCtx); + temp = func_80840058(this, &sp34, &sp32, play); if (temp > 0) { - func_80844CF8(this, globalCtx); + func_80844CF8(this, play); } else if (temp < 0) { - func_80844D30(this, globalCtx); + func_80844D30(this, play); } } } } -void func_80845000(Player* this, GlobalContext* globalCtx) { +void func_80845000(Player* this, PlayState* play) { s16 temp1; s32 temp2; f32 sp5C; @@ -8812,18 +8812,18 @@ void func_80845000(Player* this, GlobalContext* globalCtx) { sp58 = CLAMP(sp5C * 0.5f, 0.5f, 1.0f); - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, + LinkAnimation_BlendToJoint(play, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, D_80854370[Player_HoldsTwoHandedWeapon(this)], this->unk_868 * (21.0f / 29.0f), sp58, this->blendTable); - if (!func_80842964(this, globalCtx) && !func_80844BE4(this, globalCtx)) { + if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - func_80837268(this, &sp54, &sp52, 0.0f, globalCtx); + func_80837268(this, &sp54, &sp52, 0.0f, play); - temp4 = func_80840058(this, &sp54, &sp52, globalCtx); + temp4 = func_80840058(this, &sp54, &sp52, play); if (temp4 < 0) { - func_80844D30(this, globalCtx); + func_80844D30(this, play); return; } @@ -8846,12 +8846,12 @@ void func_80845000(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_80844DC8(this, globalCtx); + func_80844DC8(this, play); } } } -void func_80845308(Player* this, GlobalContext* globalCtx) { +void func_80845308(Player* this, PlayState* play) { f32 sp5C; f32 sp58; f32 sp54; @@ -8880,18 +8880,18 @@ void func_80845308(Player* this, GlobalContext* globalCtx) { sp58 = CLAMP(sp5C * 0.5f, 0.5f, 1.0f); - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, + LinkAnimation_BlendToJoint(play, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, D_80854378[Player_HoldsTwoHandedWeapon(this)], this->unk_868 * (21.0f / 29.0f), sp58, this->blendTable); - if (!func_80842964(this, globalCtx) && !func_80844BE4(this, globalCtx)) { + if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - func_80837268(this, &sp54, &sp52, 0.0f, globalCtx); + func_80837268(this, &sp54, &sp52, 0.0f, play); - temp4 = func_80840058(this, &sp54, &sp52, globalCtx); + temp4 = func_80840058(this, &sp54, &sp52, play); if (temp4 > 0) { - func_80844CF8(this, globalCtx); + func_80844CF8(this, play); return; } @@ -8914,19 +8914,19 @@ void func_80845308(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) { - func_80844DC8(this, globalCtx); + func_80844DC8(this, play); } } } -void func_80845668(Player* this, GlobalContext* globalCtx) { +void func_80845668(Player* this, PlayState* play) { s32 sp3C; f32 temp1; s32 temp2; f32 temp3; this->stateFlags2 |= PLAYER_STATE2_5; - sp3C = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp3C = LinkAnimation_Update(play, &this->skelAnime); if (this->skelAnime.animation == &gPlayerAnim_link_normal_250jump_start) { this->linearVelocity = 1.0f; @@ -8948,12 +8948,12 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { temp1 += 1.0f; } - func_80838940(this, NULL, temp1, globalCtx, NA_SE_VO_LI_AUTO_JUMP); + func_80838940(this, NULL, temp1, play, NA_SE_VO_LI_AUTO_JUMP); this->unk_850 = -1; return; } } else { - temp2 = func_808374A0(globalCtx, this, &this->skelAnime, 4.0f); + temp2 = func_808374A0(play, this, &this->skelAnime, 4.0f); if (temp2 == 0) { this->stateFlags1 &= ~(PLAYER_STATE1_14 | PLAYER_STATE1_18); @@ -8961,7 +8961,7 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { } if ((sp3C != 0) || (temp2 > 0)) { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); this->stateFlags1 &= ~(PLAYER_STATE1_14 | PLAYER_STATE1_18); return; } @@ -8970,7 +8970,7 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { if (this->skelAnime.animation == &gPlayerAnim_link_swimer_swim_15step_up) { if (LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { - func_8083D0A8(globalCtx, this, 10.0f); + func_8083D0A8(play, this, 10.0f); } temp3 = 50.0f; } else if (this->skelAnime.animation == &gPlayerAnim_link_normal_150step_up) { @@ -8994,19 +8994,19 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { } } -void func_808458D0(Player* this, GlobalContext* globalCtx) { +void func_808458D0(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor != NULL) && (this->getItemId == GI_NONE)) || - !func_80836670(this, globalCtx)) { - this->func_A74(globalCtx, this); + !func_80836670(this, play)) { + this->func_A74(play, this); } } -s32 func_80845964(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2, f32 arg3, s16 arg4, s32 arg5) { +s32 func_80845964(PlayState* play, Player* this, CsCmdActorAction* arg2, f32 arg3, s16 arg4, s32 arg5) { if ((arg5 != 0) && (this->linearVelocity == 0.0f)) { - return LinkAnimation_Update(globalCtx, &this->skelAnime); + return LinkAnimation_Update(play, &this->skelAnime); } if (arg5 != 2) { @@ -9014,7 +9014,7 @@ s32 func_80845964(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2 f32 selfDistX = arg2->endPos.x - this->actor.world.pos.x; f32 selfDistZ = arg2->endPos.z - this->actor.world.pos.z; f32 sp28 = sqrtf(SQ(selfDistX) + SQ(selfDistZ)) / sp34; - s32 sp24 = (arg2->endFrame - globalCtx->csCtx.frames) + 1; + s32 sp24 = (arg2->endFrame - play->csCtx.frames) + 1; arg4 = Math_Atan2S(selfDistZ, selfDistX); @@ -9035,17 +9035,17 @@ s32 func_80845964(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2 } this->stateFlags2 |= PLAYER_STATE2_5; - func_80841EE4(this, globalCtx); + func_80841EE4(this, play); func_8083DF68(this, arg3, arg4); if ((arg3 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_8083BF50(this, globalCtx); + func_8083BF50(this, play); } return 0; } -s32 func_80845BA0(GlobalContext* arg0, Player* arg1, f32* arg2, s32 arg3) { +s32 func_80845BA0(PlayState* play, Player* arg1, f32* arg2, s32 arg3) { f32 dx = arg1->unk_450.x - arg1->actor.world.pos.x; f32 dz = arg1->unk_450.z - arg1->actor.world.pos.z; s32 sp2C = sqrtf(SQ(dx) + SQ(dz)); @@ -9056,31 +9056,31 @@ s32 func_80845BA0(GlobalContext* arg0, Player* arg1, f32* arg2, s32 arg3) { yaw = arg1->actor.shape.rot.y; } - if (func_80845964(arg0, arg1, NULL, *arg2, yaw, 2)) { + if (func_80845964(play, arg1, NULL, *arg2, yaw, 2)) { return 0; } return sp2C; } -s32 func_80845C68(GlobalContext* globalCtx, s32 arg1) { +s32 func_80845C68(PlayState* play, s32 arg1) { if (arg1 == 0) { - Gameplay_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0xDFF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF); } gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 0; return arg1; } -void func_80845CA4(Player* this, GlobalContext* globalCtx) { +void func_80845CA4(Player* this, PlayState* play) { f32 sp3C; s32 temp; f32 sp34; s32 sp30; s32 pad; - if (!func_8083B040(this, globalCtx)) { + if (!func_8083B040(this, play)) { if (this->unk_850 == 0) { - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (DECR(this->doorTimer) == 0) { this->linearVelocity = 0.1f; @@ -9089,7 +9089,7 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) { } else if (this->unk_84F == 0) { sp3C = 5.0f * D_808535E8; - if (func_80845BA0(globalCtx, this, &sp3C, -1) < 30) { + if (func_80845BA0(play, this, &sp3C, -1) < 30) { this->unk_84F = 1; this->stateFlags1 |= PLAYER_STATE1_29; @@ -9114,33 +9114,33 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) { sp30 = -1; } - temp = func_80845BA0(globalCtx, this, &sp34, sp30); + temp = func_80845BA0(play, this, &sp34, sp30); if ((this->unk_850 == 0) || - ((temp == 0) && (this->linearVelocity == 0.0f) && (Gameplay_GetCamera(globalCtx, 0)->unk_14C & 0x10))) { + ((temp == 0) && (this->linearVelocity == 0.0f) && (Play_GetCamera(play, 0)->unk_14C & 0x10))) { - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); - func_80845C68(globalCtx, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); + func_8005B1A4(Play_GetCamera(play, 0)); + func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); - if (!func_8083B644(this, globalCtx)) { - func_8083CF5C(this, globalCtx); + if (!func_8083B644(this, play)) { + func_8083CF5C(this, play); } } } } if (this->stateFlags1 & PLAYER_STATE1_11) { - func_80836670(this, globalCtx); + func_80836670(this, play); } } -void func_80845EF8(Player* this, GlobalContext* globalCtx) { +void func_80845EF8(Player* this, PlayState* play) { s32 sp2C; this->stateFlags2 |= PLAYER_STATE2_5; - sp2C = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp2C = LinkAnimation_Update(play, &this->skelAnime); - func_80836670(this, globalCtx); + func_80836670(this, play); if (sp2C) { if (this->unk_850 == 0) { @@ -9149,34 +9149,34 @@ void func_80845EF8(Player* this, GlobalContext* globalCtx) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { - func_8083C0E8(this, globalCtx); - if (globalCtx->roomCtx.prevRoom.num >= 0) { - func_80097534(globalCtx, &globalCtx->roomCtx); + func_8083C0E8(this, play); + if (play->roomCtx.prevRoom.num >= 0) { + func_80097534(play, &play->roomCtx); } - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); - Gameplay_SetupRespawnPoint(globalCtx, 0, 0xDFF); + func_8005B1A4(Play_GetCamera(play, 0)); + Play_SetupRespawnPoint(play, 0, 0xDFF); } return; } if (!(this->stateFlags1 & PLAYER_STATE1_29) && LinkAnimation_OnFrame(&this->skelAnime, 15.0f)) { - globalCtx->func_11D54(this, globalCtx); + play->func_11D54(this, play); } } -void func_80846050(Player* this, GlobalContext* globalCtx) { +void func_80846050(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); - func_80835688(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); + func_80835688(this, play); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 4.0f)) { Actor* interactRangeActor = this->interactRangeActor; - if (!func_80835644(globalCtx, this, interactRangeActor)) { + if (!func_80835644(play, this, interactRangeActor)) { this->heldActor = interactRangeActor; this->actor.child = interactRangeActor; interactRangeActor->parent = &this->actor; @@ -9194,10 +9194,10 @@ static struct_80832924 D_8085461C[] = { { NA_SE_VO_LI_SWORD_N, -0x20E6 }, }; -void func_80846120(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_850++ > 20)) { - if (!func_8083B040(this, globalCtx)) { - func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, globalCtx); +void func_80846120(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850++ > 20)) { + if (!func_8083B040(this, play)) { + func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); } return; } @@ -9223,18 +9223,18 @@ void func_80846120(Player* this, GlobalContext* globalCtx) { heldActor->velocity.y = Math_CosS(heldActor->shape.rot.x) * 40.0f; heldActor->gravity = -2.0f; heldActor->minVelocityY = -30.0f; - func_808323B4(globalCtx, this); + func_808323B4(play, this); return; } func_80832924(this, D_8085461C); } -void func_80846260(Player* this, GlobalContext* globalCtx) { +void func_80846260(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_link_silver_wait); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_link_silver_wait); this->unk_850 = 1; return; } @@ -9259,14 +9259,14 @@ void func_80846260(Player* this, GlobalContext* globalCtx) { } } else if (CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)) { - func_80835C58(globalCtx, this, func_80846358, 1); - func_80832264(globalCtx, this, &gPlayerAnim_link_silver_throw); + func_80835C58(play, this, func_80846358, 1); + func_80832264(play, this, &gPlayerAnim_link_silver_throw); } } -void func_80846358(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); +void func_80846358(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); return; } @@ -9276,15 +9276,15 @@ void func_80846358(Player* this, GlobalContext* globalCtx) { heldActor->world.rot.y = this->actor.shape.rot.y; heldActor->speedXZ = 10.0f; heldActor->velocity.y = 20.0f; - func_80834644(globalCtx, this); + func_80834644(play, this); func_8002F7DC(&this->actor, NA_SE_PL_THROW); func_80832698(this, NA_SE_VO_LI_SWORD_N); } } -void func_80846408(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_link_normal_nocarry_free_wait); +void func_80846408(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_link_normal_nocarry_free_wait); this->unk_850 = 15; return; } @@ -9292,49 +9292,49 @@ void func_80846408(Player* this, GlobalContext* globalCtx) { if (this->unk_850 != 0) { this->unk_850--; if (this->unk_850 == 0) { - func_8083A098(this, &gPlayerAnim_link_normal_nocarry_free_end, globalCtx); + func_8083A098(this, &gPlayerAnim_link_normal_nocarry_free_end, play); this->stateFlags1 &= ~PLAYER_STATE1_11; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } } } -void func_808464B0(Player* this, GlobalContext* globalCtx) { +void func_808464B0(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 4.0f)) { Actor* heldActor = this->heldActor; - if (!func_80835644(globalCtx, this, heldActor)) { + if (!func_80835644(play, this, heldActor)) { heldActor->velocity.y = 0.0f; heldActor->speedXZ = 0.0f; - func_80834644(globalCtx, this); + func_80834644(play, this); if (heldActor->id == ACTOR_EN_BOM_CHU) { - func_8083B8F4(this, globalCtx); + func_8083B8F4(this, play); } } } } -void func_80846578(Player* this, GlobalContext* globalCtx) { +void func_80846578(Player* this, PlayState* play) { f32 sp34; s16 sp32; func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime) || - ((this->skelAnime.curFrame >= 8.0f) && func_80837268(this, &sp34, &sp32, 0.018f, globalCtx))) { - func_80839F90(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime) || + ((this->skelAnime.curFrame >= 8.0f) && func_80837268(this, &sp34, &sp32, 0.018f, play))) { + func_80839F90(this, play); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 3.0f)) { - func_8084409C(globalCtx, this, this->linearVelocity + 8.0f, 12.0f); + func_8084409C(play, this, this->linearVelocity + 8.0f, 12.0f); } } @@ -9398,39 +9398,39 @@ static ColliderQuadInit D_808546A0 = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -void func_8084663C(Actor* thisx, GlobalContext* globalCtx) { +void func_8084663C(Actor* thisx, PlayState* play) { } -void func_80846648(GlobalContext* globalCtx, Player* this) { +void func_80846648(PlayState* play, Player* this) { this->actor.update = func_8084663C; this->actor.draw = NULL; } -void func_80846660(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F710, 0); - if ((globalCtx->sceneNum == SCENE_SPOT06) && (gSaveContext.sceneSetupIndex >= 4)) { +void func_80846660(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F710, 0); + if ((play->sceneNum == SCENE_SPOT06) && (gSaveContext.sceneSetupIndex >= 4)) { this->unk_84F = 1; } this->stateFlags1 |= PLAYER_STATE1_29; - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, 2.0f / 3.0f, 0.0f, 24.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, 2.0f / 3.0f, 0.0f, 24.0f, ANIMMODE_ONCE, 0.0f); this->actor.world.pos.y += 800.0f; } static u8 D_808546F0[] = { ITEM_SWORD_MASTER, ITEM_SWORD_KOKIRI }; -void func_80846720(GlobalContext* globalCtx, Player* this, s32 arg2) { +void func_80846720(PlayState* play, Player* this, s32 arg2) { s32 item = D_808546F0[(void)0, gSaveContext.linkAge]; s32 actionParam = sItemActionParams[item]; func_80835EFC(this); - func_808323B4(globalCtx, this); + func_808323B4(play, this); this->heldItemId = item; this->nextModelGroup = Player_ActionToModelGroup(this, actionParam); - func_8083399C(globalCtx, this, actionParam); - func_80834644(globalCtx, this); + func_8083399C(play, this, actionParam); + func_80834644(play, this); if (arg2 != 0) { func_8002F7DC(&this->actor, NA_SE_IT_SWORD_PICKOUT); @@ -9439,53 +9439,53 @@ void func_80846720(GlobalContext* globalCtx, Player* this, s32 arg2) { static Vec3f D_808546F4 = { -1.0f, 69.0f, 20.0f }; -void func_808467D4(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084E9AC, 0); +void func_808467D4(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084E9AC, 0); this->stateFlags1 |= PLAYER_STATE1_29; Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4); this->currentYaw = this->actor.shape.rot.y = -0x8000; - LinkAnimation_Change(globalCtx, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(globalCtx, this, 0x28F); + func_80832F54(play, this, 0x28F); if (LINK_IS_ADULT) { - func_80846720(globalCtx, this, 0); + func_80846720(play, this, 0); } this->unk_850 = 20; } -void func_808468A8(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F9A0, 0); - func_80832F54(globalCtx, this, 0x9B); +void func_808468A8(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F9A0, 0); + func_80832F54(play, this, 0x9B); } -void func_808468E8(GlobalContext* globalCtx, Player* this) { - func_808389E8(this, &gPlayerAnim_link_normal_jump, 12.0f, globalCtx); - func_80835C58(globalCtx, this, func_8084F9C0, 0); +void func_808468E8(PlayState* play, Player* this) { + func_808389E8(this, &gPlayerAnim_link_normal_jump, 12.0f, play); + func_80835C58(play, this, func_8084F9C0, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->fallStartHeight = this->actor.world.pos.y; - OnePointCutscene_Init(globalCtx, 5110, 40, &this->actor, MAIN_CAM); + OnePointCutscene_Init(play, 5110, 40, &this->actor, MAIN_CAM); } -void func_80846978(GlobalContext* globalCtx, Player* this) { - func_80837C0C(globalCtx, this, 1, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); +void func_80846978(PlayState* play, Player* this) { + func_80837C0C(play, this, 1, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); } -void func_808469BC(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F698, 0); +void func_808469BC(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F698, 0); this->actor.draw = NULL; this->stateFlags1 |= PLAYER_STATE1_29; } static s16 D_80854700[] = { ACTOR_MAGIC_WIND, ACTOR_MAGIC_DARK, ACTOR_MAGIC_FIRE }; -Actor* func_80846A00(GlobalContext* globalCtx, Player* this, s32 arg2) { - return Actor_Spawn(&globalCtx->actorCtx, globalCtx, D_80854700[arg2], this->actor.world.pos.x, +Actor* func_80846A00(PlayState* play, Player* this, s32 arg2) { + return Actor_Spawn(&play->actorCtx, play, D_80854700[arg2], this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } -void func_80846A68(GlobalContext* globalCtx, Player* this) { +void func_80846A68(PlayState* play, Player* this) { this->actor.draw = NULL; - func_80835C58(globalCtx, this, func_8085076C, 0); + func_80835C58(play, this, func_8085076C, 0); this->stateFlags1 |= PLAYER_STATE1_29; } @@ -9500,35 +9500,35 @@ static EffectBlureInit2 blureSword = { static Vec3s D_80854730 = { -57, 3377, 0 }; -void Player_InitCommon(Player* this, GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader) { +void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHeader) { this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; Actor_ProcessInitChain(&this->actor, sInitChain); this->swordEffectIndex = TOTAL_EFFECT_COUNT; this->currentYaw = this->actor.world.rot.y; - func_80834644(globalCtx, this); + func_80834644(play, this); - SkelAnime_InitLink(globalCtx, &this->skelAnime, skelHeader, D_80853914[PLAYER_ANIMGROUP_0][this->modelAnimType], 9, + SkelAnime_InitLink(play, &this->skelAnime, skelHeader, D_80853914[PLAYER_ANIMGROUP_0][this->modelAnimType], 9, this->jointTable, this->morphTable, PLAYER_LIMB_MAX); this->skelAnime.baseTransl = D_80854730; - SkelAnime_InitLink(globalCtx, &this->skelAnime2, skelHeader, func_80833338(this), 9, this->jointTable2, + SkelAnime_InitLink(play, &this->skelAnime2, skelHeader, func_80833338(this), 9, this->jointTable2, this->morphTable2, PLAYER_LIMB_MAX); this->skelAnime2.baseTransl = D_80854730; - Effect_Add(globalCtx, &this->swordEffectIndex, EFFECT_BLURE2, 0, 0, &blureSword); + Effect_Add(play, &this->swordEffectIndex, EFFECT_BLURE2, 0, 0, &blureSword); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, this->ageProperties->unk_04); this->unk_46C = SUBCAM_NONE; - Collider_InitCylinder(globalCtx, &this->cylinder); - Collider_SetCylinder(globalCtx, &this->cylinder, &this->actor, &D_80854624); - Collider_InitQuad(globalCtx, &this->swordQuads[0]); - Collider_SetQuad(globalCtx, &this->swordQuads[0], &this->actor, &D_80854650); - Collider_InitQuad(globalCtx, &this->swordQuads[1]); - Collider_SetQuad(globalCtx, &this->swordQuads[1], &this->actor, &D_80854650); - Collider_InitQuad(globalCtx, &this->shieldQuad); - Collider_SetQuad(globalCtx, &this->shieldQuad, &this->actor, &D_808546A0); + Collider_InitCylinder(play, &this->cylinder); + Collider_SetCylinder(play, &this->cylinder, &this->actor, &D_80854624); + Collider_InitQuad(play, &this->swordQuads[0]); + Collider_SetQuad(play, &this->swordQuads[0], &this->actor, &D_80854650); + Collider_InitQuad(play, &this->swordQuads[1]); + Collider_SetQuad(play, &this->swordQuads[1], &this->actor, &D_80854650); + Collider_InitQuad(play, &this->shieldQuad); + Collider_SetQuad(play, &this->shieldQuad, &this->actor, &D_808546A0); } -static void (*D_80854738[])(GlobalContext* globalCtx, Player* this) = { +static void (*D_80854738[])(PlayState* play, Player* this) = { func_80846648, func_808467D4, func_80846660, func_808468A8, func_808468E8, func_808469BC, func_80846A68, func_80846978, func_8083CA54, func_8083CA54, func_8083CA54, func_8083CA54, func_8083CA54, func_8083CA20, func_8083CA54, func_8083CA9C, @@ -9536,34 +9536,34 @@ static void (*D_80854738[])(GlobalContext* globalCtx, Player* this) = { static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f }; -void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { +void Player_Init(Actor* thisx, PlayState* play2) { Player* this = (Player*)thisx; - GlobalContext* globalCtx = globalCtx2; - SceneTableEntry* scene = globalCtx->loadedScene; + PlayState* play = play2; + SceneTableEntry* scene = play->loadedScene; u32 titleFileSize; s32 initMode; s32 sp50; s32 sp4C; - globalCtx->shootingGalleryStatus = globalCtx->bombchuBowlingStatus = 0; + play->shootingGalleryStatus = play->bombchuBowlingStatus = 0; - globalCtx->playerInit = Player_InitCommon; - globalCtx->playerUpdate = Player_UpdateCommon; - globalCtx->isPlayerDroppingFish = Player_IsDroppingFish; - globalCtx->startPlayerFishing = Player_StartFishing; - globalCtx->grabPlayer = func_80852F38; - globalCtx->startPlayerCutscene = func_80852FFC; - globalCtx->func_11D54 = func_80853080; - globalCtx->damagePlayer = Player_InflictDamage; - globalCtx->talkWithPlayer = func_80853148; + play->playerInit = Player_InitCommon; + play->playerUpdate = Player_UpdateCommon; + play->isPlayerDroppingFish = Player_IsDroppingFish; + play->startPlayerFishing = Player_StartFishing; + play->grabPlayer = func_80852F38; + play->startPlayerCutscene = func_80852FFC; + play->func_11D54 = func_80853080; + play->damagePlayer = Player_InflictDamage; + play->talkWithPlayer = func_80853148; thisx->room = -1; this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; this->itemActionParam = this->heldItemActionParam = -1; this->heldItemId = ITEM_NONE; - func_80835F44(globalCtx, this, ITEM_NONE); - Player_SetEquipmentData(globalCtx, this); + func_80835F44(play, this, ITEM_NONE); + Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; if (CVar_GetS32("gMMBunnyHood", 0)) { if (INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_SOLD_OUT) { @@ -9579,7 +9579,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { } } } - Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]); + Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]); this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC_DEBUG(0x3008) + 8) & ~0xF); sp50 = gSaveContext.respawnFlag; @@ -9604,8 +9604,8 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { thisx->params = gSaveContext.respawn[sp4C].playerParams; } - globalCtx->actorCtx.flags.tempSwch = gSaveContext.respawn[sp4C].tempSwchFlags & 0xFFFFFF; - globalCtx->actorCtx.flags.tempCollect = gSaveContext.respawn[sp4C].tempCollectFlags; + play->actorCtx.flags.tempSwch = gSaveContext.respawn[sp4C].tempSwchFlags & 0xFFFFFF; + play->actorCtx.flags.tempCollect = gSaveContext.respawn[sp4C].tempCollectFlags; } } @@ -9615,23 +9615,23 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { if ((gSaveContext.sceneSetupIndex < 4) && (gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field & 0x4000) && - ((globalCtx->sceneNum != SCENE_DDAN) || (gSaveContext.eventChkInf[11] & 1)) && - ((globalCtx->sceneNum != SCENE_NIGHT_SHOP) || (gSaveContext.eventChkInf[2] & 0x20))) { - TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, this->giObjectSegment, 160, 120, 144, + ((play->sceneNum != SCENE_DDAN) || (gSaveContext.eventChkInf[11] & 1)) && + ((play->sceneNum != SCENE_NIGHT_SHOP) || (gSaveContext.eventChkInf[2] & 0x20))) { + TitleCard_InitPlaceName(play, &play->actorCtx.titleCtx, this->giObjectSegment, 160, 120, 144, 24, 20); } } gSaveContext.showTitleCard = true; } - if (func_80845C68(globalCtx, (sp50 == 2) ? 1 : 0) == 0) { + if (func_80845C68(play, (sp50 == 2) ? 1 : 0) == 0) { gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = (thisx->params & 0xFF) | 0xD00; } gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 1; - if (globalCtx->sceneNum <= SCENE_GANONTIKA_SONOGO) { - gSaveContext.infTable[26] |= gBitFlags[globalCtx->sceneNum]; + if (play->sceneNum <= SCENE_GANONTIKA_SONOGO) { + gSaveContext.infTable[26] |= gBitFlags[play->sceneNum]; } initMode = (thisx->params & 0xF00) >> 8; @@ -9641,11 +9641,11 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - D_80854738[initMode](globalCtx, this); + D_80854738[initMode](play, this); if (initMode != 0) { if ((gSaveContext.gameMode == 0) || (gSaveContext.gameMode == 3)) { - this->naviActor = Player_SpawnFairy(globalCtx, this, &thisx->world.pos, &D_80854778, FAIRY_NAVI); + this->naviActor = Player_SpawnFairy(play, this, &thisx->world.pos, &D_80854778, FAIRY_NAVI); if (gSaveContext.dogParams != 0) { gSaveContext.dogParams |= 0x8000; } @@ -9654,7 +9654,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { if (gSaveContext.nayrusLoveTimer != 0) { gSaveContext.unk_13F0 = 3; - func_80846A00(globalCtx, this, 1); + func_80846A00(play, this, 1); this->stateFlags3 &= ~PLAYER_STATE3_6; } @@ -9663,7 +9663,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { gSaveContext.entranceSound = 0; } - Map_SavePlayerInitialInfo(globalCtx); + Map_SavePlayerInitialInfo(play); MREG(64) = 0; } @@ -9729,8 +9729,8 @@ static f32 D_80854784[] = { 120.0f, 240.0f, 360.0f }; static u8 sDiveDoActions[] = { DO_ACTION_1, DO_ACTION_2, DO_ACTION_3, DO_ACTION_4, DO_ACTION_5, DO_ACTION_6, DO_ACTION_7, DO_ACTION_8 }; -void func_808473D4(GlobalContext* globalCtx, Player* this) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) && (this->actor.category == ACTORCAT_PLAYER)) { +void func_808473D4(PlayState* play, Player* this) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (this->actor.category == ACTORCAT_PLAYER)) { Actor* heldActor = this->heldActor; Actor* interactRangeActor = this->interactRangeActor; s32 sp24; @@ -9738,7 +9738,7 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { s32 sp1C = func_808332B8(this); s32 doAction = DO_ACTION_NONE; - if (!Player_InBlockingCsMode(globalCtx, this)) { + if (!Player_InBlockingCsMode(play, this)) { if (this->stateFlags1 & PLAYER_STATE1_20) { doAction = DO_ACTION_RETURN; } else if ((this->heldItemActionParam == PLAYER_AP_FISHING_POLE) && (this->unk_860 != 0)) { @@ -9811,15 +9811,15 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (sp20 <= 0) && (func_8008E9C4(this) || ((D_808535E4 != 7) && (func_80833B2C(this) || - ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && + ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && !(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) { doAction = DO_ACTION_ATTACK; - } else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && + } else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && func_80833BCC(this) && (sp20 > 0)) { doAction = DO_ACTION_JUMP; } else if ((this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER) || ((this->stateFlags2 & PLAYER_STATE2_20) && - (globalCtx->actorCtx.targetCtx.arrowPointedActor == NULL))) { + (play->actorCtx.targetCtx.arrowPointedActor == NULL))) { doAction = DO_ACTION_PUTAWAY; } } @@ -9837,17 +9837,17 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { } } - Interface_SetDoAction(globalCtx, doAction); + Interface_SetDoAction(play, doAction); if (this->stateFlags2 & PLAYER_STATE2_21) { if (this->unk_664 != NULL) { - Interface_SetNaviCall(globalCtx, 0x1E); + Interface_SetNaviCall(play, 0x1E); } else { - Interface_SetNaviCall(globalCtx, 0x1D); + Interface_SetNaviCall(play, 0x1D); } - Interface_SetNaviCall(globalCtx, 0x1E); + Interface_SetNaviCall(play, 0x1E); } else { - Interface_SetNaviCall(globalCtx, 0x1F); + Interface_SetNaviCall(play, 0x1F); } } } @@ -9883,7 +9883,7 @@ s32 func_80847A78(Player* this) { static Vec3f D_80854798 = { 0.0f, 18.0f, 0.0f }; -void func_80847BA0(GlobalContext* globalCtx, Player* this) { +void func_80847BA0(PlayState* play, Player* this) { u8 spC7 = 0; CollisionPoly* spC0; Vec3f spB4; @@ -9930,7 +9930,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { } Math_Vec3f_Copy(&spB4, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, spAC, spB0, spA8, spA4); + Actor_UpdateBgCheckInfo(play, &this->actor, spAC, spB0, spA8, spA4); if (this->actor.bgCheckFlags & 0x10) { this->actor.velocity.y = 0.0f; @@ -9942,7 +9942,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { spC0 = this->actor.floorPoly; if (spC0 != NULL) { - this->unk_A7A = func_80041EA4(&globalCtx->colCtx, spC0, this->actor.floorBgId); + this->unk_A7A = func_80041EA4(&play->colCtx, spC0, this->actor.floorBgId); this->unk_A82 = this->unk_89E; if (this->actor.bgCheckFlags & 0x20) { @@ -9955,35 +9955,35 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { if (this->stateFlags2 & PLAYER_STATE2_9) { this->unk_89E = 1; } else { - this->unk_89E = SurfaceType_GetSfx(&globalCtx->colCtx, spC0, this->actor.floorBgId); + this->unk_89E = SurfaceType_GetSfx(&play->colCtx, spC0, this->actor.floorBgId); } } if (this->actor.category == ACTORCAT_PLAYER) { - Audio_SetCodeReverb(SurfaceType_GetEcho(&globalCtx->colCtx, spC0, this->actor.floorBgId)); + Audio_SetCodeReverb(SurfaceType_GetEcho(&play->colCtx, spC0, this->actor.floorBgId)); if (this->actor.floorBgId == BGCHECK_SCENE) { - func_80074CE8(globalCtx, - SurfaceType_GetLightSettingIndex(&globalCtx->colCtx, spC0, this->actor.floorBgId)); + func_80074CE8(play, + SurfaceType_GetLightSettingIndex(&play->colCtx, spC0, this->actor.floorBgId)); } else { - func_80043508(&globalCtx->colCtx, this->actor.floorBgId); + func_80043508(&play->colCtx, this->actor.floorBgId); } } - D_808535F4 = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, spC0, this->actor.floorBgId); + D_808535F4 = SurfaceType_GetConveyorSpeed(&play->colCtx, spC0, this->actor.floorBgId); if (D_808535F4 != 0) { - D_808535F8 = SurfaceType_IsConveyor(&globalCtx->colCtx, spC0, this->actor.floorBgId); + D_808535F8 = SurfaceType_IsConveyor(&play->colCtx, spC0, this->actor.floorBgId); if (((D_808535F8 == 0) && (this->actor.yDistToWater > 20.0f) && (this->currentBoots != PLAYER_BOOTS_IRON)) || ((D_808535F8 != 0) && (this->actor.bgCheckFlags & 1))) { - D_808535FC = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, spC0, this->actor.floorBgId) << 10; + D_808535FC = SurfaceType_GetConveyorDirection(&play->colCtx, spC0, this->actor.floorBgId) << 10; } else { D_808535F4 = 0; } } } - func_80839034(globalCtx, this, spC0, this->actor.floorBgId); + func_80839034(play, this, spC0, this->actor.floorBgId); this->actor.bgCheckFlags &= ~0x200; @@ -9997,7 +9997,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { D_80854798.z = this->ageProperties->unk_38 + 10.0f; if (!(this->stateFlags2 & PLAYER_STATE2_18) && - func_80839768(globalCtx, this, &D_80854798, &spA0, &sp9C, &D_80858AA8)) { + func_80839768(play, this, &D_80854798, &spA0, &sp9C, &D_80858AA8)) { this->actor.bgCheckFlags |= 0x200; if (this->actor.wallPoly != spA0) { this->actor.wallPoly = spA0; @@ -10008,7 +10008,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { sp9A = this->actor.shape.rot.y - (s16)(this->actor.wallYaw + 0x8000); - D_808535F0 = func_80041DB8(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId); + D_808535F0 = func_80041DB8(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); D_80853608 = ABS(sp9A); @@ -10050,23 +10050,23 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { sp68.z = this->actor.world.pos.z - (spB0 * sp84); sp68.y = this->actor.world.pos.y + this->ageProperties->unk_0C; - sp64 = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp7C, &sp68); + sp64 = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp7C, &sp68); wallHeight = sp64 - this->actor.world.pos.y; this->wallHeight = wallHeight; if ((this->wallHeight < 18.0f) || - BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &sp60, &this->actor.world.pos, + BgCheck_EntityCheckCeiling(&play->colCtx, &sp60, &this->actor.world.pos, (sp64 - this->actor.world.pos.y) + 20.0f, &sp78, &sp74, &this->actor)) { this->wallHeight = 399.96002f; } else { D_80854798.y = (sp64 + 5.0f) - this->actor.world.pos.y; - if (func_80839768(globalCtx, this, &D_80854798, &sp78, &sp74, &D_80858AA8) && + if (func_80839768(play, this, &D_80854798, &sp78, &sp74, &D_80858AA8) && (temp3 = this->actor.wallYaw - Math_Atan2S(sp78->normal.z, sp78->normal.x), ABS(temp3) < 0x4000) && - !func_80041E18(&globalCtx->colCtx, sp78, sp74)) { + !func_80041E18(&play->colCtx, sp78, sp74)) { this->wallHeight = 399.96002f; - } else if (func_80041DE4(&globalCtx->colCtx, wallPoly, this->actor.wallBgId) == 0) { + } else if (func_80041DE4(&play->colCtx, wallPoly, this->actor.wallBgId) == 0) { if (this->ageProperties->unk_1C <= this->wallHeight) { if (ABS(sp7C->normal.y) > 28000) { if (this->ageProperties->unk_14 <= this->wallHeight) { @@ -10100,7 +10100,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { } if (this->actor.bgCheckFlags & 1) { - D_808535E4 = func_80041D4C(&globalCtx->colCtx, spC0, this->actor.floorBgId); + D_808535E4 = func_80041D4C(&play->colCtx, spC0, this->actor.floorBgId); if (!func_80847A78(this)) { f32 sp58; @@ -10112,7 +10112,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { s32 pad3; if (this->actor.floorBgId != BGCHECK_SCENE) { - func_800434C8(&globalCtx->colCtx, this->actor.floorBgId); + func_800434C8(&play->colCtx, this->actor.floorBgId); } sp58 = COLPOLY_GET_NORMAL(spC0->normal.x); @@ -10130,7 +10130,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { D_80853610 = Math_Atan2S(1.0f, (-(sp58 * sp4C) - (sp50 * sp44)) * sp54); - func_8083E318(globalCtx, this, spC0); + func_8083E318(play, this, spC0); } } else { func_80847A78(this); @@ -10144,7 +10144,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { } } -void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { +void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { u8 seqMode; s32 pad; Actor* unk_664; @@ -10154,11 +10154,11 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { seqMode = SEQ_MODE_DEFAULT; if (this->csMode != 0) { - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), CAM_MODE_NORMAL); + Camera_ChangeMode(Play_GetCamera(play, 0), CAM_MODE_NORMAL); } else if (!(this->stateFlags1 & PLAYER_STATE1_20)) { if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_7)) { camMode = CAM_MODE_HOOKSHOT; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, this->actor.parent); + Camera_SetParam(Play_GetCamera(play, 0), 8, this->actor.parent); } else if (func_8084377C == this->func_674) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_8) { @@ -10175,12 +10175,12 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { } else { camMode = CAM_MODE_BATTLE; } - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, unk_664); + Camera_SetParam(Play_GetCamera(play, 0), 8, unk_664); } else if (this->stateFlags1 & PLAYER_STATE1_12) { camMode = CAM_MODE_CHARGE; } else if (this->stateFlags1 & PLAYER_STATE1_25) { camMode = CAM_MODE_FOLLOWBOOMERANG; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, this->boomerangActor); + Camera_SetParam(Play_GetCamera(play, 0), 8, this->boomerangActor); } else if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { if (func_80833B2C(this)) { camMode = CAM_MODE_HANGZ; @@ -10214,18 +10214,18 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { } } - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), camMode); + Camera_ChangeMode(Play_GetCamera(play, 0), camMode); } else { // First person mode seqMode = SEQ_MODE_STILL; } - if (globalCtx->actorCtx.targetCtx.bgmEnemy != NULL) { + if (play->actorCtx.targetCtx.bgmEnemy != NULL) { seqMode = SEQ_MODE_ENEMY; - Audio_SetBgmEnemyVolume(sqrtf(globalCtx->actorCtx.targetCtx.bgmEnemy->xyzDistToPlayerSq)); + Audio_SetBgmEnemyVolume(sqrtf(play->actorCtx.targetCtx.bgmEnemy->xyzDistToPlayerSq)); } - if (globalCtx->sceneNum != SCENE_TURIBORI) { + if (play->sceneNum != SCENE_TURIBORI) { Audio_SetSequenceMode(seqMode); } } @@ -10237,11 +10237,11 @@ static Vec3f D_808547B0 = { 0.0f, 0.5f, 0.0f }; static Color_RGBA8 D_808547BC = { 255, 255, 100, 255 }; static Color_RGBA8 D_808547C0 = { 255, 50, 0, 0 }; -void func_80848A04(GlobalContext* globalCtx, Player* this) { +void func_80848A04(PlayState* play, Player* this) { f32 temp; if (this->unk_85C == 0.0f) { - func_80835F44(globalCtx, this, 0xFF); + func_80835F44(play, this, 0xFF); return; } @@ -10258,11 +10258,11 @@ void func_80848A04(GlobalContext* globalCtx, Player* this) { this->unk_85C = temp; } - func_8002836C(globalCtx, &this->swordInfo[0].tip, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0, temp * 200.0f, + func_8002836C(play, &this->swordInfo[0].tip, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0, temp * 200.0f, 0, 8); } -void func_80848B44(GlobalContext* globalCtx, Player* this) { +void func_80848B44(PlayState* play, Player* this) { Vec3f shockPos; Vec3f* randBodyPart; s32 shockScale; @@ -10283,12 +10283,12 @@ void func_80848B44(GlobalContext* globalCtx, Player* this) { shockPos.y = (Rand_CenteredFloat(5.0f) + randBodyPart->y) - this->actor.world.pos.y; shockPos.z = (Rand_CenteredFloat(5.0f) + randBodyPart->z) - this->actor.world.pos.z; - EffectSsFhgFlash_SpawnShock(globalCtx, &this->actor, &shockPos, shockScale, FHGFLASH_SHOCK_PLAYER); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &shockPos, shockScale, FHGFLASH_SHOCK_PLAYER); func_8002F8F0(&this->actor, NA_SE_PL_SPARK - SFX_FLAG); } } -void func_80848C74(GlobalContext* globalCtx, Player* this) { +void func_80848C74(PlayState* play, Player* this) { s32 spawnedFlame; u8* timerPtr; s32 timerStep; @@ -10314,7 +10314,7 @@ void func_80848C74(GlobalContext* globalCtx, Player* this) { sp58 = 0; } - func_8083819C(this, globalCtx); + func_8083819C(this, play); for (i = 0; i < PLAYER_BODYPART_MAX; i++, timerPtr++) { timerStep = sp58 + sp54; @@ -10334,28 +10334,28 @@ void func_80848C74(GlobalContext* globalCtx, Player* this) { flameIntensity = (*timerPtr - 25.0f) * 0.02f; flameIntensity = CLAMP(flameIntensity, 0.0f, 1.0f); - EffectSsFireTail_SpawnFlameOnPlayer(globalCtx, flameScale, i, flameIntensity); + EffectSsFireTail_SpawnFlameOnPlayer(play, flameScale, i, flameIntensity); } } if (spawnedFlame) { func_8002F7DC(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); - if (globalCtx->sceneNum == SCENE_JYASINBOSS) { + if (play->sceneNum == SCENE_JYASINBOSS) { dmgCooldown = 0; } else { dmgCooldown = 7; } - if ((dmgCooldown & globalCtx->gameplayFrames) == 0) { - Player_InflictDamage(globalCtx, -1); + if ((dmgCooldown & play->gameplayFrames) == 0) { + Player_InflictDamage(play, -1); } } else { this->isBurning = false; } } -void func_80848EF8(Player* this, GlobalContext* globalCtx) { +void func_80848EF8(Player* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) { f32 temp = 200000.0f - (this->unk_6A4 * 5.0f); @@ -10415,7 +10415,7 @@ void func_80848EF8(Player* this, GlobalContext* globalCtx) { int rectHeight = 24; // Texture Heigh int DefaultIconA = 50; // Default icon alpha (55 on 255) - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(OVERLAY_DISP++); if (CVar_GetS32("gHudColors", 1) == 2) { @@ -10475,7 +10475,7 @@ void func_80848EF8(Player* this, GlobalContext* globalCtx) { G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (this->unk_6A0 > 4000000.0f) { @@ -10500,7 +10500,7 @@ static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f }; static f32 D_80854820[] = { 2.0f, 4.0f, 7.0f }; static f32 D_8085482C[] = { 0.5f, 1.0f, 3.0f }; -void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { +void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { s32 pad; sControlInput = input; @@ -10537,26 +10537,26 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { this->unk_890--; } - func_808473D4(globalCtx, this); - func_80836BEC(this, globalCtx); + func_808473D4(play, this); + func_80836BEC(this, play); if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_860 != 0)) { - func_80848A04(globalCtx, this); + func_80848A04(play, this); } else if ((this->heldItemActionParam == PLAYER_AP_FISHING_POLE) && (this->unk_860 < 0)) { this->unk_860++; } if (this->shockTimer != 0) { - func_80848B44(globalCtx, this); + func_80848B44(play, this); } if (this->isBurning) { - func_80848C74(globalCtx, this); + func_80848C74(play, this); } if ((this->stateFlags3 & PLAYER_STATE3_6) && (gSaveContext.nayrusLoveTimer != 0) && (gSaveContext.unk_13F0 == 0)) { gSaveContext.unk_13F0 = 3; - func_80846A00(globalCtx, this, 1); + func_80846A00(play, this, 1); this->stateFlags3 &= ~PLAYER_STATE3_6; } @@ -10566,7 +10566,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Actor_MoveForward(&this->actor); } - func_80847BA0(globalCtx, this); + func_80847BA0(play, this); } else { f32 temp_f0; f32 phi_f12; @@ -10574,7 +10574,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { if (this->currentBoots != this->prevBoots) { if (this->currentBoots == PLAYER_BOOTS_IRON) { if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80832340(globalCtx, this); + func_80832340(play, this); if (this->ageProperties->unk_2C < this->actor.yDistToWater) { this->stateFlags2 |= PLAYER_STATE2_10; } @@ -10582,7 +10582,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } else { if (this->stateFlags1 & PLAYER_STATE1_27) { if ((this->prevBoots == PLAYER_BOOTS_IRON) || (this->actor.bgCheckFlags & 1)) { - func_8083D36C(globalCtx, this); + func_8083D36C(play, this); this->stateFlags2 &= ~PLAYER_STATE2_10; } } @@ -10593,10 +10593,10 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { if ((this->actor.parent == NULL) && (this->stateFlags1 & PLAYER_STATE1_23)) { this->actor.parent = this->rideActor; - func_8083A360(globalCtx, this); + func_8083A360(play, this); this->stateFlags1 |= PLAYER_STATE1_23; - func_80832264(globalCtx, this, &gPlayerAnim_link_uma_wait_1); - func_80832F54(globalCtx, this, 0x9B); + func_80832264(play, this, &gPlayerAnim_link_uma_wait_1); + func_80832F54(play, this, 0x9B); this->unk_850 = 99; } @@ -10611,7 +10611,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Math_ScaledStepToS(&this->unk_6C2, 0, 400); func_80032CB4(this->unk_3A8, 20, 80, 6); - this->actor.shape.face = this->unk_3A8[0] + ((globalCtx->gameplayFrames & 32) ? 0 : 3); + this->actor.shape.face = this->unk_3A8[0] + ((play->gameplayFrames & 32) ? 0 : 3); if (this->currentMask == PLAYER_MASK_BUNNY) { func_8085002C(this); @@ -10658,7 +10658,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { func_8002D868(&this->actor); - if ((this->windSpeed != 0.0f) && !Player_InCsMode(globalCtx) && + if ((this->windSpeed != 0.0f) && !Player_InCsMode(play) && !(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) && (func_80845668 != this->func_674) && (func_808507F4 != this->func_674)) { this->actor.velocity.x += this->windSpeed * Math_SinS(this->windDirection); @@ -10666,7 +10666,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } func_8002D7EC(&this->actor); - func_80847BA0(globalCtx, this); + func_80847BA0(play, this); } else { D_808535E4 = 0; this->unk_A7A = 0; @@ -10678,13 +10678,13 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Vec3f sp4C; if (!(rideActor->actor.bgCheckFlags & 1)) { - func_808396F4(globalCtx, this, &D_80854814, &sp4C, &sp5C, &sp58); + func_808396F4(play, this, &D_80854814, &sp4C, &sp5C, &sp58); } else { sp5C = rideActor->actor.floorPoly; sp58 = rideActor->actor.floorBgId; } - if ((sp5C != NULL) && func_80839034(globalCtx, this, sp5C, sp58)) { + if ((sp5C != NULL) && func_80839034(play, this, sp5C, sp58)) { if (DREG(25) != 0) { DREG(25) = 0; } else { @@ -10720,41 +10720,41 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Math_StepToF(&this->windSpeed, 0.0f, (this->stateFlags1 & PLAYER_STATE1_27) ? 0.5f : 1.0f); } - if (!Player_InBlockingCsMode(globalCtx, this) && !(this->stateFlags2 & PLAYER_STATE2_18)) { - func_8083D53C(globalCtx, this); + if (!Player_InBlockingCsMode(play, this) && !(this->stateFlags2 & PLAYER_STATE2_18)) { + func_8083D53C(play, this); if ((this->actor.category == ACTORCAT_PLAYER) && (gSaveContext.health == 0)) { if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) { - func_80832440(globalCtx, this); - func_80837B9C(this, globalCtx); + func_80832440(play, this); + func_80837B9C(this, play); } else if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_27)) { - func_80836448(globalCtx, this, + func_80836448(play, this, func_808332B8(this) ? &gPlayerAnim_link_swimer_swim_down : (this->shockTimer != 0) ? &gPlayerAnim_link_normal_electric_shock_end : &gPlayerAnim_link_derth_rebirth); } } else { if ((this->actor.parent == NULL) && - ((globalCtx->sceneLoadFlag == 0x14) || (this->unk_A87 != 0) || !func_808382DC(this, globalCtx))) { - func_8083AA10(this, globalCtx); + ((play->sceneLoadFlag == 0x14) || (this->unk_A87 != 0) || !func_808382DC(this, play))) { + func_8083AA10(this, play); } else { this->fallStartHeight = this->actor.world.pos.y; } - func_80848EF8(this, globalCtx); + func_80848EF8(this, play); } } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (this->csMode != 6) && + if ((play->csCtx.state != CS_STATE_IDLE) && (this->csMode != 6) && !(this->stateFlags1 & PLAYER_STATE1_23) && !(this->stateFlags2 & PLAYER_STATE2_7) && (this->actor.category == ACTORCAT_PLAYER)) { - CsCmdActorAction* linkActionCsCmd = globalCtx->csCtx.linkAction; + CsCmdActorAction* linkActionCsCmd = play->csCtx.linkAction; if ((linkActionCsCmd != NULL) && (D_808547C4[linkActionCsCmd->action] != 0)) { - func_8002DF54(globalCtx, NULL, 6); + func_8002DF54(play, NULL, 6); func_80832210(this); } else if ((this->csMode == 0) && !(this->stateFlags2 & PLAYER_STATE2_10) && - (globalCtx->csCtx.state != CS_STATE_UNSKIPPABLE_INIT)) { - func_8002DF54(globalCtx, NULL, 0x31); + (play->csCtx.state != CS_STATE_UNSKIPPABLE_INIT)) { + func_8002DF54(play, NULL, 0x31); func_80832210(this); } } @@ -10764,13 +10764,13 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { !(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21 | PLAYER_STATE1_26))) { this->unk_6AD = 3; } else if (func_80852E14 != this->func_674) { - func_80852944(globalCtx, this, NULL); + func_80852944(play, this, NULL); } } else { this->prevCsMode = 0; } - func_8083D6EC(globalCtx, this); + func_8083D6EC(play, this); if ((this->unk_664 == NULL) && (this->naviTextId == 0)) { this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_21); @@ -10783,7 +10783,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { this->stateFlags3 &= ~PLAYER_STATE3_4; func_80847298(this); - func_8083315C(globalCtx, this); + func_8083315C(play, this); if (this->stateFlags1 & PLAYER_STATE1_27) { D_808535E8 = 0.5f; @@ -10796,17 +10796,17 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { D_80858AA4 = this->currentMask; if (!(this->stateFlags3 & PLAYER_STATE3_2)) { - this->func_674(this, globalCtx); + this->func_674(this, play); } - Player_UpdateCamAndSeqModes(globalCtx, this); + Player_UpdateCamAndSeqModes(play, this); if (this->skelAnime.moveFlags & 8) { - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, (this->skelAnime.moveFlags & 4) ? 1.0f : this->ageProperties->unk_08); } - func_808368EC(this, globalCtx); + func_808368EC(this, play); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_8)) { this->targetActorDistance = 0.0f; @@ -10862,19 +10862,19 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { if (!(this->stateFlags2 & PLAYER_STATE2_14)) { if (!(this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_23))) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder.base); } if (!(this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_26)) && (this->invincibilityTimer <= 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder.base); if (this->invincibilityTimer < 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder.base); } } } - AnimationContext_SetNextQueue(globalCtx); + AnimationContext_SetNextQueue(play); } Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -10888,18 +10888,18 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { this->stateFlags3 &= ~PLAYER_STATE3_2; - Collider_ResetCylinderAC(globalCtx, &this->cylinder.base); + Collider_ResetCylinderAC(play, &this->cylinder.base); - Collider_ResetQuadAT(globalCtx, &this->swordQuads[0].base); - Collider_ResetQuadAT(globalCtx, &this->swordQuads[1].base); + Collider_ResetQuadAT(play, &this->swordQuads[0].base); + Collider_ResetQuadAT(play, &this->swordQuads[1].base); - Collider_ResetQuadAC(globalCtx, &this->shieldQuad.base); - Collider_ResetQuadAT(globalCtx, &this->shieldQuad.base); + Collider_ResetQuadAC(play, &this->shieldQuad.base); + Collider_ResetQuadAT(play, &this->shieldQuad.base); } static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f }; -void Player_Update(Actor* thisx, GlobalContext* globalCtx) { +void Player_Update(Actor* thisx, PlayState* play) { static Vec3f sDogSpawnPos; Player* this = (Player*)thisx; s32 dogParams; @@ -10907,16 +10907,16 @@ void Player_Update(Actor* thisx, GlobalContext* globalCtx) { Input sp44; Actor* dog; - if (func_8084FCAC(this, globalCtx)) { + if (func_8084FCAC(this, play)) { if (gSaveContext.dogParams < 0) { - if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_DOG) < 0) { + if (Object_GetIndex(&play->objectCtx, OBJECT_DOG) < 0) { gSaveContext.dogParams = 0; } else { gSaveContext.dogParams &= 0x7FFF; func_808395DC(this, &this->actor.world.pos, &D_80854838, &sDogSpawnPos); dogParams = gSaveContext.dogParams; - dog = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, + dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z, 0, this->actor.shape.rot.y, 0, dogParams | 0x8000); if (dog != NULL) { dog->room = 0; @@ -10929,13 +10929,13 @@ void Player_Update(Actor* thisx, GlobalContext* globalCtx) { } if ((this->heldActor != NULL) && (this->heldActor->update == NULL)) { - func_808323B4(globalCtx, this); + func_808323B4(play, this); } if (this->stateFlags1 & (PLAYER_STATE1_5 | PLAYER_STATE1_29)) { memset(&sp44, 0, sizeof(sp44)); } else { - sp44 = globalCtx->state.input[0]; + sp44 = play->state.input[0]; if (this->unk_88E != 0) { sp44.cur.button &= ~(BTN_A | BTN_B | BTN_CUP); sp44.press.button &= ~(BTN_A | BTN_B | BTN_CUP); @@ -10951,7 +10951,7 @@ void Player_Update(Actor* thisx, GlobalContext* globalCtx) { } } - Player_UpdateCommon(this, globalCtx, &sp44); + Player_UpdateCommon(this, play, &sp44); } MREG(52) = this->actor.world.pos.x; @@ -11003,23 +11003,23 @@ static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = { static Vec3s D_80854864 = { 0, 0, 0 }; -void Player_DrawGameplay(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDList, +void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, OverrideLimbDrawOpa overrideLimbDraw) { static s32 D_8085486C = 255; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, cullDList); gSPSegment(POLY_XLU_DISP++, 0x0C, cullDList); - func_8008F470(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod, + func_8008F470(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod, this->currentTunic, this->currentBoots, this->actor.shape.face, overrideLimbDraw, func_80090D20, this); if ((overrideLimbDraw == func_80090014) && (this->currentMask != PLAYER_MASK_NONE)) { // Fixes a bug in vanilla where ice traps are rendered extremely large while wearing a bunny hood if (CVar_GetS32("gFixIceTrapWithBunnyHood", 1)) Matrix_Push(); - Mtx* sp70 = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Mtx)); + Mtx* sp70 = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Mtx)); if (this->currentMask == PLAYER_MASK_BUNNY) { Vec3s sp68; @@ -11069,22 +11069,22 @@ void Player_DrawGameplay(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* c this->actor.world.pos.z, &D_80854864); Matrix_Scale(4.0f, 4.0f, 4.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + 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, 16, 32, 1, 0, - (globalCtx->gameplayFrames * -15) % 128, 16, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 32, 1, 0, + (play->gameplayFrames * -15) % 128, 16, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, D_8085486C); gDPSetEnvColor(POLY_XLU_DISP++, 120, 90, 30, 128); gSPDisplayList(POLY_XLU_DISP++, gHoverBootsCircleDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Player_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Player* this = (Player*)thisx; Vec3f pos; @@ -11114,7 +11114,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { rot.y = 32300; rot.x = rot.z = 0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (!(this->stateFlags2 & PLAYER_STATE2_29)) { OverrideLimbDrawOpa overrideLimbDraw = func_80090014; @@ -11130,8 +11130,8 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { if (CVar_GetS32("gDisableLOD", 0) != 0) lod = 0; - func_80093C80(globalCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093C80(play); + func_80093D84(play->state.gfxCtx); if (this->invincibilityTimer > 0) { this->unk_88F += CLAMP(50 - this->invincibilityTimer, 8, 40); @@ -11139,13 +11139,13 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { Gfx_SetFog2(POLY_OPA_DISP, 255, 0, 0, 0, 0, 4000 - (s32)(Math_CosS(this->unk_88F * 256) * 2000.0f)); } - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); if (this->unk_6AD != 0) { Vec3f projectedHeadPos; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &projectedHeadPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->actor.focus.pos, &projectedHeadPos); if (projectedHeadPos.z < -4.0f) { overrideLimbDraw = func_800902F0; } @@ -11156,8 +11156,8 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { } if (this->stateFlags2 & PLAYER_STATE2_26) { - f32 sp78 = ((u16)(globalCtx->gameplayFrames * 600) * M_PI) / 0x8000; - f32 sp74 = ((u16)(globalCtx->gameplayFrames * 1000) * M_PI) / 0x8000; + f32 sp78 = ((u16)(play->gameplayFrames * 600) * M_PI) / 0x8000; + f32 sp74 = ((u16)(play->gameplayFrames * 1000) * M_PI) / 0x8000; Matrix_Push(); this->actor.scale.y = -this->actor.scale.y; @@ -11172,7 +11172,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(1.1f, 0.95f, 1.05f, MTXMODE_APPLY); Matrix_RotateY(-sp74, MTXMODE_APPLY); Matrix_RotateX(-sp78, MTXMODE_APPLY); - Player_DrawGameplay(globalCtx, this, lod, gCullFrontDList, overrideLimbDraw); + Player_DrawGameplay(play, this, lod, gCullFrontDList, overrideLimbDraw); this->actor.scale.y = -this->actor.scale.y; Matrix_Pop(); } @@ -11180,50 +11180,50 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { gSPClearGeometryMode(POLY_OPA_DISP++, G_CULL_BOTH); gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BOTH); - Player_DrawGameplay(globalCtx, this, lod, gCullBackDList, overrideLimbDraw); + Player_DrawGameplay(play, this, lod, gCullBackDList, overrideLimbDraw); if (this->invincibilityTimer > 0) { - POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); } if (this->stateFlags2 & PLAYER_STATE2_14) { f32 scale = (this->unk_84F >> 1) * 22.0f; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (0 - globalCtx->gameplayFrames) % 128, 32, 32, 1, - 0, (globalCtx->gameplayFrames * -2) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (0 - play->gameplayFrames) % 128, 32, 32, 1, + 0, (play->gameplayFrames * -2) % 128, 32, 32)); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, 255); gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); } if (this->unk_862 > 0) { - Player_DrawGetItem(globalCtx, this); + Player_DrawGetItem(play, this); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Player_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Player_Destroy(Actor* thisx, PlayState* play) { Player* this = (Player*)thisx; - Effect_Delete(globalCtx, this->swordEffectIndex); + Effect_Delete(play, this->swordEffectIndex); - Collider_DestroyCylinder(globalCtx, &this->cylinder); - Collider_DestroyQuad(globalCtx, &this->swordQuads[0]); - Collider_DestroyQuad(globalCtx, &this->swordQuads[1]); - Collider_DestroyQuad(globalCtx, &this->shieldQuad); + Collider_DestroyCylinder(play, &this->cylinder); + Collider_DestroyQuad(play, &this->swordQuads[0]); + Collider_DestroyQuad(play, &this->swordQuads[1]); + Collider_DestroyQuad(play, &this->shieldQuad); - func_800876C8(globalCtx); + func_800876C8(play); - gSaveContext.linkAge = globalCtx->linkAgeOnLoad; + gSaveContext.linkAge = play->linkAgeOnLoad; } -s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) { +s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { s32 temp1; s16 temp2; s16 temp3; @@ -11310,7 +11310,7 @@ s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) { } this->unk_6AE |= 2; - return func_80836AB8(this, (globalCtx->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - + return func_80836AB8(this, (play->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - arg3; } @@ -11385,7 +11385,7 @@ void func_8084B000(Player* this) { this->actor.gravity = 0.0f; } -void func_8084B158(GlobalContext* globalCtx, Player* this, Input* input, f32 arg3) { +void func_8084B158(PlayState* play, Player* this, Input* input, f32 arg3) { f32 temp; if ((input != NULL) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_B)) { @@ -11401,10 +11401,10 @@ void func_8084B158(GlobalContext* globalCtx, Player* this, Input* input, f32 arg } this->skelAnime.playSpeed = temp; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); } -void func_8084B1D8(Player* this, GlobalContext* globalCtx) { +void func_8084B1D8(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_27) { func_8084B000(this); func_8084AEEC(this, &this->linearVelocity, 0, this->actor.shape.rot.y); @@ -11413,7 +11413,7 @@ void func_8084B1D8(Player* this, GlobalContext* globalCtx) { } if ((this->unk_6AD == 2) && (func_8002DD6C(this) || func_808332E4(this))) { - func_80836670(this, globalCtx); + func_80836670(this, play); } u16 buttonsToCheck = BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; @@ -11421,34 +11421,34 @@ void func_8084B1D8(Player* this, GlobalContext* globalCtx) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if ((this->csMode != 0) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || func_80833B54(this) || - (this->unk_664 != NULL) || !func_8083AD4C(globalCtx, this) || + (this->unk_664 != NULL) || !func_8083AD4C(play, this) || (((this->unk_6AD == 2) && (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_R) || func_80833B2C(this) || (!func_8002DD78(this) && !func_808334B4(this)))) || ((this->unk_6AD == 1) && CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)))) { - func_8083C148(this, globalCtx); + func_8083C148(this, play); func_80078884(NA_SE_SY_CAMERA_ZOOM_UP); } else if ((DECR(this->unk_850) == 0) || (this->unk_6AD != 2)) { if (func_8008F128(this)) { this->unk_6AE |= 0x43; } else { - this->actor.shape.rot.y = func_8084ABD8(globalCtx, this, 0, 0); + this->actor.shape.rot.y = func_8084ABD8(play, this, 0, 0); } } this->currentYaw = this->actor.shape.rot.y; } -s32 func_8084B3CC(GlobalContext* globalCtx, Player* this) { - if (globalCtx->shootingGalleryStatus != 0) { - func_80832564(globalCtx, this); - func_80835C58(globalCtx, this, func_8084FA54, 0); +s32 func_8084B3CC(PlayState* play, Player* this) { + if (play->shootingGalleryStatus != 0) { + func_80832564(play, this); + func_80835C58(play, this, func_8084FA54, 0); if (!func_8002DD6C(this) || Player_HoldsHookshot(this)) { - func_80835F44(globalCtx, this, 3); + func_80835F44(play, this, 3); } this->stateFlags1 |= PLAYER_STATE1_20; - func_80832264(globalCtx, this, func_80833338(this)); + func_80832264(play, this, func_80833338(this)); func_80832210(this); func_8083B010(this); return 1; @@ -11462,41 +11462,41 @@ void func_8084B498(Player* this) { (INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY) ? PLAYER_AP_OCARINA_FAIRY : PLAYER_AP_OCARINA_TIME; } -s32 func_8084B4D4(GlobalContext* globalCtx, Player* this) { +s32 func_8084B4D4(PlayState* play, Player* this) { if (this->stateFlags3 & PLAYER_STATE3_5) { this->stateFlags3 &= ~PLAYER_STATE3_5; func_8084B498(this); this->unk_6AD = 4; - func_8083B040(this, globalCtx); + func_8083B040(this, play); return 1; } return 0; } -void func_8084B530(Player* this, GlobalContext* globalCtx) { +void func_8084B530(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - func_80836670(this, globalCtx); + func_80836670(this, play); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_8; if (!CHECK_FLAG_ALL(this->targetActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { this->stateFlags2 &= ~PLAYER_STATE2_13; } - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Play_GetCamera(play, 0)); - if (!func_8084B4D4(globalCtx, this) && !func_8084B3CC(globalCtx, this) && !func_8083ADD4(globalCtx, this)) { - if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, globalCtx)) { + if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !func_8083ADD4(play, this)) { + if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_23) { s32 sp24 = this->unk_850; - func_8083A360(globalCtx, this); + func_8083A360(play, this); this->unk_850 = sp24; } else if (func_808332B8(this)) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else { - func_80853080(this, globalCtx); + func_80853080(this, play); } } } @@ -11506,20 +11506,20 @@ void func_8084B530(Player* this, GlobalContext* globalCtx) { } if (this->stateFlags1 & PLAYER_STATE1_23) { - func_8084CC98(this, globalCtx); + func_8084CC98(this, play); } else if (func_808332B8(this)) { - func_8084D610(this, globalCtx); - } else if (!func_8008E9C4(this) && LinkAnimation_Update(globalCtx, &this->skelAnime)) { + func_8084D610(this, play); + } else if (!func_8008E9C4(this) && LinkAnimation_Update(play, &this->skelAnime)) { if (this->skelAnime.moveFlags != 0) { func_80832DBC(this); if ((this->targetActor->category == ACTORCAT_NPC) && (this->heldItemActionParam != PLAYER_AP_FISHING_POLE)) { - func_808322D0(globalCtx, this, &gPlayerAnim_link_normal_talk_free); + func_808322D0(play, this, &gPlayerAnim_link_normal_talk_free); } else { - func_80832284(globalCtx, this, func_80833338(this)); + func_80832284(play, this, func_80833338(this)); } } else { - func_808322A4(globalCtx, this, &gPlayerAnim_link_normal_talk_free_wait); + func_808322A4(play, this, &gPlayerAnim_link_normal_talk_free_wait); } } @@ -11528,30 +11528,30 @@ void func_8084B530(Player* this, GlobalContext* globalCtx) { } } -void func_8084B78C(Player* this, GlobalContext* globalCtx) { +void func_8084B78C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; - func_8083F524(globalCtx, this); + func_8083F524(play, this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - if (!func_8083F9D0(globalCtx, this)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + if (!func_8083F9D0(play, this)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); temp = func_8083FFB8(this, &sp34, &sp32); if (temp > 0) { - func_8083FAB8(this, globalCtx); + func_8083FAB8(this, play); } else if (temp < 0) { - func_8083FB14(this, globalCtx); + func_8083FB14(this, play); } } } } -void func_8084B840(GlobalContext* globalCtx, Player* this, f32 arg2) { +void func_8084B840(PlayState* play, Player* this, f32 arg2) { if (this->actor.wallBgId != BGCHECK_SCENE) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if (dynaPolyActor != NULL) { func_8002DFA4(dynaPolyActor, arg2, this->actor.world.rot.y); @@ -11564,14 +11564,14 @@ static struct_80832924 D_80854870[] = { { NA_SE_PL_SLIP, -0x1015 }, }; -void func_8084B898(Player* this, GlobalContext* globalCtx) { +void func_8084B898(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; - if (func_80832CB0(globalCtx, this, &gPlayerAnim_link_normal_pushing)) { + if (func_80832CB0(play, this, &gPlayerAnim_link_normal_pushing)) { this->unk_850 = 1; } else if (this->unk_850 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { @@ -11580,22 +11580,22 @@ void func_8084B898(Player* this, GlobalContext* globalCtx) { } func_80832924(this, D_80854870); - func_8083F524(globalCtx, this); + func_8083F524(play, this); - if (!func_8083F9D0(globalCtx, this)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + if (!func_8083F9D0(play, this)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); temp = func_8083FFB8(this, &sp34, &sp32); if (temp < 0) { - func_8083FB14(this, globalCtx); + func_8083FB14(this, play); } else if (temp == 0) { - func_8083F72C(this, &gPlayerAnim_link_normal_push_end, globalCtx); + func_8083F72C(this, &gPlayerAnim_link_normal_push_end, play); } else { this->stateFlags2 |= PLAYER_STATE2_4; } } if (this->stateFlags2 & PLAYER_STATE2_4) { - func_8084B840(globalCtx, this, 2.0f); + func_8084B840(play, this, 2.0f); this->linearVelocity = 2.0f; } } @@ -11607,7 +11607,7 @@ static struct_80832924 D_80854878[] = { static Vec3f D_80854880 = { 0.0f, 26.0f, -40.0f }; -void func_8084B9E4(Player* this, GlobalContext* globalCtx) { +void func_8084B9E4(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp70; s16 sp6E; @@ -11622,7 +11622,7 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { anim = D_80853914[PLAYER_ANIMGROUP_36][this->modelAnimType]; this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; - if (func_80832CB0(globalCtx, this, anim)) { + if (func_80832CB0(play, this, anim)) { this->unk_850 = 1; } else { if (this->unk_850 == 0) { @@ -11634,29 +11634,29 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { } } - func_8083F524(globalCtx, this); + func_8083F524(play, this); - if (!func_8083F9D0(globalCtx, this)) { - func_80837268(this, &sp70, &sp6E, 0.0f, globalCtx); + if (!func_8083F9D0(play, this)) { + func_80837268(this, &sp70, &sp6E, 0.0f, play); temp1 = func_8083FFB8(this, &sp70, &sp6E); if (temp1 > 0) { - func_8083FAB8(this, globalCtx); + func_8083FAB8(this, play); } else if (temp1 == 0) { - func_8083F72C(this, D_80853914[PLAYER_ANIMGROUP_37][this->modelAnimType], globalCtx); + func_8083F72C(this, D_80853914[PLAYER_ANIMGROUP_37][this->modelAnimType], play); } else { this->stateFlags2 |= PLAYER_STATE2_4; } } if (this->stateFlags2 & PLAYER_STATE2_4) { - temp2 = func_8083973C(globalCtx, this, &D_80854880, &sp5C) - this->actor.world.pos.y; + temp2 = func_8083973C(play, this, &D_80854880, &sp5C) - this->actor.world.pos.y; if (fabsf(temp2) < 20.0f) { sp44.x = this->actor.world.pos.x; sp44.z = this->actor.world.pos.z; sp44.y = sp5C.y; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp44, &sp5C, &sp38, &sp54, true, false, false, true, + if (!BgCheck_EntityLineTest1(&play->colCtx, &sp44, &sp5C, &sp38, &sp54, true, false, false, true, &sp50)) { - func_8084B840(globalCtx, this, -2.0f); + func_8084B840(play, this, -2.0f); return; } } @@ -11664,7 +11664,7 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { } } -void func_8084BBE4(Player* this, GlobalContext* globalCtx) { +void func_8084BBE4(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; LinkAnimationHeader* anim; @@ -11672,9 +11672,9 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { // clang-format off - anim = (this->unk_84F > 0) ? &gPlayerAnim_link_normal_fall_wait : D_80853914[PLAYER_ANIMGROUP_40][this->modelAnimType]; func_80832284(globalCtx, this, anim); + anim = (this->unk_84F > 0) ? &gPlayerAnim_link_normal_fall_wait : D_80853914[PLAYER_ANIMGROUP_40][this->modelAnimType]; func_80832284(play, this, anim); // clang-format on } else if (this->unk_84F == 0) { if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { @@ -11696,14 +11696,14 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->currentYaw, 0x800); if (this->unk_84F != 0) { - func_80837268(this, &sp3C, &sp3A, 0.0f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.0f, play); if (this->unk_847[this->unk_846] >= 0) { if (this->unk_84F > 0) { anim = D_80853914[PLAYER_ANIMGROUP_38][this->modelAnimType]; } else { anim = D_80853914[PLAYER_ANIMGROUP_41][this->modelAnimType]; } - func_8083A9B8(this, anim, globalCtx); + func_8083A9B8(this, anim, play); return; } @@ -11714,18 +11714,18 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { } else { this->linearVelocity = 0.8f; } - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14); } } } -void func_8084BDFC(Player* this, GlobalContext* globalCtx) { +void func_8084BDFC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832E48(this, 1); - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); return; } @@ -11742,7 +11742,7 @@ void func_8084BEE4(Player* this) { func_8002F7DC(&this->actor, (this->unk_84F != 0) ? NA_SE_PL_WALK_WALL : NA_SE_PL_WALK_LADDER); } -void func_8084BF1C(Player* this, GlobalContext* globalCtx) { +void func_8084BF1C(Player* this, PlayState* play) { static Vec3f D_8085488C = { 0.0f, 0.0f, 26.0f }; s32 sp84; s32 sp80; @@ -11785,19 +11785,19 @@ void func_8084BF1C(Player* this, GlobalContext* globalCtx) { if (this->unk_850 >= 0) { if ((this->actor.wallPoly != NULL) && (this->actor.wallBgId != BGCHECK_SCENE)) { - DynaPolyActor* wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + DynaPolyActor* wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if (wallPolyActor != NULL) { Math_Vec3f_Diff(&wallPolyActor->actor.world.pos, &wallPolyActor->actor.prevPos, &sp6C); Math_Vec3f_Sum(&this->actor.world.pos, &sp6C, &this->actor.world.pos); } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 6.0f, this->ageProperties->unk_00, 7); - func_8083F360(globalCtx, this, 26.0f, this->ageProperties->unk_3C, 50.0f, -20.0f); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 6.0f, this->ageProperties->unk_00, 7); + func_8083F360(play, this, 26.0f, this->ageProperties->unk_3C, 50.0f, -20.0f); } - if ((this->unk_850 < 0) || !func_8083FBC0(this, globalCtx)) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) != 0) { + if ((this->unk_850 < 0) || !func_8083FBC0(this, play)) { + if (LinkAnimation_Update(play, &this->skelAnime) != 0) { if (this->unk_850 < 0) { this->unk_850 = ABS(this->unk_850) & 1; return; @@ -11808,41 +11808,41 @@ void func_8084BF1C(Player* this, GlobalContext* globalCtx) { if (sp84 > 0) { D_8085488C.y = this->ageProperties->unk_40; - temp_f0 = func_8083973C(globalCtx, this, &D_8085488C, &sp5C); + temp_f0 = func_8083973C(play, this, &D_8085488C, &sp5C); if (this->actor.world.pos.y < temp_f0) { if (this->unk_84F != 0) { this->actor.world.pos.y = temp_f0; this->stateFlags1 &= ~PLAYER_STATE1_21; - func_8083A5C4(globalCtx, this, this->actor.wallPoly, this->ageProperties->unk_3C, + func_8083A5C4(play, this, this->actor.wallPoly, this->ageProperties->unk_3C, &gPlayerAnim_link_normal_jump_climb_up_free); this->currentYaw += 0x8000; this->actor.shape.rot.y = this->currentYaw; - func_8083A9B8(this, &gPlayerAnim_link_normal_jump_climb_up_free, globalCtx); + func_8083A9B8(this, &gPlayerAnim_link_normal_jump_climb_up_free, play); this->stateFlags1 |= PLAYER_STATE1_14; } else { - func_8083F070(this, this->ageProperties->unk_CC[this->unk_850], globalCtx); + func_8083F070(this, this->ageProperties->unk_CC[this->unk_850], play); } } else { this->skelAnime.prevTransl = this->ageProperties->unk_4A[sp68]; - func_80832264(globalCtx, this, this->ageProperties->unk_AC[sp68]); + func_80832264(play, this, this->ageProperties->unk_AC[sp68]); } } else { if ((this->actor.world.pos.y - this->actor.floorHeight) < 15.0f) { if (this->unk_84F != 0) { - func_8083FB7C(this, globalCtx); + func_8083FB7C(this, play); } else { if (this->unk_850 != 0) { this->skelAnime.prevTransl = this->ageProperties->unk_44; } - func_8083F070(this, this->ageProperties->unk_C4[this->unk_850], globalCtx); + func_8083F070(this, this->ageProperties->unk_C4[this->unk_850], play); this->unk_850 = 1; } } else { sp68 ^= 1; this->skelAnime.prevTransl = this->ageProperties->unk_62[sp68]; anim1 = this->ageProperties->unk_AC[sp68]; - LinkAnimation_Change(globalCtx, &this->skelAnime, anim1, -1.0f, Animation_GetLastFrame(anim1), + LinkAnimation_Change(play, &this->skelAnime, anim1, -1.0f, Animation_GetLastFrame(anim1), 0.0f, ANIMMODE_ONCE, 0.0f); } } @@ -11853,10 +11853,10 @@ void func_8084BF1C(Player* this, GlobalContext* globalCtx) { if (sp80 > 0) { this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->unk_850]; - func_80832264(globalCtx, this, anim2); + func_80832264(play, this, anim2); } else { this->skelAnime.prevTransl = this->ageProperties->unk_86[this->unk_850]; - LinkAnimation_Change(globalCtx, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), + LinkAnimation_Change(play, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), 0.0f, ANIMMODE_ONCE, 0.0f); } } else { @@ -11893,7 +11893,7 @@ static struct_80832924 D_808548A8[] = { { NA_SE_PL_WALK_LADDER, -0x81E }, }; -void func_8084C5F8(Player* this, GlobalContext* globalCtx) { +void func_8084C5F8(Player* this, PlayState* play) { s32 temp; f32* sp38; CollisionPoly* sp34; @@ -11902,15 +11902,15 @@ void func_8084C5F8(Player* this, GlobalContext* globalCtx) { this->stateFlags2 |= PLAYER_STATE2_6; - temp = func_808374A0(globalCtx, this, &this->skelAnime, 4.0f); + temp = func_808374A0(play, this, &this->skelAnime, 4.0f); if (temp == 0) { this->stateFlags1 &= ~PLAYER_STATE1_21; return; } - if ((temp > 0) || LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); + if ((temp > 0) || LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); this->stateFlags1 &= ~PLAYER_STATE1_21; return; } @@ -11926,8 +11926,8 @@ void func_8084C5F8(Player* this, GlobalContext* globalCtx) { sp24.x = this->actor.world.pos.x; sp24.y = this->actor.world.pos.y + 20.0f; sp24.z = this->actor.world.pos.z; - if (BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp34, &sp30, &sp24) != 0.0f) { - this->unk_89E = func_80041F10(&globalCtx->colCtx, sp34, sp30); + if (BgCheck_EntityRaycastFloor3(&play->colCtx, &sp34, &sp30, &sp24) != 0.0f) { + this->unk_89E = func_80041F10(&play->colCtx, sp34, sp30); func_808328A0(this); } } @@ -11938,17 +11938,17 @@ static struct_80832924 D_808548B4[] = { { 0, 0x3050 }, { 0, 0x3058 }, { 0, 0x3060 }, { 0, -0x3068 }, }; -void func_8084C760(Player* this, GlobalContext* globalCtx) { +void func_8084C760(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (!(this->stateFlags1 & PLAYER_STATE1_0)) { if (this->skelAnime.moveFlags != 0) { this->skelAnime.moveFlags = 0; return; } - if (!func_8083F570(this, globalCtx)) { + if (!func_8083F570(this, play)) { this->linearVelocity = sControlInput->rel.stick_y * 0.03f; } } @@ -11963,11 +11963,11 @@ static struct_80832924 D_808548D8[] = { { 0, 0x303C }, { 0, 0x3044 }, { 0, 0x304C }, { 0, -0x3054 }, }; -void func_8084C81C(Player* this, GlobalContext* globalCtx) { +void func_8084C81C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); this->stateFlags2 &= ~PLAYER_STATE2_18; return; } @@ -11990,7 +11990,7 @@ static Vec3f D_8085492C[] = { { -60.0f, -20.0f, 0.0f }, }; -s32 func_8084C89C(GlobalContext* globalCtx, Player* this, s32 arg2, f32* arg3) { +s32 func_8084C89C(PlayState* play, Player* this, s32 arg2, f32* arg3) { EnHorse* rideActor = (EnHorse*)this->rideActor; f32 sp50; f32 sp4C; @@ -12002,14 +12002,14 @@ s32 func_8084C89C(GlobalContext* globalCtx, Player* this, s32 arg2, f32* arg3) { sp50 = rideActor->actor.world.pos.y + 20.0f; sp4C = rideActor->actor.world.pos.y - 20.0f; - *arg3 = func_8083973C(globalCtx, this, &D_808548FC[arg2], &sp40); + *arg3 = func_8083973C(play, this, &D_808548FC[arg2], &sp40); return (sp4C < *arg3) && (*arg3 < sp50) && - !func_80839768(globalCtx, this, &D_80854914[arg2], &sp30, &sp2C, &sp34) && - !func_80839768(globalCtx, this, &D_8085492C[arg2], &sp30, &sp2C, &sp34); + !func_80839768(play, this, &D_80854914[arg2], &sp30, &sp2C, &sp34) && + !func_80839768(play, this, &D_8085492C[arg2], &sp30, &sp2C, &sp34); } -s32 func_8084C9BC(Player* this, GlobalContext* globalCtx) { +s32 func_8084C9BC(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; s32 sp38; f32 sp34; @@ -12018,25 +12018,25 @@ s32 func_8084C9BC(Player* this, GlobalContext* globalCtx) { this->unk_850 = 99; } else { sp38 = (this->mountSide < 0) ? 0 : 1; - if (!func_8084C89C(globalCtx, this, sp38, &sp34)) { + if (!func_8084C89C(play, this, sp38, &sp34)) { sp38 ^= 1; - if (!func_8084C89C(globalCtx, this, sp38, &sp34)) { + if (!func_8084C89C(play, this, sp38, &sp34)) { return 0; } else { this->mountSide = -this->mountSide; } } - if ((globalCtx->csCtx.state == CS_STATE_IDLE) && (globalCtx->transitionMode == 0) && + if ((play->csCtx.state == CS_STATE_IDLE) && (play->transitionMode == 0) && (EN_HORSE_CHECK_1(rideActor) || EN_HORSE_CHECK_4(rideActor))) { this->stateFlags2 |= PLAYER_STATE2_22; if (EN_HORSE_CHECK_1(rideActor) || (EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) { rideActor->actor.child = NULL; - func_80835DAC(globalCtx, this, func_8084D3E4, 0); + func_80835DAC(play, this, func_8084D3E4, 0); this->unk_878 = sp34 - rideActor->actor.world.pos.y; - func_80832264(globalCtx, this, + func_80832264(play, this, (this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down : &gPlayerAnim_link_uma_right_down); return 1; @@ -12110,7 +12110,7 @@ static struct_80832924 D_808549A4[] = { { NA_SE_PL_CALM_PAT, 0x884 }, { NA_SE_PL_CALM_PAT, -0x888 }, }; -void func_8084CC98(Player* this, GlobalContext* globalCtx) { +void func_8084CC98(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; u8* arr; @@ -12119,7 +12119,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { func_8084CBF4(this, 1.0f, 10.0f); if (this->unk_850 == 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { this->skelAnime.animation = &gPlayerAnim_link_uma_wait_1; this->unk_850 = 99; return; @@ -12133,7 +12133,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } if (LinkAnimation_OnFrame(&this->skelAnime, arr[1])) { - func_8002DE74(globalCtx, this); + func_8002DE74(play, this); func_8002F7DC(&this->actor, NA_SE_PL_SIT_ON_HORSE); return; } @@ -12141,7 +12141,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { return; } - func_8002DE74(globalCtx, this); + func_8002DE74(play, this); this->skelAnime.prevTransl = D_8085499C; if ((rideActor->animationIdx != this->unk_850) && ((rideActor->animationIdx >= 2) || (this->unk_850 >= 2))) { @@ -12156,41 +12156,41 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } else if (rand < 0.2f) { temp = 1; } - func_80832264(globalCtx, this, D_8085498C[temp]); + func_80832264(play, this, D_8085498C[temp]); } else { this->skelAnime.animation = D_80854944[this->unk_850 - 2]; - Animation_SetMorph(globalCtx, &this->skelAnime, 8.0f); + Animation_SetMorph(play, &this->skelAnime, 8.0f); if (this->unk_850 < 4) { - func_80834644(globalCtx, this); + func_80834644(play, this); this->unk_84F = 0; } } } if (this->unk_850 == 1) { - if ((D_808535E0 != 0) || func_8083224C(globalCtx)) { - func_80832264(globalCtx, this, &gPlayerAnim_link_uma_wait_3); - } else if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if ((D_808535E0 != 0) || func_8083224C(play)) { + func_80832264(play, this, &gPlayerAnim_link_uma_wait_3); + } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_850 = 99; } else if (this->skelAnime.animation == &gPlayerAnim_link_uma_wait_1) { func_80832924(this, D_808549A4); } } else { this->skelAnime.curFrame = rideActor->curFrame; - LinkAnimation_AnimateFrame(globalCtx, &this->skelAnime); + LinkAnimation_AnimateFrame(play, &this->skelAnime); } - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime.morphTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.morphTable, this->skelAnime.jointTable); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0)) { + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0)) { if (this->csMode == 7) { this->csMode = 0; } this->unk_6AD = 0; this->unk_84F = 0; } else if ((this->unk_850 < 2) || (this->unk_850 >= 4)) { - D_808535E0 = func_80836670(this, globalCtx); + D_808535E0 = func_80836670(this, play); if (D_808535E0 != 0) { this->unk_84F = 0; } @@ -12203,11 +12203,11 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csMode != 0) || - (!func_8083224C(globalCtx) && ((rideActor->actor.speedXZ != 0.0f) || !func_8083B644(this, globalCtx)) && - !func_8083C1DC(this, globalCtx))) { + (!func_8083224C(play) && ((rideActor->actor.speedXZ != 0.0f) || !func_8083B644(this, play)) && + !func_8083C1DC(this, play))) { if (D_808535E0 == 0) { if (this->unk_84F != 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { + if (LinkAnimation_Update(play, &this->skelAnime2)) { rideActor->stateFlags &= ~ENHORSE_FLAG_8; this->unk_84F = 0; } @@ -12218,7 +12218,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { func_80832698(this, NA_SE_VO_LI_LASH); } - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable); } else { if (LinkAnimation_OnFrame(&this->skelAnime2, 10.0f)) { @@ -12226,7 +12226,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { func_80832698(this, NA_SE_VO_LI_LASH); } - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, D_80853410); } } else { @@ -12241,26 +12241,26 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } if (anim != NULL) { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); this->unk_84F = 1; } } } if (this->stateFlags1 & PLAYER_STATE1_20) { - if (!func_8083AD4C(globalCtx, this) || CHECK_BTN_ANY(sControlInput->press.button, BTN_A) || + if (!func_8083AD4C(play, this) || CHECK_BTN_ANY(sControlInput->press.button, BTN_A) || func_80833BCC(this)) { this->unk_6AD = 0; this->stateFlags1 &= ~PLAYER_STATE1_20; } else { - this->unk_6BE = func_8084ABD8(globalCtx, this, 1, -5000) - this->actor.shape.rot.y; + this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; this->unk_6BE += 5000; this->unk_6B0 = -5000; } return; } - if ((this->csMode != 0) || (!func_8084C9BC(this, globalCtx) && !func_8083B040(this, globalCtx))) { + if ((this->csMode != 0) || (!func_8084C9BC(this, play) && !func_8083B040(this, play))) { if (this->unk_664 != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; @@ -12273,7 +12273,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } } else { if (func_8002DD78(this) != 0) { - this->unk_6BE = func_8084ABD8(globalCtx, this, 1, -5000) - this->actor.shape.rot.y; + this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; this->unk_6BE += 5000; this->unk_6B0 = -5000; } @@ -12288,14 +12288,14 @@ static struct_80832924 D_808549C4[] = { { NA_SE_PL_SLIPDOWN, -0x819 }, }; -void func_8084D3E4(Player* this, GlobalContext* globalCtx) { +void func_8084D3E4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; func_8084CBF4(this, 1.0f, 10.0f); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { EnHorse* rideActor = (EnHorse*)this->rideActor; - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); this->stateFlags1 &= ~PLAYER_STATE1_23; this->actor.parent = NULL; AREG(6) = 0; @@ -12307,7 +12307,7 @@ void func_8084D3E4(Player* this, GlobalContext* globalCtx) { gSaveContext.horseData.angle = rideActor->actor.shape.rot.y; } } else { - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), CAM_SET_NORMAL0); + Camera_ChangeSetting(Play_GetCamera(play, 0), CAM_SET_NORMAL0); if (this->mountSide < 0) { D_808549C4[0].field = 0x2828; @@ -12327,26 +12327,26 @@ void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { func_80832924(this, D_808549D0); } -void func_8084D574(GlobalContext* globalCtx, Player* this, s16 arg2) { - func_80835C58(globalCtx, this, func_8084D84C, 0); +void func_8084D574(PlayState* play, Player* this, s16 arg2) { + func_80835C58(play, this, func_8084D84C, 0); this->actor.shape.rot.y = this->currentYaw = arg2; - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); } -void func_8084D5CC(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084DAB4, 0); - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim); +void func_8084D5CC(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084DAB4, 0); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); } -void func_8084D610(Player* this, GlobalContext* globalCtx) { +void func_8084D610(Player* this, PlayState* play) { f32 sp34; s16 sp32; - func_80832CB0(globalCtx, this, &gPlayerAnim_link_swimer_swim_wait); + func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); - if (!func_8083224C(globalCtx) && !func_80837348(globalCtx, this, D_80854444, 1) && - !func_8083D12C(globalCtx, this, sControlInput)) { + if (!func_8083224C(play) && !func_80837348(play, this, D_80854444, 1) && + !func_8083D12C(play, this, sControlInput)) { if (this->unk_6AD != 1) { this->unk_6AD = 0; } @@ -12356,11 +12356,11 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { sp32 = this->actor.shape.rot.y; if (this->actor.bgCheckFlags & 1) { - func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_15][this->modelAnimType], globalCtx); + func_8083A098(this, D_80853914[PLAYER_ANIMGROUP_15][this->modelAnimType], play); func_808328A0(this); } } else { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + func_80837268(this, &sp34, &sp32, 0.0f, play); if (sp34 != 0.0f) { s16 temp = this->actor.shape.rot.y - sp32; @@ -12370,9 +12370,9 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { } if (func_80833C04(this)) { - func_8084D5CC(globalCtx, this); + func_8084D5CC(play, this); } else { - func_8084D574(globalCtx, this, sp32); + func_8084D574(play, this, sp32); } } } @@ -12381,44 +12381,44 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { } } -void func_8084D7C4(Player* this, GlobalContext* globalCtx) { - if (!func_8083B040(this, globalCtx)) { +void func_8084D7C4(Player* this, PlayState* play) { + if (!func_8083B040(this, play)) { this->stateFlags2 |= PLAYER_STATE2_5; - func_8084B158(globalCtx, this, NULL, this->linearVelocity); + func_8084B158(play, this, NULL, this->linearVelocity); func_8084B000(this); if (DECR(this->unk_850) == 0) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } } } -void func_8084D84C(Player* this, GlobalContext* globalCtx) { +void func_8084D84C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s16 temp; this->stateFlags2 |= PLAYER_STATE2_5; - func_8084B158(globalCtx, this, sControlInput, this->linearVelocity); + func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!func_80837348(globalCtx, this, D_80854444, 1) && !func_8083D12C(globalCtx, this, sControlInput)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); temp = this->actor.shape.rot.y - sp32; if ((sp34 == 0.0f) || (ABS(temp) > 0x6000) || (this->currentBoots == PLAYER_BOOTS_IRON)) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else if (func_80833C04(this)) { - func_8084D5CC(globalCtx, this); + func_8084D5CC(play, this); } func_8084D530(this, &this->linearVelocity, sp34, sp32); } } -s32 func_8084D980(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3) { +s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { LinkAnimationHeader* anim; s16 temp1; s32 temp2; @@ -12435,7 +12435,7 @@ s32 func_8084D980(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3) *arg3 = this->currentYaw; } } else { - temp2 = func_8083FD78(this, arg2, arg3, globalCtx); + temp2 = func_8083FD78(this, arg2, arg3, play); if (temp2 > 0) { anim = &gPlayerAnim_link_swimer_swim; @@ -12449,62 +12449,62 @@ s32 func_8084D980(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3) } if (anim != this->skelAnime.animation) { - func_80832C6C(globalCtx, this, anim); + func_80832C6C(play, this, anim); return 1; } return 0; } -void func_8084DAB4(Player* this, GlobalContext* globalCtx) { +void func_8084DAB4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; - func_8084B158(globalCtx, this, sControlInput, this->linearVelocity); + func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!func_80837348(globalCtx, this, D_80854444, 1) && !func_8083D12C(globalCtx, this, sControlInput)) { - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { + func_80837268(this, &sp2C, &sp2A, 0.0f, play); if (sp2C == 0.0f) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else if (!func_80833C04(this)) { - func_8084D574(globalCtx, this, sp2A); + func_8084D574(play, this, sp2A); } else { - func_8084D980(globalCtx, this, &sp2C, &sp2A); + func_8084D980(play, this, &sp2C, &sp2A); } func_8084D530(this, &this->linearVelocity, sp2C, sp2A); } } -void func_8084DBC4(GlobalContext* globalCtx, Player* this, f32 arg2) { +void func_8084DBC4(PlayState* play, Player* this, f32 arg2) { f32 sp2C; s16 sp2A; - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.0f, play); func_8084AEEC(this, &this->linearVelocity, sp2C * 0.5f, sp2A); func_8084AEEC(this, &this->actor.velocity.y, arg2, this->currentYaw); } -void func_8084DC48(Player* this, GlobalContext* globalCtx) { +void func_8084DC48(Player* this, PlayState* play) { f32 sp2C; this->stateFlags2 |= PLAYER_STATE2_5; this->actor.gravity = 0.0f; - func_80836670(this, globalCtx); + func_80836670(this, play); - if (!func_8083B040(this, globalCtx)) { + if (!func_8083B040(this, play)) { if (this->currentBoots == PLAYER_BOOTS_IRON) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); return; } if (this->unk_84F == 0) { if (this->unk_850 == 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) || + if (LinkAnimation_Update(play, &this->skelAnime) || ((this->skelAnime.curFrame >= 22.0f) && !CHECK_BTN_ALL(sControlInput->cur.button, BTN_A))) { - func_8083D330(globalCtx, this); + func_8083D330(play, this); } else if (LinkAnimation_OnFrame(&this->skelAnime, 20.0f) != 0) { this->actor.velocity.y = -2.0f; } @@ -12513,60 +12513,60 @@ void func_8084DC48(Player* this, GlobalContext* globalCtx) { return; } - func_8084B158(globalCtx, this, sControlInput, this->actor.velocity.y); + func_8084B158(play, this, sControlInput, this->actor.velocity.y); this->unk_6C2 = 16000; - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !func_8083E5A8(this, globalCtx) && + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !func_8083E5A8(this, play) && !(this->actor.bgCheckFlags & 1) && (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { - func_8084DBC4(globalCtx, this, -2.0f); + func_8084DBC4(play, this, -2.0f); } else { this->unk_84F++; - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim_wait); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); } } else if (this->unk_84F == 1) { - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); func_8084B000(this); if (this->unk_6C2 < 10000) { this->unk_84F++; this->unk_850 = this->actor.yDistToWater; - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); } - } else if (!func_8083D12C(globalCtx, this, sControlInput)) { + } else if (!func_8083D12C(play, this, sControlInput)) { sp2C = (this->unk_850 * 0.018f) + 4.0f; if (this->stateFlags1 & PLAYER_STATE1_11) { sControlInput = NULL; } - func_8084B158(globalCtx, this, sControlInput, fabsf(this->actor.velocity.y)); + func_8084B158(play, this, sControlInput, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_6C2, -10000, 800); if (sp2C > 8.0f) { sp2C = 8.0f; } - func_8084DBC4(globalCtx, this, sp2C); + func_8084DBC4(play, this, sp2C); } } } -void func_8084DF6C(GlobalContext* globalCtx, Player* this) { +void func_8084DF6C(PlayState* play, Player* this) { this->unk_862 = 0; this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Play_GetCamera(play, 0)); } -void func_8084DFAC(GlobalContext* globalCtx, Player* this) { - func_8084DF6C(globalCtx, this); +void func_8084DFAC(PlayState* play, Player* this) { + func_8084DF6C(play, this); func_808322FC(this); - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); this->currentYaw = this->actor.shape.rot.y; } -s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { +s32 func_8084DFF4(PlayState* play, Player* this) { GetItemEntry giEntry; s32 temp1; s32 temp2; @@ -12589,7 +12589,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { ((gItemAgeReqs[equipItem] == 9 || gItemAgeReqs[equipItem] == gSaveContext.linkAge) || CVar_GetS32("gTimelessEquipment", 0)); - Message_StartTextbox(globalCtx, giEntry.textId, &this->actor); + Message_StartTextbox(play, giEntry.textId, &this->actor); // RANDOTODO: Macro this boolean check. if (!(giEntry.modIndex == MOD_RANDOMIZER && giEntry.itemId == RG_ICE_TRAP)) { if (giEntry.modIndex == MOD_NONE) { @@ -12598,11 +12598,11 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { gSaveContext.bgsFlag = true; gSaveContext.swordHealth = 8; } - Item_Give(globalCtx, giEntry.itemId); + Item_Give(play, giEntry.itemId); } else { - Randomizer_Item_Give(globalCtx, giEntry); + Randomizer_Item_Give(play, giEntry); } - Player_SetPendingFlag(this, globalCtx); + Player_SetPendingFlag(this, play); } // Use this if we do have a getItemEntry @@ -12639,9 +12639,9 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); } } - else if (equipNow && Message_ShouldAdvanceSilent(globalCtx) && - Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (globalCtx->msgCtx.choiceIndex == 0) { // Equip now? Yes + else if (equipNow && Message_ShouldAdvanceSilent(play) && + Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (play->msgCtx.choiceIndex == 0) { // Equip now? Yes if (equipItem >= ITEM_SWORD_KOKIRI && equipItem <= ITEM_SWORD_BGS) { gSaveContext.equips.buttonItems[0] = equipItem; @@ -12651,26 +12651,26 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { } else if (equipItem >= ITEM_SHIELD_DEKU && equipItem <= ITEM_SHIELD_MIRROR) { Inventory_ChangeEquipment(EQUIP_SHIELD, equipItem - ITEM_SHIELD_DEKU + 1); func_808328EC(&this->actor, NA_SE_IT_SHIELD_REMOVE); - Player_SetEquipmentData(globalCtx, this); + Player_SetEquipmentData(play, this); } else if (equipItem == ITEM_TUNIC_GORON || equipItem == ITEM_TUNIC_ZORA) { Inventory_ChangeEquipment(EQUIP_TUNIC, equipItem - ITEM_TUNIC_KOKIRI + 1); func_808328EC(this, NA_SE_PL_CHANGE_ARMS); - Player_SetEquipmentData(globalCtx, this); + Player_SetEquipmentData(play, this); } } equipNow = false; - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_DONE; + Message_CloseTextbox(play); + play->msgCtx.msgMode = MSGMODE_TEXT_DONE; } else { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->getItemId == GI_GAUNTLETS_SILVER && !gSaveContext.n64ddFlag) { - globalCtx->nextEntranceIndex = 0x0123; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0x0123; + play->sceneLoadFlag = 0x14; gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->fadeTransition = 0xF; + play->fadeTransition = 0xF; this->stateFlags1 &= ~PLAYER_STATE1_29; - func_80852FFC(globalCtx, NULL, 8); + func_80852FFC(play, NULL, 8); } // Set unk_862 to 0 early to not have the game draw non-custom colored models for a split second. @@ -12683,7 +12683,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { if (this->getItemEntry.itemId == RG_ICE_TRAP && this->getItemEntry.modIndex == MOD_RANDOMIZER) { this->unk_862 = 0; gSaveContext.pendingIceTrapCount++; - Player_SetPendingFlag(this, globalCtx); + Player_SetPendingFlag(this, play); } this->getItemId = GI_NONE; @@ -12694,20 +12694,20 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { return 0; } -void func_8084E1EC(Player* this, GlobalContext* globalCtx) { +void func_8084E1EC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - if (!(this->stateFlags1 & PLAYER_STATE1_10) || func_8084DFF4(globalCtx, this)) { - func_8084DF6C(globalCtx, this); - func_80838F18(globalCtx, this); - func_80832340(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { + if (!(this->stateFlags1 & PLAYER_STATE1_10) || func_8084DFF4(play, this)) { + func_8084DF6C(play, this); + func_80838F18(play, this); + func_80832340(play, this); } } else { if ((this->stateFlags1 & PLAYER_STATE1_10) && LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { - func_808332F4(this, globalCtx); - func_80832340(globalCtx, this); - func_80835EA4(globalCtx, 8); + func_808332F4(this, play); + func_80832340(play, this); + func_80835EA4(play, 8); } else if (LinkAnimation_OnFrame(&this->skelAnime, 5.0f)) { func_80832698(this, NA_SE_VO_LI_BREATH_DRINK); } @@ -12717,21 +12717,21 @@ void func_8084E1EC(Player* this, GlobalContext* globalCtx) { func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_8084E30C(Player* this, GlobalContext* globalCtx) { +void func_8084E30C(Player* this, PlayState* play) { func_8084B000(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80838F18(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80838F18(play, this); } func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_8084E368(Player* this, GlobalContext* globalCtx) { +void func_8084E368(Player* this, PlayState* play) { func_8084B000(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80843AE8(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80843AE8(play, this); } func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); @@ -12739,14 +12739,14 @@ void func_8084E368(Player* this, GlobalContext* globalCtx) { static s16 D_808549D4[] = { 0x0600, 0x04F6, 0x0604, 0x01F1, 0x0568, 0x05F4 }; -void func_8084E3C4(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808322A4(globalCtx, this, &gPlayerAnim_link_normal_okarina_swing); +void func_8084E3C4(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808322A4(play, this, &gPlayerAnim_link_normal_okarina_swing); this->unk_850 = 1; if (this->stateFlags2 & (PLAYER_STATE2_23 | PLAYER_STATE2_25)) { this->stateFlags2 |= PLAYER_STATE2_24; } else { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); } return; } @@ -12755,37 +12755,37 @@ void func_8084E3C4(Player* this, GlobalContext* globalCtx) { return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + func_8005B1A4(Play_GetCamera(play, 0)); if ((this->targetActor != NULL) && (this->targetActor == this->unk_6A8)) { - func_80853148(globalCtx, this->targetActor); + func_80853148(play, this->targetActor); } else if (this->naviTextId < 0) { this->targetActor = this->naviActor; this->naviActor->textId = -this->naviTextId; - func_80853148(globalCtx, this->targetActor); - } else if (!func_8083B040(this, globalCtx)) { - func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, globalCtx); + func_80853148(play, this->targetActor); + } else if (!func_8083B040(this, play)) { + func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } this->stateFlags2 &= ~(PLAYER_STATE2_23 | PLAYER_STATE2_24 | PLAYER_STATE2_25); this->unk_6A8 = NULL; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_02) { - gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex = D_808549D4[globalCtx->msgCtx.lastPlayedSong]; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { + gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex = D_808549D4[play->msgCtx.lastPlayedSong]; gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x5FF; - gSaveContext.respawn[RESPAWN_MODE_RETURN].data = globalCtx->msgCtx.lastPlayedSong; + gSaveContext.respawn[RESPAWN_MODE_RETURN].data = play->msgCtx.lastPlayedSong; this->csMode = 0; this->stateFlags1 &= ~PLAYER_STATE1_29; - func_80852FFC(globalCtx, NULL, 8); - globalCtx->mainCamera.unk_14C &= ~8; + func_80852FFC(play, NULL, 8); + play->mainCamera.unk_14C &= ~8; this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; this->stateFlags2 |= PLAYER_STATE2_27; - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF) == NULL) { - Environment_WarpSongLeave(globalCtx); + if (Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF) == NULL) { + Environment_WarpSongLeave(play); } gSaveContext.seqId = (u8)NA_BGM_DISABLED; @@ -12793,12 +12793,12 @@ void func_8084E3C4(Player* this, GlobalContext* globalCtx) { } } -void func_8084E604(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083A098(this, &gPlayerAnim_link_normal_light_bom_end, globalCtx); +void func_8084E604(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083A098(this, &gPlayerAnim_link_normal_light_bom_end, play); } else if (LinkAnimation_OnFrame(&this->skelAnime, 3.0f)) { Inventory_ChangeAmmo(ITEM_NUT, -1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].x, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].y, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].z, 4000, this->actor.shape.rot.y, 0, ARROW_NUT); func_80832698(this, NA_SE_VO_LI_SWORD_N); @@ -12814,29 +12814,29 @@ static struct_80832924 D_808549E0[] = { { 0, -0x287B }, }; -void func_8084E6D4(Player* this, GlobalContext* globalCtx) { +void func_8084E6D4(Player* this, PlayState* play) { s32 cond; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 != 0) { if (this->unk_850 >= 2) { this->unk_850--; } - if (func_8084DFF4(globalCtx, this) && (this->unk_850 == 1)) { + if (func_8084DFF4(play, this) && (this->unk_850 == 1)) { cond = ((this->targetActor != NULL) && (this->exchangeItemId < 0)) || (this->stateFlags3 & PLAYER_STATE3_5); if (cond || (gSaveContext.healthAccumulator == 0)) { if (cond) { - func_8084DF6C(globalCtx, this); + func_8084DF6C(play, this); this->exchangeItemId = EXCH_ITEM_NONE; - if (func_8084B4D4(globalCtx, this) == 0) { - func_80853148(globalCtx, this->targetActor); + if (func_8084B4D4(play, this) == 0) { + func_80853148(play, this->targetActor); } } else { - func_8084DFAC(globalCtx, this); + func_8084DFAC(play, this); } } } @@ -12849,12 +12849,12 @@ void func_8084E6D4(Player* this, GlobalContext* globalCtx) { if ((this->getItemId != GI_ICE_TRAP && !gSaveContext.n64ddFlag) || (gSaveContext.n64ddFlag && (this->getItemId != RG_ICE_TRAP || this->getItemEntry.getItemId != RG_ICE_TRAP))) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, this->actor.world.pos.z, 0, 0, 0, 0); - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } else { this->actor.colChkInfo.damage = 0; - func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20); + func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; } @@ -12862,13 +12862,13 @@ void func_8084E6D4(Player* this, GlobalContext* globalCtx) { } if (this->skelAnime.animation == &gPlayerAnim_link_normal_box_kick) { - func_808322D0(globalCtx, this, &gPlayerAnim_link_demo_get_itemB); + func_808322D0(play, this, &gPlayerAnim_link_demo_get_itemB); } else { - func_808322D0(globalCtx, this, &gPlayerAnim_link_demo_get_itemA); + func_808322D0(play, this, &gPlayerAnim_link_demo_get_itemA); } this->unk_850 = 2; - func_80835EA4(globalCtx, 9); + func_80835EA4(play, 9); } } else { if (this->unk_850 == 0) { @@ -12879,11 +12879,11 @@ void func_8084E6D4(Player* this, GlobalContext* globalCtx) { } if (this->skelAnime.animation == &gPlayerAnim_link_demo_get_itemB) { - Math_ScaledStepToS(&this->actor.shape.rot.y, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 4000); + Math_ScaledStepToS(&this->actor.shape.rot.y, Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, 4000); } if (LinkAnimation_OnFrame(&this->skelAnime, 21.0f)) { - func_808332F4(this, globalCtx); + func_808332F4(this, play); } } } @@ -12901,15 +12901,15 @@ static struct_80832924 D_808549F4[] = { { 0, -0x280F }, }; -void func_8084E9AC(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_8084E9AC(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F == 0) { if (DECR(this->unk_850) == 0) { this->unk_84F = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } } else { if (LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 158.0f)) { @@ -12929,8 +12929,8 @@ static u8 D_808549FC[] = { 0x01, 0x03, 0x02, 0x04, 0x04, }; -void func_8084EAC0(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_8084EAC0(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 == 0) { if (this->itemActionParam == PLAYER_AP_BOTTLE_POE) { s32 rand = Rand_S16Offset(-1, 3); @@ -12944,7 +12944,7 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { } if (rand < 0) { - Health_ChangeBy(globalCtx, -0x10); + Health_ChangeBy(play, -0x10); } else { gSaveContext.healthAccumulator = rand * 0x10; } @@ -12969,38 +12969,38 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { if (CVar_GetS32("gBlueManaPercentRestore", 0)) { if (gSaveContext.unk_13F0 != 10) { - Magic_Fill(globalCtx); + Magic_Fill(play); } - func_80087708(globalCtx, + func_80087708(play, (gSaveContext.magicLevel * 48 * CVar_GetS32("gBluePotionMana", 100) / 100 + 15) / 16 * 16, 5); } else { if (gSaveContext.unk_13F0 != 10) { - Magic_Fill(globalCtx); + Magic_Fill(play); } - func_80087708(globalCtx, CVar_GetS32("gBluePotionMana", 100), 5); + func_80087708(play, CVar_GetS32("gBluePotionMana", 100), 5); ; } } else if (CVar_GetS32("gGreenPotionEffect", 0) && this->itemActionParam == PLAYER_AP_BOTTLE_POTION_GREEN) { if (CVar_GetS32("gGreenPercentRestore", 0)) { if (gSaveContext.unk_13F0 != 10) { - Magic_Fill(globalCtx); + Magic_Fill(play); } - func_80087708(globalCtx, + func_80087708(play, (gSaveContext.magicLevel * 48 * CVar_GetS32("gGreenPotionMana", 100) / 100 + 15) / 16 * 16, 5); } else { if (gSaveContext.unk_13F0 != 10) { - Magic_Fill(globalCtx); + Magic_Fill(play); } - func_80087708(globalCtx, CVar_GetS32("gGreenPotionMana", 100), 5); + func_80087708(play, CVar_GetS32("gGreenPotionMana", 100), 5); ; } } else if (CVar_GetS32("gMilkEffect", 0) && (this->itemActionParam == PLAYER_AP_BOTTLE_MILK || @@ -13027,7 +13027,7 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { } if (sp28 & 2) { - Magic_Fill(globalCtx); + Magic_Fill(play); } if (sp28 & 4) { @@ -13036,18 +13036,18 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { } } - func_808322A4(globalCtx, this, &gPlayerAnim_link_bottle_drink_demo_wait); + func_808322A4(play, this, &gPlayerAnim_link_bottle_drink_demo_wait); this->unk_850 = 1; return; } - func_8083C0E8(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8083C0E8(this, play); + func_8005B1A4(Play_GetCamera(play, 0)); } else if (this->unk_850 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.unk_13F0 != 9)) { - func_80832B78(globalCtx, this, &gPlayerAnim_link_bottle_drink_demo_end); + func_80832B78(play, this, &gPlayerAnim_link_bottle_drink_demo_end); this->unk_850 = 2; - Player_UpdateBottleHeld(globalCtx, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); } func_80832698(this, NA_SE_VO_LI_DRINK - SFX_FLAG); } else if ((this->unk_850 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) { @@ -13062,7 +13062,7 @@ static BottleCatchInfo D_80854A04[] = { { ACTOR_EN_INSECT, ITEM_BUG, 0x21, 0x7A }, }; -void func_8084ECA4(Player* this, GlobalContext* globalCtx) { +void func_8084ECA4(Player* this, PlayState* play) { struct_80854554* sp24; BottleCatchInfo* catchInfo; s32 temp; @@ -13071,22 +13071,22 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) { sp24 = &D_80854554[this->unk_850]; func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F != 0) { if (this->unk_850 == 0) { if (CVar_GetS32("gFastDrops", 0)) { this->unk_84F = 0; } else { - Message_StartTextbox(globalCtx, D_80854A04[this->unk_84F - 1].textId, &this->actor); + Message_StartTextbox(play, D_80854A04[this->unk_84F - 1].textId, &this->actor); } Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); this->unk_850 = 1; - } else if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->unk_84F = 0; - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Play_GetCamera(play, 0)); } } else { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } } else { if (this->unk_84F == 0) { @@ -13112,11 +13112,11 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) { this->unk_84F = i + 1; this->unk_850 = 0; this->interactRangeActor->parent = &this->actor; - Player_UpdateBottleHeld(globalCtx, this, catchInfo->itemId, ABS(catchInfo->actionParam)); + Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->actionParam)); if (!CVar_GetS32("gFastDrops", 0)) { this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; - func_808322D0(globalCtx, this, sp24->unk_04); - func_80835EA4(globalCtx, 4); + func_808322D0(play, this, sp24->unk_04); + func_80835EA4(play, 4); } } } @@ -13132,16 +13132,16 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) { static Vec3f D_80854A1C = { 0.0f, 0.0f, 5.0f }; -void func_8084EED8(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); +void func_8084EED8(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); + func_8005B1A4(Play_GetCamera(play, 0)); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 37.0f)) { - Player_SpawnFairy(globalCtx, this, &this->leftHandPos, &D_80854A1C, FAIRY_REVIVE_BOTTLE); - Player_UpdateBottleHeld(globalCtx, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_SpawnFairy(play, this, &this->leftHandPos, &D_80854A1C, FAIRY_REVIVE_BOTTLE); + Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); func_8002F7DC(&this->actor, NA_SE_EV_BOTTLE_CAP_OPEN); func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } else if (LinkAnimation_OnFrame(&this->skelAnime, 47.0f)) { @@ -13169,24 +13169,24 @@ static struct_80832924 D_80854A34[] = { { NA_SE_EV_BOTTLE_CAP_OPEN, -0x828 }, }; -void func_8084EFC0(Player* this, GlobalContext* globalCtx) { +void func_8084EFC0(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); + func_8005B1A4(Play_GetCamera(play, 0)); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 76.0f)) { BottleDropInfo* dropInfo = &D_80854A28[this->itemActionParam - PLAYER_AP_BOTTLE_FISH]; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, dropInfo->actorId, + Actor_Spawn(&play->actorCtx, play, dropInfo->actorId, (Math_SinS(this->actor.shape.rot.y) * 5.0f) + this->leftHandPos.x, this->leftHandPos.y, (Math_CosS(this->actor.shape.rot.y) * 5.0f) + this->leftHandPos.z, 0x4000, this->actor.shape.rot.y, 0, dropInfo->actorParams); - Player_UpdateBottleHeld(globalCtx, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); return; } @@ -13197,12 +13197,12 @@ static struct_80832924 D_80854A3C[] = { { NA_SE_PL_PUT_OUT_ITEM, -0x81E }, }; -void func_8084F104(Player* this, GlobalContext* globalCtx) { +void func_8084F104(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 < 0) { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } else if (this->exchangeItemId == EXCH_ITEM_NONE) { Actor* targetActor = this->targetActor; @@ -13211,7 +13211,7 @@ void func_8084F104(Player* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_8; } - func_80853148(globalCtx, targetActor); + func_80853148(play, targetActor); } else { GetItemEntry giEntry = ItemTable_Retrieve(D_80854528[this->exchangeItemId - 1]); @@ -13224,25 +13224,25 @@ void func_8084F104(Player* this, GlobalContext* globalCtx) { } if (this->unk_850 == 0) { - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); if ((this->itemActionParam == PLAYER_AP_CHICKEN) || (this->itemActionParam == PLAYER_AP_POCKET_CUCCO)) { func_8002F7DC(&this->actor, NA_SE_EV_CHICKEN_CRY_M); } this->unk_850 = 1; - } else if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_8; this->unk_862 = 0; if (this->unk_84F == 1) { - func_80832264(globalCtx, this, &gPlayerAnim_link_bottle_read_end); + func_80832264(play, this, &gPlayerAnim_link_bottle_read_end); this->unk_850 = -1; } else { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Play_GetCamera(play, 0)); } } } else if (this->unk_850 >= 0) { @@ -13254,20 +13254,20 @@ void func_8084F104(Player* this, GlobalContext* globalCtx) { } } -void func_8084F308(Player* this, GlobalContext* globalCtx) { +void func_8084F308(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_link_normal_re_dead_attack_wait); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_link_normal_re_dead_attack_wait); } if (func_80832594(this, 0, 100)) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); this->stateFlags2 &= ~PLAYER_STATE2_7; } } -void func_8084F390(Player* this, GlobalContext* globalCtx) { +void func_8084F390(Player* this, PlayState* play) { CollisionPoly* floorPoly; f32 sp50; f32 sp4C; @@ -13277,15 +13277,15 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { Vec3f sp38; this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; - LinkAnimation_Update(globalCtx, &this->skelAnime); - func_8084269C(globalCtx, this); + LinkAnimation_Update(play, &this->skelAnime); + func_8084269C(play, this); func_800F4138(&this->actor.projectedPos, NA_SE_PL_SLIP_LEVEL - SFX_FLAG, this->actor.speedXZ); - if (func_8083B040(this, globalCtx) == 0) { + if (func_8083B040(this, play) == 0) { floorPoly = this->actor.floorPoly; if (floorPoly == NULL) { - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); return; } @@ -13305,7 +13305,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { sp4C = (sp50 * sp50) * 0.015f; sp48 = sp38.y * 0.01f; - if (SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) != 1) { + if (SurfaceType_GetSlope(&play->colCtx, floorPoly, this->actor.floorBgId) != 1) { sp50 = 0; sp48 = sp38.y * 10.0f; } @@ -13321,7 +13321,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { } else { anim = D_80853914[PLAYER_ANIMGROUP_43][this->modelAnimType]; } - func_8083A098(this, anim, globalCtx); + func_8083A098(this, anim, play); } Math_SmoothStepToS(&this->currentYaw, sp46, 10, 4000, 800); @@ -13329,28 +13329,28 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { } } -void func_8084F608(Player* this, GlobalContext* globalCtx) { - if ((DECR(this->unk_850) == 0) && func_8083ADD4(globalCtx, this)) { - func_80852280(globalCtx, this, NULL); - func_80835C58(globalCtx, this, func_80852E14, 0); - func_80852E14(this, globalCtx); +void func_8084F608(Player* this, PlayState* play) { + if ((DECR(this->unk_850) == 0) && func_8083ADD4(play, this)) { + func_80852280(play, this, NULL); + func_80835C58(play, this, func_80852E14, 0); + func_80852E14(this, play); } } -void func_8084F698(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084F608, 0); +void func_8084F698(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084F608, 0); this->unk_850 = 40; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x10); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x10); } -void func_8084F710(Player* this, GlobalContext* globalCtx) { +void func_8084F710(Player* this, PlayState* play) { s32 pad; - if ((this->unk_84F != 0) && (globalCtx->csCtx.frames < 0x131)) { + if ((this->unk_84F != 0) && (play->csCtx.frames < 0x131)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; } else if (D_80853600 < 150.0f) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 == 0) { if (this->actor.bgCheckFlags & 1) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; @@ -13358,89 +13358,89 @@ void func_8084F710(Player* this, GlobalContext* globalCtx) { this->unk_850 = 1; } } else { - if ((globalCtx->sceneNum == SCENE_SPOT04) && func_8083ADD4(globalCtx, this)) { + if ((play->sceneNum == SCENE_SPOT04) && func_8083ADD4(play, this)) { return; } - func_80853080(this, globalCtx); + func_80853080(this, play); } } Math_SmoothStepToF(&this->actor.velocity.y, 2.0f, 0.3f, 8.0f, 0.5f); } - if ((globalCtx->sceneNum == SCENE_KENJYANOMA) && func_8083ADD4(globalCtx, this)) { + if ((play->sceneNum == SCENE_KENJYANOMA) && func_8083ADD4(play, this)) { return; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.linkAction != NULL)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.linkAction != NULL)) { f32 sp28 = this->actor.world.pos.y; - func_808529D0(globalCtx, this, globalCtx->csCtx.linkAction); + func_808529D0(play, this, play->csCtx.linkAction); this->actor.world.pos.y = sp28; } } -void func_8084F88C(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_8084F88C(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime); - if ((this->unk_850++ > 8) && (globalCtx->sceneLoadFlag == 0)) { + if ((this->unk_850++ > 8) && (play->sceneLoadFlag == 0)) { if (this->unk_84F != 0) { - if (globalCtx->sceneNum == 9) { - Gameplay_TriggerRespawn(globalCtx); - globalCtx->nextEntranceIndex = 0x0088; + if (play->sceneNum == 9) { + Play_TriggerRespawn(play); + play->nextEntranceIndex = 0x0088; } else if (this->unk_84F < 0) { - Gameplay_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); } else { - Gameplay_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } - globalCtx->fadeTransition = 4; + play->fadeTransition = 4; func_80078884(NA_SE_OC_ABYSS); } else { - globalCtx->fadeTransition = 2; + play->fadeTransition = 2; gSaveContext.nextTransition = 2; gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = 0xFF; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } } -void func_8084F9A0(Player* this, GlobalContext* globalCtx) { - func_80839800(this, globalCtx); +void func_8084F9A0(Player* this, PlayState* play) { + func_80839800(this, play); } -void func_8084F9C0(Player* this, GlobalContext* globalCtx) { +void func_8084F9C0(Player* this, PlayState* play) { this->actor.gravity = -1.0f; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (this->actor.velocity.y < 0.0f) { - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); } else if (this->actor.velocity.y < 6.0f) { Math_StepToF(&this->linearVelocity, 3.0f, 0.5f); } } -void func_8084FA54(Player* this, GlobalContext* globalCtx) { +void func_8084FA54(Player* this, PlayState* play) { this->unk_6AD = 2; - func_8083AD4C(globalCtx, this); - LinkAnimation_Update(globalCtx, &this->skelAnime); - func_80836670(this, globalCtx); + func_8083AD4C(play, this); + LinkAnimation_Update(play, &this->skelAnime); + func_80836670(this, play); - this->unk_6BE = func_8084ABD8(globalCtx, this, 1, 0) - this->actor.shape.rot.y; + this->unk_6BE = func_8084ABD8(play, this, 1, 0) - this->actor.shape.rot.y; this->unk_6AE |= 0x80; - if (globalCtx->shootingGalleryStatus < 0) { - globalCtx->shootingGalleryStatus++; - if (globalCtx->shootingGalleryStatus == 0) { - func_8083C148(this, globalCtx); + if (play->shootingGalleryStatus < 0) { + play->shootingGalleryStatus++; + if (play->shootingGalleryStatus == 0) { + func_8083C148(this, play); } } } -void func_8084FB10(Player* this, GlobalContext* globalCtx) { +void func_8084FB10(Player* this, PlayState* play) { if (this->unk_84F >= 0) { if (this->unk_84F < 6) { this->unk_84F++; @@ -13448,30 +13448,30 @@ void func_8084FB10(Player* this, GlobalContext* globalCtx) { if (func_80832594(this, 1, 100)) { this->unk_84F = -1; - EffectSsIcePiece_SpawnBurst(globalCtx, &this->actor.world.pos, this->actor.scale.x); + EffectSsIcePiece_SpawnBurst(play, &this->actor.world.pos, this->actor.scale.x); func_8002F7DC(&this->actor, NA_SE_PL_ICE_BROKEN); } else { this->stateFlags2 |= PLAYER_STATE2_14; } - if ((globalCtx->gameplayFrames % 4) == 0) { - Player_InflictDamage(globalCtx, -1); + if ((play->gameplayFrames % 4) == 0) { + Player_InflictDamage(play, -1); } } else { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); func_80837AFC(this, -20); } } } -void func_8084FBF4(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_8084FBF4(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime); func_808382BC(this); - if (((this->unk_850 % 25) != 0) || func_80837B18(globalCtx, this, -1)) { + if (((this->unk_850 % 25) != 0) || func_80837B18(play, this, -1)) { if (DECR(this->unk_850) == 0) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } @@ -13479,8 +13479,8 @@ void func_8084FBF4(Player* this, GlobalContext* globalCtx) { func_8002F8F0(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92); } -s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { - sControlInput = &globalCtx->state.input[0]; +s32 func_8084FCAC(Player* this, PlayState* play) { + sControlInput = &play->state.input[0]; if (CVar_GetS32("gDebugEnabled", 0) && ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_A | BTN_L | BTN_R) && @@ -13490,7 +13490,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { D_808535D0 ^= 1; if (D_808535D0) { - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), CAM_MODE_BOWARROWZ); + Camera_ChangeMode(Play_GetCamera(play, 0), CAM_MODE_BOWARROWZ); } } @@ -13516,7 +13516,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { s16 angle; s16 temp; - angle = temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + angle = temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DDOWN)) { angle = temp + 0x8000; @@ -13539,7 +13539,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { this->actor.velocity.x = 0.0f; if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { - Flags_SetTempClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetTempClear(play, play->roomCtx.curRoom.num); } Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -13604,16 +13604,16 @@ void func_8085002C(Player* this) { } } -s32 func_80850224(Player* this, GlobalContext* globalCtx) { - if (func_8083C6B8(globalCtx, this) == 0) { +s32 func_80850224(Player* this, PlayState* play) { + if (func_8083C6B8(play, this) == 0) { if (func_8083BB20(this) != 0) { s32 sp24 = func_80837818(this); - func_80837948(globalCtx, this, sp24); + func_80837948(play, this, sp24); if (sp24 >= 0x18) { this->stateFlags2 |= PLAYER_STATE2_17; - func_80837530(globalCtx, this, 0); + func_80837530(play, this, 0); return 1; } } else { @@ -13626,12 +13626,12 @@ s32 func_80850224(Player* this, GlobalContext* globalCtx) { static Vec3f D_80854A40 = { 0.0f, 40.0f, 45.0f }; -void func_808502D0(Player* this, GlobalContext* globalCtx) { +void func_808502D0(Player* this, PlayState* play) { struct_80854190* sp44 = &D_80854190[this->swordAnimation]; this->stateFlags2 |= PLAYER_STATE2_5; - if (!func_80842DF4(globalCtx, this)) { + if (!func_80842DF4(play, this)) { func_8084285C(this, 0.0f, sp44->unk_0C, sp44->unk_0D); if ((this->stateFlags2 & PLAYER_STATE2_30) && (this->heldItemActionParam != PLAYER_AP_HAMMER) && @@ -13641,14 +13641,14 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { } if (this->linearVelocity > 12.0f) { - func_8084269C(globalCtx, this); + func_8084269C(play, this); } Math_StepToF(&this->linearVelocity, 0.0f, 5.0f); func_8083C50C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - if (!func_80850224(this, globalCtx)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + if (!func_80850224(this, play)) { u8 sp43 = this->skelAnime.moveFlags; LinkAnimationHeader* sp3C; @@ -13666,7 +13666,7 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { sp3C = &gPlayerAnim_link_fighter_power_jump_kiru_end; } - func_8083A098(this, sp3C, globalCtx); + func_8083A098(this, sp3C, play); this->skelAnime.moveFlags = sp43; this->stateFlags3 |= PLAYER_STATE3_3; @@ -13677,7 +13677,7 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { Vec3f shockwavePos; f32 sp2C; - shockwavePos.y = func_8083973C(globalCtx, this, &D_80854A40, &shockwavePos); + shockwavePos.y = func_8083973C(play, this, &D_80854A40, &shockwavePos); sp2C = this->actor.world.pos.y - shockwavePos.y; Math_ScaledStepToS(&this->actor.focus.rot.x, Math_Atan2S(45.0f, sp2C), 800); @@ -13686,65 +13686,65 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { if ((((this->swordAnimation == 0x16) && LinkAnimation_OnFrame(&this->skelAnime, 7.0f)) || ((this->swordAnimation == 0x13) && LinkAnimation_OnFrame(&this->skelAnime, 2.0f))) && (sp2C > -40.0f) && (sp2C < 40.0f)) { - func_80842A28(globalCtx, this); - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &shockwavePos, &zeroVec, &zeroVec); + func_80842A28(play, this); + EffectSsBlast_SpawnWhiteShockwave(play, &shockwavePos, &zeroVec, &zeroVec); } } } } } -void func_808505DC(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_808505DC(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); if (this->skelAnime.curFrame >= 6.0f) { - func_80839FFC(this, globalCtx); + func_80839FFC(this, play); } } -void func_8085063C(Player* this, GlobalContext* globalCtx) { +void func_8085063C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - LinkAnimation_Update(globalCtx, &this->skelAnime); - func_80836670(this, globalCtx); + LinkAnimation_Update(play, &this->skelAnime); + func_80836670(this, play); if (this->unk_850 == 0) { - Message_StartTextbox(globalCtx, 0x3B, &this->actor); + Message_StartTextbox(play, 0x3B, &this->actor); this->unk_850 = 1; return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { gSaveContext.respawnFlag = 3; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; - globalCtx->fadeTransition = 5; - func_80088AF0(globalCtx); + play->sceneLoadFlag = 0x14; + play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; + play->fadeTransition = 5; + func_80088AF0(play); return; } - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = -respawnData; gSaveContext.fw.set = 0; func_80078914(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, NA_SE_PL_MAGIC_WIND_VANISH); } - func_80853080(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_80853080(this, play); + func_8005B1A4(Play_GetCamera(play, 0)); } } -void func_8085076C(Player* this, GlobalContext* globalCtx) { +void func_8085076C(Player* this, PlayState* play) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; if (this->unk_850 > 20) { this->actor.draw = Player_Draw; this->actor.world.pos.y += 60.0f; - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); return; } @@ -13795,27 +13795,27 @@ static struct_80832924 D_80854A8C[][2] = { }, }; -void func_808507F4(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_808507F4(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F < 0) { if ((this->itemActionParam == PLAYER_AP_NAYRUS_LOVE) || (gSaveContext.unk_13F0 == 0)) { - func_80839FFC(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_80839FFC(this, play); + func_8005B1A4(Play_GetCamera(play, 0)); } } else { if (this->unk_850 == 0) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f); - if (func_80846A00(globalCtx, this, this->unk_84F) != NULL) { + if (func_80846A00(play, this, this->unk_84F) != NULL) { this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; if ((this->unk_84F != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { gSaveContext.unk_13F0 = 1; } } else { - func_800876C8(globalCtx); + func_800876C8(play); } } else { - LinkAnimation_PlayLoopSetSpeed(globalCtx, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f); + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f); if (this->unk_84F == 0) { this->unk_850 = -10; @@ -13830,7 +13830,7 @@ void func_808507F4(Player* this, GlobalContext* globalCtx) { if (this->unk_850 == 0) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 1; - Gameplay_SetupRespawnPoint(globalCtx, RESPAWN_MODE_TOP, 0x6FF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_TOP, 0x6FF); gSaveContext.fw.set = 1; gSaveContext.fw.pos.x = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x; gSaveContext.fw.pos.y = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.y; @@ -13852,7 +13852,7 @@ void func_808507F4(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~(PLAYER_STATE1_28 | PLAYER_STATE1_29); } } else if (D_80854A7C[this->unk_84F] < this->unk_850++) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f); this->currentYaw = this->actor.shape.rot.y; this->unk_84F = -1; } @@ -13862,20 +13862,20 @@ void func_808507F4(Player* this, GlobalContext* globalCtx) { func_8083721C(this); } -void func_80850AEC(Player* this, GlobalContext* globalCtx) { +void func_80850AEC(Player* this, PlayState* play) { f32 temp; this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_link_hook_fly_wait); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_link_hook_fly_wait); } Math_Vec3f_Sum(&this->actor.world.pos, &this->actor.velocity, &this->actor.world.pos); if (func_80834FBC(this)) { Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); - func_80847BA0(globalCtx, this); + func_80847BA0(play, this); temp = this->actor.world.pos.y - this->actor.floorHeight; if (temp > 20.0f) { @@ -13886,7 +13886,7 @@ void func_80850AEC(Player* this, GlobalContext* globalCtx) { this->actor.world.pos.y -= temp; this->linearVelocity = 1.0f; this->actor.velocity.y = 0.0f; - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); this->stateFlags2 &= ~PLAYER_STATE2_10; this->actor.bgCheckFlags |= 1; this->stateFlags1 |= PLAYER_STATE1_2; @@ -13900,7 +13900,7 @@ void func_80850AEC(Player* this, GlobalContext* globalCtx) { } } -void func_80850C68(Player* this, GlobalContext* globalCtx) { +void func_80850C68(Player* this, PlayState* play) { if ((this->unk_850 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { f32 updateScale = R_UPDATE_RATE * 0.5f; @@ -13910,37 +13910,37 @@ void func_80850C68(Player* this, GlobalContext* globalCtx) { } LinkAnimation_BlendToJoint( - globalCtx, &this->skelAnime, &gPlayerAnim_link_fishing_wait, this->skelAnime.curFrame, + play, &this->skelAnime, &gPlayerAnim_link_fishing_wait, this->skelAnime.curFrame, (this->unk_858 < 0.0f) ? &gPlayerAnim_link_fishing_reel_left : &gPlayerAnim_link_fishing_reel_right, 5.0f, fabsf(this->unk_858), this->blendTable); LinkAnimation_BlendToMorph( - globalCtx, &this->skelAnime, &gPlayerAnim_link_fishing_wait, this->skelAnime.curFrame, + play, &this->skelAnime, &gPlayerAnim_link_fishing_wait, this->skelAnime.curFrame, (this->unk_85C < 0.0f) ? &gPlayerAnim_link_fishing_reel_up : &gPlayerAnim_link_fishing_reel_down, 5.0f, fabsf(this->unk_85C), D_80858AD8); - LinkAnimation_InterpJointMorph(globalCtx, &this->skelAnime, 0.5f); - } else if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + LinkAnimation_InterpJointMorph(play, &this->skelAnime, 0.5f); + } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_860 = 2; - func_80832284(globalCtx, this, &gPlayerAnim_link_fishing_wait); + func_80832284(play, this, &gPlayerAnim_link_fishing_wait); this->unk_850 = 1; } func_8083721C(this); if (this->unk_860 == 0) { - func_80853080(this, globalCtx); + func_80853080(this, play); } else if (this->unk_860 == 3) { - func_80835C58(globalCtx, this, func_80850E84, 0); - func_80832B0C(globalCtx, this, &gPlayerAnim_link_fishing_fish_catch); + func_80835C58(play, this, func_80850E84, 0); + func_80832B0C(play, this, &gPlayerAnim_link_fishing_fish_catch); } } -void func_80850E84(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_860 == 0)) { - func_8083A098(this, &gPlayerAnim_link_fishing_fish_catch_end, globalCtx); +void func_80850E84(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_860 == 0)) { + func_8083A098(this, &gPlayerAnim_link_fishing_fish_catch_end, play); } } -static void (*D_80854AA4[])(GlobalContext*, Player*, void*) = { +static void (*D_80854AA4[])(PlayState*, Player*, void*) = { NULL, func_80851008, func_80851030, func_80851094, func_808510B4, func_808510D4, func_808510F4, func_80851114, func_80851134, func_80851154, func_80851174, func_808511D4, func_808511FC, func_80851294, func_80851050, func_80851194, func_808511B4, func_80851248, func_808512E0, @@ -14173,106 +14173,106 @@ static struct_80854B18 D_80854E50[] = { { 12, &gPlayerAnim_demo_link_nwait }, }; -void func_80850ED8(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80850ED8(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); - func_80832B0C(globalCtx, this, anim); + func_80832B0C(play, this, anim); func_80832210(this); } -void func_80850F1C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80850F1C(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -8.0f); func_80832210(this); } -void func_80850F9C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80850F9C(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); func_80832210(this); } -void func_80851008(GlobalContext* globalCtx, Player* this, void* anim) { +void func_80851008(PlayState* play, Player* this, void* anim) { func_80832210(this); } -void func_80851030(GlobalContext* globalCtx, Player* this, void* anim) { - func_80850ED8(globalCtx, this, anim); +void func_80851030(PlayState* play, Player* this, void* anim) { + func_80850ED8(play, this, anim); } -void func_80851050(GlobalContext* globalCtx, Player* this, void* anim) { +void func_80851050(PlayState* play, Player* this, void* anim) { func_80832DB0(this); - func_80832C2C(globalCtx, this, anim); + func_80832C2C(play, this, anim); func_80832210(this); } -void func_80851094(GlobalContext* globalCtx, Player* this, void* anim) { - func_80850F1C(globalCtx, this, anim); +void func_80851094(PlayState* play, Player* this, void* anim) { + func_80850F1C(play, this, anim); } -void func_808510B4(GlobalContext* globalCtx, Player* this, void* anim) { - func_80850F9C(globalCtx, this, anim); +void func_808510B4(PlayState* play, Player* this, void* anim) { + func_80850F9C(play, this, anim); } -void func_808510D4(GlobalContext* globalCtx, Player* this, void* anim) { - func_8083308C(globalCtx, this, anim); +void func_808510D4(PlayState* play, Player* this, void* anim) { + func_8083308C(play, this, anim); } -void func_808510F4(GlobalContext* globalCtx, Player* this, void* anim) { - func_8083303C(globalCtx, this, anim, 0x9C); +void func_808510F4(PlayState* play, Player* this, void* anim) { + func_8083303C(play, this, anim, 0x9C); } -void func_80851114(GlobalContext* globalCtx, Player* this, void* anim) { - func_8083313C(globalCtx, this, anim); +void func_80851114(PlayState* play, Player* this, void* anim) { + func_8083313C(play, this, anim); } -void func_80851134(GlobalContext* globalCtx, Player* this, void* anim) { - func_808330EC(globalCtx, this, anim, 0x9C); +void func_80851134(PlayState* play, Player* this, void* anim) { + func_808330EC(play, this, anim, 0x9C); } -void func_80851154(GlobalContext* globalCtx, Player* this, void* anim) { - func_80832264(globalCtx, this, anim); +void func_80851154(PlayState* play, Player* this, void* anim) { + func_80832264(play, this, anim); } -void func_80851174(GlobalContext* globalCtx, Player* this, void* anim) { - func_80832284(globalCtx, this, anim); +void func_80851174(PlayState* play, Player* this, void* anim) { + func_80832284(play, this, anim); } -void func_80851194(GlobalContext* globalCtx, Player* this, void* anim) { - func_808322D0(globalCtx, this, anim); +void func_80851194(PlayState* play, Player* this, void* anim) { + func_808322D0(play, this, anim); } -void func_808511B4(GlobalContext* globalCtx, Player* this, void* anim) { - func_808322A4(globalCtx, this, anim); +void func_808511B4(PlayState* play, Player* this, void* anim) { + func_808322A4(play, this, anim); } -void func_808511D4(GlobalContext* globalCtx, Player* this, void* anim) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_808511D4(PlayState* play, Player* this, void* anim) { + LinkAnimation_Update(play, &this->skelAnime); } -void func_808511FC(GlobalContext* globalCtx, Player* this, void* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80850F9C(globalCtx, this, anim); +void func_808511FC(PlayState* play, Player* this, void* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80850F9C(play, this, anim); this->unk_850 = 1; } } -void func_80851248(GlobalContext* globalCtx, Player* this, void* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_80851248(PlayState* play, Player* this, void* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_808322A4(globalCtx, this, anim); + func_808322A4(play, this, anim); } } -void func_80851294(GlobalContext* globalCtx, Player* this, void* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083313C(globalCtx, this, anim); +void func_80851294(PlayState* play, Player* this, void* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083313C(play, this, anim); this->unk_850 = 1; } } -void func_808512E0(GlobalContext* globalCtx, Player* this, void* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_808512E0(PlayState* play, Player* this, void* arg2) { + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, arg2); } @@ -14288,33 +14288,33 @@ void func_80851314(Player* this) { } } -void func_80851368(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->stateFlags1 |= PLAYER_STATE1_27; this->stateFlags2 |= PLAYER_STATE2_10; this->stateFlags1 &= ~(PLAYER_STATE1_18 | PLAYER_STATE1_19); - func_80832284(globalCtx, this, &gPlayerAnim_link_swimer_swim); + func_80832284(play, this, &gPlayerAnim_link_swimer_swim); } -void func_808513BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.gravity = 0.0f; if (this->unk_84F == 0) { - if (func_8083D12C(globalCtx, this, NULL)) { + if (func_8083D12C(play, this, NULL)) { this->unk_84F = 1; } else { - func_8084B158(globalCtx, this, NULL, fabsf(this->actor.velocity.y)); + func_8084B158(play, this, NULL, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_6C2, -10000, 800); func_8084AEEC(this, &this->actor.velocity.y, 4.0f, this->currentYaw); } return; } - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F == 1) { - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim_wait); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); } else { - func_80832284(globalCtx, this, &gPlayerAnim_link_swimer_swim_wait); + func_80832284(play, this, &gPlayerAnim_link_swimer_swim_wait); } } @@ -14322,67 +14322,67 @@ void func_808513BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_808514C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80851314(this); if (func_808332B8(this)) { - func_808513BC(globalCtx, this, 0); + func_808513BC(play, this, 0); return; } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_11)) { - func_80836670(this, globalCtx); + func_80836670(this, play); return; } if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) { - func_8083E5A8(this, globalCtx); + func_8083E5A8(this, play); } } -void func_8085157C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_8085157C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); } -void func_808515A4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808515A4(PlayState* play, Player* this, CsCmdActorAction* arg2) { LinkAnimationHeader* anim; if (func_808332B8(this)) { - func_80851368(globalCtx, this, 0); + func_80851368(play, this, 0); return; } anim = D_80853914[PLAYER_ANIMGROUP_44][this->modelAnimType]; if ((this->unk_446 == 6) || (this->unk_446 == 0x2E)) { - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); } else { func_80832DB0(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), ANIMMODE_LOOP, -4.0f); } func_80832210(this); } -void func_80851688(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (func_8084B3CC(globalCtx, this) == 0) { - if ((this->csMode == 0x31) && (globalCtx->csCtx.state == CS_STATE_IDLE)) { - func_8002DF54(globalCtx, NULL, 7); +void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (func_8084B3CC(play, this) == 0) { + if ((this->csMode == 0x31) && (play->csCtx.state == CS_STATE_IDLE)) { + func_8002DF54(play, NULL, 7); return; } if (func_808332B8(this) != 0) { - func_808513BC(globalCtx, this, 0); + func_808513BC(play, this, 0); return; } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_11)) { - func_80836670(this, globalCtx); + func_80836670(this, play); } } } @@ -14392,12 +14392,12 @@ static struct_80832924 D_80855188[] = { { 0, -0x3030 }, }; -void func_80851750(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, D_80855188); } -void func_80851788(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->stateFlags1 &= ~PLAYER_STATE1_25; this->currentYaw = this->actor.shape.rot.y = this->actor.world.rot.y = @@ -14410,18 +14410,18 @@ void func_80851788(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80851828(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2) { f32 sp1C = 2.5f; - func_80845BA0(globalCtx, this, &sp1C, 10); + func_80845BA0(play, this, &sp1C, 10); - if (globalCtx->sceneNum == SCENE_BDAN_BOSS) { + if (play->sceneNum == SCENE_BDAN_BOSS) { if (this->unk_850 == 0) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { return; } } else { - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { return; } } @@ -14433,31 +14433,31 @@ void func_80851828(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_808518DC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_8083CEAC(this, globalCtx); +void func_808518DC(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_8083CEAC(this, play); } -void func_8085190C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80851314(this); if (this->unk_850 != 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, func_808334E4(this)); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, func_808334E4(this)); this->unk_850 = 0; } func_80833C3C(this); } else { - func_808401B0(globalCtx, this); + func_808401B0(play, this); } } -void func_80851998(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80845964(globalCtx, this, arg2, 0.0f, 0, 0); +void func_80851998(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80845964(play, this, arg2, 0.0f, 0, 0); } -void func_808519C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80845964(globalCtx, this, arg2, 0.0f, 0, 1); +void func_808519C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80845964(play, this, arg2, 0.0f, 0, 1); } // unused @@ -14468,11 +14468,11 @@ static LinkAnimationHeader* D_80855190[] = { static Vec3f D_80855198 = { -1.0f, 70.0f, 20.0f }; -void func_808519EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808519EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80855198); this->actor.shape.rot.y = -0x8000; - func_808322D0(globalCtx, this, this->ageProperties->unk_9C); - func_80832F54(globalCtx, this, 0x28F); + func_808322D0(play, this, this->ageProperties->unk_9C); + func_80832F54(play, this, 0x28F); } static struct_808551A4 D_808551A4[] = { @@ -14485,11 +14485,11 @@ static struct_80832924 D_808551AC[] = { { 0, -0x4027 }, }; -void func_80851A50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2) { struct_808551A4* sp2C; Gfx** dLists; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if ((LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 70.0f)) || (!LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 87.0f))) { @@ -14516,8 +14516,8 @@ void func_80851A50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80851B90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_demo_warp, -(2.0f / 3.0f), 12.0f, 12.0f, +void func_80851B90(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_demo_warp, -(2.0f / 3.0f), 12.0f, 12.0f, ANIMMODE_ONCE, 0.0f); } @@ -14525,23 +14525,23 @@ static struct_80832924 D_808551B4[] = { { 0, -0x281E }, }; -void func_80851BE8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); this->unk_850++; if (this->unk_850 >= 180) { if (this->unk_850 == 180) { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, (2.0f / 3.0f), 10.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, (2.0f / 3.0f), 10.0f, Animation_GetLastFrame(&gPlayerAnim_link_okarina_warp_goal), ANIMMODE_ONCE, -8.0f); } func_80832924(this, D_808551B4); } } -void func_80851CA4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_850 == 0) && (this->actor.bgCheckFlags & 1)) { - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_back_downB); +void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850 == 0) && (this->actor.bgCheckFlags & 1)) { + func_80832264(play, this, &gPlayerAnim_link_normal_back_downB); this->unk_850 = 1; } @@ -14550,8 +14550,8 @@ void func_80851CA4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80851D2C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80850F1C(globalCtx, this, &gPlayerAnim_link_normal_okarina_start); +void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80850F1C(play, this, &gPlayerAnim_link_normal_okarina_start); func_8084B498(this); Player_SetModels(this, Player_ActionToModelGroup(this, this->itemActionParam)); } @@ -14560,53 +14560,53 @@ static struct_80832924 D_808551B8[] = { { NA_SE_IT_SWORD_PICKOUT, -0x80C }, }; -void func_80851D80(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 6.0f)) { - func_80846720(globalCtx, this, 0); + func_80846720(play, this, 0); } else { func_80832924(this, D_808551B8); } } -void func_80851DEC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851DEC(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); Math_StepToS(&this->actor.shape.face, 0, 1); } -void func_80851E28(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851E28(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); Math_StepToS(&this->actor.shape.face, 2, 1); } -void func_80851E64(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80833064(globalCtx, this, &gPlayerAnim_link_swimer_swim_get, 0x98); +void func_80851E64(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80833064(play, this, &gPlayerAnim_link_swimer_swim_get, 0x98); } -void func_80851E90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_8083303C(globalCtx, this, &gPlayerAnim_clink_op3_negaeri, 0x9C); +void func_80851E90(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_8083303C(play, this, &gPlayerAnim_clink_op3_negaeri, 0x9C); func_80832698(this, NA_SE_VO_LI_GROAN); } -void func_80851ECC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808330EC(globalCtx, this, &gPlayerAnim_clink_op3_wait2, 0x9C); +void func_80851ECC(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808330EC(play, this, &gPlayerAnim_clink_op3_wait2, 0x9C); } } -void func_80851F14(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808322A4(globalCtx, this, anim); +void func_80851F14(PlayState* play, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808322A4(play, this, anim); this->unk_850 = 1; } else if (this->unk_850 == 0) { func_80832924(this, arg3); } } -void func_80851F84(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851F84(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.shape.shadowDraw = NULL; - func_80851134(globalCtx, this, &gPlayerAnim_clink_op3_wait1); + func_80851134(play, this, &gPlayerAnim_clink_op3_wait1); } static struct_80832924 D_808551BC[] = { @@ -14615,9 +14615,9 @@ static struct_80832924 D_808551BC[] = { { NA_SE_PL_SLIPDOWN, -0x900 }, }; -void func_80851FB0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808330EC(globalCtx, this, &gPlayerAnim_clink_op3_wait3, 0x9C); +void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808330EC(play, this, &gPlayerAnim_clink_op3_wait3, 0x9C); this->unk_850 = 1; } else if (this->unk_850 == 0) { func_80832924(this, D_808551BC); @@ -14634,24 +14634,24 @@ static struct_80832924 D_808551C8[] = { { 0, -0x4860 }, }; -void func_80852048(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852048(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, D_808551C8); } -void func_80852080(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80833064(globalCtx, this, &gPlayerAnim_clink_demo_futtobi, 0x9D); +void func_80852080(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80833064(play, this, &gPlayerAnim_clink_demo_futtobi, 0x9D); func_80832698(this, NA_SE_VO_LI_FALL_L); } -void func_808520BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808520BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { f32 startX = arg2->startPos.x; f32 startY = arg2->startPos.y; f32 startZ = arg2->startPos.z; f32 distX = (arg2->endPos.x - startX); f32 distY = (arg2->endPos.y - startY); f32 distZ = (arg2->endPos.z - startZ); - f32 sp4 = (f32)(globalCtx->csCtx.frames - arg2->startFrame) / (f32)(arg2->endFrame - arg2->startFrame); + f32 sp4 = (f32)(play->csCtx.frames - arg2->startFrame) / (f32)(arg2->endFrame - arg2->startFrame); this->actor.world.pos.x = distX * sp4 + startX; this->actor.world.pos.y = distY * sp4 + startY; @@ -14663,43 +14663,43 @@ static struct_80832924 D_808551D8[] = { { NA_SE_PL_BOUND, -0x101E }, }; -void func_80852174(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_808520BC(globalCtx, this, arg2); - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852174(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_808520BC(play, this, arg2); + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, D_808551D8); } -void func_808521B8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808521B8(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (arg2 != NULL) { - func_808520BC(globalCtx, this, arg2); + func_808520BC(play, this, arg2); } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); } -void func_808521F4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80832B0C(globalCtx, this, D_80853914[PLAYER_ANIMGROUP_44][this->modelAnimType]); +void func_808521F4(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80832B0C(play, this, D_80853914[PLAYER_ANIMGROUP_44][this->modelAnimType]); func_80832210(this); } -void func_80852234(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852234(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); } -void func_8085225C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80832F54(globalCtx, this, 0x98); +void func_8085225C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80832F54(play, this, 0x98); } -void func_80852280(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852280(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.draw = Player_Draw; } -void func_80852298(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083313C(globalCtx, this, &gPlayerAnim_clink_demo_koutai_wait); +void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083313C(play, this, &gPlayerAnim_clink_demo_koutai_wait); this->unk_850 = 1; } else if (this->unk_850 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { - func_80846720(globalCtx, this, 1); + func_80846720(play, this, 1); } } } @@ -14709,8 +14709,8 @@ static struct_80832924 D_808551E0[] = { { 0, -0x3018 }, }; -void func_80852328(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80851F14(globalCtx, this, &gPlayerAnim_link_demo_furimuki2_wait, D_808551E0); +void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80851F14(play, this, &gPlayerAnim_link_demo_furimuki2_wait, D_808551E0); } static struct_80832924 D_808551E8[] = { @@ -14718,25 +14718,25 @@ static struct_80832924 D_808551E8[] = { { 0, -0x4023 }, }; -void func_80852358(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80851F14(globalCtx, this, &gPlayerAnim_link_demo_nozokikomi_wait, D_808551E8); +void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80851F14(play, this, &gPlayerAnim_link_demo_nozokikomi_wait, D_808551E8); } -void func_80852388(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808322A4(globalCtx, this, &gPlayerAnim_demo_link_twait); +void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808322A4(play, this, &gPlayerAnim_demo_link_twait); this->unk_850 = 1; } - if ((this->unk_850 != 0) && (globalCtx->csCtx.frames >= 900)) { + if ((this->unk_850 != 0) && (play->csCtx.frames >= 900)) { this->rightHandType = PLAYER_MODELTYPE_LH_OPEN; } else { this->rightHandType = PLAYER_MODELTYPE_RH_FF; } } -void func_80852414(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { - func_80851294(globalCtx, this, anim); +void func_80852414(PlayState* play, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { + func_80851294(play, this, anim); if (this->unk_850 == 0) { func_80832924(this, arg3); } @@ -14747,64 +14747,64 @@ static struct_80832924 D_808551F0[] = { { 0, -0x3021 }, }; -void func_80852450(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80852414(globalCtx, this, &gPlayerAnim_clink_demo_koutai_wait, D_808551F0); +void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80852414(play, this, &gPlayerAnim_clink_demo_koutai_wait, D_808551F0); } static struct_80832924 D_808551F8[] = { { NA_SE_PL_KNOCK, -0x84E }, }; -void func_80852480(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80852414(globalCtx, this, &gPlayerAnim_link_demo_kakeyori_wait, D_808551F8); +void func_80852480(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80852414(play, this, &gPlayerAnim_link_demo_kakeyori_wait, D_808551F8); } -void func_808524B0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80837704(globalCtx, this); +void func_808524B0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80837704(play, this); } -void func_808524D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808524D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { sControlInput->press.button |= BTN_B; - func_80844E68(this, globalCtx); + func_80844E68(this, play); } -void func_80852514(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80844E68(this, globalCtx); +void func_80852514(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80844E68(this, play); } -void func_80852544(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852544(PlayState* play, Player* this, CsCmdActorAction* arg2) { } -void func_80852554(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852554(PlayState* play, Player* this, CsCmdActorAction* arg2) { } -void func_80852564(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852564(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->stateFlags3 |= PLAYER_STATE3_1; this->linearVelocity = 2.0f; this->actor.velocity.y = -1.0f; - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_back_downA); + func_80832264(play, this, &gPlayerAnim_link_normal_back_downA); func_80832698(this, NA_SE_VO_LI_FALL_L); } -static void (*D_808551FC[])(Player* this, GlobalContext* globalCtx) = { +static void (*D_808551FC[])(Player* this, PlayState* play) = { func_8084377C, func_80843954, func_80843A38, }; -void func_808525C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - D_808551FC[this->unk_850](this, globalCtx); +void func_808525C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + D_808551FC[this->unk_850](this, play); } -void func_80852608(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80846720(globalCtx, this, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_link_demo_return_to_past); +void func_80852608(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80846720(play, this, 0); + func_808322D0(play, this, &gPlayerAnim_link_demo_return_to_past); } -void func_80852648(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852648(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { this->heldItemActionParam = this->itemActionParam = PLAYER_AP_NONE; @@ -14813,7 +14813,7 @@ void func_80852648(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg this->leftHandDLists = D_80125E08; Inventory_ChangeEquipment(EQUIP_SWORD, 2); gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; - Inventory_DeleteEquipment(globalCtx, 0); + Inventory_DeleteEquipment(play, 0); } } @@ -14827,7 +14827,7 @@ static Vec3s D_80855210[2][2] = { { { -200, 500, 0 }, { 600, 400, 600 } }, }; -void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; static Color_RGBA8 envColor = { 0, 128, 128, 0 }; @@ -14836,7 +14836,7 @@ void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg Vec3f sp34; Vec3s* ptr; - func_80851294(globalCtx, this, D_80855208[age]); + func_80851294(play, this, D_80855208[age]); if (this->rightHandType != PLAYER_MODELTYPE_RH_FF) { this->rightHandType = PLAYER_MODELTYPE_RH_FF; @@ -14851,38 +14851,38 @@ void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg SkinMatrix_Vec3fMtxFMultXYZ(&this->shieldMf, &sp34, &sparklePos); - EffectSsKiraKira_SpawnDispersed(globalCtx, &sparklePos, &zeroVec, &zeroVec, &primColor, &envColor, 600, -10); + EffectSsKiraKira_SpawnDispersed(play, &sparklePos, &zeroVec, &zeroVec, &primColor, &envColor, 600, -10); } -void func_8085283C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80852944(globalCtx, this, arg2); +void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80852944(play, this, arg2); } else if (this->unk_850 == 0) { - Item_Give(globalCtx, ITEM_SWORD_MASTER); - func_80846720(globalCtx, this, 0); + Item_Give(play, ITEM_SWORD_MASTER); + func_80846720(play, this, 0); } else { func_8084E988(this); } } -void func_808528C8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_8084285C(this, 0.0f, 99.0f, this->skelAnime.endFrame - 8.0f); } if (this->heldItemActionParam != PLAYER_AP_SWORD_MASTER) { - func_80846720(globalCtx, this, 1); + func_80846720(play, this, 1); } } -void func_80852944(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (func_808332B8(this)) { - func_80838F18(globalCtx, this); - func_80832340(globalCtx, this); + func_80838F18(play, this); + func_80832340(play, this); } else { - func_8083C148(this, globalCtx); - if (!func_8083B644(this, globalCtx)) { - func_8083E5A8(this, globalCtx); + func_8083C148(this, play); + if (!func_8083B644(this, play)) { + func_8083E5A8(this, play); } } @@ -14890,17 +14890,17 @@ void func_80852944(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg this->unk_6AD = 0; } -void func_808529D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.world.pos.x = arg2->startPos.x; this->actor.world.pos.y = arg2->startPos.y; - if ((globalCtx->sceneNum == SCENE_SPOT04) && !LINK_IS_ADULT) { + if ((play->sceneNum == SCENE_SPOT04) && !LINK_IS_ADULT) { this->actor.world.pos.y -= 1.0f; } this->actor.world.pos.z = arg2->startPos.z; this->currentYaw = this->actor.shape.rot.y = arg2->rot.y; } -void func_80852A54(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852A54(PlayState* play, Player* this, CsCmdActorAction* arg2) { f32 dx = arg2->startPos.x - (s32)this->actor.world.pos.x; f32 dy = arg2->startPos.y - (s32)this->actor.world.pos.y; f32 dz = arg2->startPos.z - (s32)this->actor.world.pos.z; @@ -14908,18 +14908,18 @@ void func_80852A54(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg s16 yawDiff = arg2->rot.y - this->actor.shape.rot.y; if ((this->linearVelocity == 0.0f) && ((dist > 50.0f) || (ABS(yawDiff) > 0x4000))) { - func_808529D0(globalCtx, this, arg2); + func_808529D0(play, this, arg2); } this->skelAnime.moveFlags = 0; func_80832DB0(this); } -void func_80852B4C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2, struct_80854B18* arg3) { +void func_80852B4C(PlayState* play, Player* this, CsCmdActorAction* arg2, struct_80854B18* arg3) { if (arg3->type > 0) { - D_80854AA4[arg3->type](globalCtx, this, arg3->ptr); + D_80854AA4[arg3->type](play, this, arg3->ptr); } else if (arg3->type < 0) { - arg3->func(globalCtx, this, arg2); + arg3->func(play, this, arg2); } if ((D_80858AA0 & 4) && !(this->skelAnime.moveFlags & 4)) { @@ -14928,19 +14928,19 @@ void func_80852B4C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80852C0C(GlobalContext* globalCtx, Player* this, s32 csMode) { +void func_80852C0C(PlayState* play, Player* this, s32 csMode) { if ((csMode != 1) && (csMode != 8) && (csMode != 0x31) && (csMode != 7)) { - func_808323B4(globalCtx, this); + func_808323B4(play, this); } } -void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - CsCmdActorAction* linkCsAction = globalCtx->csCtx.linkAction; +void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { + CsCmdActorAction* linkCsAction = play->csCtx.linkAction; s32 pad; s32 sp24; - if (globalCtx->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { - func_8002DF54(globalCtx, NULL, 7); + if (play->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { + func_8002DF54(play, NULL, 7); this->unk_446 = 0; func_80832210(this); return; @@ -14955,9 +14955,9 @@ void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg sp24 = D_808547C4[linkCsAction->action]; if (sp24 >= 0) { if ((sp24 == 3) || (sp24 == 4)) { - func_80852A54(globalCtx, this, linkCsAction); + func_80852A54(play, this, linkCsAction); } else { - func_808529D0(globalCtx, this, linkCsAction); + func_808529D0(play, this, linkCsAction); } } @@ -14965,8 +14965,8 @@ void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg func_80832DBC(this); osSyncPrintf("TOOL MODE=%d\n", sp24); - func_80852C0C(globalCtx, this, ABS(sp24)); - func_80852B4C(globalCtx, this, linkCsAction, &D_80854B18[ABS(sp24)]); + func_80852C0C(play, this, ABS(sp24)); + func_80852B4C(play, this, linkCsAction, &D_80854B18[ABS(sp24)]); this->unk_850 = 0; this->unk_84F = 0; @@ -14974,31 +14974,31 @@ void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } sp24 = D_808547C4[this->unk_446]; - func_80852B4C(globalCtx, this, linkCsAction, &D_80854E50[ABS(sp24)]); + func_80852B4C(play, this, linkCsAction, &D_80854E50[ABS(sp24)]); } -void func_80852E14(Player* this, GlobalContext* globalCtx) { +void func_80852E14(Player* this, PlayState* play) { if (this->csMode != this->prevCsMode) { D_80858AA0 = this->skelAnime.moveFlags; func_80832DBC(this); this->prevCsMode = this->csMode; osSyncPrintf("DEMO MODE=%d\n", this->csMode); - func_80852C0C(globalCtx, this, this->csMode); - func_80852B4C(globalCtx, this, NULL, &D_80854B18[this->csMode]); + func_80852C0C(play, this, this->csMode); + func_80852B4C(play, this, NULL, &D_80854B18[this->csMode]); } - func_80852B4C(globalCtx, this, NULL, &D_80854E50[this->csMode]); + func_80852B4C(play, this, NULL, &D_80854E50[this->csMode]); } -s32 Player_IsDroppingFish(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_IsDroppingFish(PlayState* play) { + Player* this = GET_PLAYER(play); return (func_8084EFC0 == this->func_674) && (this->itemActionParam == PLAYER_AP_BOTTLE_FISH); } -s32 Player_StartFishing(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_StartFishing(PlayState* play) { + Player* this = GET_PLAYER(play); if (gSaveContext.linkAge == 1) { if (!CHECK_OWNED_EQUIP(EQUIP_SWORD, 0)) { @@ -15011,17 +15011,17 @@ s32 Player_StartFishing(GlobalContext* globalCtx) { } } - func_80832564(globalCtx, this); - func_80835F44(globalCtx, this, ITEM_FISHING_POLE); + func_80832564(play, this); + func_80835F44(play, this, ITEM_FISHING_POLE); return 1; } -s32 func_80852F38(GlobalContext* globalCtx, Player* this) { - if (!Player_InBlockingCsMode(globalCtx, this) && (this->invincibilityTimer >= 0) && !func_8008F128(this) && +s32 func_80852F38(PlayState* play, Player* this) { + if (!Player_InBlockingCsMode(play, this) && (this->invincibilityTimer >= 0) && !func_8008F128(this) && !(this->stateFlags3 & PLAYER_STATE3_7)) { - func_80832564(globalCtx, this); - func_80835C58(globalCtx, this, func_8084F308, 0); - func_80832264(globalCtx, this, &gPlayerAnim_link_normal_re_dead_attack); + func_80832564(play, this); + func_80835C58(play, this, func_8084F308, 0); + func_80832264(play, this, &gPlayerAnim_link_normal_re_dead_attack); this->stateFlags2 |= PLAYER_STATE2_7; func_80832224(this); func_80832698(this, NA_SE_VO_LI_HELD); @@ -15032,12 +15032,12 @@ s32 func_80852F38(GlobalContext* globalCtx, Player* this) { } // Sets up player cutscene -s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode) { - Player* this = GET_PLAYER(globalCtx); +s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode) { + Player* this = GET_PLAYER(play); - if (!Player_InBlockingCsMode(globalCtx, this)) { - func_80832564(globalCtx, this); - func_80835C58(globalCtx, this, func_80852E14, 0); + if (!Player_InBlockingCsMode(play, this)) { + func_80832564(play, this); + func_80835C58(play, this, func_80852E14, 0); this->csMode = csMode; this->unk_448 = actor; func_80832224(this); @@ -15047,20 +15047,20 @@ s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode) { return 0; } -void func_80853080(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840BC8, 1); - func_80832B0C(globalCtx, this, func_80833338(this)); +void func_80853080(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840BC8, 1); + func_80832B0C(play, this, func_80833338(this)); this->currentYaw = this->actor.shape.rot.y; } -s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage) { - return Player_InflictDamageModified(globalCtx, damage, true); +s32 Player_InflictDamage(PlayState* play, s32 damage) { + return Player_InflictDamageModified(play, damage, true); } -s32 Player_InflictDamageModified(GlobalContext* globalCtx, s32 damage, u8 modified) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified) { + Player* this = GET_PLAYER(play); - if (!Player_InBlockingCsMode(globalCtx, this) && !func_80837B18_modified(globalCtx, this, damage, modified)) { + if (!Player_InBlockingCsMode(play, this) && !func_80837B18_modified(play, this, damage, modified)) { this->stateFlags2 &= ~PLAYER_STATE2_7; return 1; } @@ -15069,8 +15069,8 @@ s32 Player_InflictDamageModified(GlobalContext* globalCtx, s32 damage, u8 modifi } // Start talking with the given actor -void func_80853148(GlobalContext* globalCtx, Actor* actor) { - Player* this = GET_PLAYER(globalCtx); +void func_80853148(PlayState* play, Actor* actor) { + Player* this = GET_PLAYER(play); s32 pad; if ((this->targetActor != NULL) || (actor == this->naviActor) || @@ -15082,9 +15082,9 @@ void func_80853148(GlobalContext* globalCtx, Actor* actor) { this->exchangeItemId = EXCH_ITEM_NONE; if (actor->textId == 0xFFFF) { - func_8002DF54(globalCtx, actor, 1); + func_8002DF54(play, actor, 1); actor->flags |= ACTOR_FLAG_8; - func_80832528(globalCtx, this); + func_80832528(play, this); } else { if (this->actor.flags & ACTOR_FLAG_8) { this->actor.textId = 0; @@ -15096,33 +15096,33 @@ void func_80853148(GlobalContext* globalCtx, Actor* actor) { if (this->stateFlags1 & PLAYER_STATE1_23) { s32 sp24 = this->unk_850; - func_80832528(globalCtx, this); - func_8083A2F8(globalCtx, this); + func_80832528(play, this); + func_8083A2F8(play, this); this->unk_850 = sp24; } else { if (func_808332B8(this)) { - func_80836898(globalCtx, this, func_8083A2F8); - func_80832C6C(globalCtx, this, &gPlayerAnim_link_swimer_swim_wait); + func_80836898(play, this, func_8083A2F8); + func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait); } else if ((actor->category != ACTORCAT_NPC) || (this->heldItemActionParam == PLAYER_AP_FISHING_POLE)) { - func_8083A2F8(globalCtx, this); + func_8083A2F8(play, this); if (!func_8008E9C4(this)) { if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) { - func_808322D0(globalCtx, this, &gPlayerAnim_link_normal_backspace); + func_808322D0(play, this, &gPlayerAnim_link_normal_backspace); } else { - func_80832284(globalCtx, this, func_80833338(this)); + func_80832284(play, this, func_80833338(this)); } } } else { - func_80836898(globalCtx, this, func_8083A2F8); - func_808322D0(globalCtx, this, + func_80836898(play, this, func_8083A2F8); + func_808322D0(play, this, (actor->xzDistToPlayer < 40.0f) ? &gPlayerAnim_link_normal_backspace : &gPlayerAnim_link_normal_talk_free); } if (this->skelAnime.animation == &gPlayerAnim_link_normal_backspace) { - func_80832F54(globalCtx, this, 0x19); + func_80832F54(play, this, 0x19); } func_80832224(this); @@ -15133,6 +15133,6 @@ void func_80853148(GlobalContext* globalCtx, Actor* actor) { if ((this->naviActor == this->targetActor) && ((this->targetActor->textId & 0xFF00) != 0x200)) { this->naviActor->flags |= ACTOR_FLAG_8; - func_80835EA4(globalCtx, 0xB); + func_80835EA4(play, 0xB); } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/soh/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c index 3c1c6a685..48192fbe4 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c @@ -20,16 +20,16 @@ #define rScaleStep regs[10] #define rScaleStepDecay regs[11] -u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBlast_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Blast_InitVars = { EFFECT_SS_BLAST, EffectSsBlast_Init, }; -u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBlastParams* initParams = (EffectSsBlastParams*)initParamsx; this->pos = initParams->pos; @@ -55,8 +55,8 @@ u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mf; s32 pad; f32 radius; @@ -65,9 +65,9 @@ void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { radius = this->rScale * 0.0025f; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA); - func_800BFCB8(globalCtx, &mf, &this->pos); + func_800BFCB8(play, &mf, &this->pos); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); Matrix_Put(&mf); Matrix_Scale(radius, radius, radius, MTXMODE_APPLY); @@ -78,7 +78,7 @@ void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsBlast_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this) { Math_StepToS(&this->rPrimColorA, 0, this->rAlphaTarget); this->rScale += this->rScaleStep; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c index a3c764d83..5651ffdc3 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c @@ -10,16 +10,16 @@ #define rScale regs[0] #define rTexIdx regs[1] -u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBomb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBomb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsBomb_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Bomb_InitVars = { EFFECT_SS_BOMB, EffectSsBomb_Init, }; -u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBomb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBombInitParams* initParams = (EffectSsBombInitParams*)initParamsx; Math_Vec3f_Copy(&this->pos, &initParams->pos); @@ -35,14 +35,14 @@ u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* return 1; } -void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) { static void* explosionTextures[] = { gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -58,7 +58,7 @@ void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -80,7 +80,7 @@ void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsBomb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb_Update(PlayState* play, u32 index, EffectSs* this) { if ((this->life < 21) && (this->life > 16)) { this->rTexIdx = (20 - this->life); } else { diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index 34bd3446b..6e0c17e60 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -20,10 +20,10 @@ #define rScaleStep regs[9] #define rDepth regs[10] -u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this); +void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this); +void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Bomb2_InitVars = { EFFECT_SS_BOMB2, @@ -35,7 +35,7 @@ static EffectSsDrawFunc sDrawFuncs[] = { EffectSsBomb2_DrawLayered, }; -u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBomb2InitParams* initParams = (EffectSsBomb2InitParams*)initParamsx; @@ -61,12 +61,12 @@ u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void } // unused in the original game. looks like EffectSsBomb but with color -void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this) { static void* textures[] = { gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex, gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -80,7 +80,7 @@ void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) scale = this->rScale * 0.01f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -98,12 +98,12 @@ void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) { static void* textures[] = { gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex, gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -123,7 +123,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th scale = this->rScale * 0.01f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -150,7 +150,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th Matrix_Translate(0.0f, 0.0f, depth, MTXMODE_APPLY); Matrix_RotateZ((this->life * 0.02f) + 180.0f, MTXMODE_APPLY); Matrix_Scale(layer2Scale, layer2Scale, layer2Scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL); layer2Scale -= 0.15f; @@ -162,7 +162,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th CLOSE_DISPS(gfxCtx); } -void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this) { s32 divisor; this->rTexIdx = (23 - this->life) / 3; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/soh/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index aeb67483e..f96d60cf4 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -9,16 +9,16 @@ #define rScale regs[0] -u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Bubble_InitVars = { EFFECT_SS_BUBBLE, EffectSsBubble_Init, }; -u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBubbleInitParams* initParams = (EffectSsBubbleInitParams*)initParamsx; //! @bug Rand_ZeroOne in the macro means a random number is generated for both parts of the macro. @@ -37,8 +37,8 @@ u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale = this->rScale / 100.0f; OPEN_DISPS(gfxCtx); @@ -56,7 +56,7 @@ void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this) { WaterBox* waterBox; f32 waterSurfaceY; Vec3f ripplePos; @@ -64,7 +64,7 @@ void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) waterSurfaceY = this->pos.y; // kill bubble if it's out of range of a water box - if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->pos.x, this->pos.z, &waterSurfaceY, &waterBox)) { + if (!WaterBox_GetSurface1(play, &play->colCtx, this->pos.x, this->pos.z, &waterSurfaceY, &waterBox)) { this->life = -1; return; } @@ -73,7 +73,7 @@ void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) ripplePos.x = this->pos.x; ripplePos.y = waterSurfaceY; ripplePos.z = this->pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 0, 80, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 0, 80, 0); this->life = -1; } else { this->life++; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/soh/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 120bae418..ef73f691e 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -18,18 +18,18 @@ #define rObjBankIdx regs[10] #define rYAccelStep regs[11] // has no effect due to how it's implemented -u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_D_Fire_InitVars = { EFFECT_SS_D_FIRE, EffectSsDFire_Init, }; -u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDFireInitParams* initParams = (EffectSsDFireInitParams*)initParamsx; - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_DODONGO); + s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DODONGO); if (objBankIndex >= 0) { this->pos = initParams->pos; @@ -43,7 +43,7 @@ u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void this->rObjBankIdx = objBankIndex; this->draw = EffectSsDFire_Draw; this->update = EffectSsDFire_Update; - this->rTexIdx = ((s16)(globalCtx->state.frames % 4) ^ 3); + this->rTexIdx = ((s16)(play->state.frames % 4) ^ 3); this->rPrimColorR = 255; this->rPrimColorG = 255; this->rPrimColorB = 50; @@ -58,8 +58,8 @@ u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void static void* sTextures[] = { gDodongoFire0Tex, gDodongoFire1Tex, gDodongoFire2Tex, gDodongoFire3Tex }; -void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -69,17 +69,17 @@ void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Mtx* mtx; f32 scale; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; OPEN_DISPS(gfxCtx); - if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_DODONGO) > -1) { + if (Object_GetIndex(&play->objectCtx, OBJECT_DODONGO) > -1) { gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); scale = this->rScale / 100.0f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -99,7 +99,7 @@ void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsDFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this) { this->rTexIdx++; this->rTexIdx &= 3; this->rScale += this->rScaleStep; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c index b80c2139a..c3bdb77d4 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c @@ -20,16 +20,16 @@ #define rPlaySound regs[10] #define rReg11 regs[11] -u32 EffectSsDeadDb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Db_InitVars = { EFFECT_SS_DEAD_DB, EffectSsDeadDb_Init, }; -u32 EffectSsDeadDb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDeadDbInitParams* initParams = (EffectSsDeadDbInitParams*)initParamsx; this->pos = initParams->pos; @@ -62,8 +62,8 @@ static void* sTextures[] = { gEffEnemyDeathFlame9Tex, gEffEnemyDeathFlame10Tex, }; -void EffectSsDeadDb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -93,7 +93,7 @@ void EffectSsDeadDb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsDeadDb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this) { f32 w; f32 pad; @@ -131,7 +131,7 @@ void EffectSsDeadDb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) } if (this->rPlaySound && (this->rTextIdx == 1)) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->pos, &this->vec, &w); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->pos, &this->vec, &w); Audio_PlaySoundGeneral(NA_SE_EN_EXTINCT, &this->vec, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index f9c8eff71..60accff06 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -19,16 +19,16 @@ #define rAlphaStep regs[10] #define rAlphaMode regs[11] // if mode is 0 alpha decreases over time, otherwise it increases -u32 EffectSsDeadDd_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDd_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDd_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Dd_InitVars = { EFFECT_SS_DEAD_DD, EffectSsDeadDd_Init, }; -u32 EffectSsDeadDd_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 i; EffectSsDeadDdInitParams* initParams = (EffectSsDeadDdInitParams*)initParamsx; @@ -89,8 +89,8 @@ u32 EffectSsDeadDd_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsDeadDd_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -120,7 +120,7 @@ void EffectSsDeadDd_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsDeadDd_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this) { this->rScale += this->rScaleStep; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index 862bc4a28..3f20ec7ad 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -17,16 +17,16 @@ #define rAlphaStep regs[10] #define rHalfOfLife regs[11] -u32 EffectSsDeadDs_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDs_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Ds_InitVars = { EFFECT_SS_DEAD_DS, EffectSsDeadDs_Init, }; -u32 EffectSsDeadDs_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDeadDsInitParams* initParams = (EffectSsDeadDsInitParams*)initParamsx; this->pos = initParams->pos; @@ -45,7 +45,7 @@ u32 EffectSsDeadDs_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale; s32 pad1; @@ -55,10 +55,10 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Vec3f pos; CollisionPoly* floorPoly; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); scale = this->rScale * 0.01f; - func_80094BC4(globalCtx->state.gfxCtx); + func_80094BC4(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, this->rAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); pos = this->pos; @@ -71,12 +71,12 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { sp44.y = pos.y - this->velocity.y; sp44.z = pos.z - this->velocity.z; - if (BgCheck_EntitySphVsWall1(&globalCtx->colCtx, &this->pos, &pos, &sp44, 1.5f, &floorPoly, 1.0f)) { + if (BgCheck_EntitySphVsWall1(&play->colCtx, &this->pos, &pos, &sp44, 1.5f, &floorPoly, 1.0f)) { func_80038A28(floorPoly, this->pos.x, this->pos.y, this->pos.z, &mf); Matrix_Put(&mf); } else { pos.y++; - temp = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &floorPoly, &pos); + temp = BgCheck_EntityRaycastFloor1(&play->colCtx, &floorPoly, &pos); if (floorPoly != NULL) { func_80038A28(floorPoly, this->pos.x, temp + 1.5f, this->pos.z, &mf); @@ -99,16 +99,16 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_RotateZYX(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY); Matrix_RotateX(1.57f, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gSPDisplayList(POLY_XLU_DISP++, gLensFlareCircleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EffectSsDeadDs_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this) { if (this->life < this->rHalfOfLife) { this->rScale += this->rScaleStep; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c index b15f991a2..b58f22fdf 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c @@ -9,15 +9,15 @@ #define rSfxId regs[10] #define rRepeatMode regs[11] // sound is replayed every update. unused in the original game -u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadSound_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadSound_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadSound_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Sound_InitVars = { EFFECT_SS_DEAD_SOUND, EffectSsDeadSound_Init, }; -u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadSound_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDeadSoundInitParams* initParams = (EffectSsDeadSoundInitParams*)initParamsx; this->pos = initParams->pos; @@ -34,7 +34,7 @@ u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, return 1; } -void EffectSsDeadSound_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadSound_Update(PlayState* play, u32 index, EffectSs* this) { switch (this->rRepeatMode) { case DEADSOUND_REPEAT_MODE_OFF: this->rRepeatMode--; // decrement to 0 so sound only plays once diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c b/soh/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c index d2baa9881..761d3d554 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c @@ -19,9 +19,9 @@ #define rScale regs[9] #define rLifespan regs[10] -u32 EffectSsDtBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDtBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDtBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this); static Color_RGBA8 sPrimColors[] = { { 255, 255, 100, 255 }, { 150, 255, 255, 255 }, { 100, 255, 255, 255 } }; static Color_RGBA8 sEnvColors[] = { { 170, 0, 0, 255 }, { 0, 100, 0, 255 }, { 0, 0, 255, 255 } }; @@ -31,7 +31,7 @@ EffectSsInit Effect_Ss_Dt_Bubble_InitVars = { EffectSsDtBubble_Init, }; -u32 EffectSsDtBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDtBubbleInitParams* initParams = (EffectSsDtBubbleInitParams*)initParamsx; //! @bug Rand_ZeroOne in the macro means a random number is generated for both parts of the macro. @@ -72,8 +72,8 @@ u32 EffectSsDtBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsDtBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale; OPEN_DISPS(gfxCtx); @@ -94,7 +94,7 @@ void EffectSsDtBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void EffectSsDtBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this) { f32 rand; if (this->rRandXZ == 1) { diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/soh/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index 4189a1f01..2c1c299b3 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -21,10 +21,10 @@ #define rDrawFlags regs[11] #define rLifespan regs[12] -u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBlast_UpdateFire(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsBlast_UpdateFire(PlayState* play, u32 index, EffectSs* this); +void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dust_InitVars = { EFFECT_SS_DUST, @@ -36,7 +36,7 @@ static EffectSsUpdateFunc sUpdateFuncs[] = { EffectSsBlast_UpdateFire, }; -u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 randColorOffset; EffectSsDustInitParams* initParams = (EffectSsDustInitParams*)initParamsx; @@ -76,11 +76,11 @@ u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* return 1; } -void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) { static void* dustTextures[] = { gDust1Tex, gDust2Tex, gDust3Tex, gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -94,7 +94,7 @@ void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { scale = this->rScale * 0.0025f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -128,7 +128,7 @@ void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; @@ -146,7 +146,7 @@ void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { } // this update mode is unused in the original game -void EffectSsBlast_UpdateFire(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBlast_UpdateFire(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/soh/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index e17e85ed3..ad884cc35 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -18,16 +18,16 @@ #define rFlags regs[8] #define rScroll regs[9] -u32 EffectSsEnFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_En_Fire_InitVars = { EFFECT_SS_EN_FIRE, EffectSsEnFire_Init, }; -u32 EffectSsEnFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsEnFireInitParams* initParams = (EffectSsEnFireInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -63,8 +63,8 @@ u32 EffectSsEnFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale; s16 camYaw; s32 pad[3]; @@ -73,12 +73,12 @@ void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000); + camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000); Matrix_RotateY(camYaw * (M_PI / 0x8000), MTXMODE_APPLY); scale = Math_SinS(this->life * 0x333) * (this->rScale * 0.00005f); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); redGreen = this->life - 5; @@ -87,11 +87,11 @@ void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { redGreen = 0; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, redGreen * 12.7f, 0, 0, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0x0, 0x80, redGreen * 12.7f, redGreen * 12.7f, 0, 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->rScroll * -0x14) & 0x1FF, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->rScroll * -0x14) & 0x1FF, 0x20, 0x80)); if (((this->rFlags & 0x7FFF) != 0) || (this->life < 18)) { @@ -113,7 +113,7 @@ typedef struct { /* 0x14C */ Vec3s firePos[10]; } FireActorS; -void EffectSsEnFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this) { this->rScroll++; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/soh/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index 4ec1950d0..28033ee1d 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -21,17 +21,17 @@ #define rAlphaMode regs[11] #define rScale regs[12] -u32 EffectSsEnIce_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnIce_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnIce_UpdateFlying(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_En_Ice_InitVars = { EFFECT_SS_EN_ICE, EffectSsEnIce_Init, }; -u32 EffectSsEnIce_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsEnIceInitParams* initParams = (EffectSsEnIceInitParams*)initParamsx; if (initParams->type == 0) { @@ -85,8 +85,8 @@ u32 EffectSsEnIce_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; Vec3f hiliteLightDir; @@ -94,7 +94,7 @@ void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { f32 alpha; scale = this->rScale * 0.01f; - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; OPEN_DISPS(gfxCtx); @@ -120,10 +120,10 @@ void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { hiliteLightDir.y = 0.0f; hiliteLightDir.z = 89.8f; - func_80093D84(globalCtx->state.gfxCtx); - func_8002EB44(&this->pos, &globalCtx->view.eye, &hiliteLightDir, globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + func_8002EB44(&this->pos, &play->view.eye, &hiliteLightDir, play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0, (gameplayFrames * 2) & 0xFF, 0x40, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); @@ -133,7 +133,7 @@ void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsEnIce_UpdateFlying(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { s16 rand; if ((this->actor != NULL) && (this->actor->update != NULL)) { @@ -160,6 +160,6 @@ void EffectSsEnIce_UpdateFlying(GlobalContext* globalCtx, u32 index, EffectSs* t } } -void EffectSsEnIce_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this) { this->rPitch += this->rRotSpeed; // rRotSpeed is not initialized so this does nothing } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index 5dc8fc1db..d45ecf941 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -12,9 +12,9 @@ #define rScoreIdx regs[2] #define rScale regs[3] -u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this); static s16 sScores[] = { 30, 60, 100 }; @@ -23,17 +23,17 @@ EffectSsInit Effect_Ss_Extra_InitVars = { EffectSsExtra_Init, }; -u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsExtraInitParams* initParams = (EffectSsExtraInitParams*)initParamsx; s32 pad; s32 objBankIndex; u32 oldSeg6; - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_YABUSAME_POINT); + objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_YABUSAME_POINT); - if ((objBankIndex >= 0) && Object_IsLoaded(&globalCtx->objectCtx, objBankIndex)) { + if ((objBankIndex >= 0) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); this->pos = initParams->pos; this->velocity = initParams->velocity; this->accel = initParams->accel; @@ -58,28 +58,28 @@ static void* sTextures[] = { object_yabusame_point_Tex_000900, }; -void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale = this->rScale / 100.0f; - void* object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + void* object = play->objectCtx.status[this->rObjBankIdx].segment; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rScoreIdx])); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_yabusame_point_DL_000DC0)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + 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 -= 1; } else { @@ -87,6 +87,6 @@ void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { } if (this->rTimer == 1) { - globalCtx->interfaceCtx.unk_23C = sScores[this->rScoreIdx]; + play->interfaceCtx.unk_23C = sScores[this->rScoreIdx]; } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c b/soh/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c index b11635657..f6de3db27 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c @@ -13,16 +13,16 @@ #define rYaw regs[10] #define rScale regs[11] -u32 EffectSsFcircle_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFcircle_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsFcircle_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFcircle_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsFcircle_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Fcircle_InitVars = { EFFECT_SS_FCIRCLE, EffectSsFcircle_Init, }; -u32 EffectSsFcircle_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsFcircle_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsFcircleInitParams* initParams = (EffectSsFcircleInitParams*)initParamsx; this->pos = initParams->pos; @@ -42,8 +42,8 @@ u32 EffectSsFcircle_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFcircle_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 yScale; f32 xzScale; @@ -60,10 +60,10 @@ void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_RotateY(this->rYaw * (M_PI / 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 0, 32, 64, 1, 0, - ((globalCtx->gameplayFrames) * -0xF) % 256, 32, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 0, 32, 64, 1, 0, + ((play->gameplayFrames) * -0xF) % 256, 32, 64)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 220, 0, (this->life * 12.75f)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPDisplayList(POLY_XLU_DISP++, this->gfx); @@ -71,7 +71,7 @@ void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsFcircle_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFcircle_Update(PlayState* play, u32 index, EffectSs* this) { Actor* actor = this->actor; if (actor != NULL) { diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/soh/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 39751fc5f..47bf032e4 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -14,11 +14,11 @@ #define rParam regs[4] #define rScale regs[8] -u32 EffectSsFhgFlash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFhgFlash_UpdateLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFhgFlash_UpdateShock(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this); +void EffectSsFhgFlash_UpdateLightBall(PlayState* play, u32 index, EffectSs* this); +void EffectSsFhgFlash_DrawShock(PlayState* play, u32 index, EffectSs* this); +void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { EFFECT_SS_FHG_FLASH, @@ -28,7 +28,7 @@ EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { static UNK_TYPE D_809A5178[258]; static Gfx D_809A5100[15]; -u32 EffectSsFhgFlash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsFhgFlashInitParams* initParams = (EffectSsFhgFlashInitParams*)initParamsx; s32 pad; s32 objBankIdx; @@ -37,11 +37,11 @@ u32 EffectSsFhgFlash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v void* oldSeg6; if (initParams->type == FHGFLASH_LIGHTBALL) { - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FHG); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FHG); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIdx].segment); this->rObjBankIdx = objBankIdx; this->pos = initParams->pos; this->velocity = initParams->velocity; @@ -84,14 +84,14 @@ static Color_RGB8 sColors[] = { { 255, 0, 255 }, { 255, 150, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, }; -void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; void* object; scale = this->rScale / 100.0f; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; OPEN_DISPS(gfxCtx); @@ -99,11 +99,11 @@ void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectS Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); gDPSetEnvColor(POLY_XLU_DISP++, sColors[this->rParam].r, sColors[this->rParam].g, sColors[this->rParam].b, 0); gDPPipeSync(POLY_XLU_DISP++); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((this->rXZRot / 32768.0f) * 3.1416f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -112,8 +112,8 @@ void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectS CLOSE_DISPS(gfxCtx); } -void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFhgFlash_DrawShock(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; @@ -125,12 +125,12 @@ void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* t Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); if (this->rParam != FHGFLASH_SHOCK_NO_ACTOR) { - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); Matrix_RotateX((this->rXZRot / 32768.0f) * 1.1416f, MTXMODE_APPLY); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2); } else { - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); } @@ -145,7 +145,7 @@ void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* t CLOSE_DISPS(gfxCtx); } -void EffectSsFhgFlash_UpdateLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFhgFlash_UpdateLightBall(PlayState* play, u32 index, EffectSs* this) { s16 rand = (Rand_ZeroOne() * 20000.0f); this->rXZRot = (this->rXZRot + rand) + 0x4000; @@ -168,7 +168,7 @@ void EffectSsFhgFlash_UpdateLightBall(GlobalContext* globalCtx, u32 index, Effec } } -void EffectSsFhgFlash_UpdateShock(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this) { s16 randBodypart; Player* player; BossGanondrof* phantomGanon; @@ -178,7 +178,7 @@ void EffectSsFhgFlash_UpdateShock(GlobalContext* globalCtx, u32 index, EffectSs* this->rXZRot = (this->rXZRot + rand) + 0x4000; if (this->rParam == FHGFLASH_SHOCK_PLAYER) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); randBodypart = Rand_ZeroFloat(17.9f); this->pos.x = player->bodyPartsPos[randBodypart].x + Rand_CenteredFloat(10.0f); this->pos.y = player->bodyPartsPos[randBodypart].y + Rand_CenteredFloat(15.0f); diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/soh/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index e21086ec4..89e154aad 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -21,16 +21,16 @@ #define rBodyPart regs[11] #define rType regs[12] -u32 EffectSsFireTail_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFireTail_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Fire_Tail_InitVars = { EFFECT_SS_FIRE_TAIL, EffectSsFireTail_Init, }; -u32 EffectSsFireTail_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsFireTailInitParams* initParams = (EffectSsFireTailInitParams*)initParamsx; this->pos = initParams->pos; @@ -65,8 +65,8 @@ u32 EffectSsFireTail_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; s16 yaw; Vec3f scale; @@ -86,14 +86,14 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Translate(this->pos.x + this->actor->world.pos.x, this->pos.y + this->actor->world.pos.y, this->pos.z + this->actor->world.pos.z, MTXMODE_NEW); } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 bodyPart = this->rBodyPart; this->pos.x = - player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * 5.0f); + player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); this->pos.y = player->bodyPartsPos[bodyPart].y; this->pos.z = - player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * 5.0f); + player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); } @@ -101,11 +101,11 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); } - yaw = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + yaw = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); temp1 = fabsf(Math_CosS(yaw)); temp2 = Math_SinS(yaw); dist = Math_Vec3f_DistXZ(&scale, &this->vec) / (this->rReg10 * 0.1f); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(temp2 * this->rReg2 * dist * (M_PI / 180.0f), MTXMODE_APPLY); temp2 = 1.0f - ((f32)(this->life + 1) / this->rLifespan); temp2 = 1.0f - SQ(temp2); @@ -119,14 +119,14 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Scale(1.0f, temp1, 1.0f / temp1, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255); gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (globalCtx->state.frames * -0x14) & 0x1FF, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + (play->state.frames * -0x14) & 0x1FF, 32, 128)); if (this->rType != 0) { gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL); @@ -137,6 +137,6 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void EffectSsFireTail_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this) { this->rScale *= 0.9f; } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c b/soh/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c index e910da2b1..f094b5405 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c @@ -7,16 +7,16 @@ #include "z_eff_ss_g_fire.h" #include "objects/gameplay_keep/gameplay_keep.h" -u32 EffectSsGFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Fire_InitVars = { EFFECT_SS_G_FIRE, EffectSsGFire_Init, }; -u32 EffectSsGFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGFireInitParams* initParams = (EffectSsGFireInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -42,16 +42,16 @@ u32 EffectSsGFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsGFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this) { void* fireFootprintTextures[] = { gEffFireFootprint1Tex, gEffFireFootprint2Tex, gEffFireFootprint3Tex, gEffFireFootprint4Tex, gEffFireFootprint5Tex, gEffFireFootprint6Tex, gEffFireFootprint7Tex, gEffFireFootprint8Tex, }; s16 texIdx = (this->rgTexIdx / 100) % 7; - EffectSs_DrawGEffect(globalCtx, this, fireFootprintTextures[texIdx]); + EffectSs_DrawGEffect(play, this, fireFootprintTextures[texIdx]); } -void EffectSsGFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this) { this->rgTexIdx += this->rgTexIdxStep; } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c b/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c index 6392fd3fc..f7459fc24 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c @@ -7,16 +7,16 @@ #include "z_eff_ss_g_magma.h" #include "objects/gameplay_keep/gameplay_keep.h" -u32 EffectSsGMagma_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGMagma_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGMagma_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGMagma_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGMagma_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGMagma_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Magma_InitVars = { EFFECT_SS_G_MAGMA, EffectSsGMagma_Init, }; -u32 EffectSsGMagma_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGMagma_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGMagmaInitParams* initParams = (EffectSsGMagmaInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -46,16 +46,16 @@ static void* sTextures[] = { gEffMagmaBubble5Tex, gEffMagmaBubble6Tex, gEffMagmaBubble7Tex, gEffMagmaBubble8Tex, }; -void EffectSsGMagma_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGMagma_Draw(PlayState* play, u32 index, EffectSs* this) { s16 texIdx = this->rgTexIdx / 100; if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, sTextures[texIdx]); + EffectSs_DrawGEffect(play, this, sTextures[texIdx]); } -void EffectSsGMagma_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGMagma_Update(PlayState* play, u32 index, EffectSs* this) { this->rgTexIdx += this->rgTexIdxStep; } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c b/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c index 7d29067fe..3ea4a4a58 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c @@ -20,9 +20,9 @@ #define rObjBankIdx regs[10] #define rScale regs[11] -u32 EffectSsGMagma2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGMagma2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGMagma2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGMagma2_Update(PlayState* play, u32 index, EffectSs* this); static void* sTextures[] = { object_kingdodongo_Tex_02E4E0, object_kingdodongo_Tex_02E8E0, object_kingdodongo_Tex_02ECE0, @@ -37,15 +37,15 @@ EffectSsInit Effect_Ss_G_Magma2_InitVars = { EffectSsGMagma2_Init, }; -u32 EffectSsGMagma2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_KINGDODONGO); +u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO); s32 pad; - if ((objBankIndex >= 0) && Object_IsLoaded(&globalCtx->objectCtx, objBankIndex)) { + if ((objBankIndex >= 0) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EffectSsGMagma2InitParams* initParams = (EffectSsGMagma2InitParams*)initParamsx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); this->rObjBankIdx = objBankIndex; this->pos = initParams->pos; this->velocity = zeroVec; @@ -71,14 +71,14 @@ u32 EffectSsGMagma2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 0; } -void EffectSsGMagma2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; void* object; scale = this->rScale / 100.0f; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; OPEN_DISPS(gfxCtx); @@ -103,7 +103,7 @@ void EffectSsGMagma2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsGMagma2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGMagma2_Update(PlayState* play, u32 index, EffectSs* this) { this->rTimer += this->rUpdateRate; if (this->rTimer >= 10) { diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/soh/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index 311998111..7f49a298b 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -20,16 +20,16 @@ #define rEnvColorA regs[10] #define rLifespan regs[11] -u32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGRipple_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGRipple_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Ripple_InitVars = { EFFECT_SS_G_RIPPLE, EffectSsGRipple_Init, }; -u32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 pad; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; WaterBox* waterBox; @@ -54,13 +54,13 @@ u32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo this->rEnvColorG = 255; this->rEnvColorB = 255; this->rEnvColorA = 255; - this->rWaterBoxNum = WaterBox_GetSurface2(globalCtx, &globalCtx->colCtx, &initParams->pos, 3.0f, &waterBox); + this->rWaterBoxNum = WaterBox_GetSurface2(play, &play->colCtx, &initParams->pos, 3.0f, &waterBox); return 1; } -void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, void* segment) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsGRipple_DrawRipple(PlayState* play, EffectSs* this, void* segment) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 radius; s32 pad; MtxF mfTrans; @@ -71,12 +71,12 @@ void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, void* OPEN_DISPS(gfxCtx); - if (globalCtx) {} + if (play) {} radius = this->rRadius * 0.0025f; - if ((this->rWaterBoxNum != -1) && (this->rWaterBoxNum < globalCtx->colCtx.colHeader->numWaterBoxes)) { - yPos = (this->rWaterBoxNum + globalCtx->colCtx.colHeader->waterBoxes)->ySurface; + if ((this->rWaterBoxNum != -1) && (this->rWaterBoxNum < play->colCtx.colHeader->numWaterBoxes)) { + yPos = (this->rWaterBoxNum + play->colCtx.colHeader->waterBoxes)->ySurface; } else { yPos = this->pos.y; } @@ -101,13 +101,13 @@ void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, void* CLOSE_DISPS(gfxCtx); } -void EffectSsGRipple_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this) { if (this->rLifespan == 0) { - EffectSsGRipple_DrawRipple(globalCtx, this, gEffWaterRippleTex); + EffectSsGRipple_DrawRipple(play, this, gEffWaterRippleTex); } } -void EffectSsGRipple_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this) { f32 radius; f32 primAlpha; f32 envAlpha; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/soh/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c index 6fb930a2f..fbd7fcef5 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c @@ -19,17 +19,17 @@ #define rScale regs[9] #define rScaleStep regs[10] -u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSpk_UpdateNoAccel(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Spk_InitVars = { EFFECT_SS_G_SPK, EffectSsGSpk_Init, }; -u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGSpkInitParams* initParams = (EffectSsGSpkInitParams*)initParamsx; Math_Vec3f_Copy(&this->pos, &initParams->pos); @@ -65,14 +65,14 @@ u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* return 1; } -void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this) { static void* sparkTextures[] = { gEffSpark1Tex, gEffSpark2Tex, gEffSpark3Tex, gEffSpark4Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -86,7 +86,7 @@ void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { scale = this->rScale * 0.0025f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -103,7 +103,7 @@ void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() - 0.5f) * 3.0f; this->accel.z = (Rand_ZeroOne() - 0.5f) * 3.0f; @@ -126,7 +126,7 @@ void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { // this update mode is unused in the original game // with this update mode, the sparks dont move randomly in the xz plane, appearing to be on top of each other -void EffectSsGSpk_UpdateNoAccel(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this) { if (this->actor != NULL) { if ((this->actor->category == ACTORCAT_EXPLOSIVE) && (this->actor->update != NULL)) { this->pos.x += (Math_SinS(this->actor->world.rot.y) * this->actor->speedXZ); diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c b/soh/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c index cb2fd316c..d855ebb07 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c @@ -11,16 +11,16 @@ // this ends up having no effect because the texture provided does not use segment 6 #define rType regs[11] -u32 EffectSsGSplash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParams); -void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSplash_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParams); +void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Splash_InitVars = { EFFECT_SS_G_SPLASH, EffectSsGSplash_Init, }; -u32 EffectSsGSplash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGSplashInitParams* initParams = (EffectSsGSplashInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -89,7 +89,7 @@ u32 EffectSsGSplash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this) { static void* waterSplashTextures[] = { gEffWaterSplash1Tex, gEffWaterSplash2Tex, gEffWaterSplash3Tex, gEffWaterSplash4Tex, gEffWaterSplash5Tex, gEffWaterSplash6Tex, gEffWaterSplash7Tex, gEffWaterSplash8Tex, @@ -102,7 +102,7 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, waterSplashTextures[texIdx]); + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIdx]); break; case 1: @@ -110,7 +110,7 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, waterSplashTextures[texIdx]); + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIdx]); break; case 2: @@ -118,7 +118,7 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, waterSplashTextures[texIdx]); + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIdx]); break; default: @@ -126,13 +126,13 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { } } -void EffectSsGSplash_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this) { Vec3f newSplashPos; if ((this->rType == 1) && (this->life == 5)) { newSplashPos = this->pos; newSplashPos.y += ((this->rgScale * 20) * 0.002f); - EffectSsGSplash_Spawn(globalCtx, &newSplashPos, 0, 0, 2, this->rgScale / 2); + EffectSsGSplash_Spawn(play, &newSplashPos, 0, 0, 2, this->rgScale / 2); } this->rgTexIdx += this->rgTexIdxStep; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c b/soh/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c index eff9b9957..e63caae43 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c @@ -15,25 +15,25 @@ #define rObjBankIdx regs[5] #define rMinLife regs[6] -u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHahen_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsHahen_DrawGray(PlayState* play, u32 index, EffectSs* this); +void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Hahen_InitVars = { EFFECT_SS_HAHEN, EffectSsHahen_Init, }; -void EffectSsHahen_CheckForObject(EffectSs* this, GlobalContext* globalCtx) { - if (((this->rObjBankIdx = Object_GetIndex(&globalCtx->objectCtx, this->rObjId)) < 0) || - !Object_IsLoaded(&globalCtx->objectCtx, this->rObjBankIdx)) { +void EffectSsHahen_CheckForObject(EffectSs* this, PlayState* play) { + if (((this->rObjBankIdx = Object_GetIndex(&play->objectCtx, this->rObjId)) < 0) || + !Object_IsLoaded(&play->objectCtx, this->rObjBankIdx)) { this->life = -1; this->draw = NULL; } } -u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsHahenInitParams* initParams = (EffectSsHahenInitParams*)initParamsx; this->pos = initParams->pos; @@ -44,7 +44,7 @@ u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void if (initParams->dList != NULL) { this->gfx = initParams->dList; this->rObjId = initParams->objId; - EffectSsHahen_CheckForObject(this, globalCtx); + EffectSsHahen_CheckForObject(this, play); } else { this->gfx = SEGMENTED_TO_VIRTUAL(gEffFragments1DL); this->rObjId = -1; @@ -66,15 +66,15 @@ u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsHahen_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale = this->rScale * 0.001f; OPEN_DISPS(gfxCtx); if (this->rObjId != -1) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); @@ -83,22 +83,22 @@ void EffectSsHahen_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, this->gfx); CLOSE_DISPS(gfxCtx); } // in the original game this function is hardcoded to be used only by the skull pots in Shadow Temple -void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsHahen_DrawGray(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale = this->rScale * 0.001f; OPEN_DISPS(gfxCtx); if (this->rObjId != -1) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); @@ -107,7 +107,7 @@ void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetCombineLERP(POLY_OPA_DISP++, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 100, 100, 120, 255); @@ -116,8 +116,8 @@ void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { - Player* player = GET_PLAYER(globalCtx); +void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this) { + Player* player = GET_PLAYER(play); this->rPitch += 55; this->rYaw += 10; @@ -127,6 +127,6 @@ void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { } if (this->rObjId != -1) { - EffectSsHahen_CheckForObject(this, globalCtx); + EffectSsHahen_CheckForObject(this, play); } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c b/soh/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c index 9e73e1f08..b4a9bad86 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c @@ -17,9 +17,9 @@ #define rEnvColorB regs[7] #define rScale regs[8] -u32 EffectSsHitMark_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHitMark_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsHitMark_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsHitMark_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsHitMark_Update(PlayState* play, u32 index, EffectSs* this); static Color_RGB8 sColors[] = { { 255, 255, 255 }, { 255, 255, 0 }, { 255, 255, 255 }, { 255, 0, 0 }, { 255, 200, 100 }, { 200, 150, 0 }, @@ -41,7 +41,7 @@ EffectSsInit Effect_Ss_HitMark_InitVars = { EffectSsHitMark_Init, }; -u32 EffectSsHitMark_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsHitMark_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 colorIdx; EffectSsHitMarkInitParams* initParams = (EffectSsHitMarkInitParams*)initParamsx; this->pos = initParams->pos; @@ -69,8 +69,8 @@ u32 EffectSsHitMark_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsHitMark_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -84,7 +84,7 @@ void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); scale = this->rScale / 100.0f; SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -101,7 +101,7 @@ void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsHitMark_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsHitMark_Update(PlayState* play, u32 index, EffectSs* this) { s32 colorIdx; if (this->rType == EFFECT_HITMARK_DUST) { diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 277354c46..167a33c9c 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -13,16 +13,16 @@ #define rRotSpeed regs[3] #define rScale regs[4] -u32 EffectSsIcePiece_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsIcePiece_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Ice_Piece_InitVars = { EFFECT_SS_ICE_PIECE, EffectSsIcePiece_Init, }; -u32 EffectSsIcePiece_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsIcePieceInitParams* initParams = (EffectSsIcePieceInitParams*)initParamsx; this->pos = initParams->pos; @@ -42,15 +42,15 @@ u32 EffectSsIcePiece_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; u32 frames; f32 alpha; scale = this->rScale * 0.01f; - frames = globalCtx->state.frames; + frames = play->state.frames; OPEN_DISPS(gfxCtx); @@ -67,18 +67,18 @@ void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_RotateX(this->rPitch * (M_PI / 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (s32)alpha & 0xFF); - func_8003435C(&this->pos, globalCtx); + func_8003435C(&this->pos, play); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (1 * frames) % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (1 * frames) % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment1DL); CLOSE_DISPS(gfxCtx); } -void EffectSsIcePiece_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this) { this->rPitch += this->rRotSpeed; this->velocity.x = this->velocity.x * 0.85f; this->velocity.y = this->velocity.y * 0.85f; diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index b98cbdbb1..5b643ed4f 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -11,26 +11,26 @@ #define rAlpha regs[1] #define rScale regs[2] -u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsIceSmoke_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Ice_Smoke_InitVars = { EFFECT_SS_ICE_SMOKE, EffectSsIceSmoke_Init, }; -u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsIceSmokeInitParams* initParams = (EffectSsIceSmokeInitParams*)initParamsx; s32 pad; s32 objBankIdx; void* oldSeg6; - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FZ); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIdx].segment); Math_Vec3f_Copy(&this->pos, &initParams->pos); Math_Vec3f_Copy(&this->velocity, &initParams->velocity); Math_Vec3f_Copy(&this->accel, &initParams->accel); @@ -50,22 +50,22 @@ u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 0; } -void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; void* object; Mtx* mtx; f32 scale; s32 objBankIdx; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FZ); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { gDPPipeSync(POLY_XLU_DISP++); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL)); @@ -73,13 +73,13 @@ void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 235, 235, this->rAlpha); gSPSegment( POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->life * 3, this->life * 15, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->life * 3, this->life * 15, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); scale = this->rScale * 0.0001f; Matrix_Scale(scale, scale, 1.0f, MTXMODE_APPLY); - mtx = MATRIX_NEWMTX(globalCtx->state.gfxCtx); + mtx = MATRIX_NEWMTX(play->state.gfxCtx); if (mtx != NULL) { gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -89,15 +89,15 @@ void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) this->life = -1; } - 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) { s32 objBankIdx; - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FZ); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { if (this->rAlpha < 100) { this->rAlpha += 10; } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/soh/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index 73f1fb8d5..317f71d52 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -14,16 +14,16 @@ #define rXZScale regs[5] #define rScaleMax regs[6] -u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsKFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_K_Fire_InitVars = { EFFECT_SS_K_FIRE, EffectSsKFire_Init, }; -u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsKFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsKFireInitParams* initParams = (EffectSsKFireInitParams*)initParamsx; this->pos = initParams->pos; @@ -40,8 +40,8 @@ u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 xzScale; f32 yScale; @@ -53,10 +53,10 @@ void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(xzScale, yScale, xzScale, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - globalCtx->state.frames * this->rScroll, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + play->state.frames * this->rScroll, 0x20, 0x80)); if (this->rType >= 100) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, this->rAlpha); @@ -67,20 +67,20 @@ void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { } gDPPipeSync(POLY_XLU_DISP++); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if ((index & 1) != 0) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); 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/soh/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/soh/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index fc399a548..7c4944aa1 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -20,18 +20,18 @@ #define rObjBankIdx regs[11] #define rColorIdx regs[12] -u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsKakera_Update(PlayState* play, u32 index, EffectSs* this); -void func_809A9BA8(EffectSs* this, GlobalContext* globalCtx); +void func_809A9BA8(EffectSs* this, PlayState* play); EffectSsInit Effect_Ss_Kakera_InitVars = { EFFECT_SS_KAKERA, EffectSsKakera_Init, }; -u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsKakeraInitParams* initParams = (EffectSsKakeraInitParams*)initParamsx; s32 objId; @@ -49,7 +49,7 @@ u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi this->rObjId = KAKERA_OBJECT_DEFAULT; } else { this->rObjId = initParams->objId; - func_809A9BA8(this, globalCtx); + func_809A9BA8(this, play); } } else { @@ -86,9 +86,9 @@ f32 func_809A9818(f32 arg0, f32 arg1) { return ((temp_f2 * 2.0f) - arg1) + arg0; } -void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this) { static Color_RGB8 colors[] = { { 255, 255, 255 }, { 235, 170, 130 } }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; s32 colorIdx; @@ -100,9 +100,9 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (this->rObjId != KAKERA_OBJECT_DEFAULT) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } else { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } } @@ -114,7 +114,7 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (colorIdx >= 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, colors[colorIdx].r, colors[colorIdx].g, colors[colorIdx].b, 255); @@ -124,7 +124,7 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { } else { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (colorIdx >= 0) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, colors[colorIdx].r, colors[colorIdx].g, colors[colorIdx].b, 255); @@ -136,10 +136,10 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void func_809A9BA8(EffectSs* this, GlobalContext* globalCtx) { - this->rObjBankIdx = Object_GetIndex(&globalCtx->objectCtx, this->rObjId); +void func_809A9BA8(EffectSs* this, PlayState* play) { + this->rObjBankIdx = Object_GetIndex(&play->objectCtx, this->rObjId); - if ((this->rObjBankIdx < 0) || !Object_IsLoaded(&globalCtx->objectCtx, this->rObjBankIdx)) { + if ((this->rObjBankIdx < 0) || !Object_IsLoaded(&play->objectCtx, this->rObjBankIdx)) { this->life = 0; this->draw = NULL; } @@ -346,9 +346,9 @@ s32 func_809AA0EC(EffectSs* this) { return true; } -void func_809AA230(EffectSs* this, GlobalContext* globalCtx) { +void func_809AA230(EffectSs* this, PlayState* play) { static f32 D_809AA5B0[] = { 10.0f, 20.0f, 40.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->rReg8 == 0) { if ((((this->rReg4 >> 4) & 1) * 0x10) == 0x10) { @@ -373,7 +373,7 @@ void func_809AA230(EffectSs* this, GlobalContext* globalCtx) { break; case 1: if (this->velocity.y < 0.0f) { - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) { this->velocity.x *= func_809A9818(0.9f, 0.2f); this->velocity.y *= -0.8f; this->velocity.z *= func_809A9818(0.9f, 0.2f); @@ -385,13 +385,13 @@ void func_809AA230(EffectSs* this, GlobalContext* globalCtx) { } break; case 2: - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) {} + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) {} break; } } } -void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKakera_Update(PlayState* play, u32 index, EffectSs* this) { switch (((this->rReg4 >> 5) & 3) << 5) { case 0x20: this->rPitch += 0xB; @@ -413,9 +413,9 @@ void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) this->life = 0; } - func_809AA230(this, globalCtx); + func_809AA230(this, play); if (this->rObjId != KAKERA_OBJECT_DEFAULT) { - func_809A9BA8(this, globalCtx); + func_809A9BA8(this, play); } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c b/soh/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c index 0c78e4e72..078914439 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c @@ -21,18 +21,18 @@ #define rScale regs[11] #define rLifespan regs[12] -u32 EffectSsKiraKira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_809AABF0(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_809AACAC(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_809AAD6C(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKiraKira_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKiraKira_Draw(PlayState* play, u32 index, EffectSs* this); +void func_809AABF0(PlayState* play, u32 index, EffectSs* this); +void func_809AACAC(PlayState* play, u32 index, EffectSs* this); +void func_809AAD6C(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_KiraKira_InitVars = { EFFECT_SS_KIRAKIRA, EffectSsKiraKira_Init, }; -u32 EffectSsKiraKira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsKiraKira_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsKiraKiraInitParams* initParams = (EffectSsKiraKiraInitParams*)initParamsx; this->pos = initParams->pos; @@ -74,7 +74,7 @@ u32 EffectSsKiraKira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKiraKira_Draw(PlayState* play, u32 index, EffectSs* this) { GraphicsContext* gfxCtx; f32 scale; s32 pad; @@ -87,14 +87,14 @@ void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Mtx* mtx; scale = this->rScale / 10000.0f; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetRotateZYX(&mfRotY, 0, 0, this->rYaw); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotY, &mfTrans11DA0RotY); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0RotY, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -113,7 +113,7 @@ void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void func_809AABF0(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_809AABF0(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; this->rEnvColorA += this->rAlphaStep; @@ -129,7 +129,7 @@ void func_809AABF0(GlobalContext* globalCtx, u32 index, EffectSs* this) { this->rYaw += this->rRotSpeed; } -void func_809AACAC(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_809AACAC(PlayState* play, u32 index, EffectSs* this) { this->velocity.x *= 0.95f; this->velocity.z *= 0.95f; this->accel.x = Rand_CenteredFloat(0.2f); @@ -147,6 +147,6 @@ void func_809AACAC(GlobalContext* globalCtx, u32 index, EffectSs* this) { this->rYaw += this->rRotSpeed; } -void func_809AAD6C(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_809AAD6C(PlayState* play, u32 index, EffectSs* this) { this->rScale = this->rEnvColorA * Math_SinS((32768.0f / this->rLifespan) * this->life); } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/soh/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 933347fc6..f0ed53c12 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -20,16 +20,16 @@ #define rYaw regs[10] #define rLifespan regs[11] -u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsLightning_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Lightning_InitVars = { EFFECT_SS_LIGHTNING, EffectSsLightning_Init, }; -u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsLightningInitParams* initParams = (EffectSsLightningInitParams*)initParamsx; this->pos = initParams->pos; @@ -53,7 +53,7 @@ u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, return 1; } -void EffectSsLightning_NewLightning(GlobalContext* globalCtx, Vec3f* pos, s16 yaw, EffectSs* this) { +void EffectSsLightning_NewLightning(PlayState* play, Vec3f* pos, s16 yaw, EffectSs* this) { EffectSs newLightning; EffectSs_Delete(&newLightning); @@ -63,15 +63,15 @@ void EffectSsLightning_NewLightning(GlobalContext* globalCtx, Vec3f* pos, s16 ya newLightning.rYaw = yaw; newLightning.life = newLightning.rLifespan; - EffectSs_Insert(globalCtx, &newLightning); + EffectSs_Insert(play, &newLightning); } -void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this) { static void* lightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, gEffLightning5Tex, gEffLightning6Tex, gEffLightning7Tex, gEffLightning8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfResult; MtxF mfTrans; MtxF mfScale; @@ -96,7 +96,7 @@ void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) xzScale = yScale * 0.6f; SkinMatrix_SetScale(&mfScale, xzScale, yScale, xzScale); SkinMatrix_SetRotateZYX(&mfRotate, this->vec.x, this->vec.y, this->rYaw); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotate, &mfTrans11DA0Rotate); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0Rotate, &mfScale, &mfResult); @@ -117,7 +117,7 @@ void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsLightning_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad; Vec3f pos; s16 yaw; @@ -131,13 +131,13 @@ void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* thi pos.y = this->pos.y + (Math_SinS(this->rYaw - 0x4000) * scale); scale = Math_CosS(this->rYaw - 0x4000) * scale; - pos.x = this->pos.x - (Math_CosS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx))) * scale); - pos.z = this->pos.z + (Math_SinS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx))) * scale); + pos.x = this->pos.x - (Math_CosS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play))) * scale); + pos.z = this->pos.z + (Math_SinS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play))) * scale); - EffectSsLightning_NewLightning(globalCtx, &pos, yaw, this); + EffectSsLightning_NewLightning(play, &pos, yaw, this); if (Rand_ZeroOne() < 0.1f) { - EffectSsLightning_NewLightning(globalCtx, &pos, (this->rYaw * 2) - yaw, this); + EffectSsLightning_NewLightning(play, &pos, (this->rYaw * 2) - yaw, this); } } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index b44d3474b..60bf9aba0 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -19,16 +19,16 @@ #define rDirection regs[9] #define rScale regs[10] -u32 EffectSsSibuki_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Sibuki_InitVars = { EFFECT_SS_SIBUKI, EffectSsSibuki_Init, }; -u32 EffectSsSibuki_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsSibukiInitParams* initParams = (EffectSsSibukiInitParams*)initParamsx; this->pos = initParams->pos; @@ -59,8 +59,8 @@ u32 EffectSsSibuki_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale = this->rScale / 100.0f; OPEN_DISPS(gfxCtx); @@ -78,11 +78,11 @@ void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad[3]; f32 xzVelScale; s16 yaw; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->pos.y <= player->actor.floorHeight) { this->life = 0; @@ -92,7 +92,7 @@ void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) this->rMoveDelay--; if (this->rMoveDelay == 0) { - yaw = Camera_GetInputDirYaw(Gameplay_GetCamera(globalCtx, 0)); + yaw = Camera_GetInputDirYaw(Play_GetCamera(play, 0)); xzVelScale = ((200.0f + KREG(20)) * 0.01f) + ((0.1f * Rand_ZeroOne()) * (KREG(23) + 20.0f)); if (this->rDirection != 0) { diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c b/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c index e61954de3..f944d4fa7 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c @@ -18,16 +18,16 @@ #define rTexIdx regs[8] #define rScale regs[9] -u32 EffectSsSibuki2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSibuki2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSibuki2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsSibuki2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSibuki2_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsSibuki2_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Sibuki2_InitVars = { EFFECT_SS_SIBUKI2, EffectSsSibuki2_Init, }; -u32 EffectSsSibuki2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsSibuki2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsSibuki2InitParams* initParams = (EffectSsSibuki2InitParams*)initParamsx; this->pos = initParams->pos; @@ -50,13 +50,13 @@ u32 EffectSsSibuki2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsSibuki2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSibuki2_Draw(PlayState* play, u32 index, EffectSs* this) { static void* bubbleTextures[] = { gEffUnusedBubbles1Tex, gEffUnusedBubbles1Tex, gEffUnusedBubbles2Tex, gEffUnusedBubbles3Tex, gEffUnusedBubbles4Tex, gEffUnusedBubbles5Tex, gEffUnusedBubbles6Tex, gEffUnusedBubbles7Tex, gEffUnusedBubbles8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale = this->rScale / 100.0f; OPEN_DISPS(gfxCtx); @@ -74,7 +74,7 @@ void EffectSsSibuki2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsSibuki2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSibuki2_Update(PlayState* play, u32 index, EffectSs* this) { if (this->rTexIdx < 8) { this->rTexIdx++; } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index aa113bec0..d6c04c24b 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -10,16 +10,16 @@ #define rUnused regs[1] -u32 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); +u32 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); EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = { EFFECT_SS_SOLDER_SRCH_BALL, EffectSsSolderSrchBall_Init, }; -u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsSolderSrchBall_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsSolderSrchBallInitParams* initParams = (EffectSsSolderSrchBallInitParams*)initParamsx; this->pos = initParams->pos; @@ -33,13 +33,13 @@ u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* t return 1; } -void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSolderSrchBall_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 playerPosDiffX; f32 playerPosDiffY; f32 playerPosDiffZ; s16* linkDetected; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); linkDetected = this->actor; @@ -47,7 +47,7 @@ void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs playerPosDiffY = player->actor.world.pos.y - this->pos.y; playerPosDiffZ = player->actor.world.pos.z - this->pos.z; - if (!BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, 30.0f)) { + if (!BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, 30.0f)) { if (sqrtf(SQ(playerPosDiffX) + SQ(playerPosDiffY) + SQ(playerPosDiffZ)) < 70.0f) { *linkDetected = true; } @@ -221,18 +221,18 @@ static void draw_ico_sphere(Gfx** p_gfx_p, f32 x, f32 y, f32 z, f32 radius, Grap Matrix_Pop(); } -void EffectSsSolderSrchBall_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSolderSrchBall_Draw(PlayState* play, u32 index, EffectSs* this) { if (CVar_GetS32("gGuardVision", 0) == 0) { return; } - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u32 rm; u32 blc1; u32 blc2; s16* seenLink = this->actor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); rm = Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_XLU; blc1 = GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA); blc2 = GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA); @@ -250,5 +250,5 @@ void EffectSsSolderSrchBall_Draw(GlobalContext* globalCtx, u32 index, EffectSs* } draw_ico_sphere(&POLY_XLU_DISP, this->pos.x, this->pos.y, this->pos.z, 30.0f, gfxCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } \ No newline at end of file diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/soh/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index 80327fa7f..bdd1868ae 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -11,9 +11,9 @@ #define rObjBankIdx regs[0] #define rYaw regs[1] -u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsStick_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsStick_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Stick_InitVars = { EFFECT_SS_STICK, @@ -25,7 +25,7 @@ typedef struct { /* 0x04 */ Gfx* displayList; } StickDrawInfo; -u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { StickDrawInfo drawInfo[] = { { OBJECT_LINK_BOY, gLinkAdultBrokenGiantsKnifeBladeDL }, // adult, broken sword { OBJECT_LINK_CHILD, gLinkChildLinkDekuStickDL }, // child, broken stick @@ -33,7 +33,7 @@ u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void StickDrawInfo* ageInfoEntry = gSaveContext.linkAge + drawInfo; EffectSsStickInitParams* initParams = (EffectSsStickInitParams*)initParamsx; - this->rObjBankIdx = Object_GetIndex(&globalCtx->objectCtx, ageInfoEntry->objectID); + this->rObjBankIdx = Object_GetIndex(&play->objectCtx, ageInfoEntry->objectID); this->gfx = ageInfoEntry->displayList; this->vec = this->pos = initParams->pos; this->rYaw = initParams->yaw; @@ -48,8 +48,8 @@ u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; OPEN_DISPS(gfxCtx); @@ -61,18 +61,18 @@ void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_RotateZYX(0, this->rYaw, 0, MTXMODE_APPLY); } else { Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - Matrix_RotateZYX(0, this->rYaw, globalCtx->state.frames * 10000, MTXMODE_APPLY); + Matrix_RotateZYX(0, this->rYaw, play->state.frames * 10000, MTXMODE_APPLY); } gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_80093D18(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); gSPDisplayList(POLY_OPA_DISP++, this->gfx); CLOSE_DISPS(gfxCtx); } -void EffectSsStick_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsStick_Update(PlayState* play, u32 index, EffectSs* this) { } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/soh/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index 235cacd3c..378990470 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -9,9 +9,9 @@ #define rReg0 regs[0] -u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsStone1_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsStone1_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Stone1_InitVars = { EFFECT_SS_STONE1, @@ -35,7 +35,7 @@ static EffStoneDrawInfo sDrawInfo[] = { { gUnknownEffStone1Tex, { 255, 255, 255, 255 }, { 0, 255, 255, 255 } }, }; -u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsStone1_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsStone1InitParams* initParams = (EffectSsStone1InitParams*)initParamsx; Vec3f pos = initParams->pos; @@ -49,8 +49,8 @@ u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; EffStoneDrawInfo* drawParams = &sDrawInfo[this->life]; Vec3f mfVec; f32 mfW; @@ -58,7 +58,7 @@ void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->pos, &mfVec, &mfW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->pos, &mfVec, &mfW); scale = (mfW < 1500.0f) ? 3.0f : (mfW / 1500.0f) * 3.0f; Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -74,7 +74,7 @@ void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -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/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 6f5c92e15..fa688f4b6 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -2126,7 +2126,7 @@ void FileChoose_LoadGame(GameState* thisx) { gSaveContext.fileNum = this->buttonIndex; Sram_OpenSave(); gSaveContext.gameMode = 0; - SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); this->state.running = false; } diff --git a/soh/src/overlays/gamestates/ovl_opening/z_opening.c b/soh/src/overlays/gamestates/ovl_opening/z_opening.c index fb877bdc2..433523fd1 100644 --- a/soh/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/soh/src/overlays/gamestates/ovl_opening/z_opening.c @@ -16,7 +16,7 @@ void Opening_SetupTitleScreen(OpeningContext* this) { Sram_InitDebugSave(); gSaveContext.cutsceneIndex = 0xFFF3; gSaveContext.sceneSetupIndex = 7; - SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } void func_80803C5C(OpeningContext* this) { diff --git a/soh/src/overlays/gamestates/ovl_select/z_select.c b/soh/src/overlays/gamestates/ovl_select/z_select.c index 8a63ff025..601af217c 100644 --- a/soh/src/overlays/gamestates/ovl_select/z_select.c +++ b/soh/src/overlays/gamestates/ovl_select/z_select.c @@ -46,7 +46,7 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) { gSaveContext.showTitleCard = true; gWeatherMode = 0; this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } void Select_Grotto_LoadGame(SelectContext* this, s32 grottoIndex) { @@ -88,7 +88,7 @@ void Select_Grotto_LoadGame(SelectContext* this, s32 grottoIndex) { gSaveContext.showTitleCard = true; gWeatherMode = 0; this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } static SceneSelectEntry sScenes[] = { diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index b002074a9..ef59c1356 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -4,7 +4,7 @@ extern const char* digitTextures[]; -void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { Color_RGB8 A_button_ori = {80, 255, 150}; Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori); Color_RGB8 C_button_ori = {255, 255, 50}; @@ -66,8 +66,8 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx { 0x02, 0xFF, 0x13, 0xFE }, { 0xFF, 0x17, 0xFD, 0x16 }, { 0xFF, 0x17, 0x15, 0x18 }, { 0x15, 0x0C, 0xFD, 0x18 }, { 0xFF, 0x10, 0x16, 0x04 }, { 0x00, 0x00, 0x00, 0x00 }, }; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; s16 sp226; s16 sp224; s16 sp222; @@ -98,7 +98,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { phi_s0 = D_8082A1AC[phi_s3][2]; if (phi_s0 == -3) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); pauseCtx->unk_1E4 = 0; } else { while (phi_s0 >= 0) { @@ -111,7 +111,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx } else if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { phi_s0 = D_8082A1AC[phi_s3][3]; if (phi_s0 == -2) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); pauseCtx->unk_1E4 = 0; } else { while (phi_s0 >= 0) { diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index 25415a08a..5d2028c08 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -81,8 +81,8 @@ void KaleidoScope_DrawDebugEditorText(Gfx** gfxp) { extern const char* digitTextures[]; -void KaleidoScope_DrawDigit(GlobalContext* globalCtx, s32 digit, s32 rectLeft, s32 rectTop) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void KaleidoScope_DrawDigit(PlayState* play, s32 digit, s32 rectLeft, s32 rectTop) { + OPEN_DISPS(play->state.gfxCtx); gDPLoadTextureBlock(POLY_KAL_DISP++, digitTextures[digit], G_IM_FMT_I, G_IM_SIZ_8b, 8, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -90,16 +90,16 @@ void KaleidoScope_DrawDigit(GlobalContext* globalCtx, s32 digit, s32 rectLeft, s gSPTextureRectangle(POLY_KAL_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + 8) << 2, (rectTop + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { +void KaleidoScope_DrawDebugEditor(PlayState* play) { static s16 curSection = 0; static s16 curRow = 0; static s32 prevDBtnInput = 0; static s32 heldDBtnTimer = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; Gfx* gfx; Gfx* gfxRef; s16 spD8[4]; @@ -110,12 +110,12 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { s16 y; s32 dBtnInput = input->cur.button & (BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); pauseCtx->stickRelX = input->rel.stick_x; pauseCtx->stickRelY = input->rel.stick_y; - func_800944C4_KAL(globalCtx->state.gfxCtx); + func_800944C4_KAL(play->state.gfxCtx); gDPSetRenderMode(POLY_KAL_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); @@ -140,7 +140,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { gDPSetEnvColor(POLY_KAL_DISP++, 0, 0, 0, 0); // Current Health Quarter (X / 4) - KaleidoScope_DrawDigit(globalCtx, (gSaveContext.health % 0x10) / 4, 194, 15); + KaleidoScope_DrawDigit(play, (gSaveContext.health % 0x10) / 4, 194, 15); gDPPipeSync(POLY_KAL_DISP++); gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, 255); @@ -164,7 +164,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { } for (i = 0, x = 68; i < 4; i++, x += 10) { - KaleidoScope_DrawDigit(globalCtx, spD8[i], x, 15); + KaleidoScope_DrawDigit(play, spD8[i], x, 15); } // Health capacity @@ -175,8 +175,8 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[3] -= 10; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], 146, 15); - KaleidoScope_DrawDigit(globalCtx, spD8[3], 156, 15); + KaleidoScope_DrawDigit(play, spD8[2], 146, 15); + KaleidoScope_DrawDigit(play, spD8[3], 156, 15); // Health spD8[2] = 0; @@ -186,8 +186,8 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[3] -= 10; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], 172, 15); - KaleidoScope_DrawDigit(globalCtx, spD8[3], 182, 15); + KaleidoScope_DrawDigit(play, spD8[2], 172, 15); + KaleidoScope_DrawDigit(play, spD8[3], 182, 15); // Inventory for (slot = 0, i = 0, y = 35; i < 4; i++, y += 15) { @@ -211,8 +211,8 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[2] = spD8[3] = 0; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], x, y); - KaleidoScope_DrawDigit(globalCtx, spD8[3], x + 10, y); + KaleidoScope_DrawDigit(play, spD8[2], x, y); + KaleidoScope_DrawDigit(play, spD8[3], x + 10, y); } } @@ -229,24 +229,24 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[2] = spD8[3] = 0; } - KaleidoScope_DrawDigit(globalCtx, spD8[3], spD8[1], 98); + KaleidoScope_DrawDigit(play, spD8[3], spD8[1], 98); spD8[1] += 10; } // Upgrades for (spD8[1] = 78, i = 0; i < 8; i++, spD8[1] += 12) { - KaleidoScope_DrawDigit(globalCtx, CUR_UPG_VALUE(i), spD8[1], 115); + KaleidoScope_DrawDigit(play, CUR_UPG_VALUE(i), spD8[1], 115); } // Equipment for (spD8[1] = 202, i = 0; i < 4; i++, spD8[1] += 12) { - KaleidoScope_DrawDigit(globalCtx, ALL_EQUIP_VALUE(i), spD8[1], 115); + KaleidoScope_DrawDigit(play, ALL_EQUIP_VALUE(i), spD8[1], 115); } // Dungeon Items for (spD8[1] = 78, i = 0; i < 12; i++, spD8[1] += 12) { spD8[2] = gSaveContext.inventory.dungeonItems[i] & gEquipMasks[0]; - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 132); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 132); } // Medallions @@ -255,7 +255,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 149); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 149); } // Spiritual Stones @@ -264,7 +264,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 149); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 149); } // Songs @@ -273,7 +273,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_SONG_MINUET + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 166); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 166); } // Other Quest Items @@ -282,7 +282,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 185); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 185); } // GS Tokens @@ -299,12 +299,12 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[3] -= 10; } - KaleidoScope_DrawDigit(globalCtx, spD8[1], 145, 185); - KaleidoScope_DrawDigit(globalCtx, spD8[2], 155, 185); - KaleidoScope_DrawDigit(globalCtx, spD8[3], 165, 185); + KaleidoScope_DrawDigit(play, spD8[1], 145, 185); + KaleidoScope_DrawDigit(play, spD8[2], 155, 185); + KaleidoScope_DrawDigit(play, spD8[3], 165, 185); // Heart Pieces (X / 4) - KaleidoScope_DrawDigit(globalCtx, ((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C, 210, + KaleidoScope_DrawDigit(play, ((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C, 210, 185); // Handles navigating the menu to different sections with the D-Pad @@ -384,13 +384,13 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { case 2: if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - Health_ChangeBy(globalCtx, -4); + Health_ChangeBy(play, -4); } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - Health_ChangeBy(globalCtx, 4); + Health_ChangeBy(play, 4); } else if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { - Health_ChangeBy(globalCtx, -0x10); + Health_ChangeBy(play, -0x10); } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { - Health_ChangeBy(globalCtx, 0x10); + Health_ChangeBy(play, 0x10); } break; @@ -650,5 +650,5 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { pauseCtx->debugState = 0; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 1828a7d2e..0a74e87c3 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -16,8 +16,8 @@ static u8 sEquipmentItemOffsets[] = { static s16 sEquipTimer = 0; -void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32 width, u32 height) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) { + PauseContext* pauseCtx = &play->pauseCtx; u8* curTexture; s32 vtxIndex; s32 textureCount; @@ -27,7 +27,7 @@ void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32 s32 pad; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_KAL_DISP++); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); @@ -86,17 +86,17 @@ void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32 vtxIndex += 4; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Vec3s link_kaleido_rot = { 0, 32300, 0 }; // Default rotation link face us. -void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_DrawPlayerWork(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; Vec3f pos; //Vec3s rot; // Removed for not having it use din the function f32 scale; - Input* input = &globalCtx->state.input[0]; + Input* input = &play->state.input[0]; s16 RotationSpeed = 150 * CVar_GetS32("gPauseLiveLinkRotationSpeed", 0); u8 AllowStickRotation = (CVar_GetS32("gPauseLiveLinkRotation", 0) == 3) ? true : false; u8 AllowCRotation = (CVar_GetS32("gPauseLiveLinkRotation", 0) == 2) ? true : false; @@ -151,16 +151,16 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) { link_kaleido_rot.x = 0; extern int fbTest; - gsSPSetFB(globalCtx->state.gfxCtx->polyOpa.p++, fbTest); - func_8009214C(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &link_kaleido_rot, scale, + gsSPSetFB(play->state.gfxCtx->polyOpa.p++, fbTest); + func_8009214C(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &link_kaleido_rot, scale, CUR_EQUIP_VALUE(EQUIP_SWORD), CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1, CUR_EQUIP_VALUE(EQUIP_SHIELD), CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1); - gsSPResetFB(globalCtx->state.gfxCtx->polyOpa.p++); + gsSPResetFB(play->state.gfxCtx->polyOpa.p++); } -void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; +void KaleidoScope_DrawEquipment(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; u16 i; u16 j; u16 k; @@ -178,7 +178,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { s16 oldCursorPoint; bool dpad = (CVar_GetS32("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_KAL_DISP++); gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, ZREG(39), ZREG(40), ZREG(41), pauseCtx->alpha); @@ -247,7 +247,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { if (cursorY == pauseCtx->cursorY[PAUSE_EQUIP]) { pauseCtx->cursorX[PAUSE_EQUIP] = cursorX; pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); cursorMoveResult = 3; } } @@ -281,7 +281,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { if (cursorY == pauseCtx->cursorY[PAUSE_EQUIP]) { pauseCtx->cursorX[PAUSE_EQUIP] = cursorX; pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); cursorMoveResult = 3; } } @@ -384,7 +384,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } } @@ -424,7 +424,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); break; } } @@ -571,7 +571,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { } } RESUME_EQUIPMENT_SWORD: - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -604,7 +604,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { default: break; } - KaleidoScope_SetupItemEquip(globalCtx, cursorItem, slot, + KaleidoScope_SetupItemEquip(play, cursorItem, slot, pauseCtx->equipVtx[cursorSlot * 4].v.ob[0] * 10, pauseCtx->equipVtx[cursorSlot * 4].v.ob[1] * 10); } else { @@ -657,7 +657,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { } } - func_800949A8(globalCtx->state.gfxCtx); + func_800949A8(play->state.gfxCtx); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); @@ -674,7 +674,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); } - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + point - 1], 32, 32, 0); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + point - 1], 32, 32, 0); gsSPGrayscale(POLY_KAL_DISP++, false); } } else { @@ -683,7 +683,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); // Grey Out Slingshot Bullet Bags gsSPGrayscale(POLY_KAL_DISP++, true); } - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1], 32, 32, 0); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1], 32, 32, 0); gsSPGrayscale(POLY_KAL_DISP++, false); } else if (CUR_UPG_VALUE(sAdultUpgrades[i]) != 0) { if (drawGreyItems && @@ -692,7 +692,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); } - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], 32, 32, 0); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], 32, 32, 0); gsSPGrayscale(POLY_KAL_DISP++, false); } } @@ -706,25 +706,25 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gsSPGrayscale(POLY_KAL_DISP++, true); } if (((u32)i == 0) && (k == 2) && (gSaveContext.bgsFlag != 0)) { - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point); } else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) { - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point); } else if (gBitFlags[bit] & gSaveContext.inventory.equipment) { - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[itemId], 32, 32, point); } gsSPGrayscale(POLY_KAL_DISP++, false); } } - KaleidoScope_DrawPlayerWork(globalCtx); + KaleidoScope_DrawPlayerWork(play); //if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 10)) { - //KaleidoScope_SetupPlayerPreRender(globalCtx); + //KaleidoScope_SetupPlayerPreRender(play); //} if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 9)) { //! @bug: This function shouldn't take any arguments - //KaleidoScope_ProcessPlayerPreRender(globalCtx); + //KaleidoScope_ProcessPlayerPreRender(play); } // gSPInvalidateTexCache(POLY_KAL_DISP++, 0); @@ -736,13 +736,13 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gSPSegment(POLY_KAL_DISP++, 0x08, pauseCtx->iconItemSegment); gSPSegment(POLY_KAL_DISP++, 0x09, pauseCtx->iconItem24Segment); gSPSegment(POLY_KAL_DISP++, 0x0A, pauseCtx->nameSegment); - gSPSegment(POLY_KAL_DISP++, 0x0B, globalCtx->interfaceCtx.mapSegment); + gSPSegment(POLY_KAL_DISP++, 0x0B, play->interfaceCtx.mapSegment); //gSPSegment(POLY_KAL_DISP++, 0x0C, pauseCtx->iconItemAltSegment); - func_800949A8_KAL(globalCtx->state.gfxCtx); - KaleidoScope_DrawEquipmentImage(globalCtx, pauseCtx->playerSegment, 64, 112); + func_800949A8_KAL(play->state.gfxCtx); + KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, 64, 112); if (gUpgradeMasks[0]) {} - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 93cdf559c..4dd11dcd1 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -84,12 +84,12 @@ void KaleidoScope_SetItemCursorVtx(PauseContext* pauseCtx) { KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx); } -void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { +void KaleidoScope_DrawItemSelect(PlayState* play) { static s16 magicArrowEffectsR[] = { 255, 100, 255 }; static s16 magicArrowEffectsG[] = { 0, 100, 255 }; static s16 magicArrowEffectsB[] = { 0, 255, 100 }; - Input* input = &globalCtx->state.input[0]; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + Input* input = &play->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; u16 i; u16 j; u16 cursorItem; @@ -102,9 +102,9 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { s16 moveCursorResult; bool dpad = (CVar_GetS32("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800949A8(globalCtx->state.gfxCtx); + func_800949A8(play->state.gfxCtx); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); @@ -164,7 +164,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { pauseCtx->cursorX[PAUSE_ITEM] = cursorX; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); moveCursorResult = 2; } @@ -196,7 +196,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { pauseCtx->cursorX[PAUSE_ITEM] = cursorX; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); moveCursorResult = 2; } @@ -242,7 +242,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } } @@ -277,7 +277,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); break; } } @@ -414,11 +414,11 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { if (((pauseCtx->stickRelX > 30 || pauseCtx->stickRelY > 30) || dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT | BTN_DUP))) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Inventory_ReplaceItem(globalCtx, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetNextAdultTradeItem()); + Inventory_ReplaceItem(play, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetNextAdultTradeItem()); } else if (((pauseCtx->stickRelX < -30 || pauseCtx->stickRelY < -30) || dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DDOWN))) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Inventory_ReplaceItem(globalCtx, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetPrevAdultTradeItem()); + Inventory_ReplaceItem(play, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetPrevAdultTradeItem()); } gSelectingAdultTrade = cursorSlot == SLOT_TRADE_ADULT; } @@ -429,7 +429,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { if (CHECK_BTN_ANY(input->press.button, buttonsToCheck)) { if (CHECK_SLOT_AGE(cursorSlot) && (cursorItem != ITEM_SOLD_OUT) && (cursorItem != ITEM_NONE)) { - KaleidoScope_SetupItemEquip(globalCtx, cursorItem, cursorSlot, + KaleidoScope_SetupItemEquip(play, cursorItem, cursorSlot, pauseCtx->itemVtx[index].v.ob[0] * 10, pauseCtx->itemVtx[index].v.ob[1] * 10); } else { @@ -519,14 +519,14 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); } - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[itemId], 32, 32, 0); gsSPGrayscale(POLY_KAL_DISP++, false); } } if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_ITEM); + KaleidoScope_DrawCursor(play, PAUSE_ITEM); } gDPPipeSync(POLY_KAL_DISP++); @@ -535,16 +535,16 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { for (i = 0; i < 15; i++) { if ((gAmmoItems[i] != ITEM_NONE) && (gSaveContext.inventory.items[i] != ITEM_NONE)) { - KaleidoScope_DrawAmmoCount(pauseCtx, globalCtx->state.gfxCtx, gSaveContext.inventory.items[i], i); + KaleidoScope_DrawAmmoCount(pauseCtx, play->state.gfxCtx, gSaveContext.inventory.items[i], i); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void KaleidoScope_SetupItemEquip(GlobalContext* globalCtx, u16 item, u16 slot, s16 animX, s16 animY) { - Input* input = &globalCtx->state.input[0]; - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_SetupItemEquip(PlayState* play, u16 item, u16 slot, s16 animX, s16 animY) { + Input* input = &play->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; gSelectingMask = false; gSelectingAdultTrade = false; @@ -598,9 +598,9 @@ void KaleidoScope_SetupItemEquip(GlobalContext* globalCtx, u16 item, u16 slot, s static s16 sCButtonPosX[] = { 66, 90, 114, 110, 110, 86, 134 }; static s16 sCButtonPosY[] = { 110, 92, 110, 76, 44, 62, 62 }; -void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { +void KaleidoScope_UpdateItemEquip(PlayState* play) { static s16 D_8082A488 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; Vtx* bowItemVtx; u16 offsetX; u16 offsetY; @@ -869,7 +869,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { gSaveContext.equips.buttonItems[targetButtonIndex]; gSaveContext.equips.cButtonSlots[otherSlotIndex] = gSaveContext.equips.cButtonSlots[pauseCtx->equipTargetCBtn]; - Interface_LoadItemIcon2(globalCtx, otherButtonIndex); + Interface_LoadItemIcon2(play, otherButtonIndex); } else { gSaveContext.equips.buttonItems[otherButtonIndex] = ITEM_NONE; gSaveContext.equips.cButtonSlots[otherSlotIndex] = SLOT_NONE; @@ -880,7 +880,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { gSaveContext.equips.buttonItems[targetButtonIndex] = pauseCtx->equipTargetItem; gSaveContext.equips.cButtonSlots[pauseCtx->equipTargetCBtn] = pauseCtx->equipTargetSlot; - Interface_LoadItemIcon1(globalCtx, targetButtonIndex); + Interface_LoadItemIcon1(play, targetButtonIndex); pauseCtx->unk_1E4 = 0; sEquipMoveTimer = 10; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index 028d7d82c..f29647be6 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -7,7 +7,7 @@ #include "textures/icon_item_dungeon_static/icon_item_dungeon_static.h" #include "textures/icon_item_nes_static/icon_item_nes_static.h" -void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { static void* dungeonItemTexs[] = { gBossKeyIconTex, gCompassIconTex, @@ -42,9 +42,9 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC static s16 mapBgPulseB = 140 / 8; static u16 mapBgPulseTimer = 20; static u16 mapBgPulseStage = 0; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; s16 i; s16 j; s16 oldCursorPoint; @@ -63,7 +63,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC if (pauseCtx->cursorSpecialPos == 0) { if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { if (pauseCtx->cursorX[PAUSE_MAP] != 0) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); } else { pauseCtx->cursorX[PAUSE_MAP] = 1; pauseCtx->cursorPoint[PAUSE_MAP] = 0; @@ -72,14 +72,14 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) { pauseCtx->cursorPoint[PAUSE_MAP]++; if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex)) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); } } } } } else if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { if (pauseCtx->cursorX[PAUSE_MAP] == 0) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); } else { pauseCtx->cursorX[PAUSE_MAP] = 0; pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot; @@ -87,7 +87,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE + gMapData->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3]; - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); } } @@ -144,7 +144,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC gMapData->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3]; pauseCtx->dungeonMapSlot = pauseCtx->cursorPoint[PAUSE_MAP]; if (i != R_MAP_TEX_INDEX) { - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); } } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { @@ -175,7 +175,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC R_MAP_TEX_INDEX_BASE + gMapData ->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3]; - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); } } } else { @@ -312,7 +312,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gGoldSkulltulaIconTex, 24, 24, 8); } - if ((globalCtx->sceneNum >= SCENE_YDAN) && (globalCtx->sceneNum <= SCENE_TAKARAYA)) { + if ((play->sceneNum >= SCENE_YDAN) && (play->sceneNum <= SCENE_TAKARAYA)) { stepR = (mapBgPulseR - mapBgPulseColors[mapBgPulseStage][0]) / mapBgPulseTimer; stepG = (mapBgPulseG - mapBgPulseColors[mapBgPulseStage][1]) / mapBgPulseTimer; stepB = (mapBgPulseB - mapBgPulseColors[mapBgPulseStage][2]) / mapBgPulseTimer; @@ -361,7 +361,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC CLOSE_DISPS(gfxCtx); } -void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { static void* cloudTexs[] = { gWorldMapCloud16Tex, gWorldMapCloud15Tex, gWorldMapCloud14Tex, gWorldMapCloud13Tex, gWorldMapCloud12Tex, gWorldMapCloud11Tex, gWorldMapCloud10Tex, gWorldMapCloud9Tex, @@ -409,8 +409,8 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx gPauseCurrentPositionFRATex, }; static u16 D_8082A6D4 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; s16 i; s16 j; s16 t; @@ -435,7 +435,7 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > 11) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } } while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0); @@ -446,7 +446,7 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < 0) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 0; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); break; } } while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0); @@ -700,7 +700,7 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx } if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_MAP); + KaleidoScope_DrawCursor(play, PAUSE_MAP); } gSPVertex(POLY_KAL_DISP++, &pauseCtx->mapPageVtx[176], 16, 0); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index bc41fddba..06ffa7b14 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -2,9 +2,9 @@ static s16 D_8082A6E0[] = { 100, 255 }; -void KaleidoScope_UpdatePrompt(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; +void KaleidoScope_UpdatePrompt(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; s8 relStickX = input->rel.stick_x; s16 step; bool dpad = CVar_GetS32("gDpadPause", 0); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index b272297f1..58425a25d 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -12,28 +12,28 @@ extern u8 gEquipAgeReqs[][4]; extern u8 gAreaGsFlags[]; extern bool gSelectingMask; -void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx); +void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); -void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx); -void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx); -void KaleidoScope_DrawEquipment(GlobalContext* globalCtx); +void KaleidoScope_DrawDebugEditor(PlayState* play); +void KaleidoScope_DrawPlayerWork(PlayState* play); +void KaleidoScope_DrawEquipment(PlayState* play); void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); -void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx); -void KaleidoScope_SetupItemEquip(GlobalContext* globalCtx, u16 item, u16 slot, s16 animX, s16 animY); -void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx); -void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx); -void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx); -void KaleidoScope_UpdatePrompt(GlobalContext* globalCtx); +void KaleidoScope_DrawItemSelect(PlayState* play); +void KaleidoScope_SetupItemEquip(PlayState* play, u16 item, u16 slot, s16 animX, s16 animY); +void KaleidoScope_UpdateItemEquip(PlayState* play); +void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_UpdatePrompt(PlayState* play); Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); -void KaleidoScope_MoveCursorToSpecialPos(GlobalContext* globalCtx, u16 specialPos); +void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos); void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); void KaleidoScope_ProcessPlayerPreRender(); -void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx); -void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex); -void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx); +void KaleidoScope_SetupPlayerPreRender(PlayState* play); +void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex); +void KaleidoScope_UpdateDungeonMap(PlayState* play); -void PauseMapMark_Draw(GlobalContext* globalCtx); +void PauseMapMark_Draw(PlayState* play); void KaleidoScope_UpdateCursorSize(PauseContext* pauseCtx); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index e64841f79..d955b1492 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -849,8 +849,8 @@ void KaleidoScope_OverridePalIndexCI4(u8* texture, ptrdiff_t size, s32 targetInd } } -void KaleidoScope_MoveCursorToSpecialPos(GlobalContext* globalCtx, u16 specialPos) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos) { + PauseContext* pauseCtx = &play->pauseCtx; pauseCtx->cursorSpecialPos = specialPos; pauseCtx->pageSwitchTimer = 0; @@ -869,8 +869,8 @@ void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, CLOSE_DISPS(gfxCtx); } -void KaleidoScope_SetDefaultCursor(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_SetDefaultCursor(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; s16 s; s16 i; gSelectingMask = false; @@ -985,11 +985,11 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { } } -void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { + PauseContext* pauseCtx = &play->pauseCtx; u16 temp; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); temp = pauseCtx->unk_1E4; @@ -1045,7 +1045,7 @@ void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) { gDPSetEnvColor(POLY_KAL_DISP++, 0, 0, 0, 255); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, void** textures) { @@ -1082,7 +1082,7 @@ Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, void** textures) { return gfx; } -void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { static s16 D_8082ACF4[][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 255, 50 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 255, 50 }, @@ -1135,8 +1135,8 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { static s16 D_8082AD4C = 0; static s16 D_8082AD50 = 0; const Color_RGB8 A_cursor = CVar_GetRGB("gCCABtnPrim", A_BTN_ori); - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; s16 stepR; s16 stepG; s16 stepB; @@ -1290,7 +1290,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_KAL_DISP = KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->itemPageVtx, sSelectItemTexs[gSaveContext.language]); - KaleidoScope_DrawItemSelect(globalCtx); + KaleidoScope_DrawItemSelect(play); } if (pauseCtx->pageIndex != PAUSE_EQUIP) { @@ -1308,7 +1308,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_KAL_DISP = KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->equipPageVtx, sEquipmentTexs[gSaveContext.language]); - KaleidoScope_DrawEquipment(globalCtx); + KaleidoScope_DrawEquipment(play); } if (pauseCtx->pageIndex != PAUSE_QUEST) { @@ -1327,7 +1327,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_KAL_DISP = KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->questPageVtx, sQuestStatusTexs[gSaveContext.language]); - KaleidoScope_DrawQuestStatus(globalCtx, gfxCtx); + KaleidoScope_DrawQuestStatus(play, gfxCtx); } if (pauseCtx->pageIndex != PAUSE_MAP) { @@ -1347,16 +1347,16 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->mapPageVtx, sMapTexs[gSaveContext.language]); if (sInDungeonScene) { - KaleidoScope_DrawDungeonMap(globalCtx, gfxCtx); + KaleidoScope_DrawDungeonMap(play, gfxCtx); func_800949A8(gfxCtx); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) { - PauseMapMark_Draw(globalCtx); + PauseMapMark_Draw(play); } } else { - KaleidoScope_DrawWorldMap(globalCtx, gfxCtx); + KaleidoScope_DrawWorldMap(play, gfxCtx); } } @@ -1375,7 +1375,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_KAL_DISP = KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->itemPageVtx, sSelectItemTexs[gSaveContext.language]); - KaleidoScope_DrawItemSelect(globalCtx); + KaleidoScope_DrawItemSelect(play); break; case PAUSE_MAP: @@ -1391,20 +1391,20 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->mapPageVtx, sMapTexs[gSaveContext.language]); if (sInDungeonScene) { - KaleidoScope_DrawDungeonMap(globalCtx, gfxCtx); + KaleidoScope_DrawDungeonMap(play, gfxCtx); func_800949A8(gfxCtx); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_MAP); + KaleidoScope_DrawCursor(play, PAUSE_MAP); } if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) { - PauseMapMark_Draw(globalCtx); + PauseMapMark_Draw(play); } } else { - KaleidoScope_DrawWorldMap(globalCtx, gfxCtx); + KaleidoScope_DrawWorldMap(play, gfxCtx); } break; @@ -1422,10 +1422,10 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_KAL_DISP = KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->questPageVtx, sQuestStatusTexs[gSaveContext.language]); - KaleidoScope_DrawQuestStatus(globalCtx, gfxCtx); + KaleidoScope_DrawQuestStatus(play, gfxCtx); if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_QUEST); + KaleidoScope_DrawCursor(play, PAUSE_QUEST); } break; @@ -1441,10 +1441,10 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_KAL_DISP = KaleidoScope_DrawPageSections(POLY_KAL_DISP, pauseCtx->equipPageVtx, sEquipmentTexs[gSaveContext.language]); - KaleidoScope_DrawEquipment(globalCtx); + KaleidoScope_DrawEquipment(play); if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_EQUIP); + KaleidoScope_DrawCursor(play, PAUSE_EQUIP); } break; } @@ -1453,7 +1453,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { func_800949A8(gfxCtx); if ((pauseCtx->state == 7) || ((pauseCtx->state >= 8) && (pauseCtx->state < 0x12))) { - KaleidoScope_UpdatePrompt(globalCtx); + KaleidoScope_UpdatePrompt(play); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); @@ -1578,7 +1578,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { FrameInterpolation_RecordCloseChild(); } -void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { +void KaleidoScope_DrawInfoPanel(PlayState* play) { static s16 gABtnTexColour[][4] = { //A button colors { 0, 255, 100, 255 },//Gamecube { 0, 100, 255, 255 },//Original N64 @@ -1637,7 +1637,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { static s16 D_808321A2; static s16 D_808321A4; static s16 D_808321A6; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16 stepR; s16 stepG; s16 stepB; @@ -1646,7 +1646,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { s16 i; s16 j; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); stepR = ABS(D_808321A0 - D_8082ADF0[D_8082AE04][0]) / D_8082AE00; stepG = ABS(D_808321A2 - D_8082ADF0[D_8082AE04][1]) / D_8082AE00; @@ -1774,7 +1774,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, -144.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 90, 100, 130, 255); @@ -1811,7 +1811,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->infoPanelVtx[j].v.ob[0]; pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->infoPanelVtx[j].v.ob[1]; KaleidoScope_UpdateCursorSize(pauseCtx); - KaleidoScope_DrawCursor(globalCtx, pauseCtx->pageIndex); + KaleidoScope_DrawCursor(play, pauseCtx->pageIndex); } temp = pauseCtx->infoPanelOffsetY - 80; @@ -1887,7 +1887,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetEnvColor(POLY_KAL_DISP++, 0, 0, 0, 0); - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gGoldSkulltulaIconTex, 24, 24, 0); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gGoldSkulltulaIconTex, 24, 24, 0); } } } else if ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 7) || (pauseCtx->unk_1E4 == 8)) { @@ -2107,11 +2107,11 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void KaleidoScope_UpdateNamePanel(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_UpdateNamePanel(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; u16 sp2A; if ((pauseCtx->namedItem != pauseCtx->cursorItem[pauseCtx->pageIndex]) || @@ -2176,8 +2176,8 @@ void KaleidoScope_UpdateNamePanel(GlobalContext* globalCtx) { } } -void func_808237B4(GlobalContext* globalCtx, Input* input) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void func_808237B4(PlayState* play, Input* input) { + PauseContext* pauseCtx = &play->pauseCtx; s32 cond = false; s32 mode; @@ -2360,11 +2360,11 @@ static s16 D_8082B0E4[] = { 0x0019, 0x000D, 0x0001, 0x0001, 0x000D, 0x0015, 0x000F, 0x000D, 0x000C, 0x0001, 0x0000, }; -s16 func_80823A0C(GlobalContext* globalCtx, Vtx* vtx, s16 arg2, s16 arg3) { +s16 func_80823A0C(PlayState* play, Vtx* vtx, s16 arg2, s16 arg3) { static s16 D_8082B110 = 0; static s16 D_8082B114 = 1; static s16 D_8082B118 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16* ptr1; s16* ptr2; s16* ptr3; @@ -2553,8 +2553,8 @@ static s16 D_8082B1F8[] = { 48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, }; -void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { + PauseContext* pauseCtx = &play->pauseCtx; s16 phi_t1; s16 phi_t2; s16 phi_t2_2; @@ -2571,14 +2571,14 @@ void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx } pauseCtx->itemPageVtx = Graph_Alloc(gfxCtx, 60 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->itemPageVtx, 0, 0); + func_80823A0C(play, pauseCtx->itemPageVtx, 0, 0); pauseCtx->equipPageVtx = Graph_Alloc(gfxCtx, 60 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->equipPageVtx, 1, 0); + func_80823A0C(play, pauseCtx->equipPageVtx, 1, 0); if (!sInDungeonScene) { pauseCtx->mapPageVtx = Graph_Alloc(gfxCtx, 248 * sizeof(Vtx)); - phi_t3 = func_80823A0C(globalCtx, pauseCtx->mapPageVtx, 4, 32); + phi_t3 = func_80823A0C(play, pauseCtx->mapPageVtx, 4, 32); for (phi_t2 = 0, phi_t5 = 58; phi_t2 < 15; phi_t2++, phi_t3 += 4, phi_t5 -= 9) { pauseCtx->mapPageVtx[phi_t3 + 2].v.ob[0] = -108; @@ -2624,11 +2624,11 @@ void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->mapPageVtx[phi_t3 - 2].v.tc[1] = pauseCtx->mapPageVtx[phi_t3 - 1].v.tc[1] = 0x40; } else { pauseCtx->mapPageVtx = Graph_Alloc(gfxCtx, 128 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->mapPageVtx, 2, 17); + func_80823A0C(play, pauseCtx->mapPageVtx, 2, 17); } pauseCtx->questPageVtx = Graph_Alloc(gfxCtx, 60 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->questPageVtx, 3, 0); + func_80823A0C(play, pauseCtx->questPageVtx, 3, 0); pauseCtx->cursorVtx = Graph_Alloc(gfxCtx, 20 * sizeof(Vtx)); @@ -2997,11 +2997,11 @@ void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->infoPanelVtx = Graph_Alloc(gfxCtx, 28 * sizeof(Vtx)); pauseCtx->saveVtx = Graph_Alloc(gfxCtx, 80 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->saveVtx, 5, 5); + func_80823A0C(play, pauseCtx->saveVtx, 5, 5); } -void KaleidoScope_DrawGameOver(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void KaleidoScope_DrawGameOver(PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -3045,12 +3045,12 @@ void KaleidoScope_DrawGameOver(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void KaleidoScope_Draw(GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[0]; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void KaleidoScope_Draw(PlayState* play) { + Input* input = &play->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); pauseCtx->stickRelX = input->rel.stick_x; pauseCtx->stickRelY = input->rel.stick_y; @@ -3067,32 +3067,32 @@ void KaleidoScope_Draw(GlobalContext* globalCtx) { { KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); - func_800949A8_KAL(globalCtx->state.gfxCtx); - KaleidoScope_InitVertices(globalCtx, globalCtx->state.gfxCtx); - KaleidoScope_DrawPages(globalCtx, globalCtx->state.gfxCtx); + func_800949A8_KAL(play->state.gfxCtx); + KaleidoScope_InitVertices(play, play->state.gfxCtx); + KaleidoScope_DrawPages(play, play->state.gfxCtx); - func_800949A8_KAL(globalCtx->state.gfxCtx); + func_800949A8_KAL(play->state.gfxCtx); gDPSetCombineLERP(POLY_KAL_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); if (!((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11))) { - KaleidoScope_DrawInfoPanel(globalCtx); + KaleidoScope_DrawInfoPanel(play); } } if ((pauseCtx->state >= 0xB) && (pauseCtx->state <= 0x11)) { - KaleidoScope_DrawGameOver(globalCtx); + KaleidoScope_DrawGameOver(play); } if ((pauseCtx->debugState == 1) || (pauseCtx->debugState == 2)) { - KaleidoScope_DrawDebugEditor(globalCtx); + KaleidoScope_DrawDebugEditor(play); } - func_800AAA50(&globalCtx->view, 15); + func_800AAA50(&play->view, 15); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } uint32_t _bswap32(uint32_t a) @@ -3129,15 +3129,15 @@ void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount) { } } -void func_808265BC(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void func_808265BC(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; pauseCtx->eye.x += D_8082ABAC[pauseCtx->mode] * ZREG(46); pauseCtx->eye.z += D_8082ABCC[pauseCtx->mode] * ZREG(46); pauseCtx->unk_1EA += 4 * ZREG(46); if (pauseCtx->unk_1EA == (64 * ZREG(47))) { - func_80084BF4(globalCtx, 1); + func_80084BF4(play, 1); for (int buttonIndex = 0; buttonIndex < ARRAY_COUNT(gSaveContext.buttonStatus); buttonIndex++) { gSaveContext.buttonStatus[buttonIndex] = D_8082AB6C[pauseCtx->pageIndex][buttonIndex]; @@ -3159,7 +3159,7 @@ void func_808265BC(GlobalContext* globalCtx) { pauseCtx->unk_1E4 = 0; pauseCtx->state++; pauseCtx->alpha = 255; - Interface_LoadActionLabelB(globalCtx, DO_ACTION_SAVE); + Interface_LoadActionLabelB(play, DO_ACTION_SAVE); } else if (pauseCtx->unk_1EA == 64) { pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode]; pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1; @@ -3250,8 +3250,8 @@ void KaleidoScope_UpdateCursorSize(PauseContext* pauseCtx) { pauseCtx->cursorVtx[14].v.ob[1] = pauseCtx->cursorVtx[15].v.ob[1] = pauseCtx->cursorVtx[12].v.ob[1] - 16; } -void KaleidoScope_LoadDungeonMap(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void KaleidoScope_LoadDungeonMap(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; char* firstTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX]; char* secondTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX + 1]; @@ -3260,38 +3260,38 @@ void KaleidoScope_LoadDungeonMap(GlobalContext* globalCtx) { memcpy(interfaceCtx->mapSegment + 0x800, ResourceMgr_LoadTexByName(secondTextureName), ResourceMgr_LoadTexSizeByName(secondTextureName)); } -void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void KaleidoScope_UpdateDungeonMap(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; - osSyncPrintf("MAP DMA = %d\n", globalCtx->interfaceCtx.mapPaletteIndex); + osSyncPrintf("MAP DMA = %d\n", play->interfaceCtx.mapPaletteIndex); - KaleidoScope_LoadDungeonMap(globalCtx); - Map_SetFloorPalettesData(globalCtx, pauseCtx->dungeonMapSlot - 3); + KaleidoScope_LoadDungeonMap(play); + Map_SetFloorPalettesData(play, pauseCtx->dungeonMapSlot - 3); - if ((globalCtx->sceneNum >= SCENE_YDAN) && (globalCtx->sceneNum <= SCENE_TAKARAYA)) { + if ((play->sceneNum >= SCENE_YDAN) && (play->sceneNum <= SCENE_TAKARAYA)) { if ((VREG(30) + 3) == pauseCtx->cursorPoint[PAUSE_MAP]) { KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment, 2040, interfaceCtx->mapPaletteIndex, 14); } } - if ((globalCtx->sceneNum >= SCENE_YDAN) && (globalCtx->sceneNum <= SCENE_TAKARAYA)) { + if ((play->sceneNum >= SCENE_YDAN) && (play->sceneNum <= SCENE_TAKARAYA)) { if ((VREG(30) + 3) == pauseCtx->cursorPoint[PAUSE_MAP]) { KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment + 0x800, 2040, interfaceCtx->mapPaletteIndex, 14); } } } -void KaleidoScope_Update(GlobalContext* globalCtx) +void KaleidoScope_Update(PlayState* play) { static s16 D_8082B258 = 0; static s16 D_8082B25C = 10; static s16 D_8082B260 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + GameOverContext* gameOverCtx = &play->gameOverCtx; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; size_t size = 0; size_t size0 = 0; size_t size1 = 0; @@ -3309,14 +3309,14 @@ void KaleidoScope_Update(GlobalContext* globalCtx) if ((!pauseCtx->unk_1E4 || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->state == 6)) { pauseCtx->stickRelX = input->rel.stick_x; pauseCtx->stickRelY = input->rel.stick_y; - KaleidoScope_UpdateCursorSize(&globalCtx->pauseCtx); + KaleidoScope_UpdateCursorSize(&play->pauseCtx); KaleidoScope_HandlePageToggles(pauseCtx, input); } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 5))) { - KaleidoScope_UpdateCursorSize(&globalCtx->pauseCtx); + KaleidoScope_UpdateCursorSize(&play->pauseCtx); } if (pauseCtx->state == 6) { - KaleidoScope_UpdateNamePanel(globalCtx); + KaleidoScope_UpdateNamePanel(play); } } @@ -3335,9 +3335,9 @@ void KaleidoScope_Update(GlobalContext* globalCtx) pauseCtx->unk_204 = -314.0f; - pauseCtx->playerSegment = (void*)(((uintptr_t)globalCtx->objectCtx.spaceStart + 0x30) & ~0x3F); + pauseCtx->playerSegment = (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F); - size1 = func_80091738(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime); + size1 = func_80091738(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime); osSyncPrintf("プレイヤー size1=%x\n", size1); pauseCtx->iconItemSegment = (void*)(((uintptr_t)pauseCtx->playerSegment + size1 + 0xF) & ~0xF); @@ -3360,7 +3360,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) //pauseCtx->iconItemAltSegment = (void*)(((uintptr_t)pauseCtx->iconItem24Segment + size + 0xF) & ~0xF); #endif - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -3389,7 +3389,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) interfaceCtx->mapPalette[28] = 6; interfaceCtx->mapPalette[29] = 99; - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); break; default: @@ -3430,7 +3430,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) osSyncPrintf("サイズ=%x\n", size2 + size1 + size0 + size); osSyncPrintf("item_name I_N_PT=%x\n", 0x800); - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); osSyncPrintf("サイズ=%x\n", size2 + size1 + size0 + size + 0x800); if (((void)0, gSaveContext.worldMapArea) < 22) { @@ -3452,8 +3452,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) PreRender_Init(&sPlayerPreRender); PreRender_SetValuesSave(&sPlayerPreRender, 64, 112, pauseCtx->playerSegment, NULL, sPreRenderCvg); - KaleidoScope_DrawPlayerWork(globalCtx); - //KaleidoScope_SetupPlayerPreRender(globalCtx); + KaleidoScope_DrawPlayerWork(play); + //KaleidoScope_SetupPlayerPreRender(play); #endif for (i = 0; i < ARRAY_COUNT(pauseCtx->worldMapPoints); i++) { pauseCtx->worldMapPoints[i] = 0; @@ -3681,7 +3681,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) case 4: if (pauseCtx->unk_1F4 == 160.0f) { - KaleidoScope_SetDefaultCursor(globalCtx); + KaleidoScope_SetDefaultCursor(play); //OTRTODO - Player on pause //KaleidoScope_ProcessPlayerPreRender(); } @@ -3700,14 +3700,14 @@ void KaleidoScope_Update(GlobalContext* globalCtx) pauseCtx->state = 5; } - func_808265BC(globalCtx); + func_808265BC(play); break; case 5: pauseCtx->alpha += (u16)(255 / (WREG(6) + WREG(4))); - func_808265BC(globalCtx); + func_808265BC(play); if (pauseCtx->state == 6) { - KaleidoScope_UpdateNamePanel(globalCtx); + KaleidoScope_UpdateNamePanel(play); } break; @@ -3719,7 +3719,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) if (CVar_GetS32("gCheatEasyPauseBufferEnabled", 0)) { CVar_SetS32("gCheatEasyPauseBufferFrameAdvance", 13); } - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = 0x12; WREG(2) = -6240; func_800F64E0(0); @@ -3740,7 +3740,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) break; case 1: - func_808237B4(globalCtx, globalCtx->state.input); + func_808237B4(play, play->state.input); break; case 2: @@ -3752,7 +3752,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) break; case 3: - KaleidoScope_UpdateItemEquip(globalCtx); + KaleidoScope_UpdateItemEquip(play); break; case 4: @@ -3763,7 +3763,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) if (CHECK_BTN_ALL(input->press.button, BTN_START)) { Audio_OcaSetInstrument(0); - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = 0x12; WREG(2) = -6240; func_800F64E0(0); @@ -3815,7 +3815,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) case 8: if (CHECK_BTN_ALL(input->press.button, BTN_START)) { Audio_OcaSetInstrument(0); - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = 0x12; WREG(2) = -6240; func_800F64E0(0); @@ -3862,7 +3862,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) case 1: if (CHECK_BTN_ALL(input->press.button, BTN_A)) { if (pauseCtx->promptChoice != 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] = @@ -3876,13 +3876,13 @@ void KaleidoScope_Update(GlobalContext* globalCtx) } else { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Gameplay_PerformSave(globalCtx); + Play_PerformSave(play); pauseCtx->unk_1EC = 4; D_8082B25C = CVar_GetS32("gSkipSaveConfirmation", 0) ? 3 /* 0.1 sec */ : 90 /* 3 secs */; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->unk_1EC = 2; WREG(2) = -6240; YREG(8) = pauseCtx->unk_204; @@ -3899,7 +3899,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) case 4: if (CHECK_BTN_ALL(input->press.button, BTN_B) || CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START) || (--D_8082B25C == 0)) { - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] = @@ -3961,7 +3961,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) Interface_ChangeAlpha(1); #if 1 - pauseCtx->iconItemSegment = (void*)(((uintptr_t)globalCtx->objectCtx.spaceStart + 0x30) & ~0x3F); + pauseCtx->iconItemSegment = (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F); size0 = (uintptr_t)_icon_item_staticSegmentRomEnd - (uintptr_t)_icon_item_staticSegmentRomStart; osSyncPrintf("icon_item size0=%x\n", size0); DmaMgr_SendRequest1(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, size0, @@ -4118,8 +4118,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); pauseCtx->promptChoice = 0; - Gameplay_SaveSceneFlags(globalCtx); - gSaveContext.savedSceneNum = globalCtx->sceneNum; + Play_SaveSceneFlags(play); + gSaveContext.savedSceneNum = play->sceneNum; Save_SaveFile(); pauseCtx->state = 0xF; D_8082B25C = CVar_GetS32("gSkipSaveConfirmation", 0) ? 3 /* 0.1 sec */ : 90 /* 3 secs */; @@ -4145,7 +4145,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) if (pauseCtx->promptChoice == 0) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Gameplay_SaveSceneFlags(globalCtx); + Play_SaveSceneFlags(play); switch (gSaveContext.entranceIndex) { case 0x0000: @@ -4208,10 +4208,10 @@ void KaleidoScope_Update(GlobalContext* globalCtx) pauseCtx->state = 0; R_UPDATE_RATE = 3; R_PAUSE_MENU_MODE = 0; - func_800981B8(&globalCtx->objectCtx); - func_800418D0(&globalCtx->colCtx, globalCtx); + func_800981B8(&play->objectCtx); + func_800418D0(&play->colCtx, play); if (pauseCtx->promptChoice == 0) { - Gameplay_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; gSaveContext.nextTransition = 2; gSaveContext.health = 0x30; @@ -4229,8 +4229,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) osSyncPrintf("Z_MAGIC_NOW_NOW=%d\n", gSaveContext.unk_13F6); osSyncPrintf(VT_RST); } else { - globalCtx->state.running = 0; - SET_NEXT_GAMESTATE(&globalCtx->state, Opening_Init, OpeningContext); + play->state.running = 0; + SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext); } } } @@ -4256,7 +4256,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) pauseCtx->unk_1F8 = 160.0f; pauseCtx->unk_1F4 = 160.0f; pauseCtx->namedItem = PAUSE_ITEM_NONE; - globalCtx->interfaceCtx.startAlpha = 0; + play->interfaceCtx.startAlpha = 0; } break; @@ -4267,10 +4267,10 @@ void KaleidoScope_Update(GlobalContext* globalCtx) CVar_SetS32("gPauseTriforce", 0); - func_800981B8(&globalCtx->objectCtx); - func_800418D0(&globalCtx->colCtx, globalCtx); + func_800981B8(&play->objectCtx); + func_800418D0(&play->colCtx, play); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -4289,7 +4289,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) case SCENE_MIZUSIN_BS: case SCENE_JYASINBOSS: case SCENE_HAKADAN_BS: - Map_InitData(globalCtx, globalCtx->interfaceCtx.mapRoomNum); + Map_InitData(play, play->interfaceCtx.mapRoomNum); break; } @@ -4303,7 +4303,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) gSaveContext.unk_13EA = 0; Interface_ChangeAlpha(gSaveContext.unk_13EE); player->targetActor = NULL; - Player_SetEquipmentData(globalCtx, player); + Player_SetEquipmentData(play, player); osSyncPrintf(VT_RST); break; } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 57d13edb9..5a464f4dd 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -35,7 +35,7 @@ static const u32 sLineBytesImageSizes[] = { 0, 1, 2, 2 }; extern PauseMapMarksData gPauseMapMarkDataTable[]; extern PauseMapMarksData gPauseMapMarkDataTableMasterQuest[]; -void PauseMapMark_Init(GlobalContext* globalCtx) { +void PauseMapMark_Init(PlayState* play) { gBossMarkState = 0; gBossMarkScale = 1.0f; if(ResourceMgr_IsGameMasterQuest()) { @@ -45,11 +45,11 @@ void PauseMapMark_Init(GlobalContext* globalCtx) { } } -void PauseMapMark_Clear(GlobalContext* globalCtx) { +void PauseMapMark_Clear(PlayState* play) { gLoadedPauseMarkDataTable = NULL; } -void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { +void PauseMapMark_DrawForDungeon(PlayState* play) { PauseMapMarkData* mapMarkData; PauseMapMarkPoint* markPoint; PauseMapMarkInfo* markInfo; @@ -58,15 +58,15 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { mapMarkData = &gLoadedPauseMarkDataTable[R_MAP_TEX_INDEX >> 1][i]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); while (true) { if (mapMarkData->markType == PAUSE_MAP_MARK_NONE) { break; } - if ((mapMarkData->markType == PAUSE_MAP_MARK_BOSS) && (globalCtx->sceneNum >= SCENE_YDAN_BOSS) && - (globalCtx->sceneNum <= SCENE_GANON_FINAL)) { + if ((mapMarkData->markType == PAUSE_MAP_MARK_BOSS) && (play->sceneNum >= SCENE_YDAN_BOSS) && + (play->sceneNum <= SCENE_GANON_FINAL)) { if (gBossMarkState == 0) { Math_ApproachF(&gBossMarkScale, 1.5f, 1.0f, 0.041f); if (gBossMarkScale == 1.5f) { @@ -85,7 +85,7 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { Matrix_Push(); - if ((globalCtx->pauseCtx.state == 4) || (globalCtx->pauseCtx.state >= 0x12)) { + if ((play->pauseCtx.state == 4) || (play->pauseCtx.state >= 0x12)) { Matrix_Translate(-36.0f, 101.0f, 0.0f, MTXMODE_APPLY); } else { Matrix_Translate(-36.0f, 21.0f, 0.0f, MTXMODE_APPLY); @@ -100,10 +100,10 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { s32 display; if (mapMarkData->markType == PAUSE_MAP_MARK_CHEST) { - if (Flags_GetTreasure(globalCtx, markPoint->chestFlag)) { + if (Flags_GetTreasure(play, markPoint->chestFlag)) { display = false; } else { - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN_BOSS: case SCENE_DDAN_BOSS: case SCENE_BDAN_BOSS: @@ -134,7 +134,7 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(GREG(92) + markPoint->x, GREG(93) + markPoint->y, 0.0f, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_Pop(); @@ -149,13 +149,13 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void PauseMapMark_Draw(GlobalContext* globalCtx) { - PauseMapMark_Init(globalCtx); +void PauseMapMark_Draw(PlayState* play) { + PauseMapMark_Init(play); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -166,9 +166,9 @@ void PauseMapMark_Draw(GlobalContext* globalCtx) { case SCENE_HAKADAN: case SCENE_HAKADANCH: case SCENE_ICE_DOUKUTO: - PauseMapMark_DrawForDungeon(globalCtx); + PauseMapMark_DrawForDungeon(play); break; } - PauseMapMark_Clear(globalCtx); + PauseMapMark_Clear(play); }